@progress/kendo-editor-common 1.11.8 → 1.11.9-dev.202411180546
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.KendoEditorCommon=t():e.KendoEditorCommon=t()}(self,(()=>(()=>{"use strict";var e={400:(e,t,n)=>{n.r(t),n.d(t,{browser:()=>d,detectDesktopBrowser:()=>u,detectMobileOS:()=>c,getter:()=>k,mobileOS:()=>h,msPointers:()=>m,parseInlineStyles:()=>_,pointers:()=>v,setter:()=>C,touch:()=>p,touchEnabled:()=>g});var r=function(){return"undefined"!=typeof window},o={wp:/(Windows Phone(?: OS)?)\s(\d+)\.(\d+(\.\d+)?)/,fire:/(Silk)\/(\d+)\.(\d+(\.\d+)?)/,android:/(Android|Android.*(?:Opera|Firefox).*?\/)\s*(\d+)(\.(\d+(\.\d+)?))?/,iphone:/(iPhone|iPod).*OS\s+(\d+)[\._]([\d\._]+)/,ipad:/(iPad).*OS\s+(\d+)[\._]([\d_]+)/,meego:/(MeeGo).+NokiaBrowser\/(\d+)\.([\d\._]+)/,webos:/(webOS)\/(\d+)\.(\d+(\.\d+)?)/,blackberry:/(BlackBerry|BB10).*?Version\/(\d+)\.(\d+(\.\d+)?)/,playbook:/(PlayBook).*?Tablet\s*OS\s*(\d+)\.(\d+(\.\d+)?)/,windows:/(MSIE)\s+(\d+)\.(\d+(\.\d+)?)/,tizen:/(tizen).*?Version\/(\d+)\.(\d+(\.\d+)?)/i,sailfish:/(sailfish).*rv:(\d+)\.(\d+(\.\d+)?).*firefox/i,ffos:/(Mobile).*rv:(\d+)\.(\d+(\.\d+)?).*Firefox/},i={ios:/^i(phone|pad|pod)$/i,android:/^android|fire$/i,blackberry:/^blackberry|playbook/i,windows:/windows/,wp:/wp/,flat:/sailfish|ffos|tizen/i,meego:/meego/},a={edge:/(edge)[ \/]([\w.]+)/i,webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,msie:/(msie\s|trident.*? rv:)([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i},s={omini:/Opera\sMini/i,omobile:/Opera\sMobi/i,firefox:/Firefox|Fennec/i,mobilesafari:/version\/.*safari/i,ie:/MSIE|Windows\sPhone/i,chrome:/chrome|crios/i,webkit:/webkit/i},l=function(e,t,n){for(var r in t)if(t.hasOwnProperty(r)&&t[r].test(e))return r;return void 0!==n?n:e},c=function(e){var t,n=[];for(var r in o)if(o.hasOwnProperty(r)){if(!(n=e.match(o[r])))continue;if("windows"===r&&"plugins"in window.navigator)return null;var a={};return a.device=r,a.browser=l(e,s,"default"),a.name=l(r,i),a[a.name]=!0,a.majorVersion=n[2],a.minorVersion=n[3]?n[3].replace("_","."):".0",t=a.minorVersion.replace(".","").substr(0,2),a.flatVersion=a.majorVersion+t+new Array(3-(t.length<3?t.length:2)).join("0"),a.cordova=void 0!==typeof window.PhoneGap||void 0!==typeof window.cordova,a.appMode=window.navigator.standalone||/file|local|wmapp/.test(window.location.protocol)||a.cordova,a}return null},u=function(e){var t=null,n=[];for(var r in a)if(a.hasOwnProperty(r)&&(n=e.match(a[r]))){(t={})[r]=!0,t[n[1].toLowerCase().split(" ")[0].split("/")[0]]=!0,t.version=parseInt(document.documentMode||n[2],10);break}return t},f=r()&&window.navigator?window.navigator.userAgent:null,d=f?u(f):null,h=f?c(f):null,p=r()&&"ontouchstart"in window,m=d&&!d.chrome&&window.MSPointerEvent,v=d&&!d.chrome&&window.PointerEvent,g=h&&(p||m||v),y=/\[(?:(\d+)|['"](.*?)['"])\]|((?:(?!\[.*?\]|\.).)+)/g;function b(e){var t=[];return e.replace(y,(function(e,n,r,o){t.push(void 0!==n?n:r||o)})),t}var w={};function k(e){if(w[e])return w[e];var t=b(e);return w[e]=function(e){for(var n=e,r=0;r<t.length&&n;r++)n=n[t[r]];return n},w[e]}w[void 0]=function(e){return e};var S={undefined:function(e){return e}},x=function(e,t){return t&&t.arrays&&!isNaN(Number(e))?[]:{}};function C(e){if(S[e])return S[e];var t=b(e);return S[e]=function(e,n,r){for(var o=e,i=t.length-1,a=0;a<i&&o;a++)o=o[t[a]]=o[t[a]]||x(t[a+1],r);o[t[i]]=n},S[e]}var O=/\/\*[\s\S]*?\*\//g,M=/([^\s:;]+?)\s*:\s*((?:(?:url\(\s*(?:(?:[^"')\\]|\\.)*|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')\s*\)|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[^;"'])*?)\s*)(?=;|$)/gi,T=/"|"|"/gi,A=/'|'|'/gi,N='"',R="'",D="";function _(e){for(var t,n,r={},o=(e||D).replace(O,D).replace(T,N).replace(A,R),i=M.exec(o);null!==i;)t=i[1].trim(),n=i[2].trim(),r[t]=n,i=M.exec(o);return r}},2066:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DOMSerializer=void 0;var r=n(3147),o=function(){function e(e,t){this.nodes=e,this.marks=t}return e.renderSpec=function(t,n,o){if(void 0===o&&(o=null),"string"==typeof n)return{dom:t.createTextNode(n)};if(null!=n.nodeType)return{dom:n};if(n.dom&&null!=n.dom.nodeType)return n;var i,a=n[0],s=a.indexOf(" ");s>0&&(o=a.slice(0,s),a=a.slice(s+1));var l=o?t.createElementNS(o,a):t.createElement(a),c=n[1],u=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c))for(var f in u=2,c)null!=c[f]&&((s=f.indexOf(" "))>0?l.setAttributeNS(f.slice(0,s),f.slice(s+1),c[f]):(0,r.setAttribute)(l,f,c[f]));for(var d=u;d<n.length;d++){var h=n[d];if(0===h){if(d<n.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}var p=e.renderSpec(t,h,o),m=p.dom,v=p.contentDOM;if(l.appendChild(m),v){if(i)throw new RangeError("Multiple content holes");i=v}}return{dom:l,contentDOM:i}},e.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))},e.nodesFromSchema=function(e){var t=i(e.nodes);return t.text||(t.text=function(e){return e.text}),t},e.marksFromSchema=function(e){return i(e.marks)},e.prototype.serializeFragment=function(e,t,n){var r=this;void 0===t&&(t={}),n||(n=a(t).createDocumentFragment());var o=n,i=[];return e.forEach((function(e){if(i.length||e.marks.length){for(var n=0,a=0;n<i.length&&a<e.marks.length;){var s=e.marks[a];if(r.marks[s.type.name]){if(!s.eq(i[n][0])||!1===s.type.spec.spanning)break;n++,a++}else a++}for(;n<i.length;)o=i.pop()[1];for(;a<e.marks.length;){var l=e.marks[a++],c=r.serializeMark(l,e.isInline,t);c&&(i.push([l,o]),o.appendChild(c.dom),o=c.contentDOM||c.dom)}}o.appendChild(r.serializeNodeInner(e,t))})),n},e.prototype.serializeNode=function(e,t){void 0===t&&(t={});for(var n=this.serializeNodeInner(e,t),r=e.marks.length-1;r>=0;r--){var o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},e.prototype.serializeMark=function(t,n,r){void 0===r&&(r={});var o=this.marks[t.type.name];return o&&e.renderSpec(a(r),o(t,n))},e.prototype.serializeNodeInner=function(t,n){var r=e.renderSpec(a(n),this.nodes[t.type.name](t)),o=r.dom,i=r.contentDOM;if(i){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,i)}return o},e}();function i(e){var t={};for(var n in e)if(e[n]){var r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function a(e){return e.document||window.document}t.DOMSerializer=o},510:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isAligned=t.alignBlocks=void 0;var r=n(452);t.alignBlocks=function(e,t){return function(n,o){var i=(0,r.blockNodes)(n),a=n.tr;a.setMeta("commandName",t),i.forEach((function(t){if(t.type.isTextblock){var n=e.find((function(e){return e.node===t.type.name}));if(n){var o=(0,r.addStyles)(t,n.style);(0,r.changeTextBlock)(a,t,t.type,o)}}}));var s=a.docChanged;return s&&o(a.scrollIntoView()),s}},t.isAligned=function(e,t){var n=(0,r.blockNodes)(e),o=!1;return n.forEach((function(e){if(!o&&e.type.isTextblock&&e.attrs.style){var n=t.find((function(t){return t.node===e.type.name}));n&&(o=n.style.every((function(t){return!!t.value&&new RegExp("".concat(t.name,":\\s?").concat(t.value),"i").test(e.attrs.style)})))}})),o}},452:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.activeNode=t.parentBlockFormat=t.hasNode=t.addStyles=t.getBlockFormats=t.cleanTextBlockFormatting=t.formatBlockElements=t.blockNodes=t.changeTextBlock=void 0;var r=n(7582),o=n(3147),i=n(2843),a=n(9443),s=n(2391);t.changeTextBlock=function(e,t,n,r){if(!n.isTextblock)return!1;e.selection.ranges.forEach((function(o){var s=e.steps.length,l=o.$from.pos,c=o.$to.pos;e.doc.nodesBetween(l,c,(function(o,l){if(o.eq(t)&&o.isTextblock&&!o.hasMarkup(n,r)&&function(e,t,n){var r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(s).map(l),n)){e.clearIncompatible(e.mapping.slice(s).map(l,1),n);var c=e.mapping.slice(s),u=c.map(l,1),f=c.map(l+o.nodeSize,1),d=new a.Slice(a.Fragment.from(n.create(r,null,o.marks)),0,0);return e.step(new i.ReplaceAroundStep(u,f,u+1,f-1,d,1,!0)),!1}}))}))},t.blockNodes=function(e,t){void 0===t&&(t={blocksInSelection:!1});var n=e.doc,r=e.selection,o=r.$from,i=r.ranges,a=t.blocksInSelection,l=[],c=r instanceof s.NodeSelection?r.node:void 0;return c?c.isBlock?(l.push(c),c.nodesBetween(0,c.content.size,(function(e){e.isBlock&&l.push(e)}))):!a&&o.parent&&o.parent.isBlock&&l.push(o.parent):i.forEach((function(e){var t=e.$from.pos,r=e.$to.pos;n.nodesBetween(t,r,(function(e,n){e.isBlock&&(!a||n>=t&&n+e.content.size+2<=r)&&l.push(e)}))})),l},t.formatBlockElements=function(e,n){return function(o,i){var a=(0,t.blockNodes)(o),s=o.schema.nodes,l=o.tr;l.setMeta("commandName",n),l.setMeta("args",{value:e}),a.forEach((function(n){if(n.type.isTextblock)if("p"===e)(0,t.changeTextBlock)(l,n,s.paragraph,n.attrs);else if(/^h[1-6]$/i.test(e)){var o=parseInt(e.substr(1),10);(0,t.changeTextBlock)(l,n,s.heading,r.__assign(r.__assign({},n.attrs),{level:o}))}else"blockquote"===e&&(0,t.changeTextBlock)(l,n,s.blockquote,n.attrs)}));var c=l.docChanged;return c&&i(l.scrollIntoView()),c}},t.cleanTextBlockFormatting=function(e,n){void 0===n&&(n={blocksInSelection:!0});var o=e.doc,i=e.selection,a=n.blocksInSelection,s=n.blockNodeType;(0,t.blockNodes)({doc:o,selection:i},{blocksInSelection:a}).filter((function(e){return e.isTextblock})).forEach((function(n){var o=n.attrs||{},i=o.style,a=void 0===i?"":i,l=o.class,c=void 0===l?"":l,u=r.__rest(o,["style","class"]),f=s||n.type;(a||c||f!==n.type)&&(0,t.changeTextBlock)(e,n,f,u)}))},t.getBlockFormats=function(e){var n=(0,t.blockNodes)(e),r=e.schema.nodes,o=[];return n.forEach((function(e){e.type===r.paragraph?o.push("p"):e.type===r.heading?o.push("h".concat(e.attrs.level)):e.type===r.blockquote&&r.blockquote.isTextblock&&o.push("blockquote")})),o},t.addStyles=function(e,t){var n,r,i=e.attrs.style;return i&&t.forEach((function(e){r={style:e.name,value:/^.+$/,newValue:e.value},n=(0,o.changeStylesString)(i,r),i=n.changed?n.style:i})),i=i||t.reduce((function(e,t){return(e&&t.value?e+" ":"")+t.value?"".concat(t.name,": ").concat(t.value,";"):""}),""),Object.assign({},e.attrs,{style:i||null})},t.hasNode=function(e,t){var n=e.selection,r=n.from,o=n.to,i=!1;return e.doc.nodesBetween(r,o,(function(e){return!(i=i||e.type===t)})),i},t.parentBlockFormat=function(e){var n=(0,t.getBlockFormats)(e);return 1===new Set(n).size?n[0]:null},t.activeNode=function(e){return{tag:(0,t.parentBlockFormat)(e)||""}}},8933:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.liftBlockquote=t.blockquote=void 0;var r=n(9270);t.blockquote=function(e,t){return(0,r.wrapIn)(e.schema.nodes.blockquote)(e,t)},t.liftBlockquote=function(e,t){var n=e.selection,r=n.$from,o=n.$to,i=e.schema.nodes.blockquote,a=e.doc,s=-1,l=r.blockRange(o);l&&a.nodesBetween(l.start,l.end,(function(e,t){e.type===i&&(s=t)}));var c=-1!==s;return t&&c&&t(e.tr.lift(l,a.resolve(s).depth)),c}},9840:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cleanFormatting=void 0;var r=n(452),o=n(1542);t.cleanFormatting=function(e){return void 0===e&&(e={blocksInSelection:!0}),function(t,n){var i=t.tr,a=e.blocksInSelection,s=e.blockNodeType,l=(e.exceptMarks||[t.schema.marks.link]).filter(Boolean);(0,o.cleanMarks)(i,{except:l}),(0,r.cleanTextBlockFormatting)(i,{blocksInSelection:a,blockNodeType:s});var c=i.docChanged;return c&&n&&n(i),c}}},89:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.alignRemoveRules=t.alignJustifyRules=t.alignCenterRules=t.alignRightRules=t.alignLeftRules=void 0;var n=function(e,t){return{name:e,value:t}};t.alignLeftRules=[{node:"paragraph",style:[n("text-align","left")]},{node:"heading",style:[n("text-align","left")]},{node:"table_caption_external",style:[n("text-align","left")]}],t.alignRightRules=[{node:"paragraph",style:[n("text-align","right")]},{node:"heading",style:[n("text-align","right")]},{node:"table_caption_external",style:[n("text-align","right")]}],t.alignCenterRules=[{node:"paragraph",style:[n("text-align","center")]},{node:"heading",style:[n("text-align","center")]},{node:"table_caption_external",style:[n("text-align","center")]}],t.alignJustifyRules=[{node:"paragraph",style:[n("text-align","justify")]},{node:"heading",style:[n("text-align","justify")]},{node:"table_caption_external",style:[n("text-align","justify")]}],t.alignRemoveRules=[{node:"paragraph",style:[n("text-align","")]},{node:"heading",style:[n("text-align","")]},{node:"table_caption_external",style:[n("text-align","")]}]},4437:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unlink=t.link=t.superscript=t.subscript=t.strikethrough=t.underline=t.italic=t.bold=void 0,t.bold={mark:"strong",altMarks:["b"],altStyle:{name:"font-weight",value:/^(bold(er)?|[5-9]\d{2,})$/}},t.italic={mark:"em",altMarks:["i"],altStyle:{name:"font-style",value:/^italic$/i}},t.underline={mark:"u",altStyle:{name:"text-decoration",value:/^underline$/i}},t.strikethrough={mark:"del",altStyle:{name:"text-decoration",value:/^line-through$/i}},t.subscript={mark:"sub"},t.superscript={mark:"sup"},t.link={mark:"link"},t.unlink={mark:"link"}},3352:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dataResizeDirImage=t.dataResizeDirTable=t.resizeHandle=t.resizableWrap=t.resizableAttr=t.colgroupAttr=t.rowTypeAttr=void 0,t.rowTypeAttr="k-parent-node",t.colgroupAttr="k-colgroup-data",t.resizableAttr="k-resizable-node",t.resizableWrap="k-editor-resize-wrap-element",t.resizeHandle="k-editor-resize-handle",t.dataResizeDirTable="data-dir-table-resize",t.dataResizeDirImage="data-dir-image-resize"},2287:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.outdentRules=t.indentRules=void 0;var r=n(7582),o=n(8672);t.indentRules={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"}],listsTypes:r.__assign({},o.listsTypes)},t.outdentRules={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"}],listsTypes:r.__assign({},o.listsTypes)}},2866:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.buildListKeymap=t.buildKeymap=void 0;var r=n(7582),o=n(9270),i=n(8638),a=n(8665),s=n(1641),l=n(4437),c=n(3884),u=n(3147),f="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);t.buildKeymap=function(e,t){var n={},s=t&&t.applyToWord||!1;if(n["Mod-z"]=i.undo,n["Shift-Mod-z"]=i.redo,n.Backspace=(0,o.chainCommands)(a.undoInputRule,o.deleteSelection,o.joinBackward,o.selectNodeBackward),n.Enter=(0,o.chainCommands)(o.newlineInCode,o.createParagraphNear,o.liftEmptyBlock,o.splitBlockKeepMarks),f||(n["Mod-y"]=i.redo),e.marks.strong&&(n["Mod-b"]=(0,u.expandToWordWrap)(c.toggleInlineFormat,r.__assign(r.__assign({},l.bold),{applyToWord:s}))),e.marks.em&&(n["Mod-i"]=(0,u.expandToWordWrap)(c.toggleInlineFormat,r.__assign(r.__assign({},l.italic),{applyToWord:s}))),e.marks.u&&(n["Mod-u"]=(0,u.expandToWordWrap)(c.toggleInlineFormat,r.__assign(r.__assign({},l.underline),{applyToWord:s}))),e.nodes.hard_break){var d=e.nodes.hard_break,h=(0,o.chainCommands)(o.exitCode,(function(e,t){return t(e.tr.replaceSelectionWith(d.create()).scrollIntoView()),!0}));n["Shift-Enter"]=h}return n},t.buildListKeymap=function(e){var t={};return e.nodes.list_item&&(t.Enter=(0,s.splitListItemKeepMarks)(e.nodes.list_item)),t}},8672:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bulletList=t.orderedList=t.listsTypes=void 0;var r=n(7582);t.listsTypes={orderedList:"ordered_list",bulletList:"bullet_list",listItem:"list_item"},t.orderedList={listType:t.listsTypes.orderedList,types:r.__assign({},t.listsTypes)},t.bulletList={listType:t.listsTypes.bulletList,types:r.__assign({},t.listsTypes)}},4221:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.marks=t.nodes=t.parseStrColgroup=void 0;var r=n(7582),o=n(9443),i=n(1640),a=n(5643),s=n(3352),l=["blockquote",0],c=["hr"],u=["pre",["code",0]],f=["ol",0],d=["ul",0],h=["li",0],p=function(e){for(var t,n={},r=e.attributes,o=0;o<r.length;o++)n[(t=r[o]).name]=t.value;return n},m=function(e){var t={};return e.forEach((function(e){t[e]={default:null}})),t},v=function(){return m(["style","class","id"])},g=function(e,t){for(var n in e)if(n&&null!==e[n]&&n!==t)return!0;return!1},y=function(e,t){void 0===t&&(t=[]);var n={},r=function(r){r&&null!==e[r]&&!t.find((function(e){return e===r}))&&(n[r]=e[r])};for(var o in e)r(o);return n},b=function(e){var t;return(t={})[e]={name:e,inclusive:!0,parseDOM:[{tag:e}],toDOM:function(){return[e,0]}},t},w=r.__assign(r.__assign(r.__assign(r.__assign(r.__assign(r.__assign(r.__assign(r.__assign(r.__assign(r.__assign({link:{attrs:r.__assign(r.__assign({},v()),{href:{default:null},target:{default:null},title:{default:null}}),inclusive:!1,parseDOM:[{tag:"a",getAttrs:p}],toDOM:function(e){return["a",y(e.attrs),0]}}},b("strong")),b("b")),b("em")),b("i")),b("del")),b("sub")),b("sup")),b("code")),{style:{attrs:r.__assign({},v()),parseDOM:[{tag:"span",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["span",y(e.attrs),0]:["span",0]}}}),b("u"));t.marks=w;var k=function(e){var t;return(t={})[e]={default:null,getFromDOM:function(t){return t.getAttribute(e)},setDOMAttr:function(t,n){n[e]=t}},t},S=r.__assign(r.__assign(r.__assign(r.__assign(r.__assign({},k("style")),k("class")),k("id")),k("headers")),k("scope")),x={doc:{content:"colgroup*"},col:{attrs:m(["id","class","style","span"]),parseDOM:[{getAttrs:p,tag:"col"}],toDOM:function(e){return["col",e.attrs]}},colgroup:{attrs:m(["id","class","style","span"]),content:"col*",parseDOM:[{getAttrs:p,tag:"colgroup"}],toDOM:function(e){return["colgroup",e.attrs,0]}},text:{inline:!0,group:"inline"}},C=new o.Schema({nodes:x,marks:{}});t.parseStrColgroup=function(e){var t=(0,a.domToPmDoc)((0,a.htmlToFragment)(e),C,{preserveWhitespace:!1});return(0,a.pmDocToFragment)(t).firstChild};var O=(0,i.tableNodes)({tableGroup:"block",cellContent:"block+",cellAttributes:S});O.table_row.attrs=r.__assign(r.__assign({},O.table_row.attrs),m([s.rowTypeAttr,"style","class","id"])),O.table_row.toDOM=function(e){return["tr",y(e.attrs),0]},O.table_row.parseDOM=[{tag:"tr",getAttrs:p}],O.table.attrs=r.__assign(r.__assign({},O.table.attrs),m(["style","class","id",s.colgroupAttr,s.resizableAttr])),O.table.toDOM=function(e){var n=g(e.attrs)?y(e.attrs,[s.colgroupAttr,s.resizableAttr]):{},r=null;if(e.attrs[s.colgroupAttr]&&!function(e){for(var t=!1,n=e.child(0),r=0;r<n.childCount;r++)if(n.child(r).attrs.colwidth){t=!0;break}return t}(e)){var o=(0,t.parseStrColgroup)(e.attrs[s.colgroupAttr]);if(o){var i=Array.from(o.children).map((function(e){return["col",p(e)]}));r=["colgroup",p(o)].concat(i)}}return r?["table",n,r,["tbody",0]]:["table",n,["tbody",0]]},O.table.parseDOM=[{tag:"table",getAttrs:function(e){var t=p(e),n=Array.from(e.childNodes).find((function(e){return"COLGROUP"===e.nodeName}));return n&&(t[s.colgroupAttr]=n.outerHTML),t}}];var M=r.__assign({doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:r.__assign({},v()),parseDOM:[{tag:"p",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["p",y(e.attrs),0]:["p",0]}},table_wrapper:{content:"(table_caption_external | table)+",group:"block",defining:!0,attrs:{table:{default:null},style:{default:null}},parseDOM:[{tag:"div[table]",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["div",y(e.attrs),0]:["div",0]}},table_caption_external:{content:"inline+",group:"block",attrs:r.__assign({caption:{default:null}},v()),parseDOM:[{tag:"div[caption]",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["div",y(e.attrs),0]:["div",0]}},div:{content:"block*",group:"block",attrs:r.__assign({},v()),parseDOM:[{tag:"div",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["div",y(e.attrs),0]:["div",0]}},blockquote:{attrs:r.__assign({},v()),content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["blockquote",y(e.attrs),0]:l}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:function(){return c}},heading:{attrs:r.__assign(r.__assign({},v()),{level:{default:1}}),content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",getAttrs:function(e){return r.__assign(r.__assign({},p(e)),{level:1})}},{tag:"h2",getAttrs:function(e){return r.__assign(r.__assign({},p(e)),{level:2})}},{tag:"h3",getAttrs:function(e){return r.__assign(r.__assign({},p(e)),{level:3})}},{tag:"h4",getAttrs:function(e){return r.__assign(r.__assign({},p(e)),{level:4})}},{tag:"h5",getAttrs:function(e){return r.__assign(r.__assign({},p(e)),{level:5})}},{tag:"h6",getAttrs:function(e){return r.__assign(r.__assign({},p(e)),{level:6})}}],toDOM:function(e){return g(e.attrs,"level")?["h"+e.attrs.level,y(e.attrs,["level"]),0]:["h"+e.attrs.level,0]}},code_block:{content:"text*",marks:"",group:"block",code:!0,defining:!0,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM:function(){return u}},text:{inline:!0,group:"inline"},image:{inline:!0,attrs:r.__assign({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}},v()),group:"inline",draggable:!0,parseDOM:[{tag:"img",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["img",y(e.attrs)]:["img"]}},hard_break:{inline:!0,attrs:r.__assign({},v()),group:"inline",selectable:!1,parseDOM:[{tag:"br",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["br",y(e.attrs)]:["br"]}},ordered_list:{content:"list_item+",group:"block",attrs:r.__assign(r.__assign({},v()),{type:{default:null},order:{default:1}}),parseDOM:[{tag:"ol",getAttrs:function(e){return r.__assign(r.__assign({},p(e)),{order:e.hasAttribute("start")?parseInt(e.getAttribute("start")||"1",10):1})}}],toDOM:function(e){return 1===e.attrs.order?g(e.attrs,"order")?["ol",y(e.attrs,["order"]),0]:f:["ol",r.__assign(r.__assign({},y(e.attrs,["order"])),{start:e.attrs.order}),0]}},bullet_list:{content:"list_item+",group:"block",attrs:r.__assign({},v()),parseDOM:[{tag:"ul",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["ul",y(e.attrs),0]:d}},list_item:{content:"(paragraph | heading) block*",attrs:r.__assign({},v()),parseDOM:[{tag:"li",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["li",y(e.attrs),0]:h},defining:!0}},O);t.nodes=M},2582:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.replaceAll=t.replace=t.findAll=t.find=t.findAt=void 0;var r=n(7582),o=n(2391);t.findAt=function(e,t,n,r,i){var l,c,u,f,d,h,p=[],m=[],v=t.matchCase,g=t.matchWord,y=t.useRegExp,b=t.text;if(y&&(/^\\$/.test(b)||/[^\\]\\$/.test(b))&&(b=b.substring(0,b.length-1)),!b)return p;var w=v?"g":"gi",k=y?new RegExp(b,w):s(b,w);return e.nodesBetween(n,r,(function(t,s){if(i(p))return!1;t.inlineContent&&s+t.content.size>=n&&(m.length=0,t.nodesBetween(0,t.content.size,(function(t,v,y,b){if(i(p))return!1;var w=1+s+v;if(t.isText&&w+t.nodeSize>=n){if(d=t.text||"",h=y.childCount-1>=b+1&&y.child(b+1),m.push(n<=w?{text:d,start:w}:{text:d.slice(n-w),start:n}),h&&h.isText)return;for(c=m.map((function(e){return e.text})).join(""),l=k.exec(c);null!==l&&(u=m[0].start+l.index,f=u+l[0].length,n<=u&&r>=f&&a(l,g)&&p.push(o.TextSelection.create(e,u,f)),!i(p));)l=k.exec(c)}else m.length=0})))})),p},t.find=function(e,n){var o=n.backward,i=n.matchCyclic,a=r.__rest(n,["backward","matchCyclic"]),s=o?function(){return!1}:function(e){return e.length>0},l=e.doc,c=e.selection,u=[];return o?!(u=(0,t.findAt)(l,a,0,c.from,s)).length&&i&&(u=(0,t.findAt)(l,a,c.from,l.content.size,s)):!(u=(0,t.findAt)(l,a,c.to,l.content.size,s)).length&&i&&(u=(0,t.findAt)(l,a,0,c.to,s)),u.length?u[u.length-1]:null},t.findAll=function(e,n){return(0,t.findAt)(e,n,0,e.content.size,(function(){return!1}))},t.replace=function(e,t,n){var r=e.from,i=e.to;return n.insertText(t,r,i).setSelection(o.TextSelection.create(n.doc,r,r+t.length)),n},t.replaceAll=function(e,n,r){var o=(0,t.findAll)(e.doc,r);if(0===o.length)return null;for(var i=e.tr,a=o.length-1;a>=0;a--)i.insertText(n,o[a].from,o[a].to);return i};var i=/^[\s0-9~`!@#$%\^&*\(\)_\-=+\\|\[\]{};:'"\?/.,<>]?$/,a=function(e,t){if(t){if(!0===t){var n=e.input,r=n.charAt(e.index-1),o=n.charAt(e.index+e[0].length);return i.test(r)&&i.test(o)}return t(e)}return!0},s=function(e,t){var n=e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d").replace(/\s/g,"\\s");return new RegExp(n,t)}},8834:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.insertImage=void 0;var r=n(3147);t.insertImage=function(e){return function(t,n){var o=t.schema.nodes.image.createAndFill(e);(0,r.insertNode)(o)(t,(function(t){return n(t.setMeta("commandName","insertImage").setMeta("args",e))}))}}},648:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.outdent=t.indent=t.canBeIndented=t.canOutdentAsListItem=t.canIndentAsListItem=t.isIndented=t.indentBlocks=void 0;var r=n(4032),o=n(2287),i=n(452),a=n(3147),s=n(8933);t.indentBlocks=function(e,t,n){return function(r,o){var a=(0,i.blockNodes)(r),s=r.tr;s.setMeta("commandName",t),a.forEach((function(t){if(t.type.isTextblock){var r=void 0,o=e.find((function(e){return e.node===t.type.name}));if(o){var a="rtl"===n?o.rtlStyle:o.style,l={name:a,value:o.step>0?"".concat(o.step).concat(o.unit):""};if(t.attrs.style){var c=new RegExp("".concat(a,":\\s?(\\d+)").concat(o.unit),"i"),u=t.attrs.style.match(c);if(u){var f=parseFloat(u[1])+o.step;f=f<=0?"":f,l.value="".concat(f).concat(f?o.unit:"")}}r=(0,i.addStyles)(t,[l])}r&&(0,i.changeTextBlock)(s,t,t.type,r)}}));var l=s.docChanged;return l&&o(s.scrollIntoView()),l}},t.isIndented=function(e,t,n){var r=(0,i.blockNodes)(e),o=!1;return r.forEach((function(e){if(!o&&e.type.isTextblock&&e.attrs.style){var r=t.find((function(t){return t.node===e.type.name}));if(r){var i="rtl"===n?r.rtlStyle:r.style,a=new RegExp("".concat(i,":\\s?\\d+").concat(r.unit),"i");o=a.test(e.attrs.style)}}})),o},t.canIndentAsListItem=function(e,t){return(0,r.sinkListItem)(t)(e)},t.canOutdentAsListItem=function(e,t){var n=e.schema.nodes[t.listsTypes.listItem],o=e.schema.nodes[t.listsTypes.orderedList],i=e.schema.nodes[t.listsTypes.bulletList],s=!!(0,a.findNthParentNodeOfType)(o,2)(e.selection),l=!!(0,a.findNthParentNodeOfType)(i,2)(e.selection);return(s||l)&&(0,r.liftListItem)(n)(e)},t.canBeIndented=function(e,n){var r=e.schema.nodes,a=r[o.indentRules.listsTypes.listItem];return((0,t.isIndented)(e,n.nodes)||o.indentRules.nodes.some((function(t){return r[t.node]&&(0,i.hasNode)(e,r[t.node])})))&&!(0,i.hasNode)(e,a)},t.indent=function(e,n){var i=e.schema.nodes[o.indentRules.listsTypes.listItem],a=(0,t.canBeIndented)(e,o.indentRules);(0,t.canIndentAsListItem)(e,i)?(0,r.sinkListItem)(i)(e,n):a&&(0,t.indentBlocks)(o.indentRules.nodes)(e,n)},t.outdent=function(e,n){var a=e.schema.nodes,l=a[o.outdentRules.listsTypes.listItem],c=(0,t.canBeIndented)(e,o.outdentRules);(0,i.hasNode)(e,a.blockquote)?(0,s.liftBlockquote)(e,n):(0,t.canOutdentAsListItem)(e,o.outdentRules)?(0,r.liftListItem)(l)(e,n):c&&(0,t.indentBlocks)(o.outdentRules.nodes)(e,n)}},3884:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.applyInlineStyle=t.toggleInlineFormat=t.getInlineStyles=void 0;var r=n(7582),o=n(2843),i=n(2391),a=n(3147),s=n(1542),l=function(e,t){var n=e.find((function(e){return"style"===e.type.name})),r=n&&n.attrs.style;return(0,a.changeStylesString)(r,t)},c=function(e,t,n,i,a){var s=a.create({style:i.style}),c=[],u=[],f=null,d=null;return e.doc.nodesBetween(t,n,(function(e,h,p){if(e.isInline){var m=e.marks;if(!s.isInSet(m)&&p.type.allowsMarkType(s.type)){var v=Math.max(h,t),g=Math.min(h+e.nodeSize,n),y=l(m,i);if(y.changed||i.newValue){for(var b=y.changed?{style:y.style||null}:{style:"".concat([i.style],": ").concat(i.newValue,";")},w=a.isInSet(m)?m.find((function(e){return"style"===e.type.name})):null,k=w?r.__assign(r.__assign({},w.attrs),b):b,S=a.create(k),x=S.addToSet(m),C=0;C<m.length;C++)m[C].isInSet(x)||(f&&f.to===v&&f.mark.eq(m[C])?f.to=g:(f=new o.RemoveMarkStep(v,g,m[C]),c.push(f)));var O=d&&d.to===v,M=O&&S.attrs.style===d.mark.attrs.style;O&&M?d.to=g:Object.keys(k).some((function(e){return null!==k[e]}))&&(d=new o.AddMarkStep(v,g,S),u.push(d))}}}})),c.forEach((function(t){return e.step(t)})),u.forEach((function(t){return e.step(t)})),c.length+u.length>0};t.getInlineStyles=function(e,t){var n=e.schema.marks.style;return(n?(0,s.selectionMarks)(e,n):[]).map((function(e){return(0,s.styleValue)(e,t)})).filter((function(e){return null!==e}))};var u=function(e,t){return function(n,o,u){var f=n.selection,d=f.empty,h=f.ranges,p=n.selection instanceof i.TextSelection&&n.selection.$cursor;if(d&&!p||!(0,s.markApplies)(n.doc,h,e))return!1;var m=!1;if(o){var v=u||n.tr;if(p){var g=n.storedMarks||p.marks();if(e.isInSet(g)){var y=l(g,t),b=g.find((function(e){return"style"===e.type.name})),w=r.__assign(r.__assign({},b?b.attrs:{}),{style:y.style||null});if((0,a.shallowEqual)(b.attrs,w))return!1;o(v.removeStoredMark(e)),Object.keys(w).some((function(e){return null!==w[e]}))&&o(v.addStoredMark(e.create(w))),m=!0}}else{for(var k=0;k<h.length;k++){var S=h[k],x=S.$from,C=S.$to;m=c(v,x.pos,C.pos,t,e)||m}m&&(v.scrollIntoView(),o(v))}}return m}};t.toggleInlineFormat=function(e,t,n){return function(o,i){var a=o.schema.marks,l=e.altStyle,c=e.altMarks,f=void 0===c?[]:c,d=e.mark,h=t||o.tr,p=!1,m=!1,v=function(){return m=!0};l&&a.style&&(p=u(a.style,{style:l.name,value:l.value})(o,v,h));var g=r.__spreadArray([d],f,!0).filter((function(e){return a[e]})).map((function(e){return(0,s.hasMark)(o,{mark:e})&&a[e]})).filter((function(e){return e}));return g.length?(0,s.removeMarks)(g,o,v,h):p||(0,s.toggleMark)(a[d],n,h)(o,v),m&&i(h),m}},t.applyInlineStyle=function(e,t){return function(n,o){var i=n.schema.marks.style,l={style:e.style,value:/^.+$/,newValue:e.value},c=n.tr;t&&c.setMeta("commandName",t),c.setMeta("args",e);var f=n.selection,d=f.empty,h=f.$cursor,p=f.ranges;if(d&&!h||!i||!(0,s.markApplies)(n.doc,p,i))return!1;if(h){var m=n.storedMarks||h.marks(),v=i.isInSet(m)?m.find((function(e){return"style"===e.type.name})):null,g={style:null};if(v&&v.attrs.style){var y=(0,a.changeStylesString)(v.attrs.style,l);y.changed&&y.style&&(g.style=y.style)}else l.newValue&&(g.style="".concat([l.style],": ").concat(l.newValue,";"));var b=v?r.__assign(r.__assign({},v.attrs),g):g;return Object.keys(b).some((function(e){return null!==b[e]}))?o(c.addStoredMark(i.create(b))):o(c.removeStoredMark(i)),!0}return u(i,l)(n,o,c)}}},1504:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.applyLink=t.removeLink=void 0;var r=n(3884),o=n(1542),i=n(2391);t.removeLink=function(e,t){return function(n,i){var a=n.selection.$cursor;if(a){var s=a.parent,l=a.index(),c=n.schema.marks[e.mark],u=s.child(l).marks.find((function(e){return e.type===c})),f=s.childCount,d=a.pos-a.textOffset,h=s.child(l).nodeSize,p=void 0,m=void 0;for(p=l-1;p>=0&&u.isInSet(s.child(p).marks);)h+=m=s.child(p).nodeSize,d-=m,p-=1;for(p=l+1;p<f&&u.isInSet(s.child(p).marks);)h+=s.child(p).nodeSize,p+=1;i((0,o.removeMark)(t||n.tr,d,d+h,u))}else(0,r.toggleInlineFormat)(e,t)(n,i)}},t.applyLink=function(e,n){var a=e.mark,s=e.attrs;return void 0===n&&(n="link"),function(e,l){var c=e.schema.marks,u=e.tr;n&&(u.setMeta("commandName",n),u.setMeta("args",s));var f=!1,d=function(){return f=!0};if(function(e,t){var n=(0,o.selectionMarks)(e,t);return 1===n.length&&n[0]?n[0]:null}(e,c[a]))!function(e,t){return function(n,r){var o=n.selection,i=o.$cursor,a=o.from,s=o.to,l=n.schema.marks[e.mark];if(i){var c=i.parent,u=i.index(),f=c.child(u).marks.find((function(e){return e.type===l})),d=c.childCount,h=i.pos-i.textOffset,p=c.child(u).nodeSize,m=void 0,v=void 0;for(m=u-1;m>=0&&f.isInSet(c.child(m).marks);)p+=v=c.child(m).nodeSize,h-=v,m-=1;for(m=u+1;m<d&&f.isInSet(c.child(m).marks);)p+=c.child(m).nodeSize,m+=1;t.removeMark(h,h+p,l),t.addMark(h,h+p,l.create(e.attrs)),r(t)}else t.doc.nodesBetween(a,s,(function(n,o){n.isInline&&l.isInSet(n.marks)&&(t.removeMark(o,o+n.nodeSize,l),t.addMark(o,o+n.nodeSize,l.create(e.attrs)),r(t))}))}}({mark:a,attrs:s},u)(e,d);else{var h=e;(0,o.hasMark)(e,{mark:a})&&((0,t.removeLink)({mark:a,attrs:s},u)(e,d),h=i.EditorState.create({doc:u.doc,selection:u.selection})),f?(0,o.toggleMark)(c[a],s,u)(h,d):(0,r.toggleInlineFormat)({mark:a},u,s)(h,d)}return f&&l(u),f}}},1628:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertMsLists=void 0;var r=n(5643),o=/style=['"]?[^'"]*?mso-list:\s*[a-zA-Z]+(\d+)\s[a-zA-Z]+(\d+)\s(\w+)/gi,i=function(e){return/^MsoListParagraph/.test(e.className)},a=function(e){var t=e.innerHTML;return(t=t.replace(/<!--(.|\s)*?-->/gi,"")).replace(/<\/?[^>]+?\/?>/gm,"")},s=function(e,t){var n=document.createElement(e);return n.style.listStyleType=t,n},l=function(e){var t=null;return/^\d/.test(e)||(t=(/^[a-z]/.test(e)?"lower-":"upper-")+(/^[ivxlcdm]/i.test(e)?"roman":"alpha")),t},c=function(e,t){var n=[];Array.from(e).forEach((function(e){if(e.nodeType===Node.ELEMENT_NODE){var r=e;r.getAttribute("datalist")?(n.push(e),t.add(n)):i(r)&&n.length?n.push(e):(n=[],"DIV"===r.nodeName?c(r.children,t):"TABLE"===r.nodeName&&Array.from(r.querySelectorAll("td,th")).forEach((function(e){c(e.children,t)})))}}))},u=function(e){var t,n=e.innerHTML,r=function(e){return e.replace(/^(?: |[\u00a0\n\r\s])+/,"")};return n=n.replace(/<\/?\w+[^>]*>/g,"").replace(/ /g," "),/^[\u2022\u00b7\u00a7\u00d8oØüvn][\u00a0 ]+/.test(n)?{tag:"ul",style:(t=r(a(e)),/^[\u2022\u00b7\u00FC\u00D8\u002dv-]/.test(t)?null:/^o/.test(t)?"circle":"square")}:/^\s*\w+[\.\)][\u00a0 ]{2,}/.test(n)?{tag:"ol",style:l(r(a(e)))}:void 0},f=function(e){var t,n=e.nodeName.toLowerCase();e.firstChild&&e.firstChild.nodeType===Node.COMMENT_NODE&&e.removeChild(e.firstChild),1===e.childNodes.length?t=e.firstChild.nodeType===Node.TEXT_NODE?a(e):e.firstChild.innerHTML.replace(/^\w+[\.\)]( )+ /,""):(e.removeChild(e.firstChild),3===e.firstChild.nodeType&&/^[ivxlcdm]+\.$/i.test(e.firstChild.nodeValue)&&e.removeChild(e.firstChild),/^( |\s)+$/i.test(e.firstChild.innerHTML)&&e.removeChild(e.firstChild),t="p"!==n?"<"+n+">"+e.innerHTML+"</"+n+">":e.innerHTML),e.parentNode.removeChild(e);var o=document.createElement("li");return o.appendChild((0,r.htmlToFragment)(t)),o};t.convertMsLists=function(e){var t=(0,r.htmlToFragment)(function(e){return e.replace(o,(function(e,t,n){return'datalist="'.concat(t,'" datalevel="').concat(n,'" ').concat(e)}))}(e)),n=new Set;return c(t.children,n),n.forEach((function(e){return function(e){var t,n,r,o,a,l,c,d,h,p,m,v,g,y=-1,b={};for(d=0;d<e.length;d++){var w=(g={datalist:(h=e[d]).getAttribute("datalist"),datalevel:h.getAttribute("datalevel")}).datalist,k=u(h);if(p=k&&k.tag){if(m=g.datalevel||parseFloat(h.style.marginLeft||0),g.datalevel||h.style.marginLeft){var S=p+w;b[m]||(b[m]={}),(!n||n<0)&&(n=m,r=w,o=(c=e.filter((function(e){return e.getAttribute("datalist")===String(r)})))[c.length-1],l=s(p,k&&k.style),h.parentNode.insertBefore(l,h),y=m,b[m][S]=l),a=o===h,v=b[m][S],(m>y||!v)&&(v=s(p,k&&k.style),b[m][S]=v,t.appendChild(v)),t=f(h),v.appendChild(t),a?n=y=-1:y=m}}else!t||a&&!i(h)||(h.style.marginLeft&&(h.style.marginLeft=""),h.style.marginLeft&&(h.style.margin=""),t.appendChild(h))}}(e)})),(0,r.fragmentToHtml)(t)}},1641:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.splitListItemKeepMarks=t.toggleOrderedList=t.toggleUnorderedList=t.toggleList=t.listStyle=void 0;var r=n(7582),o=n(9443),i=n(2391),a=n(2843),s=n(9270),l=n(4032),c=n(8672),u=function(e,t,n){for(var r=t.depth,o=e.nodes[n.bulletList],i=e.nodes[n.orderedList],a=e.nodes[n.listItem],s=t.depth;s>0;s--){var l=t.node(s);if(l.type!==o&&l.type!==i||(r=s),l.type!==o&&l.type!==i&&l.type!==a)break}return r-1};function f(e,t,n,r){var i=r||e.schema.nodes.listItem,s=t.$from,l=t.$to,c=s.blockRange(l,(function(e){return e.childCount&&e.firstChild.type===i}));if(!c||c.depth<2||s.node(c.depth-1).type!==i)return n;var u=c.end,f=l.end(c.depth);return u<f&&(n.step(new a.ReplaceAroundStep(u-1,f,u,f,new o.Slice(o.Fragment.from(i.create(void 0,c.parent.copy())),1,0),1,!0)),c=new o.NodeRange(n.doc.resolve(s.pos),n.doc.resolve(f),c.depth)),n.lift(c,(0,a.liftTarget)(c)).scrollIntoView()}function d(e){return function(t,n){var r=t.tr,o=t.selection,s=o.$from,l=o.$to;return r.doc.nodesBetween(s.pos,l.pos,(function(n,o){if(n.isTextblock||"blockquote"===n.type.name||"div"===n.type.name){var s=new i.NodeSelection(r.doc.resolve(r.mapping.map(o))),l=s.$from.blockRange(s.$to);if(!l||s.$from.parent.type!==t.schema.nodes[e.listItem])return!1;var c=l&&(0,a.liftTarget)(l);if(null==c)return!1;r.lift(l,c)}})),n&&n(r),!0}}var h=/list\-style\-type:\s?([\w-]+)/;t.listStyle=function(e){var t=e.style||"",n=h.exec(t);return n&&n[1]||""},t.toggleList=function(e,n,r,o,a){var c=o.listType,h=o.listAttrs,p=void 0===h?{style:null}:h,m=e.selection,v=m.$from.node(m.$from.depth-2),g=m.$to.node(m.$to.depth-2);if(v&&v.type.name===c&&(0,t.listStyle)(v.attrs)===(0,t.listStyle)(p)&&g&&g.type.name===c&&(0,t.listStyle)(g.attrs)===(0,t.listStyle)(p)){var y=r.state.schema.nodes,b={bulletList:y[o.bulletList],orderedList:y[o.orderedList],listItem:y[o.listItem]},w=function(e,t){for(var n,r=t.bulletList,o=t.orderedList,i=t.listItem,a=e.depth-1;a>0;a--){var s=e.node(a);if(s.type!==r&&s.type!==o||(n=a),s.type!==r&&s.type!==o&&s.type!==i)break}return n}(m.$to,b),k=function(e,t,n,r,o,a){a||(a=e.schema.nodes.listItem);var s=!1;return o.doc.nodesBetween(t,n,(function(n,l){if(!s&&n.type===a&&l>t){s=!0;for(var c=r+3;c>r+2;){var u=o.doc.resolve(o.mapping.map(l));c=u.depth;var d=o.doc.resolve(o.mapping.map(l+n.textContent.length)),h=new i.TextSelection(u,d);o=f(e,h,o,a)}}})),o}(e,m.$to.pos,m.$to.end(w),w,r.state.tr,b.listItem);return k=function(e,t,n){var r=e.selection,o=r.from,i=r.to,a=e.schema.nodes,s=a.paragraph,l=a.heading,c=[];t.doc.nodesBetween(o,i,(function(e,t){e.type!==s&&e.type!==l||c.push({node:e,pos:t})}));for(var f=c.length-1;f>=0;f--){var d=c[f],h=t.doc.resolve(t.mapping.map(d.pos));if(h.depth>0){var p;p=d.node.textContent&&d.node.textContent.length>0?t.doc.resolve(t.mapping.map(d.pos+d.node.textContent.length)):t.doc.resolve(t.mapping.map(d.pos+1));var m=h.blockRange(p);m&&t.lift(m,u(e.schema,h,n))}}return t}(e,k,o),k.setMeta("commandName",a),n(k),!0}return function(e){return function(t,n,r){if(!r)return!1;var o,i,a=(t=r.state).schema.nodes[e.listType],c=t.selection,u=c.$from,f=c.$to,h=u.node(-2),p=u.node(-3),m=function(e,t,n,r){return 0===function(e,t,n){for(var r=[],o=function(e,t){var n=["blockquote","bulletList","orderedList"];if(1===t.depth)return t;for(var r=t.node(t.depth),o=t;t.depth>=1;)(r=(t=e.resolve(t.before(t.depth))).node(t.depth))&&-1!==n.indexOf(r.type.name)&&(o=t);return o}(e,t).depth,i=e.resolve(t.start(o));i.pos<=n.start(n.depth);){var a=Math.min(i.depth,o),s=i.node(a);if(s&&r.push(s),0===a)break;var l=e.resolve(i.after(a));if(l.start(a)>=e.nodeSize-2)break;l.depth!==i.depth&&(l=e.resolve(l.pos+2)),i=l.depth?e.resolve(l.start(l.depth)):e.resolve(l.end(l.depth))}return r}(e,t,n).filter((function(e){return e.type!==r})).length}(t.doc,u,f,a);return(h&&h.type===a||p&&p.type===a)&&m?d(e)(t,n):(m||(d(e)(t,n),t=r.state),(o=a,void 0===(i=e.listAttrs)&&(i={}),(0,s.autoJoin)((0,l.wrapInList)(o,i),(function(e,t){return e.type===t.type&&e.type===o})))(t,n))}}(o)(e,n,r)},t.toggleUnorderedList=function(e,n,o){return(0,t.toggleList)(e,n,o,r.__assign({listType:c.bulletList.listType},c.bulletList.types))},t.toggleOrderedList=function(e,n,o){return(0,t.toggleList)(e,n,o,r.__assign({listType:c.orderedList.listType},c.orderedList.types))},t.splitListItemKeepMarks=function(e){return function(t,n){return(0,l.splitListItem)(e)(t,(function(e){var r=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();r&&e.ensureMarks(r),n(e)}))}}},6608:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.expandSelection=t.selectedLineTextOnly=t.getNodeFromSelection=t.getSelectionText=t.hasSameMarkup=t.liftBlockquote=t.blockquote=t.listStyle=t.toggleList=t.toggleUnorderedList=t.toggleOrderedList=t.indentBlocks=t.canBeIndented=t.isIndented=t.canOutdentAsListItem=t.outdent=t.canIndentAsListItem=t.indent=t.selectionMarks=t.cleanMarks=t.removeAllMarks=t.getActiveMarks=t.getMark=t.hasMark=t.cleanTextBlockFormatting=t.blockNodes=t.changeTextBlock=t.parentBlockFormat=t.getBlockFormats=t.formatBlockElements=t.activeNode=t.hasNode=t.cleanFormatting=t.isAligned=t.alignBlocks=t.insertImage=t.insertText=t.removeLink=t.applyLink=t.toggleInlineFormat=t.getInlineStyles=t.applyInlineStyle=t.fragmentToHtml=t.pmDocToFragment=t.domToPmDoc=t.htmlToFragment=t.trimWhitespace=t.parseContent=t.setHtml=t.getHtml=void 0,t.listMarkersStyles=t.tableRowResizeKey=t.tableColumnResizeKey=t.tableResizeKey=t.tableResizing=t.caretColorKey=t.caretColor=t.imageResizeKey=t.imageResizing=t.textHighlightKey=t.textHighlight=t.cspFix=t.spacesFix=t.placeholder=t.replaceAll=t.replace=t.findAll=t.findAt=t.find=t.convertMsLists=t.replaceImageSourcesFromRtf=t.removeAttribute=t.sanitizeStyleAttr=t.sanitizeClassAttr=t.pasteCleanup=t.removeTag=t.removeComments=t.sanitize=t.link=t.superscript=t.subscript=t.strikethrough=t.underline=t.italic=t.bold=t.buildListKeymap=t.buildKeymap=t.marks=t.nodes=t.outdentRules=t.indentRules=t.alignRemoveRules=t.alignJustifyRules=t.alignRightRules=t.alignCenterRules=t.alignLeftRules=t.indentHtml=t.insertNode=t.canInsert=t.expandToWordWrap=void 0,t.pmDeleteColumn=t.pmAddRowBefore=t.pmAddRowAfter=t.pmAddColumnAfter=t.pmAddColumnBefore=t.deleteColumn=t.addColumnAfter=t.addColumnBefore=t.addRowBefore=t.addRowAfter=t.createTable=t.nextCell=t.moveCellForward=t.removeColSpan=t.findCell=t.cellAround=t.updateColumnsOnResize=t.columnResizingPluginKey=t.columnResizing=t.columnIsHeader=t.colCount=t.addColumn=t.addColSpan=t.addRow=t.rowIsHeader=t.deleteRow=t.mergeCells=t.splitCellWithType=t.splitCell=t.toggleHeaderRow=t.toggleHeaderColumn=t.toggleHeaderCell=t.toggleHeader=t.goToNextCell=t.setCellAttr=t.selectionCell=t.selectedRect=t.CellSelection=t.inSameTable=t.deleteTable=t.isInTable=t.fixTablesKey=t.fixTables=t.tableNodes=t.tableNodeTypes=t.tableEditingKey=t.tableEditing=t.TableMap=void 0;var r=n(7582),o=n(5643);Object.defineProperty(t,"getHtml",{enumerable:!0,get:function(){return o.getHtml}}),Object.defineProperty(t,"setHtml",{enumerable:!0,get:function(){return o.setHtml}}),Object.defineProperty(t,"parseContent",{enumerable:!0,get:function(){return o.parseContent}}),Object.defineProperty(t,"trimWhitespace",{enumerable:!0,get:function(){return o.trimWhitespace}}),Object.defineProperty(t,"htmlToFragment",{enumerable:!0,get:function(){return o.htmlToFragment}}),Object.defineProperty(t,"domToPmDoc",{enumerable:!0,get:function(){return o.domToPmDoc}}),Object.defineProperty(t,"pmDocToFragment",{enumerable:!0,get:function(){return o.pmDocToFragment}}),Object.defineProperty(t,"fragmentToHtml",{enumerable:!0,get:function(){return o.fragmentToHtml}});var i=n(3884);Object.defineProperty(t,"applyInlineStyle",{enumerable:!0,get:function(){return i.applyInlineStyle}}),Object.defineProperty(t,"getInlineStyles",{enumerable:!0,get:function(){return i.getInlineStyles}}),Object.defineProperty(t,"toggleInlineFormat",{enumerable:!0,get:function(){return i.toggleInlineFormat}});var a=n(1504);Object.defineProperty(t,"applyLink",{enumerable:!0,get:function(){return a.applyLink}}),Object.defineProperty(t,"removeLink",{enumerable:!0,get:function(){return a.removeLink}});var s=n(6149);Object.defineProperty(t,"insertText",{enumerable:!0,get:function(){return s.insertText}});var l=n(8834);Object.defineProperty(t,"insertImage",{enumerable:!0,get:function(){return l.insertImage}});var c=n(510);Object.defineProperty(t,"alignBlocks",{enumerable:!0,get:function(){return c.alignBlocks}}),Object.defineProperty(t,"isAligned",{enumerable:!0,get:function(){return c.isAligned}});var u=n(9840);Object.defineProperty(t,"cleanFormatting",{enumerable:!0,get:function(){return u.cleanFormatting}});var f=n(452);Object.defineProperty(t,"hasNode",{enumerable:!0,get:function(){return f.hasNode}}),Object.defineProperty(t,"activeNode",{enumerable:!0,get:function(){return f.activeNode}}),Object.defineProperty(t,"formatBlockElements",{enumerable:!0,get:function(){return f.formatBlockElements}}),Object.defineProperty(t,"getBlockFormats",{enumerable:!0,get:function(){return f.getBlockFormats}}),Object.defineProperty(t,"parentBlockFormat",{enumerable:!0,get:function(){return f.parentBlockFormat}}),Object.defineProperty(t,"changeTextBlock",{enumerable:!0,get:function(){return f.changeTextBlock}}),Object.defineProperty(t,"blockNodes",{enumerable:!0,get:function(){return f.blockNodes}}),Object.defineProperty(t,"cleanTextBlockFormatting",{enumerable:!0,get:function(){return f.cleanTextBlockFormatting}});var d=n(1542);Object.defineProperty(t,"hasMark",{enumerable:!0,get:function(){return d.hasMark}}),Object.defineProperty(t,"getMark",{enumerable:!0,get:function(){return d.getMark}}),Object.defineProperty(t,"getActiveMarks",{enumerable:!0,get:function(){return d.getActiveMarks}}),Object.defineProperty(t,"removeAllMarks",{enumerable:!0,get:function(){return d.removeAllMarks}}),Object.defineProperty(t,"cleanMarks",{enumerable:!0,get:function(){return d.cleanMarks}}),Object.defineProperty(t,"selectionMarks",{enumerable:!0,get:function(){return d.selectionMarks}});var h=n(648);Object.defineProperty(t,"indent",{enumerable:!0,get:function(){return h.indent}}),Object.defineProperty(t,"canIndentAsListItem",{enumerable:!0,get:function(){return h.canIndentAsListItem}}),Object.defineProperty(t,"outdent",{enumerable:!0,get:function(){return h.outdent}}),Object.defineProperty(t,"canOutdentAsListItem",{enumerable:!0,get:function(){return h.canOutdentAsListItem}}),Object.defineProperty(t,"isIndented",{enumerable:!0,get:function(){return h.isIndented}}),Object.defineProperty(t,"canBeIndented",{enumerable:!0,get:function(){return h.canBeIndented}}),Object.defineProperty(t,"indentBlocks",{enumerable:!0,get:function(){return h.indentBlocks}});var p=n(1641);Object.defineProperty(t,"toggleOrderedList",{enumerable:!0,get:function(){return p.toggleOrderedList}}),Object.defineProperty(t,"toggleUnorderedList",{enumerable:!0,get:function(){return p.toggleUnorderedList}}),Object.defineProperty(t,"toggleList",{enumerable:!0,get:function(){return p.toggleList}}),Object.defineProperty(t,"listStyle",{enumerable:!0,get:function(){return p.listStyle}});var m=n(8933);Object.defineProperty(t,"blockquote",{enumerable:!0,get:function(){return m.blockquote}}),Object.defineProperty(t,"liftBlockquote",{enumerable:!0,get:function(){return m.liftBlockquote}});var v=n(3147);Object.defineProperty(t,"hasSameMarkup",{enumerable:!0,get:function(){return v.hasSameMarkup}}),Object.defineProperty(t,"getSelectionText",{enumerable:!0,get:function(){return v.getSelectionText}}),Object.defineProperty(t,"getNodeFromSelection",{enumerable:!0,get:function(){return v.getNodeFromSelection}}),Object.defineProperty(t,"selectedLineTextOnly",{enumerable:!0,get:function(){return v.selectedLineTextOnly}}),Object.defineProperty(t,"expandSelection",{enumerable:!0,get:function(){return v.expandSelection}}),Object.defineProperty(t,"expandToWordWrap",{enumerable:!0,get:function(){return v.expandToWordWrap}}),Object.defineProperty(t,"canInsert",{enumerable:!0,get:function(){return v.canInsert}}),Object.defineProperty(t,"insertNode",{enumerable:!0,get:function(){return v.insertNode}}),Object.defineProperty(t,"indentHtml",{enumerable:!0,get:function(){return v.indentHtml}});var g=n(89);Object.defineProperty(t,"alignLeftRules",{enumerable:!0,get:function(){return g.alignLeftRules}}),Object.defineProperty(t,"alignCenterRules",{enumerable:!0,get:function(){return g.alignCenterRules}}),Object.defineProperty(t,"alignRightRules",{enumerable:!0,get:function(){return g.alignRightRules}}),Object.defineProperty(t,"alignJustifyRules",{enumerable:!0,get:function(){return g.alignJustifyRules}}),Object.defineProperty(t,"alignRemoveRules",{enumerable:!0,get:function(){return g.alignRemoveRules}});var y=n(2287);Object.defineProperty(t,"indentRules",{enumerable:!0,get:function(){return y.indentRules}}),Object.defineProperty(t,"outdentRules",{enumerable:!0,get:function(){return y.outdentRules}});var b=n(4221);Object.defineProperty(t,"nodes",{enumerable:!0,get:function(){return b.nodes}}),Object.defineProperty(t,"marks",{enumerable:!0,get:function(){return b.marks}});var w=n(2866);Object.defineProperty(t,"buildKeymap",{enumerable:!0,get:function(){return w.buildKeymap}}),Object.defineProperty(t,"buildListKeymap",{enumerable:!0,get:function(){return w.buildListKeymap}});var k=n(4437);Object.defineProperty(t,"bold",{enumerable:!0,get:function(){return k.bold}}),Object.defineProperty(t,"italic",{enumerable:!0,get:function(){return k.italic}}),Object.defineProperty(t,"underline",{enumerable:!0,get:function(){return k.underline}}),Object.defineProperty(t,"strikethrough",{enumerable:!0,get:function(){return k.strikethrough}}),Object.defineProperty(t,"subscript",{enumerable:!0,get:function(){return k.subscript}}),Object.defineProperty(t,"superscript",{enumerable:!0,get:function(){return k.superscript}}),Object.defineProperty(t,"link",{enumerable:!0,get:function(){return k.link}});var S=n(3910);Object.defineProperty(t,"sanitize",{enumerable:!0,get:function(){return S.sanitize}}),Object.defineProperty(t,"removeComments",{enumerable:!0,get:function(){return S.removeComments}}),Object.defineProperty(t,"removeTag",{enumerable:!0,get:function(){return S.removeTag}}),Object.defineProperty(t,"pasteCleanup",{enumerable:!0,get:function(){return S.pasteCleanup}}),Object.defineProperty(t,"sanitizeClassAttr",{enumerable:!0,get:function(){return S.sanitizeClassAttr}}),Object.defineProperty(t,"sanitizeStyleAttr",{enumerable:!0,get:function(){return S.sanitizeStyleAttr}}),Object.defineProperty(t,"removeAttribute",{enumerable:!0,get:function(){return S.removeAttribute}}),Object.defineProperty(t,"replaceImageSourcesFromRtf",{enumerable:!0,get:function(){return S.replaceImageSourcesFromRtf}});var x=n(1628);Object.defineProperty(t,"convertMsLists",{enumerable:!0,get:function(){return x.convertMsLists}});var C=n(2582);Object.defineProperty(t,"find",{enumerable:!0,get:function(){return C.find}}),Object.defineProperty(t,"findAt",{enumerable:!0,get:function(){return C.findAt}}),Object.defineProperty(t,"findAll",{enumerable:!0,get:function(){return C.findAll}}),Object.defineProperty(t,"replace",{enumerable:!0,get:function(){return C.replace}}),Object.defineProperty(t,"replaceAll",{enumerable:!0,get:function(){return C.replaceAll}});var O=n(7932);Object.defineProperty(t,"placeholder",{enumerable:!0,get:function(){return O.placeholder}});var M=n(2164);Object.defineProperty(t,"spacesFix",{enumerable:!0,get:function(){return M.spacesFix}});var T=n(5578);Object.defineProperty(t,"cspFix",{enumerable:!0,get:function(){return T.cspFix}});var A=n(2860);Object.defineProperty(t,"textHighlight",{enumerable:!0,get:function(){return A.textHighlight}}),Object.defineProperty(t,"textHighlightKey",{enumerable:!0,get:function(){return A.textHighlightKey}});var N=n(2936);Object.defineProperty(t,"imageResizing",{enumerable:!0,get:function(){return N.imageResizing}}),Object.defineProperty(t,"imageResizeKey",{enumerable:!0,get:function(){return N.imageResizeKey}});var R=n(3198);Object.defineProperty(t,"caretColor",{enumerable:!0,get:function(){return R.caretColor}}),Object.defineProperty(t,"caretColorKey",{enumerable:!0,get:function(){return R.caretColorKey}});var D=n(6034);Object.defineProperty(t,"tableResizing",{enumerable:!0,get:function(){return D.tableResizing}}),Object.defineProperty(t,"tableResizeKey",{enumerable:!0,get:function(){return D.tableResizeKey}}),Object.defineProperty(t,"tableColumnResizeKey",{enumerable:!0,get:function(){return D.tableColumnResizeKey}}),Object.defineProperty(t,"tableRowResizeKey",{enumerable:!0,get:function(){return D.tableRowResizeKey}});var _=n(3490);Object.defineProperty(t,"listMarkersStyles",{enumerable:!0,get:function(){return _.listMarkersStyles}}),r.__exportStar(n(9270),t),r.__exportStar(n(1588),t),r.__exportStar(n(1634),t),r.__exportStar(n(8638),t),r.__exportStar(n(8665),t),r.__exportStar(n(7354),t),r.__exportStar(n(9443),t),r.__exportStar(n(4032),t),r.__exportStar(n(2391),t);var E=n(1640);Object.defineProperty(t,"TableMap",{enumerable:!0,get:function(){return E.TableMap}}),Object.defineProperty(t,"tableEditing",{enumerable:!0,get:function(){return E.tableEditing}}),Object.defineProperty(t,"tableEditingKey",{enumerable:!0,get:function(){return E.tableEditingKey}}),Object.defineProperty(t,"tableNodeTypes",{enumerable:!0,get:function(){return E.tableNodeTypes}}),Object.defineProperty(t,"tableNodes",{enumerable:!0,get:function(){return E.tableNodes}}),Object.defineProperty(t,"fixTables",{enumerable:!0,get:function(){return E.fixTables}}),Object.defineProperty(t,"fixTablesKey",{enumerable:!0,get:function(){return E.fixTablesKey}}),Object.defineProperty(t,"isInTable",{enumerable:!0,get:function(){return E.isInTable}}),Object.defineProperty(t,"deleteTable",{enumerable:!0,get:function(){return E.deleteTable}}),Object.defineProperty(t,"inSameTable",{enumerable:!0,get:function(){return E.inSameTable}}),Object.defineProperty(t,"CellSelection",{enumerable:!0,get:function(){return E.CellSelection}}),Object.defineProperty(t,"selectedRect",{enumerable:!0,get:function(){return E.selectedRect}}),Object.defineProperty(t,"selectionCell",{enumerable:!0,get:function(){return E.selectionCell}}),Object.defineProperty(t,"setCellAttr",{enumerable:!0,get:function(){return E.setCellAttr}}),Object.defineProperty(t,"goToNextCell",{enumerable:!0,get:function(){return E.goToNextCell}}),Object.defineProperty(t,"toggleHeader",{enumerable:!0,get:function(){return E.toggleHeader}}),Object.defineProperty(t,"toggleHeaderCell",{enumerable:!0,get:function(){return E.toggleHeaderCell}}),Object.defineProperty(t,"toggleHeaderColumn",{enumerable:!0,get:function(){return E.toggleHeaderColumn}}),Object.defineProperty(t,"toggleHeaderRow",{enumerable:!0,get:function(){return E.toggleHeaderRow}}),Object.defineProperty(t,"splitCell",{enumerable:!0,get:function(){return E.splitCell}}),Object.defineProperty(t,"splitCellWithType",{enumerable:!0,get:function(){return E.splitCellWithType}}),Object.defineProperty(t,"mergeCells",{enumerable:!0,get:function(){return E.mergeCells}}),Object.defineProperty(t,"deleteRow",{enumerable:!0,get:function(){return E.deleteRow}}),Object.defineProperty(t,"rowIsHeader",{enumerable:!0,get:function(){return E.rowIsHeader}}),Object.defineProperty(t,"addRow",{enumerable:!0,get:function(){return E.addRow}}),Object.defineProperty(t,"addColSpan",{enumerable:!0,get:function(){return E.addColSpan}}),Object.defineProperty(t,"addColumn",{enumerable:!0,get:function(){return E.addColumn}}),Object.defineProperty(t,"colCount",{enumerable:!0,get:function(){return E.colCount}}),Object.defineProperty(t,"columnIsHeader",{enumerable:!0,get:function(){return E.columnIsHeader}}),Object.defineProperty(t,"columnResizing",{enumerable:!0,get:function(){return E.columnResizing}}),Object.defineProperty(t,"columnResizingPluginKey",{enumerable:!0,get:function(){return E.columnResizingPluginKey}}),Object.defineProperty(t,"updateColumnsOnResize",{enumerable:!0,get:function(){return E.updateColumnsOnResize}}),Object.defineProperty(t,"cellAround",{enumerable:!0,get:function(){return E.cellAround}}),Object.defineProperty(t,"findCell",{enumerable:!0,get:function(){return E.findCell}}),Object.defineProperty(t,"removeColSpan",{enumerable:!0,get:function(){return E.removeColSpan}}),Object.defineProperty(t,"moveCellForward",{enumerable:!0,get:function(){return E.moveCellForward}}),Object.defineProperty(t,"nextCell",{enumerable:!0,get:function(){return E.nextCell}}),r.__exportStar(n(2843),t),r.__exportStar(n(9222),t);var P=n(8153);Object.defineProperty(t,"createTable",{enumerable:!0,get:function(){return P.createTable}}),Object.defineProperty(t,"addRowAfter",{enumerable:!0,get:function(){return P.addRowAfter}}),Object.defineProperty(t,"addRowBefore",{enumerable:!0,get:function(){return P.addRowBefore}}),Object.defineProperty(t,"addColumnBefore",{enumerable:!0,get:function(){return P.addColumnBefore}}),Object.defineProperty(t,"addColumnAfter",{enumerable:!0,get:function(){return P.addColumnAfter}}),Object.defineProperty(t,"deleteColumn",{enumerable:!0,get:function(){return P.deleteColumn}}),Object.defineProperty(t,"pmAddColumnBefore",{enumerable:!0,get:function(){return P.pmAddColumnBefore}}),Object.defineProperty(t,"pmAddColumnAfter",{enumerable:!0,get:function(){return P.pmAddColumnAfter}}),Object.defineProperty(t,"pmAddRowAfter",{enumerable:!0,get:function(){return P.pmAddRowAfter}}),Object.defineProperty(t,"pmAddRowBefore",{enumerable:!0,get:function(){return P.pmAddRowBefore}}),Object.defineProperty(t,"pmDeleteColumn",{enumerable:!0,get:function(){return P.pmDeleteColumn}})},1542:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getActiveMarks=t.getMark=t.selectionMarks=t.styleValue=t.hasMark=t.cleanMarks=t.removeAllMarks=t.removeMarks=t.removeMark=t.toggleMark=t.markApplies=void 0;var r=n(2843),o=n(9443),i=n(3147);t.markApplies=function(e,t,n){for(var r=function(r){var o=t[r],i=o.$from,a=o.$to,s=0===i.depth&&e.type.allowsMarkType(n);if(e.nodesBetween(i.pos,a.pos,(function(e){if(s)return!1;s=e.inlineContent&&e.type.allowsMarkType(n)})),s)return{v:!0}},o=0;o<t.length;o++){var i=r(o);if(i)return i.v}return!1},t.toggleMark=function(e,n,r){return function(o,i){var a=o.selection,s=a.empty,l=a.$cursor,c=a.ranges;if(s&&!l||!(0,t.markApplies)(o.doc,c,e))return!1;if(i)if(l)e.isInSet(o.storedMarks||l.marks())?i(r.removeStoredMark(e)):i(r.addStoredMark(e.create(n)));else{for(var u=!1,f=0;!u&&f<c.length;f++){var d=c[f],h=d.$from,p=d.$to;u=o.doc.rangeHasMark(h.pos,p.pos,e)}for(f=0;f<c.length;f++){var m=c[f];h=m.$from,p=m.$to,u?r.removeMark(h.pos,p.pos,e):r.addMark(h.pos,p.pos,e.create(n))}i(r.scrollIntoView())}return!0}},t.removeMark=function(e,t,n,i){void 0===i&&(i=null);var a=[],s=0;return e.doc.nodesBetween(t,n,(function(e,r){if(e.isInline){s++;var l=null;if(i instanceof o.MarkType){var c=i.isInSet(e.marks);c&&(l=[c])}else i?i.isInSet(e.marks)&&(l=[i]):l=e.marks;if(l&&l.length)for(var u=Math.min(r+e.nodeSize,n),f=0;f<l.length;f++){for(var d=l[f],h=void 0,p=0;p<a.length;p++){var m=a[p];m.step===s-1&&d.eq(m.style)&&(h=m)}h?(h.to=u,h.step=s):a.push({style:d,from:Math.max(r,t),to:u,step:s})}}})),a.forEach((function(t){return e.step(new r.RemoveMarkStep(t.from,t.to,t.style))})),e},t.removeMarks=function(e,n,r,o){var i=n.selection,a=i.$cursor,s=i.ranges;if(o=o||n.tr,a)e.forEach((function(e){e.isInSet(n.storedMarks||a.marks())&&r(o.removeStoredMark(e))}));else{for(var l=function(n){var r=s[n],i=r.$from,a=r.$to;e.forEach((function(e){(0,t.removeMark)(o,i.pos,a.pos,e)}))},c=0;c<s.length;c++)l(c);r(o.scrollIntoView())}return!0},t.removeAllMarks=function(e){var n=(void 0===e?{}:e).except,r=void 0===n?[]:n;return function(e,n){var o,i=e.tr;(0,t.cleanMarks)(i,{except:(o=r,o instanceof Array?o:[o])}),i.docChanged&&n(i)}},t.cleanMarks=function(e,t){var n=t.except,r=e.doc,o=e.selection,i=r.type.schema,a=o.empty,s=o.ranges,l=(n||[]).map((function(e){return e.name}));if(!a){var c=Object.keys(i.marks).map((function(e){return i.marks[e]})).filter((function(e){return-1===l.indexOf(e.name)}));s.forEach((function(t){var n=t.$from,r=t.$to;c.forEach((function(t){return e.removeMark(n.pos,r.pos,t)}))}))}},t.hasMark=function(e,n){var r,o=e.schema.marks,i=(n.altMarks||[]).filter((function(e){return o[e]})),a=n.altStyle,s=e.selection,l=s.from,c=s.$from,u=s.to,f=s.empty,d=o[n.mark],h=e.doc,p=!1;return f?(r=e.storedMarks||c.marks(),p=d&&d.isInSet(r)||i.some((function(e){return o[e].isInSet(r)}))):p=d&&h.rangeHasMark(l,u,d)||i.some((function(e){return h.rangeHasMark(l,u,o[e])})),!p&&a&&o.style?(0,t.selectionMarks)(e,o.style).some((function(e){return null!==(0,t.styleValue)(e,a)})):Boolean(p)},t.styleValue=function(e,t){for(var n=e&&e.attrs.style||"",r=(0,i.parseStyle)(n),o=Object.keys(r),a=0;a<o.length;a++){var s=o[a];if(s.toLowerCase()===t.name&&t.value.test(r[s]))return r[s]}return null},t.selectionMarks=function(e,t){var n=e.selection,r=n.from,o=n.$from,i=n.to,a=n.empty,s=[];return a?s.push(t.isInSet(e.storedMarks||o.marks())):e.doc.nodesBetween(r,i,(function(e){e.isInline&&s.push(t.isInSet(e.marks))})),s},t.getMark=function(e,n){var r=(0,t.selectionMarks)(e,n),o=r.filter((function(e){return Boolean(e)}));return r.length===o.length?r[0]:void 0},t.getActiveMarks=function(e,n){var r=(0,t.selectionMarks)(e,n),o=r.filter((function(e){return Boolean(e)}));return{hasNodesWithoutMarks:r.length!==o.length,marks:o}}},3910:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.replaceImageSourcesFromRtf=t.pasteCleanup=t.sanitizeStyleAttr=t.sanitizeClassAttr=t.removeAttribute=t.removeTag=t.removeComments=t.sanitize=void 0;var r=n(1628),o=n(5643),i=n(3147);function a(e){for(var t=e.length,n=new Array(t/2),r=0;r<t;r+=2)n[r]=String.fromCharCode(parseInt(e.substring(r,r+2),16));return btoa(n.join(""))}t.sanitize=function(e){return(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/^[\s\S]+?<!--StartFragment-->\s*([\s\S]*?)\s*<!--EndFragment-->[\s\S]+$/,"$1")).replace(/<\/?[ovw]:[^>]*?>/gi,"")).replace(/<\\?\??xml[^>]*>/gi,"")).replace(/<(?:link|meta) [^>]+?>/gi,"")).replace(/<style[^>]*?>\s*<\/style>/gi,"")).replace(/<\/?st1:.*?>/gi,"")).replace(/<a name="[a-zA-Z0-9_]+">/gim,"")).replace(/v:shapes?="[^"]+"/gi,"")).replace(/<!\[if !supportLists\]>/gi,"")).replace(/<!\[endif\]>/gi,"")},t.removeComments=function(e){return e.replace(/<!--[\s\S]+?-->/g,"")},t.removeTag=function(e,t){return e.replace(new RegExp("<\\/?("+t+")(?:\\s[^>]*?)?>","gi"),"")},t.removeAttribute=function(e){e.ownerElement&&e.ownerElement.removeAttribute(e.name)},t.sanitizeClassAttr=function(e){/^Mso/.test(e.value)&&(0,t.removeAttribute)(e)},t.sanitizeStyleAttr=function(e){var n=(0,i.parseStyle)(e.value),r=e.ownerElement.style,o="";Object.keys(n).forEach((function(e){void 0!==r[e]&&(o+="".concat(e,": ").concat(n[e],"; "))})),(o=o.trim())?e.value=o:(0,t.removeAttribute)(e)},t.pasteCleanup=function(e,n){var i=e;if(n.convertMsLists&&(i=(0,r.convertMsLists)(i)),n.stripTags&&(i=(0,t.removeTag)(i,n.stripTags)),n.attributes){var a=(0,o.htmlToFragment)(i);Array.from(a.querySelectorAll("*")).forEach((function(e){return function(e,t){if(e.nodeType===Node.ELEMENT_NODE){for(var n=e.attributes.length-1;n>=0;n--){var r=e.attributes[n];t[r.name]?t[r.name](r):t["*"]&&t["*"](r)}"SPAN"===e.nodeName&&0===e.attributes.length&&function(e){var t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}(e)}}(e,n.attributes)})),i=(0,o.fragmentToHtml)(a)}return i};var s=/<img\s[^>]*?src=(?:'|")file:\/[^'"]+(?:'|")[^>]*>/gi,l=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,c=new RegExp("(?:("+l.source+"))([\\da-fA-F\\s]+)\\}","g"),u=/[^\da-fA-F]/g,f=/file:\/[^'"]+\.(jpg|png|gif)/i,d=/\\(png|jpeg)blip\\/,h="text/rtf";t.replaceImageSourcesFromRtf=function(e,t){var n=e.match(s);if(!n||-1===t.types.indexOf(h))return e;var r=t.getData(h),o=[],i=r.match(c);if(!r||!i)return e;for(var p=0,m=i;p<m.length;p++){var v=m[p],g=d.exec(v);if(g){var y=v.replace(l,"").replace(u,"");o.push("data:image/".concat(g[1],";base64,").concat(a(y)))}}return n.length!==o.length?e:e.replace(s,(function(e){var t=o.shift()||"";return e.replace(f,t)}))}},3198:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.caretColor=t.caretColorKey=void 0;var r=n(2391),o=n(9222),i=n(1542);t.caretColorKey=new r.PluginKey("caret-color"),t.caretColor=function(){return new r.Plugin({key:t.caretColorKey,props:{decorations:function(e){var t=e.doc,n=e.selection,r=e.storedMarks;if(!n.empty||!r)return o.DecorationSet.empty;var a=(0,i.styleValue)((r||[]).find((function(e){return"style"===e.type.name})),{name:"color",value:/^.+$/});if(!a)return o.DecorationSet.empty;var s=n.$anchor.parent,l=[];return t.descendants((function(e,t){e.eq(s)&&l.push(o.Decoration.node(t,t+e.nodeSize,{style:"caret-color: "+a}))})),o.DecorationSet.create(t,l)}}})}},5578:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cspFix=void 0;var r=n(2391),o=n(3147),i=function(e,t){for(var n in t)n&&(0,o.setAttribute)(e,n,t[n])},a=function(e,t,n,r){void 0===r&&(r=!1),this.node=e,this.view=t,this.dom=document.createElement(n),i(this.dom,e.attrs),this.contentDOM=r?void 0:this.dom},s=function(e,t){this.mark=e,this.view=t,this.dom=document.createElement("span"),i(this.dom,e.attrs),this.contentDOM=this.dom};t.cspFix=function(){return new r.Plugin({key:new r.PluginKey("csp-fix"),props:{nodeViews:{paragraph:function(e,t){return new a(e,t,"p")},div:function(e,t){return new a(e,t,"div")},table_wrapper:function(e,t){return new a(e,t,"div")},table_caption_external:function(e,t){return new a(e,t,"div")},table:function(e,t){return new a(e,t,"table")},table_row:function(e,t){return new a(e,t,"tr")},table_cell:function(e,t){return new a(e,t,"td")},table_header:function(e,t){return new a(e,t,"th")},image:function(e,t){return new a(e,t,"img",!0)}},markViews:{style:function(e,t){return new s(e,t)}}}})}},2860:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.textHighlight=t.textHighlightKey=void 0;var r=n(2391),o=n(9222);t.textHighlightKey=new r.PluginKey("highlight"),t.textHighlight=function(e){return void 0===e&&(e=t.textHighlightKey),new r.Plugin({key:e,state:{init:function(){return null},apply:function(e){return e.getMeta(this.spec.key)}},props:{decorations:function(e){var t=(this.spec.key.getState(e)||[]).map((function(e){return o.Decoration.inline(e.from,e.to,e.attrs)}));return o.DecorationSet.create(e.doc,t)}}})}},2936:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.imageResizing=t.imageResizeKey=void 0;var r=n(7582),o=n(2391),i=n(9222),a=n(3352),s=n(3147),l=n(8115);t.imageResizeKey=new o.PluginKey("image-resize");var c=function(e,t,n){e.style[t]=n+"px"},u=/[^\-]width:|[^\-]height:/,f=/^.+$/,d=function(){function e(e,t,n,r){this.activeHandle=e,this.dragging=t,this.rect=n,this.nodePosition=r}return e.prototype.apply=function(n){var r=n.getMeta(t.imageResizeKey);return r?new e(r.activeHandle,r.setDragging,r.rect,r.nodePosition):this},e}();t.imageResizing=function(e){return void 0===e&&(e={node:"image",lockRatio:!0}),new o.Plugin({key:t.imageResizeKey,view:function(n){return{resize:function(){t.imageResizeKey.getState(n.state).rect&&n.dispatch(n.state.tr.setMeta("resize",!0))},get window(){return n.dom.ownerDocument&&n.dom.ownerDocument.defaultView},attachResize:function(){var e=this.window;e&&(e.removeEventListener("resize",this.resize),e.addEventListener("resize",this.resize))},removeResize:function(){var e=this.window;e&&e.removeEventListener("resize",this.resize)},update:function(n,r){var i=n.state,a=i.selection,s=i.schema.nodes[e.node],l=t.imageResizeKey.getState(i),c=l.rect;if(a instanceof o.NodeSelection&&s===a.node.type){var u=n.nodeDOM(a.from),f={top:u.offsetTop,left:u.offsetLeft,width:u.offsetWidth,height:u.offsetHeight};if(!r.selection.eq(a)||c&&(c.width!==f.width||c.height!==f.height||c.top!==f.top||c.left!==f.left)){var d=i.tr;d.setMeta(t.imageResizeKey,{rect:f,nodePosition:a.from}),n.dispatch(d),this.attachResize()}}else c&&(l.rect=null,l.nodePosition=-1)},destroy:function(){this.removeResize()}}},state:{init:function(){return new d("",null,null,-1)},apply:function(e,t){return t.apply(e)}},props:{handleDOMEvents:{mousedown:function(n,i){return function(e,n,i){var d=n.target.getAttribute(a.dataResizeDirImage);if(!d)return!1;var h=t.imageResizeKey.getState(e.state);n.preventDefault();var p=e.state.tr;function m(n){!function(e,n,r){var o=t.imageResizeKey.getState(e.state),i=o.rect,a=o.dragging,s=o.nodePosition,u=o.activeHandle;if(a&&i){var f=e.nodeDOM(s),d=l.directions[u],h=(n.clientX-a.startX)*d.x,p=(n.clientY-a.startY)*d.y,m=d.x?h+f.width:i.width,v=d.y?p+f.height:i.height;if(r.lockRatio&&d.x&&d.y){var g=Math.min(m/f.width,v/f.height),y=f.width*g,b=f.height*g;a.startX=n.clientX-(m-y)*d.x,a.startY=n.clientY-(v-b)*d.y,m=y,v=b}else a.startX=d.x?n.clientX:a.startX,a.startY=d.y?n.clientY:a.startY;c(f,"width",m),c(f,"height",v),i.top=f.offsetTop,i.left=f.offsetLeft,i.width=f.offsetWidth,i.height=f.offsetHeight;var w=f.nextElementSibling;w.style.width=i.width+"px",w.style.height=i.height+"px",w.style.top=i.top+"px",w.style.left=i.left+"px"}}(e,n,i)}return p.setMeta(t.imageResizeKey,{setDragging:{startX:n.clientX,startY:n.clientY},activeHandle:d,rect:h.rect,nodePosition:h.nodePosition}),p.setMeta("addToHistory",!1),e.dispatch(p),n.view.addEventListener("mouseup",(function n(i){i.view.removeEventListener("mouseup",n),i.view.removeEventListener("mousemove",m),function(e){var n=t.imageResizeKey.getState(e.state),i=n.rect,a=n.dragging,l=n.nodePosition;if(a&&i){var c=e.state.selection;if(c instanceof o.NodeSelection){var d=c.node.attrs,h=i.width,p=i.height,m=void 0;if(u.test(d.style||"")){var v=(0,s.changeStylesString)(d.style,{style:"width",value:f,newValue:h+"px"}),g=(0,s.changeStylesString)(v.style||"",{style:"height",value:f,newValue:p+"px"}).style;m=r.__assign(r.__assign({},d),{style:g})}else m=r.__assign(r.__assign({},d),{width:h,height:p});var y=c.node.type.createAndFill(m);if(y){var b=e.state.tr;b.replaceWith(l,l+1,y),b.setSelection(o.NodeSelection.create(b.doc,l)),b.setMeta("commandName","image-resize"),b.setMeta("args",m),b.setMeta(t.imageResizeKey,{setDragging:null,activeHandle:null,rect:i,nodePosition:l}),e.dispatch(b)}}}}(e)})),n.view.addEventListener("mousemove",m),!0}(n,i,e)}},decorations:function(n){var r=n.selection,s=n.schema.nodes[e.node],c=t.imageResizeKey.getState(n).rect;if(c&&r instanceof o.NodeSelection&&s===r.node.type){var u=document.createElement("div");u.className="k-editor-resize-handles-wrapper",u.style.width=c.width+"px",u.style.height=c.height+"px",u.style.top=c.top+"px",u.style.left=c.left+"px";for(var f=0;f<l.handles.length;f++){var d=document.createElement("div");d.className=a.resizeHandle+" "+l.handles[f],d.setAttribute(a.dataResizeDirImage,l.handles[f]),u.appendChild(d)}return i.DecorationSet.create(n.doc,[i.Decoration.widget(n.selection.from+1,u)])}return i.DecorationSet.empty}}})}},3490:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.listMarkersStyles=void 0;var r=n(7582),o=n(2391),i=n(2843),a=n(3147),s=function(e,t,n,r,o){var i,a,s=o.resolve(e),l=o.resolve(t),c=r.type.name;return!s.nodeBefore&&(i=s.node(s.depth),a=s.node(s.depth-1),i&&a&&a.firstChild===i&&a.type.name===c)?n+r.content.size<=t:!l.nodeAfter&&(i=l.node(l.depth),a=l.node(l.depth-1),i&&a&&a.lastChild===i&&a.type.name===c)?e<=n:e<=n&&n+r.content.size<=t},l={listItem:"list_item",resetValues:{"font-size":"","font-family":"",color:""}};t.listMarkersStyles=function(e){return void 0===e&&(e=l),new o.Plugin({key:new o.PluginKey("list-markers-styles"),appendTransaction:function(t,n,o){var l,c=t.slice().pop(),u=c.getMeta("commandName");return"FontSize"===u||"FontName"===u||"ForeColor"===u?l=function(e,t,n){var o=t.tr,i=t.doc,l=t.selection,c=l.from,u=l.to,f=e.getMeta("args");return i.nodesBetween(c,u,(function(e,t){e.type.name===n.listItem&&s(c,u,t,e,i)&&o.setNodeMarkup(t,null,r.__assign(r.__assign({},e.attrs),{style:(0,a.applyStyle)(e.attrs.style,f.style,f.value)}))})),o.docChanged?o:void 0}(c,o,e):"CleanFormatting"===u&&(l=function(e,t,n){var o=Object.keys(n.resetValues),l=t.tr,c=t.doc,u=t.selection,f=u.from,d=u.to;return c.nodesBetween(f,d,(function(e,t){if(e.type.name===n.listItem&&s(f,d,t,e,c)){var i=e.attrs,u=(0,a.parseStyle)(e.attrs.style);o.forEach((function(e){u[e]&&(i=r.__assign(r.__assign({},i),{style:(0,a.applyStyle)(i.style,e,"")}))})),i!==e.attrs&&l.setNodeMarkup(t,null,i)}})),e.steps.forEach((function(e){if(e instanceof i.RemoveMarkStep){var t=e.mark;if("style"===t.type.name&&t.attrs.style){var r=t.attrs.style.split(/\s*:\s*/)[0],o=l.doc.resolve(e.from),s=(0,a.parentNode)(o,(function(e){return e.type.name===n.listItem}));if(s&&(0,a.parseStyle)(s.node.attrs.style)[r]&&n.resetValues[r]){var c=t.type.create({style:"".concat(r,": ").concat(n.resetValues[r],";")});l.addMark(e.from,e.to,c)}}}})),l.docChanged?l:void 0}(c,o,e)),l&&l.setMeta("addToHistory",!0),l}})}},7932:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.placeholder=void 0;var r=n(2391),o=n(9222);t.placeholder=function(e){var t={class:"k-placeholder","data-placeholder":e};return new r.Plugin({key:new r.PluginKey("placeholder"),props:{decorations:function(e){var n=e.doc,r=n.content.firstChild;if(!(0===n.childCount||1===n.childCount&&r.inlineContent&&0===r.childCount))return o.DecorationSet.empty;var i=[];return n.descendants((function(e,n){i.push(o.Decoration.node(n,n+e.nodeSize,t))})),o.DecorationSet.create(n,i)}}})}},8115:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.handles=t.directions=void 0,t.directions={southeast:{x:1,y:1},east:{x:1,y:0},south:{x:0,y:1},north:{x:0,y:-1},west:{x:-1,y:0},southwest:{x:-1,y:1},northwest:{x:-1,y:-1},northeast:{x:1,y:-1}},t.handles=Object.keys(t.directions)},2164:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.spacesFix=void 0;var r=n(2391),o=n(9222),i=/\s+/g,a=/text-align/;t.spacesFix=function(){return new r.Plugin({key:new r.PluginKey("spaces-fix"),props:{decorations:function(e){var t,n,r,s,l=[],c=e.doc;return c.nodesBetween(0,c.content.size,(function(e,c,u){if(e.type.isText&&function(e){return a.test(e&&e.attrs&&e.attrs.style||"")}(u))for(n=i.exec(e.text||"");null!==n;){if(t=c+n.index,r=n[0].length,n.index+r<n.input.length)for(s=0;s<=r-1;s+=2)l.push(o.Decoration.inline(t+s,t+s+1,{style:"white-space: normal"}));n=i.exec(e.text||"")}})),o.DecorationSet.create(c,l)}}})}},5496:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.columnResizing=void 0;var r=n(7582),o=n(2391),i=n(1640),a=n(9222),s=n(3352),l=n(6652),c=n(3147),u=n(8230);t.columnResizing=function(){return new o.Plugin({key:u.tableColumnResizeKey,state:{init:function(){return new f(-1,null)},apply:function(e,t){return t.apply(e)}},props:{attributes:function(e){return(0,u.otherResizeHandle)(u.tableColumnResizeKey,e)?null:u.tableColumnResizeKey.getState(e).activeHandle>-1?{class:"resize-cursor"}:null},handleDOMEvents:{mousemove:function(e,t){return(0,u.otherResizing)(u.tableColumnResizeKey,e.state)||function(e,t){var n=u.tableColumnResizeKey.getState(e.state);if(!n.dragging){var r=(0,u.domCellAround)(t.target),o=-1;if(r){var i=(0,u.cellIndexes)(r),a=r.getBoundingClientRect(),s=a.left,l=a.right;Math.abs(t.clientX-s)<=5&&i.cellIndex>0?(i.cellIndex-=r.colSpan,o=(0,u.edgeCell)(e,t,i)):l-t.clientX>0&&l-t.clientX<=5&&(o=(0,u.edgeCell)(e,t,i))}o!==n.activeHandle&&d(e,o)}}(e,t),!1},mouseleave:function(e){return function(e){var t=u.tableColumnResizeKey.getState(e.state);t.activeHandle>-1&&!t.dragging&&d(e,-1)}(e),!1},mousedown:function(e,t){return function(e,t){var n,o=u.tableColumnResizeKey.getState(e.state);if(-1===o.activeHandle||o.dragging)return!1;for(var a=e.state.doc.resolve(o.activeHandle),l=a.parent,f=a.index(),d=0,h=0;h<=f;h++)d+=l.child(h).attrs.colspan;var p,m,v=a.node(a.depth-1),g=e.domAtPos(o.activeHandle),y=g.node.childNodes[g.offset].closest("table");if(v.attrs[s.colgroupAttr])(p=(w=y.firstChild).children[d-1]).style.width||(p.style.width=p.offsetWidth+"px");else{var b=0;for(h=0;h<l.childCount;h++)b+=l.child(h).attrs.colspan;var w=document.createElement("colgroup"),k=new Array(b);for(h=0;h<b;h++)k[h]=document.createElement("col"),w.appendChild(k[h]);y.insertBefore(w,y.firstChild),(p=k[f]).style.width=p.offsetWidth+"px",m=r.__assign(r.__assign({},v.attrs),((n={})[s.colgroupAttr]="<colgroup>"+k.reduce((function(e,t){return e+t.outerHTML}),"")+"</colgroup>",n))}var S=parseFloat(p.style.width),x=e.state.tr.setMeta(u.tableColumnResizeKey,{setDragging:{startX:t.clientX,startWidth:S}});if(!y.style.width){var C=Array.from(p.parentNode.children).map((function(e){return e.style.width}));if(C.every(Boolean)){var O=C.reduce((function(e,t){return e+parseFloat(t)}),0);m=(0,c.setNodeStyle)(m||v.attrs,"width",O+"px")}}if(m){var M=a.posAtIndex(0,a.depth-1)-1;x.setNodeMarkup(M,null,m)}function T(t){t.view.removeEventListener("mouseup",T),t.view.removeEventListener("mousemove",A);var n=u.tableColumnResizeKey.getState(e.state);if(n.dragging){var o=e.state.tr;!function(e,t,n){var o,i=e.state.doc.resolve(n),a=i.node(-1),l=i.start(-1),u=i.posAtIndex(0,i.depth-1)-1,f=e.nodeDOM(l).closest("table"),d=a.attrs;if(a&&d[s.colgroupAttr]){var h=f.firstChild;d=r.__assign(r.__assign({},d),((o={})[s.colgroupAttr]=h.outerHTML,o))}var p=f.style.width;f&&p&&(0,c.parseStyle)(d.style).width!==p&&(d=(0,c.setNodeStyle)(d,"width",p)),t.setNodeMarkup(u,null,d)}(e,o,n.activeHandle),e.dispatch(o.setMeta(u.tableColumnResizeKey,{setDragging:null}))}}function A(t){if(!t.which)return T(t);var n=u.tableColumnResizeKey.getState(e.state),r=function(e,t){var n=t.clientX-e.startX;return Math.max(25,e.startWidth+n)}(n.dragging,t);!function(e,t,n){var r=e.state.doc.resolve(t),o=r.node(-1),a=r.start(-1),s=i.TableMap.get(o).colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,l=e.domAtPos(r.start(-1)).node;"TABLE"!==l.nodeName&&(l=l.closest("table"));var c=l,u=c.firstChild,f=Array.from(u.children);if(f[s].style.width=n+"px",c.style.width){var d=f.map((function(e){return e.style.width}));if(d.every(Boolean)){var h=d.reduce((function(e,t){return e+parseFloat(t)}),0);c.style.width=h+"px"}}}(e,n.activeHandle,r)}return e.dispatch(x),t.view.addEventListener("mouseup",T),t.view.addEventListener("mousemove",A),t.preventDefault(),!0}(e,t)}},decorations:function(e){if(!(0,u.otherResizing)(u.tableColumnResizeKey,e)){var t=u.tableColumnResizeKey.getState(e);if(t.activeHandle>-1)return function(e,t){for(var n=[],r=e.doc.resolve(t),o=r.node(-1),s=i.TableMap.get(o),l=r.start(-1),c=[],u=t-l,f=-1,d=0;d<s.height;d++)c.push(s.map.slice(d*s.width,d*s.width+s.width)),-1===f&&(f=c[d].lastIndexOf(u));var h=[];return c.forEach((function(e){var t=e[f];e[f]!==e[f+1]&&h.push(t)})),h.forEach((function(e){var t=l+e+o.nodeAt(e).nodeSize-1,r=document.createElement("div");r.className="column-resize-handle",n.push(a.Decoration.widget(t,r))})),a.DecorationSet.create(e.doc,n)}(e,t.activeHandle)}return a.DecorationSet.empty},nodeViews:{table_wrapper:function(e,t){return new l.TableWrapperView(e,t)},table:function(e,t){return new l.TableView(e,t)}}}})};var f=function(){function e(e,t){this.activeHandle=e,this.dragging=t}return e.prototype.apply=function(t){var n,r,o=t.getMeta(u.tableColumnResizeKey);if(o&&null!=o.setHandle)return new e(o.setHandle,null);if(o&&void 0!==o.setDragging)return new e(this.activeHandle,o.setDragging);if(this.activeHandle>-1&&t.docChanged){var i=t.mapping.map(this.activeHandle,-1);r=t.doc.resolve(i),Boolean("row"===r.parent.type.spec.tableRole&&r.nodeAfter)||(i=-1),n=new e(i,this.dragging)}return n||this},e}();function d(e,t){var n=e.state.tr;n.setMeta("addToHistory",!1),n.setMeta(u.tableColumnResizeKey,{setHandle:t}),e.dispatch(n)}},6034:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tableRowResizeKey=t.tableColumnResizeKey=t.tableResizeKey=t.tableResizing=void 0;var r=n(5496),o=n(5652),i=n(4159);t.tableResizing=function(){return[(0,o.tableResizing)(),(0,r.columnResizing)(),(0,i.rowResizing)()]};var a=n(8230);Object.defineProperty(t,"tableResizeKey",{enumerable:!0,get:function(){return a.tableResizeKey}}),Object.defineProperty(t,"tableColumnResizeKey",{enumerable:!0,get:function(){return a.tableColumnResizeKey}}),Object.defineProperty(t,"tableRowResizeKey",{enumerable:!0,get:function(){return a.tableRowResizeKey}})},4159:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.rowResizing=void 0;var r=n(2391),o=n(1640),i=n(9222),a=n(8230),s=n(3147),l=function(){function e(){}return e.prototype.ignoreMutation=function(e){return"attributes"===e.type&&"style"===e.attributeName&&"TR"===e.target.nodeName},e}();t.rowResizing=function(){return new r.Plugin({key:a.tableRowResizeKey,state:{init:function(e,t){return this.spec.props.nodeViews[(0,o.tableNodeTypes)(t.schema).row.name]=function(){return new l},new c(-1,null)},apply:function(e,t){return t.apply(e)}},props:{attributes:function(e){return(0,a.otherResizeHandle)(a.tableRowResizeKey,e)?null:a.tableRowResizeKey.getState(e).activeHandle>-1?{class:"resize-cursor-vertical"}:null},handleDOMEvents:{mousemove:function(e,t){return(0,a.otherResizing)(a.tableRowResizeKey,e.state)||function(e,t){var n=a.tableRowResizeKey.getState(e.state);if(!n.dragging){var r=(0,a.domCellAround)(t.target),o=-1;if(r){var i=(0,a.cellIndexes)(r),s=r.getBoundingClientRect(),l=s.top,c=s.bottom;Math.abs(t.clientY-l)<=5&&i.rowIndex>0?(i.rowIndex-=r.rowSpan,o=(0,a.edgeCell)(e,t,i)):c-t.clientY>0&&c-t.clientY<=5&&(o=(0,a.edgeCell)(e,t,i))}o!==n.activeHandle&&u(e,o)}}(e,t),!1},mouseleave:function(e){return function(e){var t=a.tableRowResizeKey.getState(e.state);t.activeHandle>-1&&!t.dragging&&u(e,-1)}(e),!1},mousedown:function(e,t){return function(e,t){var n=a.tableRowResizeKey.getState(e.state);if(-1===n.activeHandle||n.dragging)return!1;var r=e.state.doc.resolve(n.activeHandle),o=r.parent,i=r.node(-1),l=(0,s.parseStyle)(o.attrs.style).height,c=(0,s.parseStyle)(i.attrs.style).height,u=l?parseFloat(l):0;function f(t){t.view.removeEventListener("mouseup",f),t.view.removeEventListener("mousemove",d);var n=a.tableRowResizeKey.getState(e.state);if(n.dragging){var r=e.state.tr.setMeta(a.tableRowResizeKey,{setDragging:null});!function(e,t,n){var r=e.state.doc,o=r.resolve(n),i=o.parent,a=o.posAtIndex(0)-1,l=e.nodeDOM(a),c=l.ownerDocument&&l.ownerDocument.defaultView||window;l.style.height=c.getComputedStyle(l).height,t.setNodeMarkup(a,null,(0,s.setNodeStyle)(i.attrs,"height",l.style.height));var u=l&&l.closest("table"),f=u&&u.style.height;if(f){var d=r.resolve(a),h=d.start(d.depth)-1;t.setNodeMarkup(h,null,(0,s.setNodeStyle)(d.parent.attrs,"height",f))}}(e,r,n.activeHandle),e.dispatch(r)}}function d(t){if(!t.which)return f(t);var n=a.tableRowResizeKey.getState(e.state),r=function(e,t){var n=t.clientY-e.startY;return e.startHeight.rowHeight+n}(n.dragging,t),o=t.clientY-n.dragging.startY;!function(e,t,n,r,o){var i=e.nodeDOM(t),a=i&&i.parentNode;if(a){a.style.height=n+"px";var s=a.ownerDocument&&a.ownerDocument.defaultView||window;a.style.height=s.getComputedStyle(a).height;var l=a.closest("table"),c=parseFloat(o)+r+"px",u=l&&l.style.height;u&&u!==c&&(l.style.height=parseFloat(o)+r+"px",l.style.height=s.getComputedStyle(l).height)}}(e,n.activeHandle,r,o,c)}return l||(u=e.nodeDOM(n.activeHandle).offsetHeight),e.dispatch(e.state.tr.setMeta(a.tableRowResizeKey,{setDragging:{startY:t.clientY,startHeight:{rowHeight:u,tableHeight:c}}})),t.view.addEventListener("mouseup",f),t.view.addEventListener("mousemove",d),t.preventDefault(),!0}(e,t)}},decorations:function(e){if((0,a.otherResizing)(a.tableRowResizeKey,e))return i.DecorationSet.empty;var t=a.tableRowResizeKey.getState(e);return t.activeHandle>-1?function(e,t){var n=[];if("number"!=typeof t)return i.DecorationSet.empty;for(var r=e.doc.resolve(t),a=r.node(-1),s=o.TableMap.get(a),l=r.start(-1),c=[],u=t-l,f=-1,d=0;d<s.height;d++)c.push(s.map.slice(d*s.width,d*s.width+s.width)),-1!==c[d].indexOf(u)&&(f=d);var h=[];return c[f].forEach((function(e,t){c[f+1]&&e===c[f+1][t]||h.push(e)})),h.forEach((function(e){var t=a.nodeAt(e),r=l+e+(t?t.nodeSize:0)-1,o=document.createElement("div");o.className="row-resize-handle",n.push(i.Decoration.widget(r,o))})),i.DecorationSet.create(e.doc,n)}(e,t.activeHandle):void 0},nodeViews:{}}})};var c=function(){function e(e,t){this.activeHandle=e,this.dragging=t}return e.prototype.apply=function(t){var n,r,o=t.getMeta(a.tableRowResizeKey);if(o&&null!=o.setHandle)return new e(o.setHandle,null);if(o&&void 0!==o.setDragging)return new e(this.activeHandle,o.setDragging);if(this.activeHandle>-1){var i=t.mapping.map(this.activeHandle,-1);"row"===(r=t.doc.resolve(i)).parent.type.spec.tableRole&&r.nodeAfter||(i=null),n=new e(i,this.dragging)}return n||this},e}();function u(e,t){var n=e.state.tr;n.setMeta("addToHistory",!1),n.setMeta(a.tableRowResizeKey,{setHandle:t}),e.dispatch(n)}},5652:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tableResizing=void 0;var r=n(7582),o=n(2391),i=n(3352),a=n(8230),s=n(3147),l=n(8115),c={southeast:!0,southwest:!0,northwest:!0,northeast:!0},u=r.__assign({east:!0,west:!0},c),f=r.__assign({south:!0,north:!0},c),d=function(){function e(e,t,n){this.activeHandle=e,this.dragging=t,this.nodePosition=n}return e.prototype.apply=function(t){var n=t.getMeta(a.tableResizeKey);return n?new e(n.activeHandle,n.setDragging,n.nodePosition):this},e}(),h=function(e){var t=Array.from(e.firstChild.children).map((function(e){return e.offsetWidth})),n=Array.from(e.rows).map((function(e){return e.offsetHeight})),r=t.reduce((function(e,t){return e+t}),0),o=n.reduce((function(e,t){return e+t}),0),i=e.offsetHeight;return{width:r,height:o,colsWidth:t,rowsHeight:n,offsetWidth:e.offsetWidth,offsetHeight:i}},p=function(e,t){var n=t.target.getAttribute(i.dataResizeDirTable);if(!n)return!1;var o=a.tableResizeKey.getState(e.state);t.preventDefault();var c=e.state.tr;c.setMeta(a.tableResizeKey,{setDragging:{startX:t.clientX,startY:t.clientY},activeHandle:n,nodePosition:o.nodePosition}),c.setMeta("addToHistory",!1),function(e,t,n){var r=e.state.doc.nodeAt(n),o=(0,a.getTable)(e.nodeDOM(n)),l=h(o),c=l.width,u=l.height,f=l.colsWidth,d=l.rowsHeight,p=l.offsetWidth,m=l.offsetHeight,v=o.firstChild,g=Array.from(v&&v.children||[]),y=!1;g.forEach((function(e,t){e.style.width&&!/%$/.test(e.style.width)&&(e.style.width=100*f[t]/c+"%",y=!0)}));var b=!1;r.forEach((function(e,r,o){var i=(0,s.parseStyle)(e.attrs.style).height;i&&!/%$/.test(i)&&(t.setNodeMarkup(n+r+1,null,(0,s.setNodeStyle)(e.attrs,"height",100*d[o]/u+"%")),b=!0)}));var w=r.attrs;(0,s.parseStyle)(w.style).width!==p+"px"&&(w=(0,s.setNodeStyle)(w,"width",p+"px")),y&&(w[i.colgroupAttr]=v.outerHTML),b&&(w=(0,s.setNodeStyle)(w,"height",m+"px")),(y||b)&&t.setNodeMarkup(n,null,w)}(e,c,o.nodePosition),e.dispatch(c);var d=t.view||window;function p(t){!function(e,t){var n,r=a.tableResizeKey.getState(e.state),o=r.dragging,i=r.nodePosition,s=r.activeHandle;if(!(i<0)&&o){var c=(0,a.getTable)(e.nodeDOM(i)),d=c.getBoundingClientRect(),h=l.directions[s],p=(t.clientX-o.startX)*h.x,m=(t.clientY-o.startY)*h.y,v=(c.ownerDocument&&c.ownerDocument.defaultView||window).getComputedStyle(c),g=/px/.test(v.width)?parseFloat(v.width):c.offsetWidth,y=/px/.test(v.height)?parseFloat(v.height):c.offsetHeight,b=h.x?p+g:d.width,w=h.y?m+y:d.height;if(o.startX=h.x?t.clientX:o.startX,o.startY=h.y?t.clientY:o.startY,u[s]&&(c.style.width=b+"px"),f[s]&&(c.style.height=w+"px"),/px/.test(c.style.width)){var k=null===(n=c.parentNode)||void 0===n?void 0:n.parentNode;k instanceof HTMLDivElement&&k.matches("div[table]")&&/%/.test(k.style.width)&&(k.style.width="")}}}(e,t)}return d.addEventListener("mouseup",(function t(){d.removeEventListener("mouseup",t),d.removeEventListener("mousemove",p),function(e){var t=a.tableResizeKey.getState(e.state),n=t.dragging,o=t.nodePosition,l=t.activeHandle;if(n){var c=e.state.doc.nodeAt(o),d=(0,a.getTable)(e.nodeDOM(o)),p=h(d);if(c){var m=p.offsetWidth+"px",v=p.offsetHeight+"px",g=e.state.tr,y=c.attrs,b=(0,s.parseStyle)(y.style);if(u[l]&&d.style.width&&b.width!==m&&(y=(0,s.setNodeStyle)(y,"width",m)),f[l]&&d.style.height&&b.height!==v&&(y=(0,s.setNodeStyle)(y,"height",v)),y=function(e,t,n,o){var l=e.state.doc.nodeAt(n),c=(0,a.getTable)(e.nodeDOM(n)),u=(c.ownerDocument&&c.ownerDocument.defaultView||window).getComputedStyle,f=Array.from(c.rows);l.forEach((function(e,r,o){var i=(0,s.parseStyle)(e.attrs.style).height;i&&!/px$/.test(i)&&t.setNodeMarkup(n+r+1,null,(0,s.setNodeStyle)(e.attrs,"height",u(f[o]).height))}));var d=c.firstChild,h=Array.from(d&&d.children||[]),p=!1;h.forEach((function(e,t){e.style.width&&!/px$/.test(e.style.width)&&(e.style.width=u(h[t]).width,p=!0)}));var m=r.__assign({},o);return p&&(m[i.colgroupAttr]=d.outerHTML),m}(e,g,o,y),g.setNodeMarkup(o,null,y),g.setMeta("commandName","node-resize"),g.setMeta("args",y),g.setMeta(a.tableResizeKey,{setDragging:null,activeHandle:null,nodePosition:o}),!/%/.test((0,s.parseStyle)(y.style).width||"")){var w=g.doc.resolve(o),k=(0,s.parentNode)(w,(function(e){return"table_wrapper"===e.type.name}));if(k&&/%/.test((0,s.parseStyle)(k.node.attrs.style).width||"")){var S=(0,s.setNodeStyle)(k.node.attrs,"width",""),x=w.start(k.depth)-1;g.setNodeMarkup(x,null,S)}}e.dispatch(g)}}}(e)})),d.addEventListener("mousemove",p),!0};t.tableResizing=function(e){return void 0===e&&(e={node:"table"}),new o.Plugin({key:a.tableResizeKey,view:function(){return{selectedNode:function(e,t){var n=e.selection;if(n instanceof o.NodeSelection&&t===n.node.type&&n instanceof o.NodeSelection)return{node:n.node,pos:n.from};var r=(0,s.parentNode)(n.$from,(function(e){return e.type===t})),i=r&&r.node;return i?{node:i,pos:n.$from.start(r.depth)-1}:null},update:function(t,n){var o,s,l,c,u,f=t.state,d=f.schema.nodes[e.node],h=this.selectedNode(f,d),p=this.selectedNode(n,d);if((h||!p||n.doc.eq(t.state.doc))&&(h||p)){var m=f.tr;if(m.setMeta("addToHistory",!1),h&&p&&h.pos!==p.pos){m.setMeta(a.tableResizeKey,{nodePosition:h.pos});var v=m.doc.nodeAt(p.pos);v&&v.type.name===d.name&&m.setNodeMarkup(p.pos,d,r.__assign(r.__assign({},p.node.attrs),((o={})[i.resizableAttr]=!1,o))),m.setNodeMarkup(h.pos,d,r.__assign(r.__assign({},h.node.attrs),((s={})[i.resizableAttr]=!0,s))),t.dispatch(m)}else h&&p&&h.pos===p.pos&&!h.node.attrs[i.resizableAttr]&&!f.selection.eq(n.selection)?(m.setMeta(a.tableResizeKey,{nodePosition:h.pos}),t.dispatch(m.setNodeMarkup(h.pos,d,r.__assign(r.__assign({},h.node.attrs),((l={})[i.resizableAttr]=!0,l))))):h&&!p?(m.setMeta(a.tableResizeKey,{nodePosition:h.pos}),t.dispatch(m.setNodeMarkup(h.pos,d,r.__assign(r.__assign({},h.node.attrs),((c={})[i.resizableAttr]=!0,c))))):!h&&p&&(m.setMeta(a.tableResizeKey,{nodePosition:-1}),t.dispatch(m.setNodeMarkup(p.pos,d,r.__assign(r.__assign({},p.node.attrs),((u={})[i.resizableAttr]=!1,u)))))}}}},state:{init:function(){return new d("",null,-1)},apply:function(e,t){return t.apply(e)}},props:{handleDOMEvents:{mousedown:function(e,t){return p(e,t)}}}})}},6652:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableWrapperView=t.TableView=void 0;var r=n(3352),o=n(4221),i=n(8115),a=n(3147),s=function(){function e(e,t){this.node=e,this.view=t,this.dom=document.createElement("div"),this.dom.className=r.resizableWrap,this.table=this.dom.appendChild(document.createElement("table")),e.attrs[r.colgroupAttr]&&this.renderColgroup(e.attrs[r.colgroupAttr]);var n=this.table.appendChild(document.createElement("tbody"));this.setAttributes(this.table,e.attrs),this.resizeHandles=i.handles.map((function(e){var t=document.createElement("span");return t.className=r.resizeHandle+" "+e,t.setAttribute(r.dataResizeDirTable,e),t})),this.contentDOM=n}return e.prototype.update=function(e){var t=this;if(e.type!==this.node.type)return!1;var n=this.node;return this.node=e,e.attrs[r.resizableAttr]?this.resizeHandles.forEach((function(e){t.dom.appendChild(e)})):Array.from(this.dom.children).filter((function(e){return e.classList.contains(r.resizeHandle)})).forEach((function(e){return e.remove()})),this.setAttributes(this.table,e.attrs),n.attrs[r.colgroupAttr]!==e.attrs[r.colgroupAttr]&&this.renderColgroup(e.attrs[r.colgroupAttr]),!0},e.prototype.ignoreMutation=function(e){return"attributes"===e.type&&(e.target===this.table||e.target.firstChild===this.table||this.colgroup&&this.colgroup.contains(e.target))},e.prototype.destroy=function(){this.node=void 0,this.view=void 0,this.table=void 0,this.colgroup=void 0,this.resizeHandles=void 0},e.prototype.renderColgroup=function(e){this.table&&this.table.firstChild&&"COLGROUP"===this.table.firstChild.nodeName&&this.table.removeChild(this.table.firstChild),e&&(this.colgroup=(0,o.parseStrColgroup)(e),this.table.insertBefore(this.colgroup,this.table.firstChild))},e.prototype.setAttributes=function(e,t){var n=[r.colgroupAttr,r.resizableAttr];for(var o in t)o&&-1===n.indexOf(o)&&(0,a.setAttribute)(e,o,t[o]);/%$/.test(e.style.width)?(this.dom.style.width=e.style.width,e.style.width=""):this.dom.style.width=""},e}();t.TableView=s;var l=function(){function e(e,t){this.node=e,this.view=t,this.dom=document.createElement("div"),this.setAttributes(this.dom,e.attrs),this.contentDOM=this.dom}return e.prototype.update=function(e){return e.type===this.node.type&&(this.node=e,this.setAttributes(this.dom,e.attrs),!0)},e.prototype.ignoreMutation=function(e){return"attributes"===e.type&&"style"===e.attributeName},e.prototype.destroy=function(){this.node=void 0,this.view=void 0},e.prototype.setAttributes=function(e,t){for(var n in t)n&&(0,a.setAttribute)(e,n,t[n]);if(e.setAttribute("table",""),/%/.test(e.style.width)){var r=this.node&&this.node.lastChild,o=(r?(0,a.parseStyle)(r.attrs.style):{}).width||"";o&&!/%/.test(o)&&(e.style.width="")}},e}();t.TableWrapperView=l},8230:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.edgeCell=t.cellIndexes=t.domCellAround=t.getTable=t.otherResizeHandle=t.otherResizing=t.tableRowResizeKey=t.tableColumnResizeKey=t.tableResizeKey=void 0;var r=n(2391),o=n(1640),i=n(3147);t.tableResizeKey=new r.PluginKey("table-resize"),t.tableColumnResizeKey=new r.PluginKey("table-column-resizing"),t.tableRowResizeKey=new r.PluginKey("table-row-resizing"),t.otherResizing=function(e,n){var r=!1;return(r=(r=r||e!==t.tableResizeKey&&Boolean(t.tableResizeKey.get(n))&&t.tableResizeKey.getState(n).dragging)||e!==t.tableColumnResizeKey&&Boolean(t.tableColumnResizeKey.get(n))&&t.tableColumnResizeKey.getState(n).dragging)||e!==t.tableRowResizeKey&&Boolean(t.tableRowResizeKey.get(n))&&t.tableRowResizeKey.getState(n).dragging},t.otherResizeHandle=function(e,n){var r=!1;return(r=r||e!==t.tableColumnResizeKey&&Boolean(t.tableColumnResizeKey.get(n))&&t.tableColumnResizeKey.getState(n).activeHandle>-1)||e!==t.tableRowResizeKey&&Boolean(t.tableRowResizeKey.get(n))&&t.tableRowResizeKey.getState(n).activeHandle>-1},t.getTable=function(e){return e&&e.firstChild&&"TABLE"===e.firstChild.nodeName?e.firstChild:e},t.domCellAround=function(e){for(;e&&"TD"!==e.nodeName&&"TH"!==e.nodeName;)e=e.classList.contains("ProseMirror")?null:e.parentNode;return e},t.cellIndexes=function(e){for(var t=function(e){var t=Array.from(e&&e.rows||[]),n=Array.from(t&&t[0]&&t[0].cells||[]).map((function(e){return e.colSpan})).reduce((function(e,t){return e+t}),0),r=t.map((function(){return new Array(n)}));return t.forEach((function(e,t){var n=0;Array.from(e.cells).forEach((function(e){for(var o=0;o<e.colSpan;o++){for(var i=0;i<e.rowSpan;i++){var a=r[t+i].findIndex((function(e,t){return t>=n&&!e}));r[t+i][a]=e}n++}}))})),r}(e.closest("table")),n=null,r=function(r){if(t[r].forEach((function(t,o){e===t&&(n={rowIndex:r,cellIndex:o})})),n)return"break"},o=0;o<t.length&&"break"!==r(o);o++);return n||{rowIndex:-1,cellIndex:-1}},t.edgeCell=function(e,t,n){var r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return-1;var a=e.state.doc.resolve(r.pos),s=(0,i.parentNode)(a,(function(e){return"table"===e.type.spec.tableRole}));if(null===s)return-1;var l=a.start(s.depth),c=s.node,u=o.TableMap.get(c);return l+u.map[u.width*n.rowIndex+n.cellIndex]}},5643:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setHtml=t.getHtml=t.parseContent=t.domToPmDoc=t.pmDocToFragment=t.fragmentToHtml=t.htmlToFragment=t.trimWhitespace=void 0;var r=n(9443),o=n(2391),i=n(3352),a=n(2066),s=n(3147),l=["div","ol","ul","li","table","tbody","thead","tfoot","caption","td","th","p","tr","col","colgroup","article","main","nav","header","footer","aside","section"],c=function(e,t){var n=(e.ownerDocument||document).createElement(t);Array.from(e.rows).filter((function(e){return e.getAttribute(i.rowTypeAttr)===t})).forEach((function(e){e.removeAttribute(i.rowTypeAttr),n.appendChild(e)})),n.children.length&&e.appendChild(n)},u=function(e,t){var n=t.toUpperCase();e.filter((function(e){return e.nodeName===n})).forEach((function(e){Array.from(e.children).forEach((function(n){n.setAttribute(i.rowTypeAttr,t),e.parentNode&&e.parentNode.insertBefore(n,e)})),e.remove()}))};t.trimWhitespace=function(e,t){void 0===t&&(t=l);var n=t.join("|");return e.replace(new RegExp("\\s*(<(?:"+n+")(?:\\s[^>]*?)?>)","g"),"$1").replace(new RegExp("(<\\/(?:"+n+")(?:\\s[^>]*?)?>)\\s*","g"),"$1")};var f="data-style",d=" "+f+"=",h=/<[^>]+>/gm,p=/\sstyle=/gm,m=function(e){return e.replace(p,d)};t.htmlToFragment=function(e){var t,n=document.createElement("template");return n.innerHTML=function(e){return e.replace(h,m)}(e),t=n.content,Array.from(t.querySelectorAll("["+f+"]")).forEach((function(e){var t=e.getAttribute(f);e.removeAttribute(f),(0,s.setStyleAttr)(e,t)})),n.content},t.fragmentToHtml=function(e){return Array.from(e.childNodes).reduce((function(e,t){return e+(t.outerHTML||t.textContent||"")}),"")},t.pmDocToFragment=function(e){var t=a.DOMSerializer.fromSchema(e.type.schema).serializeFragment(e.content);return function(e){Array.from(e.querySelectorAll("table")).forEach((function(e){c(e,"thead"),c(e,"tbody"),c(e,"tfoot");var t=Array.from(e.children).find((function(e){return 0===e.children.length}));t&&t.remove();var n=e.parentNode instanceof HTMLDivElement?e.parentNode:null;if(n&&n.matches("div[table]")){e.style.marginLeft=n.style.marginLeft,e.style.marginRight=n.style.marginRight;var r=Array.from(n.children).find((function(e){return e.matches("div[caption]")}));if(r&&"<img>"!==r.innerHTML){var o=e.createCaption();for(r.id&&(o.id=r.id),r.className&&(o.className=r.className),Array.from(r.style).forEach((function(e){o.style[e]=r.style[e]}));r.firstChild;)o.appendChild(r.firstChild)}n.style.width&&!e.style.width&&(e.style.width=n.style.width),n.parentNode.insertBefore(e,n),n.parentNode.removeChild(n)}}))}(t),t},t.domToPmDoc=function(e,t,n){return r.DOMParser.fromSchema(t).parse(e,n)},t.parseContent=function(e,n,r){var o,a=(0,t.htmlToFragment)(e);return o=a,Array.from(o.querySelectorAll("table")).forEach((function(e){var t=Array.from(e.children);t.some((function(e){return"THEAD"===e.nodeName||"TFOOT"===e.nodeName}))&&(u(t,"thead"),u(t,"tbody"),u(t,"tfoot"));var n=t.find((function(e){return"COLGROUP"===e.nodeName}));if(n&&(e.setAttribute(i.colgroupAttr,n.outerHTML),n.remove()),e.caption||e.style.marginLeft||e.style.marginRight){var r=document.createElement("div");if(r.setAttribute("table",""),r.style.display="table",r.style.marginLeft=e.style.marginLeft,r.style.marginRight=e.style.marginRight,e.caption){var o=document.createElement("div");for(o.setAttribute("caption",""),e.caption.id&&(o.id=e.caption.id),e.caption.className&&(o.className=e.caption.className),Array.from(e.caption.style).forEach((function(t){o.style[t]=e.caption.style[t]}));e.caption.firstChild;)o.appendChild(e.caption.firstChild);e.removeChild(e.caption),r.appendChild(o)}e.parentNode.insertBefore(r,e),r.appendChild(e),/%/.test(e.style.width)&&(r.style.width=e.style.width,e.style.width="")}})),(0,t.domToPmDoc)(a,n,r)},t.getHtml=function(e){var n=(0,t.pmDocToFragment)(e.doc);return(0,t.fragmentToHtml)(n)},t.setHtml=function(e,n,r){return void 0===n&&(n="setHTML"),void 0===r&&(r={preserveWhitespace:"full"}),function(i,a){return a(i.tr.setSelection(new o.AllSelection(i.doc)).replaceSelectionWith((0,t.parseContent)(e,i.schema,r)).setMeta("commandName",n))}}},8153:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pmDeleteColumn=t.pmAddColumnAfter=t.pmAddColumnBefore=t.pmAddRowAfter=t.pmAddRowBefore=t.deleteColumn=t.addColumnAfter=t.addColumnBefore=t.addRowAfter=t.addRowBefore=t.createTable=void 0;var r=n(7582),o=n(1640);Object.defineProperty(t,"pmAddRowAfter",{enumerable:!0,get:function(){return o.addRowAfter}}),Object.defineProperty(t,"pmAddRowBefore",{enumerable:!0,get:function(){return o.addRowBefore}}),Object.defineProperty(t,"pmAddColumnBefore",{enumerable:!0,get:function(){return o.addColumnBefore}}),Object.defineProperty(t,"pmAddColumnAfter",{enumerable:!0,get:function(){return o.addColumnAfter}}),Object.defineProperty(t,"pmDeleteColumn",{enumerable:!0,get:function(){return o.deleteColumn}});var i=n(3352),a=n(4221);t.createTable=function(e,t,n){for(var r,o=e.table,i=e.table_row,a=e.table_cell,s=[],l=0;l<t+1;l++){r=[];for(var c=0;c<n+1;c++)r.push(a.createAndFill());s.push(i.createAndFill(void 0,r))}return o.createAndFill(void 0,s)};var s=/^table$/,l=/^table_row$/,c=/^table_cell|table_header$/,u=function(e,t){for(var n=e.$head,r=n.depth;r>0;r--){var o=n.node(r);if(t.test(o.type.name))return{pos:n.before(r),node:o}}return null};t.addRowBefore=function(e,t){var n=t&&function(e){var n,r=u(e.selection,l),o=u(e.selection,s);if(r&&o&&r.node.attrs[i.rowTypeAttr]){for(var a=0,c=0;c<o.node.nodeSize;c++)if(o.node.child(c).eq(r.node)){a=c;break}var f=o.node.child(a-1),d=r.pos-f.nodeSize;e.setNodeMarkup(d,void 0,((n={})[i.rowTypeAttr]=r.node.attrs[i.rowTypeAttr],n))}return t(e)};return(0,o.addRowBefore)(e,n)},t.addRowAfter=function(e,t){var n=t&&function(e){var n,r=u(e.selection,l);if(r&&r.node.attrs[i.rowTypeAttr]){var o=r.pos+r.node.nodeSize;e.setNodeMarkup(o,void 0,((n={})[i.rowTypeAttr]=r.node.attrs[i.rowTypeAttr],n))}return t(e)};return(0,o.addRowAfter)(e,n)};var f=function(e,t){if(!e)return-1;var n=o.TableMap.get(e.node),r=u(t,c),i=n.map.indexOf(r.pos-e.pos-1),a=-1;return-1!==i&&(a=i%n.width),a},d=function(e,t,n){var o,s=f(t,e.selection),l=(0,a.parseStrColgroup)(t.node.attrs[i.colgroupAttr]);l.insertBefore(l.ownerDocument.createElement("col"),l.children[s+n]),e.setNodeMarkup(t.pos,null,r.__assign(r.__assign({},t.node.attrs),((o={})[i.colgroupAttr]=l.outerHTML,o)))};t.addColumnBefore=function(e,t){var n=t&&function(e){var n=u(e.selection,s);return n.node.attrs[i.colgroupAttr]?(d(e,n,-1),t(e)):t(e)};return(0,o.addColumnBefore)(e,n)},t.addColumnAfter=function(e,t){var n=t&&function(e){var n=u(e.selection,s);return n.node.attrs[i.colgroupAttr]?(d(e,n,1),t(e)):t(e)};return(0,o.addColumnAfter)(e,n)},t.deleteColumn=function(e,t){var n=u(e.selection,s),l=n&&n.node.attrs[i.colgroupAttr],c=f(n,e.selection),d=t&&function(e){if(!l)return t(e);var o=e.doc.nodeAt(n.pos);return function(e,t,n){var o,s=(0,a.parseStrColgroup)(t.node.attrs[i.colgroupAttr]);s.removeChild(s.children[n]),e.setNodeMarkup(t.pos,null,r.__assign(r.__assign({},t.node.attrs),((o={})[i.colgroupAttr]=s.outerHTML,o)))}(e,{node:o,pos:n.pos},c),t(e)};return(0,o.deleteColumn)(e,d)}},6149:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.insertText=void 0,t.insertText=function(e){return function(t,n){n(t.tr.insertText(e.text,e.from,e.to))}}},3147:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setAttribute=t.setStyleAttr=t.applyStyle=t.parseStyle=t.expandToWordWrap=t.expandSelection=t.shallowEqual=t.indentHtml=t.selectedLineTextOnly=t.getNodeFromSelection=t.getSelectionText=t.hasSameMarkup=t.insertNode=t.parentNode=t.findNthParentNodeOfType=t.canInsert=t.setNodeStyle=t.changeStylesString=void 0;var r=n(7582),o=n(9443),i=n(2391),a=n(400),s=n(5643);t.changeStylesString=function(e,n){var r=n.style,o=n.value,i=n.newValue;if(!e)return{changed:!1,style:null};for(var a=(0,t.parseStyle)(e),s=Object.keys(a),l=[],c=0;c<s.length;c++){var u=s[c];u.toLowerCase()===r&&o.test(a[u])||l.push("".concat(u,": ").concat(a[u]))}return i&&l.push("".concat(r,": ").concat(i)),{style:l.join("; ")+(l.length?";":""),changed:Boolean(i)||l.length!==s.length}};var l=/^.+$/;t.setNodeStyle=function(e,n,o){var i;if(new RegExp("[^-]?"+n+":").test(e.style||"")){var a=(0,t.changeStylesString)(e.style||"",{style:n,value:l,newValue:o}).style;i=r.__assign(r.__assign({},e),{style:a})}else i=e.style?r.__assign(r.__assign({},e),{style:e.style.replace(/;$/,"")+"; "+n+": "+o+";"}):r.__assign(r.__assign({},e),{style:n+": "+o+";"});return i},t.canInsert=function(e,t){for(var n=e.selection.$from,r=n.depth;r>=0;r--){var o=n.index(r);if(n.node(r).canReplaceWith(o,o,t))return!0}return!1};var c=function(e){return e instanceof o.Node?e.type.name:e.name};t.findNthParentNodeOfType=function(e,t){return void 0===t&&(t=1),function(n){return function(e,t){return void 0===t&&(t=1),function(n){for(var r=n.$from,o=r.depth;o>0;o--){var i=r.node(o);if(e(i)&&0==(t-=1))return{depth:o,node:i}}}}((function(t){return c(t)===c(e)}),t)(n)}},t.parentNode=function(e,t){for(var n=e.depth;n>0;n--){var r=e.node(n);if(t(r))return{node:r,depth:n}}return null};var u=function(e){var t={};for(var n in e)n&&(e[n]||0===e[n])&&(t[n]=e[n]);return t};t.insertNode=function(e,t){return function(n,o){var a=n.selection,s=n.tr;a instanceof i.NodeSelection&&a.node.type.name===e.type.name&&e.isLeaf&&!e.isText&&1===e.nodeSize?(s.setNodeMarkup(a.from,null,r.__assign(r.__assign({},u(a.node.attrs)),u(e.attrs))),s.setSelection(i.NodeSelection.create(s.doc,a.from))):s.replaceSelectionWith(e),t&&s.scrollIntoView(),o(s)}},t.hasSameMarkup=function(e,t,n,r){var i=o.Fragment.from((0,s.parseContent)(e,n,r)),a=o.Fragment.from((0,s.parseContent)(t,n,r));return i.eq(a)},t.getSelectionText=function(e){var t=e.selection;if(t instanceof i.TextSelection||t instanceof i.AllSelection){var n=t.content().content;return n.textBetween(0,n.size)}return""},t.getNodeFromSelection=function(e){if(e.selection instanceof i.NodeSelection)return e.selection.node},t.selectedLineTextOnly=function(e){var n="",r=!1,o=e.selection,i=e.doc,a=o.$from,s=o.$to,l=o.from,c=o.to;return a.sameParent(s)&&(i.nodesBetween(l,c,(function(e){r=r||e.isLeaf&&!e.isText})),r||(n=(0,t.getSelectionText)(e))),n},t.indentHtml=function(e){return e.replace(/<\/(p|li|ul|ol|h[1-6]|table|tr|td|th)>/gi,"</$1>\n").replace(/<(ul|ol)([^>]*)><li/gi,"<$1$2>\n<li").replace(/<br \/>/gi,"<br />\n").replace(/\n$/,"")},t.shallowEqual=function(e,t){var n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((function(n){return e[n]===t[n]}))};var f={before:/[^ !,?.\[\]{}()]+$/i,after:/^[^ !,?.\[\]{}()]+/i};t.expandSelection=function(e,t,n){if(!n.applyToWord||!e.selection.empty)return{state:e,dispatch:t};var r=!0===n.applyToWord?f:n.applyToWord,o=null,a=e.tr,s=e.selection,l=s.$head.nodeBefore,c=s.$head.nodeAfter;if(l&&"text"===l.type.name&&l.text&&c&&"text"===c.type.name&&c.text){var u=[];s.$head.parent.descendants((function(e,t){return u.push({node:e,pos:t}),!1}));for(var d=s.$head.parentOffset,h=u.findIndex((function(e){var t=e.node,n=e.pos;return n<=d&&n+t.nodeSize>=d})),p=u[h].node.text,m=!1,v=h-1;v>=0;v--){var g=u[v];!m&&g&&"text"===g.node.type.name?p=g.node.text+p:(m=!0,d-=g.node.nodeSize)}for(v=h+1;v<u.length&&((g=u[v])&&"text"===g.node.type.name);v++)p+=g.node.text;var y=p.substring(0,d),b=p.substring(d),w=r.before.exec(y),k=r.after.exec(b);if(w&&k){var S=w[0].length,x=k[0].length,C=o=s.from;return a.setSelection(i.TextSelection.create(e.doc,C-S,C+x)),{state:{tr:a,selection:a.selection,doc:a.doc,storedMarks:null,schema:a.doc.type.schema},dispatch:function(e){e.setSelection(i.TextSelection.create(e.doc,o)),t(e)}}}}return{state:e,dispatch:t}},t.expandToWordWrap=function(e,n){return function(r,o){var i=(0,t.expandSelection)(r,o,n),a=i.state,s=i.dispatch;return e(n)(a,s)}},t.parseStyle=function(e){return(0,a.parseInlineStyles)(e)},t.applyStyle=function(e,n,r){var o=(0,t.parseStyle)(e);o[n]=r;var i=Object.keys(o).map((function(e){return o[e]?"".concat(e,": ").concat(o[e]):null})).filter(Boolean).join("; ");return i?i+";":null},t.setStyleAttr=function(e,n){var r=(0,t.parseStyle)(n);for(var o in r)o&&void 0!==e.style[o]&&(e.style[o]=r[o])},t.setAttribute=function(e,n,r){var o=e.getAttribute(n);void 0!==r&&r!==o?"style"===n?(e.removeAttribute(n),(0,t.setStyleAttr)(e,r)):e.setAttribute(n,r):void 0===r&&e.removeAttribute(n)}},6586:e=>{function t(e){this.content=e}t.prototype={constructor:t,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,n,r){var o=r&&r!=e?this.remove(r):this,i=o.find(e),a=o.content.slice();return-1==i?a.push(r||e,n):(a[i+1]=n,r&&(a[i]=r)),new t(a)},remove:function(e){var n=this.find(e);if(-1==n)return this;var r=this.content.slice();return r.splice(n,2),new t(r)},addToStart:function(e,n){return new t([e,n].concat(this.remove(e).content))},addToEnd:function(e,n){var r=this.remove(e).content.slice();return r.push(e,n),new t(r)},addBefore:function(e,n,r){var o=this.remove(n),i=o.content.slice(),a=o.find(e);return i.splice(-1==a?i.length:a,0,n,r),new t(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=t.from(e)).size?new t(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=t.from(e)).size?new t(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var n=this;e=t.from(e);for(var r=0;r<e.content.length;r+=2)n=n.remove(e.content[r]);return n},toObject:function(){var e={};return this.forEach((function(t,n){e[t]=n})),e},get size(){return this.content.length>>1}},t.from=function(e){if(e instanceof t)return e;var n=[];if(e)for(var r in e)n.push(r,e[r]);return new t(n)},e.exports=t},9270:(e,t,n)=>{var r=n(2843),o=n(9443),i=n(2391),a=function(e,t){return!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0)};function s(e,t){var n=e.selection.$cursor;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}var l=function(e,t,n){var a=s(e,n);if(!a)return!1;var l=d(a);if(!l){var c=a.blockRange(),f=c&&r.liftTarget(c);return null!=f&&(t&&t(e.tr.lift(c,f).scrollIntoView()),!0)}var h=l.nodeBefore;if(O(e,l,t,-1))return!0;if(0==a.parent.content.size&&(u(h,"end")||i.NodeSelection.isSelectable(h)))for(var p=a.depth;;p--){var m=r.replaceStep(e.doc,a.before(p),a.after(p),o.Slice.empty);if(m&&m.slice.size<m.to-m.from){if(t){var v=e.tr.step(m);v.setSelection(u(h,"end")?i.Selection.findFrom(v.doc.resolve(v.mapping.map(l.pos,-1)),-1):i.NodeSelection.create(v.doc,l.pos-h.nodeSize)),t(v.scrollIntoView())}return!0}if(1==p||a.node(p-1).childCount>1)break}return!(!h.isAtom||l.depth!=a.depth-1||(t&&t(e.tr.delete(l.pos-h.nodeSize,l.pos).scrollIntoView()),0))};function c(e,t,n){for(var a=t.nodeBefore,s=t.pos-1;!a.isTextblock;s--){if(a.type.spec.isolating)return!1;var l=a.lastChild;if(!l)return!1;a=l}for(var c=t.nodeAfter,u=t.pos+1;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;var f=c.firstChild;if(!f)return!1;c=f}var d=r.replaceStep(e.doc,s,u,o.Slice.empty);if(!d||d.from!=s||d instanceof r.ReplaceStep&&d.slice.size>=u-s)return!1;if(n){var h=e.tr.step(d);h.setSelection(i.TextSelection.create(h.doc,s)),n(h.scrollIntoView())}return!0}function u(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}var f=function(e,t,n){var r=e.selection,o=r.$head,a=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):o.parentOffset>0)return!1;a=d(o)}var s=a&&a.nodeBefore;return!(!s||!i.NodeSelection.isSelectable(s)||(t&&t(e.tr.setSelection(i.NodeSelection.create(e.doc,a.pos-s.nodeSize)).scrollIntoView()),0))};function d(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function h(e,t){var n=e.selection.$cursor;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}var p=function(e,t,n){var a=h(e,n);if(!a)return!1;var s=v(a);if(!s)return!1;var l=s.nodeAfter;if(O(e,s,t,1))return!0;if(0==a.parent.content.size&&(u(l,"start")||i.NodeSelection.isSelectable(l))){var c=r.replaceStep(e.doc,a.before(),a.after(),o.Slice.empty);if(c&&c.slice.size<c.to-c.from){if(t){var f=e.tr.step(c);f.setSelection(u(l,"start")?i.Selection.findFrom(f.doc.resolve(f.mapping.map(s.pos)),1):i.NodeSelection.create(f.doc,f.mapping.map(s.pos))),t(f.scrollIntoView())}return!0}}return!(!l.isAtom||s.depth!=a.depth-1||(t&&t(e.tr.delete(s.pos,s.pos+l.nodeSize).scrollIntoView()),0))},m=function(e,t,n){var r=e.selection,o=r.$head,a=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):o.parentOffset<o.parent.content.size)return!1;a=v(o)}var s=a&&a.nodeAfter;return!(!s||!i.NodeSelection.isSelectable(s)||(t&&t(e.tr.setSelection(i.NodeSelection.create(e.doc,a.pos)).scrollIntoView()),0))};function v(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){var n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var g=function(e,t){var n=e.selection,r=n.$head,o=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(o)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))};function y(e){for(var t=0;t<e.edgeCount;t++){var n=e.edge(t).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var b=function(e,t){var n=e.selection,r=n.$head,o=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(o))return!1;var a=r.node(-1),s=r.indexAfter(-1),l=y(a.contentMatchAt(s));if(!l||!a.canReplaceWith(s,s,l))return!1;if(t){var c=r.after(),u=e.tr.replaceWith(c,c,l.createAndFill());u.setSelection(i.Selection.near(u.doc.resolve(c),1)),t(u.scrollIntoView())}return!0},w=function(e,t){var n=e.selection,r=n.$from,o=n.$to;if(n instanceof i.AllSelection||r.parent.inlineContent||o.parent.inlineContent)return!1;var a=y(o.parent.contentMatchAt(o.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){var s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=e.tr.insert(s,a.createAndFill());l.setSelection(i.TextSelection.create(l.doc,s+1)),t(l.scrollIntoView())}return!0},k=function(e,t){var n=e.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var o=n.before();if(r.canSplit(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}var i=n.blockRange(),a=i&&r.liftTarget(i);return null!=a&&(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)};function S(e){return function(t,n){var o=t.selection,a=o.$from,s=o.$to;if(t.selection instanceof i.NodeSelection&&t.selection.node.isBlock)return!(!a.parentOffset||!r.canSplit(t.doc,a.pos)||(n&&n(t.tr.split(a.pos).scrollIntoView()),0));if(!a.depth)return!1;for(var l,c,u=[],f=!1,d=!1,h=a.depth;;h--){if(a.node(h).isBlock){f=a.end(h)==a.pos+(a.depth-h),d=a.start(h)==a.pos-(a.depth-h),c=y(a.node(h-1).contentMatchAt(a.indexAfter(h-1)));var p=e&&e(s.parent,f,a);u.unshift(p||(f&&c?{type:c}:null)),l=h;break}if(1==h)return!1;u.unshift(null)}var m=t.tr;(t.selection instanceof i.TextSelection||t.selection instanceof i.AllSelection)&&m.deleteSelection();var v=m.mapping.map(a.pos),g=r.canSplit(m.doc,v,u.length,u);if(g||(u[0]=c?{type:c}:null,g=r.canSplit(m.doc,v,u.length,u)),m.split(v,u.length,u),!f&&d&&a.node(l).type!=c){var b=m.mapping.map(a.before(l)),w=m.doc.resolve(b);c&&a.node(l-1).canReplaceWith(w.index(),w.index()+1,c)&&m.setNodeMarkup(m.mapping.map(a.before(l)),c)}return n&&n(m.scrollIntoView()),!0}}var x=S(),C=function(e,t){return t&&t(e.tr.setSelection(new i.AllSelection(e.doc))),!0};function O(e,t,n,a){var s,l,c=t.nodeBefore,f=t.nodeAfter,d=c.type.spec.isolating||f.type.spec.isolating;if(!d&&function(e,t,n){var o=t.nodeBefore,i=t.nodeAfter,a=t.index();return!(!(o&&i&&o.type.compatibleContent(i.type))||(!o.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(a,a+1)||!i.isTextblock&&!r.canJoin(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;var h=!d&&t.parent.canReplace(t.index(),t.index()+1);if(h&&(s=(l=c.contentMatchAt(c.childCount)).findWrapping(f.type))&&l.matchType(s[0]||f.type).validEnd){if(n){for(var p=t.pos+f.nodeSize,m=o.Fragment.empty,v=s.length-1;v>=0;v--)m=o.Fragment.from(s[v].create(null,m));m=o.Fragment.from(c.copy(m));var g=e.tr.step(new r.ReplaceAroundStep(t.pos-1,p,t.pos,p,new o.Slice(m,1,0),s.length,!0)),y=g.doc.resolve(p+2*s.length);y.nodeAfter&&y.nodeAfter.type==c.type&&r.canJoin(g.doc,y.pos)&&g.join(y.pos),n(g.scrollIntoView())}return!0}var b=f.type.spec.isolating||a>0&&d?null:i.Selection.findFrom(t,1),w=b&&b.$from.blockRange(b.$to),k=w&&r.liftTarget(w);if(null!=k&&k>=t.depth)return n&&n(e.tr.lift(w,k).scrollIntoView()),!0;if(h&&u(f,"start",!0)&&u(c,"end")){for(var S=c,x=[];x.push(S),!S.isTextblock;)S=S.lastChild;for(var C=f,O=1;!C.isTextblock;C=C.firstChild)O++;if(S.canReplace(S.childCount,S.childCount,C.content)){if(n){for(var M=o.Fragment.empty,T=x.length-1;T>=0;T--)M=o.Fragment.from(x[T].copy(M));n(e.tr.step(new r.ReplaceAroundStep(t.pos-x.length,t.pos+f.nodeSize,t.pos+O,t.pos+f.nodeSize-O,new o.Slice(M,x.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function M(e){return function(t,n){for(var r=t.selection,o=e<0?r.$from:r.$to,a=o.depth;o.node(a).isInline;){if(!a)return!1;a--}return!!o.node(a).isTextblock&&(n&&n(t.tr.setSelection(i.TextSelection.create(t.doc,e<0?o.start(a):o.end(a)))),!0)}}var T=M(-1),A=M(1);function N(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e,n,r){for(var o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}var R=N(a,l,f),D=N(a,p,m),_={Enter:N(g,w,k,x),"Mod-Enter":b,Backspace:R,"Mod-Backspace":R,"Shift-Backspace":R,Delete:D,"Mod-Delete":D,"Mod-a":C},E={"Ctrl-h":_.Backspace,"Alt-Backspace":_["Mod-Backspace"],"Ctrl-d":_.Delete,"Ctrl-Alt-Backspace":_["Mod-Delete"],"Alt-Delete":_["Mod-Delete"],"Alt-d":_["Mod-Delete"],"Ctrl-a":T,"Ctrl-e":A};for(var P in _)E[P]=_[P];var z=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&"darwin"==os.platform())?E:_;t.autoJoin=function(e,t){var n=Array.isArray(t)?function(e){return t.indexOf(e.type.name)>-1}:t;return function(t,o,i){return e(t,o&&function(e,t){return function(n){if(!n.isGeneric)return e(n);for(var o=[],i=0;i<n.mapping.maps.length;i++){for(var a=n.mapping.maps[i],s=0;s<o.length;s++)o[s]=a.map(o[s]);a.forEach((function(e,t,n,r){return o.push(n,r)}))}for(var l=[],c=0;c<o.length;c+=2)for(var u=o[c],f=o[c+1],d=n.doc.resolve(u),h=d.sharedDepth(f),p=d.node(h),m=d.indexAfter(h),v=d.after(h+1);v<=f;++m){var g=p.maybeChild(m);if(!g)break;if(m&&-1==l.indexOf(v)){var y=p.child(m-1);y.type==g.type&&t(y,g)&&l.push(v)}v+=g.nodeSize}l.sort((function(e,t){return e-t}));for(var b=l.length-1;b>=0;b--)r.canJoin(n.doc,l[b])&&n.join(l[b]);e(n)}}(o,n),i)}},t.baseKeymap=z,t.chainCommands=N,t.createParagraphNear=w,t.deleteSelection=a,t.exitCode=b,t.joinBackward=l,t.joinDown=function(e,t){var n,o=e.selection;if(o instanceof i.NodeSelection){if(o.node.isTextblock||!r.canJoin(e.doc,o.to))return!1;n=o.to}else if(null==(n=r.joinPoint(e.doc,o.to,1)))return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0},t.joinForward=p,t.joinTextblockBackward=function(e,t,n){var r=s(e,n);if(!r)return!1;var o=d(r);return!!o&&c(e,o,t)},t.joinTextblockForward=function(e,t,n){var r=h(e,n);if(!r)return!1;var o=v(r);return!!o&&c(e,o,t)},t.joinUp=function(e,t){var n,o=e.selection,a=o instanceof i.NodeSelection;if(a){if(o.node.isTextblock||!r.canJoin(e.doc,o.from))return!1;n=o.from}else if(null==(n=r.joinPoint(e.doc,o.from,-1)))return!1;if(t){var s=e.tr.join(n);a&&s.setSelection(i.NodeSelection.create(s.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(s.scrollIntoView())}return!0},t.lift=function(e,t){var n=e.selection,o=n.$from,i=n.$to,a=o.blockRange(i),s=a&&r.liftTarget(a);return null!=s&&(t&&t(e.tr.lift(a,s).scrollIntoView()),!0)},t.liftEmptyBlock=k,t.macBaseKeymap=E,t.newlineInCode=g,t.pcBaseKeymap=_,t.selectAll=C,t.selectNodeBackward=f,t.selectNodeForward=m,t.selectParentNode=function(e,t){var n,r=e.selection,o=r.$from,a=r.to,s=o.sharedDepth(a);return 0!=s&&(n=o.before(s),t&&t(e.tr.setSelection(i.NodeSelection.create(e.doc,n))),!0)},t.selectTextblockEnd=A,t.selectTextblockStart=T,t.setBlockType=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,r){for(var o=!1,i=0;i<n.selection.ranges.length&&!o;i++){var a=n.selection.ranges[i],s=a.$from.pos,l=a.$to.pos;n.doc.nodesBetween(s,l,(function(r,i){if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{var a=n.doc.resolve(i),s=a.index();o=a.parent.canReplaceWith(s,s+1,e)}}))}if(!o)return!1;if(r){for(var c=n.tr,u=0;u<n.selection.ranges.length;u++){var f=n.selection.ranges[u],d=f.$from.pos,h=f.$to.pos;c.setBlockType(d,h,e,t)}r(c.scrollIntoView())}return!0}},t.splitBlock=x,t.splitBlockAs=S,t.splitBlockKeepMarks=function(e,t){return x(e,t&&function(n){var r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();r&&n.ensureMarks(r),t(n)})},t.toggleMark=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=!1!==(n&&n.removeWhenPresent),o=!1!==(n&&n.enterInlineAtoms);return function(n,a){var s=n.selection,l=s.empty,c=s.$cursor,u=s.ranges;if(l&&!c||!function(e,t,n,r){for(var o,i=function(){var o=t[a],i=o.$from,s=o.$to,l=0==i.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(i.pos,s.pos,(function(e,t){if(l||!r&&e.isAtom&&e.isInline&&t>=i.pos&&t+e.nodeSize<=s.pos)return!1;l=e.inlineContent&&e.type.allowsMarkType(n)})),l)return{v:!0}},a=0;a<t.length;a++)if(o=i())return o.v;return!1}(n.doc,u,e,o))return!1;if(a)if(c)e.isInSet(n.storedMarks||c.marks())?a(n.tr.removeStoredMark(e)):a(n.tr.addStoredMark(e.create(t)));else{var f,d=n.tr;o||(u=function(e){for(var t=[],n=function(){var n=e[r],o=n.$from,a=n.$to;o.doc.nodesBetween(o.pos,a.pos,(function(e,n){if(e.isAtom&&e.content.size&&e.isInline&&n>=o.pos&&n+e.nodeSize<=a.pos)return n+1>o.pos&&t.push(new i.SelectionRange(o,o.doc.resolve(n+1))),o=o.doc.resolve(n+1+e.content.size),!1})),o.pos<a.pos&&t.push(new i.SelectionRange(o,a))},r=0;r<e.length;r++)n();return t}(u)),f=r?!u.some((function(t){return n.doc.rangeHasMark(t.$from.pos,t.$to.pos,e)})):!u.every((function(t){var n=!1;return d.doc.nodesBetween(t.$from.pos,t.$to.pos,(function(r,o,i){if(n)return!1;n=!e.isInSet(r.marks)&&!!i&&i.type.allowsMarkType(e)&&!(r.isText&&/^\s*$/.test(r.textBetween(Math.max(0,t.$from.pos-o),Math.min(r.nodeSize,t.$to.pos-o))))})),!n}));for(var h=0;h<u.length;h++){var p=u[h],m=p.$from,v=p.$to;if(f){var g=m.pos,y=v.pos,b=m.nodeAfter,w=v.nodeBefore,k=b&&b.isText?/^\s*/.exec(b.text)[0].length:0,S=w&&w.isText?/\s*$/.exec(w.text)[0].length:0;g+k<y&&(g+=k,y-=S),d.addMark(g,y,e.create(t))}else d.removeMark(m.pos,v.pos,e)}a(d.scrollIntoView())}return!0}},t.wrapIn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,o){var i=n.selection,a=i.$from,s=i.$to,l=a.blockRange(s),c=l&&r.findWrapping(l,e,t);return!!c&&(o&&o(n.tr.wrap(l,c).scrollIntoView()),!0)}}},1588:(e,t,n)=>{function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2391),i=n(2843),a=function(){function e(t,n){var r,o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(r=n.width)&&void 0!==r?r:1,this.color=!1===n.color?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map((function(e){var n=function(t){o[e](t)};return t.dom.addEventListener(e,n),{name:e,handler:n}}))}var t,n;return t=e,(n=[{key:"destroy",value:function(){var e=this;this.handlers.forEach((function(t){var n=t.name,r=t.handler;return e.editorView.dom.removeEventListener(n,r)}))}},{key:"update",value:function(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}},{key:"setCursor",value:function(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}},{key:"updateOverlay",value:function(){var e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent;if(n){var r=t.nodeBefore,o=t.nodeAfter;if(r||o){var i=this.editorView.nodeDOM(this.cursorPos-(r?r.nodeSize:0));if(i){var a=i.getBoundingClientRect(),s=r?a.bottom:a.top;r&&o&&(s=(s+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),e={left:a.left,right:a.right,top:s-this.width/2,bottom:s+this.width/2}}}}if(!e){var l=this.editorView.coordsAtPos(this.cursorPos);e={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}var c,u,f=this.editorView.dom.offsetParent;if(this.element||(this.element=f.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!f||f==document.body&&"static"==getComputedStyle(f).position)c=-pageXOffset,u=-pageYOffset;else{var d=f.getBoundingClientRect();c=d.left-f.scrollLeft,u=d.top-f.scrollTop}this.element.style.left=e.left-c+"px",this.element.style.top=e.top-u+"px",this.element.style.width=e.right-e.left+"px",this.element.style.height=e.bottom-e.top+"px"}},{key:"scheduleRemoval",value:function(e){var t=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return t.setCursor(null)}),e)}},{key:"dragover",value:function(e){if(this.editorView.editable){var t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,t,e):r;if(t&&!o){var a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){var s=i.dropPoint(this.editorView.state.doc,a,this.editorView.dragging.slice);null!=s&&(a=s)}this.setCursor(a),this.scheduleRemoval(5e3)}}}},{key:"dragend",value:function(){this.scheduleRemoval(20)}},{key:"drop",value:function(){this.scheduleRemoval(20)}},{key:"dragleave",value:function(e){e.target!=this.editorView.dom&&this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}])&&r(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.dropCursor=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new o.Plugin({view:function(t){return new a(t,e)}})}},1634:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}Object.defineProperty(t,"__esModule",{value:!0});var c=n(7354),u=n(2391),f=n(9443),d=n(9222),h=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(c,e);var t,n,i=(t=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,o=l(t);if(n){var i=l(this).constructor;e=Reflect.construct(o,arguments,i)}else e=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function c(e){return o(this,c),i.call(this,e,e)}return a(c,[{key:"map",value:function(e,t){var n=e.resolve(t.map(this.head));return c.valid(n)?new c(n):u.Selection.near(n)}},{key:"content",value:function(){return f.Slice.empty}},{key:"eq",value:function(e){return e instanceof c&&e.head==this.head}},{key:"toJSON",value:function(){return{type:"gapcursor",pos:this.head}}},{key:"getBookmark",value:function(){return new p(this.anchor)}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new c(e.resolve(t.pos))}},{key:"valid",value:function(e){var t=e.parent;if(t.isTextblock||!function(e){for(var t=e.depth;t>=0;t--){var n=e.index(t),r=e.node(t);if(0!=n)for(var o=r.child(n-1);;o=o.lastChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(var t=e.depth;t>=0;t--){var n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(var o=r.child(n);;o=o.firstChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;var n=t.type.spec.allowGapCursor;if(null!=n)return n;var r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}},{key:"findGapCursorFrom",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e:for(;;){if(!n&&c.valid(e))return e;for(var r=e.pos,o=null,i=e.depth;;i--){var a=e.node(i);if(t>0?e.indexAfter(i)<a.childCount:e.index(i)>0){o=a.child(t>0?e.indexAfter(i):e.index(i)-1);break}if(0==i)return null;r+=t;var s=e.doc.resolve(r);if(c.valid(s))return s}for(;;){var l=t>0?o.firstChild:o.lastChild;if(!l){if(o.isAtom&&!o.isText&&!u.NodeSelection.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*t),n=!1;continue e}break}o=l,r+=t;var f=e.doc.resolve(r);if(c.valid(f))return f}return null}}}]),c}(u.Selection);h.prototype.visible=!1,h.findFrom=h.findGapCursorFrom,u.Selection.jsonID("gapcursor",h);var p=function(){function e(t){o(this,e),this.pos=t}return a(e,[{key:"map",value:function(t){return new e(t.map(this.pos))}},{key:"resolve",value:function(e){var t=e.resolve(this.pos);return h.valid(t)?new h(t):u.Selection.near(t)}}]),e}(),m=c.keydownHandler({ArrowLeft:v("horiz",-1),ArrowRight:v("horiz",1),ArrowUp:v("vert",-1),ArrowDown:v("vert",1)});function v(e,t){var n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,o){var i=e.selection,a=t>0?i.$to:i.$from,s=i.empty;if(i instanceof u.TextSelection){if(!o.endOfTextblock(n)||0==a.depth)return!1;s=!1,a=e.doc.resolve(t>0?a.after():a.before())}var l=h.findGapCursorFrom(a,t,s);return!!l&&(r&&r(e.tr.setSelection(new h(l))),!0)}}function g(e,t,n){if(!e||!e.editable)return!1;var r=e.state.doc.resolve(t);if(!h.valid(r))return!1;var o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&u.NodeSelection.isSelectable(e.state.doc.nodeAt(o.inside))||(e.dispatch(e.state.tr.setSelection(new h(r))),0))}function y(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof h))return!1;var n=e.state.selection.$from,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;for(var o=f.Fragment.empty,i=r.length-1;i>=0;i--)o=f.Fragment.from(r[i].createAndFill(null,o));var a=e.state.tr.replace(n.pos,n.pos,new f.Slice(o,0,0));return a.setSelection(u.TextSelection.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function b(e){if(!(e.selection instanceof h))return null;var t=document.createElement("div");return t.className="ProseMirror-gapcursor",d.DecorationSet.create(e.doc,[d.Decoration.widget(e.selection.head,t,{key:"gapcursor"})])}t.GapCursor=h,t.gapCursor=function(){return new u.Plugin({props:{decorations:b,createSelectionBetween:function(e,t,n){return t.pos==n.pos&&h.valid(n)?new h(n):null},handleClick:g,handleKeyDown:m,handleDOMEvents:{beforeinput:y}}})}},8638:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e){if("object"!==r(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===r(i)?i:String(i)),o)}var i}function a(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var s=n(3958),l=n(2843),c=n(2391),u=function(){function e(t,n){o(this,e),this.items=t,this.eventCount=n}return a(e,[{key:"popEvent",value:function(t,n){var r=this;if(0==this.eventCount)return null;for(var o,i,a=this.items.length;;a--)if(this.items.get(a-1).selection){--a;break}n&&(o=this.remapping(a,this.items.length),i=o.maps.length);var s,l,c=t.tr,u=[],d=[];return this.items.forEach((function(t,n){if(!t.step)return o||(o=r.remapping(a,n+1),i=o.maps.length),i--,void d.push(t);if(o){d.push(new f(t.map));var h,p=t.step.map(o.slice(i));p&&c.maybeStep(p).doc&&(h=c.mapping.maps[c.mapping.maps.length-1],u.push(new f(h,void 0,void 0,u.length+d.length))),i--,h&&o.appendMap(h,i)}else c.maybeStep(t.step);return t.selection?(s=o?t.selection.map(o.slice(i)):t.selection,l=new e(r.items.slice(0,a).append(d.reverse().concat(u)),r.eventCount-1),!1):void 0}),this.items.length,0),{remaining:l,transform:c,selection:s}}},{key:"addTransform",value:function(t,n,r,o){for(var i=[],a=this.eventCount,s=this.items,l=!o&&s.length?s.get(s.length-1):null,c=0;c<t.steps.length;c++){var u,d=t.steps[c].invert(t.docs[c]),p=new f(t.mapping.maps[c],d,n);(u=l&&l.merge(p))&&(p=u,c?i.pop():s=s.slice(0,s.length-1)),i.push(p),n&&(a++,n=void 0),o||(l=p)}var m,v,g,y=a-r.depth;return y>h&&(v=y,(m=s).forEach((function(e,t){if(e.selection&&0==v--)return g=t,!1})),s=m.slice(g),a-=y),new e(s.append(i),a)}},{key:"remapping",value:function(e,t){var n=new l.Mapping;return this.items.forEach((function(t,r){var o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)}),e,t),n}},{key:"addMaps",value:function(t){return 0==this.eventCount?this:new e(this.items.append(t.map((function(e){return new f(e)}))),this.eventCount)}},{key:"rebased",value:function(t,n){if(!this.eventCount)return this;var r=[],o=Math.max(0,this.items.length-n),i=t.mapping,a=t.steps.length,s=this.eventCount;this.items.forEach((function(e){e.selection&&s--}),o);var l=n;this.items.forEach((function(e){var n=i.getMirror(--l);if(null!=n){a=Math.min(a,n);var o=i.maps[n];if(e.step){var c=t.steps[n].invert(t.docs[n]),u=e.selection&&e.selection.map(i.slice(l+1,n));u&&s++,r.push(new f(o,c,u))}else r.push(new f(o))}}),o);for(var c=[],u=n;u<a;u++)c.push(new f(i.maps[u]));var d=new e(this.items.slice(0,o).append(c).append(r),s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-r.length)),d}},{key:"emptyItemCount",value:function(){var e=0;return this.items.forEach((function(t){t.step||e++})),e}},{key:"compress",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.items.length,n=this.remapping(0,t),r=n.maps.length,o=[],i=0;return this.items.forEach((function(e,a){if(a>=t)o.push(e),e.selection&&i++;else if(e.step){var s=e.step.map(n.slice(r)),l=s&&s.getMap();if(r--,l&&n.appendMap(l,r),s){var c=e.selection&&e.selection.map(n.slice(r));c&&i++;var u,d=new f(l.invert(),s,c),h=o.length-1;(u=o.length&&o[h].merge(d))?o[h]=u:o.push(d)}}else e.map&&r--}),this.items.length,0),new e(s.from(o.reverse()),i)}}]),e}();u.empty=new u(s.empty,0);var f=function(){function e(t,n,r,i){o(this,e),this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}return a(e,[{key:"merge",value:function(t){if(this.step&&t.step&&!t.selection){var n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}}]),e}(),d=a((function e(t,n,r,i,a){o(this,e),this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=a})),h=20;function p(e){for(var t=[],n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((function(e,n,r,o){return t.push(r,o)}));return t}function m(e,t){if(!e)return null;for(var n=[],r=0;r<e.length;r+=2){var o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}var v=!1,g=null;function y(e){var t=e.plugins;if(g!=t){v=!1,g=t;for(var n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){v=!0;break}}return v}var b=new c.PluginKey("history"),w=new c.PluginKey("closeHistory");function k(e,t){return function(n,r){var o=b.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){var i=function(e,t,n){var r=y(t),o=b.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;var a=i.selection.resolve(i.transform.doc),s=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new d(n?s:i.remaining,n?i.remaining:s,null,0,-1);return i.transform.setSelection(a).setMeta(b,{redo:n,historyState:l})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}var S=k(!1,!0),x=k(!0,!0),C=k(!1,!1),O=k(!0,!1);t.closeHistory=function(e){return e.setMeta(w,!0)},t.history=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new c.Plugin({key:b,state:{init:function(){return new d(u.empty,u.empty,null,0,-1)},apply:function(t,n,r){return function(e,t,n,r){var o,i=n.getMeta(b);if(i)return i.historyState;n.getMeta(w)&&(e=new d(e.done,e.undone,null,0,-1));var a=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(a&&a.getMeta(b))return a.getMeta(b).redo?new d(e.done.addTransform(n,void 0,r,y(t)),e.undone,p(n.mapping.maps),e.prevTime,e.prevComposition):new d(e.done,e.undone.addTransform(n,void 0,r,y(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||a&&!1===a.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new d(e.done.rebased(n,o),e.undone.rebased(n,o),m(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new d(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),m(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);var s=n.getMeta("composition"),l=0==e.prevTime||!a&&e.prevComposition!=s&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;var n=!1;return e.mapping.maps[0].forEach((function(e,r){for(var o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)})),n}(n,e.prevRanges)),c=a?m(e.prevRanges,n.mapping):p(n.mapping.maps);return new d(e.done.addTransform(n,l?t.selection.getBookmark():void 0,r,y(t)),u.empty,c,n.time,null==s?e.prevComposition:s)}(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput:function(e,t){var n=t.inputType,r="historyUndo"==n?S:"historyRedo"==n?x:null;return!!r&&(t.preventDefault(),r(e.state,e.dispatch))}}}})},t.redo=x,t.redoDepth=function(e){var t=b.getState(e);return t?t.undone.eventCount:0},t.redoNoScroll=O,t.undo=S,t.undoDepth=function(e){var t=b.getState(e);return t?t.done.eventCount:0},t.undoNoScroll=C},8665:(e,t,n)=>{var r,o=n(2391),i=n(2843),a=(r=function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.match=t,this.match=t,this.handler="string"==typeof n?(r=n,function(e,t,n,o){var i=r;if(t[1]){var a=t[0].lastIndexOf(t[1]);i+=t[0].slice(a+t[1].length);var s=(n+=a)-o;s>0&&(i=t[0].slice(a-s,a)+i,n=o)}return e.tr.insertText(i,n,o)}):n,this.undoable=!1!==o.undoable,this.inCode=o.inCode||!1},Object.defineProperty(r,"prototype",{writable:!1}),r);function s(e,t,n,r,o,i){if(e.composing)return!1;for(var a=e.state,s=a.doc.resolve(t),l=s.parent.textBetween(Math.max(0,s.parentOffset-500),s.parentOffset,null,"")+r,c=0;c<o.length;c++){var u=o[c];if(s.parent.type.spec.code){if(!u.inCode)continue}else if("only"===u.inCode)continue;var f=u.match.exec(l),d=f&&u.handler(a,f,t-(f[0].length-r.length),n);if(d)return u.undoable&&d.setMeta(i,{transform:d,from:t,to:n,text:r}),e.dispatch(d),!0}return!1}var l=new a(/--$/,"—"),c=new a(/\.\.\.$/,"…"),u=new a(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),f=new a(/"$/,"”"),d=new a(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),h=new a(/'$/,"’"),p=[u,f,d,h];t.InputRule=a,t.closeDoubleQuote=f,t.closeSingleQuote=h,t.ellipsis=c,t.emDash=l,t.inputRules=function(e){var t=e.rules,n=new o.Plugin({state:{init:function(){return null},apply:function(e,t){return e.getMeta(this)||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:function(e,r,o,i){return s(e,r,o,i,t,n)},handleDOMEvents:{compositionend:function(e){setTimeout((function(){var r=e.state.selection.$cursor;r&&s(e,r.pos,r.pos,"",t,n)}))}}},isInputRules:!0});return n},t.openDoubleQuote=u,t.openSingleQuote=d,t.smartQuotes=p,t.textblockTypeInputRule=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return new a(e,(function(e,r,o,i){var a=e.doc.resolve(o),s=n instanceof Function?n(r):n;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t)?e.tr.delete(o,i).setBlockType(o,o,t,s):null}))},t.undoInputRule=function(e,t){for(var n=e.plugins,r=0;r<n.length;r++){var o=n[r],i=void 0;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){for(var a=e.tr,s=i.transform,l=s.steps.length-1;l>=0;l--)a.step(s.steps[l].invert(s.docs[l]));if(i.text){var c=a.doc.resolve(i.from).marks();a.replaceWith(i.from,i.to,e.schema.text(i.text,c))}else a.delete(i.from,i.to);t(a)}return!0}}return!1},t.wrappingInputRule=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3?arguments[3]:void 0;return new a(e,(function(e,o,a,s){var l=n instanceof Function?n(o):n,c=e.tr.delete(a,s),u=c.doc.resolve(a).blockRange(),f=u&&i.findWrapping(u,t,l);if(!f)return null;c.wrap(u,f);var d=c.doc.resolve(a-1).nodeBefore;return d&&d.type==t&&i.canJoin(c.doc,a-1)&&(!r||r(o,d))&&c.join(a-1),c}))}},7354:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(6691),o=n(2391),i="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function a(e){var t,n,r,o,a=e.split(/-(?!$)/),s=a[a.length-1];"Space"==s&&(s=" ");for(var l=0;l<a.length-1;l++){var c=a[l];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))t=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))r=!0;else{if(!/^mod$/i.test(c))throw new Error("Unrecognized modifier name: "+c);i?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function s(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function l(e){var t=function(e){var t=Object.create(null);for(var n in e)t[a(n)]=e[n];return t}(e);return function(e,n){var o,i=r.keyName(n),a=t[s(i,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){var l=t[s(i,n,!1)];if(l&&l(e.state,e.dispatch,e))return!0}if((n.shiftKey||n.altKey||n.metaKey||i.charCodeAt(0)>127)&&(o=r.base[n.keyCode])&&o!=i){var c=t[s(o,n)];if(c&&c(e.state,e.dispatch,e))return!0}}return!1}}t.keydownHandler=l,t.keymap=function(e){return new o.Plugin({props:{handleKeyDown:l(e)}})}},9443:(e,t,n)=>{function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(){return o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=f(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},o.apply(this,arguments)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function a(e){var t=c();return function(){var n,r=f(e);if(t){var o=f(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===d(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){var t="function"==typeof Map?new Map:void 0;return s=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return l(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),u(n,e)},s(e)}function l(e,t,n){return l=c()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&u(o,n.prototype),o},l.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==d(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===d(o)?o:String(o)),r)}var o}function m(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var v=n(6586);function g(e,t,n){for(var r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;var o=e.child(r),i=t.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(var a=0;o.text[a]==i.text[a];a++)n++;return n}if(o.content.size||i.content.size){var s=g(o.content,i.content,n+1);if(null!=s)return s}n+=o.nodeSize}else n+=o.nodeSize}}function y(e,t,n,r){for(var o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};var a=e.child(--o),s=t.child(--i),l=a.nodeSize;if(a!=s){if(!a.sameMarkup(s))return{a:n,b:r};if(a.isText&&a.text!=s.text){for(var c=0,u=Math.min(a.text.length,s.text.length);c<u&&a.text[a.text.length-c-1]==s.text[s.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(a.content.size||s.content.size){var f=y(a.content,s.content,n-1,r-1);if(f)return f}n-=l,r-=l}else n-=l,r-=l}}var b=function(){function e(t,n){if(h(this,e),this.content=t,this.size=n||0,null==n)for(var r=0;r<t.length;r++)this.size+=t[r].nodeSize}return m(e,[{key:"nodesBetween",value:function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,i=0,a=0;a<t;i++){var s=this.content[i],l=a+s.nodeSize;if(l>e&&!1!==n(s,r+a,o||null,i)&&s.content.size){var c=a+1;s.nodesBetween(Math.max(0,e-c),Math.min(s.content.size,t-c),n,r+c)}a=l}}},{key:"descendants",value:function(e){this.nodesBetween(0,this.size,e)}},{key:"textBetween",value:function(e,t,n,r){var o="",i=!0;return this.nodesBetween(e,t,(function(a,s){var l=a.isText?a.text.slice(Math.max(e,s)-s,t-s):a.isLeaf?r?"function"==typeof r?r(a):r:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&l||a.isTextblock)&&n&&(i?i=!1:o+=n),o+=l}),0),o}},{key:"append",value:function(t){if(!t.size)return this;if(!this.size)return t;var n=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<t.content.length;i++)o.push(t.content[i]);return new e(o,this.size+t.size)}},{key:"cut",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size;if(0==t&&n==this.size)return this;var r=[],o=0;if(n>t)for(var i=0,a=0;a<n;i++){var s=this.content[i],l=a+s.nodeSize;l>t&&((a<t||l>n)&&(s=s.isText?s.cut(Math.max(0,t-a),Math.min(s.text.length,n-a)):s.cut(Math.max(0,t-a-1),Math.min(s.content.size,n-a-1))),r.push(s),o+=s.nodeSize),a=l}return new e(r,o)}},{key:"cutByIndex",value:function(t,n){return t==n?e.empty:0==t&&n==this.content.length?this:new e(this.content.slice(t,n))}},{key:"replaceChild",value:function(t,n){var r=this.content[t];if(r==n)return this;var o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[t]=n,new e(o,i)}},{key:"addToStart",value:function(t){return new e([t].concat(this.content),this.size+t.nodeSize)}},{key:"addToEnd",value:function(t){return new e(this.content.concat(t),this.size+t.nodeSize)}},{key:"eq",value:function(e){if(this.content.length!=e.content.length)return!1;for(var t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}},{key:"firstChild",get:function(){return this.content.length?this.content[0]:null}},{key:"lastChild",get:function(){return this.content.length?this.content[this.content.length-1]:null}},{key:"childCount",get:function(){return this.content.length}},{key:"child",value:function(e){var t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}},{key:"maybeChild",value:function(e){return this.content[e]||null}},{key:"forEach",value:function(e){for(var t=0,n=0;t<this.content.length;t++){var r=this.content[t];e(r,n,t),n+=r.nodeSize}}},{key:"findDiffStart",value:function(e){return g(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}},{key:"findDiffEnd",value:function(e){return y(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size,arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size)}},{key:"findIndex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;if(0==e)return k(0,e);if(e==this.size)return k(this.content.length,e);if(e>this.size||e<0)throw new RangeError("Position ".concat(e," outside of fragment (").concat(this,")"));for(var n=0,r=0;;n++){var o=r+this.child(n).nodeSize;if(o>=e)return o==e||t>0?k(n+1,o):k(n,r);r=o}}},{key:"toString",value:function(){return"<"+this.toStringInner()+">"}},{key:"toStringInner",value:function(){return this.content.join(", ")}},{key:"toJSON",value:function(){return this.content.length?this.content.map((function(e){return e.toJSON()})):null}}],[{key:"fromJSON",value:function(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new e(n.map(t.nodeFromJSON))}},{key:"fromArray",value:function(t){if(!t.length)return e.empty;for(var n,r=0,o=0;o<t.length;o++){var i=t[o];r+=i.nodeSize,o&&i.isText&&t[o-1].sameMarkup(i)?(n||(n=t.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}},{key:"from",value:function(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}]),e}();b.empty=new b([],0);var w={index:0,offset:0};function k(e,t){return w.index=e,w.offset=t,w}function S(e,t){if(e===t)return!0;if(!e||"object"!=d(e)||!t||"object"!=d(t))return!1;var n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(!S(e[r],t[r]))return!1}else{for(var o in e)if(!(o in t)||!S(e[o],t[o]))return!1;for(var i in t)if(!(i in e))return!1}return!0}var x=function(){function e(t,n){h(this,e),this.type=t,this.attrs=n}return m(e,[{key:"addToSet",value:function(e){for(var t,n=!1,r=0;r<e.length;r++){var o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}},{key:"removeFromSet",value:function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}},{key:"isInSet",value:function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}},{key:"eq",value:function(e){return this==e||this.type==e.type&&S(this.attrs,e.attrs)}},{key:"toJSON",value:function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return e}}],[{key:"fromJSON",value:function(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");var n=e.marks[t.type];if(!n)throw new RangeError("There is no mark type ".concat(t.type," in this schema"));var r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}},{key:"sameSet",value:function(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}},{key:"setFrom",value:function(t){if(!t||Array.isArray(t)&&0==t.length)return e.none;if(t instanceof e)return[t];var n=t.slice();return n.sort((function(e,t){return e.type.rank-t.type.rank})),n}}]),e}();x.none=[];var C=function(e){i(n,e);var t=a(n);function n(){return h(this,n),t.apply(this,arguments)}return m(n)}(s(Error)),O=function(){function e(t,n,r){h(this,e),this.content=t,this.openStart=n,this.openEnd=r}return m(e,[{key:"size",get:function(){return this.content.size-this.openStart-this.openEnd}},{key:"insertAt",value:function(t,n){var r=T(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}},{key:"removeBetween",value:function(t,n){return new e(M(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}},{key:"eq",value:function(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}},{key:"toString",value:function(){return this.content+"("+this.openStart+","+this.openEnd+")"}},{key:"toJSON",value:function(){if(!this.content.size)return null;var e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}}],[{key:"fromJSON",value:function(t,n){if(!n)return e.empty;var r=n.openStart||0,o=n.openEnd||0;if("number"!=typeof r||"number"!=typeof o)throw new RangeError("Invalid input for Slice.fromJSON");return new e(b.fromJSON(t,n.content),r,o)}},{key:"maxOpen",value:function(t){for(var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=0,o=0,i=t.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(var a=t.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)o++;return new e(t,r,o)}}]),e}();function M(e,t,n){var r=e.findIndex(t),o=r.index,i=r.offset,a=e.maybeChild(o),s=e.findIndex(n),l=s.index,c=s.offset;if(i==t||a.isText){if(c!=n&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(o!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(o,a.copy(M(a.content,t-i-1,n-i-1)))}function T(e,t,n,r){var o=e.findIndex(t),i=o.index,a=o.offset,s=e.maybeChild(i);if(a==t||s.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));var l=T(s.content,t-a-1,n);return l&&e.replaceChild(i,s.copy(l))}function A(e,t,n){if(n.openStart>e.depth)throw new C("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new C("Inconsistent open depths");return N(e,t,n,0)}function N(e,t,n,r){var o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){var a=N(e,t,n,r+1);return i.copy(i.content.replaceChild(o,a))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){var s=function(e,t){for(var n=t.depth-e.openStart,r=t.node(n).copy(e.content),o=n-1;o>=0;o--)r=t.node(o).copy(b.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return P(i,z(e,s.start,s.end,t,r))}var l=e.parent,c=l.content;return P(l,c.cut(0,e.parentOffset).append(n.content).append(c.cut(t.parentOffset)))}return P(i,I(e,t,r))}function R(e,t){if(!t.type.compatibleContent(e.type))throw new C("Cannot join "+t.type.name+" onto "+e.type.name)}function D(e,t,n){var r=e.node(n);return R(r,t.node(n)),r}function _(e,t){var n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function E(e,t,n,r){var o=(t||e).node(n),i=0,a=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(_(e.nodeAfter,r),i++));for(var s=i;s<a;s++)_(o.child(s),r);t&&t.depth==n&&t.textOffset&&_(t.nodeBefore,r)}function P(e,t){return e.type.checkContent(t),e.copy(t)}function z(e,t,n,r,o){var i=e.depth>o&&D(e,t,o+1),a=r.depth>o&&D(n,r,o+1),s=[];return E(null,e,o,s),i&&a&&t.index(o)==n.index(o)?(R(i,a),_(P(i,z(e,t,n,r,o+1)),s)):(i&&_(P(i,I(e,t,o+1)),s),E(t,n,o,s),a&&_(P(a,I(n,r,o+1)),s)),E(r,null,o,s),new b(s)}function I(e,t,n){var r=[];return E(null,e,n,r),e.depth>n&&_(P(D(e,t,n+1),I(e,t,n+1)),r),E(t,null,n,r),new b(r)}O.empty=new O(b.empty,0,0);var j=function(){function e(t,n,r){h(this,e),this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}return m(e,[{key:"resolveDepth",value:function(e){return null==e?this.depth:e<0?this.depth+e:e}},{key:"parent",get:function(){return this.node(this.depth)}},{key:"doc",get:function(){return this.node(0)}},{key:"node",value:function(e){return this.path[3*this.resolveDepth(e)]}},{key:"index",value:function(e){return this.path[3*this.resolveDepth(e)+1]}},{key:"indexAfter",value:function(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}},{key:"start",value:function(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}},{key:"end",value:function(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}},{key:"before",value:function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}},{key:"after",value:function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}},{key:"textOffset",get:function(){return this.pos-this.path[this.path.length-1]}},{key:"nodeAfter",get:function(){var e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}},{key:"nodeBefore",get:function(){var e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}},{key:"posAtIndex",value:function(e,t){t=this.resolveDepth(t);for(var n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1,o=0;o<e;o++)r+=n.child(o).nodeSize;return r}},{key:"marks",value:function(){var e=this.parent,t=this.index();if(0==e.content.size)return x.none;if(this.textOffset)return e.child(t).marks;var n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){var o=n;n=r,r=o}for(var i=n.marks,a=0;a<i.length;a++)!1!==i[a].type.spec.inclusive||r&&i[a].isInSet(r.marks)||(i=i[a--].removeFromSet(i));return i}},{key:"marksAcross",value:function(e){var t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;for(var n=t.marks,r=e.parent.maybeChild(e.index()),o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}},{key:"sharedDepth",value:function(e){for(var t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}},{key:"blockRange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this,t=arguments.length>1?arguments[1]:void 0;if(e.pos<this.pos)return e.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new L(this,e,n);return null}},{key:"sameParent",value:function(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}},{key:"max",value:function(e){return e.pos>this.pos?e:this}},{key:"min",value:function(e){return e.pos<this.pos?e:this}},{key:"toString",value:function(){for(var e="",t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}}],[{key:"resolve",value:function(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");for(var r=[],o=0,i=n,a=t;;){var s=a.content.findIndex(i),l=s.index,c=s.offset,u=i-c;if(r.push(a,l,o+c),!u)break;if((a=a.child(l)).isText)break;i=u-1,o+=c+1}return new e(n,r,i)}},{key:"resolveCached",value:function(t,n){var r=$.get(t);if(r)for(var o=0;o<r.elts.length;o++){var i=r.elts[o];if(i.pos==n)return i}else $.set(t,r=new F);var a=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%B,a}}]),e}(),F=m((function e(){h(this,e),this.elts=[],this.i=0})),B=12,$=new WeakMap,L=function(){function e(t,n,r){h(this,e),this.$from=t,this.$to=n,this.depth=r}return m(e,[{key:"start",get:function(){return this.$from.before(this.depth+1)}},{key:"end",get:function(){return this.$to.after(this.depth+1)}},{key:"parent",get:function(){return this.$from.node(this.depth)}},{key:"startIndex",get:function(){return this.$from.index(this.depth)}},{key:"endIndex",get:function(){return this.$to.indexAfter(this.depth)}}]),e}(),V=Object.create(null),K=function(){function e(t,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:x.none;h(this,e),this.type=t,this.attrs=n,this.marks=o,this.content=r||b.empty}return m(e,[{key:"nodeSize",get:function(){return this.isLeaf?1:2+this.content.size}},{key:"childCount",get:function(){return this.content.childCount}},{key:"child",value:function(e){return this.content.child(e)}},{key:"maybeChild",value:function(e){return this.content.maybeChild(e)}},{key:"forEach",value:function(e){this.content.forEach(e)}},{key:"nodesBetween",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.content.nodesBetween(e,t,n,r,this)}},{key:"descendants",value:function(e){this.nodesBetween(0,this.content.size,e)}},{key:"textContent",get:function(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}},{key:"textBetween",value:function(e,t,n,r){return this.content.textBetween(e,t,n,r)}},{key:"firstChild",get:function(){return this.content.firstChild}},{key:"lastChild",get:function(){return this.content.lastChild}},{key:"eq",value:function(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}},{key:"sameMarkup",value:function(e){return this.hasMarkup(e.type,e.attrs,e.marks)}},{key:"hasMarkup",value:function(e,t,n){return this.type==e&&S(this.attrs,t||e.defaultAttrs||V)&&x.sameSet(this.marks,n||x.none)}},{key:"copy",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}},{key:"mark",value:function(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}},{key:"cut",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size;return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}},{key:"slice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e==t)return O.empty;var r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),a=r.start(i),s=r.node(i).content.cut(r.pos-a,o.pos-a);return new O(s,r.depth-i,o.depth-i)}},{key:"replace",value:function(e,t,n){return A(this.resolve(e),this.resolve(t),n)}},{key:"nodeAt",value:function(e){for(var t=this;;){var n=t.content.findIndex(e),r=n.index,o=n.offset;if(!(t=t.maybeChild(r)))return null;if(o==e||t.isText)return t;e-=o+1}}},{key:"childAfter",value:function(e){var t=this.content.findIndex(e),n=t.index,r=t.offset;return{node:this.content.maybeChild(n),index:n,offset:r}}},{key:"childBefore",value:function(e){if(0==e)return{node:null,index:0,offset:0};var t=this.content.findIndex(e),n=t.index,r=t.offset;if(r<e)return{node:this.content.child(n),index:n,offset:r};var o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}},{key:"resolve",value:function(e){return j.resolveCached(this,e)}},{key:"resolveNoCache",value:function(e){return j.resolve(this,e)}},{key:"rangeHasMark",value:function(e,t,n){var r=!1;return t>e&&this.nodesBetween(e,t,(function(e){return n.isInSet(e.marks)&&(r=!0),!r})),r}},{key:"isBlock",get:function(){return this.type.isBlock}},{key:"isTextblock",get:function(){return this.type.isTextblock}},{key:"inlineContent",get:function(){return this.type.inlineContent}},{key:"isInline",get:function(){return this.type.isInline}},{key:"isText",get:function(){return this.type.isText}},{key:"isLeaf",get:function(){return this.type.isLeaf}},{key:"isAtom",get:function(){return this.type.isAtom}},{key:"toString",value:function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),W(this.marks,e)}},{key:"contentMatchAt",value:function(e){var t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}},{key:"canReplace",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:b.empty,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:n.childCount,i=this.contentMatchAt(e).matchFragment(n,r,o),a=i&&i.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(var s=r;s<o;s++)if(!this.type.allowsMarks(n.child(s).marks))return!1;return!0}},{key:"canReplaceWith",value:function(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;var o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}},{key:"canAppend",value:function(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}},{key:"check",value:function(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);for(var e=x.none,t=0;t<this.marks.length;t++){var n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!x.sameSet(e,this.marks))throw new RangeError("Invalid collection of marks for node ".concat(this.type.name,": ").concat(this.marks.map((function(e){return e.type.name}))));this.content.forEach((function(e){return e.check()}))}},{key:"toJSON",value:function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map((function(e){return e.toJSON()}))),e}}],[{key:"fromJSON",value:function(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");var n=void 0;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}var r=b.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}]),e}();K.prototype.text=void 0;var H=function(e){i(n,e);var t=a(n);function n(e,r,o,i){var a;if(h(this,n),a=t.call(this,e,r,null,i),!o)throw new RangeError("Empty text nodes are not allowed");return a.text=o,a}return m(n,[{key:"toString",value:function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):W(this.marks,JSON.stringify(this.text))}},{key:"textContent",get:function(){return this.text}},{key:"textBetween",value:function(e,t){return this.text.slice(e,t)}},{key:"nodeSize",get:function(){return this.text.length}},{key:"mark",value:function(e){return e==this.marks?this:new n(this.type,this.attrs,this.text,e)}},{key:"withText",value:function(e){return e==this.text?this:new n(this.type,this.attrs,e,this.marks)}},{key:"cut",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.text.length;return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}},{key:"eq",value:function(e){return this.sameMarkup(e)&&this.text==e.text}},{key:"toJSON",value:function(){var e=o(f(n.prototype),"toJSON",this).call(this);return e.text=this.text,e}}]),n}(K);function W(e,t){for(var n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}var q=function(){function e(t){h(this,e),this.validEnd=t,this.next=[],this.wrapCache=[]}return m(e,[{key:"matchType",value:function(e){for(var t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}},{key:"matchFragment",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.childCount,r=this,o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}},{key:"inlineContent",get:function(){return 0!=this.next.length&&this.next[0].type.isInline}},{key:"defaultType",get:function(){for(var e=0;e<this.next.length;e++){var t=this.next[e].type;if(!t.isText&&!t.hasRequiredAttrs())return t}return null}},{key:"compatible",value:function(e){for(var t=0;t<this.next.length;t++)for(var n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}},{key:"fillBefore",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[this];return function o(i,a){var s=i.matchFragment(e,n);if(s&&(!t||s.validEnd))return b.from(a.map((function(e){return e.createAndFill()})));for(var l=0;l<i.next.length;l++){var c=i.next[l],u=c.type,f=c.next;if(!u.isText&&!u.hasRequiredAttrs()&&-1==r.indexOf(f)){r.push(f);var d=o(f,a.concat(u));if(d)return d}}return null}(this,[])}},{key:"findWrapping",value:function(e){for(var t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];var n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}},{key:"computeWrapping",value:function(e){for(var t=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),o=r.match;if(o.matchType(e)){for(var i=[],a=r;a.type;a=a.via)i.push(a.type);return i.reverse()}for(var s=0;s<o.next.length;s++){var l=o.next[s],c=l.type,u=l.next;c.isLeaf||c.hasRequiredAttrs()||c.name in t||r.type&&!u.validEnd||(n.push({match:c.contentMatch,type:c,via:r}),t[c.name]=!0)}}return null}},{key:"edgeCount",get:function(){return this.next.length}},{key:"edge",value:function(e){if(e>=this.next.length)throw new RangeError("There's no ".concat(e,"th edge in this content match"));return this.next[e]}},{key:"toString",value:function(){var e=[];return function t(n){e.push(n);for(var r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((function(t,n){for(var r=n+(t.validEnd?"*":" ")+" ",o=0;o<t.next.length;o++)r+=(o?", ":"")+t.next[o].type.name+"->"+e.indexOf(t.next[o].next);return r})).join("\n")}}],[{key:"parse",value:function(t,n){var r=new J(t,n);if(null==r.next)return e.empty;var o=U(r);r.next&&r.err("Unexpected trailing text");var i=te(function(e){var t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce((function(t,n){return t.concat(e(n,i))}),[]);if("seq"!=t.type){if("star"==t.type){var a=n();return r(i,a),o(e(t.expr,a),a),[r(a)]}if("plus"==t.type){var s=n();return o(e(t.expr,i),s),o(e(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(i)].concat(e(t.expr,i));if("range"==t.type){for(var l=i,c=0;c<t.min;c++){var u=n();o(e(t.expr,l),u),l=u}if(-1==t.max)o(e(t.expr,l),l);else for(var f=t.min;f<t.max;f++){var d=n();r(l,d),o(e(t.expr,l),d),l=d}return[r(l)]}if("name"==t.type)return[r(i,void 0,t.value)];throw new Error("Unknown expr type")}for(var h=0;;h++){var p=e(t.exprs[h],i);if(h==t.exprs.length-1)return p;o(p,i=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){var o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach((function(e){return e.to=t}))}}(o));return function(e,t){for(var n=0,r=[e];n<r.length;n++){for(var o=r[n],i=!o.validEnd,a=[],s=0;s<o.next.length;s++){var l=o.next[s],c=l.type,u=l.next;a.push(c.name),!i||c.isText||c.hasRequiredAttrs()||(i=!1),-1==r.indexOf(u)&&r.push(u)}i&&t.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,r),i}}]),e}();q.empty=new q(!0);var J=function(){function e(t,n){h(this,e),this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}return m(e,[{key:"next",get:function(){return this.tokens[this.pos]}},{key:"eat",value:function(e){return this.next==e&&(this.pos++||!0)}},{key:"err",value:function(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}]),e}();function U(e){var t=[];do{t.push(G(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function G(e){var t=[];do{t.push(X(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function X(e){for(var t=function(e){if(e.eat("(")){var t=U(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){var n=function(e,t){var n=e.nodeTypes,r=n[t];if(r)return[r];var o=[];for(var i in n){var a=n[i];a.isInGroup(t)&&o.push(a)}return 0==o.length&&e.err("No node type or group '"+t+"' found"),o}(e,e.next).map((function(t){return null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}}));return e.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}e.err("Unexpected token '"+e.next+"'")}(e);;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=Q(e,t)}return t}function Y(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");var t=Number(e.next);return e.pos++,t}function Q(e,t){var n=Y(e),r=n;return e.eat(",")&&(r="}"!=e.next?Y(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function Z(e,t){return t-e}function ee(e,t){var n=[];return function t(r){var o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(var i=0;i<o.length;i++){var a=o[i],s=a.term,l=a.to;s||-1!=n.indexOf(l)||t(l)}}(t),n.sort(Z)}function te(e){var t=Object.create(null);return function n(r){var o=[];r.forEach((function(t){e[t].forEach((function(t){var n=t.term,r=t.to;if(n){for(var i,a=0;a<o.length;a++)o[a][0]==n&&(i=o[a][1]);ee(e,r).forEach((function(e){i||o.push([n,i=[]]),-1==i.indexOf(e)&&i.push(e)}))}}))}));for(var i=t[r.join(",")]=new q(r.indexOf(e.length-1)>-1),a=0;a<o.length;a++){var s=o[a][1].sort(Z);i.next.push({type:o[a][0],next:t[s.join(",")]||n(s)})}return i}(ee(e,0))}function ne(e){var t=Object.create(null);for(var n in e){var r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function re(e,t){var n=Object.create(null);for(var r in e){var o=t&&t[r];if(void 0===o){var i=e[r];if(!i.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=i.default}n[r]=o}return n}function oe(e,t,n,r){for(var o in t)if(!(o in e))throw new RangeError("Unsupported attribute ".concat(o," for ").concat(n," of type ").concat(o));for(var i in e){var a=e[i];a.validate&&a.validate(t[i])}}function ie(e,t){var n=Object.create(null);if(t)for(var r in t)n[r]=new se(e,r,t[r]);return n}var ae=function(){function e(t,n,r){h(this,e),this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ie(t,r.attrs),this.defaultAttrs=ne(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==t),this.isText="text"==t}return m(e,[{key:"isInline",get:function(){return!this.isBlock}},{key:"isTextblock",get:function(){return this.isBlock&&this.inlineContent}},{key:"isLeaf",get:function(){return this.contentMatch==q.empty}},{key:"isAtom",get:function(){return this.isLeaf||!!this.spec.atom}},{key:"isInGroup",value:function(e){return this.groups.indexOf(e)>-1}},{key:"whitespace",get:function(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}},{key:"hasRequiredAttrs",value:function(){for(var e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}},{key:"compatibleContent",value:function(e){return this==e||this.contentMatch.compatible(e.contentMatch)}},{key:"computeAttrs",value:function(e){return!e&&this.defaultAttrs?this.defaultAttrs:re(this.attrs,e)}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new K(this,this.computeAttrs(e),b.from(t),x.setFrom(n))}},{key:"createChecked",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;return t=b.from(t),this.checkContent(t),new K(this,this.computeAttrs(e),t,x.setFrom(n))}},{key:"createAndFill",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(e=this.computeAttrs(e),(t=b.from(t)).size){var r=this.contentMatch.fillBefore(t);if(!r)return null;t=r.append(t)}var o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(b.empty,!0);return i?new K(this,e,t.append(i),x.setFrom(n)):null}},{key:"validContent",value:function(e){var t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(var n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}},{key:"checkContent",value:function(e){if(!this.validContent(e))throw new RangeError("Invalid content for node ".concat(this.name,": ").concat(e.toString().slice(0,50)))}},{key:"checkAttrs",value:function(e){oe(this.attrs,e,"node",this.name)}},{key:"allowsMarkType",value:function(e){return null==this.markSet||this.markSet.indexOf(e)>-1}},{key:"allowsMarks",value:function(e){if(null==this.markSet)return!0;for(var t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}},{key:"allowedMarks",value:function(e){if(null==this.markSet)return e;for(var t,n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:x.none:e}}],[{key:"compile",value:function(t,n){var r=Object.create(null);t.forEach((function(t,o){return r[t]=new e(t,n,o)}));var o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(var i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}}]),e}(),se=function(){function e(t,n,r){h(this,e),this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate="string"==typeof r.validate?function(e,t,n){var r=n.split("|");return function(n){var o=null===n?"null":d(n);if(r.indexOf(o)<0)throw new RangeError("Expected value of type ".concat(r," for attribute ").concat(t," on type ").concat(e,", got ").concat(o))}}(t,n,r.validate):r.validate}return m(e,[{key:"isRequired",get:function(){return!this.hasDefault}}]),e}(),le=function(){function e(t,n,r,o){h(this,e),this.name=t,this.rank=n,this.schema=r,this.spec=o,this.attrs=ie(t,o.attrs),this.excluded=null;var i=ne(this.attrs);this.instance=i?new x(this,i):null}return m(e,[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!e&&this.instance?this.instance:new x(this,re(this.attrs,e))}},{key:"removeFromSet",value:function(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}},{key:"isInSet",value:function(e){for(var t=0;t<e.length;t++)if(e[t].type==this)return e[t]}},{key:"checkAttrs",value:function(e){oe(this.attrs,e,"mark",this.name)}},{key:"excludes",value:function(e){return this.excluded.indexOf(e)>-1}}],[{key:"compile",value:function(t,n){var r=Object.create(null),o=0;return t.forEach((function(t,i){return r[t]=new e(t,o++,n,i)})),r}}]),e}(),ce=function(){function e(t){h(this,e),this.linebreakReplacement=null,this.cached=Object.create(null);var n=this.spec={};for(var r in t)n[r]=t[r];n.nodes=v.from(t.nodes),n.marks=v.from(t.marks||{}),this.nodes=ae.compile(this.spec.nodes,this),this.marks=le.compile(this.spec.marks,this);var o=Object.create(null);for(var i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");var a=this.nodes[i],s=a.spec.content||"",l=a.spec.marks;if(a.contentMatch=o[s]||(o[s]=q.parse(s,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet="_"==l?null:l?ue(this,l.split(" ")):""!=l&&a.inlineContent?null:[]}for(var c in this.marks){var u=this.marks[c],f=u.spec.excludes;u.excluded=null==f?[u]:""==f?[]:ue(this,f.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}return m(e,[{key:"node",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof ae))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}},{key:"text",value:function(e,t){var n=this.nodes.text;return new H(n,n.defaultAttrs,e,x.setFrom(t))}},{key:"mark",value:function(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}},{key:"nodeFromJSON",value:function(e){return K.fromJSON(this,e)}},{key:"markFromJSON",value:function(e){return x.fromJSON(this,e)}},{key:"nodeType",value:function(e){var t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}]),e}();function ue(e,t){for(var n=[],r=0;r<t.length;r++){var o=t[r],i=e.marks[o],a=i;if(i)n.push(i);else for(var s in e.marks){var l=e.marks[s];("_"==o||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(a=l)}if(!a)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}var fe=function(){function e(t,n){var r=this;h(this,e),this.schema=t,this.rules=n,this.tags=[],this.styles=[];var o=this.matchedStyles=[];n.forEach((function(e){if(function(e){return null!=e.tag}(e))r.tags.push(e);else if(function(e){return null!=e.style}(e)){var t=/[^=]*/.exec(e.style)[0];o.indexOf(t)<0&&o.push(t),r.styles.push(e)}})),this.normalizeLists=!this.tags.some((function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)}))}return m(e,[{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new ge(this,t,!1);return n.addAll(e,x.none,t.from,t.to),n.finish()}},{key:"parseSlice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new ge(this,t,!0);return n.addAll(e,x.none,t.from,t.to),O.maxOpen(n.finish())}},{key:"matchTag",value:function(e,t,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var o=this.tags[r];if(ye(e,o.tag)&&(void 0===o.namespace||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){var i=o.getAttrs(e);if(!1===i)continue;o.attrs=i||void 0}return o}}}},{key:"matchStyle",value:function(e,t,n,r){for(var o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){var i=this.styles[o],a=i.style;if(!(0!=a.indexOf(e)||i.context&&!n.matchesContext(i.context)||a.length>e.length&&(61!=a.charCodeAt(e.length)||a.slice(e.length+1)!=t))){if(i.getAttrs){var s=i.getAttrs(t);if(!1===s)continue;i.attrs=s||void 0}return i}}}}],[{key:"schemaRules",value:function(e){var t=[];function n(e){for(var n=null==e.priority?50:e.priority,r=0;r<t.length;r++){var o=t[r];if((null==o.priority?50:o.priority)<n)break}t.splice(r,0,e)}var r=function(t){var r=e.marks[t].spec.parseDOM;r&&r.forEach((function(e){n(e=be(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)}))};for(var o in e.marks)r(o);var i=function(t){var r=e.nodes[t].spec.parseDOM;r&&r.forEach((function(e){n(e=be(e)),e.node||e.ignore||e.mark||(e.node=t)}))};for(var a in e.nodes)i(a);return t}},{key:"fromSchema",value:function(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}}]),e}(),de={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},he={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},pe={ol:!0,ul:!0};function me(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}var ve=function(){function e(t,n,r,o,i,a){h(this,e),this.type=t,this.attrs=n,this.marks=r,this.solid=o,this.options=a,this.content=[],this.activeMarks=x.none,this.match=i||(4&a?null:t.contentMatch)}return m(e,[{key:"findWrapping",value:function(e){if(!this.match){if(!this.type)return[];var t=this.type.contentMatch.fillBefore(b.from(e));if(!t){var n,r=this.type.contentMatch;return(n=r.findWrapping(e.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}},{key:"finish",value:function(e){if(!(1&this.options)){var t,n=this.content[this.content.length-1];if(n&&n.isText&&(t=/[ \t\r\n\u000c]+$/.exec(n.text))){var r=n;n.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-t[0].length))}}var o=b.from(this.content);return!e&&this.match&&(o=o.append(this.match.fillBefore(b.empty,!0))),this.type?this.type.create(this.attrs,o,this.marks):o}},{key:"inlineContext",value:function(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!de.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}]),e}(),ge=function(){function e(t,n,r){h(this,e),this.parser=t,this.options=n,this.isOpen=r,this.open=0;var o,i=n.topNode,a=me(null,n.preserveWhitespace,0)|(r?4:0);o=i?new ve(i.type,i.attrs,x.none,!0,n.topMatch||i.type.contentMatch,a):new ve(r?null:t.schema.topNodeType,null,x.none,!0,null,a),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}return m(e,[{key:"top",get:function(){return this.nodes[this.open]}},{key:"addDOM",value:function(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}},{key:"addTextNode",value:function(e,t){var n=e.nodeValue,r=this.top;if(2&r.options||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(1&r.options)n=2&r.options?n.replace(/\r\n?/g,"\n"):n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){var o=r.content[r.content.length-1],i=e.previousSibling;(!o||i&&"BR"==i.nodeName||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),t),this.findInText(e)}else this.findInside(e)}},{key:"addElement",value:function(e,t,n){var r,o=e.nodeName.toLowerCase();pe.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(var t=e.firstChild,n=null;t;t=t.nextSibling){var r=1==t.nodeType?t.nodeName.toLowerCase():null;r&&pe.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):"li"==r?n=t:r&&(n=null)}}(e);var i=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(r=this.parser.matchTag(e,this,n));if(i?i.ignore:he.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(e=i.skip);var a,s=this.top,l=this.needsBlock;if(de.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),a=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild)return void this.leafFallback(e,t);var c=i&&i.skip?t:this.readStyles(e,t);c&&this.addAll(e,c),a&&this.sync(s),this.needsBlock=l}else{var u=this.readStyles(e,t);u&&this.addElementByRule(e,i,u,!1===i.consuming?r:void 0)}}},{key:"leafFallback",value:function(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}},{key:"ignoreFallback",value:function(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t)}},{key:"readStyles",value:function(e,t){var n=this,r=e.style;if(r&&r.length)for(var o=0;o<this.parser.matchedStyles.length;o++){var i=this.parser.matchedStyles[o],a=r.getPropertyValue(i);if(a)for(var s,l=function(e){var r=n.parser.matchStyle(i,a,n,e);return r?r.ignore?{v:null}:(t=r.clearMark?t.filter((function(e){return!r.clearMark(e)})):t.concat(n.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming?(c=e,0):void(c=e=r)):(c=e,0)},c=void 0;0!==(s=l(c));)if(s)return s.v}return t}},{key:"addElementByRule",value:function(e,t,n,r){var o,i,a=this;if(t.node)if((i=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(i.create(t.attrs),n)||this.leafFallback(e,n);else{var s=this.enter(i,t.attrs||null,n,t.preserveWhitespace);s&&(o=!0,n=s)}else{var l=this.parser.schema.marks[t.mark];n=n.concat(l.create(t.attrs))}var c=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((function(e){return a.insertNode(e,n)}));else{var u=e;"string"==typeof t.contentElement?u=e.querySelector(t.contentElement):"function"==typeof t.contentElement?u=t.contentElement(e):t.contentElement&&(u=t.contentElement),this.findAround(e,u,!0),this.addAll(u,n),this.findAround(e,u,!1)}o&&this.sync(c)&&this.open--}},{key:"addAll",value:function(e,t,n,r){for(var o=n||0,i=n?e.childNodes[n]:e.firstChild,a=null==r?null:e.childNodes[r];i!=a;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}},{key:"findPlace",value:function(e,t){for(var n,r,o=this.open;o>=0;o--){var i=this.nodes[o],a=i.findWrapping(e);if(a&&(!n||n.length>a.length)&&(n=a,r=i,!a.length))break;if(i.solid)break}if(!n)return null;this.sync(r);for(var s=0;s<n.length;s++)t=this.enterInner(n[s],null,t,!1);return t}},{key:"insertNode",value:function(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){var n=this.textblockFromContext();n&&(t=this.enterInner(n,null,t))}var o=this.findPlace(e,t);if(o){this.closeExtra();var i=this.top;i.match&&(i.match=i.match.matchType(e.type));var a,s=x.none,l=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw a}}}}(o.concat(e.marks));try{for(l.s();!(a=l.n()).done;){var c=a.value;(i.type?i.type.allowsMarkType(c.type):we(c.type,e.type))&&(s=c.addToSet(s))}}catch(e){l.e(e)}finally{l.f()}return i.content.push(e.mark(s)),!0}return!1}},{key:"enter",value:function(e,t,n,r){var o=this.findPlace(e.create(t),n);return o&&(o=this.enterInner(e,t,n,!0,r)),o}},{key:"enterInner",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0;this.closeExtra();var i=this.top;i.match=i.match&&i.match.matchType(e);var a=me(e,o,i.options);4&i.options&&0==i.content.length&&(a|=4);var s=x.none;return n=n.filter((function(t){return!(i.type?i.type.allowsMarkType(t.type):we(t.type,e))||(s=t.addToSet(s),!1)})),this.nodes.push(new ve(e,t,s,r,null,a)),this.open++,n}},{key:"closeExtra",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}},{key:"finish",value:function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}},{key:"sync",value:function(e){for(var t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}},{key:"currentPos",get:function(){this.closeExtra();for(var e=0,t=this.open;t>=0;t--){for(var n=this.nodes[t].content,r=n.length-1;r>=0;r--)e+=n[r].nodeSize;t&&e++}return e}},{key:"findAtPoint",value:function(e,t){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}},{key:"findInside",value:function(e){if(this.find)for(var t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}},{key:"findAround",value:function(e,t,n){if(e!=t&&this.find)for(var r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},{key:"findInText",value:function(e){if(this.find)for(var t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}},{key:"matchesContext",value:function(e){var t=this;if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);var n=e.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1);return function e(a,s){for(;a>=0;a--){var l=n[a];if(""==l){if(a==n.length-1||0==a)continue;for(;s>=i;s--)if(e(a-1,s))return!0;return!1}var c=s>0||0==s&&o?t.nodes[s].type:r&&s>=i?r.node(s-i).type:null;if(!c||c.name!=l&&!c.isInGroup(l))return!1;s--}return!0}(n.length-1,this.open)}},{key:"textblockFromContext",value:function(){var e=this.options.context;if(e)for(var t=e.depth;t>=0;t--){var n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}}}]),e}();function ye(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function be(e){var t={};for(var n in e)t[n]=e[n];return t}function we(e,t){var n,r=t.schema.nodes,o=function(){var n=r[i];if(!n.allowsMarkType(e))return 0;var o=[];return function e(n){o.push(n);for(var r=0;r<n.edgeCount;r++){var i=n.edge(r),a=i.type,s=i.next;if(a==t)return!0;if(o.indexOf(s)<0&&e(s))return!0}}(n.contentMatch)?{v:!0}:void 0};for(var i in r)if(0!==(n=o())&&n)return n.v}var ke=function(){function e(t,n){h(this,e),this.nodes=t,this.marks=n}return m(e,[{key:"serializeFragment",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;r||(r=xe(n).createDocumentFragment());var o=r,i=[];return e.forEach((function(e){if(i.length||e.marks.length){for(var r=0,a=0;r<i.length&&a<e.marks.length;){var s=e.marks[a];if(t.marks[s.type.name]){if(!s.eq(i[r][0])||!1===s.type.spec.spanning)break;r++,a++}else a++}for(;r<i.length;)o=i.pop()[1];for(;a<e.marks.length;){var l=e.marks[a++],c=t.serializeMark(l,e.isInline,n);c&&(i.push([l,o]),o.appendChild(c.dom),o=c.contentDOM||c.dom)}}o.appendChild(t.serializeNodeInner(e,n))})),r}},{key:"serializeNodeInner",value:function(e,t){var n=Oe(xe(t),this.nodes[e.type.name](e),null,e.attrs),r=n.dom,o=n.contentDOM;if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return r}},{key:"serializeNode",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.serializeNodeInner(e,t),r=e.marks.length-1;r>=0;r--){var o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}},{key:"serializeMark",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.marks[e.type.name];return r&&Oe(xe(n),r(e,t),null,e.attrs)}}],[{key:"renderSpec",value:function(e,t){return Oe(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,arguments.length>3?arguments[3]:void 0)}},{key:"fromSchema",value:function(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}},{key:"nodesFromSchema",value:function(e){var t=Se(e.nodes);return t.text||(t.text=function(e){return e.text}),t}},{key:"marksFromSchema",value:function(e){return Se(e.marks)}}]),e}();function Se(e){var t={};for(var n in e){var r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function xe(e){return e.document||window.document}var Ce=new WeakMap;function Oe(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;var o,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=function(e){var t=Ce.get(e);return void 0===t&&Ce.set(e,t=function(e){var t=null;return function e(n){if(n&&"object"==d(n))if(Array.isArray(n))if("string"==typeof n[0])t||(t=[]),t.push(n);else for(var r=0;r<n.length;r++)e(n[r]);else for(var o in n)e(n[o])}(e),t}(e)),t}(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");var a,s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));var l=n?e.createElementNS(n,i):e.createElement(i),c=t[1],u=1;if(c&&"object"==d(c)&&null==c.nodeType&&!Array.isArray(c))for(var f in u=2,c)if(null!=c[f]){var h=f.indexOf(" ");h>0?l.setAttributeNS(f.slice(0,h),f.slice(h+1),c[f]):l.setAttribute(f,c[f])}for(var p=u;p<t.length;p++){var m=t[p];if(0===m){if(p<t.length-1||p>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}var v=Oe(e,m,n,r),g=v.dom,y=v.contentDOM;if(l.appendChild(g),y){if(a)throw new RangeError("Multiple content holes");a=y}}return{dom:l,contentDOM:a}}t.ContentMatch=q,t.DOMParser=fe,t.DOMSerializer=ke,t.Fragment=b,t.Mark=x,t.MarkType=le,t.Node=K,t.NodeRange=L,t.NodeType=ae,t.ReplaceError=C,t.ResolvedPos=j,t.Schema=ce,t.Slice=O},4032:(e,t,n)=>{var r=n(2843),o=n(9443),i=n(2391),a=["ol",0],s=["ul",0],l=["li",0],c={attrs:{order:{default:1,validate:"number"}},parseDOM:[{tag:"ol",getAttrs:function(e){return{order:e.hasAttribute("start")?+e.getAttribute("start"):1}}}],toDOM:function(e){return 1==e.attrs.order?a:["ol",{start:e.attrs.order},0]}},u={parseDOM:[{tag:"ul"}],toDOM:function(){return s}},f={parseDOM:[{tag:"li"}],toDOM:function(){return l},defining:!0};function d(e,t){var n={};for(var r in e)n[r]=e[r];for(var o in t)n[o]=t[o];return n}function h(e,t){return function(n,a){var s=n.selection,l=s.$from,c=s.$to,u=s.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;var f=l.node(-1);if(f.type!=e)return!1;if(0==l.parent.content.size&&l.node(-1).childCount==l.indexAfter(-1)){if(3==l.depth||l.node(-3).type!=e||l.index(-2)!=l.node(-2).childCount-1)return!1;if(a){for(var d=o.Fragment.empty,h=l.index(-1)?1:l.index(-2)?2:3,p=l.depth-h;p>=l.depth-3;p--)d=o.Fragment.from(l.node(p).copy(d));var m=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3;d=d.append(o.Fragment.from(e.createAndFill()));var v=l.before(l.depth-(h-1)),g=n.tr.replace(v,l.after(-m),new o.Slice(d,4-h,0)),y=-1;g.doc.nodesBetween(v,g.doc.content.size,(function(e,t){if(y>-1)return!1;e.isTextblock&&0==e.content.size&&(y=t+1)})),y>-1&&g.setSelection(i.Selection.near(g.doc.resolve(y))),a(g.scrollIntoView())}return!0}var b=c.pos==l.end()?f.contentMatchAt(0).defaultType:null,w=n.tr.delete(l.pos,c.pos),k=b?[t?{type:e,attrs:t}:null,{type:b}]:void 0;return!!r.canSplit(w.doc,l.pos,2,k)&&(a&&a(w.split(l.pos,2,k).scrollIntoView()),!0)}}t.addListNodes=function(e,t,n){return e.append({ordered_list:d(c,{content:"list_item+",group:n}),bullet_list:d(u,{content:"list_item+",group:n}),list_item:d(f,{content:t})})},t.bulletList=u,t.liftListItem=function(e){return function(t,n){var i=t.selection,a=i.$from,s=i.$to,l=a.blockRange(s,(function(t){return t.childCount>0&&t.firstChild.type==e}));return!!l&&(!n||(a.node(l.depth-1).type==e?function(e,t,n,i){var a=e.tr,s=i.end,l=i.$to.end(i.depth);s<l&&(a.step(new r.ReplaceAroundStep(s-1,l,s,l,new o.Slice(o.Fragment.from(n.create(null,i.parent.copy())),1,0),1,!0)),i=new o.NodeRange(a.doc.resolve(i.$from.pos),a.doc.resolve(l),i.depth));var c=r.liftTarget(i);if(null==c)return!1;a.lift(i,c);var u=a.mapping.map(s,-1)-1;return r.canJoin(a.doc,u)&&a.join(u),t(a.scrollIntoView()),!0}(t,n,e,l):function(e,t,n){for(var i=e.tr,a=n.parent,s=n.end,l=n.endIndex-1,c=n.startIndex;l>c;l--)s-=a.child(l).nodeSize,i.delete(s-1,s+1);var u=i.doc.resolve(n.start),f=u.nodeAfter;if(i.mapping.map(n.end)!=n.start+u.nodeAfter.nodeSize)return!1;var d=0==n.startIndex,h=n.endIndex==a.childCount,p=u.node(-1),m=u.index(-1);if(!p.canReplace(m+(d?0:1),m+1,f.content.append(h?o.Fragment.empty:o.Fragment.from(a))))return!1;var v=u.pos,g=v+f.nodeSize;return i.step(new r.ReplaceAroundStep(v-(d?1:0),g+(h?1:0),v+1,g-1,new o.Slice((d?o.Fragment.empty:o.Fragment.from(a.copy(o.Fragment.empty))).append(h?o.Fragment.empty:o.Fragment.from(a.copy(o.Fragment.empty))),d?0:1,h?0:1),d?0:1)),t(i.scrollIntoView()),!0}(t,n,l)))}},t.listItem=f,t.orderedList=c,t.sinkListItem=function(e){return function(t,n){var i=t.selection,a=i.$from,s=i.$to,l=a.blockRange(s,(function(t){return t.childCount>0&&t.firstChild.type==e}));if(!l)return!1;var c=l.startIndex;if(0==c)return!1;var u=l.parent,f=u.child(c-1);if(f.type!=e)return!1;if(n){var d=f.lastChild&&f.lastChild.type==u.type,h=o.Fragment.from(d?e.create():null),p=new o.Slice(o.Fragment.from(e.create(null,o.Fragment.from(u.type.create(null,h)))),d?3:1,0),m=l.start,v=l.end;n(t.tr.step(new r.ReplaceAroundStep(m-(d?3:1),v,m,v,p,1,!0)).scrollIntoView())}return!0}},t.splitListItem=h,t.splitListItemKeepMarks=function(e,t){var n=h(e,t);return function(e,t){return n(e,t&&function(n){var r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();r&&n.ensureMarks(r),t(n)})}},t.wrapInList=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,i){var a=n.selection,s=a.$from,l=a.$to,c=s.blockRange(l),u=!1,f=c;if(!c)return!1;if(c.depth>=2&&s.node(c.depth-1).type.compatibleContent(e)&&0==c.startIndex){if(0==s.index(c.depth-1))return!1;var d=n.doc.resolve(c.start-2);f=new o.NodeRange(d,d,c.depth),c.endIndex<c.parent.childCount&&(c=new o.NodeRange(s,n.doc.resolve(l.end(c.depth)),c.depth)),u=!0}var h=r.findWrapping(f,e,t,c);return!!h&&(i&&i(function(e,t,n,i,a){for(var s=o.Fragment.empty,l=n.length-1;l>=0;l--)s=o.Fragment.from(n[l].type.create(n[l].attrs,s));e.step(new r.ReplaceAroundStep(t.start-(i?2:0),t.end,t.start,t.end,new o.Slice(s,0,0),n.length,!0));for(var c=0,u=0;u<n.length;u++)n[u].type==a&&(c=u+1);for(var f=n.length-c,d=t.start+n.length-(i?2:0),h=t.parent,p=t.startIndex,m=t.endIndex,v=!0;p<m;p++,v=!1)!v&&r.canSplit(e.doc,d,f)&&(e.split(d,f),d+=2*f),d+=h.child(p).nodeSize;return e}(n.tr,c,h,u,e).scrollIntoView()),!0)}}},2391:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(){return o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},o.apply(this,arguments)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}function a(e,t){return a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},a(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=l(e);if(t){var i=l(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(t,"__esModule",{value:!0});var d=n(9443),h=n(2843),p=Object.create(null),m=function(){function e(t,n,r){c(this,e),this.$anchor=t,this.$head=n,this.ranges=r||[new v(t.min(n),t.max(n))]}return f(e,[{key:"anchor",get:function(){return this.$anchor.pos}},{key:"head",get:function(){return this.$head.pos}},{key:"from",get:function(){return this.$from.pos}},{key:"to",get:function(){return this.$to.pos}},{key:"$from",get:function(){return this.ranges[0].$from}},{key:"$to",get:function(){return this.ranges[0].$to}},{key:"empty",get:function(){for(var e=this.ranges,t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}},{key:"content",value:function(){return this.$from.doc.slice(this.from,this.to,!0)}},{key:"replace",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.Slice.empty,n=t.content.lastChild,r=null,o=0;o<t.openEnd;o++)r=n,n=n.lastChild;for(var i=e.steps.length,a=this.ranges,s=0;s<a.length;s++){var l=a[s],c=l.$from,u=l.$to,f=e.mapping.slice(i);e.replaceRange(f.map(c.pos),f.map(u.pos),s?d.Slice.empty:t),0==s&&M(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}},{key:"replaceWith",value:function(e,t){for(var n=e.steps.length,r=this.ranges,o=0;o<r.length;o++){var i=r[o],a=i.$from,s=i.$to,l=e.mapping.slice(n),c=l.map(a.pos),u=l.map(s.pos);o?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),M(e,n,t.isInline?-1:1))}}},{key:"getBookmark",value:function(){return b.between(this.$anchor,this.$head).getBookmark()}}],[{key:"findFrom",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.parent.inlineContent?new b(e):O(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(var o=e.depth-1;o>=0;o--){var i=t<0?O(e.node(0),e.node(o),e.before(o+1),e.index(o),t,n):O(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,n);if(i)return i}return null}},{key:"near",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.findFrom(e,t)||this.findFrom(e,-t)||new x(e.node(0))}},{key:"atStart",value:function(e){return O(e,e,0,0,1)||new x(e)}},{key:"atEnd",value:function(e){return O(e,e,e.content.size,e.childCount,-1)||new x(e)}},{key:"fromJSON",value:function(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=p[t.type];if(!n)throw new RangeError("No selection type ".concat(t.type," defined"));return n.fromJSON(e,t)}},{key:"jsonID",value:function(e,t){if(e in p)throw new RangeError("Duplicate use of selection JSON ID "+e);return p[e]=t,t.prototype.jsonID=e,t}}]),e}();m.prototype.visible=!0;var v=f((function e(t,n){c(this,e),this.$from=t,this.$to=n})),g=!1;function y(e){g||e.parent.inlineContent||(g=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}var b=function(e){i(n,e);var t=s(n);function n(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return c(this,n),y(e),y(r),t.call(this,e,r)}return f(n,[{key:"$cursor",get:function(){return this.$anchor.pos==this.$head.pos?this.$head:null}},{key:"map",value:function(e,t){var r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return m.near(r);var o=e.resolve(t.map(this.anchor));return new n(o.parent.inlineContent?o:r,r)}},{key:"replace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.Slice.empty;if(o(l(n.prototype),"replace",this).call(this,e,t),t==d.Slice.empty){var r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}},{key:"eq",value:function(e){return e instanceof n&&e.anchor==this.anchor&&e.head==this.head}},{key:"getBookmark",value:function(){return new w(this.anchor,this.head)}},{key:"toJSON",value:function(){return{type:"text",anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new n(e.resolve(t.anchor),e.resolve(t.head))}},{key:"create",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}},{key:"between",value:function(e,t,r){var o=e.pos-t.pos;if(r&&!o||(r=o>=0?1:-1),!t.parent.inlineContent){var i=m.findFrom(t,r,!0)||m.findFrom(t,-r,!0);if(!i)return m.near(t,r);t=i.$head}return e.parent.inlineContent||(0==o||(e=(m.findFrom(e,-r,!0)||m.findFrom(e,r,!0)).$anchor).pos<t.pos!=o<0)&&(e=t),new n(e,t)}}]),n}(m);m.jsonID("text",b);var w=function(){function e(t,n){c(this,e),this.anchor=t,this.head=n}return f(e,[{key:"map",value:function(t){return new e(t.map(this.anchor),t.map(this.head))}},{key:"resolve",value:function(e){return b.between(e.resolve(this.anchor),e.resolve(this.head))}}]),e}(),k=function(e){i(n,e);var t=s(n);function n(e){var r;c(this,n);var o=e.nodeAfter,i=e.node(0).resolve(e.pos+o.nodeSize);return(r=t.call(this,e,i)).node=o,r}return f(n,[{key:"map",value:function(e,t){var r=t.mapResult(this.anchor),o=r.deleted,i=r.pos,a=e.resolve(i);return o?m.near(a):new n(a)}},{key:"content",value:function(){return new d.Slice(d.Fragment.from(this.node),0,0)}},{key:"eq",value:function(e){return e instanceof n&&e.anchor==this.anchor}},{key:"toJSON",value:function(){return{type:"node",anchor:this.anchor}}},{key:"getBookmark",value:function(){return new S(this.anchor)}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new n(e.resolve(t.anchor))}},{key:"create",value:function(e,t){return new n(e.resolve(t))}},{key:"isSelectable",value:function(e){return!e.isText&&!1!==e.type.spec.selectable}}]),n}(m);k.prototype.visible=!1,m.jsonID("node",k);var S=function(){function e(t){c(this,e),this.anchor=t}return f(e,[{key:"map",value:function(t){var n=t.mapResult(this.anchor),r=n.deleted,o=n.pos;return r?new w(o,o):new e(o)}},{key:"resolve",value:function(e){var t=e.resolve(this.anchor),n=t.nodeAfter;return n&&k.isSelectable(n)?new k(t):m.near(t)}}]),e}(),x=function(e){i(n,e);var t=s(n);function n(e){return c(this,n),t.call(this,e.resolve(0),e.resolve(e.content.size))}return f(n,[{key:"replace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.Slice.empty;if(t==d.Slice.empty){e.delete(0,e.doc.content.size);var r=m.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else o(l(n.prototype),"replace",this).call(this,e,t)}},{key:"toJSON",value:function(){return{type:"all"}}},{key:"map",value:function(e){return new n(e)}},{key:"eq",value:function(e){return e instanceof n}},{key:"getBookmark",value:function(){return C}}],[{key:"fromJSON",value:function(e){return new n(e)}}]),n}(m);m.jsonID("all",x);var C={map:function(){return this},resolve:function(e){return new x(e)}};function O(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(t.inlineContent)return b.create(e,n);for(var a=r-(o>0?0:1);o>0?a<t.childCount:a>=0;a+=o){var s=t.child(a);if(s.isAtom){if(!i&&k.isSelectable(s))return k.create(e,n-(o<0?s.nodeSize:0))}else{var l=O(e,s,n+o,o<0?s.childCount:0,o,i);if(l)return l}n+=s.nodeSize*o}return null}function M(e,t,n){var r=e.steps.length-1;if(!(r<t)){var o,i=e.steps[r];(i instanceof h.ReplaceStep||i instanceof h.ReplaceAroundStep)&&(e.mapping.maps[r].forEach((function(e,t,n,r){null==o&&(o=r)})),e.setSelection(m.near(e.doc.resolve(o),n)))}}var T=function(e){i(n,e);var t=s(n);function n(e){var r;return c(this,n),(r=t.call(this,e.doc)).curSelectionFor=0,r.updated=0,r.meta=Object.create(null),r.time=Date.now(),r.curSelection=e.selection,r.storedMarks=e.storedMarks,r}return f(n,[{key:"selection",get:function(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}},{key:"setSelection",value:function(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}},{key:"selectionSet",get:function(){return(1&this.updated)>0}},{key:"setStoredMarks",value:function(e){return this.storedMarks=e,this.updated|=2,this}},{key:"ensureMarks",value:function(e){return d.Mark.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}},{key:"addStoredMark",value:function(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}},{key:"removeStoredMark",value:function(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}},{key:"storedMarksSet",get:function(){return(2&this.updated)>0}},{key:"addStep",value:function(e,t){o(l(n.prototype),"addStep",this).call(this,e,t),this.updated=-3&this.updated,this.storedMarks=null}},{key:"setTime",value:function(e){return this.time=e,this}},{key:"replaceSelection",value:function(e){return this.selection.replace(this,e),this}},{key:"replaceSelectionWith",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||d.Mark.none))),n.replaceWith(this,e),this}},{key:"deleteSelection",value:function(){return this.selection.replace(this),this}},{key:"insertText",value:function(e,t,n){var r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();if(null==n&&(n=t),n=null==n?t:n,!e)return this.deleteRange(t,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(t);o=n==t?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.setSelection(m.near(this.selection.$to)),this}},{key:"setMeta",value:function(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}},{key:"getMeta",value:function(e){return this.meta["string"==typeof e?e:e.key]}},{key:"isGeneric",get:function(){for(var e in this.meta)return!1;return!0}},{key:"scrollIntoView",value:function(){return this.updated|=4,this}},{key:"scrolledIntoView",get:function(){return(4&this.updated)>0}}]),n}(h.Transform);function A(e,t){return t&&e?e.bind(t):e}var N=f((function e(t,n,r){c(this,e),this.name=t,this.init=A(n.init,r),this.apply=A(n.apply,r)})),R=[new N("doc",{init:function(e){return e.doc||e.schema.topNodeType.createAndFill()},apply:function(e){return e.doc}}),new N("selection",{init:function(e,t){return e.selection||m.atStart(t.doc)},apply:function(e){return e.selection}}),new N("storedMarks",{init:function(e){return e.storedMarks||null},apply:function(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new N("scrollToSelection",{init:function(){return 0},apply:function(e,t){return e.scrolledIntoView?t+1:t}})],D=f((function e(t,n){var r=this;c(this,e),this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=R.slice(),n&&n.forEach((function(e){if(r.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");r.plugins.push(e),r.pluginsByKey[e.key]=e,e.spec.state&&r.fields.push(new N(e.key,e.spec.state,e))}))})),_=function(){function e(t){c(this,e),this.config=t}return f(e,[{key:"schema",get:function(){return this.config.schema}},{key:"plugins",get:function(){return this.config.plugins}},{key:"apply",value:function(e){return this.applyTransaction(e).state}},{key:"filterTransaction",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=0;n<this.config.plugins.length;n++)if(n!=t){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}},{key:"applyTransaction",value:function(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};for(var t=[e],n=this.applyInner(e),r=null;;){for(var o=!1,i=0;i<this.config.plugins.length;i++){var a=this.config.plugins[i];if(a.spec.appendTransaction){var s=r?r[i].n:0,l=r?r[i].state:this,c=s<t.length&&a.spec.appendTransaction.call(a,s?t.slice(s):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(var u=0;u<this.config.plugins.length;u++)r.push(u<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}},{key:"applyInner",value:function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var n=new e(this.config),r=this.config.fields,o=0;o<r.length;o++){var i=r[o];n[i.name]=i.apply(t,this[i.name],this,n)}return n}},{key:"tr",get:function(){return new T(this)}},{key:"reconfigure",value:function(t){for(var n=new D(this.schema,t.plugins),r=n.fields,o=new e(n),i=0;i<r.length;i++){var a=r[i].name;o[a]=this.hasOwnProperty(a)?this[a]:r[i].init(t,o)}return o}},{key:"toJSON",value:function(e){var t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map((function(e){return e.toJSON()}))),e&&"object"==r(e))for(var n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var o=e[n],i=o.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(o,this[o.key]))}return t}}],[{key:"create",value:function(t){for(var n=new D(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n),o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(t,r);return r}},{key:"fromJSON",value:function(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var o=new D(t.schema,t.plugins),i=new e(o);return o.fields.forEach((function(e){if("doc"==e.name)i.doc=d.Node.fromJSON(t.schema,n.doc);else if("selection"==e.name)i.selection=m.fromJSON(i.doc,n.selection);else if("storedMarks"==e.name)n.storedMarks&&(i.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(var o in r){var a=r[o],s=a.spec.state;if(a.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,o))return void(i[e.name]=s.fromJSON.call(a,t,n[o],i))}i[e.name]=e.init(t,i)}})),i}}]),e}();function E(e,t,n){for(var r in e){var o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=E(o,t,{})),n[r]=o}return n}var P=function(){function e(t){c(this,e),this.spec=t,this.props={},t.props&&E(t.props,this,this.props),this.key=t.key?t.key.key:I("plugin")}return f(e,[{key:"getState",value:function(e){return e[this.key]}}]),e}(),z=Object.create(null);function I(e){return e in z?e+"$"+ ++z[e]:(z[e]=0,e+"$")}var j=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"key";c(this,e),this.key=I(t)}return f(e,[{key:"get",value:function(e){return e.config.pluginsByKey[this.key]}},{key:"getState",value:function(e){return e[this.key]}}]),e}();t.AllSelection=x,t.EditorState=_,t.NodeSelection=k,t.Plugin=P,t.PluginKey=j,t.Selection=m,t.SelectionRange=v,t.TextSelection=b,t.Transaction=T},1640:(e,t,n)=>{var r,o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,l={};((e,t)=>{for(var n in t)o(e,n,{get:t[n],enumerable:!0})})(l,{CellBookmark:()=>I,CellSelection:()=>z,ResizeState:()=>Le,TableMap:()=>m,TableView:()=>je,__clipCells:()=>ke,__insertCells:()=>Ce,__pastedCells:()=>be,addColSpan:()=>E,addColumn:()=>J,addColumnAfter:()=>G,addColumnBefore:()=>U,addRow:()=>Z,addRowAfter:()=>te,addRowBefore:()=>ee,cellAround:()=>S,cellNear:()=>O,colCount:()=>R,columnIsHeader:()=>P,columnResizing:()=>$e,columnResizingPluginKey:()=>Be,deleteCellSelection:()=>ve,deleteColumn:()=>Y,deleteRow:()=>re,deleteTable:()=>me,findCell:()=>N,fixTables:()=>$,fixTablesKey:()=>F,goToNextCell:()=>pe,handlePaste:()=>Re,inSameTable:()=>A,isInTable:()=>x,mergeCells:()=>ie,moveCellForward:()=>T,nextCell:()=>D,pointsAtCell:()=>M,removeColSpan:()=>_,removeColumn:()=>X,removeRow:()=>ne,rowIsHeader:()=>Q,selectedRect:()=>q,selectionCell:()=>C,setCellAttr:()=>le,splitCell:()=>ae,splitCellWithType:()=>se,tableEditing:()=>qe,tableEditingKey:()=>k,tableNodeTypes:()=>w,tableNodes:()=>b,toggleHeader:()=>ue,toggleHeaderCell:()=>he,toggleHeaderColumn:()=>de,toggleHeaderRow:()=>fe,updateColumnsOnResize:()=>Fe}),e.exports=(r=l,((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of a(t))s.call(e,n)||undefined===n||o(e,n,{get:()=>t[n],enumerable:!(r=i(t,n))||r.enumerable});return e})(o({},"__esModule",{value:!0}),r));var c,u,f=n(2391),d=n(9443),h=n(2391),p=n(9222);if("undefined"!=typeof WeakMap){let e=new WeakMap;c=t=>e.get(t),u=(t,n)=>(e.set(t,n),n)}else{const e=[],t=10;let n=0;c=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},u=(r,o)=>(n==t&&(n=0),e[n++]=r,e[n++]=o)}var m=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,o=t/this.width|0;let i=r+1,a=o+1;for(let e=1;i<this.width&&this.map[t+e]==n;e++)i++;for(let e=1;a<this.height&&this.map[t+this.width*e]==n;e++)a++;return{left:r,top:o,right:i,bottom:a}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:o,top:i,bottom:a}=this.findCell(e);return"horiz"==t?(n<0?0==r:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?0==i:a==this.height)?null:this.map[r+this.width*(n<0?i-1:a)]}rectBetween(e,t){const{left:n,right:r,top:o,bottom:i}=this.findCell(e),{left:a,right:s,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,a),top:Math.min(o,l),right:Math.max(r,s),bottom:Math.max(i,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let o=e.left;o<e.right;o++){const i=r*this.width+o,a=this.map[i];n[a]||(n[a]=!0,o==e.left&&o&&this.map[i-1]==a||r==e.top&&r&&this.map[i-this.width]==a||t.push(a))}return t}positionAt(e,t,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==e){let n=t+e*this.width;const r=(e+1)*this.width;for(;n<r&&this.map[n]<o;)n++;return n==r?i-1:this.map[n]}o=i}}static get(e){return c(e)||u(e,function(e){if("table"!=e.type.spec.tableRole)throw new RangeError("Not a table node: "+e.type.name);const t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const o=e.child(r);let i=0;if(n)for(let t=0;t<r;t++){const n=e.child(t);for(let e=0;e<n.childCount;e++){const o=n.child(e);t+o.attrs.rowspan>r&&(i+=o.attrs.colspan)}}for(let e=0;e<o.childCount;e++){const t=o.child(e);i+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=i:t!=i&&(t=Math.max(t,i))}return t}(e),n=e.childCount,r=[];let o=0,i=null;const a=[];for(let e=0,o=t*n;e<o;e++)r[e]=0;for(let s=0,l=0;s<n;s++){const c=e.child(s);l++;for(let e=0;;e++){for(;o<r.length&&0!=r[o];)o++;if(e==c.childCount)break;const u=c.child(e),{colspan:f,rowspan:d,colwidth:h}=u.attrs;for(let e=0;e<d;e++){if(e+s>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:l,n:d-e});break}const c=o+e*t;for(let e=0;e<f;e++){0==r[c+e]?r[c+e]=l:(i||(i=[])).push({type:"collision",row:s,pos:l,n:f-e});const n=h&&h[e];if(n){const r=(c+e)%t*2,o=a[r];null==o||o!=n&&1==a[r+1]?(a[r]=n,a[r+1]=1):o==n&&a[r+1]++}}}o+=f,l+=u.nodeSize}const u=(s+1)*t;let f=0;for(;o<u;)0==r[o++]&&f++;f&&(i||(i=[])).push({type:"missing",row:s,n:f}),l++}const s=new m(t,n,r,i);let l=!1;for(let e=0;!l&&e<a.length;e+=2)null!=a[e]&&a[e+1]<n&&(l=!0);return l&&function(e,t,n){e.problems||(e.problems=[]);const r={};for(let o=0;o<e.map.length;o++){const i=e.map[o];if(r[i])continue;r[i]=!0;const a=n.nodeAt(i);if(!a)throw new RangeError(`No cell with offset ${i} found`);let s=null;const l=a.attrs;for(let n=0;n<l.colspan;n++){const r=t[(o+n)%e.width*2];null==r||l.colwidth&&l.colwidth[n]==r||((s||(s=v(l)))[n]=r)}s&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:s})}}(s,a,e),s}(e))}};function v(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function g(e,t){if("string"==typeof e)return{};const n=e.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map((e=>Number(e))):null,o=Number(e.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:r&&r.length==o?r:null};for(const n in t){const r=t[n].getFromDOM,o=r&&r(e);null!=o&&(i[n]=o)}return i}function y(e,t){const n={};1!=e.attrs.colspan&&(n.colspan=e.attrs.colspan),1!=e.attrs.rowspan&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(","));for(const r in t){const o=t[r].setDOMAttr;o&&o(e.attrs[r],n)}return n}function b(e){const t=e.cellAttributes||{},n={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(const e in t)n[e]={default:t[e].default};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:e=>g(e,t)}],toDOM:e=>["td",y(e,t),0]},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:e=>g(e,t)}],toDOM:e=>["th",y(e,t),0]}}}function w(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],o=r.spec.tableRole;o&&(t[o]=r)}}return t}var k=new(n(2391).PluginKey)("selectingCells");function S(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function x(e){const t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function C(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;const n=S(t.$head)||O(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function O(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}function M(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function T(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function A(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function N(e){return m.get(e.node(-1)).findCell(e.pos-e.start(-1))}function R(e){return m.get(e.node(-1)).colCount(e.pos-e.start(-1))}function D(e,t,n){const r=e.node(-1),o=m.get(r),i=e.start(-1),a=o.nextCell(e.pos-i,t,n);return null==a?null:e.node(0).resolve(i+a)}function _(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some((e=>e>0))||(r.colwidth=null)),r}function E(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function P(e,t,n){const r=w(t.type.schema).header_cell;for(let o=0;o<e.height;o++)if(t.nodeAt(e.map[n+o*e.width]).type!=r)return!1;return!0}var z=class e extends h.Selection{constructor(e,t=e){const n=e.node(-1),r=m.get(n),o=e.start(-1),i=r.rectBetween(e.pos-o,t.pos-o),a=e.node(0),s=r.cellsInRect(i).filter((e=>e!=t.pos-o));s.unshift(t.pos-o);const l=s.map((e=>{const t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);const r=o+e+1;return new h.SelectionRange(a.resolve(r),a.resolve(r+t.content.size))}));super(l[0].$from,l[0].$to,l),this.$anchorCell=e,this.$headCell=t}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),o=t.resolve(n.map(this.$headCell.pos));if(M(r)&&M(o)&&A(r,o)){const t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,o):t&&this.isColSelection()?e.colSelection(r,o):new e(r,o)}return h.TextSelection.between(r,o)}content(){const e=this.$anchorCell.node(-1),t=m.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},i=[];for(let n=r.top;n<r.bottom;n++){const a=[];for(let i=n*t.width+r.left,s=r.left;s<r.right;s++,i++){const n=t.map[i];if(o[n])continue;o[n]=!0;const s=t.findCell(n);let l=e.nodeAt(n);if(!l)throw RangeError(`No cell with offset ${n} found`);const c=r.left-s.left,u=s.right-r.right;if(c>0||u>0){let e=l.attrs;if(c>0&&(e=_(e,0,c)),u>0&&(e=_(e,e.colspan-u,u)),s.left<r.left){if(l=l.type.createAndFill(e),!l)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else l=l.type.create(e,l.content)}if(s.top<r.top||s.bottom>r.bottom){const e={...l.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};l=s.top<r.top?l.type.createAndFill(e):l.type.create(e,l.content)}a.push(l)}i.push(e.child(n).copy(d.Fragment.from(a)))}const a=this.isColSelection()&&this.isRowSelection()?e:i;return new d.Slice(d.Fragment.from(a),1,1)}replace(e,t=d.Slice.empty){const n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){const{$from:i,$to:a}=r[o],s=e.mapping.slice(n);e.replace(s.map(i.pos),s.map(a.pos),o?d.Slice.empty:t)}const o=h.Selection.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new d.Slice(d.Fragment.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=m.get(t),r=this.$anchorCell.start(-1),o=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<o.length;n++)e(t.nodeAt(o[n]),r+o[n])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),o=m.get(r),i=t.start(-1),a=o.findCell(t.pos-i),s=o.findCell(n.pos-i),l=t.node(0);return a.top<=s.top?(a.top>0&&(t=l.resolve(i+o.map[a.left])),s.bottom<o.height&&(n=l.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))):(s.top>0&&(n=l.resolve(i+o.map[s.left])),a.bottom<o.height&&(t=l.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))),new e(t,n)}isRowSelection(){const e=this.$anchorCell.node(-1),t=m.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),o=t.colCount(this.$headCell.pos-n);if(Math.min(r,o)>0)return!1;const i=r+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,a)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),o=m.get(r),i=t.start(-1),a=o.findCell(t.pos-i),s=o.findCell(n.pos-i),l=t.node(0);return a.left<=s.left?(a.left>0&&(t=l.resolve(i+o.map[a.top*o.width])),s.right<o.width&&(n=l.resolve(i+o.map[o.width*(s.top+1)-1]))):(s.left>0&&(n=l.resolve(i+o.map[s.top*o.width])),a.right<o.width&&(t=l.resolve(i+o.map[o.width*(a.top+1)-1]))),new e(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new I(this.$anchorCell.pos,this.$headCell.pos)}};z.prototype.visible=!1,h.Selection.jsonID("cell",z);var I=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&A(t,n)?new z(t,n):h.Selection.near(n,1)}};function j(e){if(!(e.selection instanceof z))return null;const t=[];return e.selection.forEachCell(((e,n)=>{t.push(p.Decoration.node(n,n+e.nodeSize,{class:"selectedCell"}))})),p.DecorationSet.create(e.doc,t)}var F=new(n(2391).PluginKey)("fix-tables");function B(e,t,n,r){const o=e.childCount,i=t.childCount;e:for(let a=0,s=0;a<i;a++){const i=t.child(a);for(let t=s,r=Math.min(o,a+3);t<r;t++)if(e.child(t)==i){s=t+1,n+=i.nodeSize;continue e}r(i,n),s<o&&e.child(s).sameMarkup(i)?B(e.child(s),i,n+1,r):i.nodesBetween(0,i.content.size,r,n+1),n+=i.nodeSize}}function $(e,t){let n;const r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){const o=m.get(t);if(!o.problems)return r;r||(r=e.tr);const i=[];for(let e=0;e<o.height;e++)i.push(0);for(let e=0;e<o.problems.length;e++){const a=o.problems[e];if("collision"==a.type){const e=t.nodeAt(a.pos);if(!e)continue;const o=e.attrs;for(let e=0;e<o.rowspan;e++)i[a.row+e]+=a.n;r.setNodeMarkup(r.mapping.map(n+1+a.pos),null,_(o,o.colspan-a.n,a.n))}else if("missing"==a.type)i[a.row]+=a.n;else if("overlong_rowspan"==a.type){const e=t.nodeAt(a.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+a.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-a.n})}else if("colwidth mismatch"==a.type){const e=t.nodeAt(a.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+a.pos),null,{...e.attrs,colwidth:a.colwidth})}}let a,s;for(let e=0;e<i.length;e++)i[e]&&(null==a&&(a=e),s=e);for(let l=0,c=n+1;l<o.height;l++){const n=t.child(l),o=c+n.nodeSize,u=i[l];if(u>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);const i=[];for(let n=0;n<u;n++){const n=w(e.schema)[t].createAndFill();n&&i.push(n)}const f=0!=l&&a!=l-1||s!=l?o-1:c+1;r.insert(r.mapping.map(f),i)}c=o}return r.setMeta(F,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&B(t.doc,e.doc,0,r):e.doc.descendants(r),n}var L=n(7354),V=n(9443),K=n(2391),H=n(9443),W=n(2391);function q(e){const t=e.selection,n=C(e),r=n.node(-1),o=n.start(-1),i=m.get(r);return{...t instanceof z?i.rectBetween(t.$anchorCell.pos-o,t.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function J(e,{map:t,tableStart:n,table:r},o){let i=o>0?-1:0;P(t,r,o+i)&&(i=0==o||o==t.width?null:0);for(let a=0;a<t.height;a++){const s=a*t.width+o;if(o>0&&o<t.width&&t.map[s-1]==t.map[s]){const i=t.map[s],l=r.nodeAt(i);e.setNodeMarkup(e.mapping.map(n+i),null,E(l.attrs,o-t.colCount(i))),a+=l.attrs.rowspan-1}else{const l=null==i?w(r.type.schema).cell:r.nodeAt(t.map[s+i]).type,c=t.positionAt(a,o,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function U(e,t){if(!x(e))return!1;if(t){const n=q(e);t(J(e.tr,n,n.left))}return!0}function G(e,t){if(!x(e))return!1;if(t){const n=q(e);t(J(e.tr,n,n.right))}return!0}function X(e,{map:t,table:n,tableStart:r},o){const i=e.mapping.maps.length;for(let a=0;a<t.height;){const s=a*t.width+o,l=t.map[s],c=n.nodeAt(l),u=c.attrs;if(o>0&&t.map[s-1]==l||o<t.width-1&&t.map[s+1]==l)e.setNodeMarkup(e.mapping.slice(i).map(r+l),null,_(u,o-t.colCount(l)));else{const t=e.mapping.slice(i).map(r+l);e.delete(t,t+c.nodeSize)}a+=u.rowspan}}function Y(e,t){if(!x(e))return!1;if(t){const n=q(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;X(r,n,e),e!=n.left;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=m.get(e)}t(r)}return!0}function Q(e,t,n){var r;const o=w(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if((null==(r=t.nodeAt(e.map[i+n*e.width]))?void 0:r.type)!=o)return!1;return!0}function Z(e,{map:t,tableStart:n,table:r},o){var i;let a=n;for(let e=0;e<o;e++)a+=r.child(e).nodeSize;const s=[];let l=o>0?-1:0;Q(t,r,o+l)&&(l=0==o||o==t.height?null:0);for(let a=0,c=t.width*o;a<t.width;a++,c++)if(o>0&&o<t.height&&t.map[c]==t.map[c-t.width]){const o=t.map[c],i=r.nodeAt(o).attrs;e.setNodeMarkup(n+o,null,{...i,rowspan:i.rowspan+1}),a+=i.colspan-1}else{const e=null==l?w(r.type.schema).cell:null==(i=r.nodeAt(t.map[c+l*t.width]))?void 0:i.type,n=null==e?void 0:e.createAndFill();n&&s.push(n)}return e.insert(a,w(r.type.schema).row.create(null,s)),e}function ee(e,t){if(!x(e))return!1;if(t){const n=q(e);t(Z(e.tr,n,n.top))}return!0}function te(e,t){if(!x(e))return!1;if(t){const n=q(e);t(Z(e.tr,n,n.bottom))}return!0}function ne(e,{map:t,table:n,tableStart:r},o){let i=0;for(let e=0;e<o;e++)i+=n.child(e).nodeSize;const a=i+n.child(o).nodeSize,s=e.mapping.maps.length;e.delete(i+r,a+r);const l=new Set;for(let i=0,a=o*t.width;i<t.width;i++,a++){const c=t.map[a];if(!l.has(c))if(l.add(c),o>0&&c==t.map[a-t.width]){const t=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(s).map(c+r),null,{...t,rowspan:t.rowspan-1}),i+=t.colspan-1}else if(o<t.height&&c==t.map[a+t.width]){const a=n.nodeAt(c),l=a.attrs,u=a.type.create({...l,rowspan:a.attrs.rowspan-1},a.content),f=t.positionAt(o+1,i,n);e.insert(e.mapping.slice(s).map(r+f),u),i+=l.colspan-1}}}function re(e,t){if(!x(e))return!1;if(t){const n=q(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;ne(r,n,e),e!=n.top;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=m.get(n.table)}t(r)}return!0}function oe(e){const t=e.content;return 1==t.childCount&&t.child(0).isTextblock&&0==t.child(0).childCount}function ie(e,t){const n=e.selection;if(!(n instanceof z)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=q(e),{map:o}=r;if(function({width:e,height:t,map:n},r){let o=r.top*e+r.left,i=o,a=(r.bottom-1)*e+r.left,s=o+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[i]==n[i-1]||r.right<e&&n[s]==n[s+1])return!0;i+=e,s+=e}for(let i=r.left;i<r.right;i++){if(r.top>0&&n[o]==n[o-e]||r.bottom<t&&n[a]==n[a+e])return!0;o++,a++}return!1}(o,r))return!1;if(t){const n=e.tr,i={};let a,s,l=H.Fragment.empty;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){const c=o.map[e*o.width+t],u=r.table.nodeAt(c);if(!i[c]&&u)if(i[c]=!0,null==a)a=c,s=u;else{oe(u)||(l=l.append(u.content));const e=n.mapping.map(c+r.tableStart);n.delete(e,e+u.nodeSize)}}if(null==a||null==s)return!0;if(n.setNodeMarkup(a+r.tableStart,null,{...E(s.attrs,s.attrs.colspan,r.right-r.left-s.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const e=a+1+s.content.size,t=oe(s)?a+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,l)}n.setSelection(new z(n.doc.resolve(a+r.tableStart))),t(n)}return!0}function ae(e,t){const n=w(e.schema);return se((({node:e})=>n[e.type.spec.tableRole]))(e,t)}function se(e){return(t,n)=>{var r;const o=t.selection;let i,a;if(o instanceof z){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,a=o.$anchorCell.pos}else{if(i=function(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if("cell"===n||"header_cell"===n)return e.node(t)}return null}(o.$from),!i)return!1;a=null==(r=S(o.$from))?void 0:r.pos}if(null==i||null==a)return!1;if(1==i.attrs.colspan&&1==i.attrs.rowspan)return!1;if(n){let r=i.attrs;const s=[],l=r.colwidth;r.rowspan>1&&(r={...r,rowspan:1}),r.colspan>1&&(r={...r,colspan:1});const c=q(t),u=t.tr;for(let e=0;e<c.right-c.left;e++)s.push(l?{...r,colwidth:l&&l[e]?[l[e]]:null}:r);let f;for(let t=c.top;t<c.bottom;t++){let n=c.map.positionAt(t,c.left,c.table);t==c.top&&(n+=i.nodeSize);for(let r=c.left,o=0;r<c.right;r++,o++)r==c.left&&t==c.top||u.insert(f=u.mapping.map(n+c.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[o]))}u.setNodeMarkup(a,e({node:i,row:c.top,col:c.left}),s[0]),o instanceof z&&u.setSelection(new z(u.doc.resolve(o.$anchorCell.pos),f?u.doc.resolve(f):void 0)),n(u)}return!0}}function le(e,t){return function(n,r){if(!x(n))return!1;const o=C(n);if(o.nodeAfter.attrs[e]===t)return!1;if(r){const i=n.tr;n.selection instanceof z?n.selection.forEachCell(((n,r)=>{n.attrs[e]!==t&&i.setNodeMarkup(r,null,{...n.attrs,[e]:t})})):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[e]:t}),r(i)}return!0}}function ce(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){const o=t.table.nodeAt(r[e]);if(o&&o.type!==n.header_cell)return!1}return!0}function ue(e,t){return(t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(e){return function(t,n){if(!x(t))return!1;if(n){const r=w(t.schema),o=q(t),i=t.tr,a=o.map.cellsInRect("column"==e?{left:o.left,top:0,right:o.right,bottom:o.map.height}:"row"==e?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),s=a.map((e=>o.table.nodeAt(e)));for(let e=0;e<a.length;e++)s[e].type==r.header_cell&&i.setNodeMarkup(o.tableStart+a[e],r.cell,s[e].attrs);if(0==i.steps.length)for(let e=0;e<a.length;e++)i.setNodeMarkup(o.tableStart+a[e],r.header_cell,s[e].attrs);n(i)}return!0}}(e):function(t,n){if(!x(t))return!1;if(n){const r=w(t.schema),o=q(t),i=t.tr,a=ce("row",o,r),s=ce("column",o,r),l=("column"===e?a:"row"===e&&s)?1:0,c="column"==e?{left:0,top:l,right:1,bottom:o.map.height}:"row"==e?{left:l,top:0,right:o.map.width,bottom:1}:o,u="column"==e?s?r.cell:r.header_cell:"row"==e?a?r.cell:r.header_cell:r.cell;o.map.cellsInRect(c).forEach((e=>{const t=e+o.tableStart,n=i.doc.nodeAt(t);n&&i.setNodeMarkup(t,u,n.attrs)})),n(i)}return!0}}var fe=ue("row",{useDeprecatedLogic:!0}),de=ue("column",{useDeprecatedLogic:!0}),he=ue("cell",{useDeprecatedLogic:!0});function pe(e){return function(t,n){if(!x(t))return!1;const r=function(e,t){if(t<0){const t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){const r=e.node(-1).child(t),o=r.lastChild;if(o)return n-1-o.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){const e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(C(t),e);if(null==r)return!1;if(n){const e=t.doc.resolve(r);n(t.tr.setSelection(W.TextSelection.between(e,T(e))).scrollIntoView())}return!0}}function me(e,t){const n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function ve(e,t){const n=e.selection;if(!(n instanceof z))return!1;if(t){const r=e.tr,o=w(e.schema).cell.createAndFill().content;n.forEachCell(((e,t)=>{e.content.eq(o)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new H.Slice(o,0,0))})),r.docChanged&&t(r)}return!0}var ge=n(9443),ye=n(2843);function be(e){if(!e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;const o=t.child(0),i=o.type.spec.tableRole,a=o.type.schema,s=[];if("row"==i)for(let e=0;e<t.childCount;e++){let o=t.child(e).content;const i=e?0:Math.max(0,n-1),l=e<t.childCount-1?0:Math.max(0,r-1);(i||l)&&(o=we(w(a).row,new ge.Slice(o,i,l)).content),s.push(o)}else{if("cell"!=i&&"header_cell"!=i)return null;s.push(n||r?we(w(a).row,new ge.Slice(t,n,r)).content:t)}return function(e,t){const n=[];for(let e=0;e<t.length;e++){const r=t[e];for(let t=r.childCount-1;t>=0;t--){const{rowspan:o,colspan:i}=r.child(t).attrs;for(let t=e;t<e+o;t++)n[t]=(n[t]||0)+i}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let o=0;o<n.length;o++)if(o>=t.length&&t.push(ge.Fragment.empty),n[o]<r){const i=w(e).cell.createAndFill(),a=[];for(let e=n[o];e<r;e++)a.push(i);t[o]=t[o].append(ge.Fragment.from(a))}return{height:t.length,width:r,rows:t}}(a,s)}function we(e,t){const n=e.createAndFill();return new ye.Transform(n).replace(0,n.content.size,t).doc}function ke({width:e,height:t,rows:n},r,o){if(e!=r){const t=[],o=[];for(let e=0;e<n.length;e++){const i=n[e],a=[];for(let n=t[e]||0,o=0;n<r;o++){let s=i.child(o%i.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(_(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),a.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}o.push(ge.Fragment.from(a))}n=o,e=r}if(t!=o){const e=[];for(let r=0,i=0;r<o;r++,i++){const a=[],s=n[i%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>o&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,o-t.attrs.rowspan)},t.content)),a.push(t)}e.push(ge.Fragment.from(a))}n=e,t=o}return{width:e,height:t,rows:n}}function Se(e,t,n,r,o,i,a,s){if(0==a||a==t.height)return!1;let l=!1;for(let c=o;c<i;c++){const o=a*t.width+c,i=t.map[o];if(t.map[o-t.width]==i){l=!0;const o=n.nodeAt(i),{top:u,left:f}=t.findCell(i);e.setNodeMarkup(e.mapping.slice(s).map(i+r),null,{...o.attrs,rowspan:a-u}),e.insert(e.mapping.slice(s).map(t.positionAt(a,f,n)),o.type.createAndFill({...o.attrs,rowspan:u+o.attrs.rowspan-a})),c+=o.attrs.colspan-1}}return l}function xe(e,t,n,r,o,i,a,s){if(0==a||a==t.width)return!1;let l=!1;for(let c=o;c<i;c++){const o=c*t.width+a,i=t.map[o];if(t.map[o-1]==i){l=!0;const o=n.nodeAt(i),u=t.colCount(i),f=e.mapping.slice(s).map(i+r);e.setNodeMarkup(f,null,_(o.attrs,a-u,o.attrs.colspan-(a-u))),e.insert(f+o.nodeSize,o.type.createAndFill(_(o.attrs,0,a-u))),c+=o.attrs.rowspan-1}}return l}function Ce(e,t,n,r,o){let i=n?e.doc.nodeAt(n-1):e.doc;if(!i)throw new Error("No table found");let a=m.get(i);const{top:s,left:l}=r,c=l+o.width,u=s+o.height,f=e.tr;let d=0;function h(){if(i=n?f.doc.nodeAt(n-1):f.doc,!i)throw new Error("No table found");a=m.get(i),d=f.mapping.maps.length}(function(e,t,n,r,o,i,a){const s=w(e.doc.type.schema);let l,c;if(o>t.width)for(let i=0,u=0;i<t.height;i++){const f=n.child(i);u+=f.nodeSize;const d=[];let h;h=null==f.lastChild||f.lastChild.type==s.cell?l||(l=s.cell.createAndFill()):c||(c=s.header_cell.createAndFill());for(let e=t.width;e<o;e++)d.push(h);e.insert(e.mapping.slice(a).map(u-1+r),d)}if(i>t.height){const u=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,o);e++){const o=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==s.header_cell;u.push(o?c||(c=s.header_cell.createAndFill()):l||(l=s.cell.createAndFill()))}const f=s.row.create(null,ge.Fragment.from(u)),d=[];for(let e=t.height;e<i;e++)d.push(f);e.insert(e.mapping.slice(a).map(r+n.nodeSize-2),d)}return!(!l&&!c)})(f,a,i,n,c,u,d)&&h(),Se(f,a,i,n,l,c,s,d)&&h(),Se(f,a,i,n,l,c,u,d)&&h(),xe(f,a,i,n,s,u,l,d)&&h(),xe(f,a,i,n,s,u,c,d)&&h();for(let e=s;e<u;e++){const t=a.positionAt(e,l,i),r=a.positionAt(e,c,i);f.replace(f.mapping.slice(d).map(t+n),f.mapping.slice(d).map(r+n),new ge.Slice(o.rows[e-s],0,0))}h(),f.setSelection(new z(f.doc.resolve(n+a.positionAt(s,l,i)),f.doc.resolve(n+a.positionAt(u-1,c-1,i)))),t(f)}var Oe=(0,L.keydownHandler)({ArrowLeft:Te("horiz",-1),ArrowRight:Te("horiz",1),ArrowUp:Te("vert",-1),ArrowDown:Te("vert",1),"Shift-ArrowLeft":Ae("horiz",-1),"Shift-ArrowRight":Ae("horiz",1),"Shift-ArrowUp":Ae("vert",-1),"Shift-ArrowDown":Ae("vert",1),Backspace:ve,"Mod-Backspace":ve,Delete:ve,"Mod-Delete":ve});function Me(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Te(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;if(i instanceof z)return Me(n,r,K.Selection.near(i.$headCell,t));if("horiz"!=e&&!i.empty)return!1;const a=_e(o,e,t);if(null==a)return!1;if("horiz"==e)return Me(n,r,K.Selection.near(n.doc.resolve(i.head+t),t));{const o=n.doc.resolve(a),i=D(o,e,t);let s;return s=i?K.Selection.near(i,1):t<0?K.Selection.near(n.doc.resolve(o.before(-1)),-1):K.Selection.near(n.doc.resolve(o.after(-1)),1),Me(n,r,s)}}}function Ae(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let a;if(i instanceof z)a=i;else{const r=_e(o,e,t);if(null==r)return!1;a=new z(n.doc.resolve(r))}const s=D(a.$headCell,e,t);return!!s&&Me(n,r,new z(a.$anchorCell,s))}}function Ne(e,t){const n=S(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new z(n))),!0)}function Re(e,t,n){if(!x(e.state))return!1;let r=be(n);const o=e.state.selection;if(o instanceof z){r||(r={width:1,height:1,rows:[V.Fragment.from(we(w(e.state.schema).cell,n))]});const t=o.$anchorCell.node(-1),i=o.$anchorCell.start(-1),a=m.get(t).rectBetween(o.$anchorCell.pos-i,o.$headCell.pos-i);return r=ke(r,a.right-a.left,a.bottom-a.top),Ce(e.state,e.dispatch,i,a,r),!0}if(r){const t=C(e.state),n=t.start(-1);return Ce(e.state,e.dispatch,n,m.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function De(e,t){var n;if(t.ctrlKey||t.metaKey)return;const r=Ee(e,t.target);let o;if(t.shiftKey&&e.state.selection instanceof z)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&null!=(o=S(e.state.selection.$anchor))&&(null==(n=Pe(e,t))?void 0:n.pos)!=o.pos)i(o,t),t.preventDefault();else if(!r)return;function i(t,n){let r=Pe(e,n);const o=null==k.getState(e.state);if(!r||!A(t,r)){if(!o)return;r=t}const i=new z(t,r);if(o||!e.state.selection.eq(i)){const n=e.state.tr.setSelection(i);o&&n.setMeta(k,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener("mouseup",a),e.root.removeEventListener("dragstart",a),e.root.removeEventListener("mousemove",s),null!=k.getState(e.state)&&e.dispatch(e.state.tr.setMeta(k,-1))}function s(n){const o=n,s=k.getState(e.state);let l;if(null!=s)l=e.state.doc.resolve(s);else if(Ee(e,o.target)!=r&&(l=Pe(e,t),!l))return a();l&&i(l,o)}e.root.addEventListener("mouseup",a),e.root.addEventListener("dragstart",a),e.root.addEventListener("mousemove",s)}function _e(e,t,n){if(!(e.state.selection instanceof K.TextSelection))return null;const{$head:r}=e.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if("cell"==i.type.spec.tableRole||"header_cell"==i.type.spec.tableRole){const i=r.before(o),a="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(a)?i:null}}return null}function Ee(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function Pe(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});return n&&n?S(e.state.doc.resolve(n.pos)):null}var ze=n(2391),Ie=n(9222),je=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Fe(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,Fe(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function Fe(e,t,n,r,o,i){var a;let s=0,l=!0,c=t.firstChild;const u=e.firstChild;if(u){for(let e=0,n=0;e<u.childCount;e++){const{colspan:a,colwidth:f}=u.child(e).attrs;for(let e=0;e<a;e++,n++){const a=o==n?i:f&&f[e],u=a?a+"px":"";if(s+=a||r,a||(l=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{const e=document.createElement("col");e.style.width=u,t.appendChild(e)}}}for(;c;){const e=c.nextSibling;null==(a=c.parentNode)||a.removeChild(c),c=e}l?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}var Be=new ze.PluginKey("tableColumnResizing");function $e({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=je,lastColumnResizable:o=!0}={}){const i=new ze.Plugin({key:Be,state:{init(e,t){var o,a;const s=null==(a=null==(o=i.spec)?void 0:o.props)?void 0:a.nodeViews,l=w(t.schema).table.name;return r&&s&&(s[l]=(e,t)=>new r(e,n,t)),new Le(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{const t=Be.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r){const o=Be.getState(e.state);if(o&&!o.dragging){const i=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target);let a=-1;if(i){const{left:r,right:o}=i.getBoundingClientRect();t.clientX-r<=n?a=Ve(e,t,"left",n):o-t.clientX<=n&&(a=Ve(e,t,"right",n))}if(a!=o.activeHandle){if(!r&&-1!==a){const t=e.state.doc.resolve(a),n=t.node(-1),r=m.get(n),o=t.start(-1);if(r.colCount(t.pos-o)+t.nodeAfter.attrs.colspan-1==r.width-1)return}He(e,a)}}}(t,n,e,o)},mouseleave:e=>{!function(e){const t=Be.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&He(e,-1)}(e)},mousedown:(e,r)=>{!function(e,t,n,r){var o;const i=null!=(o=e.dom.ownerDocument.defaultView)?o:window,a=Be.getState(e.state);if(!a||-1==a.activeHandle||a.dragging)return!1;const s=e.state.doc.nodeAt(a.activeHandle),l=function(e,t,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=e.domAtPos(t);let a=i.node.childNodes[i.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(a-=r[e],s--);return a/s}(e,a.activeHandle,s.attrs);function c(t){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const r=Be.getState(e.state);(null==r?void 0:r.dragging)&&(function(e,t,n){const r=e.state.doc.resolve(t),o=r.node(-1),i=m.get(o),a=r.start(-1),s=i.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let e=0;e<i.height;e++){const t=e*i.width+s;if(e&&i.map[t]==i.map[t-i.width])continue;const r=i.map[t],u=o.nodeAt(r).attrs,f=1==u.colspan?0:s-i.colCount(r);if(u.colwidth&&u.colwidth[f]==n)continue;const d=u.colwidth?u.colwidth.slice():(c=u.colspan,Array(c).fill(0));d[f]=n,l.setNodeMarkup(a+r,null,{...u,colwidth:d})}var c;l.docChanged&&e.dispatch(l)}(e,r.activeHandle,Ke(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(Be,{setDragging:null})))}function u(t){if(!t.which)return c(t);const o=Be.getState(e.state);if(o&&o.dragging){const i=Ke(o.dragging,t,n);We(e,o.activeHandle,i,r)}}e.dispatch(e.state.tr.setMeta(Be,{setDragging:{startX:t.clientX,startWidth:l}})),We(e,a.activeHandle,l,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),t.preventDefault()}(e,r,t,n)}},decorations:e=>{const t=Be.getState(e);if(t&&t.activeHandle>-1)return function(e,t){var n;const r=[],o=e.doc.resolve(t),i=o.node(-1);if(!i)return Ie.DecorationSet.empty;const a=m.get(i),s=o.start(-1),l=a.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){const o=l+t*a.width;if(!(l!=a.width-1&&a.map[o]==a.map[o+1]||0!=t&&a.map[o]==a.map[o-a.width])){const t=a.map[o],l=s+t+i.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null==(n=Be.getState(e))?void 0:n.dragging)&&r.push(Ie.Decoration.node(s+t,s+t+i.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),r.push(Ie.Decoration.widget(l,c))}}return Ie.DecorationSet.create(e.doc,r)}(e,t.activeHandle)},nodeViews:{}}});return i}var Le=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){const n=this,r=t.getMeta(Be);if(r&&null!=r.setHandle)return new e(r.setHandle,!1);if(r&&void 0!==r.setDragging)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return M(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function Ve(e,t,n,r){const o="right"==n?-r:r,i=e.posAtCoords({left:t.clientX+o,top:t.clientY});if(!i)return-1;const{pos:a}=i,s=S(e.state.doc.resolve(a));if(!s)return-1;if("right"==n)return s.pos;const l=m.get(s.node(-1)),c=s.start(-1),u=l.map.indexOf(s.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function Ke(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function He(e,t){e.dispatch(e.state.tr.setMeta(Be,{setHandle:t}))}function We(e,t,n,r){const o=e.state.doc.resolve(t),i=o.node(-1),a=o.start(-1),s=m.get(i).colCount(o.pos-a)+o.nodeAfter.attrs.colspan-1;let l=e.domAtPos(o.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&Fe(i,l.firstChild,l,r,s,n)}function qe({allowTableNodeSelection:e=!1}={}){return new f.Plugin({key:k,state:{init:()=>null,apply(e,t){const n=e.getMeta(k);if(null!=n)return-1==n?null:n;if(null==t||!e.docChanged)return t;const{deleted:r,pos:o}=e.mapping.mapResult(t);return r?null:o}},props:{decorations:j,handleDOMEvents:{mousedown:De},createSelectionBetween:e=>null!=k.getState(e.state)?e.state.selection:null,handleTripleClick:Ne,handleKeyDown:Oe,handlePaste:Re},appendTransaction:(t,n,r)=>function(e,t,n){const r=(t||e).selection,o=(t||e).doc;let i,a;if(r instanceof h.NodeSelection&&(a=r.node.type.spec.tableRole)){if("cell"==a||"header_cell"==a)i=z.create(o,r.from);else if("row"==a){const e=o.resolve(r.from+1);i=z.rowSelection(e,e)}else if(!n){const e=m.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];i=z.create(o,t+1,n)}}else r instanceof h.TextSelection&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,o=e.depth;for(;o>=0&&!(e.after(o+1)<e.end(o));o--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(o).type.spec.tableRole)}(r)?i=h.TextSelection.create(o,r.from):r instanceof h.TextSelection&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){const r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){const n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(r)&&(i=h.TextSelection.create(o,r.$from.start(),r.$from.end()));return i&&(t||(t=e.tr)).setSelection(i),t}(r,$(r,n),e)})}},2843:(e,t,n)=>{function r(e){var t="function"==typeof Map?new Map:void 0;return r=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return o(e,arguments,c(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,e)},r(e)}function o(e,t,n){return o=l()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&a(o,n.prototype),o},o.apply(null,arguments)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}function s(e){var t=l();return function(){var n,r=c(e);if(t){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==u(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===u(o)?o:String(o)),r)}var o}function h(e,t,n){return t&&d(e.prototype,t),n&&d(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var p=n(9443),m=Math.pow(2,16);function v(e){return 65535&e}var g=function(){function e(t,n,r){f(this,e),this.pos=t,this.delInfo=n,this.recover=r}return h(e,[{key:"deleted",get:function(){return(8&this.delInfo)>0}},{key:"deletedBefore",get:function(){return(5&this.delInfo)>0}},{key:"deletedAfter",get:function(){return(6&this.delInfo)>0}},{key:"deletedAcross",get:function(){return(4&this.delInfo)>0}}]),e}(),y=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(f(this,e),this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}return h(e,[{key:"recover",value:function(e){var t=0,n=v(e);if(!this.inverted)for(var r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/m}(e)}},{key:"mapResult",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!1)}},{key:"map",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!0)}},{key:"_map",value:function(e,t,n){for(var r=0,o=this.inverted?2:1,i=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?r:0);if(s>e)break;var l=this.ranges[a+o],c=this.ranges[a+i],u=s+l;if(e<=u){var f=s+r+((l?e==s?-1:e==u?1:t:t)<0?0:c);if(n)return f;var d=e==s?2:e==u?1:4;return(t<0?e!=s:e!=u)&&(d|=8),new g(f,d,e==(t<0?s:u)?null:a/3+(e-s)*m)}r+=c-l}return n?e+r:new g(e+r,0,null)}},{key:"touches",value:function(e,t){for(var n=0,r=v(t),o=this.inverted?2:1,i=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?n:0);if(s>e)break;var l=this.ranges[a+o];if(e<=s+l&&a==3*r)return!0;n+=this.ranges[a+i]-l}return!1}},{key:"forEach",value:function(e){for(var t=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r<this.ranges.length;r+=3){var i=this.ranges[r],a=i-(this.inverted?o:0),s=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(a,a+l,s,s+c),o+=c-l}}},{key:"invert",value:function(){return new e(this.ranges,!this.inverted)}},{key:"toString",value:function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}}],[{key:"offset",value:function(t){return 0==t?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}}]),e}();y.empty=new y([]);var b=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length;f(this,e),this.maps=t,this.mirror=n,this.from=r,this.to=o}return h(e,[{key:"slice",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.maps.length;return new e(this.maps,this.mirror,t,n)}},{key:"copy",value:function(){return new e(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}},{key:"appendMap",value:function(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)}},{key:"appendMapping",value:function(e){for(var t=0,n=this.maps.length;t<e.maps.length;t++){var r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r:void 0)}}},{key:"getMirror",value:function(e){if(this.mirror)for(var t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}},{key:"setMirror",value:function(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}},{key:"appendMappingInverted",value:function(e){for(var t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){var r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}},{key:"invert",value:function(){var t=new e;return t.appendMappingInverted(this),t}},{key:"map",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this.mirror)return this._map(e,t,!0);for(var n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}},{key:"mapResult",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!1)}},{key:"_map",value:function(e,t,n){for(var r=0,o=this.from;o<this.to;o++){var i=this.maps[o].mapResult(e,t);if(null!=i.recover){var a=this.getMirror(o);if(null!=a&&a>o&&a<this.to){o=a,e=this.maps[a].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new g(e,r,null)}}]),e}(),w=Object.create(null),k=function(){function e(){f(this,e)}return h(e,[{key:"getMap",value:function(){return y.empty}},{key:"merge",value:function(e){return null}}],[{key:"fromJSON",value:function(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=w[t.stepType];if(!n)throw new RangeError("No step type ".concat(t.stepType," defined"));return n.fromJSON(e,t)}},{key:"jsonID",value:function(e,t){if(e in w)throw new RangeError("Duplicate use of step JSON ID "+e);return w[e]=t,t.prototype.jsonID=e,t}}]),e}(),S=function(){function e(t,n){f(this,e),this.doc=t,this.failed=n}return h(e,null,[{key:"ok",value:function(t){return new e(t,null)}},{key:"fail",value:function(t){return new e(null,t)}},{key:"fromReplace",value:function(t,n,r,o){try{return e.ok(t.replace(n,r,o))}catch(t){if(t instanceof p.ReplaceError)return e.fail(t.message);throw t}}}]),e}();function x(e,t,n){for(var r=[],o=0;o<e.childCount;o++){var i=e.child(o);i.content.size&&(i=i.copy(x(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return p.Fragment.fromArray(r)}var C=function(e){i(n,e);var t=s(n);function n(e,r,o){var i;return f(this,n),(i=t.call(this)).from=e,i.to=r,i.mark=o,i}return h(n,[{key:"apply",value:function(e){var t=this,n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new p.Slice(x(n.content,(function(e,n){return e.isAtom&&n.type.allowsMarkType(t.mark.type)?e.mark(t.mark.addToSet(e.marks)):e}),o),n.openStart,n.openEnd);return S.fromReplace(e,this.from,this.to,i)}},{key:"invert",value:function(){return new O(this.from,this.to,this.mark)}},{key:"map",value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}},{key:"merge",value:function(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}},{key:"toJSON",value:function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}}]),n}(k);k.jsonID("addMark",C);var O=function(e){i(n,e);var t=s(n);function n(e,r,o){var i;return f(this,n),(i=t.call(this)).from=e,i.to=r,i.mark=o,i}return h(n,[{key:"apply",value:function(e){var t=this,n=e.slice(this.from,this.to),r=new p.Slice(x(n.content,(function(e){return e.mark(t.mark.removeFromSet(e.marks))}),e),n.openStart,n.openEnd);return S.fromReplace(e,this.from,this.to,r)}},{key:"invert",value:function(){return new C(this.from,this.to,this.mark)}},{key:"map",value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}},{key:"merge",value:function(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}},{key:"toJSON",value:function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}}]),n}(k);k.jsonID("removeMark",O);var M=function(e){i(n,e);var t=s(n);function n(e,r){var o;return f(this,n),(o=t.call(this)).pos=e,o.mark=r,o}return h(n,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return S.fail("No node at mark step's position");var n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return S.fromReplace(e,this.pos,this.pos+1,new p.Slice(p.Fragment.from(n),0,t.isLeaf?0:1))}},{key:"invert",value:function(e){var t=e.nodeAt(this.pos);if(t){var r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(var o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new n(this.pos,t.marks[o]);return new n(this.pos,this.mark)}}return new T(this.pos,this.mark)}},{key:"map",value:function(e){var t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.mark)}},{key:"toJSON",value:function(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new n(t.pos,e.markFromJSON(t.mark))}}]),n}(k);k.jsonID("addNodeMark",M);var T=function(e){i(n,e);var t=s(n);function n(e,r){var o;return f(this,n),(o=t.call(this)).pos=e,o.mark=r,o}return h(n,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return S.fail("No node at mark step's position");var n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return S.fromReplace(e,this.pos,this.pos+1,new p.Slice(p.Fragment.from(n),0,t.isLeaf?0:1))}},{key:"invert",value:function(e){var t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new M(this.pos,this.mark):this}},{key:"map",value:function(e){var t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.mark)}},{key:"toJSON",value:function(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new n(t.pos,e.markFromJSON(t.mark))}}]),n}(k);k.jsonID("removeNodeMark",T);var A=function(e){i(n,e);var t=s(n);function n(e,r,o){var i,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return f(this,n),(i=t.call(this)).from=e,i.to=r,i.slice=o,i.structure=a,i}return h(n,[{key:"apply",value:function(e){return this.structure&&R(e,this.from,this.to)?S.fail("Structure replace would overwrite content"):S.fromReplace(e,this.from,this.to,this.slice)}},{key:"getMap",value:function(){return new y([this.from,this.to-this.from,this.slice.size])}},{key:"invert",value:function(e){return new n(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}},{key:"map",value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new n(t.pos,Math.max(t.pos,r.pos),this.slice)}},{key:"merge",value:function(e){if(!(e instanceof n)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;var t=this.slice.size+e.slice.size==0?p.Slice.empty:new p.Slice(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new n(e.from,this.to,t,this.structure)}var r=this.slice.size+e.slice.size==0?p.Slice.empty:new p.Slice(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new n(this.from,this.to+(e.to-e.from),r,this.structure)}},{key:"toJSON",value:function(){var e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new n(t.from,t.to,p.Slice.fromJSON(e,t.slice),!!t.structure)}}]),n}(k);k.jsonID("replace",A);var N=function(e){i(n,e);var t=s(n);function n(e,r,o,i,a,s){var l,c=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return f(this,n),(l=t.call(this)).from=e,l.to=r,l.gapFrom=o,l.gapTo=i,l.slice=a,l.insert=s,l.structure=c,l}return h(n,[{key:"apply",value:function(e){if(this.structure&&(R(e,this.from,this.gapFrom)||R(e,this.gapTo,this.to)))return S.fail("Structure gap-replace would overwrite content");var t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return S.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,t.content);return n?S.fromReplace(e,this.from,this.to,n):S.fail("Content does not fit in gap")}},{key:"getMap",value:function(){return new y([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}},{key:"invert",value:function(e){var t=this.gapTo-this.gapFrom;return new n(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}},{key:"map",value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||i>r.pos?null:new n(t.pos,r.pos,o,i,this.slice,this.insert,this.structure)}},{key:"toJSON",value:function(){var e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new n(t.from,t.to,t.gapFrom,t.gapTo,p.Slice.fromJSON(e,t.slice),t.insert,!!t.structure)}}]),n}(k);function R(e,t,n){for(var r=e.resolve(t),o=n-t,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var a=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,o--}return!1}function D(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.contentMatch,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=e.doc.nodeAt(t),a=[],s=t+1,l=0;l<i.childCount;l++){var c=i.child(l),u=s+c.nodeSize,f=r.matchType(c.type);if(f){r=f;for(var d=0;d<c.marks.length;d++)n.allowsMarkType(c.marks[d].type)||e.step(new O(s,u,c.marks[d]));if(o&&c.isText&&"pre"!=n.whitespace)for(var h=void 0,m=/\r?\n|\r/g,v=void 0;h=m.exec(c.text);)v||(v=new p.Slice(p.Fragment.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),a.push(new A(s+h.index,s+h.index+h[0].length,v))}else a.push(new A(s,u,p.Slice.empty));s=u}if(!r.validEnd){var g=r.fillBefore(p.Fragment.empty,!0);e.replace(s,s,new p.Slice(g,0,0))}for(var y=a.length-1;y>=0;y--)e.step(a[y])}function _(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function E(e){return{type:e,attrs:null}}function P(e,t,n,r){t.forEach((function(o,i){if(o.isText)for(var a,s=/\r?\n|\r/g;a=s.exec(o.text);){var l=e.mapping.slice(r).map(n+1+i+a.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}))}function z(e,t,n,r){t.forEach((function(o,i){if(o.type==o.type.schema.linebreakReplacement){var a=e.mapping.slice(r).map(n+1+i);e.replaceWith(a,a+1,t.type.schema.text("\n"))}}))}function I(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);for(var n=e.contentMatchAt(e.childCount),r=e.type.schema.linebreakReplacement,o=0;o<t.childCount;o++){var i=t.child(o),a=i.type==r?e.type.schema.nodes.text:i.type;if(!(n=n.matchType(a)))return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}(e,t))}function j(e,t,n){var r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var a=r.depth-1;a>=0;a--){var s=r.indexAfter(a);if(r.node(a).canReplaceWith(s,s,n))return r.after(a+1);if(s<r.node(a).childCount)return null}return null}function F(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:p.Slice.empty;if(t==n&&!r.size)return null;var o=e.resolve(t),i=e.resolve(n);return B(o,i,r)?new A(t,n,r):new $(o,i,r).fit()}function B(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}k.jsonID("replaceAround",N);var $=function(){function e(t,n,r){f(this,e),this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=p.Fragment.empty;for(var o=0;o<=t.depth;o++){var i=t.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(t.indexAfter(o))})}for(var a=t.depth;a>0;a--)this.placed=p.Fragment.from(t.node(a).copy(this.placed))}return h(e,[{key:"depth",get:function(){return this.frontier.length-1}},{key:"fit",value:function(){for(;this.unplaced.size;){var e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}var t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(t<0?this.$to:r.doc.resolve(t));if(!o)return null;for(var i=this.placed,a=r.depth,s=o.depth;a&&s&&1==i.childCount;)i=i.firstChild.content,a--,s--;var l=new p.Slice(i,a,s);return t>-1?new N(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new A(r.pos,o.pos,l):null}},{key:"findFittable",value:function(){for(var e=this.unplaced.openStart,t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){var o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(var i=1;i<=2;i++)for(var a=1==i?e:this.unplaced.openStart;a>=0;a--)for(var s=null,l=(a?(s=K(this.unplaced.content,a-1).firstChild).content:this.unplaced.content).firstChild,c=this.depth;c>=0;c--){var u=this.frontier[c],f=u.type,d=u.match,h=void 0,m=null;if(1==i&&(l?d.matchType(l.type)||(m=d.fillBefore(p.Fragment.from(l),!1)):s&&f.compatibleContent(s.type)))return{sliceDepth:a,frontierDepth:c,parent:s,inject:m};if(2==i&&l&&(h=d.findWrapping(l.type)))return{sliceDepth:a,frontierDepth:c,parent:s,wrap:h};if(s&&d.matchType(s.type))break}}},{key:"openMore",value:function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,o=K(t,n);return!(!o.childCount||o.firstChild.isLeaf||(this.unplaced=new p.Slice(t,n+1,Math.max(r,o.size+n>=t.size-r?n+1:0)),0))}},{key:"dropNode",value:function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,o=K(t,n);if(o.childCount<=1&&n>0){var i=t.size-n<=n+o.size;this.unplaced=new p.Slice(L(t,n-1,1),n-1,i?n-1:r)}else this.unplaced=new p.Slice(L(t,n,1),n,r)}},{key:"placeNodes",value:function(e){for(var t=e.sliceDepth,n=e.frontierDepth,r=e.parent,o=e.inject,i=e.wrap;this.depth>n;)this.closeFrontierNode();if(i)for(var a=0;a<i.length;a++)this.openFrontierNode(i[a]);var s=this.unplaced,l=r?r.content:s.content,c=s.openStart-t,u=0,f=[],d=this.frontier[n],h=d.match,m=d.type;if(o){for(var v=0;v<o.childCount;v++)f.push(o.child(v));h=h.matchFragment(o)}for(var g=l.size+t-(s.content.size-s.openEnd);u<l.childCount;){var y=l.child(u),b=h.matchType(y.type);if(!b)break;(++u>1||0==c||y.content.size)&&(h=b,f.push(H(y.mark(m.allowedMarks(y.marks)),1==u?c:0,u==l.childCount?g:-1)))}var w=u==l.childCount;w||(g=-1),this.placed=V(this.placed,n,p.Fragment.from(f)),this.frontier[n].match=h,w&&g<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var k=0,S=l;k<g;k++){var x=S.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),S=x.content}this.unplaced=w?0==t?p.Slice.empty:new p.Slice(L(s.content,t-1,1),t-1,g<0?s.openEnd:t-1):new p.Slice(L(s.content,t,u),s.openStart,s.openEnd)}},{key:"mustMoveInline",value:function(){if(!this.$to.parent.isTextblock)return-1;var e,t=this.frontier[this.depth];if(!t.type.isTextblock||!W(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r}},{key:"findCloseLevel",value:function(e){e:for(var t=Math.min(this.depth,e.depth);t>=0;t--){var n=this.frontier[t],r=n.match,o=n.type,i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=W(e,t,o,r,i);if(a){for(var s=t-1;s>=0;s--){var l=this.frontier[s],c=l.match,u=W(e,s,l.type,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}},{key:"close",value:function(e){var t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=V(this.placed,t.depth,t.fit)),e=t.move;for(var n=t.depth+1;n<=e.depth;n++){var r=e.node(n),o=r.type.contentMatch.fillBefore(r.content,!0,e.index(n));this.openFrontierNode(r.type,r.attrs,o)}return e}},{key:"openFrontierNode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=V(this.placed,this.depth,p.Fragment.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}},{key:"closeFrontierNode",value:function(){var e=this.frontier.pop().match.fillBefore(p.Fragment.empty,!0);e.childCount&&(this.placed=V(this.placed,this.frontier.length,e))}}]),e}();function L(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(L(e.firstChild.content,t-1,n)))}function V(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(V(e.lastChild.content,t-1,n)))}function K(e,t){for(var n=0;n<t;n++)e=e.firstChild.content;return e}function H(e,t,n){if(t<=0)return e;var r=e.content;return t>1&&(r=r.replaceChild(0,H(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(p.Fragment.empty,!0)))),e.copy(r)}function W(e,t,n,r,o){var i=e.node(t),a=o?e.indexAfter(t):e.index(t);if(a==i.childCount&&!n.compatibleContent(i.type))return null;var s=r.fillBefore(i.content,!0,a);return s&&!function(e,t,n){for(var r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,a)?s:null}function q(e,t,n,r,o){if(t<n){var i=e.firstChild;e=e.replaceChild(0,i.copy(q(i.content,t+1,n,r,i)))}if(t>r){var a=o.contentMatchAt(0),s=a.fillBefore(e).append(e);e=s.append(a.matchFragment(s).fillBefore(p.Fragment.empty,!0))}return e}function J(e,t){for(var n=[],r=Math.min(e.depth,t.depth);r>=0;r--){var o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}var U=function(e){i(n,e);var t=s(n);function n(e,r,o){var i;return f(this,n),(i=t.call(this)).pos=e,i.attr=r,i.value=o,i}return h(n,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return S.fail("No node at attribute step's position");var n=Object.create(null);for(var r in t.attrs)n[r]=t.attrs[r];n[this.attr]=this.value;var o=t.type.create(n,null,t.marks);return S.fromReplace(e,this.pos,this.pos+1,new p.Slice(p.Fragment.from(o),0,t.isLeaf?0:1))}},{key:"getMap",value:function(){return y.empty}},{key:"invert",value:function(e){return new n(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}},{key:"map",value:function(e){var t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.attr,this.value)}},{key:"toJSON",value:function(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new n(t.pos,t.attr,t.value)}}]),n}(k);k.jsonID("attr",U);var G=function(e){i(n,e);var t=s(n);function n(e,r){var o;return f(this,n),(o=t.call(this)).attr=e,o.value=r,o}return h(n,[{key:"apply",value:function(e){var t=Object.create(null);for(var n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;var r=e.type.create(t,e.content,e.marks);return S.ok(r)}},{key:"getMap",value:function(){return y.empty}},{key:"invert",value:function(e){return new n(this.attr,e.attrs[this.attr])}},{key:"map",value:function(e){return this}},{key:"toJSON",value:function(){return{stepType:"docAttr",attr:this.attr,value:this.value}}}],[{key:"fromJSON",value:function(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new n(t.attr,t.value)}}]),n}(k);k.jsonID("docAttr",G),t.TransformError=function(e){i(n,e);var t=s(n);function n(){return f(this,n),t.apply(this,arguments)}return h(n)}(r(Error)),t.TransformError=function e(t){var n=Error.call(this,t);return n.__proto__=e.prototype,n},t.TransformError.prototype=Object.create(Error.prototype),t.TransformError.prototype.constructor=t.TransformError,t.TransformError.prototype.name="TransformError";var X=function(){function e(t){f(this,e),this.doc=t,this.steps=[],this.docs=[],this.mapping=new b}return h(e,[{key:"before",get:function(){return this.docs.length?this.docs[0]:this.doc}},{key:"step",value:function(e){var n=this.maybeStep(e);if(n.failed)throw new t.TransformError(n.failed);return this}},{key:"maybeStep",value:function(e){var t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}},{key:"docChanged",get:function(){return this.steps.length>0}},{key:"addStep",value:function(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}},{key:"replace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:p.Slice.empty,r=F(this.doc,e,t,n);return r&&this.step(r),this}},{key:"replaceWith",value:function(e,t,n){return this.replace(e,t,new p.Slice(p.Fragment.from(n),0,0))}},{key:"delete",value:function(e,t){return this.replace(e,t,p.Slice.empty)}},{key:"insert",value:function(e,t){return this.replaceWith(e,e,t)}},{key:"replaceRange",value:function(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);var o=e.doc.resolve(t),i=e.doc.resolve(n);if(B(o,i,r))return e.step(new A(t,n,r));var a=J(o,e.doc.resolve(n));0==a[a.length-1]&&a.pop();var s=-(o.depth+1);a.unshift(s);for(var l=o.depth,c=o.pos-1;l>0;l--,c--){var u=o.node(l).type.spec;if(u.defining||u.definingAsContext||u.isolating)break;a.indexOf(l)>-1?s=l:o.before(l)==c&&a.splice(1,0,-l)}for(var f,d=a.indexOf(s),h=[],m=r.openStart,v=r.content,g=0;;g++){var y=v.firstChild;if(h.push(y),g==r.openStart)break;v=y.content}for(var b=m-1;b>=0;b--){var w=h[b],k=(f=w.type).spec.defining||f.spec.definingForContent;if(k&&!w.sameMarkup(o.node(Math.abs(s)-1)))m=b;else if(k||!w.type.isTextblock)break}for(var S=r.openStart;S>=0;S--){var x=(S+m+1)%(r.openStart+1),C=h[x];if(C)for(var O=0;O<a.length;O++){var M=a[(O+d)%a.length],T=!0;M<0&&(T=!1,M=-M);var N=o.node(M-1),R=o.index(M-1);if(N.canReplaceWith(R,R,C.type,C.marks))return e.replace(o.before(M),T?i.after(M):n,new p.Slice(q(r.content,0,r.openStart,x),x,r.openEnd))}}for(var D=e.steps.length,_=a.length-1;_>=0&&(e.replace(t,n,r),!(e.steps.length>D));_--){var E=a[_];E<0||(t=o.before(E),n=i.after(E))}}(this,e,t,n),this}},{key:"replaceRangeWith",value:function(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){var o=j(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new p.Slice(p.Fragment.from(r),0,0))}(this,e,t,n),this}},{key:"deleteRange",value:function(e,t){return function(e,t,n){for(var r=e.doc.resolve(t),o=e.doc.resolve(n),i=J(r,o),a=0;a<i.length;a++){var s=i[a],l=a==i.length-1;if(l&&0==s||r.node(s).type.contentMatch.validEnd)return e.delete(r.start(s),o.end(s));if(s>0&&(l||r.node(s-1).canReplace(r.index(s-1),o.indexAfter(s-1))))return e.delete(r.before(s),o.after(s))}for(var c=1;c<=r.depth&&c<=o.depth;c++)if(t-r.start(c)==r.depth-c&&n>r.end(c)&&o.end(c)-n!=o.depth-c&&r.start(c-1)==o.start(c-1)&&r.node(c-1).canReplace(r.index(c-1),o.index(c-1)))return e.delete(r.before(c),n);e.delete(t,n)}(this,e,t),this}},{key:"lift",value:function(e,t){return function(e,t,n){for(var r=t.$from,o=t.$to,i=t.depth,a=r.before(i+1),s=o.after(i+1),l=a,c=s,u=p.Fragment.empty,f=0,d=i,h=!1;d>n;d--)h||r.index(d)>0?(h=!0,u=p.Fragment.from(r.node(d).copy(u)),f++):l--;for(var m=p.Fragment.empty,v=0,g=i,y=!1;g>n;g--)y||o.after(g+1)<o.end(g)?(y=!0,m=p.Fragment.from(o.node(g).copy(m)),v++):c++;e.step(new N(l,c,a,s,new p.Slice(u.append(m),f,v),u.size-f,!0))}(this,e,t),this}},{key:"join",value:function(e){return function(e,t,n){var r=null,o=e.doc.type.schema.linebreakReplacement,i=e.doc.resolve(t-n),a=i.node().type;if(o&&a.inlineContent){var s="pre"==a.whitespace,l=!!a.contentMatch.matchType(o);s&&!l?r=!1:!s&&l&&(r=!0)}var c=e.steps.length;if(!1===r){var u=e.doc.resolve(t+n);z(e,u.node(),u.before(),c)}a.inlineContent&&D(e,t+n-1,a,i.node().contentMatchAt(i.index()),null==r);var f=e.mapping.slice(c),d=f.map(t-n);if(e.step(new A(d,f.map(t+n,-1),p.Slice.empty,!0)),!0===r){var h=e.doc.resolve(d);P(e,h.node(),h.before(),e.steps.length)}}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),this}},{key:"wrap",value:function(e,t){return function(e,t,n){for(var r=p.Fragment.empty,o=n.length-1;o>=0;o--){if(r.size){var i=n[o].type.contentMatch.matchFragment(r);if(!i||!i.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=p.Fragment.from(n[o].type.create(n[o].attrs,r))}var a=t.start,s=t.end;e.step(new N(a,s,a,s,new p.Slice(r,0,0),n.length,!0))}(this,e,t),this}},{key:"setBlockType",value:function(e){return function(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=e.steps.length;e.doc.nodesBetween(t,n,(function(t,n){var a="function"==typeof o?o(t):o;if(t.isTextblock&&!t.hasMarkup(r,a)&&function(e,t,n){var r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(i).map(n),r)){var s=null;if(r.schema.linebreakReplacement){var l="pre"==r.whitespace,c=!!r.contentMatch.matchType(r.schema.linebreakReplacement);l&&!c?s=!1:!l&&c&&(s=!0)}!1===s&&z(e,t,n,i),D(e,e.mapping.slice(i).map(n,1),r,void 0,null===s);var u=e.mapping.slice(i),f=u.map(n,1),d=u.map(n+t.nodeSize,1);return e.step(new N(f,d,f+1,d-1,new p.Slice(p.Fragment.from(r.create(a,null,t.marks)),0,0),1,!0)),!0===s&&P(e,t,n,i),!1}}))}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,arguments.length>2?arguments[2]:void 0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:null),this}},{key:"setNodeMarkup",value:function(e,t){return function(e,t,n,r,o){var i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);var a=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,a);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new N(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new p.Slice(p.Fragment.from(a),0,0),1,!0))}(this,e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,arguments.length>3?arguments[3]:void 0),this}},{key:"setNodeAttribute",value:function(e,t,n){return this.step(new U(e,t,n)),this}},{key:"setDocAttribute",value:function(e,t){return this.step(new G(e,t)),this}},{key:"addNodeMark",value:function(e,t){return this.step(new M(e,t)),this}},{key:"removeNodeMark",value:function(e,t){if(!(t instanceof p.Mark)){var n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(!(t=t.isInSet(n.marks)))return this}return this.step(new T(e,t)),this}},{key:"split",value:function(e){return function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,o=e.doc.resolve(t),i=p.Fragment.empty,a=p.Fragment.empty,s=o.depth,l=o.depth-n,c=n-1;s>l;s--,c--){i=p.Fragment.from(o.node(s).copy(i));var u=r&&r[c];a=p.Fragment.from(u?u.type.create(u.attrs,a):o.node(s).copy(a))}e.step(new A(t,t,new p.Slice(i.append(a),n,n),!0))}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,arguments.length>2?arguments[2]:void 0),this}},{key:"addMark",value:function(e,t,n){return function(e,t,n,r){var o,i,a=[],s=[];e.doc.nodesBetween(t,n,(function(e,l,c){if(e.isInline){var u=e.marks;if(!r.isInSet(u)&&c.type.allowsMarkType(r.type)){for(var f=Math.max(l,t),d=Math.min(l+e.nodeSize,n),h=r.addToSet(u),p=0;p<u.length;p++)u[p].isInSet(h)||(o&&o.to==f&&o.mark.eq(u[p])?o.to=d:a.push(o=new O(f,d,u[p])));i&&i.to==f?i.to=d:s.push(i=new C(f,d,r))}}})),a.forEach((function(t){return e.step(t)})),s.forEach((function(t){return e.step(t)}))}(this,e,t,n),this}},{key:"removeMark",value:function(e,t,n){return function(e,t,n,r){var o=[],i=0;e.doc.nodesBetween(t,n,(function(e,a){if(e.isInline){i++;var s=null;if(r instanceof p.MarkType)for(var l,c=e.marks;l=r.isInSet(c);)(s||(s=[])).push(l),c=l.removeFromSet(c);else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length)for(var u=Math.min(a+e.nodeSize,n),f=0;f<s.length;f++){for(var d=s[f],h=void 0,m=0;m<o.length;m++){var v=o[m];v.step==i-1&&d.eq(o[m].style)&&(h=v)}h?(h.to=u,h.step=i):o.push({style:d,from:Math.max(a,t),to:u,step:i})}}})),o.forEach((function(t){return e.step(new O(t.from,t.to,t.style))}))}(this,e,t,n),this}},{key:"clearIncompatible",value:function(e,t,n){return D(this,e,t,n),this}}]),e}();t.AddMarkStep=C,t.AddNodeMarkStep=M,t.AttrStep=U,t.DocAttrStep=G,t.MapResult=g,t.Mapping=b,t.RemoveMarkStep=O,t.RemoveNodeMarkStep=T,t.ReplaceAroundStep=N,t.ReplaceStep=A,t.Step=k,t.StepMap=y,t.StepResult=S,t.Transform=X,t.canJoin=function(e,t){var n=e.resolve(t),r=n.index();return I(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)},t.canSplit=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,o=e.resolve(t),i=o.depth-n,a=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!a.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var s=o.depth-1,l=n-2;s>i;s--,l--){var c=o.node(s),u=o.index(s);if(c.type.spec.isolating)return!1;var f=c.content.cutByIndex(u,c.childCount),d=r&&r[l+1];d&&(f=f.replaceChild(0,d.type.create(d.attrs)));var h=r&&r[l]||c;if(!c.canReplace(u+1,c.childCount)||!h.type.validContent(f))return!1}var p=o.indexAfter(i),m=r&&r[0];return o.node(i).canReplaceWith(p,p,m?m.type:o.node(i+1).type)},t.dropPoint=function(e,t,n){var r=e.resolve(t);if(!n.content.size)return t;for(var o=n.content,i=0;i<n.openStart;i++)o=o.firstChild.content;for(var a=1;a<=(0==n.openStart&&n.size?2:1);a++)for(var s=r.depth;s>=0;s--){var l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,c=r.index(s)+(l>0?1:0),u=r.node(s),f=!1;if(1==a)f=u.canReplace(c,c,o);else{var d=u.contentMatchAt(c).findWrapping(o.firstChild.type);f=d&&u.canReplaceWith(c,c,d[0])}if(f)return 0==l?r.pos:l<0?r.before(s+1):r.after(s+1)}return null},t.findWrapping=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,o=function(e,t){var n=e.parent,r=e.startIndex,o=e.endIndex,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;var a=i.length?i[0]:t;return n.canReplaceWith(r,o,a)?i:null}(e,t),i=o&&function(e,t){var n=e.parent,r=e.startIndex,o=e.endIndex,i=n.child(r),a=t.contentMatch.findWrapping(i.type);if(!a)return null;for(var s=(a.length?a[a.length-1]:t).contentMatch,l=r;s&&l<o;l++)s=s.matchType(n.child(l).type);return s&&s.validEnd?a:null}(r,t);return i?o.map(E).concat({type:t,attrs:n}).concat(i.map(E)):null},t.insertPoint=j,t.joinPoint=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=e.resolve(t),o=r.depth;;o--){var i=void 0,a=void 0,s=r.index(o);if(o==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(o+1),s++,a=r.node(o).maybeChild(s)):(i=r.node(o).maybeChild(s-1),a=r.node(o+1)),i&&!i.isTextblock&&I(i,a)&&r.node(o).canReplace(s,s+1))return t;if(0==o)break;t=n<0?r.before(o):r.after(o)}},t.liftTarget=function(e){for(var t=e.parent.content.cutByIndex(e.startIndex,e.endIndex),n=e.depth;;--n){var r=e.$from.node(n),o=e.$from.index(n),i=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(o,i,t))return n;if(0==n||r.type.spec.isolating||!_(r,o,i))break}return null},t.replaceStep=F},9222:(e,t,n)=>{function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=i(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw a}}}}function i(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(){return s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},s.apply(this,arguments)}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function u(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=d(e);if(t){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===h(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}(this,n)}}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==h(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===h(o)?o:String(o)),r)}var o}function v(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var g=n(2391),y=n(9443),b=n(2843),w=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},k=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},S=null,x=function(e,t,n){var r=S||(S=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},C=function(e,t,n,r){return n&&(M(e,t,n,r,-1)||M(e,t,n,r,1))},O=/^(img|br|input|textarea|hr)$/i;function M(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:T(e))){var i=e.parentNode;if(!i||1!=i.nodeType||A(e)||O.test(e.nodeName)||"false"==e.contentEditable)return!1;t=w(e)+(o<0?0:1),e=i}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(o<0?-1:0)]).contentEditable)return!1;t=o<0?T(e):0}}}function T(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function A(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var N=function(e){return e.focusNode&&C(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function R(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}var D="undefined"!=typeof navigator?navigator:null,_="undefined"!=typeof document?document:null,E=D&&D.userAgent||"",P=/Edge\/(\d+)/.exec(E),z=/MSIE \d/.exec(E),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(E),j=!!(z||I||P),F=z?document.documentMode:I?+I[1]:P?+P[1]:0,B=!j&&/gecko\/(\d+)/i.test(E);B&&(/Firefox\/(\d+)/.exec(E)||[0,0])[1];var $=!j&&/Chrome\/(\d+)/.exec(E),L=!!$,V=$?+$[1]:0,K=!j&&!!D&&/Apple Computer/.test(D.vendor),H=K&&(/Mobile\/\w+/.test(E)||!!D&&D.maxTouchPoints>2),W=H||!!D&&/Mac/.test(D.platform),q=!!D&&/Win/.test(D.platform),J=/Android \d/.test(E),U=!!_&&"webkitFontSmoothing"in _.documentElement.style,G=U?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function X(e){var t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Y(e,t){return"number"==typeof e?e:e[t]}function Q(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Z(e,t,n){for(var r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument,a=n||e.dom;a;a=k(a))if(1==a.nodeType){var s=a,l=s==i.body,c=l?X(i):Q(s),u=0,f=0;if(t.top<c.top+Y(r,"top")?f=-(c.top-t.top+Y(o,"top")):t.bottom>c.bottom-Y(r,"bottom")&&(f=t.bottom-t.top>c.bottom-c.top?t.top+Y(o,"top")-c.top:t.bottom-c.bottom+Y(o,"bottom")),t.left<c.left+Y(r,"left")?u=-(c.left-t.left+Y(o,"left")):t.right>c.right-Y(r,"right")&&(u=t.right-c.right+Y(o,"right")),u||f)if(l)i.defaultView.scrollBy(u,f);else{var d=s.scrollLeft,h=s.scrollTop;f&&(s.scrollTop+=f),u&&(s.scrollLeft+=u);var p=s.scrollLeft-d,m=s.scrollTop-h;t={left:t.left-p,top:t.top-m,right:t.right-p,bottom:t.bottom-m}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(a).position))break}}function ee(e){for(var t=[],n=e.ownerDocument,r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=k(r));return t}function te(e,t){for(var n=0;n<e.length;n++){var r=e[n],o=r.dom,i=r.top,a=r.left;o.scrollTop!=i+t&&(o.scrollTop=i+t),o.scrollLeft!=a&&(o.scrollLeft=a)}}var ne=null;function re(e,t){for(var n,r,o,i,a=2e8,s=0,l=t.top,c=t.top,u=e.firstChild,f=0;u;u=u.nextSibling,f++){var d=void 0;if(1==u.nodeType)d=u.getClientRects();else{if(3!=u.nodeType)continue;d=x(u).getClientRects()}for(var h=0;h<d.length;h++){var p=d[h];if(p.top<=l&&p.bottom>=c){l=Math.max(p.bottom,l),c=Math.min(p.top,c);var m=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(m<a){n=u,a=m,r=m&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==u.nodeType&&m&&(s=f+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!o&&p.left<=t.left&&p.right>=t.left&&(o=u,i={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(s=f+1)}}return!n&&o&&(n=o,r=i,a=0),n&&3==n.nodeType?function(e,t){for(var n=e.nodeValue.length,r=document.createRange(),o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);var i=le(r,1);if(i.top!=i.bottom&&oe(t,i))return{node:e,offset:o+(t.left>=(i.left+i.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||a&&1==n.nodeType?{node:e,offset:s}:re(n,r)}function oe(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function ie(e,t,n){var r=e.childNodes.length;if(r&&n.top<n.bottom)for(var o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){var a=e.childNodes[i];if(1==a.nodeType)for(var s=a.getClientRects(),l=0;l<s.length;l++){var c=s[l];if(oe(t,c))return ie(a,t,c)}if((i=(i+1)%r)==o)break}return e}function ae(e,t){var n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{var r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(T(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){var o=e.caretRangeFromPoint(t,n);if(o)return{node:o.startContainer,offset:Math.min(T(o.startContainer),o.startOffset)}}}(r,t.left,t.top);i&&(n=i.node,o=i.offset);var a,s=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!s||!e.dom.contains(1!=s.nodeType?s.parentNode:s)){var l=e.dom.getBoundingClientRect();if(!oe(t,l))return null;if(!(s=ie(e.dom,t,l)))return null}if(K)for(var c=s;n&&c;c=k(c))c.draggable&&(n=void 0);if(s=function(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(s,t),n){if(B&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length))<n.childNodes.length){var u,f=n.childNodes[o];"IMG"==f.nodeName&&(u=f.getBoundingClientRect()).right<=t.left&&u.bottom>t.top&&o++}var d;U&&o&&1==n.nodeType&&1==(d=n.childNodes[o-1]).nodeType&&"false"==d.contentEditable&&d.getBoundingClientRect().top>=t.top&&o--,n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?a=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(a=function(e,t,n,r){for(var o=-1,i=t,a=!1;i!=e.dom;){var s=e.docView.nearestDesc(i,!0);if(!s)return null;if(1==s.dom.nodeType&&(s.node.isBlock&&s.parent||!s.contentDOM)){var l=s.dom.getBoundingClientRect();if(s.node.isBlock&&s.parent&&(!a&&l.left>r.left||l.top>r.top?o=s.posBefore:(!a&&l.right<r.left||l.bottom<r.top)&&(o=s.posAfter),a=!0),!s.contentDOM&&o<0&&!s.node.isText)return(s.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?s.posBefore:s.posAfter}i=s.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==a&&(a=function(e,t,n){var r=re(t,n),o=r.node,i=r.offset,a=-1;if(1==o.nodeType&&!o.firstChild){var s=o.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(o,i,a)}(e,s,t));var h=e.docView.nearestDesc(s,!0);return{pos:a,inside:h?h.posAtStart-h.border:-1}}function se(e){return e.top<e.bottom||e.left<e.right}function le(e,t){var n=e.getClientRects();if(n.length){var r=n[t<0?0:n.length-1];if(se(r))return r}return Array.prototype.find.call(n,se)||e.getBoundingClientRect()}var ce=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ue(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),o=r.node,i=r.offset,a=r.atom,s=U||B;if(3==o.nodeType){if(!s||!ce.test(o.nodeValue)&&(n<0?i:i!=o.nodeValue.length)){var l=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==o.nodeValue.length?(l--,u=1):n<0?l--:c++,fe(le(x(o,l,c),u),u<0)}var f=le(x(o,i,i),n);if(B&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){var d=le(x(o,i-1,i-1),-1);if(d.top==f.top){var h=le(x(o,i,i+1),-1);if(h.top!=f.top)return fe(h,h.left<d.left)}}return f}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(null==a&&i&&(n<0||i==T(o))){var p=o.childNodes[i-1];if(1==p.nodeType)return de(p.getBoundingClientRect(),!1)}if(null==a&&i<T(o)){var m=o.childNodes[i];if(1==m.nodeType)return de(m.getBoundingClientRect(),!0)}return de(o.getBoundingClientRect(),n>=0)}if(null==a&&i&&(n<0||i==T(o))){var v=o.childNodes[i-1],g=3==v.nodeType?x(v,T(v)-(s?0:1)):1!=v.nodeType||"BR"==v.nodeName&&v.nextSibling?null:v;if(g)return fe(le(g,1),!1)}if(null==a&&i<T(o)){for(var y=o.childNodes[i];y.pmViewDesc&&y.pmViewDesc.ignoreForCoords;)y=y.nextSibling;var b=y?3==y.nodeType?x(y,0,s?0:1):1==y.nodeType?y:null:null;if(b)return fe(le(b,-1),!0)}return fe(le(3==o.nodeType?x(o):o,-n),n>=0)}function fe(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function de(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function he(e,t,n){var r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}var pe=/[\u0590-\u08ac]/,me=null,ve=null,ge=!1;var ye=function(){function e(t,n,r,o){p(this,e),this.parent=t,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=0,r.pmViewDesc=this}return v(e,[{key:"matchesWidget",value:function(e){return!1}},{key:"matchesMark",value:function(e){return!1}},{key:"matchesNode",value:function(e,t,n){return!1}},{key:"matchesHack",value:function(e){return!1}},{key:"parseRule",value:function(){return null}},{key:"stopEvent",value:function(e){return!1}},{key:"size",get:function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e}},{key:"border",get:function(){return 0}},{key:"destroy",value:function(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(var e=0;e<this.children.length;e++)this.children[e].destroy()}},{key:"posBeforeChild",value:function(e){for(var t=0,n=this.posAtStart;;t++){var r=this.children[t];if(r==e)return n;n+=r.size}}},{key:"posBefore",get:function(){return this.parent.posBeforeChild(this)}},{key:"posAtStart",get:function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}},{key:"posAfter",get:function(){return this.posBefore+this.size}},{key:"posAtEnd",get:function(){return this.posAtStart+this.size-2*this.border}},{key:"localPosFromDOM",value:function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var r,o;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(o=r.pmViewDesc)||o.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(o)+o.size:this.posAtStart}var i,a;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&(!(a=i.pmViewDesc)||a.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(a):this.posAtEnd}var s;if(e==this.dom&&this.contentDOM)s=t>w(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var l=e;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.previousSibling)break}if(null==s&&t==e.childNodes.length)for(var c=e;;c=c.parentNode){if(c==this.dom){s=!0;break}if(c.nextSibling)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart}},{key:"nearestDesc",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!0,r=e;r;r=r.parentNode){var o=this.getDesc(r),i=void 0;if(o&&(!t||o.node)){if(!n||!(i=o.nodeDOM)||(1==i.nodeType?i.contains(1==e.nodeType?e:e.parentNode):i==e))return o;n=!1}}}},{key:"getDesc",value:function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t}},{key:"posFromDOM",value:function(e,t,n){for(var r=e;r;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}},{key:"descAt",value:function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<o)return r.descAt(e-n-r.border);n=o}}},{key:"domFromPos",value:function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};for(var n,r=0,o=0,i=0;r<this.children.length;r++){var a=this.children[r],s=i+a.size;if(s>e||a instanceof Oe){o=e-i;break}i=s}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(;r&&!(n=this.children[r-1]).size&&n instanceof be&&n.side>=0;r--);if(t<=0){for(var l,c=!0;(l=r?this.children[r-1]:null)&&l.dom.parentNode!=this.contentDOM;r--,c=!1);return l&&t&&c&&!l.border&&!l.domAtom?l.domFromPos(l.size,t):{node:this.contentDOM,offset:l?w(l.dom)+1:0}}for(var u,f=!0;(u=r<this.children.length?this.children[r]:null)&&u.dom.parentNode!=this.contentDOM;r++,f=!1);return u&&f&&!u.border&&!u.domAtom?u.domFromPos(0,t):{node:this.contentDOM,offset:u?w(u.dom):this.contentDOM.childNodes.length}}},{key:"parseRange",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,a=0;;a++){var s=this.children[a],l=i+s.size;if(-1==r&&e<=l){var c=i+s.border;if(e>=c&&t<=l-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,t,c);e=i;for(var u=a;u>0;u--){var f=this.children[u-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){r=w(f.dom)+1;break}e-=f.size}-1==r&&(r=0)}if(r>-1&&(l>t||a==this.children.length-1)){t=l;for(var d=a+1;d<this.children.length;d++){var h=this.children[d];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){o=w(h.dom);break}t+=h.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}},{key:"emptyChildAt",value:function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}},{key:"domAfterPos",value:function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}},{key:"setSelection",value:function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=Math.min(e,t),i=Math.max(e,t),a=0,s=0;a<this.children.length;a++){var l=this.children[a],c=s+l.size;if(o>s&&i<c)return l.setSelection(e-s-l.border,t-s-l.border,n,r);s=c}var u=this.domFromPos(e,e?-1:1),f=t==e?u:this.domFromPos(t,t?-1:1),d=n.getSelection(),h=!1;if((B||K)&&e==t){var p=u,m=p.node,v=p.offset;if(3==m.nodeType){if((h=!(!v||"\n"!=m.nodeValue[v-1]))&&v==m.nodeValue.length)for(var g,y=m;y;y=y.parentNode){if(g=y.nextSibling){"BR"==g.nodeName&&(u=f={node:g.parentNode,offset:w(g)+1});break}var b=y.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{var k=m.childNodes[v-1];h=k&&("BR"==k.nodeName||"false"==k.contentEditable)}}if(B&&d.focusNode&&d.focusNode!=f.node&&1==d.focusNode.nodeType){var S=d.focusNode.childNodes[d.focusOffset];S&&"false"==S.contentEditable&&(r=!0)}if(r||h&&K||!C(u.node,u.offset,d.anchorNode,d.anchorOffset)||!C(f.node,f.offset,d.focusNode,d.focusOffset)){var x=!1;if((d.extend||e==t)&&!h){d.collapse(u.node,u.offset);try{e!=t&&d.extend(f.node,f.offset),x=!0}catch(e){}}if(!x){if(e>t){var O=u;u=f,f=O}var M=document.createRange();M.setEnd(f.node,f.offset),M.setStart(u.node,u.offset),d.removeAllRanges(),d.addRange(M)}}}},{key:"ignoreMutation",value:function(e){return!this.contentDOM&&"selection"!=e.type}},{key:"contentLost",get:function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}},{key:"markDirty",value:function(e,t){for(var n=0,r=0;r<this.children.length;r++){var o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){var a=n+o.border,s=i-o.border;if(e>=a&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=a||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-a,t-a):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}},{key:"markParentsDirty",value:function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}},{key:"domAtom",get:function(){return!1}},{key:"ignoreForCoords",get:function(){return!1}},{key:"isText",value:function(e){return!1}}]),e}(),be=function(e){l(n,e);var t=u(n);function n(e,r,o,i){var a;p(this,n);var s,l=r.type.toDOM;if("function"==typeof l&&(l=l(o,(function(){return s?s.parent?s.parent.posBeforeChild(s):void 0:i}))),!r.type.spec.raw){if(1!=l.nodeType){var c=document.createElement("span");c.appendChild(l),l=c}l.contentEditable="false",l.classList.add("ProseMirror-widget")}return(a=t.call(this,e,[],l,null)).widget=r,a.widget=r,s=f(a),a}return v(n,[{key:"matchesWidget",value:function(e){return 0==this.dirty&&e.type.eq(this.widget.type)}},{key:"parseRule",value:function(){return{ignore:!0}}},{key:"stopEvent",value:function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)}},{key:"ignoreMutation",value:function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}},{key:"destroy",value:function(){this.widget.type.destroy(this.dom),s(d(n.prototype),"destroy",this).call(this)}},{key:"domAtom",get:function(){return!0}},{key:"side",get:function(){return this.widget.type.side}}]),n}(ye),we=function(e){l(n,e);var t=u(n);function n(e,r,o,i){var a;return p(this,n),(a=t.call(this,e,[],r,null)).textDOM=o,a.text=i,a}return v(n,[{key:"size",get:function(){return this.text.length}},{key:"localPosFromDOM",value:function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}},{key:"domFromPos",value:function(e){return{node:this.textDOM,offset:e}}},{key:"ignoreMutation",value:function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}]),n}(ye),ke=function(e){l(n,e);var t=u(n);function n(e,r,o,i){var a;return p(this,n),(a=t.call(this,e,[],o,i)).mark=r,a}return v(n,[{key:"parseRule",value:function(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}},{key:"matchesMark",value:function(e){return 3!=this.dirty&&this.mark.eq(e)}},{key:"markDirty",value:function(e,t){if(s(d(n.prototype),"markDirty",this).call(this,e,t),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}}},{key:"slice",value:function(e,t,r){var o=n.create(this.parent,this.mark,!0,r),i=this.children,a=this.size;t<a&&(i=Fe(i,t,a,r)),e>0&&(i=Fe(i,0,e,r));for(var s=0;s<i.length;s++)i[s].parent=o;return o.children=i,o}}],[{key:"create",value:function(e,t,r,o){var i=o.nodeViews[t.type.name],a=i&&i(t,o,r);return a&&a.dom||(a=y.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new n(e,t,a.dom,a.contentDOM||a.dom)}}]),n}(ye),Se=function(e){l(n,e);var t=u(n);function n(e,r,o,i,a,s,l,c,u){var f;return p(this,n),(f=t.call(this,e,[],a,s)).node=r,f.outerDeco=o,f.innerDeco=i,f.nodeDOM=l,f}return v(n,[{key:"parseRule",value:function(){var e=this;if(this.node.type.spec.reparseInView)return null;var t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(var n=this.children.length-1;n>=0;n--){var r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=function(){return y.Fragment.empty})}else t.contentElement=this.contentDOM;else t.getContent=function(){return e.node.content};return t}},{key:"matchesNode",value:function(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Pe(t,this.outerDeco)&&n.eq(this.innerDeco)}},{key:"size",get:function(){return this.node.nodeSize}},{key:"border",get:function(){return this.node.isLeaf?0:1}},{key:"updateChildren",value:function(e,t){var n=this,r=this.node.inlineContent,o=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,s=i&&i.pos<0,l=new Ie(this,a&&a.node,e);!function(e,t,n,r){var o=t.locals(e),i=0;if(0!=o.length)for(var a=0,s=[],l=null,c=0;;){for(var u=void 0,f=void 0;a<o.length&&o[a].to==i;){var d=o[a++];d.widget&&(u?(f||(f=[u])).push(d):u=d)}if(u)if(f){f.sort(je);for(var h=0;h<f.length;h++)n(f[h],c,!!l)}else n(u,c,!!l);var p=void 0,m=void 0;if(l)m=-1,p=l,l=null;else{if(!(c<e.childCount))break;m=c,p=e.child(c++)}for(var v=0;v<s.length;v++)s[v].to<=i&&s.splice(v--,1);for(;a<o.length&&o[a].from<=i&&o[a].to>i;)s.push(o[a++]);var g=i+p.nodeSize;if(p.isText){var y=g;a<o.length&&o[a].from<y&&(y=o[a].from);for(var b=0;b<s.length;b++)s[b].to<y&&(y=s[b].to);y<g&&(l=p.cut(y-i),p=p.cut(0,y-i),g=y,m=-1)}else for(;a<o.length&&o[a].to<g;)a++;r(p,p.isInline&&!p.isLeaf?s.filter((function(e){return!e.inline})):s.slice(),t.forChild(i,p),m),i=g}else for(var w=0;w<e.childCount;w++){var k=e.child(w);r(k,o,t.forChild(i,k),w),i+=k.nodeSize}}(this.node,this.innerDeco,(function(t,i,a){t.spec.marks?l.syncToMarks(t.spec.marks,r,e):t.type.side>=0&&!a&&l.syncToMarks(i==n.node.childCount?y.Mark.none:n.node.child(i).marks,r,e),l.placeWidget(t,e,o)}),(function(t,n,a,c){var u;l.syncToMarks(t.marks,r,e),l.findNodeMatch(t,n,a,c)||s&&e.state.selection.from>o&&e.state.selection.to<o+t.nodeSize&&(u=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(t,n,a,u,e)||l.updateNextNode(t,n,a,e,c,o)||l.addNode(t,n,a,e,o),o+=t.nodeSize})),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(a&&this.protectLocalComposition(e,a),Te(this.contentDOM,this.children,e),H&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}},{key:"localCompositionInfo",value:function(e,t){var n=e.state.selection,r=n.from,o=n.to;if(!(e.state.selection instanceof g.TextSelection)||r<t||o>t+this.node.content.size)return null;var i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){var a=i.nodeValue,s=function(e,t,n,r){for(var o=0,i=0;o<e.childCount&&i<=r;){var a=e.child(o++),s=i;if(i+=a.nodeSize,a.isText){for(var l=a.text;o<e.childCount;){var c=e.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-t.length-s,r-s)==t)return r-t.length;var u=s<r?l.lastIndexOf(t,r-s-1):-1;if(u>=0&&u+t.length+s>=n)return s+u;if(n==r&&l.length>=r+t.length-s&&l.slice(r-s,r-s+t.length)==t)return r}}}return-1}(this.node.content,a,r-t,o-t);return s<0?null:{node:i,pos:s,text:a}}return{node:i,pos:-1,text:""}}},{key:"protectLocalComposition",value:function(e,t){var n=t.node,r=t.pos,o=t.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}var a=new we(this,i,n,o);e.input.compositionNodes.push(a),this.children=Fe(this.children,r,r+o.length,e,a)}}},{key:"update",value:function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node)||(this.updateInner(e,t,n,r),0))}},{key:"updateInner",value:function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}},{key:"updateOuterDeco",value:function(e){if(!Pe(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=De(this.dom,this.nodeDOM,Re(this.outerDeco,this.node,t),Re(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}}},{key:"selectNode",value:function(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}},{key:"deselectNode",value:function(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable"))}},{key:"domAtom",get:function(){return this.node.isAtom}}],[{key:"create",value:function(e,t,r,o,i,a){var s,l=i.nodeViews[t.type.name],c=l&&l(t,i,(function(){return s?s.parent?s.parent.posBeforeChild(s):void 0:a}),r,o),u=c&&c.dom,f=c&&c.contentDOM;if(t.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(t.text);else if(!u){var d=y.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);u=d.dom,f=d.contentDOM}f||t.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));var h=u;return u=Ee(u,r,t),c?s=new Me(e,t,r,o,u,f||null,h,c,i,a+1):t.isText?new Ce(e,t,r,o,u,h,i):new n(e,t,r,o,u,f||null,h,i,a+1)}}]),n}(ye);function xe(e,t,n,r,o){Ee(r,t,e);var i=new Se(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}var Ce=function(e){l(n,e);var t=u(n);function n(e,r,o,i,a,s,l){return p(this,n),t.call(this,e,r,o,i,a,null,s,l,0)}return v(n,[{key:"parseRule",value:function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}},{key:"update",value:function(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node)||(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,0))}},{key:"inParent",value:function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}},{key:"domFromPos",value:function(e){return{node:this.nodeDOM,offset:e}}},{key:"localPosFromDOM",value:function(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):s(d(n.prototype),"localPosFromDOM",this).call(this,e,t,r)}},{key:"ignoreMutation",value:function(e){return"characterData"!=e.type&&"selection"!=e.type}},{key:"slice",value:function(e,t,r){var o=this.node.cut(e,t),i=document.createTextNode(o.text);return new n(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}},{key:"markDirty",value:function(e,t){s(d(n.prototype),"markDirty",this).call(this,e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}},{key:"domAtom",get:function(){return!1}},{key:"isText",value:function(e){return this.node.text==e}}]),n}(Se),Oe=function(e){l(n,e);var t=u(n);function n(){return p(this,n),t.apply(this,arguments)}return v(n,[{key:"parseRule",value:function(){return{ignore:!0}}},{key:"matchesHack",value:function(e){return 0==this.dirty&&this.dom.nodeName==e}},{key:"domAtom",get:function(){return!0}},{key:"ignoreForCoords",get:function(){return"IMG"==this.dom.nodeName}}]),n}(ye),Me=function(e){l(n,e);var t=u(n);function n(e,r,o,i,a,s,l,c,u,f){var d;return p(this,n),(d=t.call(this,e,r,o,i,a,s,l,u,f)).spec=c,d}return v(n,[{key:"update",value:function(e,t,r,o){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){var i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,o),i}return!(!this.contentDOM&&!e.isLeaf)&&s(d(n.prototype),"update",this).call(this,e,t,r,o)}},{key:"selectNode",value:function(){this.spec.selectNode?this.spec.selectNode():s(d(n.prototype),"selectNode",this).call(this)}},{key:"deselectNode",value:function(){this.spec.deselectNode?this.spec.deselectNode():s(d(n.prototype),"deselectNode",this).call(this)}},{key:"setSelection",value:function(e,t,r,o){this.spec.setSelection?this.spec.setSelection(e,t,r):s(d(n.prototype),"setSelection",this).call(this,e,t,r,o)}},{key:"destroy",value:function(){this.spec.destroy&&this.spec.destroy(),s(d(n.prototype),"destroy",this).call(this)}},{key:"stopEvent",value:function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}},{key:"ignoreMutation",value:function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):s(d(n.prototype),"ignoreMutation",this).call(this,e)}}]),n}(Se);function Te(e,t,n){for(var r=e.firstChild,o=!1,i=0;i<t.length;i++){var a=t[i],s=a.dom;if(s.parentNode==e){for(;s!=r;)r=ze(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(s,r);if(a instanceof ke){var l=r?r.previousSibling:e.lastChild;Te(a.contentDOM,a.children,n),r=l?l.nextSibling:e.firstChild}}for(;r;)r=ze(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}var Ae=function(e){e&&(this.nodeName=e)};Ae.prototype=Object.create(null);var Ne=[new Ae];function Re(e,t,n){if(0==e.length)return Ne;for(var r=n?Ne[0]:new Ae,o=[r],i=0;i<e.length;i++){var a=e[i].type.attrs;if(a)for(var s in a.nodeName&&o.push(r=new Ae(a.nodeName)),a){var l=a[s];null!=l&&(n&&1==o.length&&o.push(r=new Ae(t.isInline?"span":"div")),"class"==s?r.class=(r.class?r.class+" ":"")+l:"style"==s?r.style=(r.style?r.style+";":"")+l:"nodeName"!=s&&(r[s]=l))}}return o}function De(e,t,n,r){if(n==Ne&&r==Ne)return t;for(var o=t,i=0;i<r.length;i++){var a=r[i],s=n[i];if(i){var l=void 0;s&&s.nodeName==a.nodeName&&o!=e&&(l=o.parentNode)&&l.nodeName.toLowerCase()==a.nodeName||((l=document.createElement(a.nodeName)).pmIsDeco=!0,l.appendChild(o),s=Ne[0]),o=l}_e(o,s||Ne[0],a)}return o}function _e(e,t,n){for(var r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(var o in n)"class"!=o&&"style"!=o&&"nodeName"!=o&&n[o]!=t[o]&&e.setAttribute(o,n[o]);if(t.class!=n.class){for(var i=t.class?t.class.split(" ").filter(Boolean):[],a=n.class?n.class.split(" ").filter(Boolean):[],s=0;s<i.length;s++)-1==a.indexOf(i[s])&&e.classList.remove(i[s]);for(var l=0;l<a.length;l++)-1==i.indexOf(a[l])&&e.classList.add(a[l]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style)for(var c,u=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=u.exec(t.style);)e.style.removeProperty(c[1]);n.style&&(e.style.cssText+=n.style)}}function Ee(e,t,n){return De(e,e,Ne,Re(t,n,1!=e.nodeType))}function Pe(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function ze(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var Ie=function(){function e(t,n,r){p(this,e),this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=function(e,t){var n=t,r=n.children.length,o=e.childCount,i=new Map,a=[];e:for(;o>0;){for(var s=void 0;;)if(r){var l=n.children[r-1];if(!(l instanceof ke)){s=l,r--;break}n=l,r=l.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}var c=s.node;if(c){if(c!=e.child(o-1))break;--o,i.set(s,o),a.push(s)}}return{index:o,matched:i,matches:a.reverse()}}(t.node.content,t)}return v(e,[{key:"destroyBetween",value:function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}},{key:"destroyRest",value:function(){this.destroyBetween(this.index,this.top.children.length)}},{key:"syncToMarks",value:function(e,t,n){for(var r=0,o=this.stack.length>>1,i=Math.min(o,e.length);r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);for(var a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++){var l=this.top.children[s];if(l.matchesMark(e[o])&&!this.isLocked(l.dom)){a=s;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var c=ke.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}},{key:"findNodeMatch",value:function(e,t,n,r){var o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(var a=this.index,s=Math.min(this.top.children.length,a+5);a<s;a++){var l=this.top.children[a];if(l.matchesNode(e,t,n)&&!this.preMatch.matched.has(l)){i=a;break}}return!(i<0||(this.destroyBetween(this.index,i),this.index++,0))}},{key:"updateNodeAt",value:function(e,t,n,r,o){var i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}},{key:"findIndexWithChild",value:function(e){for(;;){var t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){var n=e.pmViewDesc;if(n)for(var r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==n)return r;return-1}e=t}}},{key:"updateNextNode",value:function(e,t,n,r,o,i){for(var a=this.index;a<this.top.children.length;a++){var s=this.top.children[a];if(s instanceof Se){var l=this.preMatch.matched.get(s);if(null!=l&&l!=o)return!1;var c=s.dom,u=void 0,f=this.isLocked(c)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&3!=s.dirty&&Pe(t,s.outerDeco));if(!f&&s.update(e,t,n,r))return this.destroyBetween(this.index,a),s.dom!=c&&(this.changed=!0),this.index++,!0;if(!f&&(u=this.recreateWrapper(s,e,t,n,r,i)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=2,u.updateChildren(r,i+1),u.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}},{key:"recreateWrapper",value:function(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Pe(n,e.outerDeco)||!r.eq(e.innerDeco))return null;var s=Se.create(this.top,t,n,r,i,a);if(s.contentDOM){s.children=e.children,e.children=[];var l,c=o(s.children);try{for(c.s();!(l=c.n()).done;)l.value.parent=s}catch(e){c.e(e)}finally{c.f()}}return e.destroy(),s}},{key:"addNode",value:function(e,t,n,r,o){var i=Se.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}},{key:"placeWidget",value:function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){var o=new be(this.top,e,t,n);this.top.children.splice(this.index++,0,o),this.changed=!0}else this.index++}},{key:"addTextblockHacks",value:function(){for(var e=this.top.children[this.index-1],t=this.top;e instanceof ke;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof Ce)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((K||L)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}},{key:"addHackNode",value:function(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{var n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");var r=new Oe(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}},{key:"isLocked",value:function(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}]),e}();function je(e,t){return e.type.side-t.type.side}function Fe(e,t,n,r,o){for(var i=[],a=0,s=0;a<e.length;a++){var l=e[a],c=s,u=s+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Be(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=e.domSelectionRange(),o=e.state.doc;if(!n.focusNode)return null;var i=e.docView.nearestDesc(n.focusNode),a=i&&0==i.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;var l,c,u=o.resolve(s);if(N(n)){for(l=s;i&&!i.node;)i=i.parent;var f=i.node;if(i&&f.isAtom&&g.NodeSelection.isSelectable(f)&&i.parent&&(!f.isInline||!function(e,t,n){for(var r=0==t,o=t==T(e);r||o;){if(e==n)return!0;var i=w(e);if(!(e=e.parentNode))return!1;r=r&&0==i,o=o&&i==T(e)}}(n.focusNode,n.focusOffset,i.dom))){var d=i.posBefore;c=new g.NodeSelection(s==d?u:o.resolve(d))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){for(var h=s,p=s,m=0;m<n.rangeCount;m++){var v=n.getRangeAt(m);h=Math.min(h,e.docView.posFromDOM(v.startContainer,v.startOffset,1)),p=Math.max(p,e.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(h<0)return null;var y=r(p==e.state.selection.anchor?[p,h]:[h,p],2);l=y[0],s=y[1],u=o.resolve(s)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}var b=o.resolve(l);return c||(c=Ue(e,b,u,"pointer"==t||e.state.selection.head<u.pos&&!a?1:-1)),c}function $e(e){return e.editable?e.hasFocus():Xe(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Le(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.state.selection;if(qe(e,n),$e(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&L){var r=e.domSelectionRange(),o=e.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&C(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){var t=e.domSelection(),n=document.createRange();if(t){var r=e.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setStart(r.parentNode,w(r)+1):n.setStart(r,0),n.collapse(!0),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&j&&F<=11&&(r.disabled=!0,r.disabled=!1)}}(e);else{var i,a,s=n.anchor,l=n.head;!Ve||n instanceof g.TextSelection||(n.$from.parent.inlineContent||(i=Ke(e,n.from)),n.empty||n.$from.parent.inlineContent||(a=Ke(e,n.to))),e.docView.setSelection(s,l,e.root,t),Ve&&(i&&We(i),a&&We(a)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);var n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((function(){$e(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var Ve=K||L&&V<63;function Ke(e,t){var n=e.docView.domFromPos(t,0),r=n.node,o=n.offset,i=o<r.childNodes.length?r.childNodes[o]:null,a=o?r.childNodes[o-1]:null;if(K&&i&&"false"==i.contentEditable)return He(i);if(!(i&&"false"!=i.contentEditable||a&&"false"!=a.contentEditable)){if(i)return He(i);if(a)return He(a)}}function He(e){return e.contentEditable="true",K&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function We(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function qe(e,t){if(t instanceof g.NodeSelection){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Je(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Je(e)}function Je(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Ue(e,t,n,r){return e.someProp("createSelectionBetween",(function(r){return r(e,t,n)}))||g.TextSelection.between(t,n,r)}function Ge(e){return!(e.editable&&!e.hasFocus())&&Xe(e)}function Xe(e){var t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Ye(e,t){var n=e.selection,r=n.$anchor,o=n.$head,i=t>0?r.max(o):r.min(o),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&g.Selection.findFrom(a,t)}function Qe(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Ze(e,t,n){var r=e.state.selection;if(!(r instanceof g.TextSelection)){if(r instanceof g.NodeSelection&&r.node.isInline)return Qe(e,new g.TextSelection(t>0?r.$to:r.$from));var o=Ye(e.state,t);return!!o&&Qe(e,o)}if(n.indexOf("s")>-1){var i=r.$head,a=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;var s=e.state.doc.resolve(i.pos+a.nodeSize*(t<0?-1:1));return Qe(e,new g.TextSelection(r.$anchor,s))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){var l=Ye(e.state,t);return!!(l&&l instanceof g.NodeSelection)&&Qe(e,l)}if(!(W&&n.indexOf("m")>-1)){var c,u=r.$head,f=u.textOffset?null:t<0?u.nodeBefore:u.nodeAfter;if(!f||f.isText)return!1;var d=t<0?u.pos-f.nodeSize:u.pos;return!!(f.isAtom||(c=e.docView.descAt(d))&&!c.contentDOM)&&(g.NodeSelection.isSelectable(f)?Qe(e,new g.NodeSelection(t<0?e.state.doc.resolve(u.pos-f.nodeSize):u)):!!U&&Qe(e,new g.TextSelection(e.state.doc.resolve(t<0?d:d+f.nodeSize))))}}function et(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function tt(e,t){var n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function nt(e,t){return t<0?function(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(n){var o,i,a=!1;for(B&&1==n.nodeType&&r<et(n)&&tt(n.childNodes[r],-1)&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;var s=n.childNodes[r-1];if(tt(s,-1))o=n,i=--r;else{if(3!=s.nodeType)break;r=(n=s).nodeValue.length}}else{if(rt(n))break;for(var l=n.previousSibling;l&&tt(l,-1);)o=n.parentNode,i=w(l),l=l.previousSibling;if(l)r=et(n=l);else{if((n=n.parentNode)==e.dom)break;r=0}}a?ot(e,n,r):o&&ot(e,o,i)}}(e):function(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(n){for(var o,i,a=et(n);;)if(r<a){if(1!=n.nodeType)break;if(!tt(n.childNodes[r],1))break;o=n,i=++r}else{if(rt(n))break;for(var s=n.nextSibling;s&&tt(s,1);)o=s.parentNode,i=w(s)+1,s=s.nextSibling;if(s)r=0,a=et(n=s);else{if((n=n.parentNode)==e.dom)break;r=a=0}}o&&ot(e,o,i)}}(e)}function rt(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function ot(e,t,n){var r,o;3!=t.nodeType&&((o=function(e,t){for(;e&&t==e.childNodes.length&&!A(e);)t=w(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){var n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=o,n=0):(r=function(e,t){for(;e&&!t&&!A(e);)t=w(e),e=e.parentNode;for(;e&&t;){var n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=r,n=r.nodeValue.length));var i=e.domSelection();if(i){if(N(i)){var a=document.createRange();a.setEnd(t,n),a.setStart(t,n),i.removeAllRanges(),i.addRange(a)}else i.extend&&i.extend(t,n);e.domObserver.setCurSelection();var s=e.state;setTimeout((function(){e.state==s&&Le(e)}),50)}}function it(e,t){var n=e.state.doc.resolve(t);if(!L&&!q&&n.parent.inlineContent){var r=e.coordsAtPos(t);if(t>n.start()){var o=e.coordsAtPos(t-1),i=(o.top+o.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(o.left-r.left)>1)return o.left<r.left?"ltr":"rtl"}if(t<n.end()){var a=e.coordsAtPos(t+1),s=(a.top+a.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(a.left-r.left)>1)return a.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function at(e,t,n){var r=e.state.selection;if(r instanceof g.TextSelection&&!r.empty||n.indexOf("s")>-1)return!1;if(W&&n.indexOf("m")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var a=Ye(e.state,t);if(a&&a instanceof g.NodeSelection)return Qe(e,a)}if(!o.parent.inlineContent){var s=t<0?o:i,l=r instanceof g.AllSelection?g.Selection.near(s,t):g.Selection.findFrom(s,t);return!!l&&Qe(e,l)}return!1}function st(e,t){if(!(e.state.selection instanceof g.TextSelection))return!0;var n=e.state.selection,r=n.$head,o=n.$anchor,i=n.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){var s=e.state.tr;return t<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),e.dispatch(s),!0}return!1}function lt(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function ct(e,t){e.someProp("transformCopied",(function(n){t=n(t,e)}));for(var n=[],r=t,o=r.content,i=r.openStart,a=r.openEnd;i>1&&a>1&&1==o.childCount&&1==o.firstChild.childCount;){i--,a--;var s=o.firstChild;n.push(s.type.name,s.attrs!=s.type.defaultAttrs?s.attrs:null),o=s.content}var l=e.someProp("clipboardSerializer")||y.DOMSerializer.fromSchema(e.state.schema),c=bt(),u=c.createElement("div");u.appendChild(l.serializeFragment(o,{document:c}));for(var f,d=u.firstChild,h=0;d&&1==d.nodeType&&(f=gt[d.nodeName.toLowerCase()]);){for(var p=f.length-1;p>=0;p--){for(var m=c.createElement(f[p]);u.firstChild;)m.appendChild(u.firstChild);u.appendChild(m),h++}d=u.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice","".concat(i," ").concat(a).concat(h?" -".concat(h):""," ").concat(JSON.stringify(n))),{dom:u,text:e.someProp("clipboardTextSerializer",(function(n){return n(t,e)}))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function ut(e,t,n,r,o){var i,a,s=o.parent.type.spec.code;if(!n&&!t)return null;var l=t&&(r||s||!n);if(l){if(e.someProp("transformPastedText",(function(n){t=n(t,s||r,e)})),s)return t?new y.Slice(y.Fragment.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):y.Slice.empty;var c=e.someProp("clipboardTextParser",(function(n){return n(t,o,r,e)}));if(c)a=c;else{var u=o.marks(),f=e.state.schema,d=y.DOMSerializer.fromSchema(f);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach((function(e){var t=i.appendChild(document.createElement("p"));e&&t.appendChild(d.serializeNode(f.text(e,u)))}))}}else e.someProp("transformPastedHTML",(function(t){n=t(n,e)})),i=function(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=bt().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);if((n=o&>[o[1].toLowerCase()])&&(e=n.map((function(e){return"<"+e+">"})).join("")+e+n.map((function(e){return"</"+e+">"})).reverse().join("")),r.innerHTML=function(e){var t=window.trustedTypes;return t?t.createPolicy("detachedDocument",{createHTML:function(e){return e}}).createHTML(e):e}(e),n)for(var i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n),U&&function(e){for(var t=e.querySelectorAll(L?"span:not([class]):not([style])":"span.Apple-converted-space"),n=0;n<t.length;n++){var r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(i);var h=i&&i.querySelector("[data-pm-slice]"),p=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(p&&p[3])for(var m=+p[3];m>0;m--){for(var v=i.firstChild;v&&1!=v.nodeType;)v=v.nextSibling;if(!v)break;i=v}if(!a){var g=e.someProp("clipboardParser")||e.someProp("domParser")||y.DOMParser.fromSchema(e.state.schema);a=g.parseSlice(i,{preserveWhitespace:!(!l&&!p),context:o,ruleFromNode:function(e){return"BR"!=e.nodeName||e.nextSibling||!e.parentNode||ft.test(e.parentNode.nodeName)?null:{ignore:!0}}})}if(p)a=function(e,t){if(!e.size)return e;var n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}for(var o=e.content,i=e.openStart,a=e.openEnd,s=n.length-2;s>=0;s-=2){var l=r.nodes[n[s]];if(!l||l.hasRequiredAttrs())break;o=y.Fragment.from(l.create(n[s+1],o)),i++,a++}return new y.Slice(o,i,a)}(vt(a,+p[1],+p[2]),p[4]);else if(a=y.Slice.maxOpen(function(e,t){if(e.childCount<2)return e;for(var n,r=function(){var n,r=t.node(o).contentMatchAt(t.index(o)),i=[];if(e.forEach((function(e){if(i){var t,o=r.findWrapping(e.type);if(!o)return i=null;if(t=i.length&&n.length&&ht(o,n,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=pt(i[i.length-1],n.length));var a=dt(e,o);i.push(a),r=r.matchType(a.type),n=o}}})),i)return{v:y.Fragment.from(i)}},o=t.depth;o>=0;o--)if(n=r())return n.v;return e}(a.content,o),!0),a.openStart||a.openEnd){for(var b=0,w=0,k=a.content.firstChild;b<a.openStart&&!k.type.spec.isolating;b++,k=k.firstChild);for(var S=a.content.lastChild;w<a.openEnd&&!S.type.spec.isolating;w++,S=S.lastChild);a=vt(a,b,w)}return e.someProp("transformPasted",(function(t){a=t(a,e)})),a}var ft=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function dt(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t.length-1;r>=n;r--)e=t[r].create(null,y.Fragment.from(e));return e}function ht(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){var i=ht(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(y.Fragment.from(dt(n,e,o+1))))}}function pt(e,t){if(0==t)return e;var n=e.content.replaceChild(e.childCount-1,pt(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(y.Fragment.empty,!0);return e.copy(n.append(r))}function mt(e,t,n,r,o,i){var a=t<0?e.firstChild:e.lastChild,s=a.content;return e.childCount>1&&(i=0),o<r-1&&(s=mt(s,t,n,r,o+1,i)),o>=n&&(s=t<0?a.contentMatchAt(0).fillBefore(s,i<=o).append(s):s.append(a.contentMatchAt(a.childCount).fillBefore(y.Fragment.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(s))}function vt(e,t,n){return t<e.openStart&&(e=new y.Slice(mt(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new y.Slice(mt(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var gt={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},yt=null;function bt(){return yt||(yt=document.implementation.createHTMLDocument("title"))}var wt={},kt={},St={touchstart:!0,touchmove:!0},xt=v((function e(){p(this,e),this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}));function Ct(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Ot(e){e.someProp("handleDOMEvents",(function(t){for(var n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=function(t){return Mt(e,t)})}))}function Mt(e,t){return e.someProp("handleDOMEvents",(function(n){var r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function Tt(e){return{left:e.clientX,top:e.clientY}}function At(e,t,n,r,o){if(-1==r)return!1;for(var i,a=e.state.doc.resolve(r),s=function(r){if(e.someProp(t,(function(t){return r>a.depth?t(e,n,a.nodeAfter,a.before(r),o,!0):t(e,n,a.node(r),a.before(r),o,!1)})))return{v:!0}},l=a.depth+1;l>0;l--)if(i=s(l))return i.v;return!1}function Nt(e,t,n){if(e.focused||e.focus(),!e.state.selection.eq(t)){var r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}}function Rt(e,t,n,r){return At(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(function(n){return n(e,t,r)}))}function Dt(e,t,n,r){return At(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(function(n){return n(e,t,r)}))||function(e,t,n){if(0!=n.button)return!1;var r=e.state.doc;if(-1==t)return!!r.inlineContent&&(Nt(e,g.TextSelection.create(r,0,r.content.size),"pointer"),!0);for(var o=r.resolve(t),i=o.depth+1;i>0;i--){var a=i>o.depth?o.nodeAfter:o.node(i),s=o.before(i);if(a.inlineContent)Nt(e,g.TextSelection.create(r,s+1,s+1+a.content.size),"pointer");else{if(!g.NodeSelection.isSelectable(a))continue;Nt(e,g.NodeSelection.create(r,s),"pointer")}return!0}}(e,n,r)}function _t(e){return Bt(e)}kt.keydown=function(e,t){var n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!zt(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!J||!L||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!H||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",(function(t){return t(e,n)}))||function(e,t){var n=t.keyCode,r=function(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||W&&72==n&&"c"==r)return st(e,-1)||nt(e,-1);if(46==n&&!t.shiftKey||W&&68==n&&"c"==r)return st(e,1)||nt(e,1);if(13==n||27==n)return!0;if(37==n||W&&66==n&&"c"==r){var o=37==n?"ltr"==it(e,e.state.selection.from)?-1:1:-1;return Ze(e,o,r)||nt(e,o)}if(39==n||W&&70==n&&"c"==r){var i=39==n?"ltr"==it(e,e.state.selection.from)?1:-1:1;return Ze(e,i,r)||nt(e,i)}return 38==n||W&&80==n&&"c"==r?at(e,-1,r)||nt(e,-1):40==n||W&&78==n&&"c"==r?function(e){if(!K||e.state.selection.$head.parentOffset>0)return!1;var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var o=n.firstChild;lt(e,o,"true"),setTimeout((function(){return lt(e,o,"false")}),20)}return!1}(e)||at(e,1,r)||nt(e,1):r==(W?"m":"c")&&(66==n||73==n||89==n||90==n)}(e,n)?n.preventDefault():Ct(e,"key");else{var r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout((function(){e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",(function(t){return t(e,R(13,"Enter"))})),e.input.lastIOSEnter=0)}),200)}},kt.keyup=function(e,t){16==t.keyCode&&(e.input.shiftKey=!1)},kt.keypress=function(e,t){var n=t;if(!(zt(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||W&&n.metaKey))if(e.someProp("handleKeyPress",(function(t){return t(e,n)})))n.preventDefault();else{var r=e.state.selection;if(!(r instanceof g.TextSelection&&r.$from.sameParent(r.$to))){var o=String.fromCharCode(n.charCode);/[\r\n]/.test(o)||e.someProp("handleTextInput",(function(t){return t(e,r.$from.pos,r.$to.pos,o)}))||e.dispatch(e.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}}};var Et=W?"metaKey":"ctrlKey";wt.mousedown=function(e,t){var n=t;e.input.shiftKey=n.shiftKey;var r=_t(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[Et]&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};var a=e.posAtCoords(Tt(n));a&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Pt(e,a,n,!!r)):("doubleClick"==i?Rt:Dt)(e,a.pos,a.inside,n)?n.preventDefault():Ct(e,"pointer"))};var Pt=function(){function e(t,n,r,o){var i,a,s=this;if(p(this,e),this.view=t,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[Et],this.allowDefault=r.shiftKey,n.inside>-1)i=t.state.doc.nodeAt(n.inside),a=n.inside;else{var l=t.state.doc.resolve(n.pos);i=l.parent,a=l.depth?l.before():0}var c=o?null:r.target,u=c?t.docView.nearestDesc(c,!0):null;this.target=u&&1==u.dom.nodeType?u.dom:null;var f=t.state.selection;(0==r.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||f instanceof g.NodeSelection&&f.from<=a&&f.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!B||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((function(){s.view.input.mouseDown==s&&s.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ct(t,"pointer")}return v(e,[{key:"done",value:function(){var e=this;this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((function(){return Le(e.view)})),this.view.input.mouseDown=null}},{key:"up",value:function(e){if(this.done(),this.view.dom.contains(e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Tt(e))),this.updateAllowDefault(e),this.allowDefault||!t?Ct(this.view,"pointer"):function(e,t,n,r,o){return At(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(function(n){return n(e,t,r)}))||(o?function(e,t){if(-1==t)return!1;var n,r,o=e.state.selection;o instanceof g.NodeSelection&&(n=o.node);for(var i=e.state.doc.resolve(t),a=i.depth+1;a>0;a--){var s=a>i.depth?i.nodeAfter:i.node(a);if(g.NodeSelection.isSelectable(s)){r=n&&o.$from.depth>0&&a>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(a);break}}return null!=r&&(Nt(e,g.NodeSelection.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&g.NodeSelection.isSelectable(r))&&(Nt(e,new g.NodeSelection(n),"pointer"),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||K&&this.mightDrag&&!this.mightDrag.node.isAtom||L&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Nt(this.view,g.Selection.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Ct(this.view,"pointer")}}},{key:"move",value:function(e){this.updateAllowDefault(e),Ct(this.view,"pointer"),0==e.buttons&&this.done()}},{key:"updateAllowDefault",value:function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}]),e}();function zt(e,t){return!!e.composing||!!(K&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}wt.touchstart=function(e){e.input.lastTouch=Date.now(),_t(e),Ct(e,"pointer")},wt.touchmove=function(e){e.input.lastTouch=Date.now(),Ct(e,"pointer")},wt.contextmenu=function(e){return _t(e)};var It=J?5e3:-1;function jt(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout((function(){return Bt(e)}),t))}function Ft(e){var t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Bt(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(J&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Ft(e),t||e.docView&&e.docView.dirty){var n=Be(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||e.state.selection.empty?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}kt.compositionstart=kt.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$to;if(t.selection instanceof g.TextSelection&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(e){return!1===e.type.spec.inclusive}))))e.markCursor=e.state.storedMarks||n.marks(),Bt(e,!0),e.markCursor=null;else if(Bt(e,!t.selection.empty),B&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.domSelectionRange(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var a=i<0?o.lastChild:o.childNodes[i-1];if(!a)break;if(3==a.nodeType){var s=e.domSelection();s&&s.collapse(a,a.nodeValue.length);break}o=a,i=-1}e.input.composing=!0}jt(e,It)},kt.compositionend=function(e,t){e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then((function(){return e.domObserver.flush()})),e.input.compositionID++,jt(e,20))};var $t=j&&F<15||H&&G<604;function Lt(e,t,n,r,o){var i=ut(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",(function(t){return t(e,o,i||y.Slice.empty)})))return!0;if(!i)return!1;var a=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),s=a?e.state.tr.replaceSelectionWith(a,r):e.state.tr.replaceSelection(i);return e.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Vt(e){var t=e.getData("text/plain")||e.getData("Text");if(t)return t;var n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}wt.copy=kt.cut=function(e,t){var n=t,r=e.state.selection,o="cut"==n.type;if(!r.empty){var i=$t?null:n.clipboardData,a=ct(e,r.content()),s=a.dom,l=a.text;i?(n.preventDefault(),i.clearData(),i.setData("text/html",s.innerHTML),i.setData("text/plain",l)):function(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}}(e,s),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},kt.paste=function(e,t){var n=t;if(!e.composing||J){var r=$t?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&Lt(e,Vt(r),r.getData("text/html"),o,n)?n.preventDefault():function(e,t){if(e.dom.parentNode){var n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();var o=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout((function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Lt(e,r.value,null,o,t):Lt(e,r.textContent,r.innerHTML,o,t)}),50)}}(e,n)}};var Kt=v((function e(t,n,r){p(this,e),this.slice=t,this.move=n,this.node=r})),Ht=W?"altKey":"ctrlKey";for(var Wt in wt.dragstart=function(e,t){var n=t,r=e.input.mouseDown;if(r&&r.done(),n.dataTransfer){var o,i=e.state.selection,a=i.empty?null:e.posAtCoords(Tt(n));if(a&&a.pos>=i.from&&a.pos<=(i instanceof g.NodeSelection?i.to-1:i.to));else if(r&&r.mightDrag)o=g.NodeSelection.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){var s=e.docView.nearestDesc(n.target,!0);s&&s.node.type.spec.draggable&&s!=e.docView&&(o=g.NodeSelection.create(e.state.doc,s.posBefore))}var l=ct(e,(o||e.state.selection).content()),c=l.dom,u=l.text,f=l.slice;(!n.dataTransfer.files.length||!L||V>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData($t?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",$t||n.dataTransfer.setData("text/plain",u),e.dragging=new Kt(f,!n[Ht],o)}},wt.dragend=function(e){var t=e.dragging;window.setTimeout((function(){e.dragging==t&&(e.dragging=null)}),50)},kt.dragover=kt.dragenter=function(e,t){return t.preventDefault()},kt.drop=function(e,t){var n=t,r=e.dragging;if(e.dragging=null,n.dataTransfer){var o=e.posAtCoords(Tt(n));if(o){var i=e.state.doc.resolve(o.pos),a=r&&r.slice;a?e.someProp("transformPasted",(function(t){a=t(a,e)})):a=ut(e,Vt(n.dataTransfer),$t?null:n.dataTransfer.getData("text/html"),!1,i);var s=!(!r||n[Ht]);if(e.someProp("handleDrop",(function(t){return t(e,n,a||y.Slice.empty,s)})))n.preventDefault();else if(a){n.preventDefault();var l=a?b.dropPoint(e.state.doc,i.pos,a):i.pos;null==l&&(l=i.pos);var c=e.state.tr;if(s){var u=r.node;u?u.replace(c):c.deleteSelection()}var f=c.mapping.map(l),d=0==a.openStart&&0==a.openEnd&&1==a.content.childCount,h=c.doc;if(d?c.replaceRangeWith(f,f,a.content.firstChild):c.replaceRange(f,f,a),!c.doc.eq(h)){var p=c.doc.resolve(f);if(d&&g.NodeSelection.isSelectable(a.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new g.NodeSelection(p));else{var m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((function(e,t,n,r){return m=r})),c.setSelection(Ue(e,p,c.doc.resolve(m)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))}}}}},wt.focus=function(e){e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Le(e)}),20))},wt.blur=function(e,t){var n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},wt.beforeinput=function(e,t){if(L&&J&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();var n=e.input.domChangeCount;setTimeout((function(){if(e.input.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",(function(t){return t(e,R(8,"Backspace"))})))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}}),50)}},kt)wt[Wt]=kt[Wt];function qt(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var Jt=function(){function e(t,n){p(this,e),this.toDOM=t,this.spec=n||Qt,this.side=this.spec.side||0}return v(e,[{key:"map",value:function(e,t,n,r){var o=e.mapResult(t.from+r,this.side<0?-1:1),i=o.pos;return o.deleted?null:new Xt(i-n,i-n,this)}},{key:"valid",value:function(){return!0}},{key:"eq",value:function(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&qt(this.spec,t.spec))}},{key:"destroy",value:function(e){this.spec.destroy&&this.spec.destroy(e)}}]),e}(),Ut=function(){function e(t,n){p(this,e),this.attrs=t,this.spec=n||Qt}return v(e,[{key:"map",value:function(e,t,n,r){var o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Xt(o,i,this)}},{key:"valid",value:function(e,t){return t.from<t.to}},{key:"eq",value:function(t){return this==t||t instanceof e&&qt(this.attrs,t.attrs)&&qt(this.spec,t.spec)}},{key:"destroy",value:function(){}}],[{key:"is",value:function(t){return t.type instanceof e}}]),e}(),Gt=function(){function e(t,n){p(this,e),this.attrs=t,this.spec=n||Qt}return v(e,[{key:"map",value:function(e,t,n,r){var o=e.mapResult(t.from+r,1);if(o.deleted)return null;var i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Xt(o.pos-n,i.pos-n,this)}},{key:"valid",value:function(e,t){var n,r=e.content.findIndex(t.from),o=r.index,i=r.offset;return i==t.from&&!(n=e.child(o)).isText&&i+n.nodeSize==t.to}},{key:"eq",value:function(t){return this==t||t instanceof e&&qt(this.attrs,t.attrs)&&qt(this.spec,t.spec)}},{key:"destroy",value:function(){}}]),e}(),Xt=function(){function e(t,n,r){p(this,e),this.from=t,this.to=n,this.type=r}return v(e,[{key:"copy",value:function(t,n){return new e(t,n,this.type)}},{key:"eq",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}},{key:"map",value:function(e,t,n){return this.type.map(e,this,t,n)}},{key:"spec",get:function(){return this.type.spec}},{key:"inline",get:function(){return this.type instanceof Ut}},{key:"widget",get:function(){return this.type instanceof Jt}}],[{key:"widget",value:function(t,n,r){return new e(t,t,new Jt(n,r))}},{key:"inline",value:function(t,n,r,o){return new e(t,n,new Ut(r,o))}},{key:"node",value:function(t,n,r,o){return new e(t,n,new Gt(r,o))}}]),e}(),Yt=[],Qt={},Zt=function(){function e(t,n){p(this,e),this.local=t.length?t:Yt,this.children=n.length?n:Yt}return v(e,[{key:"find",value:function(e,t,n){var r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}},{key:"findInner",value:function(e,t,n,r,o){for(var i=0;i<this.local.length;i++){var a=this.local[i];a.from<=t&&a.to>=e&&(!o||o(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){var l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,n,r+l,o)}}},{key:"map",value:function(e,t,n){return this==en||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Qt)}},{key:"mapInner",value:function(t,n,r,o,i){for(var a,s=0;s<this.local.length;s++){var l=this.local[s].map(t,r,o);l&&l.type.valid(n,l)?(a||(a=[])).push(l):i.onRemove&&i.onRemove(this.local[s].spec)}return this.children.length?nn(this.children,a||[],t,n,r,o,i):a?new e(a.sort(ln),Yt):en}},{key:"add",value:function(t,n){return n.length?this==en?e.create(t,n):this.addInner(t,n,0):this}},{key:"addInner",value:function(t,n,r){var o,i=this,a=0;t.forEach((function(e,t){var s,l=t+r;if(s=on(n,e,l)){for(o||(o=i.children.slice());a<o.length&&o[a]<t;)a+=3;o[a]==t?o[a+2]=o[a+2].addInner(e,s,l+1):o.splice(a,0,t,t+e.nodeSize,sn(s,e,l+1,Qt)),a+=3}}));for(var s=rn(a?an(n):n,-r),l=0;l<s.length;l++)s[l].type.valid(t,s[l])||s.splice(l--,1);return new e(s.length?this.local.concat(s).sort(ln):this.local,o||this.children)}},{key:"remove",value:function(e){return 0==e.length||this==en?this:this.removeInner(e,0)}},{key:"removeInner",value:function(t,n){for(var r=this.children,o=this.local,i=0;i<r.length;i+=3){for(var a,s=void 0,l=r[i]+n,c=r[i+1]+n,u=0;u<t.length;u++)(a=t[u])&&a.from>l&&a.to<c&&(t[u]=null,(s||(s=[])).push(a));if(s){r==this.children&&(r=this.children.slice());var f=r[i+2].removeInner(s,l+1);f!=en?r[i+2]=f:(r.splice(i,3),i-=3)}}if(o.length)for(var d,h=0;h<t.length;h++)if(d=t[h])for(var p=0;p<o.length;p++)o[p].eq(d,n)&&(o==this.local&&(o=this.local.slice()),o.splice(p--,1));return r==this.children&&o==this.local?this:o.length||r.length?new e(o,r):en}},{key:"forChild",value:function(t,n){if(this==en)return this;if(n.isLeaf)return e.empty;for(var r,o,i=0;i<this.children.length;i+=3)if(this.children[i]>=t){this.children[i]==t&&(r=this.children[i+2]);break}for(var a=t+1,s=a+n.content.size,l=0;l<this.local.length;l++){var c=this.local[l];if(c.from<s&&c.to>a&&c.type instanceof Ut){var u=Math.max(a,c.from)-a,f=Math.min(s,c.to)-a;u<f&&(o||(o=[])).push(c.copy(u,f))}}if(o){var d=new e(o.sort(ln),Yt);return r?new tn([d,r]):d}return r||en}},{key:"eq",value:function(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(var r=0;r<this.children.length;r+=3)if(this.children[r]!=t.children[r]||this.children[r+1]!=t.children[r+1]||!this.children[r+2].eq(t.children[r+2]))return!1;return!0}},{key:"locals",value:function(e){return cn(this.localsInner(e))}},{key:"localsInner",value:function(e){if(this==en)return Yt;if(e.inlineContent||!this.local.some(Ut.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Ut||t.push(this.local[n]);return t}},{key:"forEachSet",value:function(e){e(this)}}],[{key:"create",value:function(e,t){return t.length?sn(t,e,0,Qt):en}}]),e}();Zt.empty=new Zt([],[]),Zt.removeOverlap=cn;var en=Zt.empty,tn=function(){function e(t){p(this,e),this.members=t}return v(e,[{key:"map",value:function(t,n){var r=this.members.map((function(e){return e.map(t,n,Qt)}));return e.from(r)}},{key:"forChild",value:function(t,n){if(n.isLeaf)return Zt.empty;for(var r=[],o=0;o<this.members.length;o++){var i=this.members[o].forChild(t,n);i!=en&&(i instanceof e?r=r.concat(i.members):r.push(i))}return e.from(r)}},{key:"eq",value:function(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(var n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}},{key:"locals",value:function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(var i=0;i<o.length;i++)t.push(o[i])}else t=o}return t?cn(n?t:t.sort(ln)):Yt}},{key:"forEachSet",value:function(e){for(var t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}],[{key:"from",value:function(t){switch(t.length){case 0:return en;case 1:return t[0];default:return new e(t.every((function(e){return e instanceof Zt}))?t:t.reduce((function(e,t){return e.concat(t instanceof Zt?t:t.members)}),[]))}}}]),e}();function nn(e,t,n,r,o,i,a){for(var s=e.slice(),l=function(e){var t=0;n.maps[c].forEach((function(n,r,o,i){for(var a=i-o-(r-n),l=0;l<s.length;l+=3){var c=s[l+1];if(!(c<0||n>c+e-t)){var u=s[l]+e-t;r>=u?s[l+1]=n<=u?-2:-1:n>=e&&a&&(s[l]+=a,s[l+1]+=a)}}t+=a})),e=n.maps[c].map(e,-1),u=e},c=0,u=i;c<n.maps.length;c++)l(u);for(var f=!1,d=0;d<s.length;d+=3)if(s[d+1]<0){if(-2==s[d+1]){f=!0,s[d+1]=-1;continue}var h=n.map(e[d]+i),p=h-o;if(p<0||p>=r.content.size){f=!0;continue}var m=n.map(e[d+1]+i,-1)-o,v=r.content.findIndex(p),g=v.index,y=v.offset,b=r.maybeChild(g);if(b&&y==p&&y+b.nodeSize==m){var w=s[d+2].mapInner(n,b,h+1,e[d]+i+1,a);w!=en?(s[d]=p,s[d+1]=m,s[d+2]=w):(s[d+1]=-2,f=!0)}else f=!0}if(f){var k=function(e,t,n,r,o,i,a){function s(e,t){for(var i=0;i<e.local.length;i++){var l=e.local[i].map(r,o,t);l?n.push(l):a.onRemove&&a.onRemove(e.local[i].spec)}for(var c=0;c<e.children.length;c+=3)s(e.children[c+2],e.children[c]+t+1)}for(var l=0;l<e.length;l+=3)-1==e[l+1]&&s(e[l+2],t[l]+i+1);return n}(s,e,t,n,o,i,a),S=sn(k,r,0,a);t=S.local;for(var x=0;x<s.length;x+=3)s[x+1]<0&&(s.splice(x,3),x-=3);for(var C=0,O=0;C<S.children.length;C+=3){for(var M=S.children[C];O<s.length&&s[O]<M;)O+=3;s.splice(O,0,S.children[C],S.children[C+1],S.children[C+2])}}return new Zt(t.sort(ln),s)}function rn(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var o=e[r];n.push(new Xt(o.from+t,o.to+t,o.type))}return n}function on(e,t,n){if(t.isLeaf)return null;for(var r,o=n+t.nodeSize,i=null,a=0;a<e.length;a++)(r=e[a])&&r.from>n&&r.to<o&&((i||(i=[])).push(r),e[a]=null);return i}function an(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function sn(e,t,n,r){var o=[],i=!1;t.forEach((function(t,a){var s=on(e,t,a+n);if(s){i=!0;var l=sn(s,t,n+a+1,r);l!=en&&o.push(a,a+t.nodeSize,l)}}));for(var a=rn(i?an(e):e,-n).sort(ln),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||o.length?new Zt(a,o):en}function ln(e,t){return e.from-t.from||e.to-t.to}function cn(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var o=n+1;o<t.length;o++){var i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),un(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),un(t,o+1,i.copy(r.to,i.to)))}}return t}function un(e,t,n){for(;t<e.length&&ln(n,e[t])>0;)t++;e.splice(t,0,n)}function fn(e){var t=[];return e.someProp("decorations",(function(n){var r=n(e.state);r&&r!=en&&t.push(r)})),e.cursorWrapper&&t.push(Zt.create(e.state.doc,[e.cursorWrapper.deco])),tn.from(t)}var dn={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},hn=j&&F<=11,pn=function(){function e(){p(this,e),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return v(e,[{key:"set",value:function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}},{key:"clear",value:function(){this.anchorNode=this.focusNode=null}},{key:"eq",value:function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}]),e}(),mn=function(){function e(t,n){var r=this;p(this,e),this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new pn,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver((function(e){for(var t=0;t<e.length;t++)r.queue.push(e[t]);j&&F<=11&&e.some((function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length}))?r.flushSoon():r.flush()})),hn&&(this.onCharData=function(e){r.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),r.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}return v(e,[{key:"flushSoon",value:function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){e.flushingSoon=-1,e.flush()}),20))}},{key:"forceFlush",value:function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}},{key:"start",value:function(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,dn)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}},{key:"stop",value:function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout((function(){return e.flush()}),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}},{key:"connectSelection",value:function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}},{key:"disconnectSelection",value:function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"suppressSelectionUpdates",value:function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return e.suppressingSelectionUpdates=!1}),50)}},{key:"onSelectionChange",value:function(){if(Ge(this.view)){if(this.suppressingSelectionUpdates)return Le(this.view);if(j&&F<=11&&!this.view.state.selection.empty){var e=this.view.domSelectionRange();if(e.focusNode&&C(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}},{key:"setCurSelection",value:function(){this.currentSelection.set(this.view.domSelectionRange())}},{key:"ignoreSelectionChange",value:function(e){if(!e.focusNode)return!0;for(var t,n=new Set,r=e.focusNode;r;r=k(r))n.add(r);for(var o=e.anchorNode;o;o=k(o))if(n.has(o)){t=o;break}var i=t&&this.view.docView.nearestDesc(t);return i&&i.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}},{key:"pendingRecords",value:function(){if(this.observer){var e,t=o(this.observer.takeRecords());try{for(t.s();!(e=t.n()).done;){var n=e.value;this.queue.push(n)}}catch(e){t.e(e)}finally{t.f()}}return this.queue}},{key:"flush",value:function(){var e=this.view;if(e.docView&&!(this.flushingSoon>-1)){var t=this.pendingRecords();t.length&&(this.queue=[]);var n=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Ge(e)&&!this.ignoreSelectionChange(n),a=-1,s=-1,l=!1,c=[];if(e.editable)for(var u=0;u<t.length;u++){var f=this.registerMutation(t[u],c);f&&(a=a<0?f.from:Math.min(f.from,a),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if(B&&c.length){var d=c.filter((function(e){return"BR"==e.nodeName}));if(2==d.length){var h=r(d,2),p=h[0],m=h[1];p.parentNode&&p.parentNode.parentNode==m.parentNode?m.remove():p.remove()}else{var v,y=this.currentSelection.focusNode,b=o(d);try{for(b.s();!(v=b.n()).done;){var w=v.value,k=w.parentNode;!k||"LI"!=k.nodeName||y&&bn(e,y)==k||w.remove()}}catch(e){b.e(e)}finally{b.f()}}}var S=null;a<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&N(n)&&(S=Be(e))&&S.eq(g.Selection.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Le(e),this.currentSelection.set(n),e.scrollToSelection()):(a>-1||i)&&(a>-1&&(e.docView.markDirty(a,s),function(e){if(!vn.has(e)&&(vn.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=B,gn)return;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."),gn=!0}}(e)),this.handleDOMChange(a,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Le(e),this.currentSelection.set(n))}}},{key:"registerMutation",value:function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var r=0;r<e.addedNodes.length;r++){var o=e.addedNodes[r];t.push(o),3==o.nodeType&&(this.lastChangedTextNode=o)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var i=e.previousSibling,a=e.nextSibling;if(j&&F<=11&&e.addedNodes.length)for(var s=0;s<e.addedNodes.length;s++){var l=e.addedNodes[s],c=l.previousSibling,u=l.nextSibling;(!c||Array.prototype.indexOf.call(e.addedNodes,c)<0)&&(i=c),(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(a=u)}var f=i&&i.parentNode==e.target?w(i)+1:0,d=n.localPosFromDOM(e.target,f,-1),h=a&&a.parentNode==e.target?w(a):e.target.childNodes.length;return{from:d,to:n.localPosFromDOM(e.target,h,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}]),e}(),vn=new WeakMap,gn=!1;function yn(e,t){var n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,a=e.domAtPos(e.state.selection.anchor);if(C(a.node,a.offset,o,i)){var s=[o,i,n,r];n=s[0],r=s[1],o=s[2],i=s[3]}return{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function bn(e,t){for(var n=t.parentNode;n&&n!=e.dom;n=n.parentNode){var r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function wn(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(K&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||K&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}var kn=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Sn(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Ue(e,t.resolve(n.anchor),t.resolve(n.head))}function xn(e,t,n){for(var r=e.depth,o=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n)for(var i=e.node(r).maybeChild(e.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function Cn(e){if(2!=e.length)return!1;var t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var On=ct,Mn=ut,Tn=Bt,An=function(){function e(t,n){var r=this;p(this,e),this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new xt,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(En),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):"function"==typeof t?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=Dn(this),Rn(this),this.nodeViews=_n(this),this.docView=xe(this.state.doc,Nn(this),fn(this),this.dom,this),this.domObserver=new mn(this,(function(e,t,n,o){return function(e,t,n,r,o){var i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){var a=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,s=Be(e,a);if(s&&!e.state.selection.eq(s)){if(L&&J&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(function(t){return t(e,R(13,"Enter"))})))return;var l=e.state.tr.setSelection(s);"pointer"==a?l.setMeta("pointer",!0):"key"==a&&l.scrollIntoView(),i&&l.setMeta("composition",i),e.dispatch(l)}}else{var c=e.state.doc.resolve(t),u=c.sharedDepth(n);t=c.before(u+1),n=e.state.doc.resolve(n).after(u+1);var f,d,h=e.state.selection,p=function(e,t,n){var r,o=e.docView.parseRange(t,n),i=o.node,a=o.fromOffset,s=o.toOffset,l=o.from,c=o.to,u=e.domSelectionRange(),f=u.anchorNode;if(f&&e.dom.contains(1==f.nodeType?f:f.parentNode)&&(r=[{node:f,offset:u.anchorOffset}],N(u)||r.push({node:u.focusNode,offset:u.focusOffset})),L&&8===e.input.lastKeyCode)for(var d=s;d>a;d--){var h=i.childNodes[d-1],p=h.pmViewDesc;if("BR"==h.nodeName&&!p){s=d;break}if(!p||p.size)break}var m=e.state.doc,v=e.someProp("domParser")||y.DOMParser.fromSchema(e.state.schema),g=m.resolve(l),b=null,w=v.parse(i,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:a,to:s,preserveWhitespace:"pre"!=g.parent.type.whitespace||"full",findPositions:r,ruleFromNode:wn,context:g});if(r&&null!=r[0].pos){var k=r[0].pos,S=r[1]&&r[1].pos;null==S&&(S=k),b={anchor:k+l,head:S+l}}return{doc:w,sel:b,from:l,to:c}}(e,t,n),m=e.state.doc,v=m.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,d="end"):(f=e.state.selection.from,d="start"),e.input.lastKeyCode=null;var b=function(e,t,n,r,o){var i=e.findDiffStart(t,n);if(null==i)return null;var a=e.findDiffEnd(t,n+e.size,n+t.size),s=a.a,l=a.b;if("end"==o&&(r-=s+Math.max(0,i-Math.min(s,l))-i),s<i&&e.size<t.size){var c=r<=i&&r>=s?i-r:0;(i-=c)&&i<t.size&&Cn(t.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-s),s=i}else if(l<i){var u=r<=i&&r>=l?i-r:0;(i-=u)&&i<e.size&&Cn(e.textBetween(i-1,i+1))&&(i+=u?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}(v.content,p.doc.content,p.from,f,d);if(b&&e.input.domChangeCount++,(H&&e.input.lastIOSEnter>Date.now()-225||J)&&o.some((function(e){return 1==e.nodeType&&!kn.test(e.nodeName)}))&&(!b||b.endA>=b.endB)&&e.someProp("handleKeyDown",(function(t){return t(e,R(13,"Enter"))})))e.input.lastIOSEnter=0;else{if(!b){if(!(r&&h instanceof g.TextSelection&&!h.empty&&h.$head.sameParent(h.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){var w=Sn(e,e.state.doc,p.sel);if(w&&!w.eq(e.state.selection)){var k=e.state.tr.setSelection(w);i&&k.setMeta("composition",i),e.dispatch(k)}}return}b={start:h.from,endA:h.to,endB:h.to}}e.state.selection.from<e.state.selection.to&&b.start==b.endB&&e.state.selection instanceof g.TextSelection&&(b.start>e.state.selection.from&&b.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?b.start=e.state.selection.from:b.endA<e.state.selection.to&&b.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(b.endB+=e.state.selection.to-b.endA,b.endA=e.state.selection.to)),j&&F<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>p.from&&" "==p.doc.textBetween(b.start-p.from-1,b.start-p.from+1)&&(b.start--,b.endA--,b.endB--);var S,x=p.doc.resolveNoCache(b.start-p.from),C=p.doc.resolveNoCache(b.endB-p.from),O=m.resolve(b.start),M=x.sameParent(C)&&x.parent.inlineContent&&O.end()>=b.endA;if((H&&e.input.lastIOSEnter>Date.now()-225&&(!M||o.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName})))||!M&&x.pos<p.doc.content.size&&!x.sameParent(C)&&(S=g.Selection.findFrom(p.doc.resolve(x.pos+1),1,!0))&&S.head==C.pos)&&e.someProp("handleKeyDown",(function(t){return t(e,R(13,"Enter"))})))e.input.lastIOSEnter=0;else if(e.state.selection.anchor>b.start&&function(e,t,n,r,o){if(n-t<=o.pos-r.pos||xn(r,!0,!1)<o.pos)return!1;var i=e.resolve(t);if(!r.parent.isTextblock){var a=i.nodeAfter;return null!=a&&n==t+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;var s=e.resolve(xn(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||xn(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(m,b.start,b.endA,x,C)&&e.someProp("handleKeyDown",(function(t){return t(e,R(8,"Backspace"))})))J&&L&&e.domObserver.suppressSelectionUpdates();else{L&&J&&b.endB==b.start&&(e.input.lastAndroidDelete=Date.now()),J&&!M&&x.start()!=C.start()&&0==C.parentOffset&&x.depth==C.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==b.endA&&(b.endB-=2,C=p.doc.resolveNoCache(b.endB-p.from),setTimeout((function(){e.someProp("handleKeyDown",(function(t){return t(e,R(13,"Enter"))}))}),20));var T,A,D,_=b.start,E=b.endA;if(M)if(x.pos==C.pos)j&&F<=11&&0==x.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((function(){return Le(e)}),20)),T=e.state.tr.delete(_,E),A=m.resolve(b.start).marksAcross(m.resolve(b.endA));else if(b.endA==b.endB&&(D=function(e,t){for(var n,r,o,i=e.firstChild.marks,a=t.firstChild.marks,s=i,l=a,c=0;c<a.length;c++)s=a[c].removeFromSet(s);for(var u=0;u<i.length;u++)l=i[u].removeFromSet(l);if(1==s.length&&0==l.length)r=s[0],n="add",o=function(e){return e.mark(r.addToSet(e.marks))};else{if(0!=s.length||1!=l.length)return null;r=l[0],n="remove",o=function(e){return e.mark(r.removeFromSet(e.marks))}}for(var f=[],d=0;d<t.childCount;d++)f.push(o(t.child(d)));if(y.Fragment.from(f).eq(e))return{mark:r,type:n}}(x.parent.content.cut(x.parentOffset,C.parentOffset),O.parent.content.cut(O.parentOffset,b.endA-O.start()))))T=e.state.tr,"add"==D.type?T.addMark(_,E,D.mark):T.removeMark(_,E,D.mark);else if(x.parent.child(x.index()).isText&&x.index()==C.index()-(C.textOffset?0:1)){var P=x.parent.textBetween(x.parentOffset,C.parentOffset);if(e.someProp("handleTextInput",(function(t){return t(e,_,E,P)})))return;T=e.state.tr.insertText(P,_,E)}if(T||(T=e.state.tr.replace(_,E,p.doc.slice(b.start-p.from,b.endB-p.from))),p.sel){var z=Sn(e,T.doc,p.sel);z&&!(L&&J&&e.composing&&z.empty&&(b.start!=b.endB||e.input.lastAndroidDelete<Date.now()-100)&&(z.head==_||z.head==T.mapping.map(E)-1)||j&&z.empty&&z.head==_)&&T.setSelection(z)}A&&T.ensureMarks(A),i&&T.setMeta("composition",i),e.dispatch(T.scrollIntoView())}}}}(r,e,t,n,o)})),this.domObserver.start(),function(e){var t=function(){var t=wt[n];e.dom.addEventListener(n,e.input.eventHandlers[n]=function(n){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,n)||Mt(e,n)||!e.editable&&n.type in kt||t(e,n)},St[n]?{passive:!0}:void 0)};for(var n in wt)t();K&&e.dom.addEventListener("input",(function(){return null})),Ot(e)}(this),this.updatePluginViews()}return v(e,[{key:"composing",get:function(){return this.input.composing}},{key:"props",get:function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}},{key:"update",value:function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ot(this);var t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(En),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}},{key:"setProps",value:function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)}},{key:"updateState",value:function(e){this.updateStateInner(e,this._props)}},{key:"updateStateInner",value:function(e,t){var n,r=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(Ft(this),i=!0),this.state=e;var a=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){var s=_n(this);(function(e,t){var n=0,r=0;for(var o in e){if(e[o]!=t[o])return!0;n++}for(var i in t)r++;return n!=r})(s,this.nodeViews)&&(this.nodeViews=s,o=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ot(this),this.editable=Dn(this),Rn(this);var l=fn(this),c=Nn(this),u=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",f=o||!this.docView.matchesNode(e.doc,c,l);!f&&e.selection.eq(r.selection)||(i=!0);var d,h,p,m,v,g,y,b,k,S,x="preserve"==u&&i&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,a=o+1;a<Math.min(innerHeight,r.bottom);a+=5){var s=e.root.elementFromPoint(i,a);if(s&&s!=e.dom&&e.dom.contains(s)){var l=s.getBoundingClientRect();if(l.top>=o-20){t=s,n=l.top;break}}}return{refDOM:t,refTop:n,stack:ee(e.dom)}}(this);if(i){this.domObserver.stop();var O=f&&(j||L)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&(m=r.selection,v=e.selection,g=Math.min(m.$anchor.sharedDepth(m.head),v.$anchor.sharedDepth(v.head)),m.$anchor.start(g)!=v.$anchor.start(g));if(f){var M=L?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){var t=e.domSelectionRange();if(!t.focusNode)return null;var n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=T(e=e.childNodes[t-1])}else{if(!e.parentNode||A(e))return null;t=w(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||A(e))return null;t=w(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){var o=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(e.input.compositionNode==r){var a=n.pmViewDesc;if(a&&a.isText(n.nodeValue))return r}}return n||r}(this)),!o&&this.docView.update(e.doc,c,l,this)||(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=xe(e.doc,c,l,this.dom,this)),M&&!this.trackWrites&&(O=!0)}O||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(d=this,h=d.docView.domFromPos(d.state.selection.anchor,0),p=d.domSelectionRange(),C(h.node,h.offset,p.anchorNode,p.anchorOffset)))?Le(this,O):(qe(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==u?this.dom.scrollTop=0:"to selection"==u?this.scrollToSelection():x&&(b=(y=x).refDOM,k=y.refTop,te(y.stack,0==(S=b?b.getBoundingClientRect().top:0)?0:S-k))}},{key:"scrollToSelection",value:function(){var e=this,t=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(function(t){return t(e)})));else if(this.state.selection instanceof g.NodeSelection){var n=this.docView.domAfterPos(this.state.selection.from);1==n.nodeType&&Z(this,n.getBoundingClientRect(),t)}else Z(this,this.coordsAtPos(this.state.selection.head,1),t)}},{key:"destroyPluginViews",value:function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()}},{key:"updatePluginViews",value:function(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var r=0;r<this.directPlugins.length;r++){var o=this.directPlugins[r];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(var i=0;i<this.state.plugins.length;i++){var a=this.state.plugins[i];a.spec.view&&this.pluginViews.push(a.spec.view(this))}}}},{key:"updateDraggedNode",value:function(e,t){var n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{var o=n.from+(this.state.doc.content.size-t.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==n.node&&(r=o)}this.dragging=new Kt(e.slice,e.move,r<0?void 0:g.NodeSelection.create(this.state.doc,r))}},{key:"someProp",value:function(e,t){var n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(var o=0;o<this.directPlugins.length;o++){var i=this.directPlugins[o].props[e];if(null!=i&&(n=t?t(i):i))return n}var a=this.state.plugins;if(a)for(var s=0;s<a.length;s++){var l=a[s].props[e];if(null!=l&&(n=t?t(l):l))return n}}},{key:"hasFocus",value:function(){if(j){var e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}},{key:"focus",value:function(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(ne)return e.focus(ne);var t=ee(e);e.focus(null==ne?{get preventScroll(){return ne={preventScroll:!0},!0}}:void 0),ne||(ne=!1,te(t,0))}(this.dom),Le(this),this.domObserver.start()}},{key:"root",get:function(){var e=this,t=this._root;if(null==t)for(var n,r=function(t){if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return t.ownerDocument.getSelection()}),{v:e._root=t}},o=this.dom.parentNode;o;o=o.parentNode)if(n=r(o))return n.v;return t||document}},{key:"updateRoot",value:function(){this._root=null}},{key:"posAtCoords",value:function(e){return ae(this,e)}},{key:"coordsAtPos",value:function(e){return ue(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)}},{key:"domAtPos",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.domFromPos(e,t)}},{key:"nodeDOM",value:function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null}},{key:"posAtDOM",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}},{key:"endOfTextblock",value:function(e,t){return function(e,t,n){return me==t&&ve==n?ge:(me=t,ve=n,ge="up"==n||"down"==n?function(e,t,n){var r=t.selection,o="up"==n?r.$from:r.$to;return he(e,t,(function(){for(var t=e.docView.domFromPos(o.pos,"up"==n?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.contentDOM||r.dom;break}t=r.dom.parentNode}for(var i=ue(e,o.pos,1),a=t.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=x(a,0,a.nodeValue.length).getClientRects()}for(var l=0;l<s.length;l++){var c=s[l];if(c.bottom>c.top+1&&("up"==n?i.top-c.top>2*(c.bottom-i.top):c.bottom-i.bottom>2*(i.bottom-c.top)))return!1}}return!0}))}(e,t,n):function(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,a=o==r.parent.content.size,s=e.domSelection();return s?pe.test(r.parent.textContent)&&s.modify?he(e,t,(function(){var t=e.domSelectionRange(),o=t.focusNode,i=t.focusOffset,a=t.anchorNode,l=t.anchorOffset,c=s.caretBidiLevel;s.modify("move",n,"character");var u=r.depth?e.docView.domAfterPos(r.before()):e.dom,f=e.domSelectionRange(),d=f.focusNode,h=f.focusOffset,p=d&&!u.contains(1==d.nodeType?d:d.parentNode)||o==d&&i==h;try{s.collapse(a,l),o&&(o!=a||i!=l)&&s.extend&&s.extend(o,i)}catch(e){}return null!=c&&(s.caretBidiLevel=c),p})):"left"==n||"backward"==n?i:a:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}},{key:"pasteHTML",value:function(e,t){return Lt(this,"",e,!1,t||new ClipboardEvent("paste"))}},{key:"pasteText",value:function(e,t){return Lt(this,e,null,!0,t||new ClipboardEvent("paste"))}},{key:"destroy",value:function(){this.docView&&(function(e){for(var t in e.domObserver.stop(),e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],fn(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,S=null)}},{key:"isDestroyed",get:function(){return null==this.docView}},{key:"dispatchEvent",value:function(e){return function(e,t){Mt(e,t)||!wt[t.type]||!e.editable&&t.type in kt||wt[t.type](e,t)}(this,e)}},{key:"dispatch",value:function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}},{key:"domSelectionRange",value:function(){var e=this.domSelection();return e?K&&11===this.root.nodeType&&function(e){for(var t=e.activeElement;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){var n=t.getComposedRanges(e.root)[0];if(n)return yn(e,n)}var r;function o(e){e.preventDefault(),e.stopImmediatePropagation(),r=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",o,!0),r?yn(e,r):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}},{key:"domSelection",value:function(){return this.root.getSelection()}}]),e}();function Nn(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var r in n)"class"==r?t.class+=" "+n[r]:"style"==r?t.style=(t.style?t.style+";":"")+n[r]:t[r]||"contenteditable"==r||"nodeName"==r||(t[r]=String(n[r]))})),t.translate||(t.translate="no"),[Xt.node(0,e.state.doc.content.size,t)]}function Rn(e){if(e.markCursor){var t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Xt.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Dn(e){return!e.someProp("editable",(function(t){return!1===t(e.state)}))}function _n(e){var t=Object.create(null);function n(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function En(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}t.Decoration=Xt,t.DecorationSet=Zt,t.EditorView=An,t.__endComposition=Tn,t.__parseFromClipboard=Mn,t.__serializeForClipboard=On},3958:e=>{var t=200,n=function(){};n.prototype.append=function(e){return e.length?(e=n.from(e),!this.length&&e||e.length<t&&this.leafAppend(e)||this.length<t&&e.leafPrepend(this)||this.appendInner(e)):this},n.prototype.prepend=function(e){return e.length?n.from(e).append(this):this},n.prototype.appendInner=function(e){return new o(this,e)},n.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?n.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},n.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},n.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},n.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},n.from=function(e){return e instanceof n?e:e&&e.length?new r(e):n.empty};var r=function(e){function n(t){e.call(this),this.values=t}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var r={length:{configurable:!0},depth:{configurable:!0}};return n.prototype.flatten=function(){return this.values},n.prototype.sliceInner=function(e,t){return 0==e&&t==this.length?this:new n(this.values.slice(e,t))},n.prototype.getInner=function(e){return this.values[e]},n.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},n.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},n.prototype.leafAppend=function(e){if(this.length+e.length<=t)return new n(this.values.concat(e.flatten()))},n.prototype.leafPrepend=function(e){if(this.length+e.length<=t)return new n(e.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(n.prototype,r),n}(n);n.empty=new r([]);var o=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(n);e.exports=n},6691:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});for(var n={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},r={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},o="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),i="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),a=0;a<10;a++)n[48+a]=n[96+a]=String(a);for(a=1;a<=24;a++)n[a+111]="F"+a;for(a=65;a<=90;a++)n[a]=String.fromCharCode(a+32),r[a]=String.fromCharCode(a);for(var s in n)r.hasOwnProperty(s)||(r[s]=n[s]);t.base=n,t.keyName=function(e){var t=!(o&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||i&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?r:n)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t},t.shift=r},7582:(e,t,n)=>{n.r(t),n.d(t,{__addDisposableResource:()=>z,__assign:()=>i,__asyncDelegator:()=>O,__asyncGenerator:()=>C,__asyncValues:()=>M,__await:()=>x,__awaiter:()=>p,__classPrivateFieldGet:()=>_,__classPrivateFieldIn:()=>P,__classPrivateFieldSet:()=>E,__createBinding:()=>v,__decorate:()=>s,__disposeResources:()=>j,__esDecorate:()=>c,__exportStar:()=>g,__extends:()=>o,__generator:()=>m,__importDefault:()=>D,__importStar:()=>R,__makeTemplateObject:()=>T,__metadata:()=>h,__param:()=>l,__propKey:()=>f,__read:()=>b,__rest:()=>a,__rewriteRelativeImportExtension:()=>F,__runInitializers:()=>u,__setFunctionName:()=>d,__spread:()=>w,__spreadArray:()=>S,__spreadArrays:()=>k,__values:()=>y,default:()=>B});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)};function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function s(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function l(e,t){return function(n,r){t(n,r,e)}}function c(e,t,n,r,o,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=r.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?r.static?e:e.prototype:null,f=t||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),d=!1,h=n.length-1;h>=0;h--){var p={};for(var m in r)p[m]="access"===m?{}:r[m];for(var m in r.access)p.access[m]=r.access[m];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var v=(0,n[h])("accessor"===l?{get:f.get,set:f.set}:f[c],p);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(s=a(v.get))&&(f.get=s),(s=a(v.set))&&(f.set=s),(s=a(v.init))&&o.unshift(s)}else(s=a(v))&&("field"===l?o.unshift(s):f[c]=s)}u&&Object.defineProperty(u,r.name,f),d=!0}function u(e,t,n){for(var r=arguments.length>2,o=0;o<t.length;o++)n=r?t[o].call(e,n):t[o].call(e);return r?n:void 0}function f(e){return"symbol"==typeof e?e:"".concat(e)}function d(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function p(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))}function m(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}var v=Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]};function g(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||v(t,e,n)}function y(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function b(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function w(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(b(arguments[t]));return e}function k(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}function S(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function x(e){return this instanceof x?(this.v=e,this):new x(e)}function C(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),i=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),r[Symbol.asyncIterator]=function(){return this},r;function a(e,t){o[e]&&(r[e]=function(t){return new Promise((function(n,r){i.push([e,t,n,r])>1||s(e,t)}))},t&&(r[e]=t(r[e])))}function s(e,t){try{(n=o[e](t)).value instanceof x?Promise.resolve(n.value.v).then(l,c):u(i[0][2],n)}catch(e){u(i[0][3],e)}var n}function l(e){s("next",e)}function c(e){s("throw",e)}function u(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function O(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,o){t[r]=e[r]?function(t){return(n=!n)?{value:x(e[r](t)),done:!1}:o?o(t):t}:o}}function M(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=y(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){!function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}(r,o,(t=e[n](t)).done,t.value)}))}}}function T(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var A=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},N=function(e){return N=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},N(e)};function R(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=N(e),r=0;r<n.length;r++)"default"!==n[r]&&v(t,e,n[r]);return A(t,e),t}function D(e){return e&&e.__esModule?e:{default:e}}function _(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function E(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}function P(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function z(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var r,o;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(void 0===r){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],n&&(o=r)}if("function"!=typeof r)throw new TypeError("Object not disposable.");o&&(r=function(){try{o.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}var I="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var r=new Error(n);return r.name="SuppressedError",r.error=e,r.suppressed=t,r};function j(e){function t(t){e.error=e.hasError?new I(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var n,r=0;return function o(){for(;n=e.stack.pop();)try{if(!n.async&&1===r)return r=0,e.stack.push(n),Promise.resolve().then(o);if(n.dispose){var i=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(i).then(o,(function(e){return t(e),o()}))}else r|=1}catch(e){t(e)}if(1===r)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function F(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,(function(e,n,r,o,i){return n?t?".jsx":".js":!r||o&&i?r+o+"."+i.toLowerCase()+"js":e})):e}const B={__extends:o,__assign:i,__rest:a,__decorate:s,__param:l,__esDecorate:c,__runInitializers:u,__propKey:f,__setFunctionName:d,__metadata:h,__awaiter:p,__generator:m,__createBinding:v,__exportStar:g,__values:y,__read:b,__spread:w,__spreadArrays:k,__spreadArray:S,__await:x,__asyncGenerator:C,__asyncDelegator:O,__asyncValues:M,__makeTemplateObject:T,__importStar:R,__importDefault:D,__classPrivateFieldGet:_,__classPrivateFieldSet:E,__classPrivateFieldIn:P,__addDisposableResource:z,__disposeResources:j,__rewriteRelativeImportExtension:F}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}return n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(6608)})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.KendoEditorCommon=t():e.KendoEditorCommon=t()}(self,(()=>(()=>{"use strict";var e={400:(e,t,n)=>{n.r(t),n.d(t,{browser:()=>d,detectDesktopBrowser:()=>u,detectMobileOS:()=>c,getter:()=>k,mobileOS:()=>h,msPointers:()=>m,parseInlineStyles:()=>_,pointers:()=>v,setter:()=>C,touch:()=>p,touchEnabled:()=>g});var r=function(){return"undefined"!=typeof window},o={wp:/(Windows Phone(?: OS)?)\s(\d+)\.(\d+(\.\d+)?)/,fire:/(Silk)\/(\d+)\.(\d+(\.\d+)?)/,android:/(Android|Android.*(?:Opera|Firefox).*?\/)\s*(\d+)(\.(\d+(\.\d+)?))?/,iphone:/(iPhone|iPod).*OS\s+(\d+)[\._]([\d\._]+)/,ipad:/(iPad).*OS\s+(\d+)[\._]([\d_]+)/,meego:/(MeeGo).+NokiaBrowser\/(\d+)\.([\d\._]+)/,webos:/(webOS)\/(\d+)\.(\d+(\.\d+)?)/,blackberry:/(BlackBerry|BB10).*?Version\/(\d+)\.(\d+(\.\d+)?)/,playbook:/(PlayBook).*?Tablet\s*OS\s*(\d+)\.(\d+(\.\d+)?)/,windows:/(MSIE)\s+(\d+)\.(\d+(\.\d+)?)/,tizen:/(tizen).*?Version\/(\d+)\.(\d+(\.\d+)?)/i,sailfish:/(sailfish).*rv:(\d+)\.(\d+(\.\d+)?).*firefox/i,ffos:/(Mobile).*rv:(\d+)\.(\d+(\.\d+)?).*Firefox/},i={ios:/^i(phone|pad|pod)$/i,android:/^android|fire$/i,blackberry:/^blackberry|playbook/i,windows:/windows/,wp:/wp/,flat:/sailfish|ffos|tizen/i,meego:/meego/},a={edge:/(edge)[ \/]([\w.]+)/i,webkit:/(chrome)[ \/]([\w.]+)/i,safari:/(webkit)[ \/]([\w.]+)/i,opera:/(opera)(?:.*version|)[ \/]([\w.]+)/i,msie:/(msie\s|trident.*? rv:)([\w.]+)/i,mozilla:/(mozilla)(?:.*? rv:([\w.]+)|)/i},s={omini:/Opera\sMini/i,omobile:/Opera\sMobi/i,firefox:/Firefox|Fennec/i,mobilesafari:/version\/.*safari/i,ie:/MSIE|Windows\sPhone/i,chrome:/chrome|crios/i,webkit:/webkit/i},l=function(e,t,n){for(var r in t)if(t.hasOwnProperty(r)&&t[r].test(e))return r;return void 0!==n?n:e},c=function(e){var t,n=[];for(var r in o)if(o.hasOwnProperty(r)){if(!(n=e.match(o[r])))continue;if("windows"===r&&"plugins"in window.navigator)return null;var a={};return a.device=r,a.browser=l(e,s,"default"),a.name=l(r,i),a[a.name]=!0,a.majorVersion=n[2],a.minorVersion=n[3]?n[3].replace("_","."):".0",t=a.minorVersion.replace(".","").substr(0,2),a.flatVersion=a.majorVersion+t+new Array(3-(t.length<3?t.length:2)).join("0"),a.cordova=void 0!==typeof window.PhoneGap||void 0!==typeof window.cordova,a.appMode=window.navigator.standalone||/file|local|wmapp/.test(window.location.protocol)||a.cordova,a}return null},u=function(e){var t=null,n=[];for(var r in a)if(a.hasOwnProperty(r)&&(n=e.match(a[r]))){(t={})[r]=!0,t[n[1].toLowerCase().split(" ")[0].split("/")[0]]=!0,t.version=parseInt(document.documentMode||n[2],10);break}return t},f=r()&&window.navigator?window.navigator.userAgent:null,d=f?u(f):null,h=f?c(f):null,p=r()&&"ontouchstart"in window,m=d&&!d.chrome&&window.MSPointerEvent,v=d&&!d.chrome&&window.PointerEvent,g=h&&(p||m||v),y=/\[(?:(\d+)|['"](.*?)['"])\]|((?:(?!\[.*?\]|\.).)+)/g;function b(e){var t=[];return e.replace(y,(function(e,n,r,o){t.push(void 0!==n?n:r||o)})),t}var w={};function k(e){if(w[e])return w[e];var t=b(e);return w[e]=function(e){for(var n=e,r=0;r<t.length&&n;r++)n=n[t[r]];return n},w[e]}w[void 0]=function(e){return e};var S={undefined:function(e){return e}},x=function(e,t){return t&&t.arrays&&!isNaN(Number(e))?[]:{}};function C(e){if(S[e])return S[e];var t=b(e);return S[e]=function(e,n,r){for(var o=e,i=t.length-1,a=0;a<i&&o;a++)o=o[t[a]]=o[t[a]]||x(t[a+1],r);o[t[i]]=n},S[e]}var O=/\/\*[\s\S]*?\*\//g,M=/([^\s:;]+?)\s*:\s*((?:(?:url\(\s*(?:(?:[^"')\\]|\\.)*|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')\s*\)|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[^;"'])*?)\s*)(?=;|$)/gi,T=/"|"|"/gi,A=/'|'|'/gi,N='"',R="'",D="";function _(e){for(var t,n,r={},o=(e||D).replace(O,D).replace(T,N).replace(A,R),i=M.exec(o);null!==i;)t=i[1].trim(),n=i[2].trim(),r[t]=n,i=M.exec(o);return r}},2066:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DOMSerializer=void 0;var r=n(3147),o=function(){function e(e,t){this.nodes=e,this.marks=t}return e.renderSpec=function(t,n,o){if(void 0===o&&(o=null),"string"==typeof n)return{dom:t.createTextNode(n)};if(null!=n.nodeType)return{dom:n};if(n.dom&&null!=n.dom.nodeType)return n;var i,a=n[0],s=a.indexOf(" ");s>0&&(o=a.slice(0,s),a=a.slice(s+1));var l=o?t.createElementNS(o,a):t.createElement(a),c=n[1],u=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c))for(var f in u=2,c)null!=c[f]&&((s=f.indexOf(" "))>0?l.setAttributeNS(f.slice(0,s),f.slice(s+1),c[f]):(0,r.setAttribute)(l,f,c[f]));for(var d=u;d<n.length;d++){var h=n[d];if(0===h){if(d<n.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}var p=e.renderSpec(t,h,o),m=p.dom,v=p.contentDOM;if(l.appendChild(m),v){if(i)throw new RangeError("Multiple content holes");i=v}}return{dom:l,contentDOM:i}},e.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))},e.nodesFromSchema=function(e){var t=i(e.nodes);return t.text||(t.text=function(e){return e.text}),t},e.marksFromSchema=function(e){return i(e.marks)},e.prototype.serializeFragment=function(e,t,n){var r=this;void 0===t&&(t={}),n||(n=a(t).createDocumentFragment());var o=n,i=[];return e.forEach((function(e){if(i.length||e.marks.length){for(var n=0,a=0;n<i.length&&a<e.marks.length;){var s=e.marks[a];if(r.marks[s.type.name]){if(!s.eq(i[n][0])||!1===s.type.spec.spanning)break;n++,a++}else a++}for(;n<i.length;)o=i.pop()[1];for(;a<e.marks.length;){var l=e.marks[a++],c=r.serializeMark(l,e.isInline,t);c&&(i.push([l,o]),o.appendChild(c.dom),o=c.contentDOM||c.dom)}}o.appendChild(r.serializeNodeInner(e,t))})),n},e.prototype.serializeNode=function(e,t){void 0===t&&(t={});for(var n=this.serializeNodeInner(e,t),r=e.marks.length-1;r>=0;r--){var o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},e.prototype.serializeMark=function(t,n,r){void 0===r&&(r={});var o=this.marks[t.type.name];return o&&e.renderSpec(a(r),o(t,n))},e.prototype.serializeNodeInner=function(t,n){var r=e.renderSpec(a(n),this.nodes[t.type.name](t)),o=r.dom,i=r.contentDOM;if(i){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,i)}return o},e}();function i(e){var t={};for(var n in e)if(e[n]){var r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function a(e){return e.document||window.document}t.DOMSerializer=o},510:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isAligned=t.alignBlocks=void 0;var r=n(452);t.alignBlocks=function(e,t){return function(n,o){var i=(0,r.blockNodes)(n),a=n.tr;a.setMeta("commandName",t),i.forEach((function(t){if(t.type.isTextblock){var n=e.find((function(e){return e.node===t.type.name}));if(n){var o=(0,r.addStyles)(t,n.style);(0,r.changeTextBlock)(a,t,t.type,o)}}}));var s=a.docChanged;return s&&o(a.scrollIntoView()),s}},t.isAligned=function(e,t){var n=(0,r.blockNodes)(e),o=!1;return n.forEach((function(e){if(!o&&e.type.isTextblock&&e.attrs.style){var n=t.find((function(t){return t.node===e.type.name}));n&&(o=n.style.every((function(t){return!!t.value&&new RegExp("".concat(t.name,":\\s?").concat(t.value),"i").test(e.attrs.style)})))}})),o}},452:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.activeNode=t.parentBlockFormat=t.hasNode=t.addStyles=t.getBlockFormats=t.cleanTextBlockFormatting=t.formatBlockElements=t.blockNodes=t.changeTextBlock=void 0;var r=n(7582),o=n(3147),i=n(2843),a=n(9443),s=n(2391);t.changeTextBlock=function(e,t,n,r){if(!n.isTextblock)return!1;e.selection.ranges.forEach((function(o){var s=e.steps.length,l=o.$from.pos,c=o.$to.pos;e.doc.nodesBetween(l,c,(function(o,l){if(o.eq(t)&&o.isTextblock&&!o.hasMarkup(n,r)&&function(e,t,n){var r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(s).map(l),n)){e.clearIncompatible(e.mapping.slice(s).map(l,1),n);var c=e.mapping.slice(s),u=c.map(l,1),f=c.map(l+o.nodeSize,1),d=new a.Slice(a.Fragment.from(n.create(r,null,o.marks)),0,0);return e.step(new i.ReplaceAroundStep(u,f,u+1,f-1,d,1,!0)),!1}}))}))},t.blockNodes=function(e,t){void 0===t&&(t={blocksInSelection:!1});var n=e.doc,r=e.selection,o=r.$from,i=r.ranges,a=t.blocksInSelection,l=[],c=r instanceof s.NodeSelection?r.node:void 0;return c?c.isBlock?(l.push(c),c.nodesBetween(0,c.content.size,(function(e){e.isBlock&&l.push(e)}))):!a&&o.parent&&o.parent.isBlock&&l.push(o.parent):i.forEach((function(e){var t=e.$from.pos,r=e.$to.pos;n.nodesBetween(t,r,(function(e,n){e.isBlock&&(!a||n>=t&&n+e.content.size+2<=r)&&l.push(e)}))})),l},t.formatBlockElements=function(e,n){return function(o,i){var a=(0,t.blockNodes)(o),s=o.schema.nodes,l=o.tr;l.setMeta("commandName",n),l.setMeta("args",{value:e}),a.forEach((function(n){if(n.type.isTextblock)if("p"===e)(0,t.changeTextBlock)(l,n,s.paragraph,n.attrs);else if(/^h[1-6]$/i.test(e)){var o=parseInt(e.substr(1),10);(0,t.changeTextBlock)(l,n,s.heading,r.__assign(r.__assign({},n.attrs),{level:o}))}else"blockquote"===e&&(0,t.changeTextBlock)(l,n,s.blockquote,n.attrs)}));var c=l.docChanged;return c&&i(l.scrollIntoView()),c}},t.cleanTextBlockFormatting=function(e,n){void 0===n&&(n={blocksInSelection:!0});var o=e.doc,i=e.selection,a=n.blocksInSelection,s=n.blockNodeType;(0,t.blockNodes)({doc:o,selection:i},{blocksInSelection:a}).filter((function(e){return e.isTextblock})).forEach((function(n){var o=n.attrs||{},i=o.style,a=void 0===i?"":i,l=o.class,c=void 0===l?"":l,u=r.__rest(o,["style","class"]),f=s||n.type;(a||c||f!==n.type)&&(0,t.changeTextBlock)(e,n,f,u)}))},t.getBlockFormats=function(e){var n=(0,t.blockNodes)(e),r=e.schema.nodes,o=[];return n.forEach((function(e){e.type===r.paragraph?o.push("p"):e.type===r.heading?o.push("h".concat(e.attrs.level)):e.type===r.blockquote&&r.blockquote.isTextblock&&o.push("blockquote")})),o},t.addStyles=function(e,t){var n,r,i=e.attrs.style;return i&&t.forEach((function(e){r={style:e.name,value:/^.+$/,newValue:e.value},n=(0,o.changeStylesString)(i,r),i=n.changed?n.style:i})),i=i||t.reduce((function(e,t){return(e&&t.value?e+" ":"")+t.value?"".concat(t.name,": ").concat(t.value,";"):""}),""),Object.assign({},e.attrs,{style:i||null})},t.hasNode=function(e,t){var n=e.selection,r=n.from,o=n.to,i=!1;return e.doc.nodesBetween(r,o,(function(e){return!(i=i||e.type===t)})),i},t.parentBlockFormat=function(e){var n=(0,t.getBlockFormats)(e);return 1===new Set(n).size?n[0]:null},t.activeNode=function(e){return{tag:(0,t.parentBlockFormat)(e)||""}}},8933:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.liftBlockquote=t.blockquote=void 0;var r=n(9270);t.blockquote=function(e,t){return(0,r.wrapIn)(e.schema.nodes.blockquote)(e,t)},t.liftBlockquote=function(e,t){var n=e.selection,r=n.$from,o=n.$to,i=e.schema.nodes.blockquote,a=e.doc,s=-1,l=r.blockRange(o);l&&a.nodesBetween(l.start,l.end,(function(e,t){e.type===i&&(s=t)}));var c=-1!==s;return t&&c&&t(e.tr.lift(l,a.resolve(s).depth)),c}},9840:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cleanFormatting=void 0;var r=n(452),o=n(1542);t.cleanFormatting=function(e){return void 0===e&&(e={blocksInSelection:!0}),function(t,n){var i=t.tr,a=e.blocksInSelection,s=e.blockNodeType,l=(e.exceptMarks||[t.schema.marks.link]).filter(Boolean);(0,o.cleanMarks)(i,{except:l}),(0,r.cleanTextBlockFormatting)(i,{blocksInSelection:a,blockNodeType:s});var c=i.docChanged;return c&&n&&n(i),c}}},89:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.alignRemoveRules=t.alignJustifyRules=t.alignCenterRules=t.alignRightRules=t.alignLeftRules=void 0;var n=function(e,t){return{name:e,value:t}};t.alignLeftRules=[{node:"paragraph",style:[n("text-align","left")]},{node:"heading",style:[n("text-align","left")]},{node:"table_caption_external",style:[n("text-align","left")]}],t.alignRightRules=[{node:"paragraph",style:[n("text-align","right")]},{node:"heading",style:[n("text-align","right")]},{node:"table_caption_external",style:[n("text-align","right")]}],t.alignCenterRules=[{node:"paragraph",style:[n("text-align","center")]},{node:"heading",style:[n("text-align","center")]},{node:"table_caption_external",style:[n("text-align","center")]}],t.alignJustifyRules=[{node:"paragraph",style:[n("text-align","justify")]},{node:"heading",style:[n("text-align","justify")]},{node:"table_caption_external",style:[n("text-align","justify")]}],t.alignRemoveRules=[{node:"paragraph",style:[n("text-align","")]},{node:"heading",style:[n("text-align","")]},{node:"table_caption_external",style:[n("text-align","")]}]},4437:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unlink=t.link=t.superscript=t.subscript=t.strikethrough=t.underline=t.italic=t.bold=void 0,t.bold={mark:"strong",altMarks:["b"],altStyle:{name:"font-weight",value:/^(bold(er)?|[5-9]\d{2,})$/}},t.italic={mark:"em",altMarks:["i"],altStyle:{name:"font-style",value:/^italic$/i}},t.underline={mark:"u",altStyle:{name:"text-decoration",value:/^underline$/i}},t.strikethrough={mark:"del",altStyle:{name:"text-decoration",value:/^line-through$/i}},t.subscript={mark:"sub"},t.superscript={mark:"sup"},t.link={mark:"link"},t.unlink={mark:"link"}},3352:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dataResizeDirImage=t.dataResizeDirTable=t.resizeHandle=t.resizableWrap=t.resizableAttr=t.colgroupAttr=t.rowTypeAttr=void 0,t.rowTypeAttr="k-parent-node",t.colgroupAttr="k-colgroup-data",t.resizableAttr="k-resizable-node",t.resizableWrap="k-editor-resize-wrap-element",t.resizeHandle="k-editor-resize-handle",t.dataResizeDirTable="data-dir-table-resize",t.dataResizeDirImage="data-dir-image-resize"},2287:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.outdentRules=t.indentRules=void 0;var r=n(7582),o=n(8672);t.indentRules={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"}],listsTypes:r.__assign({},o.listsTypes)},t.outdentRules={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"}],listsTypes:r.__assign({},o.listsTypes)}},2866:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.buildListKeymap=t.buildKeymap=void 0;var r=n(7582),o=n(9270),i=n(8638),a=n(8665),s=n(1641),l=n(4437),c=n(3884),u=n(3147),f="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);t.buildKeymap=function(e,t){var n={},s=t&&t.applyToWord||!1;if(n["Mod-z"]=i.undo,n["Shift-Mod-z"]=i.redo,n.Backspace=(0,o.chainCommands)(a.undoInputRule,o.deleteSelection,o.joinBackward,o.selectNodeBackward),n.Enter=(0,o.chainCommands)(o.newlineInCode,o.createParagraphNear,o.liftEmptyBlock,o.splitBlockKeepMarks),f||(n["Mod-y"]=i.redo),e.marks.strong&&(n["Mod-b"]=(0,u.expandToWordWrap)(c.toggleInlineFormat,r.__assign(r.__assign({},l.bold),{applyToWord:s}))),e.marks.em&&(n["Mod-i"]=(0,u.expandToWordWrap)(c.toggleInlineFormat,r.__assign(r.__assign({},l.italic),{applyToWord:s}))),e.marks.u&&(n["Mod-u"]=(0,u.expandToWordWrap)(c.toggleInlineFormat,r.__assign(r.__assign({},l.underline),{applyToWord:s}))),e.nodes.hard_break){var d=e.nodes.hard_break,h=(0,o.chainCommands)(o.exitCode,(function(e,t){return t(e.tr.replaceSelectionWith(d.create()).scrollIntoView()),!0}));n["Shift-Enter"]=h}return n},t.buildListKeymap=function(e){var t={};return e.nodes.list_item&&(t.Enter=(0,s.splitListItemKeepMarks)(e.nodes.list_item)),t}},8672:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bulletList=t.orderedList=t.listsTypes=void 0;var r=n(7582);t.listsTypes={orderedList:"ordered_list",bulletList:"bullet_list",listItem:"list_item"},t.orderedList={listType:t.listsTypes.orderedList,types:r.__assign({},t.listsTypes)},t.bulletList={listType:t.listsTypes.bulletList,types:r.__assign({},t.listsTypes)}},4221:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.marks=t.nodes=t.parseStrColgroup=void 0;var r=n(7582),o=n(9443),i=n(1640),a=n(5643),s=n(3352),l=["blockquote",0],c=["hr"],u=["pre",["code",0]],f=["ol",0],d=["ul",0],h=["li",0],p=function(e){for(var t,n={},r=e.attributes,o=0;o<r.length;o++)n[(t=r[o]).name]=t.value;return n},m=function(e){var t={};return e.forEach((function(e){t[e]={default:null}})),t},v=function(){return m(["style","class","id"])},g=function(e,t){for(var n in e)if(n&&null!==e[n]&&n!==t)return!0;return!1},y=function(e,t){void 0===t&&(t=[]);var n={},r=function(r){r&&null!==e[r]&&!t.find((function(e){return e===r}))&&(n[r]=e[r])};for(var o in e)r(o);return n},b=function(e){var t;return(t={})[e]={name:e,inclusive:!0,parseDOM:[{tag:e}],toDOM:function(){return[e,0]}},t},w=r.__assign(r.__assign(r.__assign(r.__assign(r.__assign(r.__assign(r.__assign(r.__assign(r.__assign(r.__assign({link:{attrs:r.__assign(r.__assign({},v()),{href:{default:null},target:{default:null},title:{default:null}}),inclusive:!1,parseDOM:[{tag:"a",getAttrs:p}],toDOM:function(e){return["a",y(e.attrs),0]}}},b("strong")),b("b")),b("em")),b("i")),b("del")),b("sub")),b("sup")),b("code")),{style:{attrs:r.__assign({},v()),parseDOM:[{tag:"span",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["span",y(e.attrs),0]:["span",0]}}}),b("u"));t.marks=w;var k=function(e){var t;return(t={})[e]={default:null,getFromDOM:function(t){return t.getAttribute(e)},setDOMAttr:function(t,n){n[e]=t}},t},S=r.__assign(r.__assign(r.__assign(r.__assign(r.__assign({},k("style")),k("class")),k("id")),k("headers")),k("scope")),x={doc:{content:"colgroup*"},col:{attrs:m(["id","class","style","span"]),parseDOM:[{getAttrs:p,tag:"col"}],toDOM:function(e){return["col",e.attrs]}},colgroup:{attrs:m(["id","class","style","span"]),content:"col*",parseDOM:[{getAttrs:p,tag:"colgroup"}],toDOM:function(e){return["colgroup",e.attrs,0]}},text:{inline:!0,group:"inline"}},C=new o.Schema({nodes:x,marks:{}});t.parseStrColgroup=function(e){var t=(0,a.domToPmDoc)((0,a.htmlToFragment)(e),C,{preserveWhitespace:!1});return(0,a.pmDocToFragment)(t).firstChild};var O=(0,i.tableNodes)({tableGroup:"block",cellContent:"block+",cellAttributes:S});O.table_row.attrs=r.__assign(r.__assign({},O.table_row.attrs),m([s.rowTypeAttr,"style","class","id"])),O.table_row.toDOM=function(e){return["tr",y(e.attrs),0]},O.table_row.parseDOM=[{tag:"tr",getAttrs:p}],O.table.attrs=r.__assign(r.__assign({},O.table.attrs),m(["style","class","id",s.colgroupAttr,s.resizableAttr])),O.table.toDOM=function(e){var n=g(e.attrs)?y(e.attrs,[s.colgroupAttr,s.resizableAttr]):{},r=null;if(e.attrs[s.colgroupAttr]&&!function(e){for(var t=!1,n=e.child(0),r=0;r<n.childCount;r++)if(n.child(r).attrs.colwidth){t=!0;break}return t}(e)){var o=(0,t.parseStrColgroup)(e.attrs[s.colgroupAttr]);if(o){var i=Array.from(o.children).map((function(e){return["col",p(e)]}));r=["colgroup",p(o)].concat(i)}}return r?["table",n,r,["tbody",0]]:["table",n,["tbody",0]]},O.table.parseDOM=[{tag:"table",getAttrs:function(e){var t=p(e),n=Array.from(e.childNodes).find((function(e){return"COLGROUP"===e.nodeName}));return n&&(t[s.colgroupAttr]=n.outerHTML),t}}];var M=r.__assign({doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:r.__assign({},v()),parseDOM:[{tag:"p",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["p",y(e.attrs),0]:["p",0]}},table_wrapper:{content:"(table_caption_external | table)+",group:"block",defining:!0,attrs:{table:{default:null},style:{default:null}},parseDOM:[{tag:"div[table]",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["div",y(e.attrs),0]:["div",0]}},table_caption_external:{content:"inline+",group:"block",attrs:r.__assign({caption:{default:null}},v()),parseDOM:[{tag:"div[caption]",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["div",y(e.attrs),0]:["div",0]}},div:{content:"block*",group:"block",attrs:r.__assign({},v()),parseDOM:[{tag:"div",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["div",y(e.attrs),0]:["div",0]}},blockquote:{attrs:r.__assign({},v()),content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["blockquote",y(e.attrs),0]:l}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:function(){return c}},heading:{attrs:r.__assign(r.__assign({},v()),{level:{default:1}}),content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",getAttrs:function(e){return r.__assign(r.__assign({},p(e)),{level:1})}},{tag:"h2",getAttrs:function(e){return r.__assign(r.__assign({},p(e)),{level:2})}},{tag:"h3",getAttrs:function(e){return r.__assign(r.__assign({},p(e)),{level:3})}},{tag:"h4",getAttrs:function(e){return r.__assign(r.__assign({},p(e)),{level:4})}},{tag:"h5",getAttrs:function(e){return r.__assign(r.__assign({},p(e)),{level:5})}},{tag:"h6",getAttrs:function(e){return r.__assign(r.__assign({},p(e)),{level:6})}}],toDOM:function(e){return g(e.attrs,"level")?["h"+e.attrs.level,y(e.attrs,["level"]),0]:["h"+e.attrs.level,0]}},code_block:{content:"text*",marks:"",group:"block",code:!0,defining:!0,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM:function(){return u}},text:{inline:!0,group:"inline"},image:{inline:!0,attrs:r.__assign({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}},v()),group:"inline",draggable:!0,parseDOM:[{tag:"img",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["img",y(e.attrs)]:["img"]}},hard_break:{inline:!0,attrs:r.__assign({},v()),group:"inline",selectable:!1,parseDOM:[{tag:"br",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["br",y(e.attrs)]:["br"]}},ordered_list:{content:"list_item+",group:"block",attrs:r.__assign(r.__assign({},v()),{type:{default:null},order:{default:1}}),parseDOM:[{tag:"ol",getAttrs:function(e){return r.__assign(r.__assign({},p(e)),{order:e.hasAttribute("start")?parseInt(e.getAttribute("start")||"1",10):1})}}],toDOM:function(e){return 1===e.attrs.order?g(e.attrs,"order")?["ol",y(e.attrs,["order"]),0]:f:["ol",r.__assign(r.__assign({},y(e.attrs,["order"])),{start:e.attrs.order}),0]}},bullet_list:{content:"list_item+",group:"block",attrs:r.__assign({},v()),parseDOM:[{tag:"ul",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["ul",y(e.attrs),0]:d}},list_item:{content:"(paragraph | heading) block*",attrs:r.__assign({},v()),parseDOM:[{tag:"li",getAttrs:p}],toDOM:function(e){return g(e.attrs)?["li",y(e.attrs),0]:h},defining:!0}},O);t.nodes=M},2582:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.replaceAll=t.replace=t.findAll=t.find=t.findAt=void 0;var r=n(7582),o=n(2391);t.findAt=function(e,t,n,r,i){var l,c,u,f,d,h,p=[],m=[],v=t.matchCase,g=t.matchWord,y=t.useRegExp,b=t.text;if(y&&(/^\\$/.test(b)||/[^\\]\\$/.test(b))&&(b=b.substring(0,b.length-1)),!b)return p;var w=v?"g":"gi",k=y?new RegExp(b,w):s(b,w);return e.nodesBetween(n,r,(function(t,s){if(i(p))return!1;t.inlineContent&&s+t.content.size>=n&&(m.length=0,t.nodesBetween(0,t.content.size,(function(t,v,y,b){if(i(p))return!1;var w=1+s+v;if(t.isText&&w+t.nodeSize>=n){if(d=t.text||"",h=y.childCount-1>=b+1&&y.child(b+1),m.push(n<=w?{text:d,start:w}:{text:d.slice(n-w),start:n}),h&&h.isText)return;for(c=m.map((function(e){return e.text})).join(""),l=k.exec(c);null!==l&&(u=m[0].start+l.index,f=u+l[0].length,n<=u&&r>=f&&a(l,g)&&p.push(o.TextSelection.create(e,u,f)),!i(p));)l=k.exec(c)}else m.length=0})))})),p},t.find=function(e,n){var o=n.backward,i=n.matchCyclic,a=r.__rest(n,["backward","matchCyclic"]),s=o?function(){return!1}:function(e){return e.length>0},l=e.doc,c=e.selection,u=[];return o?!(u=(0,t.findAt)(l,a,0,c.from,s)).length&&i&&(u=(0,t.findAt)(l,a,c.from,l.content.size,s)):!(u=(0,t.findAt)(l,a,c.to,l.content.size,s)).length&&i&&(u=(0,t.findAt)(l,a,0,c.to,s)),u.length?u[u.length-1]:null},t.findAll=function(e,n){return(0,t.findAt)(e,n,0,e.content.size,(function(){return!1}))},t.replace=function(e,t,n){var r=e.from,i=e.to;return n.insertText(t,r,i).setSelection(o.TextSelection.create(n.doc,r,r+t.length)),n},t.replaceAll=function(e,n,r){var o=(0,t.findAll)(e.doc,r);if(0===o.length)return null;for(var i=e.tr,a=o.length-1;a>=0;a--)i.insertText(n,o[a].from,o[a].to);return i};var i=/^[\s0-9~`!@#$%\^&*\(\)_\-=+\\|\[\]{};:'"\?/.,<>]?$/,a=function(e,t){if(t){if(!0===t){var n=e.input,r=n.charAt(e.index-1),o=n.charAt(e.index+e[0].length);return i.test(r)&&i.test(o)}return t(e)}return!0},s=function(e,t){var n=e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d").replace(/\s/g,"\\s");return new RegExp(n,t)}},8834:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.insertImage=void 0;var r=n(3147);t.insertImage=function(e){return function(t,n){var o=t.schema.nodes.image.createAndFill(e);(0,r.insertNode)(o)(t,(function(t){return n(t.setMeta("commandName","insertImage").setMeta("args",e))}))}}},648:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.outdent=t.indent=t.canBeIndented=t.canOutdentAsListItem=t.canIndentAsListItem=t.isIndented=t.indentBlocks=void 0;var r=n(4032),o=n(2287),i=n(452),a=n(3147),s=n(8933);t.indentBlocks=function(e,t,n){return function(r,o){var a=(0,i.blockNodes)(r),s=r.tr;s.setMeta("commandName",t),a.forEach((function(t){if(t.type.isTextblock){var r=void 0,o=e.find((function(e){return e.node===t.type.name}));if(o){var a="rtl"===n?o.rtlStyle:o.style,l={name:a,value:o.step>0?"".concat(o.step).concat(o.unit):""};if(t.attrs.style){var c=new RegExp("".concat(a,":\\s?(\\d+)").concat(o.unit),"i"),u=t.attrs.style.match(c);if(u){var f=parseFloat(u[1])+o.step;f=f<=0?"":f,l.value="".concat(f).concat(f?o.unit:"")}}r=(0,i.addStyles)(t,[l])}r&&(0,i.changeTextBlock)(s,t,t.type,r)}}));var l=s.docChanged;return l&&o(s.scrollIntoView()),l}},t.isIndented=function(e,t,n){var r=(0,i.blockNodes)(e),o=!1;return r.forEach((function(e){if(!o&&e.type.isTextblock&&e.attrs.style){var r=t.find((function(t){return t.node===e.type.name}));if(r){var i="rtl"===n?r.rtlStyle:r.style,a=new RegExp("".concat(i,":\\s?\\d+").concat(r.unit),"i");o=a.test(e.attrs.style)}}})),o},t.canIndentAsListItem=function(e,t){return(0,r.sinkListItem)(t)(e)},t.canOutdentAsListItem=function(e,t){var n=e.schema.nodes[t.listsTypes.listItem],o=e.schema.nodes[t.listsTypes.orderedList],i=e.schema.nodes[t.listsTypes.bulletList],s=!!(0,a.findNthParentNodeOfType)(o,2)(e.selection),l=!!(0,a.findNthParentNodeOfType)(i,2)(e.selection);return(s||l)&&(0,r.liftListItem)(n)(e)},t.canBeIndented=function(e,n){var r=e.schema.nodes,a=r[o.indentRules.listsTypes.listItem];return((0,t.isIndented)(e,n.nodes)||o.indentRules.nodes.some((function(t){return r[t.node]&&(0,i.hasNode)(e,r[t.node])})))&&!(0,i.hasNode)(e,a)},t.indent=function(e,n){var i=e.schema.nodes[o.indentRules.listsTypes.listItem],a=(0,t.canBeIndented)(e,o.indentRules);(0,t.canIndentAsListItem)(e,i)?(0,r.sinkListItem)(i)(e,n):a&&(0,t.indentBlocks)(o.indentRules.nodes)(e,n)},t.outdent=function(e,n){var a=e.schema.nodes,l=a[o.outdentRules.listsTypes.listItem],c=(0,t.canBeIndented)(e,o.outdentRules);(0,i.hasNode)(e,a.blockquote)?(0,s.liftBlockquote)(e,n):(0,t.canOutdentAsListItem)(e,o.outdentRules)?(0,r.liftListItem)(l)(e,n):c&&(0,t.indentBlocks)(o.outdentRules.nodes)(e,n)}},3884:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.applyInlineStyle=t.toggleInlineFormat=t.getInlineStyles=void 0;var r=n(7582),o=n(2843),i=n(2391),a=n(3147),s=n(1542),l=function(e,t){var n=e.find((function(e){return"style"===e.type.name})),r=n&&n.attrs.style;return(0,a.changeStylesString)(r,t)},c=function(e,t,n,i,a){var s=a.create({style:i.style}),c=[],u=[],f=null,d=null;return e.doc.nodesBetween(t,n,(function(e,h,p){if(e.isInline){var m=e.marks;if(!s.isInSet(m)&&p.type.allowsMarkType(s.type)){var v=Math.max(h,t),g=Math.min(h+e.nodeSize,n),y=l(m,i);if(y.changed||i.newValue){for(var b=y.changed?{style:y.style||null}:{style:"".concat([i.style],": ").concat(i.newValue,";")},w=a.isInSet(m)?m.find((function(e){return"style"===e.type.name})):null,k=w?r.__assign(r.__assign({},w.attrs),b):b,S=a.create(k),x=S.addToSet(m),C=0;C<m.length;C++)m[C].isInSet(x)||(f&&f.to===v&&f.mark.eq(m[C])?f.to=g:(f=new o.RemoveMarkStep(v,g,m[C]),c.push(f)));var O=d&&d.to===v,M=O&&S.attrs.style===d.mark.attrs.style;O&&M?d.to=g:Object.keys(k).some((function(e){return null!==k[e]}))&&(d=new o.AddMarkStep(v,g,S),u.push(d))}}}})),c.forEach((function(t){return e.step(t)})),u.forEach((function(t){return e.step(t)})),c.length+u.length>0};t.getInlineStyles=function(e,t){var n=e.schema.marks.style;return(n?(0,s.selectionMarks)(e,n):[]).map((function(e){return(0,s.styleValue)(e,t)})).filter((function(e){return null!==e}))};var u=function(e,t){return function(n,o,u){var f=n.selection,d=f.empty,h=f.ranges,p=n.selection instanceof i.TextSelection&&n.selection.$cursor;if(d&&!p||!(0,s.markApplies)(n.doc,h,e))return!1;var m=!1;if(o){var v=u||n.tr;if(p){var g=n.storedMarks||p.marks();if(e.isInSet(g)){var y=l(g,t),b=g.find((function(e){return"style"===e.type.name})),w=r.__assign(r.__assign({},b?b.attrs:{}),{style:y.style||null});if((0,a.shallowEqual)(b.attrs,w))return!1;o(v.removeStoredMark(e)),Object.keys(w).some((function(e){return null!==w[e]}))&&o(v.addStoredMark(e.create(w))),m=!0}}else{for(var k=0;k<h.length;k++){var S=h[k],x=S.$from,C=S.$to;m=c(v,x.pos,C.pos,t,e)||m}m&&(v.scrollIntoView(),o(v))}}return m}};t.toggleInlineFormat=function(e,t,n){return function(o,i){var a=o.schema.marks,l=e.altStyle,c=e.altMarks,f=void 0===c?[]:c,d=e.mark,h=t||o.tr,p=!1,m=!1,v=function(){return m=!0};l&&a.style&&(p=u(a.style,{style:l.name,value:l.value})(o,v,h));var g=r.__spreadArray([d],f,!0).filter((function(e){return a[e]})).map((function(e){return(0,s.hasMark)(o,{mark:e})&&a[e]})).filter((function(e){return e}));return g.length?(0,s.removeMarks)(g,o,v,h):p||(0,s.toggleMark)(a[d],n,h)(o,v),m&&i(h),m}},t.applyInlineStyle=function(e,t){return function(n,o){var i=n.schema.marks.style,l={style:e.style,value:/^.+$/,newValue:e.value},c=n.tr;t&&c.setMeta("commandName",t),c.setMeta("args",e);var f=n.selection,d=f.empty,h=f.$cursor,p=f.ranges;if(d&&!h||!i||!(0,s.markApplies)(n.doc,p,i))return!1;if(h){var m=n.storedMarks||h.marks(),v=i.isInSet(m)?m.find((function(e){return"style"===e.type.name})):null,g={style:null};if(v&&v.attrs.style){var y=(0,a.changeStylesString)(v.attrs.style,l);y.changed&&y.style&&(g.style=y.style)}else l.newValue&&(g.style="".concat([l.style],": ").concat(l.newValue,";"));var b=v?r.__assign(r.__assign({},v.attrs),g):g;return Object.keys(b).some((function(e){return null!==b[e]}))?o(c.addStoredMark(i.create(b))):o(c.removeStoredMark(i)),!0}return u(i,l)(n,o,c)}}},1504:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.applyLink=t.removeLink=void 0;var r=n(3884),o=n(1542),i=n(2391);t.removeLink=function(e,t){return function(n,i){var a=n.selection.$cursor;if(a){var s=a.parent,l=a.index(),c=n.schema.marks[e.mark],u=s.child(l).marks.find((function(e){return e.type===c})),f=s.childCount,d=a.pos-a.textOffset,h=s.child(l).nodeSize,p=void 0,m=void 0;for(p=l-1;p>=0&&u.isInSet(s.child(p).marks);)h+=m=s.child(p).nodeSize,d-=m,p-=1;for(p=l+1;p<f&&u.isInSet(s.child(p).marks);)h+=s.child(p).nodeSize,p+=1;i((0,o.removeMark)(t||n.tr,d,d+h,u))}else(0,r.toggleInlineFormat)(e,t)(n,i)}},t.applyLink=function(e,n){var a=e.mark,s=e.attrs;return void 0===n&&(n="link"),function(e,l){var c=e.schema.marks,u=e.tr;n&&(u.setMeta("commandName",n),u.setMeta("args",s));var f=!1,d=function(){return f=!0};if(function(e,t){var n=(0,o.selectionMarks)(e,t);return 1===n.length&&n[0]?n[0]:null}(e,c[a]))!function(e,t){return function(n,r){var o=n.selection,i=o.$cursor,a=o.from,s=o.to,l=n.schema.marks[e.mark];if(i){var c=i.parent,u=i.index(),f=c.child(u).marks.find((function(e){return e.type===l})),d=c.childCount,h=i.pos-i.textOffset,p=c.child(u).nodeSize,m=void 0,v=void 0;for(m=u-1;m>=0&&f.isInSet(c.child(m).marks);)p+=v=c.child(m).nodeSize,h-=v,m-=1;for(m=u+1;m<d&&f.isInSet(c.child(m).marks);)p+=c.child(m).nodeSize,m+=1;t.removeMark(h,h+p,l),t.addMark(h,h+p,l.create(e.attrs)),r(t)}else t.doc.nodesBetween(a,s,(function(n,o){n.isInline&&l.isInSet(n.marks)&&(t.removeMark(o,o+n.nodeSize,l),t.addMark(o,o+n.nodeSize,l.create(e.attrs)),r(t))}))}}({mark:a,attrs:s},u)(e,d);else{var h=e;(0,o.hasMark)(e,{mark:a})&&((0,t.removeLink)({mark:a,attrs:s},u)(e,d),h=i.EditorState.create({doc:u.doc,selection:u.selection})),f?(0,o.toggleMark)(c[a],s,u)(h,d):(0,r.toggleInlineFormat)({mark:a},u,s)(h,d)}return f&&l(u),f}}},1628:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertMsLists=void 0;var r=n(5643),o=/style=['"]?[^'"]*?mso-list:\s*[a-zA-Z]+(\d+)\s[a-zA-Z]+(\d+)\s(\w+)/gi,i=function(e){return/^MsoListParagraph/.test(e.className)},a=function(e){var t=e.innerHTML;return(t=t.replace(/<!--(.|\s)*?-->/gi,"")).replace(/<\/?[^>]+?\/?>/gm,"")},s=function(e,t){var n=document.createElement(e);return n.style.listStyleType=t,n},l=function(e){var t=null;return/^\d/.test(e)||(t=(/^[a-z]/.test(e)?"lower-":"upper-")+(/^[ivxlcdm]/i.test(e)?"roman":"alpha")),t},c=function(e,t){var n=[];Array.from(e).forEach((function(e){if(e.nodeType===Node.ELEMENT_NODE){var r=e;r.getAttribute("datalist")?(n.push(e),t.add(n)):i(r)&&n.length?n.push(e):(n=[],"DIV"===r.nodeName?c(r.children,t):"TABLE"===r.nodeName&&Array.from(r.querySelectorAll("td,th")).forEach((function(e){c(e.children,t)})))}}))},u=function(e){var t,n=e.innerHTML,r=function(e){return e.replace(/^(?: |[\u00a0\n\r\s])+/,"")};return n=n.replace(/<\/?\w+[^>]*>/g,"").replace(/ /g," "),/^[\u2022\u00b7\u00a7\u00d8oØüvn][\u00a0 ]+/.test(n)?{tag:"ul",style:(t=r(a(e)),/^[\u2022\u00b7\u00FC\u00D8\u002dv-]/.test(t)?null:/^o/.test(t)?"circle":"square")}:/^\s*\w+[\.\)][\u00a0 ]{2,}/.test(n)?{tag:"ol",style:l(r(a(e)))}:void 0},f=function(e){var t,n=e.nodeName.toLowerCase();e.firstChild&&e.firstChild.nodeType===Node.COMMENT_NODE&&e.removeChild(e.firstChild),1===e.childNodes.length?t=e.firstChild.nodeType===Node.TEXT_NODE?a(e):e.firstChild.innerHTML.replace(/^\w+[\.\)]( )+ /,""):(e.removeChild(e.firstChild),3===e.firstChild.nodeType&&/^[ivxlcdm]+\.$/i.test(e.firstChild.nodeValue)&&e.removeChild(e.firstChild),/^( |\s)+$/i.test(e.firstChild.innerHTML)&&e.removeChild(e.firstChild),t="p"!==n?"<"+n+">"+e.innerHTML+"</"+n+">":e.innerHTML),e.parentNode.removeChild(e);var o=document.createElement("li");return o.appendChild((0,r.htmlToFragment)(t)),o};t.convertMsLists=function(e){var t=(0,r.htmlToFragment)(function(e){return e.replace(o,(function(e,t,n){return'datalist="'.concat(t,'" datalevel="').concat(n,'" ').concat(e)}))}(e)),n=new Set;return c(t.children,n),n.forEach((function(e){return function(e){var t,n,r,o,a,l,c,d,h,p,m,v,g,y=-1,b={};for(d=0;d<e.length;d++){var w=(g={datalist:(h=e[d]).getAttribute("datalist"),datalevel:h.getAttribute("datalevel")}).datalist,k=u(h);if(p=k&&k.tag){if(m=g.datalevel||parseFloat(h.style.marginLeft||0),g.datalevel||h.style.marginLeft){var S=p+w;b[m]||(b[m]={}),(!n||n<0)&&(n=m,r=w,o=(c=e.filter((function(e){return e.getAttribute("datalist")===String(r)})))[c.length-1],l=s(p,k&&k.style),h.parentNode.insertBefore(l,h),y=m,b[m][S]=l),a=o===h,v=b[m][S],(m>y||!v)&&(v=s(p,k&&k.style),b[m][S]=v,t.appendChild(v)),t=f(h),v.appendChild(t),a?n=y=-1:y=m}}else!t||a&&!i(h)||(h.style.marginLeft&&(h.style.marginLeft=""),h.style.marginLeft&&(h.style.margin=""),t.appendChild(h))}}(e)})),(0,r.fragmentToHtml)(t)}},1641:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.splitListItemKeepMarks=t.toggleOrderedList=t.toggleUnorderedList=t.toggleList=t.listStyle=void 0;var r=n(7582),o=n(9443),i=n(2391),a=n(2843),s=n(9270),l=n(4032),c=n(8672),u=function(e,t,n){for(var r=t.depth,o=e.nodes[n.bulletList],i=e.nodes[n.orderedList],a=e.nodes[n.listItem],s=t.depth;s>0;s--){var l=t.node(s);if(l.type!==o&&l.type!==i||(r=s),l.type!==o&&l.type!==i&&l.type!==a)break}return r-1};function f(e,t,n,r){var i=r||e.schema.nodes.listItem,s=t.$from,l=t.$to,c=s.blockRange(l,(function(e){return e.childCount&&e.firstChild.type===i}));if(!c||c.depth<2||s.node(c.depth-1).type!==i)return n;var u=c.end,f=l.end(c.depth);return u<f&&(n.step(new a.ReplaceAroundStep(u-1,f,u,f,new o.Slice(o.Fragment.from(i.create(void 0,c.parent.copy())),1,0),1,!0)),c=new o.NodeRange(n.doc.resolve(s.pos),n.doc.resolve(f),c.depth)),n.lift(c,(0,a.liftTarget)(c)).scrollIntoView()}function d(e){return function(t,n){var r=t.tr,o=t.selection,s=o.$from,l=o.$to;return r.doc.nodesBetween(s.pos,l.pos,(function(n,o){if(n.isTextblock||"blockquote"===n.type.name||"div"===n.type.name){var s=new i.NodeSelection(r.doc.resolve(r.mapping.map(o))),l=s.$from.blockRange(s.$to);if(!l||s.$from.parent.type!==t.schema.nodes[e.listItem])return!1;var c=l&&(0,a.liftTarget)(l);if(null==c)return!1;r.lift(l,c)}})),n&&n(r),!0}}var h=/list\-style\-type:\s?([\w-]+)/;t.listStyle=function(e){var t=e.style||"",n=h.exec(t);return n&&n[1]||""},t.toggleList=function(e,n,r,o,a){var c=o.listType,h=o.listAttrs,p=void 0===h?{style:null}:h,m=e.selection,v=m.$from.node(m.$from.depth-2),g=m.$to.node(m.$to.depth-2);if(v&&v.type.name===c&&(0,t.listStyle)(v.attrs)===(0,t.listStyle)(p)&&g&&g.type.name===c&&(0,t.listStyle)(g.attrs)===(0,t.listStyle)(p)){var y=r.state.schema.nodes,b={bulletList:y[o.bulletList],orderedList:y[o.orderedList],listItem:y[o.listItem]},w=function(e,t){for(var n,r=t.bulletList,o=t.orderedList,i=t.listItem,a=e.depth-1;a>0;a--){var s=e.node(a);if(s.type!==r&&s.type!==o||(n=a),s.type!==r&&s.type!==o&&s.type!==i)break}return n}(m.$to,b),k=function(e,t,n,r,o,a){a||(a=e.schema.nodes.listItem);var s=!1;return o.doc.nodesBetween(t,n,(function(n,l){if(!s&&n.type===a&&l>t){s=!0;for(var c=r+3;c>r+2;){var u=o.doc.resolve(o.mapping.map(l));c=u.depth;var d=o.doc.resolve(o.mapping.map(l+n.textContent.length)),h=new i.TextSelection(u,d);o=f(e,h,o,a)}}})),o}(e,m.$to.pos,m.$to.end(w),w,r.state.tr,b.listItem);return k=function(e,t,n){var r=e.selection,o=r.from,i=r.to,a=e.schema.nodes,s=a.paragraph,l=a.heading,c=[];t.doc.nodesBetween(o,i,(function(e,t){e.type!==s&&e.type!==l||c.push({node:e,pos:t})}));for(var f=c.length-1;f>=0;f--){var d=c[f],h=t.doc.resolve(t.mapping.map(d.pos));if(h.depth>0){var p;p=d.node.textContent&&d.node.textContent.length>0?t.doc.resolve(t.mapping.map(d.pos+d.node.textContent.length)):t.doc.resolve(t.mapping.map(d.pos+1));var m=h.blockRange(p);m&&t.lift(m,u(e.schema,h,n))}}return t}(e,k,o),k.setMeta("commandName",a),n(k),!0}return function(e){return function(t,n,r){if(!r)return!1;var o,i,a=(t=r.state).schema.nodes[e.listType],c=t.selection,u=c.$from,f=c.$to,h=u.node(-2),p=u.node(-3),m=function(e,t,n,r){return 0===function(e,t,n){for(var r=[],o=function(e,t){var n=["blockquote","bulletList","orderedList"];if(1===t.depth)return t;for(var r=t.node(t.depth),o=t;t.depth>=1;)(r=(t=e.resolve(t.before(t.depth))).node(t.depth))&&-1!==n.indexOf(r.type.name)&&(o=t);return o}(e,t).depth,i=e.resolve(t.start(o));i.pos<=n.start(n.depth);){var a=Math.min(i.depth,o),s=i.node(a);if(s&&r.push(s),0===a)break;var l=e.resolve(i.after(a));if(l.start(a)>=e.nodeSize-2)break;l.depth!==i.depth&&(l=e.resolve(l.pos+2)),i=l.depth?e.resolve(l.start(l.depth)):e.resolve(l.end(l.depth))}return r}(e,t,n).filter((function(e){return e.type!==r})).length}(t.doc,u,f,a);return(h&&h.type===a||p&&p.type===a)&&m?d(e)(t,n):(m||(d(e)(t,n),t=r.state),(o=a,void 0===(i=e.listAttrs)&&(i={}),(0,s.autoJoin)((0,l.wrapInList)(o,i),(function(e,t){return e.type===t.type&&e.type===o})))(t,n))}}(o)(e,n,r)},t.toggleUnorderedList=function(e,n,o){return(0,t.toggleList)(e,n,o,r.__assign({listType:c.bulletList.listType},c.bulletList.types))},t.toggleOrderedList=function(e,n,o){return(0,t.toggleList)(e,n,o,r.__assign({listType:c.orderedList.listType},c.orderedList.types))},t.splitListItemKeepMarks=function(e){return function(t,n){return(0,l.splitListItem)(e)(t,(function(e){var r=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();r&&e.ensureMarks(r),n(e)}))}}},6608:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.expandSelection=t.selectedLineTextOnly=t.getNodeFromSelection=t.getSelectionText=t.hasSameMarkup=t.liftBlockquote=t.blockquote=t.listStyle=t.toggleList=t.toggleUnorderedList=t.toggleOrderedList=t.indentBlocks=t.canBeIndented=t.isIndented=t.canOutdentAsListItem=t.outdent=t.canIndentAsListItem=t.indent=t.selectionMarks=t.cleanMarks=t.removeAllMarks=t.getActiveMarks=t.getMark=t.hasMark=t.cleanTextBlockFormatting=t.blockNodes=t.changeTextBlock=t.parentBlockFormat=t.getBlockFormats=t.formatBlockElements=t.activeNode=t.hasNode=t.cleanFormatting=t.isAligned=t.alignBlocks=t.insertImage=t.insertText=t.removeLink=t.applyLink=t.toggleInlineFormat=t.getInlineStyles=t.applyInlineStyle=t.fragmentToHtml=t.pmDocToFragment=t.domToPmDoc=t.htmlToFragment=t.trimWhitespace=t.parseContent=t.setHtml=t.getHtml=void 0,t.listMarkersStyles=t.tableRowResizeKey=t.tableColumnResizeKey=t.tableResizeKey=t.tableResizing=t.caretColorKey=t.caretColor=t.imageResizeKey=t.imageResizing=t.textHighlightKey=t.textHighlight=t.cspFix=t.spacesFix=t.placeholder=t.replaceAll=t.replace=t.findAll=t.findAt=t.find=t.convertMsLists=t.replaceImageSourcesFromRtf=t.removeAttribute=t.sanitizeStyleAttr=t.sanitizeClassAttr=t.pasteCleanup=t.removeTag=t.removeComments=t.sanitize=t.link=t.superscript=t.subscript=t.strikethrough=t.underline=t.italic=t.bold=t.buildListKeymap=t.buildKeymap=t.marks=t.nodes=t.outdentRules=t.indentRules=t.alignRemoveRules=t.alignJustifyRules=t.alignRightRules=t.alignCenterRules=t.alignLeftRules=t.indentHtml=t.insertNode=t.canInsert=t.expandToWordWrap=void 0,t.pmDeleteColumn=t.pmAddRowBefore=t.pmAddRowAfter=t.pmAddColumnAfter=t.pmAddColumnBefore=t.deleteColumn=t.addColumnAfter=t.addColumnBefore=t.addRowBefore=t.addRowAfter=t.createTable=t.nextCell=t.moveCellForward=t.removeColSpan=t.findCell=t.cellAround=t.updateColumnsOnResize=t.columnResizingPluginKey=t.columnResizing=t.columnIsHeader=t.colCount=t.addColumn=t.addColSpan=t.addRow=t.rowIsHeader=t.deleteRow=t.mergeCells=t.splitCellWithType=t.splitCell=t.toggleHeaderRow=t.toggleHeaderColumn=t.toggleHeaderCell=t.toggleHeader=t.goToNextCell=t.setCellAttr=t.selectionCell=t.selectedRect=t.CellSelection=t.inSameTable=t.deleteTable=t.isInTable=t.fixTablesKey=t.fixTables=t.tableNodes=t.tableNodeTypes=t.tableEditingKey=t.tableEditing=t.TableMap=void 0;var r=n(7582),o=n(5643);Object.defineProperty(t,"getHtml",{enumerable:!0,get:function(){return o.getHtml}}),Object.defineProperty(t,"setHtml",{enumerable:!0,get:function(){return o.setHtml}}),Object.defineProperty(t,"parseContent",{enumerable:!0,get:function(){return o.parseContent}}),Object.defineProperty(t,"trimWhitespace",{enumerable:!0,get:function(){return o.trimWhitespace}}),Object.defineProperty(t,"htmlToFragment",{enumerable:!0,get:function(){return o.htmlToFragment}}),Object.defineProperty(t,"domToPmDoc",{enumerable:!0,get:function(){return o.domToPmDoc}}),Object.defineProperty(t,"pmDocToFragment",{enumerable:!0,get:function(){return o.pmDocToFragment}}),Object.defineProperty(t,"fragmentToHtml",{enumerable:!0,get:function(){return o.fragmentToHtml}});var i=n(3884);Object.defineProperty(t,"applyInlineStyle",{enumerable:!0,get:function(){return i.applyInlineStyle}}),Object.defineProperty(t,"getInlineStyles",{enumerable:!0,get:function(){return i.getInlineStyles}}),Object.defineProperty(t,"toggleInlineFormat",{enumerable:!0,get:function(){return i.toggleInlineFormat}});var a=n(1504);Object.defineProperty(t,"applyLink",{enumerable:!0,get:function(){return a.applyLink}}),Object.defineProperty(t,"removeLink",{enumerable:!0,get:function(){return a.removeLink}});var s=n(6149);Object.defineProperty(t,"insertText",{enumerable:!0,get:function(){return s.insertText}});var l=n(8834);Object.defineProperty(t,"insertImage",{enumerable:!0,get:function(){return l.insertImage}});var c=n(510);Object.defineProperty(t,"alignBlocks",{enumerable:!0,get:function(){return c.alignBlocks}}),Object.defineProperty(t,"isAligned",{enumerable:!0,get:function(){return c.isAligned}});var u=n(9840);Object.defineProperty(t,"cleanFormatting",{enumerable:!0,get:function(){return u.cleanFormatting}});var f=n(452);Object.defineProperty(t,"hasNode",{enumerable:!0,get:function(){return f.hasNode}}),Object.defineProperty(t,"activeNode",{enumerable:!0,get:function(){return f.activeNode}}),Object.defineProperty(t,"formatBlockElements",{enumerable:!0,get:function(){return f.formatBlockElements}}),Object.defineProperty(t,"getBlockFormats",{enumerable:!0,get:function(){return f.getBlockFormats}}),Object.defineProperty(t,"parentBlockFormat",{enumerable:!0,get:function(){return f.parentBlockFormat}}),Object.defineProperty(t,"changeTextBlock",{enumerable:!0,get:function(){return f.changeTextBlock}}),Object.defineProperty(t,"blockNodes",{enumerable:!0,get:function(){return f.blockNodes}}),Object.defineProperty(t,"cleanTextBlockFormatting",{enumerable:!0,get:function(){return f.cleanTextBlockFormatting}});var d=n(1542);Object.defineProperty(t,"hasMark",{enumerable:!0,get:function(){return d.hasMark}}),Object.defineProperty(t,"getMark",{enumerable:!0,get:function(){return d.getMark}}),Object.defineProperty(t,"getActiveMarks",{enumerable:!0,get:function(){return d.getActiveMarks}}),Object.defineProperty(t,"removeAllMarks",{enumerable:!0,get:function(){return d.removeAllMarks}}),Object.defineProperty(t,"cleanMarks",{enumerable:!0,get:function(){return d.cleanMarks}}),Object.defineProperty(t,"selectionMarks",{enumerable:!0,get:function(){return d.selectionMarks}});var h=n(648);Object.defineProperty(t,"indent",{enumerable:!0,get:function(){return h.indent}}),Object.defineProperty(t,"canIndentAsListItem",{enumerable:!0,get:function(){return h.canIndentAsListItem}}),Object.defineProperty(t,"outdent",{enumerable:!0,get:function(){return h.outdent}}),Object.defineProperty(t,"canOutdentAsListItem",{enumerable:!0,get:function(){return h.canOutdentAsListItem}}),Object.defineProperty(t,"isIndented",{enumerable:!0,get:function(){return h.isIndented}}),Object.defineProperty(t,"canBeIndented",{enumerable:!0,get:function(){return h.canBeIndented}}),Object.defineProperty(t,"indentBlocks",{enumerable:!0,get:function(){return h.indentBlocks}});var p=n(1641);Object.defineProperty(t,"toggleOrderedList",{enumerable:!0,get:function(){return p.toggleOrderedList}}),Object.defineProperty(t,"toggleUnorderedList",{enumerable:!0,get:function(){return p.toggleUnorderedList}}),Object.defineProperty(t,"toggleList",{enumerable:!0,get:function(){return p.toggleList}}),Object.defineProperty(t,"listStyle",{enumerable:!0,get:function(){return p.listStyle}});var m=n(8933);Object.defineProperty(t,"blockquote",{enumerable:!0,get:function(){return m.blockquote}}),Object.defineProperty(t,"liftBlockquote",{enumerable:!0,get:function(){return m.liftBlockquote}});var v=n(3147);Object.defineProperty(t,"hasSameMarkup",{enumerable:!0,get:function(){return v.hasSameMarkup}}),Object.defineProperty(t,"getSelectionText",{enumerable:!0,get:function(){return v.getSelectionText}}),Object.defineProperty(t,"getNodeFromSelection",{enumerable:!0,get:function(){return v.getNodeFromSelection}}),Object.defineProperty(t,"selectedLineTextOnly",{enumerable:!0,get:function(){return v.selectedLineTextOnly}}),Object.defineProperty(t,"expandSelection",{enumerable:!0,get:function(){return v.expandSelection}}),Object.defineProperty(t,"expandToWordWrap",{enumerable:!0,get:function(){return v.expandToWordWrap}}),Object.defineProperty(t,"canInsert",{enumerable:!0,get:function(){return v.canInsert}}),Object.defineProperty(t,"insertNode",{enumerable:!0,get:function(){return v.insertNode}}),Object.defineProperty(t,"indentHtml",{enumerable:!0,get:function(){return v.indentHtml}});var g=n(89);Object.defineProperty(t,"alignLeftRules",{enumerable:!0,get:function(){return g.alignLeftRules}}),Object.defineProperty(t,"alignCenterRules",{enumerable:!0,get:function(){return g.alignCenterRules}}),Object.defineProperty(t,"alignRightRules",{enumerable:!0,get:function(){return g.alignRightRules}}),Object.defineProperty(t,"alignJustifyRules",{enumerable:!0,get:function(){return g.alignJustifyRules}}),Object.defineProperty(t,"alignRemoveRules",{enumerable:!0,get:function(){return g.alignRemoveRules}});var y=n(2287);Object.defineProperty(t,"indentRules",{enumerable:!0,get:function(){return y.indentRules}}),Object.defineProperty(t,"outdentRules",{enumerable:!0,get:function(){return y.outdentRules}});var b=n(4221);Object.defineProperty(t,"nodes",{enumerable:!0,get:function(){return b.nodes}}),Object.defineProperty(t,"marks",{enumerable:!0,get:function(){return b.marks}});var w=n(2866);Object.defineProperty(t,"buildKeymap",{enumerable:!0,get:function(){return w.buildKeymap}}),Object.defineProperty(t,"buildListKeymap",{enumerable:!0,get:function(){return w.buildListKeymap}});var k=n(4437);Object.defineProperty(t,"bold",{enumerable:!0,get:function(){return k.bold}}),Object.defineProperty(t,"italic",{enumerable:!0,get:function(){return k.italic}}),Object.defineProperty(t,"underline",{enumerable:!0,get:function(){return k.underline}}),Object.defineProperty(t,"strikethrough",{enumerable:!0,get:function(){return k.strikethrough}}),Object.defineProperty(t,"subscript",{enumerable:!0,get:function(){return k.subscript}}),Object.defineProperty(t,"superscript",{enumerable:!0,get:function(){return k.superscript}}),Object.defineProperty(t,"link",{enumerable:!0,get:function(){return k.link}});var S=n(3910);Object.defineProperty(t,"sanitize",{enumerable:!0,get:function(){return S.sanitize}}),Object.defineProperty(t,"removeComments",{enumerable:!0,get:function(){return S.removeComments}}),Object.defineProperty(t,"removeTag",{enumerable:!0,get:function(){return S.removeTag}}),Object.defineProperty(t,"pasteCleanup",{enumerable:!0,get:function(){return S.pasteCleanup}}),Object.defineProperty(t,"sanitizeClassAttr",{enumerable:!0,get:function(){return S.sanitizeClassAttr}}),Object.defineProperty(t,"sanitizeStyleAttr",{enumerable:!0,get:function(){return S.sanitizeStyleAttr}}),Object.defineProperty(t,"removeAttribute",{enumerable:!0,get:function(){return S.removeAttribute}}),Object.defineProperty(t,"replaceImageSourcesFromRtf",{enumerable:!0,get:function(){return S.replaceImageSourcesFromRtf}});var x=n(1628);Object.defineProperty(t,"convertMsLists",{enumerable:!0,get:function(){return x.convertMsLists}});var C=n(2582);Object.defineProperty(t,"find",{enumerable:!0,get:function(){return C.find}}),Object.defineProperty(t,"findAt",{enumerable:!0,get:function(){return C.findAt}}),Object.defineProperty(t,"findAll",{enumerable:!0,get:function(){return C.findAll}}),Object.defineProperty(t,"replace",{enumerable:!0,get:function(){return C.replace}}),Object.defineProperty(t,"replaceAll",{enumerable:!0,get:function(){return C.replaceAll}});var O=n(7932);Object.defineProperty(t,"placeholder",{enumerable:!0,get:function(){return O.placeholder}});var M=n(2164);Object.defineProperty(t,"spacesFix",{enumerable:!0,get:function(){return M.spacesFix}});var T=n(5578);Object.defineProperty(t,"cspFix",{enumerable:!0,get:function(){return T.cspFix}});var A=n(2860);Object.defineProperty(t,"textHighlight",{enumerable:!0,get:function(){return A.textHighlight}}),Object.defineProperty(t,"textHighlightKey",{enumerable:!0,get:function(){return A.textHighlightKey}});var N=n(2936);Object.defineProperty(t,"imageResizing",{enumerable:!0,get:function(){return N.imageResizing}}),Object.defineProperty(t,"imageResizeKey",{enumerable:!0,get:function(){return N.imageResizeKey}});var R=n(3198);Object.defineProperty(t,"caretColor",{enumerable:!0,get:function(){return R.caretColor}}),Object.defineProperty(t,"caretColorKey",{enumerable:!0,get:function(){return R.caretColorKey}});var D=n(6034);Object.defineProperty(t,"tableResizing",{enumerable:!0,get:function(){return D.tableResizing}}),Object.defineProperty(t,"tableResizeKey",{enumerable:!0,get:function(){return D.tableResizeKey}}),Object.defineProperty(t,"tableColumnResizeKey",{enumerable:!0,get:function(){return D.tableColumnResizeKey}}),Object.defineProperty(t,"tableRowResizeKey",{enumerable:!0,get:function(){return D.tableRowResizeKey}});var _=n(3490);Object.defineProperty(t,"listMarkersStyles",{enumerable:!0,get:function(){return _.listMarkersStyles}}),r.__exportStar(n(9270),t),r.__exportStar(n(1588),t),r.__exportStar(n(1634),t),r.__exportStar(n(8638),t),r.__exportStar(n(8665),t),r.__exportStar(n(7354),t),r.__exportStar(n(9443),t),r.__exportStar(n(4032),t),r.__exportStar(n(2391),t);var E=n(1640);Object.defineProperty(t,"TableMap",{enumerable:!0,get:function(){return E.TableMap}}),Object.defineProperty(t,"tableEditing",{enumerable:!0,get:function(){return E.tableEditing}}),Object.defineProperty(t,"tableEditingKey",{enumerable:!0,get:function(){return E.tableEditingKey}}),Object.defineProperty(t,"tableNodeTypes",{enumerable:!0,get:function(){return E.tableNodeTypes}}),Object.defineProperty(t,"tableNodes",{enumerable:!0,get:function(){return E.tableNodes}}),Object.defineProperty(t,"fixTables",{enumerable:!0,get:function(){return E.fixTables}}),Object.defineProperty(t,"fixTablesKey",{enumerable:!0,get:function(){return E.fixTablesKey}}),Object.defineProperty(t,"isInTable",{enumerable:!0,get:function(){return E.isInTable}}),Object.defineProperty(t,"deleteTable",{enumerable:!0,get:function(){return E.deleteTable}}),Object.defineProperty(t,"inSameTable",{enumerable:!0,get:function(){return E.inSameTable}}),Object.defineProperty(t,"CellSelection",{enumerable:!0,get:function(){return E.CellSelection}}),Object.defineProperty(t,"selectedRect",{enumerable:!0,get:function(){return E.selectedRect}}),Object.defineProperty(t,"selectionCell",{enumerable:!0,get:function(){return E.selectionCell}}),Object.defineProperty(t,"setCellAttr",{enumerable:!0,get:function(){return E.setCellAttr}}),Object.defineProperty(t,"goToNextCell",{enumerable:!0,get:function(){return E.goToNextCell}}),Object.defineProperty(t,"toggleHeader",{enumerable:!0,get:function(){return E.toggleHeader}}),Object.defineProperty(t,"toggleHeaderCell",{enumerable:!0,get:function(){return E.toggleHeaderCell}}),Object.defineProperty(t,"toggleHeaderColumn",{enumerable:!0,get:function(){return E.toggleHeaderColumn}}),Object.defineProperty(t,"toggleHeaderRow",{enumerable:!0,get:function(){return E.toggleHeaderRow}}),Object.defineProperty(t,"splitCell",{enumerable:!0,get:function(){return E.splitCell}}),Object.defineProperty(t,"splitCellWithType",{enumerable:!0,get:function(){return E.splitCellWithType}}),Object.defineProperty(t,"mergeCells",{enumerable:!0,get:function(){return E.mergeCells}}),Object.defineProperty(t,"deleteRow",{enumerable:!0,get:function(){return E.deleteRow}}),Object.defineProperty(t,"rowIsHeader",{enumerable:!0,get:function(){return E.rowIsHeader}}),Object.defineProperty(t,"addRow",{enumerable:!0,get:function(){return E.addRow}}),Object.defineProperty(t,"addColSpan",{enumerable:!0,get:function(){return E.addColSpan}}),Object.defineProperty(t,"addColumn",{enumerable:!0,get:function(){return E.addColumn}}),Object.defineProperty(t,"colCount",{enumerable:!0,get:function(){return E.colCount}}),Object.defineProperty(t,"columnIsHeader",{enumerable:!0,get:function(){return E.columnIsHeader}}),Object.defineProperty(t,"columnResizing",{enumerable:!0,get:function(){return E.columnResizing}}),Object.defineProperty(t,"columnResizingPluginKey",{enumerable:!0,get:function(){return E.columnResizingPluginKey}}),Object.defineProperty(t,"updateColumnsOnResize",{enumerable:!0,get:function(){return E.updateColumnsOnResize}}),Object.defineProperty(t,"cellAround",{enumerable:!0,get:function(){return E.cellAround}}),Object.defineProperty(t,"findCell",{enumerable:!0,get:function(){return E.findCell}}),Object.defineProperty(t,"removeColSpan",{enumerable:!0,get:function(){return E.removeColSpan}}),Object.defineProperty(t,"moveCellForward",{enumerable:!0,get:function(){return E.moveCellForward}}),Object.defineProperty(t,"nextCell",{enumerable:!0,get:function(){return E.nextCell}}),r.__exportStar(n(2843),t),r.__exportStar(n(9222),t);var P=n(8153);Object.defineProperty(t,"createTable",{enumerable:!0,get:function(){return P.createTable}}),Object.defineProperty(t,"addRowAfter",{enumerable:!0,get:function(){return P.addRowAfter}}),Object.defineProperty(t,"addRowBefore",{enumerable:!0,get:function(){return P.addRowBefore}}),Object.defineProperty(t,"addColumnBefore",{enumerable:!0,get:function(){return P.addColumnBefore}}),Object.defineProperty(t,"addColumnAfter",{enumerable:!0,get:function(){return P.addColumnAfter}}),Object.defineProperty(t,"deleteColumn",{enumerable:!0,get:function(){return P.deleteColumn}}),Object.defineProperty(t,"pmAddColumnBefore",{enumerable:!0,get:function(){return P.pmAddColumnBefore}}),Object.defineProperty(t,"pmAddColumnAfter",{enumerable:!0,get:function(){return P.pmAddColumnAfter}}),Object.defineProperty(t,"pmAddRowAfter",{enumerable:!0,get:function(){return P.pmAddRowAfter}}),Object.defineProperty(t,"pmAddRowBefore",{enumerable:!0,get:function(){return P.pmAddRowBefore}}),Object.defineProperty(t,"pmDeleteColumn",{enumerable:!0,get:function(){return P.pmDeleteColumn}})},1542:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getActiveMarks=t.getMark=t.selectionMarks=t.styleValue=t.hasMark=t.cleanMarks=t.removeAllMarks=t.removeMarks=t.removeMark=t.toggleMark=t.markApplies=void 0;var r=n(2843),o=n(9443),i=n(3147);t.markApplies=function(e,t,n){for(var r=function(r){var o=t[r],i=o.$from,a=o.$to,s=0===i.depth&&e.type.allowsMarkType(n);if(e.nodesBetween(i.pos,a.pos,(function(e){if(s)return!1;s=e.inlineContent&&e.type.allowsMarkType(n)})),s)return{v:!0}},o=0;o<t.length;o++){var i=r(o);if(i)return i.v}return!1},t.toggleMark=function(e,n,r){return function(o,i){var a=o.selection,s=a.empty,l=a.$cursor,c=a.ranges;if(s&&!l||!(0,t.markApplies)(o.doc,c,e))return!1;if(i)if(l)e.isInSet(o.storedMarks||l.marks())?i(r.removeStoredMark(e)):i(r.addStoredMark(e.create(n)));else{for(var u=!1,f=0;!u&&f<c.length;f++){var d=c[f],h=d.$from,p=d.$to;u=o.doc.rangeHasMark(h.pos,p.pos,e)}for(f=0;f<c.length;f++){var m=c[f];h=m.$from,p=m.$to,u?r.removeMark(h.pos,p.pos,e):r.addMark(h.pos,p.pos,e.create(n))}i(r.scrollIntoView())}return!0}},t.removeMark=function(e,t,n,i){void 0===i&&(i=null);var a=[],s=0;return e.doc.nodesBetween(t,n,(function(e,r){if(e.isInline){s++;var l=null;if(i instanceof o.MarkType){var c=i.isInSet(e.marks);c&&(l=[c])}else i?i.isInSet(e.marks)&&(l=[i]):l=e.marks;if(l&&l.length)for(var u=Math.min(r+e.nodeSize,n),f=0;f<l.length;f++){for(var d=l[f],h=void 0,p=0;p<a.length;p++){var m=a[p];m.step===s-1&&d.eq(m.style)&&(h=m)}h?(h.to=u,h.step=s):a.push({style:d,from:Math.max(r,t),to:u,step:s})}}})),a.forEach((function(t){return e.step(new r.RemoveMarkStep(t.from,t.to,t.style))})),e},t.removeMarks=function(e,n,r,o){var i=n.selection,a=i.$cursor,s=i.ranges;if(o=o||n.tr,a)e.forEach((function(e){e.isInSet(n.storedMarks||a.marks())&&r(o.removeStoredMark(e))}));else{for(var l=function(n){var r=s[n],i=r.$from,a=r.$to;e.forEach((function(e){(0,t.removeMark)(o,i.pos,a.pos,e)}))},c=0;c<s.length;c++)l(c);r(o.scrollIntoView())}return!0},t.removeAllMarks=function(e){var n=(void 0===e?{}:e).except,r=void 0===n?[]:n;return function(e,n){var o,i=e.tr;(0,t.cleanMarks)(i,{except:(o=r,o instanceof Array?o:[o])}),i.docChanged&&n(i)}},t.cleanMarks=function(e,t){var n=t.except,r=e.doc,o=e.selection,i=r.type.schema,a=o.empty,s=o.ranges,l=(n||[]).map((function(e){return e.name}));if(!a){var c=Object.keys(i.marks).map((function(e){return i.marks[e]})).filter((function(e){return-1===l.indexOf(e.name)}));s.forEach((function(t){var n=t.$from,r=t.$to;c.forEach((function(t){return e.removeMark(n.pos,r.pos,t)}))}))}},t.hasMark=function(e,n){var r,o=e.schema.marks,i=(n.altMarks||[]).filter((function(e){return o[e]})),a=n.altStyle,s=e.selection,l=s.from,c=s.$from,u=s.to,f=s.empty,d=o[n.mark],h=e.doc,p=!1;return f?(r=e.storedMarks||c.marks(),p=d&&d.isInSet(r)||i.some((function(e){return o[e].isInSet(r)}))):p=d&&h.rangeHasMark(l,u,d)||i.some((function(e){return h.rangeHasMark(l,u,o[e])})),!p&&a&&o.style?(0,t.selectionMarks)(e,o.style).some((function(e){return null!==(0,t.styleValue)(e,a)})):Boolean(p)},t.styleValue=function(e,t){for(var n=e&&e.attrs.style||"",r=(0,i.parseStyle)(n),o=Object.keys(r),a=0;a<o.length;a++){var s=o[a];if(s.toLowerCase()===t.name&&t.value.test(r[s]))return r[s]}return null},t.selectionMarks=function(e,t){var n=e.selection,r=n.from,o=n.$from,i=n.to,a=n.empty,s=[];return a?s.push(t.isInSet(e.storedMarks||o.marks())):e.doc.nodesBetween(r,i,(function(e){e.isInline&&s.push(t.isInSet(e.marks))})),s},t.getMark=function(e,n){var r=(0,t.selectionMarks)(e,n),o=r.filter((function(e){return Boolean(e)}));return r.length===o.length?r[0]:void 0},t.getActiveMarks=function(e,n){var r=(0,t.selectionMarks)(e,n),o=r.filter((function(e){return Boolean(e)}));return{hasNodesWithoutMarks:r.length!==o.length,marks:o}}},3910:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.replaceImageSourcesFromRtf=t.pasteCleanup=t.sanitizeStyleAttr=t.sanitizeClassAttr=t.removeAttribute=t.removeTag=t.removeComments=t.sanitize=void 0;var r=n(1628),o=n(5643),i=n(3147);function a(e){for(var t=e.length,n=new Array(t/2),r=0;r<t;r+=2)n[r]=String.fromCharCode(parseInt(e.substring(r,r+2),16));return btoa(n.join(""))}t.sanitize=function(e){return(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/^[\s\S]+?<!--StartFragment-->\s*([\s\S]*?)\s*<!--EndFragment-->[\s\S]+$/,"$1")).replace(/<\/?[ovw]:[^>]*?>/gi,"")).replace(/<\\?\??xml[^>]*>/gi,"")).replace(/<(?:link|meta) [^>]+?>/gi,"")).replace(/<style[^>]*?>\s*<\/style>/gi,"")).replace(/<\/?st1:.*?>/gi,"")).replace(/<a name="[a-zA-Z0-9_]+">/gim,"")).replace(/v:shapes?="[^"]+"/gi,"")).replace(/<!\[if !supportLists\]>/gi,"")).replace(/<!\[endif\]>/gi,"")},t.removeComments=function(e){return e.replace(/<!--[\s\S]+?-->/g,"")},t.removeTag=function(e,t){return e.replace(new RegExp("<\\/?("+t+")(?:\\s[^>]*?)?>","gi"),"")},t.removeAttribute=function(e){e.ownerElement&&e.ownerElement.removeAttribute(e.name)},t.sanitizeClassAttr=function(e){/^Mso/.test(e.value)&&(0,t.removeAttribute)(e)},t.sanitizeStyleAttr=function(e){var n=(0,i.parseStyle)(e.value),r=e.ownerElement.style,o="";Object.keys(n).forEach((function(e){void 0!==r[e]&&(o+="".concat(e,": ").concat(n[e],"; "))})),(o=o.trim())?e.value=o:(0,t.removeAttribute)(e)},t.pasteCleanup=function(e,n){var i=e;if(n.convertMsLists&&(i=(0,r.convertMsLists)(i)),n.stripTags&&(i=(0,t.removeTag)(i,n.stripTags)),n.attributes){var a=(0,o.htmlToFragment)(i);Array.from(a.querySelectorAll("*")).forEach((function(e){return function(e,t){if(e.nodeType===Node.ELEMENT_NODE){for(var n=e.attributes.length-1;n>=0;n--){var r=e.attributes[n];t[r.name]?t[r.name](r):t["*"]&&t["*"](r)}"SPAN"===e.nodeName&&0===e.attributes.length&&function(e){var t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}(e)}}(e,n.attributes)})),i=(0,o.fragmentToHtml)(a)}return i};var s=/<img\s[^>]*?src=(?:'|")file:\/[^'"]+(?:'|")[^>]*>/gi,l=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,c=new RegExp("(?:("+l.source+"))([\\da-fA-F\\s]+)\\}","g"),u=/[^\da-fA-F]/g,f=/file:\/[^'"]+\.(jpg|png|gif)/i,d=/\\(png|jpeg)blip\\/,h="text/rtf";t.replaceImageSourcesFromRtf=function(e,t){var n=e.match(s);if(!n||-1===t.types.indexOf(h))return e;var r=t.getData(h),o=[],i=r.match(c);if(!r||!i)return e;for(var p=0,m=i;p<m.length;p++){var v=m[p],g=d.exec(v);if(g){var y=v.replace(l,"").replace(u,"");o.push("data:image/".concat(g[1],";base64,").concat(a(y)))}}return n.length!==o.length?e:e.replace(s,(function(e){var t=o.shift()||"";return e.replace(f,t)}))}},3198:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.caretColor=t.caretColorKey=void 0;var r=n(2391),o=n(9222),i=n(1542);t.caretColorKey=new r.PluginKey("caret-color"),t.caretColor=function(){return new r.Plugin({key:t.caretColorKey,props:{decorations:function(e){var t=e.doc,n=e.selection,r=e.storedMarks;if(!n.empty||!r)return o.DecorationSet.empty;var a=(0,i.styleValue)((r||[]).find((function(e){return"style"===e.type.name})),{name:"color",value:/^.+$/});if(!a)return o.DecorationSet.empty;var s=n.$anchor.parent,l=[];return t.descendants((function(e,t){e.eq(s)&&l.push(o.Decoration.node(t,t+e.nodeSize,{style:"caret-color: "+a}))})),o.DecorationSet.create(t,l)}}})}},5578:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cspFix=void 0;var r=n(2391),o=n(3147),i=function(e,t){for(var n in t)n&&(0,o.setAttribute)(e,n,t[n])},a=function(e,t,n,r){void 0===r&&(r=!1),this.node=e,this.view=t,this.dom=document.createElement(n),i(this.dom,e.attrs),this.contentDOM=r?void 0:this.dom},s=function(e,t){this.mark=e,this.view=t,this.dom=document.createElement("span"),i(this.dom,e.attrs),this.contentDOM=this.dom};t.cspFix=function(){return new r.Plugin({key:new r.PluginKey("csp-fix"),props:{nodeViews:{paragraph:function(e,t){return new a(e,t,"p")},div:function(e,t){return new a(e,t,"div")},table_wrapper:function(e,t){return new a(e,t,"div")},table_caption_external:function(e,t){return new a(e,t,"div")},table:function(e,t){return new a(e,t,"table")},table_row:function(e,t){return new a(e,t,"tr")},table_cell:function(e,t){return new a(e,t,"td")},table_header:function(e,t){return new a(e,t,"th")},image:function(e,t){return new a(e,t,"img",!0)}},markViews:{style:function(e,t){return new s(e,t)}}}})}},2860:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.textHighlight=t.textHighlightKey=void 0;var r=n(2391),o=n(9222);t.textHighlightKey=new r.PluginKey("highlight"),t.textHighlight=function(e){return void 0===e&&(e=t.textHighlightKey),new r.Plugin({key:e,state:{init:function(){return null},apply:function(e){return e.getMeta(this.spec.key)}},props:{decorations:function(e){var t=(this.spec.key.getState(e)||[]).map((function(e){return o.Decoration.inline(e.from,e.to,e.attrs)}));return o.DecorationSet.create(e.doc,t)}}})}},2936:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.imageResizing=t.imageResizeKey=void 0;var r=n(7582),o=n(2391),i=n(9222),a=n(3352),s=n(3147),l=n(8115);t.imageResizeKey=new o.PluginKey("image-resize");var c=function(e,t,n){e.style[t]=n+"px"},u=/[^\-]width:|[^\-]height:/,f=/^.+$/,d=function(){function e(e,t,n,r){this.activeHandle=e,this.dragging=t,this.rect=n,this.nodePosition=r}return e.prototype.apply=function(n){var r=n.getMeta(t.imageResizeKey);return r?new e(r.activeHandle,r.setDragging,r.rect,r.nodePosition):this},e}();t.imageResizing=function(e){return void 0===e&&(e={node:"image",lockRatio:!0}),new o.Plugin({key:t.imageResizeKey,view:function(n){return{resize:function(){t.imageResizeKey.getState(n.state).rect&&n.dispatch(n.state.tr.setMeta("resize",!0))},get window(){return n.dom.ownerDocument&&n.dom.ownerDocument.defaultView},attachResize:function(){var e=this.window;e&&(e.removeEventListener("resize",this.resize),e.addEventListener("resize",this.resize))},removeResize:function(){var e=this.window;e&&e.removeEventListener("resize",this.resize)},update:function(n,r){var i=n.state,a=i.selection,s=i.schema.nodes[e.node],l=t.imageResizeKey.getState(i),c=l.rect;if(a instanceof o.NodeSelection&&s===a.node.type){var u=n.nodeDOM(a.from),f={top:u.offsetTop,left:u.offsetLeft,width:u.offsetWidth,height:u.offsetHeight};if(!r.selection.eq(a)||c&&(c.width!==f.width||c.height!==f.height||c.top!==f.top||c.left!==f.left)){var d=i.tr;d.setMeta(t.imageResizeKey,{rect:f,nodePosition:a.from}),n.dispatch(d),this.attachResize()}}else c&&(l.rect=null,l.nodePosition=-1)},destroy:function(){this.removeResize()}}},state:{init:function(){return new d("",null,null,-1)},apply:function(e,t){return t.apply(e)}},props:{handleDOMEvents:{mousedown:function(n,i){return function(e,n,i){var d=n.target.getAttribute(a.dataResizeDirImage);if(!d)return!1;var h=t.imageResizeKey.getState(e.state);n.preventDefault();var p=e.state.tr;function m(n){!function(e,n,r){var o=t.imageResizeKey.getState(e.state),i=o.rect,a=o.dragging,s=o.nodePosition,u=o.activeHandle;if(a&&i){var f=e.nodeDOM(s),d=l.directions[u],h=(n.clientX-a.startX)*d.x,p=(n.clientY-a.startY)*d.y,m=d.x?h+f.width:i.width,v=d.y?p+f.height:i.height;if(r.lockRatio&&d.x&&d.y){var g=Math.min(m/f.width,v/f.height),y=f.width*g,b=f.height*g;a.startX=n.clientX-(m-y)*d.x,a.startY=n.clientY-(v-b)*d.y,m=y,v=b}else a.startX=d.x?n.clientX:a.startX,a.startY=d.y?n.clientY:a.startY;c(f,"width",m),c(f,"height",v),i.top=f.offsetTop,i.left=f.offsetLeft,i.width=f.offsetWidth,i.height=f.offsetHeight;var w=f.nextElementSibling;w.style.width=i.width+"px",w.style.height=i.height+"px",w.style.top=i.top+"px",w.style.left=i.left+"px"}}(e,n,i)}return p.setMeta(t.imageResizeKey,{setDragging:{startX:n.clientX,startY:n.clientY},activeHandle:d,rect:h.rect,nodePosition:h.nodePosition}),p.setMeta("addToHistory",!1),e.dispatch(p),n.view.addEventListener("mouseup",(function n(i){i.view.removeEventListener("mouseup",n),i.view.removeEventListener("mousemove",m),function(e){var n=t.imageResizeKey.getState(e.state),i=n.rect,a=n.dragging,l=n.nodePosition;if(a&&i){var c=e.state.selection;if(c instanceof o.NodeSelection){var d=c.node.attrs,h=i.width,p=i.height,m=void 0;if(u.test(d.style||"")){var v=(0,s.changeStylesString)(d.style,{style:"width",value:f,newValue:h+"px"}),g=(0,s.changeStylesString)(v.style||"",{style:"height",value:f,newValue:p+"px"}).style;m=r.__assign(r.__assign({},d),{style:g})}else m=r.__assign(r.__assign({},d),{width:h,height:p});var y=c.node.type.createAndFill(m);if(y){var b=e.state.tr;b.replaceWith(l,l+1,y),b.setSelection(o.NodeSelection.create(b.doc,l)),b.setMeta("commandName","image-resize"),b.setMeta("args",m),b.setMeta(t.imageResizeKey,{setDragging:null,activeHandle:null,rect:i,nodePosition:l}),e.dispatch(b)}}}}(e)})),n.view.addEventListener("mousemove",m),!0}(n,i,e)}},decorations:function(n){var r=n.selection,s=n.schema.nodes[e.node],c=t.imageResizeKey.getState(n).rect;if(c&&r instanceof o.NodeSelection&&s===r.node.type){var u=document.createElement("div");u.className="k-editor-resize-handles-wrapper",u.style.width=c.width+"px",u.style.height=c.height+"px",u.style.top=c.top+"px",u.style.left=c.left+"px";for(var f=0;f<l.handles.length;f++){var d=document.createElement("div");d.className=a.resizeHandle+" "+l.handles[f],d.setAttribute(a.dataResizeDirImage,l.handles[f]),u.appendChild(d)}return i.DecorationSet.create(n.doc,[i.Decoration.widget(n.selection.from+1,u)])}return i.DecorationSet.empty}}})}},3490:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.listMarkersStyles=void 0;var r=n(7582),o=n(2391),i=n(2843),a=n(3147),s=function(e,t,n,r,o){var i,a,s=o.resolve(e),l=o.resolve(t),c=r.type.name;return!s.nodeBefore&&(i=s.node(s.depth),a=s.node(s.depth-1),i&&a&&a.firstChild===i&&a.type.name===c)?n+r.content.size<=t:!l.nodeAfter&&(i=l.node(l.depth),a=l.node(l.depth-1),i&&a&&a.lastChild===i&&a.type.name===c)?e<=n:e<=n&&n+r.content.size<=t},l={listItem:"list_item",resetValues:{"font-size":"","font-family":"",color:""}};t.listMarkersStyles=function(e){return void 0===e&&(e=l),new o.Plugin({key:new o.PluginKey("list-markers-styles"),appendTransaction:function(t,n,o){var l,c=t.slice().pop(),u=c.getMeta("commandName");return"FontSize"===u||"FontName"===u||"ForeColor"===u?l=function(e,t,n){var o=t.tr,i=t.doc,l=t.selection,c=l.from,u=l.to,f=e.getMeta("args");return i.nodesBetween(c,u,(function(e,t){e.type.name===n.listItem&&s(c,u,t,e,i)&&o.setNodeMarkup(t,null,r.__assign(r.__assign({},e.attrs),{style:(0,a.applyStyle)(e.attrs.style,f.style,f.value)}))})),o.docChanged?o:void 0}(c,o,e):"CleanFormatting"===u&&(l=function(e,t,n){var o=Object.keys(n.resetValues),l=t.tr,c=t.doc,u=t.selection,f=u.from,d=u.to;return c.nodesBetween(f,d,(function(e,t){if(e.type.name===n.listItem&&s(f,d,t,e,c)){var i=e.attrs,u=(0,a.parseStyle)(e.attrs.style);o.forEach((function(e){u[e]&&(i=r.__assign(r.__assign({},i),{style:(0,a.applyStyle)(i.style,e,"")}))})),i!==e.attrs&&l.setNodeMarkup(t,null,i)}})),e.steps.forEach((function(e){if(e instanceof i.RemoveMarkStep){var t=e.mark;if("style"===t.type.name&&t.attrs.style){var r=t.attrs.style.split(/\s*:\s*/)[0],o=l.doc.resolve(e.from),s=(0,a.parentNode)(o,(function(e){return e.type.name===n.listItem}));if(s&&(0,a.parseStyle)(s.node.attrs.style)[r]&&n.resetValues[r]){var c=t.type.create({style:"".concat(r,": ").concat(n.resetValues[r],";")});l.addMark(e.from,e.to,c)}}}})),l.docChanged?l:void 0}(c,o,e)),l&&l.setMeta("addToHistory",!0),l}})}},7932:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.placeholder=void 0;var r=n(2391),o=n(9222);t.placeholder=function(e){var t={class:"k-placeholder","data-placeholder":e};return new r.Plugin({key:new r.PluginKey("placeholder"),props:{decorations:function(e){var n=e.doc,r=n.content.firstChild;if(!(0===n.childCount||1===n.childCount&&r.inlineContent&&0===r.childCount))return o.DecorationSet.empty;var i=[];return n.descendants((function(e,n){i.push(o.Decoration.node(n,n+e.nodeSize,t))})),o.DecorationSet.create(n,i)}}})}},8115:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.handles=t.directions=void 0,t.directions={southeast:{x:1,y:1},east:{x:1,y:0},south:{x:0,y:1},north:{x:0,y:-1},west:{x:-1,y:0},southwest:{x:-1,y:1},northwest:{x:-1,y:-1},northeast:{x:1,y:-1}},t.handles=Object.keys(t.directions)},2164:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.spacesFix=void 0;var r=n(2391),o=n(9222),i=/\s+/g,a=/text-align/;t.spacesFix=function(){return new r.Plugin({key:new r.PluginKey("spaces-fix"),props:{decorations:function(e){var t,n,r,s,l=[],c=e.doc;return c.nodesBetween(0,c.content.size,(function(e,c,u){if(e.type.isText&&function(e){return a.test(e&&e.attrs&&e.attrs.style||"")}(u))for(n=i.exec(e.text||"");null!==n;){if(t=c+n.index,r=n[0].length,n.index+r<n.input.length)for(s=0;s<=r-1;s+=2)l.push(o.Decoration.inline(t+s,t+s+1,{style:"white-space: normal"}));n=i.exec(e.text||"")}})),o.DecorationSet.create(c,l)}}})}},5496:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.columnResizing=void 0;var r=n(7582),o=n(2391),i=n(1640),a=n(9222),s=n(3352),l=n(6652),c=n(3147),u=n(8230);t.columnResizing=function(){return new o.Plugin({key:u.tableColumnResizeKey,state:{init:function(){return new f(-1,null)},apply:function(e,t){return t.apply(e)}},props:{attributes:function(e){return(0,u.otherResizeHandle)(u.tableColumnResizeKey,e)?null:u.tableColumnResizeKey.getState(e).activeHandle>-1?{class:"resize-cursor"}:null},handleDOMEvents:{mousemove:function(e,t){return(0,u.otherResizing)(u.tableColumnResizeKey,e.state)||function(e,t){var n=u.tableColumnResizeKey.getState(e.state);if(!n.dragging){var r=(0,u.domCellAround)(t.target),o=-1;if(r){var i=(0,u.cellIndexes)(r),a=r.getBoundingClientRect(),s=a.left,l=a.right;Math.abs(t.clientX-s)<=5&&i.cellIndex>0?(i.cellIndex-=r.colSpan,o=(0,u.edgeCell)(e,t,i)):l-t.clientX>0&&l-t.clientX<=5&&(o=(0,u.edgeCell)(e,t,i))}o!==n.activeHandle&&d(e,o)}}(e,t),!1},mouseleave:function(e){return function(e){var t=u.tableColumnResizeKey.getState(e.state);t.activeHandle>-1&&!t.dragging&&d(e,-1)}(e),!1},mousedown:function(e,t){return function(e,t){var n,o=u.tableColumnResizeKey.getState(e.state);if(-1===o.activeHandle||o.dragging)return!1;for(var a=e.state.doc.resolve(o.activeHandle),l=a.parent,f=a.index(),d=0,h=0;h<=f;h++)d+=l.child(h).attrs.colspan;var p,m,v=a.node(a.depth-1),g=e.domAtPos(o.activeHandle),y=g.node.childNodes[g.offset].closest("table");if(v.attrs[s.colgroupAttr])(p=(w=y.firstChild).children[d-1]).style.width||(p.style.width=p.offsetWidth+"px");else{var b=0;for(h=0;h<l.childCount;h++)b+=l.child(h).attrs.colspan;var w=document.createElement("colgroup"),k=new Array(b);for(h=0;h<b;h++)k[h]=document.createElement("col"),w.appendChild(k[h]);y.insertBefore(w,y.firstChild),(p=k[f]).style.width=p.offsetWidth+"px",m=r.__assign(r.__assign({},v.attrs),((n={})[s.colgroupAttr]="<colgroup>"+k.reduce((function(e,t){return e+t.outerHTML}),"")+"</colgroup>",n))}var S=parseFloat(p.style.width),x=e.state.tr.setMeta(u.tableColumnResizeKey,{setDragging:{startX:t.clientX,startWidth:S}});if(!y.style.width){var C=Array.from(p.parentNode.children).map((function(e){return e.style.width}));if(C.every(Boolean)){var O=C.reduce((function(e,t){return e+parseFloat(t)}),0);m=(0,c.setNodeStyle)(m||v.attrs,"width",O+"px")}}if(m){var M=a.posAtIndex(0,a.depth-1)-1;x.setNodeMarkup(M,null,m)}function T(t){t.view.removeEventListener("mouseup",T),t.view.removeEventListener("mousemove",A);var n=u.tableColumnResizeKey.getState(e.state);if(n.dragging){var o=e.state.tr;!function(e,t,n){var o,i=e.state.doc.resolve(n),a=i.node(-1),l=i.start(-1),u=i.posAtIndex(0,i.depth-1)-1,f=e.nodeDOM(l).closest("table"),d=a.attrs;if(a&&d[s.colgroupAttr]){var h=f.firstChild;d=r.__assign(r.__assign({},d),((o={})[s.colgroupAttr]=h.outerHTML,o))}var p=f.style.width;f&&p&&(0,c.parseStyle)(d.style).width!==p&&(d=(0,c.setNodeStyle)(d,"width",p)),t.setNodeMarkup(u,null,d)}(e,o,n.activeHandle),e.dispatch(o.setMeta(u.tableColumnResizeKey,{setDragging:null}))}}function A(t){if(!t.which)return T(t);var n=u.tableColumnResizeKey.getState(e.state),r=function(e,t){var n=t.clientX-e.startX;return Math.max(25,e.startWidth+n)}(n.dragging,t);!function(e,t,n){var r=e.state.doc.resolve(t),o=r.node(-1),a=r.start(-1),s=i.TableMap.get(o).colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,l=e.domAtPos(r.start(-1)).node;"TABLE"!==l.nodeName&&(l=l.closest("table"));var c=l,u=c.firstChild,f=Array.from(u.children);if(f[s].style.width=n+"px",c.style.width){var d=f.map((function(e){return e.style.width}));if(d.every(Boolean)){var h=d.reduce((function(e,t){return e+parseFloat(t)}),0);c.style.width=h+"px"}}}(e,n.activeHandle,r)}return e.dispatch(x),t.view.addEventListener("mouseup",T),t.view.addEventListener("mousemove",A),t.preventDefault(),!0}(e,t)}},decorations:function(e){if(!(0,u.otherResizing)(u.tableColumnResizeKey,e)){var t=u.tableColumnResizeKey.getState(e);if(t.activeHandle>-1)return function(e,t){for(var n=[],r=e.doc.resolve(t),o=r.node(-1),s=i.TableMap.get(o),l=r.start(-1),c=[],u=t-l,f=-1,d=0;d<s.height;d++)c.push(s.map.slice(d*s.width,d*s.width+s.width)),-1===f&&(f=c[d].lastIndexOf(u));var h=[];return c.forEach((function(e){var t=e[f];e[f]!==e[f+1]&&h.push(t)})),h.forEach((function(e){var t=l+e+o.nodeAt(e).nodeSize-1,r=document.createElement("div");r.className="column-resize-handle",n.push(a.Decoration.widget(t,r))})),a.DecorationSet.create(e.doc,n)}(e,t.activeHandle)}return a.DecorationSet.empty},nodeViews:{table_wrapper:function(e,t){return new l.TableWrapperView(e,t)},table:function(e,t){return new l.TableView(e,t)}}}})};var f=function(){function e(e,t){this.activeHandle=e,this.dragging=t}return e.prototype.apply=function(t){var n,r,o=t.getMeta(u.tableColumnResizeKey);if(o&&null!=o.setHandle)return new e(o.setHandle,null);if(o&&void 0!==o.setDragging)return new e(this.activeHandle,o.setDragging);if(this.activeHandle>-1&&t.docChanged){var i=t.mapping.map(this.activeHandle,-1);r=t.doc.resolve(i),Boolean("row"===r.parent.type.spec.tableRole&&r.nodeAfter)||(i=-1),n=new e(i,this.dragging)}return n||this},e}();function d(e,t){var n=e.state.tr;n.setMeta("addToHistory",!1),n.setMeta(u.tableColumnResizeKey,{setHandle:t}),e.dispatch(n)}},6034:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tableRowResizeKey=t.tableColumnResizeKey=t.tableResizeKey=t.tableResizing=void 0;var r=n(5496),o=n(5652),i=n(4159);t.tableResizing=function(){return[(0,o.tableResizing)(),(0,r.columnResizing)(),(0,i.rowResizing)()]};var a=n(8230);Object.defineProperty(t,"tableResizeKey",{enumerable:!0,get:function(){return a.tableResizeKey}}),Object.defineProperty(t,"tableColumnResizeKey",{enumerable:!0,get:function(){return a.tableColumnResizeKey}}),Object.defineProperty(t,"tableRowResizeKey",{enumerable:!0,get:function(){return a.tableRowResizeKey}})},4159:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.rowResizing=void 0;var r=n(2391),o=n(1640),i=n(9222),a=n(8230),s=n(3147),l=function(){function e(){}return e.prototype.ignoreMutation=function(e){return"attributes"===e.type&&"style"===e.attributeName&&"TR"===e.target.nodeName},e}();t.rowResizing=function(){return new r.Plugin({key:a.tableRowResizeKey,state:{init:function(e,t){return this.spec.props.nodeViews[(0,o.tableNodeTypes)(t.schema).row.name]=function(){return new l},new c(-1,null)},apply:function(e,t){return t.apply(e)}},props:{attributes:function(e){return(0,a.otherResizeHandle)(a.tableRowResizeKey,e)?null:a.tableRowResizeKey.getState(e).activeHandle>-1?{class:"resize-cursor-vertical"}:null},handleDOMEvents:{mousemove:function(e,t){return(0,a.otherResizing)(a.tableRowResizeKey,e.state)||function(e,t){var n=a.tableRowResizeKey.getState(e.state);if(!n.dragging){var r=(0,a.domCellAround)(t.target),o=-1;if(r){var i=(0,a.cellIndexes)(r),s=r.getBoundingClientRect(),l=s.top,c=s.bottom;Math.abs(t.clientY-l)<=5&&i.rowIndex>0?(i.rowIndex-=r.rowSpan,o=(0,a.edgeCell)(e,t,i)):c-t.clientY>0&&c-t.clientY<=5&&(o=(0,a.edgeCell)(e,t,i))}o!==n.activeHandle&&u(e,o)}}(e,t),!1},mouseleave:function(e){return function(e){var t=a.tableRowResizeKey.getState(e.state);t.activeHandle>-1&&!t.dragging&&u(e,-1)}(e),!1},mousedown:function(e,t){return function(e,t){var n=a.tableRowResizeKey.getState(e.state);if(-1===n.activeHandle||n.dragging)return!1;var r=e.state.doc.resolve(n.activeHandle),o=r.parent,i=r.node(-1),l=(0,s.parseStyle)(o.attrs.style).height,c=(0,s.parseStyle)(i.attrs.style).height,u=l?parseFloat(l):0;function f(t){t.view.removeEventListener("mouseup",f),t.view.removeEventListener("mousemove",d);var n=a.tableRowResizeKey.getState(e.state);if(n.dragging){var r=e.state.tr.setMeta(a.tableRowResizeKey,{setDragging:null});!function(e,t,n){var r=e.state.doc,o=r.resolve(n),i=o.parent,a=o.posAtIndex(0)-1,l=e.nodeDOM(a),c=l.ownerDocument&&l.ownerDocument.defaultView||window;l.style.height=c.getComputedStyle(l).height,t.setNodeMarkup(a,null,(0,s.setNodeStyle)(i.attrs,"height",l.style.height));var u=l&&l.closest("table"),f=u&&u.style.height;if(f){var d=r.resolve(a),h=d.start(d.depth)-1;t.setNodeMarkup(h,null,(0,s.setNodeStyle)(d.parent.attrs,"height",f))}}(e,r,n.activeHandle),e.dispatch(r)}}function d(t){if(!t.which)return f(t);var n=a.tableRowResizeKey.getState(e.state),r=function(e,t){var n=t.clientY-e.startY;return e.startHeight.rowHeight+n}(n.dragging,t),o=t.clientY-n.dragging.startY;!function(e,t,n,r,o){var i=e.nodeDOM(t),a=i&&i.parentNode;if(a){a.style.height=n+"px";var s=a.ownerDocument&&a.ownerDocument.defaultView||window;a.style.height=s.getComputedStyle(a).height;var l=a.closest("table"),c=parseFloat(o)+r+"px",u=l&&l.style.height;u&&u!==c&&(l.style.height=parseFloat(o)+r+"px",l.style.height=s.getComputedStyle(l).height)}}(e,n.activeHandle,r,o,c)}return l||(u=e.nodeDOM(n.activeHandle).offsetHeight),e.dispatch(e.state.tr.setMeta(a.tableRowResizeKey,{setDragging:{startY:t.clientY,startHeight:{rowHeight:u,tableHeight:c}}})),t.view.addEventListener("mouseup",f),t.view.addEventListener("mousemove",d),t.preventDefault(),!0}(e,t)}},decorations:function(e){if((0,a.otherResizing)(a.tableRowResizeKey,e))return i.DecorationSet.empty;var t=a.tableRowResizeKey.getState(e);return t.activeHandle>-1?function(e,t){var n=[];if("number"!=typeof t)return i.DecorationSet.empty;for(var r=e.doc.resolve(t),a=r.node(-1),s=o.TableMap.get(a),l=r.start(-1),c=[],u=t-l,f=-1,d=0;d<s.height;d++)c.push(s.map.slice(d*s.width,d*s.width+s.width)),-1!==c[d].indexOf(u)&&(f=d);var h=[];return c[f].forEach((function(e,t){c[f+1]&&e===c[f+1][t]||h.push(e)})),h.forEach((function(e){var t=a.nodeAt(e),r=l+e+(t?t.nodeSize:0)-1,o=document.createElement("div");o.className="row-resize-handle",n.push(i.Decoration.widget(r,o))})),i.DecorationSet.create(e.doc,n)}(e,t.activeHandle):void 0},nodeViews:{}}})};var c=function(){function e(e,t){this.activeHandle=e,this.dragging=t}return e.prototype.apply=function(t){var n,r,o=t.getMeta(a.tableRowResizeKey);if(o&&null!=o.setHandle)return new e(o.setHandle,null);if(o&&void 0!==o.setDragging)return new e(this.activeHandle,o.setDragging);if(this.activeHandle>-1){var i=t.mapping.map(this.activeHandle,-1);"row"===(r=t.doc.resolve(i)).parent.type.spec.tableRole&&r.nodeAfter||(i=null),n=new e(i,this.dragging)}return n||this},e}();function u(e,t){var n=e.state.tr;n.setMeta("addToHistory",!1),n.setMeta(a.tableRowResizeKey,{setHandle:t}),e.dispatch(n)}},5652:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tableResizing=void 0;var r=n(7582),o=n(2391),i=n(3352),a=n(8230),s=n(3147),l=n(8115),c={southeast:!0,southwest:!0,northwest:!0,northeast:!0},u=r.__assign({east:!0,west:!0},c),f=r.__assign({south:!0,north:!0},c),d=function(){function e(e,t,n){this.activeHandle=e,this.dragging=t,this.nodePosition=n}return e.prototype.apply=function(t){var n=t.getMeta(a.tableResizeKey);return n?new e(n.activeHandle,n.setDragging,n.nodePosition):this},e}(),h=function(e){var t=Array.from(e.firstChild.children).map((function(e){return e.offsetWidth})),n=Array.from(e.rows).map((function(e){return e.offsetHeight})),r=t.reduce((function(e,t){return e+t}),0),o=n.reduce((function(e,t){return e+t}),0),i=e.offsetHeight;return{width:r,height:o,colsWidth:t,rowsHeight:n,offsetWidth:e.offsetWidth,offsetHeight:i}},p=function(e,t){var n=t.target.getAttribute(i.dataResizeDirTable);if(!n)return!1;var o=a.tableResizeKey.getState(e.state);t.preventDefault();var c=e.state.tr;c.setMeta(a.tableResizeKey,{setDragging:{startX:t.clientX,startY:t.clientY},activeHandle:n,nodePosition:o.nodePosition}),c.setMeta("addToHistory",!1),function(e,t,n){var r=e.state.doc.nodeAt(n),o=(0,a.getTable)(e.nodeDOM(n)),l=h(o),c=l.width,u=l.height,f=l.colsWidth,d=l.rowsHeight,p=l.offsetWidth,m=l.offsetHeight,v=o.firstChild,g=Array.from(v&&v.children||[]),y=!1;g.forEach((function(e,t){e.style.width&&!/%$/.test(e.style.width)&&(e.style.width=100*f[t]/c+"%",y=!0)}));var b=!1;r.forEach((function(e,r,o){var i=(0,s.parseStyle)(e.attrs.style).height;i&&!/%$/.test(i)&&(t.setNodeMarkup(n+r+1,null,(0,s.setNodeStyle)(e.attrs,"height",100*d[o]/u+"%")),b=!0)}));var w=r.attrs;(0,s.parseStyle)(w.style).width!==p+"px"&&(w=(0,s.setNodeStyle)(w,"width",p+"px")),y&&(w[i.colgroupAttr]=v.outerHTML),b&&(w=(0,s.setNodeStyle)(w,"height",m+"px")),(y||b)&&t.setNodeMarkup(n,null,w)}(e,c,o.nodePosition),e.dispatch(c);var d=t.view||window;function p(t){!function(e,t){var n,r=a.tableResizeKey.getState(e.state),o=r.dragging,i=r.nodePosition,s=r.activeHandle;if(!(i<0)&&o){var c=(0,a.getTable)(e.nodeDOM(i)),d=c.getBoundingClientRect(),h=l.directions[s],p=(t.clientX-o.startX)*h.x,m=(t.clientY-o.startY)*h.y,v=(c.ownerDocument&&c.ownerDocument.defaultView||window).getComputedStyle(c),g=/px/.test(v.width)?parseFloat(v.width):c.offsetWidth,y=/px/.test(v.height)?parseFloat(v.height):c.offsetHeight,b=h.x?p+g:d.width,w=h.y?m+y:d.height;if(o.startX=h.x?t.clientX:o.startX,o.startY=h.y?t.clientY:o.startY,u[s]&&(c.style.width=b+"px"),f[s]&&(c.style.height=w+"px"),/px/.test(c.style.width)){var k=null===(n=c.parentNode)||void 0===n?void 0:n.parentNode;k instanceof HTMLDivElement&&k.matches("div[table]")&&/%/.test(k.style.width)&&(k.style.width="")}}}(e,t)}return d.addEventListener("mouseup",(function t(){d.removeEventListener("mouseup",t),d.removeEventListener("mousemove",p),function(e){var t=a.tableResizeKey.getState(e.state),n=t.dragging,o=t.nodePosition,l=t.activeHandle;if(n){var c=e.state.doc.nodeAt(o),d=(0,a.getTable)(e.nodeDOM(o)),p=h(d);if(c){var m=p.offsetWidth+"px",v=p.offsetHeight+"px",g=e.state.tr,y=c.attrs,b=(0,s.parseStyle)(y.style);if(u[l]&&d.style.width&&b.width!==m&&(y=(0,s.setNodeStyle)(y,"width",m)),f[l]&&d.style.height&&b.height!==v&&(y=(0,s.setNodeStyle)(y,"height",v)),y=function(e,t,n,o){var l=e.state.doc.nodeAt(n),c=(0,a.getTable)(e.nodeDOM(n)),u=(c.ownerDocument&&c.ownerDocument.defaultView||window).getComputedStyle,f=Array.from(c.rows);l.forEach((function(e,r,o){var i=(0,s.parseStyle)(e.attrs.style).height;i&&!/px$/.test(i)&&t.setNodeMarkup(n+r+1,null,(0,s.setNodeStyle)(e.attrs,"height",u(f[o]).height))}));var d=c.firstChild,h=Array.from(d&&d.children||[]),p=!1;h.forEach((function(e,t){e.style.width&&!/px$/.test(e.style.width)&&(e.style.width=u(h[t]).width,p=!0)}));var m=r.__assign({},o);return p&&(m[i.colgroupAttr]=d.outerHTML),m}(e,g,o,y),g.setNodeMarkup(o,null,y),g.setMeta("commandName","node-resize"),g.setMeta("args",y),g.setMeta(a.tableResizeKey,{setDragging:null,activeHandle:null,nodePosition:o}),!/%/.test((0,s.parseStyle)(y.style).width||"")){var w=g.doc.resolve(o),k=(0,s.parentNode)(w,(function(e){return"table_wrapper"===e.type.name}));if(k&&/%/.test((0,s.parseStyle)(k.node.attrs.style).width||"")){var S=(0,s.setNodeStyle)(k.node.attrs,"width",""),x=w.start(k.depth)-1;g.setNodeMarkup(x,null,S)}}e.dispatch(g)}}}(e)})),d.addEventListener("mousemove",p),!0};t.tableResizing=function(e){return void 0===e&&(e={node:"table"}),new o.Plugin({key:a.tableResizeKey,view:function(){return{selectedNode:function(e,t){var n=e.selection;if(n instanceof o.NodeSelection&&t===n.node.type&&n instanceof o.NodeSelection)return{node:n.node,pos:n.from};var r=(0,s.parentNode)(n.$from,(function(e){return e.type===t})),i=r&&r.node;return i?{node:i,pos:n.$from.start(r.depth)-1}:null},update:function(t,n){var o,s,l,c,u,f=t.state,d=f.schema.nodes[e.node],h=this.selectedNode(f,d),p=this.selectedNode(n,d);if((h||!p||n.doc.eq(t.state.doc))&&(h||p)){var m=f.tr;if(m.setMeta("addToHistory",!1),h&&p&&h.pos!==p.pos){m.setMeta(a.tableResizeKey,{nodePosition:h.pos});var v=m.doc.nodeAt(p.pos);v&&v.type.name===d.name&&m.setNodeMarkup(p.pos,d,r.__assign(r.__assign({},p.node.attrs),((o={})[i.resizableAttr]=!1,o))),m.setNodeMarkup(h.pos,d,r.__assign(r.__assign({},h.node.attrs),((s={})[i.resizableAttr]=!0,s))),t.dispatch(m)}else h&&p&&h.pos===p.pos&&!h.node.attrs[i.resizableAttr]&&!f.selection.eq(n.selection)?(m.setMeta(a.tableResizeKey,{nodePosition:h.pos}),t.dispatch(m.setNodeMarkup(h.pos,d,r.__assign(r.__assign({},h.node.attrs),((l={})[i.resizableAttr]=!0,l))))):h&&!p?(m.setMeta(a.tableResizeKey,{nodePosition:h.pos}),t.dispatch(m.setNodeMarkup(h.pos,d,r.__assign(r.__assign({},h.node.attrs),((c={})[i.resizableAttr]=!0,c))))):!h&&p&&(m.setMeta(a.tableResizeKey,{nodePosition:-1}),t.dispatch(m.setNodeMarkup(p.pos,d,r.__assign(r.__assign({},p.node.attrs),((u={})[i.resizableAttr]=!1,u)))))}}}},state:{init:function(){return new d("",null,-1)},apply:function(e,t){return t.apply(e)}},props:{handleDOMEvents:{mousedown:function(e,t){return p(e,t)}}}})}},6652:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TableWrapperView=t.TableView=void 0;var r=n(3352),o=n(4221),i=n(8115),a=n(3147),s=function(){function e(e,t){this.node=e,this.view=t,this.dom=document.createElement("div"),this.dom.className=r.resizableWrap,this.table=this.dom.appendChild(document.createElement("table")),e.attrs[r.colgroupAttr]&&this.renderColgroup(e.attrs[r.colgroupAttr]);var n=this.table.appendChild(document.createElement("tbody"));this.setAttributes(this.table,e.attrs),this.resizeHandles=i.handles.map((function(e){var t=document.createElement("span");return t.className=r.resizeHandle+" "+e,t.setAttribute(r.dataResizeDirTable,e),t})),this.contentDOM=n}return e.prototype.update=function(e){var t=this;if(e.type!==this.node.type)return!1;var n=this.node;return this.node=e,e.attrs[r.resizableAttr]?this.resizeHandles.forEach((function(e){t.dom.appendChild(e)})):Array.from(this.dom.children).filter((function(e){return e.classList.contains(r.resizeHandle)})).forEach((function(e){return e.remove()})),this.setAttributes(this.table,e.attrs),n.attrs[r.colgroupAttr]!==e.attrs[r.colgroupAttr]&&this.renderColgroup(e.attrs[r.colgroupAttr]),!0},e.prototype.ignoreMutation=function(e){return"attributes"===e.type&&(e.target===this.table||e.target.firstChild===this.table||this.colgroup&&this.colgroup.contains(e.target))},e.prototype.destroy=function(){this.node=void 0,this.view=void 0,this.table=void 0,this.colgroup=void 0,this.resizeHandles=void 0},e.prototype.renderColgroup=function(e){this.table&&this.table.firstChild&&"COLGROUP"===this.table.firstChild.nodeName&&this.table.removeChild(this.table.firstChild),e&&(this.colgroup=(0,o.parseStrColgroup)(e),this.table.insertBefore(this.colgroup,this.table.firstChild))},e.prototype.setAttributes=function(e,t){var n=[r.colgroupAttr,r.resizableAttr];for(var o in t)o&&-1===n.indexOf(o)&&(0,a.setAttribute)(e,o,t[o]);/%$/.test(e.style.width)?(this.dom.style.width=e.style.width,e.style.width=""):this.dom.style.width=""},e}();t.TableView=s;var l=function(){function e(e,t){this.node=e,this.view=t,this.dom=document.createElement("div"),this.setAttributes(this.dom,e.attrs),this.contentDOM=this.dom}return e.prototype.update=function(e){return e.type===this.node.type&&(this.node=e,this.setAttributes(this.dom,e.attrs),!0)},e.prototype.ignoreMutation=function(e){return"attributes"===e.type&&"style"===e.attributeName},e.prototype.destroy=function(){this.node=void 0,this.view=void 0},e.prototype.setAttributes=function(e,t){for(var n in t)n&&(0,a.setAttribute)(e,n,t[n]);if(e.setAttribute("table",""),/%/.test(e.style.width)){var r=this.node&&this.node.lastChild,o=(r?(0,a.parseStyle)(r.attrs.style):{}).width||"";o&&!/%/.test(o)&&(e.style.width="")}},e}();t.TableWrapperView=l},8230:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.edgeCell=t.cellIndexes=t.domCellAround=t.getTable=t.otherResizeHandle=t.otherResizing=t.tableRowResizeKey=t.tableColumnResizeKey=t.tableResizeKey=void 0;var r=n(2391),o=n(1640),i=n(3147);t.tableResizeKey=new r.PluginKey("table-resize"),t.tableColumnResizeKey=new r.PluginKey("table-column-resizing"),t.tableRowResizeKey=new r.PluginKey("table-row-resizing"),t.otherResizing=function(e,n){var r=!1;return(r=(r=r||e!==t.tableResizeKey&&Boolean(t.tableResizeKey.get(n))&&t.tableResizeKey.getState(n).dragging)||e!==t.tableColumnResizeKey&&Boolean(t.tableColumnResizeKey.get(n))&&t.tableColumnResizeKey.getState(n).dragging)||e!==t.tableRowResizeKey&&Boolean(t.tableRowResizeKey.get(n))&&t.tableRowResizeKey.getState(n).dragging},t.otherResizeHandle=function(e,n){var r=!1;return(r=r||e!==t.tableColumnResizeKey&&Boolean(t.tableColumnResizeKey.get(n))&&t.tableColumnResizeKey.getState(n).activeHandle>-1)||e!==t.tableRowResizeKey&&Boolean(t.tableRowResizeKey.get(n))&&t.tableRowResizeKey.getState(n).activeHandle>-1},t.getTable=function(e){return e&&e.firstChild&&"TABLE"===e.firstChild.nodeName?e.firstChild:e},t.domCellAround=function(e){for(;e&&"TD"!==e.nodeName&&"TH"!==e.nodeName;)e=e.classList.contains("ProseMirror")?null:e.parentNode;return e},t.cellIndexes=function(e){for(var t=function(e){var t=Array.from(e&&e.rows||[]),n=Array.from(t&&t[0]&&t[0].cells||[]).map((function(e){return e.colSpan})).reduce((function(e,t){return e+t}),0),r=t.map((function(){return new Array(n)}));return t.forEach((function(e,t){var n=0;Array.from(e.cells).forEach((function(e){for(var o=0;o<e.colSpan;o++){for(var i=0;i<e.rowSpan;i++){var a=r[t+i].findIndex((function(e,t){return t>=n&&!e}));r[t+i][a]=e}n++}}))})),r}(e.closest("table")),n=null,r=function(r){if(t[r].forEach((function(t,o){e===t&&(n={rowIndex:r,cellIndex:o})})),n)return"break"},o=0;o<t.length&&"break"!==r(o);o++);return n||{rowIndex:-1,cellIndex:-1}},t.edgeCell=function(e,t,n){var r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return-1;var a=e.state.doc.resolve(r.pos),s=(0,i.parentNode)(a,(function(e){return"table"===e.type.spec.tableRole}));if(null===s)return-1;var l=a.start(s.depth),c=s.node,u=o.TableMap.get(c);return l+u.map[u.width*n.rowIndex+n.cellIndex]}},5643:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setHtml=t.getHtml=t.parseContent=t.domToPmDoc=t.pmDocToFragment=t.fragmentToHtml=t.htmlToFragment=t.trimWhitespace=void 0;var r=n(9443),o=n(2391),i=n(3352),a=n(2066),s=n(3147),l=["div","ol","ul","li","table","tbody","thead","tfoot","caption","td","th","p","tr","col","colgroup","article","main","nav","header","footer","aside","section"],c=function(e,t){var n=(e.ownerDocument||document).createElement(t);Array.from(e.rows).filter((function(e){return e.getAttribute(i.rowTypeAttr)===t})).forEach((function(e){e.removeAttribute(i.rowTypeAttr),n.appendChild(e)})),n.children.length&&e.appendChild(n)},u=function(e,t){var n=t.toUpperCase();e.filter((function(e){return e.nodeName===n})).forEach((function(e){Array.from(e.children).forEach((function(n){n.setAttribute(i.rowTypeAttr,t),e.parentNode&&e.parentNode.insertBefore(n,e)})),e.remove()}))};t.trimWhitespace=function(e,t){void 0===t&&(t=l);var n=t.join("|");return e.replace(new RegExp("\\s*(<(?:"+n+")(?:\\s[^>]*?)?>)","g"),"$1").replace(new RegExp("(<\\/(?:"+n+")(?:\\s[^>]*?)?>)\\s*","g"),"$1")};var f="data-style",d=" "+f+"=",h=/<[^>]+>/gm,p=/\sstyle=/gm,m=function(e){return e.replace(p,d)};t.htmlToFragment=function(e){var t,n=document.createElement("template");return n.innerHTML=function(e){return e.replace(h,m)}(e),t=n.content,Array.from(t.querySelectorAll("["+f+"]")).forEach((function(e){var t=e.getAttribute(f);e.removeAttribute(f),(0,s.setStyleAttr)(e,t)})),n.content},t.fragmentToHtml=function(e){return Array.from(e.childNodes).reduce((function(e,t){return e+(t.outerHTML||t.textContent||"")}),"")},t.pmDocToFragment=function(e){var t=a.DOMSerializer.fromSchema(e.type.schema).serializeFragment(e.content);return function(e){Array.from(e.querySelectorAll("table")).forEach((function(e){c(e,"thead"),c(e,"tbody"),c(e,"tfoot");var t=Array.from(e.children).find((function(e){return 0===e.children.length}));t&&t.remove();var n=e.parentNode instanceof HTMLDivElement?e.parentNode:null;if(n&&n.matches("div[table]")){e.style.marginLeft=n.style.marginLeft,e.style.marginRight=n.style.marginRight;var r=Array.from(n.children).find((function(e){return e.matches("div[caption]")}));if(r&&"<img>"!==r.innerHTML){var o=e.createCaption();for(r.id&&(o.id=r.id),r.className&&(o.className=r.className),Array.from(r.style).forEach((function(e){o.style[e]=r.style[e]}));r.firstChild;)o.appendChild(r.firstChild)}n.style.width&&!e.style.width&&(e.style.width=n.style.width),n.parentNode.insertBefore(e,n),n.parentNode.removeChild(n)}}))}(t),t},t.domToPmDoc=function(e,t,n){return r.DOMParser.fromSchema(t).parse(e,n)},t.parseContent=function(e,n,r){var o,a=(0,t.htmlToFragment)(e);return o=a,Array.from(o.querySelectorAll("table")).forEach((function(e){var t=Array.from(e.children);t.some((function(e){return"THEAD"===e.nodeName||"TFOOT"===e.nodeName}))&&(u(t,"thead"),u(t,"tbody"),u(t,"tfoot"));var n=t.find((function(e){return"COLGROUP"===e.nodeName}));if(n&&(e.setAttribute(i.colgroupAttr,n.outerHTML),n.remove()),e.caption||e.style.marginLeft||e.style.marginRight){var r=document.createElement("div");if(r.setAttribute("table",""),r.style.display="table",r.style.marginLeft=e.style.marginLeft,r.style.marginRight=e.style.marginRight,e.caption){var o=document.createElement("div");for(o.setAttribute("caption",""),e.caption.id&&(o.id=e.caption.id),e.caption.className&&(o.className=e.caption.className),Array.from(e.caption.style).forEach((function(t){o.style[t]=e.caption.style[t]}));e.caption.firstChild;)o.appendChild(e.caption.firstChild);e.removeChild(e.caption),r.appendChild(o)}e.parentNode.insertBefore(r,e),r.appendChild(e),/%/.test(e.style.width)&&(r.style.width=e.style.width,e.style.width="")}})),(0,t.domToPmDoc)(a,n,r)},t.getHtml=function(e){var n=(0,t.pmDocToFragment)(e.doc);return(0,t.fragmentToHtml)(n)},t.setHtml=function(e,n,r){return void 0===n&&(n="setHTML"),void 0===r&&(r={preserveWhitespace:"full"}),function(i,a){return a(i.tr.setSelection(new o.AllSelection(i.doc)).replaceSelectionWith((0,t.parseContent)(e,i.schema,r)).setMeta("commandName",n))}}},8153:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pmDeleteColumn=t.pmAddColumnAfter=t.pmAddColumnBefore=t.pmAddRowAfter=t.pmAddRowBefore=t.deleteColumn=t.addColumnAfter=t.addColumnBefore=t.addRowAfter=t.addRowBefore=t.createTable=void 0;var r=n(7582),o=n(1640);Object.defineProperty(t,"pmAddRowAfter",{enumerable:!0,get:function(){return o.addRowAfter}}),Object.defineProperty(t,"pmAddRowBefore",{enumerable:!0,get:function(){return o.addRowBefore}}),Object.defineProperty(t,"pmAddColumnBefore",{enumerable:!0,get:function(){return o.addColumnBefore}}),Object.defineProperty(t,"pmAddColumnAfter",{enumerable:!0,get:function(){return o.addColumnAfter}}),Object.defineProperty(t,"pmDeleteColumn",{enumerable:!0,get:function(){return o.deleteColumn}});var i=n(3352),a=n(4221);t.createTable=function(e,t,n){for(var r,o=e.table,i=e.table_row,a=e.table_cell,s=[],l=0;l<t+1;l++){r=[];for(var c=0;c<n+1;c++)r.push(a.createAndFill());s.push(i.createAndFill(void 0,r))}return o.createAndFill(void 0,s)};var s=/^table$/,l=/^table_row$/,c=/^table_cell|table_header$/,u=function(e,t){for(var n=e.$head,r=n.depth;r>0;r--){var o=n.node(r);if(t.test(o.type.name))return{pos:n.before(r),node:o}}return null};t.addRowBefore=function(e,t){var n=t&&function(e){var n,r=u(e.selection,l),o=u(e.selection,s);if(r&&o&&r.node.attrs[i.rowTypeAttr]){for(var a=0,c=0;c<o.node.nodeSize;c++)if(o.node.child(c).eq(r.node)){a=c;break}var f=o.node.child(a-1),d=r.pos-f.nodeSize;e.setNodeMarkup(d,void 0,((n={})[i.rowTypeAttr]=r.node.attrs[i.rowTypeAttr],n))}return t(e)};return(0,o.addRowBefore)(e,n)},t.addRowAfter=function(e,t){var n=t&&function(e){var n,r=u(e.selection,l);if(r&&r.node.attrs[i.rowTypeAttr]){var o=r.pos+r.node.nodeSize;e.setNodeMarkup(o,void 0,((n={})[i.rowTypeAttr]=r.node.attrs[i.rowTypeAttr],n))}return t(e)};return(0,o.addRowAfter)(e,n)};var f=function(e,t){if(!e)return-1;var n=o.TableMap.get(e.node),r=u(t,c),i=n.map.indexOf(r.pos-e.pos-1),a=-1;return-1!==i&&(a=i%n.width),a},d=function(e,t,n){var o,s=f(t,e.selection),l=(0,a.parseStrColgroup)(t.node.attrs[i.colgroupAttr]);l.insertBefore(l.ownerDocument.createElement("col"),l.children[s+n]),e.setNodeMarkup(t.pos,null,r.__assign(r.__assign({},t.node.attrs),((o={})[i.colgroupAttr]=l.outerHTML,o)))};t.addColumnBefore=function(e,t){var n=t&&function(e){var n=u(e.selection,s);return n.node.attrs[i.colgroupAttr]?(d(e,n,-1),t(e)):t(e)};return(0,o.addColumnBefore)(e,n)},t.addColumnAfter=function(e,t){var n=t&&function(e){var n=u(e.selection,s);return n.node.attrs[i.colgroupAttr]?(d(e,n,1),t(e)):t(e)};return(0,o.addColumnAfter)(e,n)},t.deleteColumn=function(e,t){var n=u(e.selection,s),l=n&&n.node.attrs[i.colgroupAttr],c=f(n,e.selection),d=t&&function(e){if(!l)return t(e);var o=e.doc.nodeAt(n.pos);return function(e,t,n){var o,s=(0,a.parseStrColgroup)(t.node.attrs[i.colgroupAttr]);s.removeChild(s.children[n]),e.setNodeMarkup(t.pos,null,r.__assign(r.__assign({},t.node.attrs),((o={})[i.colgroupAttr]=s.outerHTML,o)))}(e,{node:o,pos:n.pos},c),t(e)};return(0,o.deleteColumn)(e,d)}},6149:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.insertText=void 0,t.insertText=function(e){return function(t,n){n(t.tr.insertText(e.text,e.from,e.to))}}},3147:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setAttribute=t.setStyleAttr=t.applyStyle=t.parseStyle=t.expandToWordWrap=t.expandSelection=t.shallowEqual=t.indentHtml=t.selectedLineTextOnly=t.getNodeFromSelection=t.getSelectionText=t.hasSameMarkup=t.insertNode=t.parentNode=t.findNthParentNodeOfType=t.canInsert=t.setNodeStyle=t.changeStylesString=void 0;var r=n(7582),o=n(9443),i=n(2391),a=n(400),s=n(5643);t.changeStylesString=function(e,n){var r=n.style,o=n.value,i=n.newValue;if(!e)return{changed:!1,style:null};for(var a=(0,t.parseStyle)(e),s=Object.keys(a),l=[],c=0;c<s.length;c++){var u=s[c];u.toLowerCase()===r&&o.test(a[u])||l.push("".concat(u,": ").concat(a[u]))}return i&&l.push("".concat(r,": ").concat(i)),{style:l.join("; ")+(l.length?";":""),changed:Boolean(i)||l.length!==s.length}};var l=/^.+$/;t.setNodeStyle=function(e,n,o){var i;if(new RegExp("[^-]?"+n+":").test(e.style||"")){var a=(0,t.changeStylesString)(e.style||"",{style:n,value:l,newValue:o}).style;i=r.__assign(r.__assign({},e),{style:a})}else i=e.style?r.__assign(r.__assign({},e),{style:e.style.replace(/;$/,"")+"; "+n+": "+o+";"}):r.__assign(r.__assign({},e),{style:n+": "+o+";"});return i},t.canInsert=function(e,t){for(var n=e.selection.$from,r=n.depth;r>=0;r--){var o=n.index(r);if(n.node(r).canReplaceWith(o,o,t))return!0}return!1};var c=function(e){return e instanceof o.Node?e.type.name:e.name};t.findNthParentNodeOfType=function(e,t){return void 0===t&&(t=1),function(n){return function(e,t){return void 0===t&&(t=1),function(n){for(var r=n.$from,o=r.depth;o>0;o--){var i=r.node(o);if(e(i)&&0==(t-=1))return{depth:o,node:i}}}}((function(t){return c(t)===c(e)}),t)(n)}},t.parentNode=function(e,t){for(var n=e.depth;n>0;n--){var r=e.node(n);if(t(r))return{node:r,depth:n}}return null};var u=function(e){var t={};for(var n in e)n&&(e[n]||0===e[n])&&(t[n]=e[n]);return t};t.insertNode=function(e,t){return function(n,o){var a=n.selection,s=n.tr;a instanceof i.NodeSelection&&a.node.type.name===e.type.name&&e.isLeaf&&!e.isText&&1===e.nodeSize?(s.setNodeMarkup(a.from,null,r.__assign(r.__assign({},u(a.node.attrs)),u(e.attrs))),s.setSelection(i.NodeSelection.create(s.doc,a.from))):s.replaceSelectionWith(e),t&&s.scrollIntoView(),o(s)}},t.hasSameMarkup=function(e,t,n,r){var i=o.Fragment.from((0,s.parseContent)(e,n,r)),a=o.Fragment.from((0,s.parseContent)(t,n,r));return i.eq(a)},t.getSelectionText=function(e){var t=e.selection;if(t instanceof i.TextSelection||t instanceof i.AllSelection){var n=t.content().content;return n.textBetween(0,n.size)}return""},t.getNodeFromSelection=function(e){if(e.selection instanceof i.NodeSelection)return e.selection.node},t.selectedLineTextOnly=function(e){var n="",r=!1,o=e.selection,i=e.doc,a=o.$from,s=o.$to,l=o.from,c=o.to;return a.sameParent(s)&&(i.nodesBetween(l,c,(function(e){r=r||e.isLeaf&&!e.isText})),r||(n=(0,t.getSelectionText)(e))),n},t.indentHtml=function(e){return e.replace(/<\/(p|li|ul|ol|h[1-6]|table|tr|td|th)>/gi,"</$1>\n").replace(/<(ul|ol)([^>]*)><li/gi,"<$1$2>\n<li").replace(/<br \/>/gi,"<br />\n").replace(/\n$/,"")},t.shallowEqual=function(e,t){var n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((function(n){return e[n]===t[n]}))};var f={before:/[^ !,?.\[\]{}()]+$/i,after:/^[^ !,?.\[\]{}()]+/i};t.expandSelection=function(e,t,n){if(!n.applyToWord||!e.selection.empty)return{state:e,dispatch:t};var r=!0===n.applyToWord?f:n.applyToWord,o=null,a=e.tr,s=e.selection,l=s.$head.nodeBefore,c=s.$head.nodeAfter;if(l&&"text"===l.type.name&&l.text&&c&&"text"===c.type.name&&c.text){var u=[];s.$head.parent.descendants((function(e,t){return u.push({node:e,pos:t}),!1}));for(var d=s.$head.parentOffset,h=u.findIndex((function(e){var t=e.node,n=e.pos;return n<=d&&n+t.nodeSize>=d})),p=u[h].node.text,m=!1,v=h-1;v>=0;v--){var g=u[v];!m&&g&&"text"===g.node.type.name?p=g.node.text+p:(m=!0,d-=g.node.nodeSize)}for(v=h+1;v<u.length&&((g=u[v])&&"text"===g.node.type.name);v++)p+=g.node.text;var y=p.substring(0,d),b=p.substring(d),w=r.before.exec(y),k=r.after.exec(b);if(w&&k){var S=w[0].length,x=k[0].length,C=o=s.from;return a.setSelection(i.TextSelection.create(e.doc,C-S,C+x)),{state:{tr:a,selection:a.selection,doc:a.doc,storedMarks:null,schema:a.doc.type.schema},dispatch:function(e){e.setSelection(i.TextSelection.create(e.doc,o)),t(e)}}}}return{state:e,dispatch:t}},t.expandToWordWrap=function(e,n){return function(r,o){var i=(0,t.expandSelection)(r,o,n),a=i.state,s=i.dispatch;return e(n)(a,s)}},t.parseStyle=function(e){return(0,a.parseInlineStyles)(e)},t.applyStyle=function(e,n,r){var o=(0,t.parseStyle)(e);o[n]=r;var i=Object.keys(o).map((function(e){return o[e]?"".concat(e,": ").concat(o[e]):null})).filter(Boolean).join("; ");return i?i+";":null},t.setStyleAttr=function(e,n){var r=(0,t.parseStyle)(n);for(var o in r)o&&void 0!==e.style[o]&&(e.style[o]=r[o])},t.setAttribute=function(e,n,r){var o=e.getAttribute(n);void 0!==r&&r!==o?"style"===n?(e.removeAttribute(n),(0,t.setStyleAttr)(e,r)):e.setAttribute(n,r):void 0===r&&e.removeAttribute(n)}},6586:e=>{function t(e){this.content=e}t.prototype={constructor:t,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,n,r){var o=r&&r!=e?this.remove(r):this,i=o.find(e),a=o.content.slice();return-1==i?a.push(r||e,n):(a[i+1]=n,r&&(a[i]=r)),new t(a)},remove:function(e){var n=this.find(e);if(-1==n)return this;var r=this.content.slice();return r.splice(n,2),new t(r)},addToStart:function(e,n){return new t([e,n].concat(this.remove(e).content))},addToEnd:function(e,n){var r=this.remove(e).content.slice();return r.push(e,n),new t(r)},addBefore:function(e,n,r){var o=this.remove(n),i=o.content.slice(),a=o.find(e);return i.splice(-1==a?i.length:a,0,n,r),new t(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=t.from(e)).size?new t(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=t.from(e)).size?new t(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var n=this;e=t.from(e);for(var r=0;r<e.content.length;r+=2)n=n.remove(e.content[r]);return n},toObject:function(){var e={};return this.forEach((function(t,n){e[t]=n})),e},get size(){return this.content.length>>1}},t.from=function(e){if(e instanceof t)return e;var n=[];if(e)for(var r in e)n.push(r,e[r]);return new t(n)},e.exports=t},9270:(e,t,n)=>{var r=n(2843),o=n(9443),i=n(2391),a=function(e,t){return!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0)};function s(e,t){var n=e.selection.$cursor;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}var l=function(e,t,n){var a=s(e,n);if(!a)return!1;var l=d(a);if(!l){var c=a.blockRange(),f=c&&r.liftTarget(c);return null!=f&&(t&&t(e.tr.lift(c,f).scrollIntoView()),!0)}var h=l.nodeBefore;if(O(e,l,t,-1))return!0;if(0==a.parent.content.size&&(u(h,"end")||i.NodeSelection.isSelectable(h)))for(var p=a.depth;;p--){var m=r.replaceStep(e.doc,a.before(p),a.after(p),o.Slice.empty);if(m&&m.slice.size<m.to-m.from){if(t){var v=e.tr.step(m);v.setSelection(u(h,"end")?i.Selection.findFrom(v.doc.resolve(v.mapping.map(l.pos,-1)),-1):i.NodeSelection.create(v.doc,l.pos-h.nodeSize)),t(v.scrollIntoView())}return!0}if(1==p||a.node(p-1).childCount>1)break}return!(!h.isAtom||l.depth!=a.depth-1||(t&&t(e.tr.delete(l.pos-h.nodeSize,l.pos).scrollIntoView()),0))};function c(e,t,n){for(var a=t.nodeBefore,s=t.pos-1;!a.isTextblock;s--){if(a.type.spec.isolating)return!1;var l=a.lastChild;if(!l)return!1;a=l}for(var c=t.nodeAfter,u=t.pos+1;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;var f=c.firstChild;if(!f)return!1;c=f}var d=r.replaceStep(e.doc,s,u,o.Slice.empty);if(!d||d.from!=s||d instanceof r.ReplaceStep&&d.slice.size>=u-s)return!1;if(n){var h=e.tr.step(d);h.setSelection(i.TextSelection.create(h.doc,s)),n(h.scrollIntoView())}return!0}function u(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}var f=function(e,t,n){var r=e.selection,o=r.$head,a=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):o.parentOffset>0)return!1;a=d(o)}var s=a&&a.nodeBefore;return!(!s||!i.NodeSelection.isSelectable(s)||(t&&t(e.tr.setSelection(i.NodeSelection.create(e.doc,a.pos-s.nodeSize)).scrollIntoView()),0))};function d(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function h(e,t){var n=e.selection.$cursor;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}var p=function(e,t,n){var a=h(e,n);if(!a)return!1;var s=v(a);if(!s)return!1;var l=s.nodeAfter;if(O(e,s,t,1))return!0;if(0==a.parent.content.size&&(u(l,"start")||i.NodeSelection.isSelectable(l))){var c=r.replaceStep(e.doc,a.before(),a.after(),o.Slice.empty);if(c&&c.slice.size<c.to-c.from){if(t){var f=e.tr.step(c);f.setSelection(u(l,"start")?i.Selection.findFrom(f.doc.resolve(f.mapping.map(s.pos)),1):i.NodeSelection.create(f.doc,f.mapping.map(s.pos))),t(f.scrollIntoView())}return!0}}return!(!l.isAtom||s.depth!=a.depth-1||(t&&t(e.tr.delete(s.pos,s.pos+l.nodeSize).scrollIntoView()),0))},m=function(e,t,n){var r=e.selection,o=r.$head,a=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):o.parentOffset<o.parent.content.size)return!1;a=v(o)}var s=a&&a.nodeAfter;return!(!s||!i.NodeSelection.isSelectable(s)||(t&&t(e.tr.setSelection(i.NodeSelection.create(e.doc,a.pos)).scrollIntoView()),0))};function v(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){var n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var g=function(e,t){var n=e.selection,r=n.$head,o=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(o)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))};function y(e){for(var t=0;t<e.edgeCount;t++){var n=e.edge(t).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var b=function(e,t){var n=e.selection,r=n.$head,o=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(o))return!1;var a=r.node(-1),s=r.indexAfter(-1),l=y(a.contentMatchAt(s));if(!l||!a.canReplaceWith(s,s,l))return!1;if(t){var c=r.after(),u=e.tr.replaceWith(c,c,l.createAndFill());u.setSelection(i.Selection.near(u.doc.resolve(c),1)),t(u.scrollIntoView())}return!0},w=function(e,t){var n=e.selection,r=n.$from,o=n.$to;if(n instanceof i.AllSelection||r.parent.inlineContent||o.parent.inlineContent)return!1;var a=y(o.parent.contentMatchAt(o.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){var s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=e.tr.insert(s,a.createAndFill());l.setSelection(i.TextSelection.create(l.doc,s+1)),t(l.scrollIntoView())}return!0},k=function(e,t){var n=e.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var o=n.before();if(r.canSplit(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}var i=n.blockRange(),a=i&&r.liftTarget(i);return null!=a&&(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)};function S(e){return function(t,n){var o=t.selection,a=o.$from,s=o.$to;if(t.selection instanceof i.NodeSelection&&t.selection.node.isBlock)return!(!a.parentOffset||!r.canSplit(t.doc,a.pos)||(n&&n(t.tr.split(a.pos).scrollIntoView()),0));if(!a.depth)return!1;for(var l,c,u=[],f=!1,d=!1,h=a.depth;;h--){if(a.node(h).isBlock){f=a.end(h)==a.pos+(a.depth-h),d=a.start(h)==a.pos-(a.depth-h),c=y(a.node(h-1).contentMatchAt(a.indexAfter(h-1)));var p=e&&e(s.parent,f,a);u.unshift(p||(f&&c?{type:c}:null)),l=h;break}if(1==h)return!1;u.unshift(null)}var m=t.tr;(t.selection instanceof i.TextSelection||t.selection instanceof i.AllSelection)&&m.deleteSelection();var v=m.mapping.map(a.pos),g=r.canSplit(m.doc,v,u.length,u);if(g||(u[0]=c?{type:c}:null,g=r.canSplit(m.doc,v,u.length,u)),m.split(v,u.length,u),!f&&d&&a.node(l).type!=c){var b=m.mapping.map(a.before(l)),w=m.doc.resolve(b);c&&a.node(l-1).canReplaceWith(w.index(),w.index()+1,c)&&m.setNodeMarkup(m.mapping.map(a.before(l)),c)}return n&&n(m.scrollIntoView()),!0}}var x=S(),C=function(e,t){return t&&t(e.tr.setSelection(new i.AllSelection(e.doc))),!0};function O(e,t,n,a){var s,l,c=t.nodeBefore,f=t.nodeAfter,d=c.type.spec.isolating||f.type.spec.isolating;if(!d&&function(e,t,n){var o=t.nodeBefore,i=t.nodeAfter,a=t.index();return!(!(o&&i&&o.type.compatibleContent(i.type))||(!o.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(a,a+1)||!i.isTextblock&&!r.canJoin(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;var h=!d&&t.parent.canReplace(t.index(),t.index()+1);if(h&&(s=(l=c.contentMatchAt(c.childCount)).findWrapping(f.type))&&l.matchType(s[0]||f.type).validEnd){if(n){for(var p=t.pos+f.nodeSize,m=o.Fragment.empty,v=s.length-1;v>=0;v--)m=o.Fragment.from(s[v].create(null,m));m=o.Fragment.from(c.copy(m));var g=e.tr.step(new r.ReplaceAroundStep(t.pos-1,p,t.pos,p,new o.Slice(m,1,0),s.length,!0)),y=g.doc.resolve(p+2*s.length);y.nodeAfter&&y.nodeAfter.type==c.type&&r.canJoin(g.doc,y.pos)&&g.join(y.pos),n(g.scrollIntoView())}return!0}var b=f.type.spec.isolating||a>0&&d?null:i.Selection.findFrom(t,1),w=b&&b.$from.blockRange(b.$to),k=w&&r.liftTarget(w);if(null!=k&&k>=t.depth)return n&&n(e.tr.lift(w,k).scrollIntoView()),!0;if(h&&u(f,"start",!0)&&u(c,"end")){for(var S=c,x=[];x.push(S),!S.isTextblock;)S=S.lastChild;for(var C=f,O=1;!C.isTextblock;C=C.firstChild)O++;if(S.canReplace(S.childCount,S.childCount,C.content)){if(n){for(var M=o.Fragment.empty,T=x.length-1;T>=0;T--)M=o.Fragment.from(x[T].copy(M));n(e.tr.step(new r.ReplaceAroundStep(t.pos-x.length,t.pos+f.nodeSize,t.pos+O,t.pos+f.nodeSize-O,new o.Slice(M,x.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function M(e){return function(t,n){for(var r=t.selection,o=e<0?r.$from:r.$to,a=o.depth;o.node(a).isInline;){if(!a)return!1;a--}return!!o.node(a).isTextblock&&(n&&n(t.tr.setSelection(i.TextSelection.create(t.doc,e<0?o.start(a):o.end(a)))),!0)}}var T=M(-1),A=M(1);function N(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e,n,r){for(var o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}var R=N(a,l,f),D=N(a,p,m),_={Enter:N(g,w,k,x),"Mod-Enter":b,Backspace:R,"Mod-Backspace":R,"Shift-Backspace":R,Delete:D,"Mod-Delete":D,"Mod-a":C},E={"Ctrl-h":_.Backspace,"Alt-Backspace":_["Mod-Backspace"],"Ctrl-d":_.Delete,"Ctrl-Alt-Backspace":_["Mod-Delete"],"Alt-Delete":_["Mod-Delete"],"Alt-d":_["Mod-Delete"],"Ctrl-a":T,"Ctrl-e":A};for(var P in _)E[P]=_[P];var z=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&"darwin"==os.platform())?E:_;t.autoJoin=function(e,t){var n=Array.isArray(t)?function(e){return t.indexOf(e.type.name)>-1}:t;return function(t,o,i){return e(t,o&&function(e,t){return function(n){if(!n.isGeneric)return e(n);for(var o=[],i=0;i<n.mapping.maps.length;i++){for(var a=n.mapping.maps[i],s=0;s<o.length;s++)o[s]=a.map(o[s]);a.forEach((function(e,t,n,r){return o.push(n,r)}))}for(var l=[],c=0;c<o.length;c+=2)for(var u=o[c],f=o[c+1],d=n.doc.resolve(u),h=d.sharedDepth(f),p=d.node(h),m=d.indexAfter(h),v=d.after(h+1);v<=f;++m){var g=p.maybeChild(m);if(!g)break;if(m&&-1==l.indexOf(v)){var y=p.child(m-1);y.type==g.type&&t(y,g)&&l.push(v)}v+=g.nodeSize}l.sort((function(e,t){return e-t}));for(var b=l.length-1;b>=0;b--)r.canJoin(n.doc,l[b])&&n.join(l[b]);e(n)}}(o,n),i)}},t.baseKeymap=z,t.chainCommands=N,t.createParagraphNear=w,t.deleteSelection=a,t.exitCode=b,t.joinBackward=l,t.joinDown=function(e,t){var n,o=e.selection;if(o instanceof i.NodeSelection){if(o.node.isTextblock||!r.canJoin(e.doc,o.to))return!1;n=o.to}else if(null==(n=r.joinPoint(e.doc,o.to,1)))return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0},t.joinForward=p,t.joinTextblockBackward=function(e,t,n){var r=s(e,n);if(!r)return!1;var o=d(r);return!!o&&c(e,o,t)},t.joinTextblockForward=function(e,t,n){var r=h(e,n);if(!r)return!1;var o=v(r);return!!o&&c(e,o,t)},t.joinUp=function(e,t){var n,o=e.selection,a=o instanceof i.NodeSelection;if(a){if(o.node.isTextblock||!r.canJoin(e.doc,o.from))return!1;n=o.from}else if(null==(n=r.joinPoint(e.doc,o.from,-1)))return!1;if(t){var s=e.tr.join(n);a&&s.setSelection(i.NodeSelection.create(s.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(s.scrollIntoView())}return!0},t.lift=function(e,t){var n=e.selection,o=n.$from,i=n.$to,a=o.blockRange(i),s=a&&r.liftTarget(a);return null!=s&&(t&&t(e.tr.lift(a,s).scrollIntoView()),!0)},t.liftEmptyBlock=k,t.macBaseKeymap=E,t.newlineInCode=g,t.pcBaseKeymap=_,t.selectAll=C,t.selectNodeBackward=f,t.selectNodeForward=m,t.selectParentNode=function(e,t){var n,r=e.selection,o=r.$from,a=r.to,s=o.sharedDepth(a);return 0!=s&&(n=o.before(s),t&&t(e.tr.setSelection(i.NodeSelection.create(e.doc,n))),!0)},t.selectTextblockEnd=A,t.selectTextblockStart=T,t.setBlockType=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,r){for(var o=!1,i=0;i<n.selection.ranges.length&&!o;i++){var a=n.selection.ranges[i],s=a.$from.pos,l=a.$to.pos;n.doc.nodesBetween(s,l,(function(r,i){if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{var a=n.doc.resolve(i),s=a.index();o=a.parent.canReplaceWith(s,s+1,e)}}))}if(!o)return!1;if(r){for(var c=n.tr,u=0;u<n.selection.ranges.length;u++){var f=n.selection.ranges[u],d=f.$from.pos,h=f.$to.pos;c.setBlockType(d,h,e,t)}r(c.scrollIntoView())}return!0}},t.splitBlock=x,t.splitBlockAs=S,t.splitBlockKeepMarks=function(e,t){return x(e,t&&function(n){var r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();r&&n.ensureMarks(r),t(n)})},t.toggleMark=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=!1!==(n&&n.removeWhenPresent),o=!1!==(n&&n.enterInlineAtoms);return function(n,a){var s=n.selection,l=s.empty,c=s.$cursor,u=s.ranges;if(l&&!c||!function(e,t,n,r){for(var o,i=function(){var o=t[a],i=o.$from,s=o.$to,l=0==i.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(i.pos,s.pos,(function(e,t){if(l||!r&&e.isAtom&&e.isInline&&t>=i.pos&&t+e.nodeSize<=s.pos)return!1;l=e.inlineContent&&e.type.allowsMarkType(n)})),l)return{v:!0}},a=0;a<t.length;a++)if(o=i())return o.v;return!1}(n.doc,u,e,o))return!1;if(a)if(c)e.isInSet(n.storedMarks||c.marks())?a(n.tr.removeStoredMark(e)):a(n.tr.addStoredMark(e.create(t)));else{var f,d=n.tr;o||(u=function(e){for(var t=[],n=function(){var n=e[r],o=n.$from,a=n.$to;o.doc.nodesBetween(o.pos,a.pos,(function(e,n){if(e.isAtom&&e.content.size&&e.isInline&&n>=o.pos&&n+e.nodeSize<=a.pos)return n+1>o.pos&&t.push(new i.SelectionRange(o,o.doc.resolve(n+1))),o=o.doc.resolve(n+1+e.content.size),!1})),o.pos<a.pos&&t.push(new i.SelectionRange(o,a))},r=0;r<e.length;r++)n();return t}(u)),f=r?!u.some((function(t){return n.doc.rangeHasMark(t.$from.pos,t.$to.pos,e)})):!u.every((function(t){var n=!1;return d.doc.nodesBetween(t.$from.pos,t.$to.pos,(function(r,o,i){if(n)return!1;n=!e.isInSet(r.marks)&&!!i&&i.type.allowsMarkType(e)&&!(r.isText&&/^\s*$/.test(r.textBetween(Math.max(0,t.$from.pos-o),Math.min(r.nodeSize,t.$to.pos-o))))})),!n}));for(var h=0;h<u.length;h++){var p=u[h],m=p.$from,v=p.$to;if(f){var g=m.pos,y=v.pos,b=m.nodeAfter,w=v.nodeBefore,k=b&&b.isText?/^\s*/.exec(b.text)[0].length:0,S=w&&w.isText?/\s*$/.exec(w.text)[0].length:0;g+k<y&&(g+=k,y-=S),d.addMark(g,y,e.create(t))}else d.removeMark(m.pos,v.pos,e)}a(d.scrollIntoView())}return!0}},t.wrapIn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,o){var i=n.selection,a=i.$from,s=i.$to,l=a.blockRange(s),c=l&&r.findWrapping(l,e,t);return!!c&&(o&&o(n.tr.wrap(l,c).scrollIntoView()),!0)}}},1588:(e,t,n)=>{function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2391),i=n(2843),a=function(){function e(t,n){var r,o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(r=n.width)&&void 0!==r?r:1,this.color=!1===n.color?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map((function(e){var n=function(t){o[e](t)};return t.dom.addEventListener(e,n),{name:e,handler:n}}))}var t,n;return t=e,(n=[{key:"destroy",value:function(){var e=this;this.handlers.forEach((function(t){var n=t.name,r=t.handler;return e.editorView.dom.removeEventListener(n,r)}))}},{key:"update",value:function(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}},{key:"setCursor",value:function(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}},{key:"updateOverlay",value:function(){var e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent;if(n){var r=t.nodeBefore,o=t.nodeAfter;if(r||o){var i=this.editorView.nodeDOM(this.cursorPos-(r?r.nodeSize:0));if(i){var a=i.getBoundingClientRect(),s=r?a.bottom:a.top;r&&o&&(s=(s+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),e={left:a.left,right:a.right,top:s-this.width/2,bottom:s+this.width/2}}}}if(!e){var l=this.editorView.coordsAtPos(this.cursorPos);e={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}var c,u,f=this.editorView.dom.offsetParent;if(this.element||(this.element=f.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!f||f==document.body&&"static"==getComputedStyle(f).position)c=-pageXOffset,u=-pageYOffset;else{var d=f.getBoundingClientRect();c=d.left-f.scrollLeft,u=d.top-f.scrollTop}this.element.style.left=e.left-c+"px",this.element.style.top=e.top-u+"px",this.element.style.width=e.right-e.left+"px",this.element.style.height=e.bottom-e.top+"px"}},{key:"scheduleRemoval",value:function(e){var t=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return t.setCursor(null)}),e)}},{key:"dragover",value:function(e){if(this.editorView.editable){var t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,t,e):r;if(t&&!o){var a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){var s=i.dropPoint(this.editorView.state.doc,a,this.editorView.dragging.slice);null!=s&&(a=s)}this.setCursor(a),this.scheduleRemoval(5e3)}}}},{key:"dragend",value:function(){this.scheduleRemoval(20)}},{key:"drop",value:function(){this.scheduleRemoval(20)}},{key:"dragleave",value:function(e){e.target!=this.editorView.dom&&this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}])&&r(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.dropCursor=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new o.Plugin({view:function(t){return new a(t,e)}})}},1634:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}Object.defineProperty(t,"__esModule",{value:!0});var c=n(7354),u=n(2391),f=n(9443),d=n(9222),h=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(c,e);var t,n,i=(t=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,o=l(t);if(n){var i=l(this).constructor;e=Reflect.construct(o,arguments,i)}else e=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function c(e){return o(this,c),i.call(this,e,e)}return a(c,[{key:"map",value:function(e,t){var n=e.resolve(t.map(this.head));return c.valid(n)?new c(n):u.Selection.near(n)}},{key:"content",value:function(){return f.Slice.empty}},{key:"eq",value:function(e){return e instanceof c&&e.head==this.head}},{key:"toJSON",value:function(){return{type:"gapcursor",pos:this.head}}},{key:"getBookmark",value:function(){return new p(this.anchor)}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new c(e.resolve(t.pos))}},{key:"valid",value:function(e){var t=e.parent;if(t.isTextblock||!function(e){for(var t=e.depth;t>=0;t--){var n=e.index(t),r=e.node(t);if(0!=n)for(var o=r.child(n-1);;o=o.lastChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(var t=e.depth;t>=0;t--){var n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(var o=r.child(n);;o=o.firstChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;var n=t.type.spec.allowGapCursor;if(null!=n)return n;var r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}},{key:"findGapCursorFrom",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e:for(;;){if(!n&&c.valid(e))return e;for(var r=e.pos,o=null,i=e.depth;;i--){var a=e.node(i);if(t>0?e.indexAfter(i)<a.childCount:e.index(i)>0){o=a.child(t>0?e.indexAfter(i):e.index(i)-1);break}if(0==i)return null;r+=t;var s=e.doc.resolve(r);if(c.valid(s))return s}for(;;){var l=t>0?o.firstChild:o.lastChild;if(!l){if(o.isAtom&&!o.isText&&!u.NodeSelection.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*t),n=!1;continue e}break}o=l,r+=t;var f=e.doc.resolve(r);if(c.valid(f))return f}return null}}}]),c}(u.Selection);h.prototype.visible=!1,h.findFrom=h.findGapCursorFrom,u.Selection.jsonID("gapcursor",h);var p=function(){function e(t){o(this,e),this.pos=t}return a(e,[{key:"map",value:function(t){return new e(t.map(this.pos))}},{key:"resolve",value:function(e){var t=e.resolve(this.pos);return h.valid(t)?new h(t):u.Selection.near(t)}}]),e}(),m=c.keydownHandler({ArrowLeft:v("horiz",-1),ArrowRight:v("horiz",1),ArrowUp:v("vert",-1),ArrowDown:v("vert",1)});function v(e,t){var n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,o){var i=e.selection,a=t>0?i.$to:i.$from,s=i.empty;if(i instanceof u.TextSelection){if(!o.endOfTextblock(n)||0==a.depth)return!1;s=!1,a=e.doc.resolve(t>0?a.after():a.before())}var l=h.findGapCursorFrom(a,t,s);return!!l&&(r&&r(e.tr.setSelection(new h(l))),!0)}}function g(e,t,n){if(!e||!e.editable)return!1;var r=e.state.doc.resolve(t);if(!h.valid(r))return!1;var o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&u.NodeSelection.isSelectable(e.state.doc.nodeAt(o.inside))||(e.dispatch(e.state.tr.setSelection(new h(r))),0))}function y(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof h))return!1;var n=e.state.selection.$from,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;for(var o=f.Fragment.empty,i=r.length-1;i>=0;i--)o=f.Fragment.from(r[i].createAndFill(null,o));var a=e.state.tr.replace(n.pos,n.pos,new f.Slice(o,0,0));return a.setSelection(u.TextSelection.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function b(e){if(!(e.selection instanceof h))return null;var t=document.createElement("div");return t.className="ProseMirror-gapcursor",d.DecorationSet.create(e.doc,[d.Decoration.widget(e.selection.head,t,{key:"gapcursor"})])}t.GapCursor=h,t.gapCursor=function(){return new u.Plugin({props:{decorations:b,createSelectionBetween:function(e,t,n){return t.pos==n.pos&&h.valid(n)?new h(n):null},handleClick:g,handleKeyDown:m,handleDOMEvents:{beforeinput:y}}})}},8638:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e){if("object"!==r(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===r(i)?i:String(i)),o)}var i}function a(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var s=n(3958),l=n(2843),c=n(2391),u=function(){function e(t,n){o(this,e),this.items=t,this.eventCount=n}return a(e,[{key:"popEvent",value:function(t,n){var r=this;if(0==this.eventCount)return null;for(var o,i,a=this.items.length;;a--)if(this.items.get(a-1).selection){--a;break}n&&(o=this.remapping(a,this.items.length),i=o.maps.length);var s,l,c=t.tr,u=[],d=[];return this.items.forEach((function(t,n){if(!t.step)return o||(o=r.remapping(a,n+1),i=o.maps.length),i--,void d.push(t);if(o){d.push(new f(t.map));var h,p=t.step.map(o.slice(i));p&&c.maybeStep(p).doc&&(h=c.mapping.maps[c.mapping.maps.length-1],u.push(new f(h,void 0,void 0,u.length+d.length))),i--,h&&o.appendMap(h,i)}else c.maybeStep(t.step);return t.selection?(s=o?t.selection.map(o.slice(i)):t.selection,l=new e(r.items.slice(0,a).append(d.reverse().concat(u)),r.eventCount-1),!1):void 0}),this.items.length,0),{remaining:l,transform:c,selection:s}}},{key:"addTransform",value:function(t,n,r,o){for(var i=[],a=this.eventCount,s=this.items,l=!o&&s.length?s.get(s.length-1):null,c=0;c<t.steps.length;c++){var u,d=t.steps[c].invert(t.docs[c]),p=new f(t.mapping.maps[c],d,n);(u=l&&l.merge(p))&&(p=u,c?i.pop():s=s.slice(0,s.length-1)),i.push(p),n&&(a++,n=void 0),o||(l=p)}var m,v,g,y=a-r.depth;return y>h&&(v=y,(m=s).forEach((function(e,t){if(e.selection&&0==v--)return g=t,!1})),s=m.slice(g),a-=y),new e(s.append(i),a)}},{key:"remapping",value:function(e,t){var n=new l.Mapping;return this.items.forEach((function(t,r){var o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)}),e,t),n}},{key:"addMaps",value:function(t){return 0==this.eventCount?this:new e(this.items.append(t.map((function(e){return new f(e)}))),this.eventCount)}},{key:"rebased",value:function(t,n){if(!this.eventCount)return this;var r=[],o=Math.max(0,this.items.length-n),i=t.mapping,a=t.steps.length,s=this.eventCount;this.items.forEach((function(e){e.selection&&s--}),o);var l=n;this.items.forEach((function(e){var n=i.getMirror(--l);if(null!=n){a=Math.min(a,n);var o=i.maps[n];if(e.step){var c=t.steps[n].invert(t.docs[n]),u=e.selection&&e.selection.map(i.slice(l+1,n));u&&s++,r.push(new f(o,c,u))}else r.push(new f(o))}}),o);for(var c=[],u=n;u<a;u++)c.push(new f(i.maps[u]));var d=new e(this.items.slice(0,o).append(c).append(r),s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-r.length)),d}},{key:"emptyItemCount",value:function(){var e=0;return this.items.forEach((function(t){t.step||e++})),e}},{key:"compress",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.items.length,n=this.remapping(0,t),r=n.maps.length,o=[],i=0;return this.items.forEach((function(e,a){if(a>=t)o.push(e),e.selection&&i++;else if(e.step){var s=e.step.map(n.slice(r)),l=s&&s.getMap();if(r--,l&&n.appendMap(l,r),s){var c=e.selection&&e.selection.map(n.slice(r));c&&i++;var u,d=new f(l.invert(),s,c),h=o.length-1;(u=o.length&&o[h].merge(d))?o[h]=u:o.push(d)}}else e.map&&r--}),this.items.length,0),new e(s.from(o.reverse()),i)}}]),e}();u.empty=new u(s.empty,0);var f=function(){function e(t,n,r,i){o(this,e),this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}return a(e,[{key:"merge",value:function(t){if(this.step&&t.step&&!t.selection){var n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}}]),e}(),d=a((function e(t,n,r,i,a){o(this,e),this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=a})),h=20;function p(e){for(var t=[],n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((function(e,n,r,o){return t.push(r,o)}));return t}function m(e,t){if(!e)return null;for(var n=[],r=0;r<e.length;r+=2){var o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}var v=!1,g=null;function y(e){var t=e.plugins;if(g!=t){v=!1,g=t;for(var n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){v=!0;break}}return v}var b=new c.PluginKey("history"),w=new c.PluginKey("closeHistory");function k(e,t){return function(n,r){var o=b.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){var i=function(e,t,n){var r=y(t),o=b.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;var a=i.selection.resolve(i.transform.doc),s=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new d(n?s:i.remaining,n?i.remaining:s,null,0,-1);return i.transform.setSelection(a).setMeta(b,{redo:n,historyState:l})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}var S=k(!1,!0),x=k(!0,!0),C=k(!1,!1),O=k(!0,!1);t.closeHistory=function(e){return e.setMeta(w,!0)},t.history=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new c.Plugin({key:b,state:{init:function(){return new d(u.empty,u.empty,null,0,-1)},apply:function(t,n,r){return function(e,t,n,r){var o,i=n.getMeta(b);if(i)return i.historyState;n.getMeta(w)&&(e=new d(e.done,e.undone,null,0,-1));var a=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(a&&a.getMeta(b))return a.getMeta(b).redo?new d(e.done.addTransform(n,void 0,r,y(t)),e.undone,p(n.mapping.maps),e.prevTime,e.prevComposition):new d(e.done,e.undone.addTransform(n,void 0,r,y(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||a&&!1===a.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new d(e.done.rebased(n,o),e.undone.rebased(n,o),m(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new d(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),m(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);var s=n.getMeta("composition"),l=0==e.prevTime||!a&&e.prevComposition!=s&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;var n=!1;return e.mapping.maps[0].forEach((function(e,r){for(var o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)})),n}(n,e.prevRanges)),c=a?m(e.prevRanges,n.mapping):p(n.mapping.maps);return new d(e.done.addTransform(n,l?t.selection.getBookmark():void 0,r,y(t)),u.empty,c,n.time,null==s?e.prevComposition:s)}(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput:function(e,t){var n=t.inputType,r="historyUndo"==n?S:"historyRedo"==n?x:null;return!!r&&(t.preventDefault(),r(e.state,e.dispatch))}}}})},t.redo=x,t.redoDepth=function(e){var t=b.getState(e);return t?t.undone.eventCount:0},t.redoNoScroll=O,t.undo=S,t.undoDepth=function(e){var t=b.getState(e);return t?t.done.eventCount:0},t.undoNoScroll=C},8665:(e,t,n)=>{var r,o=n(2391),i=n(2843),a=(r=function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.match=t,this.match=t,this.handler="string"==typeof n?(r=n,function(e,t,n,o){var i=r;if(t[1]){var a=t[0].lastIndexOf(t[1]);i+=t[0].slice(a+t[1].length);var s=(n+=a)-o;s>0&&(i=t[0].slice(a-s,a)+i,n=o)}return e.tr.insertText(i,n,o)}):n,this.undoable=!1!==o.undoable,this.inCode=o.inCode||!1},Object.defineProperty(r,"prototype",{writable:!1}),r);function s(e,t,n,r,o,i){if(e.composing)return!1;for(var a=e.state,s=a.doc.resolve(t),l=s.parent.textBetween(Math.max(0,s.parentOffset-500),s.parentOffset,null,"")+r,c=0;c<o.length;c++){var u=o[c];if(s.parent.type.spec.code){if(!u.inCode)continue}else if("only"===u.inCode)continue;var f=u.match.exec(l),d=f&&u.handler(a,f,t-(f[0].length-r.length),n);if(d)return u.undoable&&d.setMeta(i,{transform:d,from:t,to:n,text:r}),e.dispatch(d),!0}return!1}var l=new a(/--$/,"—"),c=new a(/\.\.\.$/,"…"),u=new a(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),f=new a(/"$/,"”"),d=new a(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),h=new a(/'$/,"’"),p=[u,f,d,h];t.InputRule=a,t.closeDoubleQuote=f,t.closeSingleQuote=h,t.ellipsis=c,t.emDash=l,t.inputRules=function(e){var t=e.rules,n=new o.Plugin({state:{init:function(){return null},apply:function(e,t){return e.getMeta(this)||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:function(e,r,o,i){return s(e,r,o,i,t,n)},handleDOMEvents:{compositionend:function(e){setTimeout((function(){var r=e.state.selection.$cursor;r&&s(e,r.pos,r.pos,"",t,n)}))}}},isInputRules:!0});return n},t.openDoubleQuote=u,t.openSingleQuote=d,t.smartQuotes=p,t.textblockTypeInputRule=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return new a(e,(function(e,r,o,i){var a=e.doc.resolve(o),s=n instanceof Function?n(r):n;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t)?e.tr.delete(o,i).setBlockType(o,o,t,s):null}))},t.undoInputRule=function(e,t){for(var n=e.plugins,r=0;r<n.length;r++){var o=n[r],i=void 0;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){for(var a=e.tr,s=i.transform,l=s.steps.length-1;l>=0;l--)a.step(s.steps[l].invert(s.docs[l]));if(i.text){var c=a.doc.resolve(i.from).marks();a.replaceWith(i.from,i.to,e.schema.text(i.text,c))}else a.delete(i.from,i.to);t(a)}return!0}}return!1},t.wrappingInputRule=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3?arguments[3]:void 0;return new a(e,(function(e,o,a,s){var l=n instanceof Function?n(o):n,c=e.tr.delete(a,s),u=c.doc.resolve(a).blockRange(),f=u&&i.findWrapping(u,t,l);if(!f)return null;c.wrap(u,f);var d=c.doc.resolve(a-1).nodeBefore;return d&&d.type==t&&i.canJoin(c.doc,a-1)&&(!r||r(o,d))&&c.join(a-1),c}))}},7354:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=n(6691),o=n(2391),i="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function a(e){var t,n,r,o,a=e.split(/-(?!$)/),s=a[a.length-1];"Space"==s&&(s=" ");for(var l=0;l<a.length-1;l++){var c=a[l];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))t=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))r=!0;else{if(!/^mod$/i.test(c))throw new Error("Unrecognized modifier name: "+c);i?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function s(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function l(e){var t=function(e){var t=Object.create(null);for(var n in e)t[a(n)]=e[n];return t}(e);return function(e,n){var o,i=r.keyName(n),a=t[s(i,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){var l=t[s(i,n,!1)];if(l&&l(e.state,e.dispatch,e))return!0}if((n.shiftKey||n.altKey||n.metaKey||i.charCodeAt(0)>127)&&(o=r.base[n.keyCode])&&o!=i){var c=t[s(o,n)];if(c&&c(e.state,e.dispatch,e))return!0}}return!1}}t.keydownHandler=l,t.keymap=function(e){return new o.Plugin({props:{handleKeyDown:l(e)}})}},9443:(e,t,n)=>{function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(){return o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=f(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},o.apply(this,arguments)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function a(e){var t=c();return function(){var n,r=f(e);if(t){var o=f(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===d(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){var t="function"==typeof Map?new Map:void 0;return s=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return l(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),u(n,e)},s(e)}function l(e,t,n){return l=c()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&u(o,n.prototype),o},l.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==d(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===d(o)?o:String(o)),r)}var o}function m(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var v=n(6586);function g(e,t,n){for(var r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;var o=e.child(r),i=t.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(var a=0;o.text[a]==i.text[a];a++)n++;return n}if(o.content.size||i.content.size){var s=g(o.content,i.content,n+1);if(null!=s)return s}n+=o.nodeSize}else n+=o.nodeSize}}function y(e,t,n,r){for(var o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};var a=e.child(--o),s=t.child(--i),l=a.nodeSize;if(a!=s){if(!a.sameMarkup(s))return{a:n,b:r};if(a.isText&&a.text!=s.text){for(var c=0,u=Math.min(a.text.length,s.text.length);c<u&&a.text[a.text.length-c-1]==s.text[s.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(a.content.size||s.content.size){var f=y(a.content,s.content,n-1,r-1);if(f)return f}n-=l,r-=l}else n-=l,r-=l}}var b=function(){function e(t,n){if(h(this,e),this.content=t,this.size=n||0,null==n)for(var r=0;r<t.length;r++)this.size+=t[r].nodeSize}return m(e,[{key:"nodesBetween",value:function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,i=0,a=0;a<t;i++){var s=this.content[i],l=a+s.nodeSize;if(l>e&&!1!==n(s,r+a,o||null,i)&&s.content.size){var c=a+1;s.nodesBetween(Math.max(0,e-c),Math.min(s.content.size,t-c),n,r+c)}a=l}}},{key:"descendants",value:function(e){this.nodesBetween(0,this.size,e)}},{key:"textBetween",value:function(e,t,n,r){var o="",i=!0;return this.nodesBetween(e,t,(function(a,s){var l=a.isText?a.text.slice(Math.max(e,s)-s,t-s):a.isLeaf?r?"function"==typeof r?r(a):r:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&l||a.isTextblock)&&n&&(i?i=!1:o+=n),o+=l}),0),o}},{key:"append",value:function(t){if(!t.size)return this;if(!this.size)return t;var n=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<t.content.length;i++)o.push(t.content[i]);return new e(o,this.size+t.size)}},{key:"cut",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size;if(0==t&&n==this.size)return this;var r=[],o=0;if(n>t)for(var i=0,a=0;a<n;i++){var s=this.content[i],l=a+s.nodeSize;l>t&&((a<t||l>n)&&(s=s.isText?s.cut(Math.max(0,t-a),Math.min(s.text.length,n-a)):s.cut(Math.max(0,t-a-1),Math.min(s.content.size,n-a-1))),r.push(s),o+=s.nodeSize),a=l}return new e(r,o)}},{key:"cutByIndex",value:function(t,n){return t==n?e.empty:0==t&&n==this.content.length?this:new e(this.content.slice(t,n))}},{key:"replaceChild",value:function(t,n){var r=this.content[t];if(r==n)return this;var o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[t]=n,new e(o,i)}},{key:"addToStart",value:function(t){return new e([t].concat(this.content),this.size+t.nodeSize)}},{key:"addToEnd",value:function(t){return new e(this.content.concat(t),this.size+t.nodeSize)}},{key:"eq",value:function(e){if(this.content.length!=e.content.length)return!1;for(var t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}},{key:"firstChild",get:function(){return this.content.length?this.content[0]:null}},{key:"lastChild",get:function(){return this.content.length?this.content[this.content.length-1]:null}},{key:"childCount",get:function(){return this.content.length}},{key:"child",value:function(e){var t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}},{key:"maybeChild",value:function(e){return this.content[e]||null}},{key:"forEach",value:function(e){for(var t=0,n=0;t<this.content.length;t++){var r=this.content[t];e(r,n,t),n+=r.nodeSize}}},{key:"findDiffStart",value:function(e){return g(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}},{key:"findDiffEnd",value:function(e){return y(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size,arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size)}},{key:"findIndex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;if(0==e)return k(0,e);if(e==this.size)return k(this.content.length,e);if(e>this.size||e<0)throw new RangeError("Position ".concat(e," outside of fragment (").concat(this,")"));for(var n=0,r=0;;n++){var o=r+this.child(n).nodeSize;if(o>=e)return o==e||t>0?k(n+1,o):k(n,r);r=o}}},{key:"toString",value:function(){return"<"+this.toStringInner()+">"}},{key:"toStringInner",value:function(){return this.content.join(", ")}},{key:"toJSON",value:function(){return this.content.length?this.content.map((function(e){return e.toJSON()})):null}}],[{key:"fromJSON",value:function(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new e(n.map(t.nodeFromJSON))}},{key:"fromArray",value:function(t){if(!t.length)return e.empty;for(var n,r=0,o=0;o<t.length;o++){var i=t[o];r+=i.nodeSize,o&&i.isText&&t[o-1].sameMarkup(i)?(n||(n=t.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}},{key:"from",value:function(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}]),e}();b.empty=new b([],0);var w={index:0,offset:0};function k(e,t){return w.index=e,w.offset=t,w}function S(e,t){if(e===t)return!0;if(!e||"object"!=d(e)||!t||"object"!=d(t))return!1;var n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(!S(e[r],t[r]))return!1}else{for(var o in e)if(!(o in t)||!S(e[o],t[o]))return!1;for(var i in t)if(!(i in e))return!1}return!0}var x=function(){function e(t,n){h(this,e),this.type=t,this.attrs=n}return m(e,[{key:"addToSet",value:function(e){for(var t,n=!1,r=0;r<e.length;r++){var o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}},{key:"removeFromSet",value:function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}},{key:"isInSet",value:function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}},{key:"eq",value:function(e){return this==e||this.type==e.type&&S(this.attrs,e.attrs)}},{key:"toJSON",value:function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return e}}],[{key:"fromJSON",value:function(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");var n=e.marks[t.type];if(!n)throw new RangeError("There is no mark type ".concat(t.type," in this schema"));var r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}},{key:"sameSet",value:function(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}},{key:"setFrom",value:function(t){if(!t||Array.isArray(t)&&0==t.length)return e.none;if(t instanceof e)return[t];var n=t.slice();return n.sort((function(e,t){return e.type.rank-t.type.rank})),n}}]),e}();x.none=[];var C=function(e){i(n,e);var t=a(n);function n(){return h(this,n),t.apply(this,arguments)}return m(n)}(s(Error)),O=function(){function e(t,n,r){h(this,e),this.content=t,this.openStart=n,this.openEnd=r}return m(e,[{key:"size",get:function(){return this.content.size-this.openStart-this.openEnd}},{key:"insertAt",value:function(t,n){var r=T(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}},{key:"removeBetween",value:function(t,n){return new e(M(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}},{key:"eq",value:function(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}},{key:"toString",value:function(){return this.content+"("+this.openStart+","+this.openEnd+")"}},{key:"toJSON",value:function(){if(!this.content.size)return null;var e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}}],[{key:"fromJSON",value:function(t,n){if(!n)return e.empty;var r=n.openStart||0,o=n.openEnd||0;if("number"!=typeof r||"number"!=typeof o)throw new RangeError("Invalid input for Slice.fromJSON");return new e(b.fromJSON(t,n.content),r,o)}},{key:"maxOpen",value:function(t){for(var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=0,o=0,i=t.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(var a=t.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)o++;return new e(t,r,o)}}]),e}();function M(e,t,n){var r=e.findIndex(t),o=r.index,i=r.offset,a=e.maybeChild(o),s=e.findIndex(n),l=s.index,c=s.offset;if(i==t||a.isText){if(c!=n&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(o!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(o,a.copy(M(a.content,t-i-1,n-i-1)))}function T(e,t,n,r){var o=e.findIndex(t),i=o.index,a=o.offset,s=e.maybeChild(i);if(a==t||s.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));var l=T(s.content,t-a-1,n);return l&&e.replaceChild(i,s.copy(l))}function A(e,t,n){if(n.openStart>e.depth)throw new C("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new C("Inconsistent open depths");return N(e,t,n,0)}function N(e,t,n,r){var o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){var a=N(e,t,n,r+1);return i.copy(i.content.replaceChild(o,a))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){var s=function(e,t){for(var n=t.depth-e.openStart,r=t.node(n).copy(e.content),o=n-1;o>=0;o--)r=t.node(o).copy(b.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return P(i,z(e,s.start,s.end,t,r))}var l=e.parent,c=l.content;return P(l,c.cut(0,e.parentOffset).append(n.content).append(c.cut(t.parentOffset)))}return P(i,I(e,t,r))}function R(e,t){if(!t.type.compatibleContent(e.type))throw new C("Cannot join "+t.type.name+" onto "+e.type.name)}function D(e,t,n){var r=e.node(n);return R(r,t.node(n)),r}function _(e,t){var n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function E(e,t,n,r){var o=(t||e).node(n),i=0,a=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(_(e.nodeAfter,r),i++));for(var s=i;s<a;s++)_(o.child(s),r);t&&t.depth==n&&t.textOffset&&_(t.nodeBefore,r)}function P(e,t){return e.type.checkContent(t),e.copy(t)}function z(e,t,n,r,o){var i=e.depth>o&&D(e,t,o+1),a=r.depth>o&&D(n,r,o+1),s=[];return E(null,e,o,s),i&&a&&t.index(o)==n.index(o)?(R(i,a),_(P(i,z(e,t,n,r,o+1)),s)):(i&&_(P(i,I(e,t,o+1)),s),E(t,n,o,s),a&&_(P(a,I(n,r,o+1)),s)),E(r,null,o,s),new b(s)}function I(e,t,n){var r=[];return E(null,e,n,r),e.depth>n&&_(P(D(e,t,n+1),I(e,t,n+1)),r),E(t,null,n,r),new b(r)}O.empty=new O(b.empty,0,0);var j=function(){function e(t,n,r){h(this,e),this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}return m(e,[{key:"resolveDepth",value:function(e){return null==e?this.depth:e<0?this.depth+e:e}},{key:"parent",get:function(){return this.node(this.depth)}},{key:"doc",get:function(){return this.node(0)}},{key:"node",value:function(e){return this.path[3*this.resolveDepth(e)]}},{key:"index",value:function(e){return this.path[3*this.resolveDepth(e)+1]}},{key:"indexAfter",value:function(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}},{key:"start",value:function(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}},{key:"end",value:function(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}},{key:"before",value:function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}},{key:"after",value:function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}},{key:"textOffset",get:function(){return this.pos-this.path[this.path.length-1]}},{key:"nodeAfter",get:function(){var e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}},{key:"nodeBefore",get:function(){var e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}},{key:"posAtIndex",value:function(e,t){t=this.resolveDepth(t);for(var n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1,o=0;o<e;o++)r+=n.child(o).nodeSize;return r}},{key:"marks",value:function(){var e=this.parent,t=this.index();if(0==e.content.size)return x.none;if(this.textOffset)return e.child(t).marks;var n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){var o=n;n=r,r=o}for(var i=n.marks,a=0;a<i.length;a++)!1!==i[a].type.spec.inclusive||r&&i[a].isInSet(r.marks)||(i=i[a--].removeFromSet(i));return i}},{key:"marksAcross",value:function(e){var t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;for(var n=t.marks,r=e.parent.maybeChild(e.index()),o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}},{key:"sharedDepth",value:function(e){for(var t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}},{key:"blockRange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this,t=arguments.length>1?arguments[1]:void 0;if(e.pos<this.pos)return e.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new L(this,e,n);return null}},{key:"sameParent",value:function(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}},{key:"max",value:function(e){return e.pos>this.pos?e:this}},{key:"min",value:function(e){return e.pos<this.pos?e:this}},{key:"toString",value:function(){for(var e="",t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}}],[{key:"resolve",value:function(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");for(var r=[],o=0,i=n,a=t;;){var s=a.content.findIndex(i),l=s.index,c=s.offset,u=i-c;if(r.push(a,l,o+c),!u)break;if((a=a.child(l)).isText)break;i=u-1,o+=c+1}return new e(n,r,i)}},{key:"resolveCached",value:function(t,n){var r=$.get(t);if(r)for(var o=0;o<r.elts.length;o++){var i=r.elts[o];if(i.pos==n)return i}else $.set(t,r=new F);var a=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%B,a}}]),e}(),F=m((function e(){h(this,e),this.elts=[],this.i=0})),B=12,$=new WeakMap,L=function(){function e(t,n,r){h(this,e),this.$from=t,this.$to=n,this.depth=r}return m(e,[{key:"start",get:function(){return this.$from.before(this.depth+1)}},{key:"end",get:function(){return this.$to.after(this.depth+1)}},{key:"parent",get:function(){return this.$from.node(this.depth)}},{key:"startIndex",get:function(){return this.$from.index(this.depth)}},{key:"endIndex",get:function(){return this.$to.indexAfter(this.depth)}}]),e}(),V=Object.create(null),K=function(){function e(t,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:x.none;h(this,e),this.type=t,this.attrs=n,this.marks=o,this.content=r||b.empty}return m(e,[{key:"nodeSize",get:function(){return this.isLeaf?1:2+this.content.size}},{key:"childCount",get:function(){return this.content.childCount}},{key:"child",value:function(e){return this.content.child(e)}},{key:"maybeChild",value:function(e){return this.content.maybeChild(e)}},{key:"forEach",value:function(e){this.content.forEach(e)}},{key:"nodesBetween",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.content.nodesBetween(e,t,n,r,this)}},{key:"descendants",value:function(e){this.nodesBetween(0,this.content.size,e)}},{key:"textContent",get:function(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}},{key:"textBetween",value:function(e,t,n,r){return this.content.textBetween(e,t,n,r)}},{key:"firstChild",get:function(){return this.content.firstChild}},{key:"lastChild",get:function(){return this.content.lastChild}},{key:"eq",value:function(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}},{key:"sameMarkup",value:function(e){return this.hasMarkup(e.type,e.attrs,e.marks)}},{key:"hasMarkup",value:function(e,t,n){return this.type==e&&S(this.attrs,t||e.defaultAttrs||V)&&x.sameSet(this.marks,n||x.none)}},{key:"copy",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}},{key:"mark",value:function(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}},{key:"cut",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size;return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}},{key:"slice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e==t)return O.empty;var r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),a=r.start(i),s=r.node(i).content.cut(r.pos-a,o.pos-a);return new O(s,r.depth-i,o.depth-i)}},{key:"replace",value:function(e,t,n){return A(this.resolve(e),this.resolve(t),n)}},{key:"nodeAt",value:function(e){for(var t=this;;){var n=t.content.findIndex(e),r=n.index,o=n.offset;if(!(t=t.maybeChild(r)))return null;if(o==e||t.isText)return t;e-=o+1}}},{key:"childAfter",value:function(e){var t=this.content.findIndex(e),n=t.index,r=t.offset;return{node:this.content.maybeChild(n),index:n,offset:r}}},{key:"childBefore",value:function(e){if(0==e)return{node:null,index:0,offset:0};var t=this.content.findIndex(e),n=t.index,r=t.offset;if(r<e)return{node:this.content.child(n),index:n,offset:r};var o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}},{key:"resolve",value:function(e){return j.resolveCached(this,e)}},{key:"resolveNoCache",value:function(e){return j.resolve(this,e)}},{key:"rangeHasMark",value:function(e,t,n){var r=!1;return t>e&&this.nodesBetween(e,t,(function(e){return n.isInSet(e.marks)&&(r=!0),!r})),r}},{key:"isBlock",get:function(){return this.type.isBlock}},{key:"isTextblock",get:function(){return this.type.isTextblock}},{key:"inlineContent",get:function(){return this.type.inlineContent}},{key:"isInline",get:function(){return this.type.isInline}},{key:"isText",get:function(){return this.type.isText}},{key:"isLeaf",get:function(){return this.type.isLeaf}},{key:"isAtom",get:function(){return this.type.isAtom}},{key:"toString",value:function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),W(this.marks,e)}},{key:"contentMatchAt",value:function(e){var t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}},{key:"canReplace",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:b.empty,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:n.childCount,i=this.contentMatchAt(e).matchFragment(n,r,o),a=i&&i.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(var s=r;s<o;s++)if(!this.type.allowsMarks(n.child(s).marks))return!1;return!0}},{key:"canReplaceWith",value:function(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;var o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}},{key:"canAppend",value:function(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}},{key:"check",value:function(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);for(var e=x.none,t=0;t<this.marks.length;t++){var n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!x.sameSet(e,this.marks))throw new RangeError("Invalid collection of marks for node ".concat(this.type.name,": ").concat(this.marks.map((function(e){return e.type.name}))));this.content.forEach((function(e){return e.check()}))}},{key:"toJSON",value:function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map((function(e){return e.toJSON()}))),e}}],[{key:"fromJSON",value:function(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");var n=void 0;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}var r=b.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}]),e}();K.prototype.text=void 0;var H=function(e){i(n,e);var t=a(n);function n(e,r,o,i){var a;if(h(this,n),a=t.call(this,e,r,null,i),!o)throw new RangeError("Empty text nodes are not allowed");return a.text=o,a}return m(n,[{key:"toString",value:function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):W(this.marks,JSON.stringify(this.text))}},{key:"textContent",get:function(){return this.text}},{key:"textBetween",value:function(e,t){return this.text.slice(e,t)}},{key:"nodeSize",get:function(){return this.text.length}},{key:"mark",value:function(e){return e==this.marks?this:new n(this.type,this.attrs,this.text,e)}},{key:"withText",value:function(e){return e==this.text?this:new n(this.type,this.attrs,e,this.marks)}},{key:"cut",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.text.length;return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}},{key:"eq",value:function(e){return this.sameMarkup(e)&&this.text==e.text}},{key:"toJSON",value:function(){var e=o(f(n.prototype),"toJSON",this).call(this);return e.text=this.text,e}}]),n}(K);function W(e,t){for(var n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}var q=function(){function e(t){h(this,e),this.validEnd=t,this.next=[],this.wrapCache=[]}return m(e,[{key:"matchType",value:function(e){for(var t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}},{key:"matchFragment",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.childCount,r=this,o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}},{key:"inlineContent",get:function(){return 0!=this.next.length&&this.next[0].type.isInline}},{key:"defaultType",get:function(){for(var e=0;e<this.next.length;e++){var t=this.next[e].type;if(!t.isText&&!t.hasRequiredAttrs())return t}return null}},{key:"compatible",value:function(e){for(var t=0;t<this.next.length;t++)for(var n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}},{key:"fillBefore",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[this];return function o(i,a){var s=i.matchFragment(e,n);if(s&&(!t||s.validEnd))return b.from(a.map((function(e){return e.createAndFill()})));for(var l=0;l<i.next.length;l++){var c=i.next[l],u=c.type,f=c.next;if(!u.isText&&!u.hasRequiredAttrs()&&-1==r.indexOf(f)){r.push(f);var d=o(f,a.concat(u));if(d)return d}}return null}(this,[])}},{key:"findWrapping",value:function(e){for(var t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];var n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}},{key:"computeWrapping",value:function(e){for(var t=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),o=r.match;if(o.matchType(e)){for(var i=[],a=r;a.type;a=a.via)i.push(a.type);return i.reverse()}for(var s=0;s<o.next.length;s++){var l=o.next[s],c=l.type,u=l.next;c.isLeaf||c.hasRequiredAttrs()||c.name in t||r.type&&!u.validEnd||(n.push({match:c.contentMatch,type:c,via:r}),t[c.name]=!0)}}return null}},{key:"edgeCount",get:function(){return this.next.length}},{key:"edge",value:function(e){if(e>=this.next.length)throw new RangeError("There's no ".concat(e,"th edge in this content match"));return this.next[e]}},{key:"toString",value:function(){var e=[];return function t(n){e.push(n);for(var r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((function(t,n){for(var r=n+(t.validEnd?"*":" ")+" ",o=0;o<t.next.length;o++)r+=(o?", ":"")+t.next[o].type.name+"->"+e.indexOf(t.next[o].next);return r})).join("\n")}}],[{key:"parse",value:function(t,n){var r=new J(t,n);if(null==r.next)return e.empty;var o=U(r);r.next&&r.err("Unexpected trailing text");var i=te(function(e){var t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce((function(t,n){return t.concat(e(n,i))}),[]);if("seq"!=t.type){if("star"==t.type){var a=n();return r(i,a),o(e(t.expr,a),a),[r(a)]}if("plus"==t.type){var s=n();return o(e(t.expr,i),s),o(e(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(i)].concat(e(t.expr,i));if("range"==t.type){for(var l=i,c=0;c<t.min;c++){var u=n();o(e(t.expr,l),u),l=u}if(-1==t.max)o(e(t.expr,l),l);else for(var f=t.min;f<t.max;f++){var d=n();r(l,d),o(e(t.expr,l),d),l=d}return[r(l)]}if("name"==t.type)return[r(i,void 0,t.value)];throw new Error("Unknown expr type")}for(var h=0;;h++){var p=e(t.exprs[h],i);if(h==t.exprs.length-1)return p;o(p,i=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){var o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach((function(e){return e.to=t}))}}(o));return function(e,t){for(var n=0,r=[e];n<r.length;n++){for(var o=r[n],i=!o.validEnd,a=[],s=0;s<o.next.length;s++){var l=o.next[s],c=l.type,u=l.next;a.push(c.name),!i||c.isText||c.hasRequiredAttrs()||(i=!1),-1==r.indexOf(u)&&r.push(u)}i&&t.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,r),i}}]),e}();q.empty=new q(!0);var J=function(){function e(t,n){h(this,e),this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}return m(e,[{key:"next",get:function(){return this.tokens[this.pos]}},{key:"eat",value:function(e){return this.next==e&&(this.pos++||!0)}},{key:"err",value:function(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}]),e}();function U(e){var t=[];do{t.push(G(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function G(e){var t=[];do{t.push(X(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function X(e){for(var t=function(e){if(e.eat("(")){var t=U(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){var n=function(e,t){var n=e.nodeTypes,r=n[t];if(r)return[r];var o=[];for(var i in n){var a=n[i];a.isInGroup(t)&&o.push(a)}return 0==o.length&&e.err("No node type or group '"+t+"' found"),o}(e,e.next).map((function(t){return null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}}));return e.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}e.err("Unexpected token '"+e.next+"'")}(e);;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=Q(e,t)}return t}function Y(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");var t=Number(e.next);return e.pos++,t}function Q(e,t){var n=Y(e),r=n;return e.eat(",")&&(r="}"!=e.next?Y(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function Z(e,t){return t-e}function ee(e,t){var n=[];return function t(r){var o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(var i=0;i<o.length;i++){var a=o[i],s=a.term,l=a.to;s||-1!=n.indexOf(l)||t(l)}}(t),n.sort(Z)}function te(e){var t=Object.create(null);return function n(r){var o=[];r.forEach((function(t){e[t].forEach((function(t){var n=t.term,r=t.to;if(n){for(var i,a=0;a<o.length;a++)o[a][0]==n&&(i=o[a][1]);ee(e,r).forEach((function(e){i||o.push([n,i=[]]),-1==i.indexOf(e)&&i.push(e)}))}}))}));for(var i=t[r.join(",")]=new q(r.indexOf(e.length-1)>-1),a=0;a<o.length;a++){var s=o[a][1].sort(Z);i.next.push({type:o[a][0],next:t[s.join(",")]||n(s)})}return i}(ee(e,0))}function ne(e){var t=Object.create(null);for(var n in e){var r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function re(e,t){var n=Object.create(null);for(var r in e){var o=t&&t[r];if(void 0===o){var i=e[r];if(!i.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=i.default}n[r]=o}return n}function oe(e,t,n,r){for(var o in t)if(!(o in e))throw new RangeError("Unsupported attribute ".concat(o," for ").concat(n," of type ").concat(o));for(var i in e){var a=e[i];a.validate&&a.validate(t[i])}}function ie(e,t){var n=Object.create(null);if(t)for(var r in t)n[r]=new se(e,r,t[r]);return n}var ae=function(){function e(t,n,r){h(this,e),this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ie(t,r.attrs),this.defaultAttrs=ne(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==t),this.isText="text"==t}return m(e,[{key:"isInline",get:function(){return!this.isBlock}},{key:"isTextblock",get:function(){return this.isBlock&&this.inlineContent}},{key:"isLeaf",get:function(){return this.contentMatch==q.empty}},{key:"isAtom",get:function(){return this.isLeaf||!!this.spec.atom}},{key:"isInGroup",value:function(e){return this.groups.indexOf(e)>-1}},{key:"whitespace",get:function(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}},{key:"hasRequiredAttrs",value:function(){for(var e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}},{key:"compatibleContent",value:function(e){return this==e||this.contentMatch.compatible(e.contentMatch)}},{key:"computeAttrs",value:function(e){return!e&&this.defaultAttrs?this.defaultAttrs:re(this.attrs,e)}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new K(this,this.computeAttrs(e),b.from(t),x.setFrom(n))}},{key:"createChecked",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;return t=b.from(t),this.checkContent(t),new K(this,this.computeAttrs(e),t,x.setFrom(n))}},{key:"createAndFill",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(e=this.computeAttrs(e),(t=b.from(t)).size){var r=this.contentMatch.fillBefore(t);if(!r)return null;t=r.append(t)}var o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(b.empty,!0);return i?new K(this,e,t.append(i),x.setFrom(n)):null}},{key:"validContent",value:function(e){var t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(var n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}},{key:"checkContent",value:function(e){if(!this.validContent(e))throw new RangeError("Invalid content for node ".concat(this.name,": ").concat(e.toString().slice(0,50)))}},{key:"checkAttrs",value:function(e){oe(this.attrs,e,"node",this.name)}},{key:"allowsMarkType",value:function(e){return null==this.markSet||this.markSet.indexOf(e)>-1}},{key:"allowsMarks",value:function(e){if(null==this.markSet)return!0;for(var t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}},{key:"allowedMarks",value:function(e){if(null==this.markSet)return e;for(var t,n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:x.none:e}}],[{key:"compile",value:function(t,n){var r=Object.create(null);t.forEach((function(t,o){return r[t]=new e(t,n,o)}));var o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(var i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}}]),e}(),se=function(){function e(t,n,r){h(this,e),this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate="string"==typeof r.validate?function(e,t,n){var r=n.split("|");return function(n){var o=null===n?"null":d(n);if(r.indexOf(o)<0)throw new RangeError("Expected value of type ".concat(r," for attribute ").concat(t," on type ").concat(e,", got ").concat(o))}}(t,n,r.validate):r.validate}return m(e,[{key:"isRequired",get:function(){return!this.hasDefault}}]),e}(),le=function(){function e(t,n,r,o){h(this,e),this.name=t,this.rank=n,this.schema=r,this.spec=o,this.attrs=ie(t,o.attrs),this.excluded=null;var i=ne(this.attrs);this.instance=i?new x(this,i):null}return m(e,[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!e&&this.instance?this.instance:new x(this,re(this.attrs,e))}},{key:"removeFromSet",value:function(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}},{key:"isInSet",value:function(e){for(var t=0;t<e.length;t++)if(e[t].type==this)return e[t]}},{key:"checkAttrs",value:function(e){oe(this.attrs,e,"mark",this.name)}},{key:"excludes",value:function(e){return this.excluded.indexOf(e)>-1}}],[{key:"compile",value:function(t,n){var r=Object.create(null),o=0;return t.forEach((function(t,i){return r[t]=new e(t,o++,n,i)})),r}}]),e}(),ce=function(){function e(t){h(this,e),this.linebreakReplacement=null,this.cached=Object.create(null);var n=this.spec={};for(var r in t)n[r]=t[r];n.nodes=v.from(t.nodes),n.marks=v.from(t.marks||{}),this.nodes=ae.compile(this.spec.nodes,this),this.marks=le.compile(this.spec.marks,this);var o=Object.create(null);for(var i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");var a=this.nodes[i],s=a.spec.content||"",l=a.spec.marks;if(a.contentMatch=o[s]||(o[s]=q.parse(s,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet="_"==l?null:l?ue(this,l.split(" ")):""!=l&&a.inlineContent?null:[]}for(var c in this.marks){var u=this.marks[c],f=u.spec.excludes;u.excluded=null==f?[u]:""==f?[]:ue(this,f.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}return m(e,[{key:"node",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof ae))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}},{key:"text",value:function(e,t){var n=this.nodes.text;return new H(n,n.defaultAttrs,e,x.setFrom(t))}},{key:"mark",value:function(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}},{key:"nodeFromJSON",value:function(e){return K.fromJSON(this,e)}},{key:"markFromJSON",value:function(e){return x.fromJSON(this,e)}},{key:"nodeType",value:function(e){var t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}]),e}();function ue(e,t){for(var n=[],r=0;r<t.length;r++){var o=t[r],i=e.marks[o],a=i;if(i)n.push(i);else for(var s in e.marks){var l=e.marks[s];("_"==o||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(a=l)}if(!a)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}var fe=function(){function e(t,n){var r=this;h(this,e),this.schema=t,this.rules=n,this.tags=[],this.styles=[];var o=this.matchedStyles=[];n.forEach((function(e){if(function(e){return null!=e.tag}(e))r.tags.push(e);else if(function(e){return null!=e.style}(e)){var t=/[^=]*/.exec(e.style)[0];o.indexOf(t)<0&&o.push(t),r.styles.push(e)}})),this.normalizeLists=!this.tags.some((function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)}))}return m(e,[{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new ge(this,t,!1);return n.addAll(e,x.none,t.from,t.to),n.finish()}},{key:"parseSlice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new ge(this,t,!0);return n.addAll(e,x.none,t.from,t.to),O.maxOpen(n.finish())}},{key:"matchTag",value:function(e,t,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var o=this.tags[r];if(ye(e,o.tag)&&(void 0===o.namespace||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){var i=o.getAttrs(e);if(!1===i)continue;o.attrs=i||void 0}return o}}}},{key:"matchStyle",value:function(e,t,n,r){for(var o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){var i=this.styles[o],a=i.style;if(!(0!=a.indexOf(e)||i.context&&!n.matchesContext(i.context)||a.length>e.length&&(61!=a.charCodeAt(e.length)||a.slice(e.length+1)!=t))){if(i.getAttrs){var s=i.getAttrs(t);if(!1===s)continue;i.attrs=s||void 0}return i}}}}],[{key:"schemaRules",value:function(e){var t=[];function n(e){for(var n=null==e.priority?50:e.priority,r=0;r<t.length;r++){var o=t[r];if((null==o.priority?50:o.priority)<n)break}t.splice(r,0,e)}var r=function(t){var r=e.marks[t].spec.parseDOM;r&&r.forEach((function(e){n(e=be(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)}))};for(var o in e.marks)r(o);var i=function(t){var r=e.nodes[t].spec.parseDOM;r&&r.forEach((function(e){n(e=be(e)),e.node||e.ignore||e.mark||(e.node=t)}))};for(var a in e.nodes)i(a);return t}},{key:"fromSchema",value:function(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}}]),e}(),de={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},he={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},pe={ol:!0,ul:!0};function me(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}var ve=function(){function e(t,n,r,o,i,a){h(this,e),this.type=t,this.attrs=n,this.marks=r,this.solid=o,this.options=a,this.content=[],this.activeMarks=x.none,this.match=i||(4&a?null:t.contentMatch)}return m(e,[{key:"findWrapping",value:function(e){if(!this.match){if(!this.type)return[];var t=this.type.contentMatch.fillBefore(b.from(e));if(!t){var n,r=this.type.contentMatch;return(n=r.findWrapping(e.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}},{key:"finish",value:function(e){if(!(1&this.options)){var t,n=this.content[this.content.length-1];if(n&&n.isText&&(t=/[ \t\r\n\u000c]+$/.exec(n.text))){var r=n;n.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-t[0].length))}}var o=b.from(this.content);return!e&&this.match&&(o=o.append(this.match.fillBefore(b.empty,!0))),this.type?this.type.create(this.attrs,o,this.marks):o}},{key:"inlineContext",value:function(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!de.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}]),e}(),ge=function(){function e(t,n,r){h(this,e),this.parser=t,this.options=n,this.isOpen=r,this.open=0;var o,i=n.topNode,a=me(null,n.preserveWhitespace,0)|(r?4:0);o=i?new ve(i.type,i.attrs,x.none,!0,n.topMatch||i.type.contentMatch,a):new ve(r?null:t.schema.topNodeType,null,x.none,!0,null,a),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}return m(e,[{key:"top",get:function(){return this.nodes[this.open]}},{key:"addDOM",value:function(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}},{key:"addTextNode",value:function(e,t){var n=e.nodeValue,r=this.top;if(2&r.options||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(1&r.options)n=2&r.options?n.replace(/\r\n?/g,"\n"):n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){var o=r.content[r.content.length-1],i=e.previousSibling;(!o||i&&"BR"==i.nodeName||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),t),this.findInText(e)}else this.findInside(e)}},{key:"addElement",value:function(e,t,n){var r,o=e.nodeName.toLowerCase();pe.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(var t=e.firstChild,n=null;t;t=t.nextSibling){var r=1==t.nodeType?t.nodeName.toLowerCase():null;r&&pe.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):"li"==r?n=t:r&&(n=null)}}(e);var i=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(r=this.parser.matchTag(e,this,n));if(i?i.ignore:he.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(e=i.skip);var a,s=this.top,l=this.needsBlock;if(de.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),a=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild)return void this.leafFallback(e,t);var c=i&&i.skip?t:this.readStyles(e,t);c&&this.addAll(e,c),a&&this.sync(s),this.needsBlock=l}else{var u=this.readStyles(e,t);u&&this.addElementByRule(e,i,u,!1===i.consuming?r:void 0)}}},{key:"leafFallback",value:function(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}},{key:"ignoreFallback",value:function(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t)}},{key:"readStyles",value:function(e,t){var n=this,r=e.style;if(r&&r.length)for(var o=0;o<this.parser.matchedStyles.length;o++){var i=this.parser.matchedStyles[o],a=r.getPropertyValue(i);if(a)for(var s,l=function(e){var r=n.parser.matchStyle(i,a,n,e);return r?r.ignore?{v:null}:(t=r.clearMark?t.filter((function(e){return!r.clearMark(e)})):t.concat(n.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming?(c=e,0):void(c=e=r)):(c=e,0)},c=void 0;0!==(s=l(c));)if(s)return s.v}return t}},{key:"addElementByRule",value:function(e,t,n,r){var o,i,a=this;if(t.node)if((i=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(i.create(t.attrs),n)||this.leafFallback(e,n);else{var s=this.enter(i,t.attrs||null,n,t.preserveWhitespace);s&&(o=!0,n=s)}else{var l=this.parser.schema.marks[t.mark];n=n.concat(l.create(t.attrs))}var c=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((function(e){return a.insertNode(e,n)}));else{var u=e;"string"==typeof t.contentElement?u=e.querySelector(t.contentElement):"function"==typeof t.contentElement?u=t.contentElement(e):t.contentElement&&(u=t.contentElement),this.findAround(e,u,!0),this.addAll(u,n),this.findAround(e,u,!1)}o&&this.sync(c)&&this.open--}},{key:"addAll",value:function(e,t,n,r){for(var o=n||0,i=n?e.childNodes[n]:e.firstChild,a=null==r?null:e.childNodes[r];i!=a;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}},{key:"findPlace",value:function(e,t){for(var n,r,o=this.open;o>=0;o--){var i=this.nodes[o],a=i.findWrapping(e);if(a&&(!n||n.length>a.length)&&(n=a,r=i,!a.length))break;if(i.solid)break}if(!n)return null;this.sync(r);for(var s=0;s<n.length;s++)t=this.enterInner(n[s],null,t,!1);return t}},{key:"insertNode",value:function(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){var n=this.textblockFromContext();n&&(t=this.enterInner(n,null,t))}var o=this.findPlace(e,t);if(o){this.closeExtra();var i=this.top;i.match&&(i.match=i.match.matchType(e.type));var a,s=x.none,l=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw a}}}}(o.concat(e.marks));try{for(l.s();!(a=l.n()).done;){var c=a.value;(i.type?i.type.allowsMarkType(c.type):we(c.type,e.type))&&(s=c.addToSet(s))}}catch(e){l.e(e)}finally{l.f()}return i.content.push(e.mark(s)),!0}return!1}},{key:"enter",value:function(e,t,n,r){var o=this.findPlace(e.create(t),n);return o&&(o=this.enterInner(e,t,n,!0,r)),o}},{key:"enterInner",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0;this.closeExtra();var i=this.top;i.match=i.match&&i.match.matchType(e);var a=me(e,o,i.options);4&i.options&&0==i.content.length&&(a|=4);var s=x.none;return n=n.filter((function(t){return!(i.type?i.type.allowsMarkType(t.type):we(t.type,e))||(s=t.addToSet(s),!1)})),this.nodes.push(new ve(e,t,s,r,null,a)),this.open++,n}},{key:"closeExtra",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}},{key:"finish",value:function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}},{key:"sync",value:function(e){for(var t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}},{key:"currentPos",get:function(){this.closeExtra();for(var e=0,t=this.open;t>=0;t--){for(var n=this.nodes[t].content,r=n.length-1;r>=0;r--)e+=n[r].nodeSize;t&&e++}return e}},{key:"findAtPoint",value:function(e,t){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}},{key:"findInside",value:function(e){if(this.find)for(var t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}},{key:"findAround",value:function(e,t,n){if(e!=t&&this.find)for(var r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},{key:"findInText",value:function(e){if(this.find)for(var t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}},{key:"matchesContext",value:function(e){var t=this;if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);var n=e.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1);return function e(a,s){for(;a>=0;a--){var l=n[a];if(""==l){if(a==n.length-1||0==a)continue;for(;s>=i;s--)if(e(a-1,s))return!0;return!1}var c=s>0||0==s&&o?t.nodes[s].type:r&&s>=i?r.node(s-i).type:null;if(!c||c.name!=l&&!c.isInGroup(l))return!1;s--}return!0}(n.length-1,this.open)}},{key:"textblockFromContext",value:function(){var e=this.options.context;if(e)for(var t=e.depth;t>=0;t--){var n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}}}]),e}();function ye(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function be(e){var t={};for(var n in e)t[n]=e[n];return t}function we(e,t){var n,r=t.schema.nodes,o=function(){var n=r[i];if(!n.allowsMarkType(e))return 0;var o=[];return function e(n){o.push(n);for(var r=0;r<n.edgeCount;r++){var i=n.edge(r),a=i.type,s=i.next;if(a==t)return!0;if(o.indexOf(s)<0&&e(s))return!0}}(n.contentMatch)?{v:!0}:void 0};for(var i in r)if(0!==(n=o())&&n)return n.v}var ke=function(){function e(t,n){h(this,e),this.nodes=t,this.marks=n}return m(e,[{key:"serializeFragment",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;r||(r=xe(n).createDocumentFragment());var o=r,i=[];return e.forEach((function(e){if(i.length||e.marks.length){for(var r=0,a=0;r<i.length&&a<e.marks.length;){var s=e.marks[a];if(t.marks[s.type.name]){if(!s.eq(i[r][0])||!1===s.type.spec.spanning)break;r++,a++}else a++}for(;r<i.length;)o=i.pop()[1];for(;a<e.marks.length;){var l=e.marks[a++],c=t.serializeMark(l,e.isInline,n);c&&(i.push([l,o]),o.appendChild(c.dom),o=c.contentDOM||c.dom)}}o.appendChild(t.serializeNodeInner(e,n))})),r}},{key:"serializeNodeInner",value:function(e,t){var n=Oe(xe(t),this.nodes[e.type.name](e),null,e.attrs),r=n.dom,o=n.contentDOM;if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return r}},{key:"serializeNode",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.serializeNodeInner(e,t),r=e.marks.length-1;r>=0;r--){var o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}},{key:"serializeMark",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.marks[e.type.name];return r&&Oe(xe(n),r(e,t),null,e.attrs)}}],[{key:"renderSpec",value:function(e,t){return Oe(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,arguments.length>3?arguments[3]:void 0)}},{key:"fromSchema",value:function(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}},{key:"nodesFromSchema",value:function(e){var t=Se(e.nodes);return t.text||(t.text=function(e){return e.text}),t}},{key:"marksFromSchema",value:function(e){return Se(e.marks)}}]),e}();function Se(e){var t={};for(var n in e){var r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function xe(e){return e.document||window.document}var Ce=new WeakMap;function Oe(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;var o,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=function(e){var t=Ce.get(e);return void 0===t&&Ce.set(e,t=function(e){var t=null;return function e(n){if(n&&"object"==d(n))if(Array.isArray(n))if("string"==typeof n[0])t||(t=[]),t.push(n);else for(var r=0;r<n.length;r++)e(n[r]);else for(var o in n)e(n[o])}(e),t}(e)),t}(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");var a,s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));var l=n?e.createElementNS(n,i):e.createElement(i),c=t[1],u=1;if(c&&"object"==d(c)&&null==c.nodeType&&!Array.isArray(c))for(var f in u=2,c)if(null!=c[f]){var h=f.indexOf(" ");h>0?l.setAttributeNS(f.slice(0,h),f.slice(h+1),c[f]):l.setAttribute(f,c[f])}for(var p=u;p<t.length;p++){var m=t[p];if(0===m){if(p<t.length-1||p>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}var v=Oe(e,m,n,r),g=v.dom,y=v.contentDOM;if(l.appendChild(g),y){if(a)throw new RangeError("Multiple content holes");a=y}}return{dom:l,contentDOM:a}}t.ContentMatch=q,t.DOMParser=fe,t.DOMSerializer=ke,t.Fragment=b,t.Mark=x,t.MarkType=le,t.Node=K,t.NodeRange=L,t.NodeType=ae,t.ReplaceError=C,t.ResolvedPos=j,t.Schema=ce,t.Slice=O},4032:(e,t,n)=>{var r=n(2843),o=n(9443),i=n(2391),a=["ol",0],s=["ul",0],l=["li",0],c={attrs:{order:{default:1,validate:"number"}},parseDOM:[{tag:"ol",getAttrs:function(e){return{order:e.hasAttribute("start")?+e.getAttribute("start"):1}}}],toDOM:function(e){return 1==e.attrs.order?a:["ol",{start:e.attrs.order},0]}},u={parseDOM:[{tag:"ul"}],toDOM:function(){return s}},f={parseDOM:[{tag:"li"}],toDOM:function(){return l},defining:!0};function d(e,t){var n={};for(var r in e)n[r]=e[r];for(var o in t)n[o]=t[o];return n}function h(e,t){return function(n,a){var s=n.selection,l=s.$from,c=s.$to,u=s.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;var f=l.node(-1);if(f.type!=e)return!1;if(0==l.parent.content.size&&l.node(-1).childCount==l.indexAfter(-1)){if(3==l.depth||l.node(-3).type!=e||l.index(-2)!=l.node(-2).childCount-1)return!1;if(a){for(var d=o.Fragment.empty,h=l.index(-1)?1:l.index(-2)?2:3,p=l.depth-h;p>=l.depth-3;p--)d=o.Fragment.from(l.node(p).copy(d));var m=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3;d=d.append(o.Fragment.from(e.createAndFill()));var v=l.before(l.depth-(h-1)),g=n.tr.replace(v,l.after(-m),new o.Slice(d,4-h,0)),y=-1;g.doc.nodesBetween(v,g.doc.content.size,(function(e,t){if(y>-1)return!1;e.isTextblock&&0==e.content.size&&(y=t+1)})),y>-1&&g.setSelection(i.Selection.near(g.doc.resolve(y))),a(g.scrollIntoView())}return!0}var b=c.pos==l.end()?f.contentMatchAt(0).defaultType:null,w=n.tr.delete(l.pos,c.pos),k=b?[t?{type:e,attrs:t}:null,{type:b}]:void 0;return!!r.canSplit(w.doc,l.pos,2,k)&&(a&&a(w.split(l.pos,2,k).scrollIntoView()),!0)}}t.addListNodes=function(e,t,n){return e.append({ordered_list:d(c,{content:"list_item+",group:n}),bullet_list:d(u,{content:"list_item+",group:n}),list_item:d(f,{content:t})})},t.bulletList=u,t.liftListItem=function(e){return function(t,n){var i=t.selection,a=i.$from,s=i.$to,l=a.blockRange(s,(function(t){return t.childCount>0&&t.firstChild.type==e}));return!!l&&(!n||(a.node(l.depth-1).type==e?function(e,t,n,i){var a=e.tr,s=i.end,l=i.$to.end(i.depth);s<l&&(a.step(new r.ReplaceAroundStep(s-1,l,s,l,new o.Slice(o.Fragment.from(n.create(null,i.parent.copy())),1,0),1,!0)),i=new o.NodeRange(a.doc.resolve(i.$from.pos),a.doc.resolve(l),i.depth));var c=r.liftTarget(i);if(null==c)return!1;a.lift(i,c);var u=a.mapping.map(s,-1)-1;return r.canJoin(a.doc,u)&&a.join(u),t(a.scrollIntoView()),!0}(t,n,e,l):function(e,t,n){for(var i=e.tr,a=n.parent,s=n.end,l=n.endIndex-1,c=n.startIndex;l>c;l--)s-=a.child(l).nodeSize,i.delete(s-1,s+1);var u=i.doc.resolve(n.start),f=u.nodeAfter;if(i.mapping.map(n.end)!=n.start+u.nodeAfter.nodeSize)return!1;var d=0==n.startIndex,h=n.endIndex==a.childCount,p=u.node(-1),m=u.index(-1);if(!p.canReplace(m+(d?0:1),m+1,f.content.append(h?o.Fragment.empty:o.Fragment.from(a))))return!1;var v=u.pos,g=v+f.nodeSize;return i.step(new r.ReplaceAroundStep(v-(d?1:0),g+(h?1:0),v+1,g-1,new o.Slice((d?o.Fragment.empty:o.Fragment.from(a.copy(o.Fragment.empty))).append(h?o.Fragment.empty:o.Fragment.from(a.copy(o.Fragment.empty))),d?0:1,h?0:1),d?0:1)),t(i.scrollIntoView()),!0}(t,n,l)))}},t.listItem=f,t.orderedList=c,t.sinkListItem=function(e){return function(t,n){var i=t.selection,a=i.$from,s=i.$to,l=a.blockRange(s,(function(t){return t.childCount>0&&t.firstChild.type==e}));if(!l)return!1;var c=l.startIndex;if(0==c)return!1;var u=l.parent,f=u.child(c-1);if(f.type!=e)return!1;if(n){var d=f.lastChild&&f.lastChild.type==u.type,h=o.Fragment.from(d?e.create():null),p=new o.Slice(o.Fragment.from(e.create(null,o.Fragment.from(u.type.create(null,h)))),d?3:1,0),m=l.start,v=l.end;n(t.tr.step(new r.ReplaceAroundStep(m-(d?3:1),v,m,v,p,1,!0)).scrollIntoView())}return!0}},t.splitListItem=h,t.splitListItemKeepMarks=function(e,t){var n=h(e,t);return function(e,t){return n(e,t&&function(n){var r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();r&&n.ensureMarks(r),t(n)})}},t.wrapInList=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,i){var a=n.selection,s=a.$from,l=a.$to,c=s.blockRange(l),u=!1,f=c;if(!c)return!1;if(c.depth>=2&&s.node(c.depth-1).type.compatibleContent(e)&&0==c.startIndex){if(0==s.index(c.depth-1))return!1;var d=n.doc.resolve(c.start-2);f=new o.NodeRange(d,d,c.depth),c.endIndex<c.parent.childCount&&(c=new o.NodeRange(s,n.doc.resolve(l.end(c.depth)),c.depth)),u=!0}var h=r.findWrapping(f,e,t,c);return!!h&&(i&&i(function(e,t,n,i,a){for(var s=o.Fragment.empty,l=n.length-1;l>=0;l--)s=o.Fragment.from(n[l].type.create(n[l].attrs,s));e.step(new r.ReplaceAroundStep(t.start-(i?2:0),t.end,t.start,t.end,new o.Slice(s,0,0),n.length,!0));for(var c=0,u=0;u<n.length;u++)n[u].type==a&&(c=u+1);for(var f=n.length-c,d=t.start+n.length-(i?2:0),h=t.parent,p=t.startIndex,m=t.endIndex,v=!0;p<m;p++,v=!1)!v&&r.canSplit(e.doc,d,f)&&(e.split(d,f),d+=2*f),d+=h.child(p).nodeSize;return e}(n.tr,c,h,u,e).scrollIntoView()),!0)}}},2391:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(){return o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},o.apply(this,arguments)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}function a(e,t){return a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},a(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=l(e);if(t){var i=l(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(t,"__esModule",{value:!0});var d=n(9443),h=n(2843),p=Object.create(null),m=function(){function e(t,n,r){c(this,e),this.$anchor=t,this.$head=n,this.ranges=r||[new v(t.min(n),t.max(n))]}return f(e,[{key:"anchor",get:function(){return this.$anchor.pos}},{key:"head",get:function(){return this.$head.pos}},{key:"from",get:function(){return this.$from.pos}},{key:"to",get:function(){return this.$to.pos}},{key:"$from",get:function(){return this.ranges[0].$from}},{key:"$to",get:function(){return this.ranges[0].$to}},{key:"empty",get:function(){for(var e=this.ranges,t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}},{key:"content",value:function(){return this.$from.doc.slice(this.from,this.to,!0)}},{key:"replace",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.Slice.empty,n=t.content.lastChild,r=null,o=0;o<t.openEnd;o++)r=n,n=n.lastChild;for(var i=e.steps.length,a=this.ranges,s=0;s<a.length;s++){var l=a[s],c=l.$from,u=l.$to,f=e.mapping.slice(i);e.replaceRange(f.map(c.pos),f.map(u.pos),s?d.Slice.empty:t),0==s&&M(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}},{key:"replaceWith",value:function(e,t){for(var n=e.steps.length,r=this.ranges,o=0;o<r.length;o++){var i=r[o],a=i.$from,s=i.$to,l=e.mapping.slice(n),c=l.map(a.pos),u=l.map(s.pos);o?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),M(e,n,t.isInline?-1:1))}}},{key:"getBookmark",value:function(){return b.between(this.$anchor,this.$head).getBookmark()}}],[{key:"findFrom",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.parent.inlineContent?new b(e):O(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(var o=e.depth-1;o>=0;o--){var i=t<0?O(e.node(0),e.node(o),e.before(o+1),e.index(o),t,n):O(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,n);if(i)return i}return null}},{key:"near",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.findFrom(e,t)||this.findFrom(e,-t)||new x(e.node(0))}},{key:"atStart",value:function(e){return O(e,e,0,0,1)||new x(e)}},{key:"atEnd",value:function(e){return O(e,e,e.content.size,e.childCount,-1)||new x(e)}},{key:"fromJSON",value:function(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=p[t.type];if(!n)throw new RangeError("No selection type ".concat(t.type," defined"));return n.fromJSON(e,t)}},{key:"jsonID",value:function(e,t){if(e in p)throw new RangeError("Duplicate use of selection JSON ID "+e);return p[e]=t,t.prototype.jsonID=e,t}}]),e}();m.prototype.visible=!0;var v=f((function e(t,n){c(this,e),this.$from=t,this.$to=n})),g=!1;function y(e){g||e.parent.inlineContent||(g=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}var b=function(e){i(n,e);var t=s(n);function n(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return c(this,n),y(e),y(r),t.call(this,e,r)}return f(n,[{key:"$cursor",get:function(){return this.$anchor.pos==this.$head.pos?this.$head:null}},{key:"map",value:function(e,t){var r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return m.near(r);var o=e.resolve(t.map(this.anchor));return new n(o.parent.inlineContent?o:r,r)}},{key:"replace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.Slice.empty;if(o(l(n.prototype),"replace",this).call(this,e,t),t==d.Slice.empty){var r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}},{key:"eq",value:function(e){return e instanceof n&&e.anchor==this.anchor&&e.head==this.head}},{key:"getBookmark",value:function(){return new w(this.anchor,this.head)}},{key:"toJSON",value:function(){return{type:"text",anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new n(e.resolve(t.anchor),e.resolve(t.head))}},{key:"create",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}},{key:"between",value:function(e,t,r){var o=e.pos-t.pos;if(r&&!o||(r=o>=0?1:-1),!t.parent.inlineContent){var i=m.findFrom(t,r,!0)||m.findFrom(t,-r,!0);if(!i)return m.near(t,r);t=i.$head}return e.parent.inlineContent||(0==o||(e=(m.findFrom(e,-r,!0)||m.findFrom(e,r,!0)).$anchor).pos<t.pos!=o<0)&&(e=t),new n(e,t)}}]),n}(m);m.jsonID("text",b);var w=function(){function e(t,n){c(this,e),this.anchor=t,this.head=n}return f(e,[{key:"map",value:function(t){return new e(t.map(this.anchor),t.map(this.head))}},{key:"resolve",value:function(e){return b.between(e.resolve(this.anchor),e.resolve(this.head))}}]),e}(),k=function(e){i(n,e);var t=s(n);function n(e){var r;c(this,n);var o=e.nodeAfter,i=e.node(0).resolve(e.pos+o.nodeSize);return(r=t.call(this,e,i)).node=o,r}return f(n,[{key:"map",value:function(e,t){var r=t.mapResult(this.anchor),o=r.deleted,i=r.pos,a=e.resolve(i);return o?m.near(a):new n(a)}},{key:"content",value:function(){return new d.Slice(d.Fragment.from(this.node),0,0)}},{key:"eq",value:function(e){return e instanceof n&&e.anchor==this.anchor}},{key:"toJSON",value:function(){return{type:"node",anchor:this.anchor}}},{key:"getBookmark",value:function(){return new S(this.anchor)}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new n(e.resolve(t.anchor))}},{key:"create",value:function(e,t){return new n(e.resolve(t))}},{key:"isSelectable",value:function(e){return!e.isText&&!1!==e.type.spec.selectable}}]),n}(m);k.prototype.visible=!1,m.jsonID("node",k);var S=function(){function e(t){c(this,e),this.anchor=t}return f(e,[{key:"map",value:function(t){var n=t.mapResult(this.anchor),r=n.deleted,o=n.pos;return r?new w(o,o):new e(o)}},{key:"resolve",value:function(e){var t=e.resolve(this.anchor),n=t.nodeAfter;return n&&k.isSelectable(n)?new k(t):m.near(t)}}]),e}(),x=function(e){i(n,e);var t=s(n);function n(e){return c(this,n),t.call(this,e.resolve(0),e.resolve(e.content.size))}return f(n,[{key:"replace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.Slice.empty;if(t==d.Slice.empty){e.delete(0,e.doc.content.size);var r=m.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else o(l(n.prototype),"replace",this).call(this,e,t)}},{key:"toJSON",value:function(){return{type:"all"}}},{key:"map",value:function(e){return new n(e)}},{key:"eq",value:function(e){return e instanceof n}},{key:"getBookmark",value:function(){return C}}],[{key:"fromJSON",value:function(e){return new n(e)}}]),n}(m);m.jsonID("all",x);var C={map:function(){return this},resolve:function(e){return new x(e)}};function O(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(t.inlineContent)return b.create(e,n);for(var a=r-(o>0?0:1);o>0?a<t.childCount:a>=0;a+=o){var s=t.child(a);if(s.isAtom){if(!i&&k.isSelectable(s))return k.create(e,n-(o<0?s.nodeSize:0))}else{var l=O(e,s,n+o,o<0?s.childCount:0,o,i);if(l)return l}n+=s.nodeSize*o}return null}function M(e,t,n){var r=e.steps.length-1;if(!(r<t)){var o,i=e.steps[r];(i instanceof h.ReplaceStep||i instanceof h.ReplaceAroundStep)&&(e.mapping.maps[r].forEach((function(e,t,n,r){null==o&&(o=r)})),e.setSelection(m.near(e.doc.resolve(o),n)))}}var T=function(e){i(n,e);var t=s(n);function n(e){var r;return c(this,n),(r=t.call(this,e.doc)).curSelectionFor=0,r.updated=0,r.meta=Object.create(null),r.time=Date.now(),r.curSelection=e.selection,r.storedMarks=e.storedMarks,r}return f(n,[{key:"selection",get:function(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}},{key:"setSelection",value:function(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}},{key:"selectionSet",get:function(){return(1&this.updated)>0}},{key:"setStoredMarks",value:function(e){return this.storedMarks=e,this.updated|=2,this}},{key:"ensureMarks",value:function(e){return d.Mark.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}},{key:"addStoredMark",value:function(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}},{key:"removeStoredMark",value:function(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}},{key:"storedMarksSet",get:function(){return(2&this.updated)>0}},{key:"addStep",value:function(e,t){o(l(n.prototype),"addStep",this).call(this,e,t),this.updated=-3&this.updated,this.storedMarks=null}},{key:"setTime",value:function(e){return this.time=e,this}},{key:"replaceSelection",value:function(e){return this.selection.replace(this,e),this}},{key:"replaceSelectionWith",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||d.Mark.none))),n.replaceWith(this,e),this}},{key:"deleteSelection",value:function(){return this.selection.replace(this),this}},{key:"insertText",value:function(e,t,n){var r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();if(null==n&&(n=t),n=null==n?t:n,!e)return this.deleteRange(t,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(t);o=n==t?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.setSelection(m.near(this.selection.$to)),this}},{key:"setMeta",value:function(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}},{key:"getMeta",value:function(e){return this.meta["string"==typeof e?e:e.key]}},{key:"isGeneric",get:function(){for(var e in this.meta)return!1;return!0}},{key:"scrollIntoView",value:function(){return this.updated|=4,this}},{key:"scrolledIntoView",get:function(){return(4&this.updated)>0}}]),n}(h.Transform);function A(e,t){return t&&e?e.bind(t):e}var N=f((function e(t,n,r){c(this,e),this.name=t,this.init=A(n.init,r),this.apply=A(n.apply,r)})),R=[new N("doc",{init:function(e){return e.doc||e.schema.topNodeType.createAndFill()},apply:function(e){return e.doc}}),new N("selection",{init:function(e,t){return e.selection||m.atStart(t.doc)},apply:function(e){return e.selection}}),new N("storedMarks",{init:function(e){return e.storedMarks||null},apply:function(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new N("scrollToSelection",{init:function(){return 0},apply:function(e,t){return e.scrolledIntoView?t+1:t}})],D=f((function e(t,n){var r=this;c(this,e),this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=R.slice(),n&&n.forEach((function(e){if(r.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");r.plugins.push(e),r.pluginsByKey[e.key]=e,e.spec.state&&r.fields.push(new N(e.key,e.spec.state,e))}))})),_=function(){function e(t){c(this,e),this.config=t}return f(e,[{key:"schema",get:function(){return this.config.schema}},{key:"plugins",get:function(){return this.config.plugins}},{key:"apply",value:function(e){return this.applyTransaction(e).state}},{key:"filterTransaction",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=0;n<this.config.plugins.length;n++)if(n!=t){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}},{key:"applyTransaction",value:function(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};for(var t=[e],n=this.applyInner(e),r=null;;){for(var o=!1,i=0;i<this.config.plugins.length;i++){var a=this.config.plugins[i];if(a.spec.appendTransaction){var s=r?r[i].n:0,l=r?r[i].state:this,c=s<t.length&&a.spec.appendTransaction.call(a,s?t.slice(s):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(var u=0;u<this.config.plugins.length;u++)r.push(u<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}},{key:"applyInner",value:function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var n=new e(this.config),r=this.config.fields,o=0;o<r.length;o++){var i=r[o];n[i.name]=i.apply(t,this[i.name],this,n)}return n}},{key:"tr",get:function(){return new T(this)}},{key:"reconfigure",value:function(t){for(var n=new D(this.schema,t.plugins),r=n.fields,o=new e(n),i=0;i<r.length;i++){var a=r[i].name;o[a]=this.hasOwnProperty(a)?this[a]:r[i].init(t,o)}return o}},{key:"toJSON",value:function(e){var t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map((function(e){return e.toJSON()}))),e&&"object"==r(e))for(var n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var o=e[n],i=o.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(o,this[o.key]))}return t}}],[{key:"create",value:function(t){for(var n=new D(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n),o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(t,r);return r}},{key:"fromJSON",value:function(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var o=new D(t.schema,t.plugins),i=new e(o);return o.fields.forEach((function(e){if("doc"==e.name)i.doc=d.Node.fromJSON(t.schema,n.doc);else if("selection"==e.name)i.selection=m.fromJSON(i.doc,n.selection);else if("storedMarks"==e.name)n.storedMarks&&(i.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(var o in r){var a=r[o],s=a.spec.state;if(a.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,o))return void(i[e.name]=s.fromJSON.call(a,t,n[o],i))}i[e.name]=e.init(t,i)}})),i}}]),e}();function E(e,t,n){for(var r in e){var o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=E(o,t,{})),n[r]=o}return n}var P=function(){function e(t){c(this,e),this.spec=t,this.props={},t.props&&E(t.props,this,this.props),this.key=t.key?t.key.key:I("plugin")}return f(e,[{key:"getState",value:function(e){return e[this.key]}}]),e}(),z=Object.create(null);function I(e){return e in z?e+"$"+ ++z[e]:(z[e]=0,e+"$")}var j=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"key";c(this,e),this.key=I(t)}return f(e,[{key:"get",value:function(e){return e.config.pluginsByKey[this.key]}},{key:"getState",value:function(e){return e[this.key]}}]),e}();t.AllSelection=x,t.EditorState=_,t.NodeSelection=k,t.Plugin=P,t.PluginKey=j,t.Selection=m,t.SelectionRange=v,t.TextSelection=b,t.Transaction=T},1640:(e,t,n)=>{var r,o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,l={};((e,t)=>{for(var n in t)o(e,n,{get:t[n],enumerable:!0})})(l,{CellBookmark:()=>I,CellSelection:()=>z,ResizeState:()=>Le,TableMap:()=>m,TableView:()=>je,__clipCells:()=>ke,__insertCells:()=>Ce,__pastedCells:()=>be,addColSpan:()=>E,addColumn:()=>J,addColumnAfter:()=>G,addColumnBefore:()=>U,addRow:()=>Z,addRowAfter:()=>te,addRowBefore:()=>ee,cellAround:()=>S,cellNear:()=>O,colCount:()=>R,columnIsHeader:()=>P,columnResizing:()=>$e,columnResizingPluginKey:()=>Be,deleteCellSelection:()=>ve,deleteColumn:()=>Y,deleteRow:()=>re,deleteTable:()=>me,findCell:()=>N,fixTables:()=>$,fixTablesKey:()=>F,goToNextCell:()=>pe,handlePaste:()=>Re,inSameTable:()=>A,isInTable:()=>x,mergeCells:()=>ie,moveCellForward:()=>T,nextCell:()=>D,pointsAtCell:()=>M,removeColSpan:()=>_,removeColumn:()=>X,removeRow:()=>ne,rowIsHeader:()=>Q,selectedRect:()=>q,selectionCell:()=>C,setCellAttr:()=>le,splitCell:()=>ae,splitCellWithType:()=>se,tableEditing:()=>qe,tableEditingKey:()=>k,tableNodeTypes:()=>w,tableNodes:()=>b,toggleHeader:()=>ue,toggleHeaderCell:()=>he,toggleHeaderColumn:()=>de,toggleHeaderRow:()=>fe,updateColumnsOnResize:()=>Fe}),e.exports=(r=l,((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of a(t))s.call(e,n)||undefined===n||o(e,n,{get:()=>t[n],enumerable:!(r=i(t,n))||r.enumerable});return e})(o({},"__esModule",{value:!0}),r));var c,u,f=n(2391),d=n(9443),h=n(2391),p=n(9222);if("undefined"!=typeof WeakMap){let e=new WeakMap;c=t=>e.get(t),u=(t,n)=>(e.set(t,n),n)}else{const e=[],t=10;let n=0;c=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},u=(r,o)=>(n==t&&(n=0),e[n++]=r,e[n++]=o)}var m=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,o=t/this.width|0;let i=r+1,a=o+1;for(let e=1;i<this.width&&this.map[t+e]==n;e++)i++;for(let e=1;a<this.height&&this.map[t+this.width*e]==n;e++)a++;return{left:r,top:o,right:i,bottom:a}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:o,top:i,bottom:a}=this.findCell(e);return"horiz"==t?(n<0?0==r:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?0==i:a==this.height)?null:this.map[r+this.width*(n<0?i-1:a)]}rectBetween(e,t){const{left:n,right:r,top:o,bottom:i}=this.findCell(e),{left:a,right:s,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,a),top:Math.min(o,l),right:Math.max(r,s),bottom:Math.max(i,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let o=e.left;o<e.right;o++){const i=r*this.width+o,a=this.map[i];n[a]||(n[a]=!0,o==e.left&&o&&this.map[i-1]==a||r==e.top&&r&&this.map[i-this.width]==a||t.push(a))}return t}positionAt(e,t,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==e){let n=t+e*this.width;const r=(e+1)*this.width;for(;n<r&&this.map[n]<o;)n++;return n==r?i-1:this.map[n]}o=i}}static get(e){return c(e)||u(e,function(e){if("table"!=e.type.spec.tableRole)throw new RangeError("Not a table node: "+e.type.name);const t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const o=e.child(r);let i=0;if(n)for(let t=0;t<r;t++){const n=e.child(t);for(let e=0;e<n.childCount;e++){const o=n.child(e);t+o.attrs.rowspan>r&&(i+=o.attrs.colspan)}}for(let e=0;e<o.childCount;e++){const t=o.child(e);i+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=i:t!=i&&(t=Math.max(t,i))}return t}(e),n=e.childCount,r=[];let o=0,i=null;const a=[];for(let e=0,o=t*n;e<o;e++)r[e]=0;for(let s=0,l=0;s<n;s++){const c=e.child(s);l++;for(let e=0;;e++){for(;o<r.length&&0!=r[o];)o++;if(e==c.childCount)break;const u=c.child(e),{colspan:f,rowspan:d,colwidth:h}=u.attrs;for(let e=0;e<d;e++){if(e+s>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:l,n:d-e});break}const c=o+e*t;for(let e=0;e<f;e++){0==r[c+e]?r[c+e]=l:(i||(i=[])).push({type:"collision",row:s,pos:l,n:f-e});const n=h&&h[e];if(n){const r=(c+e)%t*2,o=a[r];null==o||o!=n&&1==a[r+1]?(a[r]=n,a[r+1]=1):o==n&&a[r+1]++}}}o+=f,l+=u.nodeSize}const u=(s+1)*t;let f=0;for(;o<u;)0==r[o++]&&f++;f&&(i||(i=[])).push({type:"missing",row:s,n:f}),l++}const s=new m(t,n,r,i);let l=!1;for(let e=0;!l&&e<a.length;e+=2)null!=a[e]&&a[e+1]<n&&(l=!0);return l&&function(e,t,n){e.problems||(e.problems=[]);const r={};for(let o=0;o<e.map.length;o++){const i=e.map[o];if(r[i])continue;r[i]=!0;const a=n.nodeAt(i);if(!a)throw new RangeError(`No cell with offset ${i} found`);let s=null;const l=a.attrs;for(let n=0;n<l.colspan;n++){const r=t[(o+n)%e.width*2];null==r||l.colwidth&&l.colwidth[n]==r||((s||(s=v(l)))[n]=r)}s&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:s})}}(s,a,e),s}(e))}};function v(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function g(e,t){if("string"==typeof e)return{};const n=e.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map((e=>Number(e))):null,o=Number(e.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:r&&r.length==o?r:null};for(const n in t){const r=t[n].getFromDOM,o=r&&r(e);null!=o&&(i[n]=o)}return i}function y(e,t){const n={};1!=e.attrs.colspan&&(n.colspan=e.attrs.colspan),1!=e.attrs.rowspan&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n["data-colwidth"]=e.attrs.colwidth.join(","));for(const r in t){const o=t[r].setDOMAttr;o&&o(e.attrs[r],n)}return n}function b(e){const t=e.cellAttributes||{},n={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(const e in t)n[e]={default:t[e].default};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:{content:e.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:e=>g(e,t)}],toDOM:e=>["td",y(e,t),0]},table_header:{content:e.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:e=>g(e,t)}],toDOM:e=>["th",y(e,t),0]}}}function w(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],o=r.spec.tableRole;o&&(t[o]=r)}}return t}var k=new(n(2391).PluginKey)("selectingCells");function S(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function x(e){const t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function C(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;const n=S(t.$head)||O(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function O(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}function M(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function T(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function A(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function N(e){return m.get(e.node(-1)).findCell(e.pos-e.start(-1))}function R(e){return m.get(e.node(-1)).colCount(e.pos-e.start(-1))}function D(e,t,n){const r=e.node(-1),o=m.get(r),i=e.start(-1),a=o.nextCell(e.pos-i,t,n);return null==a?null:e.node(0).resolve(i+a)}function _(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some((e=>e>0))||(r.colwidth=null)),r}function E(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function P(e,t,n){const r=w(t.type.schema).header_cell;for(let o=0;o<e.height;o++)if(t.nodeAt(e.map[n+o*e.width]).type!=r)return!1;return!0}var z=class e extends h.Selection{constructor(e,t=e){const n=e.node(-1),r=m.get(n),o=e.start(-1),i=r.rectBetween(e.pos-o,t.pos-o),a=e.node(0),s=r.cellsInRect(i).filter((e=>e!=t.pos-o));s.unshift(t.pos-o);const l=s.map((e=>{const t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);const r=o+e+1;return new h.SelectionRange(a.resolve(r),a.resolve(r+t.content.size))}));super(l[0].$from,l[0].$to,l),this.$anchorCell=e,this.$headCell=t}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),o=t.resolve(n.map(this.$headCell.pos));if(M(r)&&M(o)&&A(r,o)){const t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,o):t&&this.isColSelection()?e.colSelection(r,o):new e(r,o)}return h.TextSelection.between(r,o)}content(){const e=this.$anchorCell.node(-1),t=m.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},i=[];for(let n=r.top;n<r.bottom;n++){const a=[];for(let i=n*t.width+r.left,s=r.left;s<r.right;s++,i++){const n=t.map[i];if(o[n])continue;o[n]=!0;const s=t.findCell(n);let l=e.nodeAt(n);if(!l)throw RangeError(`No cell with offset ${n} found`);const c=r.left-s.left,u=s.right-r.right;if(c>0||u>0){let e=l.attrs;if(c>0&&(e=_(e,0,c)),u>0&&(e=_(e,e.colspan-u,u)),s.left<r.left){if(l=l.type.createAndFill(e),!l)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else l=l.type.create(e,l.content)}if(s.top<r.top||s.bottom>r.bottom){const e={...l.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};l=s.top<r.top?l.type.createAndFill(e):l.type.create(e,l.content)}a.push(l)}i.push(e.child(n).copy(d.Fragment.from(a)))}const a=this.isColSelection()&&this.isRowSelection()?e:i;return new d.Slice(d.Fragment.from(a),1,1)}replace(e,t=d.Slice.empty){const n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){const{$from:i,$to:a}=r[o],s=e.mapping.slice(n);e.replace(s.map(i.pos),s.map(a.pos),o?d.Slice.empty:t)}const o=h.Selection.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new d.Slice(d.Fragment.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=m.get(t),r=this.$anchorCell.start(-1),o=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<o.length;n++)e(t.nodeAt(o[n]),r+o[n])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),o=m.get(r),i=t.start(-1),a=o.findCell(t.pos-i),s=o.findCell(n.pos-i),l=t.node(0);return a.top<=s.top?(a.top>0&&(t=l.resolve(i+o.map[a.left])),s.bottom<o.height&&(n=l.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))):(s.top>0&&(n=l.resolve(i+o.map[s.left])),a.bottom<o.height&&(t=l.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))),new e(t,n)}isRowSelection(){const e=this.$anchorCell.node(-1),t=m.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),o=t.colCount(this.$headCell.pos-n);if(Math.min(r,o)>0)return!1;const i=r+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,a)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),o=m.get(r),i=t.start(-1),a=o.findCell(t.pos-i),s=o.findCell(n.pos-i),l=t.node(0);return a.left<=s.left?(a.left>0&&(t=l.resolve(i+o.map[a.top*o.width])),s.right<o.width&&(n=l.resolve(i+o.map[o.width*(s.top+1)-1]))):(s.left>0&&(n=l.resolve(i+o.map[s.top*o.width])),a.right<o.width&&(t=l.resolve(i+o.map[o.width*(a.top+1)-1]))),new e(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new I(this.$anchorCell.pos,this.$headCell.pos)}};z.prototype.visible=!1,h.Selection.jsonID("cell",z);var I=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&A(t,n)?new z(t,n):h.Selection.near(n,1)}};function j(e){if(!(e.selection instanceof z))return null;const t=[];return e.selection.forEachCell(((e,n)=>{t.push(p.Decoration.node(n,n+e.nodeSize,{class:"selectedCell"}))})),p.DecorationSet.create(e.doc,t)}var F=new(n(2391).PluginKey)("fix-tables");function B(e,t,n,r){const o=e.childCount,i=t.childCount;e:for(let a=0,s=0;a<i;a++){const i=t.child(a);for(let t=s,r=Math.min(o,a+3);t<r;t++)if(e.child(t)==i){s=t+1,n+=i.nodeSize;continue e}r(i,n),s<o&&e.child(s).sameMarkup(i)?B(e.child(s),i,n+1,r):i.nodesBetween(0,i.content.size,r,n+1),n+=i.nodeSize}}function $(e,t){let n;const r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){const o=m.get(t);if(!o.problems)return r;r||(r=e.tr);const i=[];for(let e=0;e<o.height;e++)i.push(0);for(let e=0;e<o.problems.length;e++){const a=o.problems[e];if("collision"==a.type){const e=t.nodeAt(a.pos);if(!e)continue;const o=e.attrs;for(let e=0;e<o.rowspan;e++)i[a.row+e]+=a.n;r.setNodeMarkup(r.mapping.map(n+1+a.pos),null,_(o,o.colspan-a.n,a.n))}else if("missing"==a.type)i[a.row]+=a.n;else if("overlong_rowspan"==a.type){const e=t.nodeAt(a.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+a.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-a.n})}else if("colwidth mismatch"==a.type){const e=t.nodeAt(a.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+a.pos),null,{...e.attrs,colwidth:a.colwidth})}}let a,s;for(let e=0;e<i.length;e++)i[e]&&(null==a&&(a=e),s=e);for(let l=0,c=n+1;l<o.height;l++){const n=t.child(l),o=c+n.nodeSize,u=i[l];if(u>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);const i=[];for(let n=0;n<u;n++){const n=w(e.schema)[t].createAndFill();n&&i.push(n)}const f=0!=l&&a!=l-1||s!=l?o-1:c+1;r.insert(r.mapping.map(f),i)}c=o}return r.setMeta(F,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&B(t.doc,e.doc,0,r):e.doc.descendants(r),n}var L=n(7354),V=n(9443),K=n(2391),H=n(9443),W=n(2391);function q(e){const t=e.selection,n=C(e),r=n.node(-1),o=n.start(-1),i=m.get(r);return{...t instanceof z?i.rectBetween(t.$anchorCell.pos-o,t.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function J(e,{map:t,tableStart:n,table:r},o){let i=o>0?-1:0;P(t,r,o+i)&&(i=0==o||o==t.width?null:0);for(let a=0;a<t.height;a++){const s=a*t.width+o;if(o>0&&o<t.width&&t.map[s-1]==t.map[s]){const i=t.map[s],l=r.nodeAt(i);e.setNodeMarkup(e.mapping.map(n+i),null,E(l.attrs,o-t.colCount(i))),a+=l.attrs.rowspan-1}else{const l=null==i?w(r.type.schema).cell:r.nodeAt(t.map[s+i]).type,c=t.positionAt(a,o,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function U(e,t){if(!x(e))return!1;if(t){const n=q(e);t(J(e.tr,n,n.left))}return!0}function G(e,t){if(!x(e))return!1;if(t){const n=q(e);t(J(e.tr,n,n.right))}return!0}function X(e,{map:t,table:n,tableStart:r},o){const i=e.mapping.maps.length;for(let a=0;a<t.height;){const s=a*t.width+o,l=t.map[s],c=n.nodeAt(l),u=c.attrs;if(o>0&&t.map[s-1]==l||o<t.width-1&&t.map[s+1]==l)e.setNodeMarkup(e.mapping.slice(i).map(r+l),null,_(u,o-t.colCount(l)));else{const t=e.mapping.slice(i).map(r+l);e.delete(t,t+c.nodeSize)}a+=u.rowspan}}function Y(e,t){if(!x(e))return!1;if(t){const n=q(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;X(r,n,e),e!=n.left;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=m.get(e)}t(r)}return!0}function Q(e,t,n){var r;const o=w(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if((null==(r=t.nodeAt(e.map[i+n*e.width]))?void 0:r.type)!=o)return!1;return!0}function Z(e,{map:t,tableStart:n,table:r},o){var i;let a=n;for(let e=0;e<o;e++)a+=r.child(e).nodeSize;const s=[];let l=o>0?-1:0;Q(t,r,o+l)&&(l=0==o||o==t.height?null:0);for(let a=0,c=t.width*o;a<t.width;a++,c++)if(o>0&&o<t.height&&t.map[c]==t.map[c-t.width]){const o=t.map[c],i=r.nodeAt(o).attrs;e.setNodeMarkup(n+o,null,{...i,rowspan:i.rowspan+1}),a+=i.colspan-1}else{const e=null==l?w(r.type.schema).cell:null==(i=r.nodeAt(t.map[c+l*t.width]))?void 0:i.type,n=null==e?void 0:e.createAndFill();n&&s.push(n)}return e.insert(a,w(r.type.schema).row.create(null,s)),e}function ee(e,t){if(!x(e))return!1;if(t){const n=q(e);t(Z(e.tr,n,n.top))}return!0}function te(e,t){if(!x(e))return!1;if(t){const n=q(e);t(Z(e.tr,n,n.bottom))}return!0}function ne(e,{map:t,table:n,tableStart:r},o){let i=0;for(let e=0;e<o;e++)i+=n.child(e).nodeSize;const a=i+n.child(o).nodeSize,s=e.mapping.maps.length;e.delete(i+r,a+r);const l=new Set;for(let i=0,a=o*t.width;i<t.width;i++,a++){const c=t.map[a];if(!l.has(c))if(l.add(c),o>0&&c==t.map[a-t.width]){const t=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(s).map(c+r),null,{...t,rowspan:t.rowspan-1}),i+=t.colspan-1}else if(o<t.height&&c==t.map[a+t.width]){const a=n.nodeAt(c),l=a.attrs,u=a.type.create({...l,rowspan:a.attrs.rowspan-1},a.content),f=t.positionAt(o+1,i,n);e.insert(e.mapping.slice(s).map(r+f),u),i+=l.colspan-1}}}function re(e,t){if(!x(e))return!1;if(t){const n=q(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;ne(r,n,e),e!=n.top;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=m.get(n.table)}t(r)}return!0}function oe(e){const t=e.content;return 1==t.childCount&&t.child(0).isTextblock&&0==t.child(0).childCount}function ie(e,t){const n=e.selection;if(!(n instanceof z)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=q(e),{map:o}=r;if(function({width:e,height:t,map:n},r){let o=r.top*e+r.left,i=o,a=(r.bottom-1)*e+r.left,s=o+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[i]==n[i-1]||r.right<e&&n[s]==n[s+1])return!0;i+=e,s+=e}for(let i=r.left;i<r.right;i++){if(r.top>0&&n[o]==n[o-e]||r.bottom<t&&n[a]==n[a+e])return!0;o++,a++}return!1}(o,r))return!1;if(t){const n=e.tr,i={};let a,s,l=H.Fragment.empty;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){const c=o.map[e*o.width+t],u=r.table.nodeAt(c);if(!i[c]&&u)if(i[c]=!0,null==a)a=c,s=u;else{oe(u)||(l=l.append(u.content));const e=n.mapping.map(c+r.tableStart);n.delete(e,e+u.nodeSize)}}if(null==a||null==s)return!0;if(n.setNodeMarkup(a+r.tableStart,null,{...E(s.attrs,s.attrs.colspan,r.right-r.left-s.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const e=a+1+s.content.size,t=oe(s)?a+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,l)}n.setSelection(new z(n.doc.resolve(a+r.tableStart))),t(n)}return!0}function ae(e,t){const n=w(e.schema);return se((({node:e})=>n[e.type.spec.tableRole]))(e,t)}function se(e){return(t,n)=>{var r;const o=t.selection;let i,a;if(o instanceof z){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,a=o.$anchorCell.pos}else{if(i=function(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if("cell"===n||"header_cell"===n)return e.node(t)}return null}(o.$from),!i)return!1;a=null==(r=S(o.$from))?void 0:r.pos}if(null==i||null==a)return!1;if(1==i.attrs.colspan&&1==i.attrs.rowspan)return!1;if(n){let r=i.attrs;const s=[],l=r.colwidth;r.rowspan>1&&(r={...r,rowspan:1}),r.colspan>1&&(r={...r,colspan:1});const c=q(t),u=t.tr;for(let e=0;e<c.right-c.left;e++)s.push(l?{...r,colwidth:l&&l[e]?[l[e]]:null}:r);let f;for(let t=c.top;t<c.bottom;t++){let n=c.map.positionAt(t,c.left,c.table);t==c.top&&(n+=i.nodeSize);for(let r=c.left,o=0;r<c.right;r++,o++)r==c.left&&t==c.top||u.insert(f=u.mapping.map(n+c.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[o]))}u.setNodeMarkup(a,e({node:i,row:c.top,col:c.left}),s[0]),o instanceof z&&u.setSelection(new z(u.doc.resolve(o.$anchorCell.pos),f?u.doc.resolve(f):void 0)),n(u)}return!0}}function le(e,t){return function(n,r){if(!x(n))return!1;const o=C(n);if(o.nodeAfter.attrs[e]===t)return!1;if(r){const i=n.tr;n.selection instanceof z?n.selection.forEachCell(((n,r)=>{n.attrs[e]!==t&&i.setNodeMarkup(r,null,{...n.attrs,[e]:t})})):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[e]:t}),r(i)}return!0}}function ce(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){const o=t.table.nodeAt(r[e]);if(o&&o.type!==n.header_cell)return!1}return!0}function ue(e,t){return(t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(e){return function(t,n){if(!x(t))return!1;if(n){const r=w(t.schema),o=q(t),i=t.tr,a=o.map.cellsInRect("column"==e?{left:o.left,top:0,right:o.right,bottom:o.map.height}:"row"==e?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),s=a.map((e=>o.table.nodeAt(e)));for(let e=0;e<a.length;e++)s[e].type==r.header_cell&&i.setNodeMarkup(o.tableStart+a[e],r.cell,s[e].attrs);if(0==i.steps.length)for(let e=0;e<a.length;e++)i.setNodeMarkup(o.tableStart+a[e],r.header_cell,s[e].attrs);n(i)}return!0}}(e):function(t,n){if(!x(t))return!1;if(n){const r=w(t.schema),o=q(t),i=t.tr,a=ce("row",o,r),s=ce("column",o,r),l=("column"===e?a:"row"===e&&s)?1:0,c="column"==e?{left:0,top:l,right:1,bottom:o.map.height}:"row"==e?{left:l,top:0,right:o.map.width,bottom:1}:o,u="column"==e?s?r.cell:r.header_cell:"row"==e?a?r.cell:r.header_cell:r.cell;o.map.cellsInRect(c).forEach((e=>{const t=e+o.tableStart,n=i.doc.nodeAt(t);n&&i.setNodeMarkup(t,u,n.attrs)})),n(i)}return!0}}var fe=ue("row",{useDeprecatedLogic:!0}),de=ue("column",{useDeprecatedLogic:!0}),he=ue("cell",{useDeprecatedLogic:!0});function pe(e){return function(t,n){if(!x(t))return!1;const r=function(e,t){if(t<0){const t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){const r=e.node(-1).child(t),o=r.lastChild;if(o)return n-1-o.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){const e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(C(t),e);if(null==r)return!1;if(n){const e=t.doc.resolve(r);n(t.tr.setSelection(W.TextSelection.between(e,T(e))).scrollIntoView())}return!0}}function me(e,t){const n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function ve(e,t){const n=e.selection;if(!(n instanceof z))return!1;if(t){const r=e.tr,o=w(e.schema).cell.createAndFill().content;n.forEachCell(((e,t)=>{e.content.eq(o)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new H.Slice(o,0,0))})),r.docChanged&&t(r)}return!0}var ge=n(9443),ye=n(2843);function be(e){if(!e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;const o=t.child(0),i=o.type.spec.tableRole,a=o.type.schema,s=[];if("row"==i)for(let e=0;e<t.childCount;e++){let o=t.child(e).content;const i=e?0:Math.max(0,n-1),l=e<t.childCount-1?0:Math.max(0,r-1);(i||l)&&(o=we(w(a).row,new ge.Slice(o,i,l)).content),s.push(o)}else{if("cell"!=i&&"header_cell"!=i)return null;s.push(n||r?we(w(a).row,new ge.Slice(t,n,r)).content:t)}return function(e,t){const n=[];for(let e=0;e<t.length;e++){const r=t[e];for(let t=r.childCount-1;t>=0;t--){const{rowspan:o,colspan:i}=r.child(t).attrs;for(let t=e;t<e+o;t++)n[t]=(n[t]||0)+i}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let o=0;o<n.length;o++)if(o>=t.length&&t.push(ge.Fragment.empty),n[o]<r){const i=w(e).cell.createAndFill(),a=[];for(let e=n[o];e<r;e++)a.push(i);t[o]=t[o].append(ge.Fragment.from(a))}return{height:t.length,width:r,rows:t}}(a,s)}function we(e,t){const n=e.createAndFill();return new ye.Transform(n).replace(0,n.content.size,t).doc}function ke({width:e,height:t,rows:n},r,o){if(e!=r){const t=[],o=[];for(let e=0;e<n.length;e++){const i=n[e],a=[];for(let n=t[e]||0,o=0;n<r;o++){let s=i.child(o%i.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(_(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),a.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}o.push(ge.Fragment.from(a))}n=o,e=r}if(t!=o){const e=[];for(let r=0,i=0;r<o;r++,i++){const a=[],s=n[i%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>o&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,o-t.attrs.rowspan)},t.content)),a.push(t)}e.push(ge.Fragment.from(a))}n=e,t=o}return{width:e,height:t,rows:n}}function Se(e,t,n,r,o,i,a,s){if(0==a||a==t.height)return!1;let l=!1;for(let c=o;c<i;c++){const o=a*t.width+c,i=t.map[o];if(t.map[o-t.width]==i){l=!0;const o=n.nodeAt(i),{top:u,left:f}=t.findCell(i);e.setNodeMarkup(e.mapping.slice(s).map(i+r),null,{...o.attrs,rowspan:a-u}),e.insert(e.mapping.slice(s).map(t.positionAt(a,f,n)),o.type.createAndFill({...o.attrs,rowspan:u+o.attrs.rowspan-a})),c+=o.attrs.colspan-1}}return l}function xe(e,t,n,r,o,i,a,s){if(0==a||a==t.width)return!1;let l=!1;for(let c=o;c<i;c++){const o=c*t.width+a,i=t.map[o];if(t.map[o-1]==i){l=!0;const o=n.nodeAt(i),u=t.colCount(i),f=e.mapping.slice(s).map(i+r);e.setNodeMarkup(f,null,_(o.attrs,a-u,o.attrs.colspan-(a-u))),e.insert(f+o.nodeSize,o.type.createAndFill(_(o.attrs,0,a-u))),c+=o.attrs.rowspan-1}}return l}function Ce(e,t,n,r,o){let i=n?e.doc.nodeAt(n-1):e.doc;if(!i)throw new Error("No table found");let a=m.get(i);const{top:s,left:l}=r,c=l+o.width,u=s+o.height,f=e.tr;let d=0;function h(){if(i=n?f.doc.nodeAt(n-1):f.doc,!i)throw new Error("No table found");a=m.get(i),d=f.mapping.maps.length}(function(e,t,n,r,o,i,a){const s=w(e.doc.type.schema);let l,c;if(o>t.width)for(let i=0,u=0;i<t.height;i++){const f=n.child(i);u+=f.nodeSize;const d=[];let h;h=null==f.lastChild||f.lastChild.type==s.cell?l||(l=s.cell.createAndFill()):c||(c=s.header_cell.createAndFill());for(let e=t.width;e<o;e++)d.push(h);e.insert(e.mapping.slice(a).map(u-1+r),d)}if(i>t.height){const u=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,o);e++){const o=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==s.header_cell;u.push(o?c||(c=s.header_cell.createAndFill()):l||(l=s.cell.createAndFill()))}const f=s.row.create(null,ge.Fragment.from(u)),d=[];for(let e=t.height;e<i;e++)d.push(f);e.insert(e.mapping.slice(a).map(r+n.nodeSize-2),d)}return!(!l&&!c)})(f,a,i,n,c,u,d)&&h(),Se(f,a,i,n,l,c,s,d)&&h(),Se(f,a,i,n,l,c,u,d)&&h(),xe(f,a,i,n,s,u,l,d)&&h(),xe(f,a,i,n,s,u,c,d)&&h();for(let e=s;e<u;e++){const t=a.positionAt(e,l,i),r=a.positionAt(e,c,i);f.replace(f.mapping.slice(d).map(t+n),f.mapping.slice(d).map(r+n),new ge.Slice(o.rows[e-s],0,0))}h(),f.setSelection(new z(f.doc.resolve(n+a.positionAt(s,l,i)),f.doc.resolve(n+a.positionAt(u-1,c-1,i)))),t(f)}var Oe=(0,L.keydownHandler)({ArrowLeft:Te("horiz",-1),ArrowRight:Te("horiz",1),ArrowUp:Te("vert",-1),ArrowDown:Te("vert",1),"Shift-ArrowLeft":Ae("horiz",-1),"Shift-ArrowRight":Ae("horiz",1),"Shift-ArrowUp":Ae("vert",-1),"Shift-ArrowDown":Ae("vert",1),Backspace:ve,"Mod-Backspace":ve,Delete:ve,"Mod-Delete":ve});function Me(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Te(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;if(i instanceof z)return Me(n,r,K.Selection.near(i.$headCell,t));if("horiz"!=e&&!i.empty)return!1;const a=_e(o,e,t);if(null==a)return!1;if("horiz"==e)return Me(n,r,K.Selection.near(n.doc.resolve(i.head+t),t));{const o=n.doc.resolve(a),i=D(o,e,t);let s;return s=i?K.Selection.near(i,1):t<0?K.Selection.near(n.doc.resolve(o.before(-1)),-1):K.Selection.near(n.doc.resolve(o.after(-1)),1),Me(n,r,s)}}}function Ae(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let a;if(i instanceof z)a=i;else{const r=_e(o,e,t);if(null==r)return!1;a=new z(n.doc.resolve(r))}const s=D(a.$headCell,e,t);return!!s&&Me(n,r,new z(a.$anchorCell,s))}}function Ne(e,t){const n=S(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new z(n))),!0)}function Re(e,t,n){if(!x(e.state))return!1;let r=be(n);const o=e.state.selection;if(o instanceof z){r||(r={width:1,height:1,rows:[V.Fragment.from(we(w(e.state.schema).cell,n))]});const t=o.$anchorCell.node(-1),i=o.$anchorCell.start(-1),a=m.get(t).rectBetween(o.$anchorCell.pos-i,o.$headCell.pos-i);return r=ke(r,a.right-a.left,a.bottom-a.top),Ce(e.state,e.dispatch,i,a,r),!0}if(r){const t=C(e.state),n=t.start(-1);return Ce(e.state,e.dispatch,n,m.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function De(e,t){var n;if(t.ctrlKey||t.metaKey)return;const r=Ee(e,t.target);let o;if(t.shiftKey&&e.state.selection instanceof z)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&null!=(o=S(e.state.selection.$anchor))&&(null==(n=Pe(e,t))?void 0:n.pos)!=o.pos)i(o,t),t.preventDefault();else if(!r)return;function i(t,n){let r=Pe(e,n);const o=null==k.getState(e.state);if(!r||!A(t,r)){if(!o)return;r=t}const i=new z(t,r);if(o||!e.state.selection.eq(i)){const n=e.state.tr.setSelection(i);o&&n.setMeta(k,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener("mouseup",a),e.root.removeEventListener("dragstart",a),e.root.removeEventListener("mousemove",s),null!=k.getState(e.state)&&e.dispatch(e.state.tr.setMeta(k,-1))}function s(n){const o=n,s=k.getState(e.state);let l;if(null!=s)l=e.state.doc.resolve(s);else if(Ee(e,o.target)!=r&&(l=Pe(e,t),!l))return a();l&&i(l,o)}e.root.addEventListener("mouseup",a),e.root.addEventListener("dragstart",a),e.root.addEventListener("mousemove",s)}function _e(e,t,n){if(!(e.state.selection instanceof K.TextSelection))return null;const{$head:r}=e.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if("cell"==i.type.spec.tableRole||"header_cell"==i.type.spec.tableRole){const i=r.before(o),a="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(a)?i:null}}return null}function Ee(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function Pe(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});return n&&n?S(e.state.doc.resolve(n.pos)):null}var ze=n(2391),Ie=n(9222),je=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Fe(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,Fe(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function Fe(e,t,n,r,o,i){var a;let s=0,l=!0,c=t.firstChild;const u=e.firstChild;if(u){for(let e=0,n=0;e<u.childCount;e++){const{colspan:a,colwidth:f}=u.child(e).attrs;for(let e=0;e<a;e++,n++){const a=o==n?i:f&&f[e],u=a?a+"px":"";if(s+=a||r,a||(l=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{const e=document.createElement("col");e.style.width=u,t.appendChild(e)}}}for(;c;){const e=c.nextSibling;null==(a=c.parentNode)||a.removeChild(c),c=e}l?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}var Be=new ze.PluginKey("tableColumnResizing");function $e({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=je,lastColumnResizable:o=!0}={}){const i=new ze.Plugin({key:Be,state:{init(e,t){var o,a;const s=null==(a=null==(o=i.spec)?void 0:o.props)?void 0:a.nodeViews,l=w(t.schema).table.name;return r&&s&&(s[l]=(e,t)=>new r(e,n,t)),new Le(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{const t=Be.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r){const o=Be.getState(e.state);if(o&&!o.dragging){const i=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target);let a=-1;if(i){const{left:r,right:o}=i.getBoundingClientRect();t.clientX-r<=n?a=Ve(e,t,"left",n):o-t.clientX<=n&&(a=Ve(e,t,"right",n))}if(a!=o.activeHandle){if(!r&&-1!==a){const t=e.state.doc.resolve(a),n=t.node(-1),r=m.get(n),o=t.start(-1);if(r.colCount(t.pos-o)+t.nodeAfter.attrs.colspan-1==r.width-1)return}He(e,a)}}}(t,n,e,o)},mouseleave:e=>{!function(e){const t=Be.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&He(e,-1)}(e)},mousedown:(e,r)=>{!function(e,t,n,r){var o;const i=null!=(o=e.dom.ownerDocument.defaultView)?o:window,a=Be.getState(e.state);if(!a||-1==a.activeHandle||a.dragging)return!1;const s=e.state.doc.nodeAt(a.activeHandle),l=function(e,t,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=e.domAtPos(t);let a=i.node.childNodes[i.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(a-=r[e],s--);return a/s}(e,a.activeHandle,s.attrs);function c(t){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const r=Be.getState(e.state);(null==r?void 0:r.dragging)&&(function(e,t,n){const r=e.state.doc.resolve(t),o=r.node(-1),i=m.get(o),a=r.start(-1),s=i.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let e=0;e<i.height;e++){const t=e*i.width+s;if(e&&i.map[t]==i.map[t-i.width])continue;const r=i.map[t],u=o.nodeAt(r).attrs,f=1==u.colspan?0:s-i.colCount(r);if(u.colwidth&&u.colwidth[f]==n)continue;const d=u.colwidth?u.colwidth.slice():(c=u.colspan,Array(c).fill(0));d[f]=n,l.setNodeMarkup(a+r,null,{...u,colwidth:d})}var c;l.docChanged&&e.dispatch(l)}(e,r.activeHandle,Ke(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(Be,{setDragging:null})))}function u(t){if(!t.which)return c(t);const o=Be.getState(e.state);if(o&&o.dragging){const i=Ke(o.dragging,t,n);We(e,o.activeHandle,i,r)}}e.dispatch(e.state.tr.setMeta(Be,{setDragging:{startX:t.clientX,startWidth:l}})),We(e,a.activeHandle,l,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),t.preventDefault()}(e,r,t,n)}},decorations:e=>{const t=Be.getState(e);if(t&&t.activeHandle>-1)return function(e,t){var n;const r=[],o=e.doc.resolve(t),i=o.node(-1);if(!i)return Ie.DecorationSet.empty;const a=m.get(i),s=o.start(-1),l=a.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){const o=l+t*a.width;if(!(l!=a.width-1&&a.map[o]==a.map[o+1]||0!=t&&a.map[o]==a.map[o-a.width])){const t=a.map[o],l=s+t+i.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null==(n=Be.getState(e))?void 0:n.dragging)&&r.push(Ie.Decoration.node(s+t,s+t+i.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),r.push(Ie.Decoration.widget(l,c))}}return Ie.DecorationSet.create(e.doc,r)}(e,t.activeHandle)},nodeViews:{}}});return i}var Le=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){const n=this,r=t.getMeta(Be);if(r&&null!=r.setHandle)return new e(r.setHandle,!1);if(r&&void 0!==r.setDragging)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return M(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function Ve(e,t,n,r){const o="right"==n?-r:r,i=e.posAtCoords({left:t.clientX+o,top:t.clientY});if(!i)return-1;const{pos:a}=i,s=S(e.state.doc.resolve(a));if(!s)return-1;if("right"==n)return s.pos;const l=m.get(s.node(-1)),c=s.start(-1),u=l.map.indexOf(s.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function Ke(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function He(e,t){e.dispatch(e.state.tr.setMeta(Be,{setHandle:t}))}function We(e,t,n,r){const o=e.state.doc.resolve(t),i=o.node(-1),a=o.start(-1),s=m.get(i).colCount(o.pos-a)+o.nodeAfter.attrs.colspan-1;let l=e.domAtPos(o.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&Fe(i,l.firstChild,l,r,s,n)}function qe({allowTableNodeSelection:e=!1}={}){return new f.Plugin({key:k,state:{init:()=>null,apply(e,t){const n=e.getMeta(k);if(null!=n)return-1==n?null:n;if(null==t||!e.docChanged)return t;const{deleted:r,pos:o}=e.mapping.mapResult(t);return r?null:o}},props:{decorations:j,handleDOMEvents:{mousedown:De},createSelectionBetween:e=>null!=k.getState(e.state)?e.state.selection:null,handleTripleClick:Ne,handleKeyDown:Oe,handlePaste:Re},appendTransaction:(t,n,r)=>function(e,t,n){const r=(t||e).selection,o=(t||e).doc;let i,a;if(r instanceof h.NodeSelection&&(a=r.node.type.spec.tableRole)){if("cell"==a||"header_cell"==a)i=z.create(o,r.from);else if("row"==a){const e=o.resolve(r.from+1);i=z.rowSelection(e,e)}else if(!n){const e=m.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];i=z.create(o,t+1,n)}}else r instanceof h.TextSelection&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,o=e.depth;for(;o>=0&&!(e.after(o+1)<e.end(o));o--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(o).type.spec.tableRole)}(r)?i=h.TextSelection.create(o,r.from):r instanceof h.TextSelection&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){const r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){const n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(r)&&(i=h.TextSelection.create(o,r.$from.start(),r.$from.end()));return i&&(t||(t=e.tr)).setSelection(i),t}(r,$(r,n),e)})}},2843:(e,t,n)=>{function r(e){var t="function"==typeof Map?new Map:void 0;return r=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return o(e,arguments,c(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,e)},r(e)}function o(e,t,n){return o=l()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&a(o,n.prototype),o},o.apply(null,arguments)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}function s(e){var t=l();return function(){var n,r=c(e);if(t){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==u(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===u(o)?o:String(o)),r)}var o}function h(e,t,n){return t&&d(e.prototype,t),n&&d(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var p=n(9443),m=Math.pow(2,16);function v(e){return 65535&e}var g=function(){function e(t,n,r){f(this,e),this.pos=t,this.delInfo=n,this.recover=r}return h(e,[{key:"deleted",get:function(){return(8&this.delInfo)>0}},{key:"deletedBefore",get:function(){return(5&this.delInfo)>0}},{key:"deletedAfter",get:function(){return(6&this.delInfo)>0}},{key:"deletedAcross",get:function(){return(4&this.delInfo)>0}}]),e}(),y=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(f(this,e),this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}return h(e,[{key:"recover",value:function(e){var t=0,n=v(e);if(!this.inverted)for(var r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/m}(e)}},{key:"mapResult",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!1)}},{key:"map",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!0)}},{key:"_map",value:function(e,t,n){for(var r=0,o=this.inverted?2:1,i=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?r:0);if(s>e)break;var l=this.ranges[a+o],c=this.ranges[a+i],u=s+l;if(e<=u){var f=s+r+((l?e==s?-1:e==u?1:t:t)<0?0:c);if(n)return f;var d=e==s?2:e==u?1:4;return(t<0?e!=s:e!=u)&&(d|=8),new g(f,d,e==(t<0?s:u)?null:a/3+(e-s)*m)}r+=c-l}return n?e+r:new g(e+r,0,null)}},{key:"touches",value:function(e,t){for(var n=0,r=v(t),o=this.inverted?2:1,i=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?n:0);if(s>e)break;var l=this.ranges[a+o];if(e<=s+l&&a==3*r)return!0;n+=this.ranges[a+i]-l}return!1}},{key:"forEach",value:function(e){for(var t=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r<this.ranges.length;r+=3){var i=this.ranges[r],a=i-(this.inverted?o:0),s=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(a,a+l,s,s+c),o+=c-l}}},{key:"invert",value:function(){return new e(this.ranges,!this.inverted)}},{key:"toString",value:function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}}],[{key:"offset",value:function(t){return 0==t?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}}]),e}();y.empty=new y([]);var b=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length;f(this,e),this.maps=t,this.mirror=n,this.from=r,this.to=o}return h(e,[{key:"slice",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.maps.length;return new e(this.maps,this.mirror,t,n)}},{key:"copy",value:function(){return new e(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}},{key:"appendMap",value:function(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)}},{key:"appendMapping",value:function(e){for(var t=0,n=this.maps.length;t<e.maps.length;t++){var r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r:void 0)}}},{key:"getMirror",value:function(e){if(this.mirror)for(var t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}},{key:"setMirror",value:function(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}},{key:"appendMappingInverted",value:function(e){for(var t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){var r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}},{key:"invert",value:function(){var t=new e;return t.appendMappingInverted(this),t}},{key:"map",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this.mirror)return this._map(e,t,!0);for(var n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}},{key:"mapResult",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!1)}},{key:"_map",value:function(e,t,n){for(var r=0,o=this.from;o<this.to;o++){var i=this.maps[o].mapResult(e,t);if(null!=i.recover){var a=this.getMirror(o);if(null!=a&&a>o&&a<this.to){o=a,e=this.maps[a].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new g(e,r,null)}}]),e}(),w=Object.create(null),k=function(){function e(){f(this,e)}return h(e,[{key:"getMap",value:function(){return y.empty}},{key:"merge",value:function(e){return null}}],[{key:"fromJSON",value:function(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=w[t.stepType];if(!n)throw new RangeError("No step type ".concat(t.stepType," defined"));return n.fromJSON(e,t)}},{key:"jsonID",value:function(e,t){if(e in w)throw new RangeError("Duplicate use of step JSON ID "+e);return w[e]=t,t.prototype.jsonID=e,t}}]),e}(),S=function(){function e(t,n){f(this,e),this.doc=t,this.failed=n}return h(e,null,[{key:"ok",value:function(t){return new e(t,null)}},{key:"fail",value:function(t){return new e(null,t)}},{key:"fromReplace",value:function(t,n,r,o){try{return e.ok(t.replace(n,r,o))}catch(t){if(t instanceof p.ReplaceError)return e.fail(t.message);throw t}}}]),e}();function x(e,t,n){for(var r=[],o=0;o<e.childCount;o++){var i=e.child(o);i.content.size&&(i=i.copy(x(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return p.Fragment.fromArray(r)}var C=function(e){i(n,e);var t=s(n);function n(e,r,o){var i;return f(this,n),(i=t.call(this)).from=e,i.to=r,i.mark=o,i}return h(n,[{key:"apply",value:function(e){var t=this,n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new p.Slice(x(n.content,(function(e,n){return e.isAtom&&n.type.allowsMarkType(t.mark.type)?e.mark(t.mark.addToSet(e.marks)):e}),o),n.openStart,n.openEnd);return S.fromReplace(e,this.from,this.to,i)}},{key:"invert",value:function(){return new O(this.from,this.to,this.mark)}},{key:"map",value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}},{key:"merge",value:function(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}},{key:"toJSON",value:function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}}]),n}(k);k.jsonID("addMark",C);var O=function(e){i(n,e);var t=s(n);function n(e,r,o){var i;return f(this,n),(i=t.call(this)).from=e,i.to=r,i.mark=o,i}return h(n,[{key:"apply",value:function(e){var t=this,n=e.slice(this.from,this.to),r=new p.Slice(x(n.content,(function(e){return e.mark(t.mark.removeFromSet(e.marks))}),e),n.openStart,n.openEnd);return S.fromReplace(e,this.from,this.to,r)}},{key:"invert",value:function(){return new C(this.from,this.to,this.mark)}},{key:"map",value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}},{key:"merge",value:function(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}},{key:"toJSON",value:function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}}]),n}(k);k.jsonID("removeMark",O);var M=function(e){i(n,e);var t=s(n);function n(e,r){var o;return f(this,n),(o=t.call(this)).pos=e,o.mark=r,o}return h(n,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return S.fail("No node at mark step's position");var n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return S.fromReplace(e,this.pos,this.pos+1,new p.Slice(p.Fragment.from(n),0,t.isLeaf?0:1))}},{key:"invert",value:function(e){var t=e.nodeAt(this.pos);if(t){var r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(var o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new n(this.pos,t.marks[o]);return new n(this.pos,this.mark)}}return new T(this.pos,this.mark)}},{key:"map",value:function(e){var t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.mark)}},{key:"toJSON",value:function(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new n(t.pos,e.markFromJSON(t.mark))}}]),n}(k);k.jsonID("addNodeMark",M);var T=function(e){i(n,e);var t=s(n);function n(e,r){var o;return f(this,n),(o=t.call(this)).pos=e,o.mark=r,o}return h(n,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return S.fail("No node at mark step's position");var n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return S.fromReplace(e,this.pos,this.pos+1,new p.Slice(p.Fragment.from(n),0,t.isLeaf?0:1))}},{key:"invert",value:function(e){var t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new M(this.pos,this.mark):this}},{key:"map",value:function(e){var t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.mark)}},{key:"toJSON",value:function(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new n(t.pos,e.markFromJSON(t.mark))}}]),n}(k);k.jsonID("removeNodeMark",T);var A=function(e){i(n,e);var t=s(n);function n(e,r,o){var i,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return f(this,n),(i=t.call(this)).from=e,i.to=r,i.slice=o,i.structure=a,i}return h(n,[{key:"apply",value:function(e){return this.structure&&R(e,this.from,this.to)?S.fail("Structure replace would overwrite content"):S.fromReplace(e,this.from,this.to,this.slice)}},{key:"getMap",value:function(){return new y([this.from,this.to-this.from,this.slice.size])}},{key:"invert",value:function(e){return new n(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}},{key:"map",value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new n(t.pos,Math.max(t.pos,r.pos),this.slice)}},{key:"merge",value:function(e){if(!(e instanceof n)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;var t=this.slice.size+e.slice.size==0?p.Slice.empty:new p.Slice(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new n(e.from,this.to,t,this.structure)}var r=this.slice.size+e.slice.size==0?p.Slice.empty:new p.Slice(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new n(this.from,this.to+(e.to-e.from),r,this.structure)}},{key:"toJSON",value:function(){var e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new n(t.from,t.to,p.Slice.fromJSON(e,t.slice),!!t.structure)}}]),n}(k);k.jsonID("replace",A);var N=function(e){i(n,e);var t=s(n);function n(e,r,o,i,a,s){var l,c=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return f(this,n),(l=t.call(this)).from=e,l.to=r,l.gapFrom=o,l.gapTo=i,l.slice=a,l.insert=s,l.structure=c,l}return h(n,[{key:"apply",value:function(e){if(this.structure&&(R(e,this.from,this.gapFrom)||R(e,this.gapTo,this.to)))return S.fail("Structure gap-replace would overwrite content");var t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return S.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,t.content);return n?S.fromReplace(e,this.from,this.to,n):S.fail("Content does not fit in gap")}},{key:"getMap",value:function(){return new y([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}},{key:"invert",value:function(e){var t=this.gapTo-this.gapFrom;return new n(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}},{key:"map",value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||i>r.pos?null:new n(t.pos,r.pos,o,i,this.slice,this.insert,this.structure)}},{key:"toJSON",value:function(){var e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new n(t.from,t.to,t.gapFrom,t.gapTo,p.Slice.fromJSON(e,t.slice),t.insert,!!t.structure)}}]),n}(k);function R(e,t,n){for(var r=e.resolve(t),o=n-t,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var a=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,o--}return!1}function D(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.contentMatch,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=e.doc.nodeAt(t),a=[],s=t+1,l=0;l<i.childCount;l++){var c=i.child(l),u=s+c.nodeSize,f=r.matchType(c.type);if(f){r=f;for(var d=0;d<c.marks.length;d++)n.allowsMarkType(c.marks[d].type)||e.step(new O(s,u,c.marks[d]));if(o&&c.isText&&"pre"!=n.whitespace)for(var h=void 0,m=/\r?\n|\r/g,v=void 0;h=m.exec(c.text);)v||(v=new p.Slice(p.Fragment.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),a.push(new A(s+h.index,s+h.index+h[0].length,v))}else a.push(new A(s,u,p.Slice.empty));s=u}if(!r.validEnd){var g=r.fillBefore(p.Fragment.empty,!0);e.replace(s,s,new p.Slice(g,0,0))}for(var y=a.length-1;y>=0;y--)e.step(a[y])}function _(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function E(e){return{type:e,attrs:null}}function P(e,t,n,r){t.forEach((function(o,i){if(o.isText)for(var a,s=/\r?\n|\r/g;a=s.exec(o.text);){var l=e.mapping.slice(r).map(n+1+i+a.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}))}function z(e,t,n,r){t.forEach((function(o,i){if(o.type==o.type.schema.linebreakReplacement){var a=e.mapping.slice(r).map(n+1+i);e.replaceWith(a,a+1,t.type.schema.text("\n"))}}))}function I(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);for(var n=e.contentMatchAt(e.childCount),r=e.type.schema.linebreakReplacement,o=0;o<t.childCount;o++){var i=t.child(o),a=i.type==r?e.type.schema.nodes.text:i.type;if(!(n=n.matchType(a)))return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}(e,t))}function j(e,t,n){var r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var a=r.depth-1;a>=0;a--){var s=r.indexAfter(a);if(r.node(a).canReplaceWith(s,s,n))return r.after(a+1);if(s<r.node(a).childCount)return null}return null}function F(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:p.Slice.empty;if(t==n&&!r.size)return null;var o=e.resolve(t),i=e.resolve(n);return B(o,i,r)?new A(t,n,r):new $(o,i,r).fit()}function B(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}k.jsonID("replaceAround",N);var $=function(){function e(t,n,r){f(this,e),this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=p.Fragment.empty;for(var o=0;o<=t.depth;o++){var i=t.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(t.indexAfter(o))})}for(var a=t.depth;a>0;a--)this.placed=p.Fragment.from(t.node(a).copy(this.placed))}return h(e,[{key:"depth",get:function(){return this.frontier.length-1}},{key:"fit",value:function(){for(;this.unplaced.size;){var e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}var t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(t<0?this.$to:r.doc.resolve(t));if(!o)return null;for(var i=this.placed,a=r.depth,s=o.depth;a&&s&&1==i.childCount;)i=i.firstChild.content,a--,s--;var l=new p.Slice(i,a,s);return t>-1?new N(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new A(r.pos,o.pos,l):null}},{key:"findFittable",value:function(){for(var e=this.unplaced.openStart,t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){var o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(var i=1;i<=2;i++)for(var a=1==i?e:this.unplaced.openStart;a>=0;a--)for(var s=null,l=(a?(s=K(this.unplaced.content,a-1).firstChild).content:this.unplaced.content).firstChild,c=this.depth;c>=0;c--){var u=this.frontier[c],f=u.type,d=u.match,h=void 0,m=null;if(1==i&&(l?d.matchType(l.type)||(m=d.fillBefore(p.Fragment.from(l),!1)):s&&f.compatibleContent(s.type)))return{sliceDepth:a,frontierDepth:c,parent:s,inject:m};if(2==i&&l&&(h=d.findWrapping(l.type)))return{sliceDepth:a,frontierDepth:c,parent:s,wrap:h};if(s&&d.matchType(s.type))break}}},{key:"openMore",value:function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,o=K(t,n);return!(!o.childCount||o.firstChild.isLeaf||(this.unplaced=new p.Slice(t,n+1,Math.max(r,o.size+n>=t.size-r?n+1:0)),0))}},{key:"dropNode",value:function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,o=K(t,n);if(o.childCount<=1&&n>0){var i=t.size-n<=n+o.size;this.unplaced=new p.Slice(L(t,n-1,1),n-1,i?n-1:r)}else this.unplaced=new p.Slice(L(t,n,1),n,r)}},{key:"placeNodes",value:function(e){for(var t=e.sliceDepth,n=e.frontierDepth,r=e.parent,o=e.inject,i=e.wrap;this.depth>n;)this.closeFrontierNode();if(i)for(var a=0;a<i.length;a++)this.openFrontierNode(i[a]);var s=this.unplaced,l=r?r.content:s.content,c=s.openStart-t,u=0,f=[],d=this.frontier[n],h=d.match,m=d.type;if(o){for(var v=0;v<o.childCount;v++)f.push(o.child(v));h=h.matchFragment(o)}for(var g=l.size+t-(s.content.size-s.openEnd);u<l.childCount;){var y=l.child(u),b=h.matchType(y.type);if(!b)break;(++u>1||0==c||y.content.size)&&(h=b,f.push(H(y.mark(m.allowedMarks(y.marks)),1==u?c:0,u==l.childCount?g:-1)))}var w=u==l.childCount;w||(g=-1),this.placed=V(this.placed,n,p.Fragment.from(f)),this.frontier[n].match=h,w&&g<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var k=0,S=l;k<g;k++){var x=S.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),S=x.content}this.unplaced=w?0==t?p.Slice.empty:new p.Slice(L(s.content,t-1,1),t-1,g<0?s.openEnd:t-1):new p.Slice(L(s.content,t,u),s.openStart,s.openEnd)}},{key:"mustMoveInline",value:function(){if(!this.$to.parent.isTextblock)return-1;var e,t=this.frontier[this.depth];if(!t.type.isTextblock||!W(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r}},{key:"findCloseLevel",value:function(e){e:for(var t=Math.min(this.depth,e.depth);t>=0;t--){var n=this.frontier[t],r=n.match,o=n.type,i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=W(e,t,o,r,i);if(a){for(var s=t-1;s>=0;s--){var l=this.frontier[s],c=l.match,u=W(e,s,l.type,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}},{key:"close",value:function(e){var t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=V(this.placed,t.depth,t.fit)),e=t.move;for(var n=t.depth+1;n<=e.depth;n++){var r=e.node(n),o=r.type.contentMatch.fillBefore(r.content,!0,e.index(n));this.openFrontierNode(r.type,r.attrs,o)}return e}},{key:"openFrontierNode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=V(this.placed,this.depth,p.Fragment.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}},{key:"closeFrontierNode",value:function(){var e=this.frontier.pop().match.fillBefore(p.Fragment.empty,!0);e.childCount&&(this.placed=V(this.placed,this.frontier.length,e))}}]),e}();function L(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(L(e.firstChild.content,t-1,n)))}function V(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(V(e.lastChild.content,t-1,n)))}function K(e,t){for(var n=0;n<t;n++)e=e.firstChild.content;return e}function H(e,t,n){if(t<=0)return e;var r=e.content;return t>1&&(r=r.replaceChild(0,H(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(p.Fragment.empty,!0)))),e.copy(r)}function W(e,t,n,r,o){var i=e.node(t),a=o?e.indexAfter(t):e.index(t);if(a==i.childCount&&!n.compatibleContent(i.type))return null;var s=r.fillBefore(i.content,!0,a);return s&&!function(e,t,n){for(var r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,a)?s:null}function q(e,t,n,r,o){if(t<n){var i=e.firstChild;e=e.replaceChild(0,i.copy(q(i.content,t+1,n,r,i)))}if(t>r){var a=o.contentMatchAt(0),s=a.fillBefore(e).append(e);e=s.append(a.matchFragment(s).fillBefore(p.Fragment.empty,!0))}return e}function J(e,t){for(var n=[],r=Math.min(e.depth,t.depth);r>=0;r--){var o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}var U=function(e){i(n,e);var t=s(n);function n(e,r,o){var i;return f(this,n),(i=t.call(this)).pos=e,i.attr=r,i.value=o,i}return h(n,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return S.fail("No node at attribute step's position");var n=Object.create(null);for(var r in t.attrs)n[r]=t.attrs[r];n[this.attr]=this.value;var o=t.type.create(n,null,t.marks);return S.fromReplace(e,this.pos,this.pos+1,new p.Slice(p.Fragment.from(o),0,t.isLeaf?0:1))}},{key:"getMap",value:function(){return y.empty}},{key:"invert",value:function(e){return new n(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}},{key:"map",value:function(e){var t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.attr,this.value)}},{key:"toJSON",value:function(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new n(t.pos,t.attr,t.value)}}]),n}(k);k.jsonID("attr",U);var G=function(e){i(n,e);var t=s(n);function n(e,r){var o;return f(this,n),(o=t.call(this)).attr=e,o.value=r,o}return h(n,[{key:"apply",value:function(e){var t=Object.create(null);for(var n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;var r=e.type.create(t,e.content,e.marks);return S.ok(r)}},{key:"getMap",value:function(){return y.empty}},{key:"invert",value:function(e){return new n(this.attr,e.attrs[this.attr])}},{key:"map",value:function(e){return this}},{key:"toJSON",value:function(){return{stepType:"docAttr",attr:this.attr,value:this.value}}}],[{key:"fromJSON",value:function(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new n(t.attr,t.value)}}]),n}(k);k.jsonID("docAttr",G),t.TransformError=function(e){i(n,e);var t=s(n);function n(){return f(this,n),t.apply(this,arguments)}return h(n)}(r(Error)),t.TransformError=function e(t){var n=Error.call(this,t);return n.__proto__=e.prototype,n},t.TransformError.prototype=Object.create(Error.prototype),t.TransformError.prototype.constructor=t.TransformError,t.TransformError.prototype.name="TransformError";var X=function(){function e(t){f(this,e),this.doc=t,this.steps=[],this.docs=[],this.mapping=new b}return h(e,[{key:"before",get:function(){return this.docs.length?this.docs[0]:this.doc}},{key:"step",value:function(e){var n=this.maybeStep(e);if(n.failed)throw new t.TransformError(n.failed);return this}},{key:"maybeStep",value:function(e){var t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}},{key:"docChanged",get:function(){return this.steps.length>0}},{key:"addStep",value:function(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}},{key:"replace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:p.Slice.empty,r=F(this.doc,e,t,n);return r&&this.step(r),this}},{key:"replaceWith",value:function(e,t,n){return this.replace(e,t,new p.Slice(p.Fragment.from(n),0,0))}},{key:"delete",value:function(e,t){return this.replace(e,t,p.Slice.empty)}},{key:"insert",value:function(e,t){return this.replaceWith(e,e,t)}},{key:"replaceRange",value:function(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);var o=e.doc.resolve(t),i=e.doc.resolve(n);if(B(o,i,r))return e.step(new A(t,n,r));var a=J(o,e.doc.resolve(n));0==a[a.length-1]&&a.pop();var s=-(o.depth+1);a.unshift(s);for(var l=o.depth,c=o.pos-1;l>0;l--,c--){var u=o.node(l).type.spec;if(u.defining||u.definingAsContext||u.isolating)break;a.indexOf(l)>-1?s=l:o.before(l)==c&&a.splice(1,0,-l)}for(var f,d=a.indexOf(s),h=[],m=r.openStart,v=r.content,g=0;;g++){var y=v.firstChild;if(h.push(y),g==r.openStart)break;v=y.content}for(var b=m-1;b>=0;b--){var w=h[b],k=(f=w.type).spec.defining||f.spec.definingForContent;if(k&&!w.sameMarkup(o.node(Math.abs(s)-1)))m=b;else if(k||!w.type.isTextblock)break}for(var S=r.openStart;S>=0;S--){var x=(S+m+1)%(r.openStart+1),C=h[x];if(C)for(var O=0;O<a.length;O++){var M=a[(O+d)%a.length],T=!0;M<0&&(T=!1,M=-M);var N=o.node(M-1),R=o.index(M-1);if(N.canReplaceWith(R,R,C.type,C.marks))return e.replace(o.before(M),T?i.after(M):n,new p.Slice(q(r.content,0,r.openStart,x),x,r.openEnd))}}for(var D=e.steps.length,_=a.length-1;_>=0&&(e.replace(t,n,r),!(e.steps.length>D));_--){var E=a[_];E<0||(t=o.before(E),n=i.after(E))}}(this,e,t,n),this}},{key:"replaceRangeWith",value:function(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){var o=j(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new p.Slice(p.Fragment.from(r),0,0))}(this,e,t,n),this}},{key:"deleteRange",value:function(e,t){return function(e,t,n){for(var r=e.doc.resolve(t),o=e.doc.resolve(n),i=J(r,o),a=0;a<i.length;a++){var s=i[a],l=a==i.length-1;if(l&&0==s||r.node(s).type.contentMatch.validEnd)return e.delete(r.start(s),o.end(s));if(s>0&&(l||r.node(s-1).canReplace(r.index(s-1),o.indexAfter(s-1))))return e.delete(r.before(s),o.after(s))}for(var c=1;c<=r.depth&&c<=o.depth;c++)if(t-r.start(c)==r.depth-c&&n>r.end(c)&&o.end(c)-n!=o.depth-c&&r.start(c-1)==o.start(c-1)&&r.node(c-1).canReplace(r.index(c-1),o.index(c-1)))return e.delete(r.before(c),n);e.delete(t,n)}(this,e,t),this}},{key:"lift",value:function(e,t){return function(e,t,n){for(var r=t.$from,o=t.$to,i=t.depth,a=r.before(i+1),s=o.after(i+1),l=a,c=s,u=p.Fragment.empty,f=0,d=i,h=!1;d>n;d--)h||r.index(d)>0?(h=!0,u=p.Fragment.from(r.node(d).copy(u)),f++):l--;for(var m=p.Fragment.empty,v=0,g=i,y=!1;g>n;g--)y||o.after(g+1)<o.end(g)?(y=!0,m=p.Fragment.from(o.node(g).copy(m)),v++):c++;e.step(new N(l,c,a,s,new p.Slice(u.append(m),f,v),u.size-f,!0))}(this,e,t),this}},{key:"join",value:function(e){return function(e,t,n){var r=null,o=e.doc.type.schema.linebreakReplacement,i=e.doc.resolve(t-n),a=i.node().type;if(o&&a.inlineContent){var s="pre"==a.whitespace,l=!!a.contentMatch.matchType(o);s&&!l?r=!1:!s&&l&&(r=!0)}var c=e.steps.length;if(!1===r){var u=e.doc.resolve(t+n);z(e,u.node(),u.before(),c)}a.inlineContent&&D(e,t+n-1,a,i.node().contentMatchAt(i.index()),null==r);var f=e.mapping.slice(c),d=f.map(t-n);if(e.step(new A(d,f.map(t+n,-1),p.Slice.empty,!0)),!0===r){var h=e.doc.resolve(d);P(e,h.node(),h.before(),e.steps.length)}}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),this}},{key:"wrap",value:function(e,t){return function(e,t,n){for(var r=p.Fragment.empty,o=n.length-1;o>=0;o--){if(r.size){var i=n[o].type.contentMatch.matchFragment(r);if(!i||!i.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=p.Fragment.from(n[o].type.create(n[o].attrs,r))}var a=t.start,s=t.end;e.step(new N(a,s,a,s,new p.Slice(r,0,0),n.length,!0))}(this,e,t),this}},{key:"setBlockType",value:function(e){return function(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=e.steps.length;e.doc.nodesBetween(t,n,(function(t,n){var a="function"==typeof o?o(t):o;if(t.isTextblock&&!t.hasMarkup(r,a)&&function(e,t,n){var r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(i).map(n),r)){var s=null;if(r.schema.linebreakReplacement){var l="pre"==r.whitespace,c=!!r.contentMatch.matchType(r.schema.linebreakReplacement);l&&!c?s=!1:!l&&c&&(s=!0)}!1===s&&z(e,t,n,i),D(e,e.mapping.slice(i).map(n,1),r,void 0,null===s);var u=e.mapping.slice(i),f=u.map(n,1),d=u.map(n+t.nodeSize,1);return e.step(new N(f,d,f+1,d-1,new p.Slice(p.Fragment.from(r.create(a,null,t.marks)),0,0),1,!0)),!0===s&&P(e,t,n,i),!1}}))}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,arguments.length>2?arguments[2]:void 0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:null),this}},{key:"setNodeMarkup",value:function(e,t){return function(e,t,n,r,o){var i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);var a=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,a);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new N(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new p.Slice(p.Fragment.from(a),0,0),1,!0))}(this,e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,arguments.length>3?arguments[3]:void 0),this}},{key:"setNodeAttribute",value:function(e,t,n){return this.step(new U(e,t,n)),this}},{key:"setDocAttribute",value:function(e,t){return this.step(new G(e,t)),this}},{key:"addNodeMark",value:function(e,t){return this.step(new M(e,t)),this}},{key:"removeNodeMark",value:function(e,t){if(!(t instanceof p.Mark)){var n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(!(t=t.isInSet(n.marks)))return this}return this.step(new T(e,t)),this}},{key:"split",value:function(e){return function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,o=e.doc.resolve(t),i=p.Fragment.empty,a=p.Fragment.empty,s=o.depth,l=o.depth-n,c=n-1;s>l;s--,c--){i=p.Fragment.from(o.node(s).copy(i));var u=r&&r[c];a=p.Fragment.from(u?u.type.create(u.attrs,a):o.node(s).copy(a))}e.step(new A(t,t,new p.Slice(i.append(a),n,n),!0))}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,arguments.length>2?arguments[2]:void 0),this}},{key:"addMark",value:function(e,t,n){return function(e,t,n,r){var o,i,a=[],s=[];e.doc.nodesBetween(t,n,(function(e,l,c){if(e.isInline){var u=e.marks;if(!r.isInSet(u)&&c.type.allowsMarkType(r.type)){for(var f=Math.max(l,t),d=Math.min(l+e.nodeSize,n),h=r.addToSet(u),p=0;p<u.length;p++)u[p].isInSet(h)||(o&&o.to==f&&o.mark.eq(u[p])?o.to=d:a.push(o=new O(f,d,u[p])));i&&i.to==f?i.to=d:s.push(i=new C(f,d,r))}}})),a.forEach((function(t){return e.step(t)})),s.forEach((function(t){return e.step(t)}))}(this,e,t,n),this}},{key:"removeMark",value:function(e,t,n){return function(e,t,n,r){var o=[],i=0;e.doc.nodesBetween(t,n,(function(e,a){if(e.isInline){i++;var s=null;if(r instanceof p.MarkType)for(var l,c=e.marks;l=r.isInSet(c);)(s||(s=[])).push(l),c=l.removeFromSet(c);else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length)for(var u=Math.min(a+e.nodeSize,n),f=0;f<s.length;f++){for(var d=s[f],h=void 0,m=0;m<o.length;m++){var v=o[m];v.step==i-1&&d.eq(o[m].style)&&(h=v)}h?(h.to=u,h.step=i):o.push({style:d,from:Math.max(a,t),to:u,step:i})}}})),o.forEach((function(t){return e.step(new O(t.from,t.to,t.style))}))}(this,e,t,n),this}},{key:"clearIncompatible",value:function(e,t,n){return D(this,e,t,n),this}}]),e}();t.AddMarkStep=C,t.AddNodeMarkStep=M,t.AttrStep=U,t.DocAttrStep=G,t.MapResult=g,t.Mapping=b,t.RemoveMarkStep=O,t.RemoveNodeMarkStep=T,t.ReplaceAroundStep=N,t.ReplaceStep=A,t.Step=k,t.StepMap=y,t.StepResult=S,t.Transform=X,t.canJoin=function(e,t){var n=e.resolve(t),r=n.index();return I(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)},t.canSplit=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,o=e.resolve(t),i=o.depth-n,a=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!a.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var s=o.depth-1,l=n-2;s>i;s--,l--){var c=o.node(s),u=o.index(s);if(c.type.spec.isolating)return!1;var f=c.content.cutByIndex(u,c.childCount),d=r&&r[l+1];d&&(f=f.replaceChild(0,d.type.create(d.attrs)));var h=r&&r[l]||c;if(!c.canReplace(u+1,c.childCount)||!h.type.validContent(f))return!1}var p=o.indexAfter(i),m=r&&r[0];return o.node(i).canReplaceWith(p,p,m?m.type:o.node(i+1).type)},t.dropPoint=function(e,t,n){var r=e.resolve(t);if(!n.content.size)return t;for(var o=n.content,i=0;i<n.openStart;i++)o=o.firstChild.content;for(var a=1;a<=(0==n.openStart&&n.size?2:1);a++)for(var s=r.depth;s>=0;s--){var l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,c=r.index(s)+(l>0?1:0),u=r.node(s),f=!1;if(1==a)f=u.canReplace(c,c,o);else{var d=u.contentMatchAt(c).findWrapping(o.firstChild.type);f=d&&u.canReplaceWith(c,c,d[0])}if(f)return 0==l?r.pos:l<0?r.before(s+1):r.after(s+1)}return null},t.findWrapping=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,o=function(e,t){var n=e.parent,r=e.startIndex,o=e.endIndex,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;var a=i.length?i[0]:t;return n.canReplaceWith(r,o,a)?i:null}(e,t),i=o&&function(e,t){var n=e.parent,r=e.startIndex,o=e.endIndex,i=n.child(r),a=t.contentMatch.findWrapping(i.type);if(!a)return null;for(var s=(a.length?a[a.length-1]:t).contentMatch,l=r;s&&l<o;l++)s=s.matchType(n.child(l).type);return s&&s.validEnd?a:null}(r,t);return i?o.map(E).concat({type:t,attrs:n}).concat(i.map(E)):null},t.insertPoint=j,t.joinPoint=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=e.resolve(t),o=r.depth;;o--){var i=void 0,a=void 0,s=r.index(o);if(o==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(o+1),s++,a=r.node(o).maybeChild(s)):(i=r.node(o).maybeChild(s-1),a=r.node(o+1)),i&&!i.isTextblock&&I(i,a)&&r.node(o).canReplace(s,s+1))return t;if(0==o)break;t=n<0?r.before(o):r.after(o)}},t.liftTarget=function(e){for(var t=e.parent.content.cutByIndex(e.startIndex,e.endIndex),n=e.depth;;--n){var r=e.$from.node(n),o=e.$from.index(n),i=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(o,i,t))return n;if(0==n||r.type.spec.isolating||!_(r,o,i))break}return null},t.replaceStep=F},9222:(e,t,n)=>{function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=i(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw a}}}}function i(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(){return s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},s.apply(this,arguments)}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function u(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=d(e);if(t){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===h(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}(this,n)}}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==h(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===h(o)?o:String(o)),r)}var o}function v(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var g=n(2391),y=n(9443),b=n(2843),w=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},k=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},S=null,x=function(e,t,n){var r=S||(S=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},C=function(e,t,n,r){return n&&(M(e,t,n,r,-1)||M(e,t,n,r,1))},O=/^(img|br|input|textarea|hr)$/i;function M(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:T(e))){var i=e.parentNode;if(!i||1!=i.nodeType||A(e)||O.test(e.nodeName)||"false"==e.contentEditable)return!1;t=w(e)+(o<0?0:1),e=i}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(o<0?-1:0)]).contentEditable)return!1;t=o<0?T(e):0}}}function T(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function A(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var N=function(e){return e.focusNode&&C(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function R(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}var D="undefined"!=typeof navigator?navigator:null,_="undefined"!=typeof document?document:null,E=D&&D.userAgent||"",P=/Edge\/(\d+)/.exec(E),z=/MSIE \d/.exec(E),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(E),j=!!(z||I||P),F=z?document.documentMode:I?+I[1]:P?+P[1]:0,B=!j&&/gecko\/(\d+)/i.test(E);B&&(/Firefox\/(\d+)/.exec(E)||[0,0])[1];var $=!j&&/Chrome\/(\d+)/.exec(E),L=!!$,V=$?+$[1]:0,K=!j&&!!D&&/Apple Computer/.test(D.vendor),H=K&&(/Mobile\/\w+/.test(E)||!!D&&D.maxTouchPoints>2),W=H||!!D&&/Mac/.test(D.platform),q=!!D&&/Win/.test(D.platform),J=/Android \d/.test(E),U=!!_&&"webkitFontSmoothing"in _.documentElement.style,G=U?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function X(e){var t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Y(e,t){return"number"==typeof e?e:e[t]}function Q(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Z(e,t,n){for(var r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument,a=n||e.dom;a;a=k(a))if(1==a.nodeType){var s=a,l=s==i.body,c=l?X(i):Q(s),u=0,f=0;if(t.top<c.top+Y(r,"top")?f=-(c.top-t.top+Y(o,"top")):t.bottom>c.bottom-Y(r,"bottom")&&(f=t.bottom-t.top>c.bottom-c.top?t.top+Y(o,"top")-c.top:t.bottom-c.bottom+Y(o,"bottom")),t.left<c.left+Y(r,"left")?u=-(c.left-t.left+Y(o,"left")):t.right>c.right-Y(r,"right")&&(u=t.right-c.right+Y(o,"right")),u||f)if(l)i.defaultView.scrollBy(u,f);else{var d=s.scrollLeft,h=s.scrollTop;f&&(s.scrollTop+=f),u&&(s.scrollLeft+=u);var p=s.scrollLeft-d,m=s.scrollTop-h;t={left:t.left-p,top:t.top-m,right:t.right-p,bottom:t.bottom-m}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(a).position))break}}function ee(e){for(var t=[],n=e.ownerDocument,r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=k(r));return t}function te(e,t){for(var n=0;n<e.length;n++){var r=e[n],o=r.dom,i=r.top,a=r.left;o.scrollTop!=i+t&&(o.scrollTop=i+t),o.scrollLeft!=a&&(o.scrollLeft=a)}}var ne=null;function re(e,t){for(var n,r,o,i,a=2e8,s=0,l=t.top,c=t.top,u=e.firstChild,f=0;u;u=u.nextSibling,f++){var d=void 0;if(1==u.nodeType)d=u.getClientRects();else{if(3!=u.nodeType)continue;d=x(u).getClientRects()}for(var h=0;h<d.length;h++){var p=d[h];if(p.top<=l&&p.bottom>=c){l=Math.max(p.bottom,l),c=Math.min(p.top,c);var m=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(m<a){n=u,a=m,r=m&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==u.nodeType&&m&&(s=f+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!o&&p.left<=t.left&&p.right>=t.left&&(o=u,i={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(s=f+1)}}return!n&&o&&(n=o,r=i,a=0),n&&3==n.nodeType?function(e,t){for(var n=e.nodeValue.length,r=document.createRange(),o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);var i=le(r,1);if(i.top!=i.bottom&&oe(t,i))return{node:e,offset:o+(t.left>=(i.left+i.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||a&&1==n.nodeType?{node:e,offset:s}:re(n,r)}function oe(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function ie(e,t,n){var r=e.childNodes.length;if(r&&n.top<n.bottom)for(var o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){var a=e.childNodes[i];if(1==a.nodeType)for(var s=a.getClientRects(),l=0;l<s.length;l++){var c=s[l];if(oe(t,c))return ie(a,t,c)}if((i=(i+1)%r)==o)break}return e}function ae(e,t){var n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{var r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(T(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){var o=e.caretRangeFromPoint(t,n);if(o)return{node:o.startContainer,offset:Math.min(T(o.startContainer),o.startOffset)}}}(r,t.left,t.top);i&&(n=i.node,o=i.offset);var a,s=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!s||!e.dom.contains(1!=s.nodeType?s.parentNode:s)){var l=e.dom.getBoundingClientRect();if(!oe(t,l))return null;if(!(s=ie(e.dom,t,l)))return null}if(K)for(var c=s;n&&c;c=k(c))c.draggable&&(n=void 0);if(s=function(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(s,t),n){if(B&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length))<n.childNodes.length){var u,f=n.childNodes[o];"IMG"==f.nodeName&&(u=f.getBoundingClientRect()).right<=t.left&&u.bottom>t.top&&o++}var d;U&&o&&1==n.nodeType&&1==(d=n.childNodes[o-1]).nodeType&&"false"==d.contentEditable&&d.getBoundingClientRect().top>=t.top&&o--,n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?a=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(a=function(e,t,n,r){for(var o=-1,i=t,a=!1;i!=e.dom;){var s=e.docView.nearestDesc(i,!0);if(!s)return null;if(1==s.dom.nodeType&&(s.node.isBlock&&s.parent||!s.contentDOM)){var l=s.dom.getBoundingClientRect();if(s.node.isBlock&&s.parent&&(!a&&l.left>r.left||l.top>r.top?o=s.posBefore:(!a&&l.right<r.left||l.bottom<r.top)&&(o=s.posAfter),a=!0),!s.contentDOM&&o<0&&!s.node.isText)return(s.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?s.posBefore:s.posAfter}i=s.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==a&&(a=function(e,t,n){var r=re(t,n),o=r.node,i=r.offset,a=-1;if(1==o.nodeType&&!o.firstChild){var s=o.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(o,i,a)}(e,s,t));var h=e.docView.nearestDesc(s,!0);return{pos:a,inside:h?h.posAtStart-h.border:-1}}function se(e){return e.top<e.bottom||e.left<e.right}function le(e,t){var n=e.getClientRects();if(n.length){var r=n[t<0?0:n.length-1];if(se(r))return r}return Array.prototype.find.call(n,se)||e.getBoundingClientRect()}var ce=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ue(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),o=r.node,i=r.offset,a=r.atom,s=U||B;if(3==o.nodeType){if(!s||!ce.test(o.nodeValue)&&(n<0?i:i!=o.nodeValue.length)){var l=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==o.nodeValue.length?(l--,u=1):n<0?l--:c++,fe(le(x(o,l,c),u),u<0)}var f=le(x(o,i,i),n);if(B&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){var d=le(x(o,i-1,i-1),-1);if(d.top==f.top){var h=le(x(o,i,i+1),-1);if(h.top!=f.top)return fe(h,h.left<d.left)}}return f}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(null==a&&i&&(n<0||i==T(o))){var p=o.childNodes[i-1];if(1==p.nodeType)return de(p.getBoundingClientRect(),!1)}if(null==a&&i<T(o)){var m=o.childNodes[i];if(1==m.nodeType)return de(m.getBoundingClientRect(),!0)}return de(o.getBoundingClientRect(),n>=0)}if(null==a&&i&&(n<0||i==T(o))){var v=o.childNodes[i-1],g=3==v.nodeType?x(v,T(v)-(s?0:1)):1!=v.nodeType||"BR"==v.nodeName&&v.nextSibling?null:v;if(g)return fe(le(g,1),!1)}if(null==a&&i<T(o)){for(var y=o.childNodes[i];y.pmViewDesc&&y.pmViewDesc.ignoreForCoords;)y=y.nextSibling;var b=y?3==y.nodeType?x(y,0,s?0:1):1==y.nodeType?y:null:null;if(b)return fe(le(b,-1),!0)}return fe(le(3==o.nodeType?x(o):o,-n),n>=0)}function fe(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function de(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function he(e,t,n){var r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}var pe=/[\u0590-\u08ac]/,me=null,ve=null,ge=!1;var ye=function(){function e(t,n,r,o){p(this,e),this.parent=t,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=0,r.pmViewDesc=this}return v(e,[{key:"matchesWidget",value:function(e){return!1}},{key:"matchesMark",value:function(e){return!1}},{key:"matchesNode",value:function(e,t,n){return!1}},{key:"matchesHack",value:function(e){return!1}},{key:"parseRule",value:function(){return null}},{key:"stopEvent",value:function(e){return!1}},{key:"size",get:function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e}},{key:"border",get:function(){return 0}},{key:"destroy",value:function(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(var e=0;e<this.children.length;e++)this.children[e].destroy()}},{key:"posBeforeChild",value:function(e){for(var t=0,n=this.posAtStart;;t++){var r=this.children[t];if(r==e)return n;n+=r.size}}},{key:"posBefore",get:function(){return this.parent.posBeforeChild(this)}},{key:"posAtStart",get:function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}},{key:"posAfter",get:function(){return this.posBefore+this.size}},{key:"posAtEnd",get:function(){return this.posAtStart+this.size-2*this.border}},{key:"localPosFromDOM",value:function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var r,o;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(o=r.pmViewDesc)||o.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(o)+o.size:this.posAtStart}var i,a;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&(!(a=i.pmViewDesc)||a.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(a):this.posAtEnd}var s;if(e==this.dom&&this.contentDOM)s=t>w(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var l=e;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.previousSibling)break}if(null==s&&t==e.childNodes.length)for(var c=e;;c=c.parentNode){if(c==this.dom){s=!0;break}if(c.nextSibling)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart}},{key:"nearestDesc",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!0,r=e;r;r=r.parentNode){var o=this.getDesc(r),i=void 0;if(o&&(!t||o.node)){if(!n||!(i=o.nodeDOM)||(1==i.nodeType?i.contains(1==e.nodeType?e:e.parentNode):i==e))return o;n=!1}}}},{key:"getDesc",value:function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t}},{key:"posFromDOM",value:function(e,t,n){for(var r=e;r;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}},{key:"descAt",value:function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<o)return r.descAt(e-n-r.border);n=o}}},{key:"domFromPos",value:function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};for(var n,r=0,o=0,i=0;r<this.children.length;r++){var a=this.children[r],s=i+a.size;if(s>e||a instanceof Oe){o=e-i;break}i=s}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(;r&&!(n=this.children[r-1]).size&&n instanceof be&&n.side>=0;r--);if(t<=0){for(var l,c=!0;(l=r?this.children[r-1]:null)&&l.dom.parentNode!=this.contentDOM;r--,c=!1);return l&&t&&c&&!l.border&&!l.domAtom?l.domFromPos(l.size,t):{node:this.contentDOM,offset:l?w(l.dom)+1:0}}for(var u,f=!0;(u=r<this.children.length?this.children[r]:null)&&u.dom.parentNode!=this.contentDOM;r++,f=!1);return u&&f&&!u.border&&!u.domAtom?u.domFromPos(0,t):{node:this.contentDOM,offset:u?w(u.dom):this.contentDOM.childNodes.length}}},{key:"parseRange",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,a=0;;a++){var s=this.children[a],l=i+s.size;if(-1==r&&e<=l){var c=i+s.border;if(e>=c&&t<=l-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,t,c);e=i;for(var u=a;u>0;u--){var f=this.children[u-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){r=w(f.dom)+1;break}e-=f.size}-1==r&&(r=0)}if(r>-1&&(l>t||a==this.children.length-1)){t=l;for(var d=a+1;d<this.children.length;d++){var h=this.children[d];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){o=w(h.dom);break}t+=h.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}},{key:"emptyChildAt",value:function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}},{key:"domAfterPos",value:function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}},{key:"setSelection",value:function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=Math.min(e,t),i=Math.max(e,t),a=0,s=0;a<this.children.length;a++){var l=this.children[a],c=s+l.size;if(o>s&&i<c)return l.setSelection(e-s-l.border,t-s-l.border,n,r);s=c}var u=this.domFromPos(e,e?-1:1),f=t==e?u:this.domFromPos(t,t?-1:1),d=n.getSelection(),h=!1;if((B||K)&&e==t){var p=u,m=p.node,v=p.offset;if(3==m.nodeType){if((h=!(!v||"\n"!=m.nodeValue[v-1]))&&v==m.nodeValue.length)for(var g,y=m;y;y=y.parentNode){if(g=y.nextSibling){"BR"==g.nodeName&&(u=f={node:g.parentNode,offset:w(g)+1});break}var b=y.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{var k=m.childNodes[v-1];h=k&&("BR"==k.nodeName||"false"==k.contentEditable)}}if(B&&d.focusNode&&d.focusNode!=f.node&&1==d.focusNode.nodeType){var S=d.focusNode.childNodes[d.focusOffset];S&&"false"==S.contentEditable&&(r=!0)}if(r||h&&K||!C(u.node,u.offset,d.anchorNode,d.anchorOffset)||!C(f.node,f.offset,d.focusNode,d.focusOffset)){var x=!1;if((d.extend||e==t)&&!h){d.collapse(u.node,u.offset);try{e!=t&&d.extend(f.node,f.offset),x=!0}catch(e){}}if(!x){if(e>t){var O=u;u=f,f=O}var M=document.createRange();M.setEnd(f.node,f.offset),M.setStart(u.node,u.offset),d.removeAllRanges(),d.addRange(M)}}}},{key:"ignoreMutation",value:function(e){return!this.contentDOM&&"selection"!=e.type}},{key:"contentLost",get:function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}},{key:"markDirty",value:function(e,t){for(var n=0,r=0;r<this.children.length;r++){var o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){var a=n+o.border,s=i-o.border;if(e>=a&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=a||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-a,t-a):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}},{key:"markParentsDirty",value:function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}},{key:"domAtom",get:function(){return!1}},{key:"ignoreForCoords",get:function(){return!1}},{key:"isText",value:function(e){return!1}}]),e}(),be=function(e){l(n,e);var t=u(n);function n(e,r,o,i){var a;p(this,n);var s,l=r.type.toDOM;if("function"==typeof l&&(l=l(o,(function(){return s?s.parent?s.parent.posBeforeChild(s):void 0:i}))),!r.type.spec.raw){if(1!=l.nodeType){var c=document.createElement("span");c.appendChild(l),l=c}l.contentEditable="false",l.classList.add("ProseMirror-widget")}return(a=t.call(this,e,[],l,null)).widget=r,a.widget=r,s=f(a),a}return v(n,[{key:"matchesWidget",value:function(e){return 0==this.dirty&&e.type.eq(this.widget.type)}},{key:"parseRule",value:function(){return{ignore:!0}}},{key:"stopEvent",value:function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)}},{key:"ignoreMutation",value:function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}},{key:"destroy",value:function(){this.widget.type.destroy(this.dom),s(d(n.prototype),"destroy",this).call(this)}},{key:"domAtom",get:function(){return!0}},{key:"side",get:function(){return this.widget.type.side}}]),n}(ye),we=function(e){l(n,e);var t=u(n);function n(e,r,o,i){var a;return p(this,n),(a=t.call(this,e,[],r,null)).textDOM=o,a.text=i,a}return v(n,[{key:"size",get:function(){return this.text.length}},{key:"localPosFromDOM",value:function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}},{key:"domFromPos",value:function(e){return{node:this.textDOM,offset:e}}},{key:"ignoreMutation",value:function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}]),n}(ye),ke=function(e){l(n,e);var t=u(n);function n(e,r,o,i,a){var s;return p(this,n),(s=t.call(this,e,[],o,i)).mark=r,s.spec=a,s}return v(n,[{key:"parseRule",value:function(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}},{key:"matchesMark",value:function(e){return 3!=this.dirty&&this.mark.eq(e)}},{key:"markDirty",value:function(e,t){if(s(d(n.prototype),"markDirty",this).call(this,e,t),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}}},{key:"slice",value:function(e,t,r){var o=n.create(this.parent,this.mark,!0,r),i=this.children,a=this.size;t<a&&(i=Fe(i,t,a,r)),e>0&&(i=Fe(i,0,e,r));for(var s=0;s<i.length;s++)i[s].parent=o;return o.children=i,o}},{key:"destroy",value:function(){this.spec.destroy&&this.spec.destroy(),s(d(n.prototype),"destroy",this).call(this)}}],[{key:"create",value:function(e,t,r,o){var i=o.nodeViews[t.type.name],a=i&&i(t,o,r);return a&&a.dom||(a=y.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new n(e,t,a.dom,a.contentDOM||a.dom,a)}}]),n}(ye),Se=function(e){l(n,e);var t=u(n);function n(e,r,o,i,a,s,l,c,u){var f;return p(this,n),(f=t.call(this,e,[],a,s)).node=r,f.outerDeco=o,f.innerDeco=i,f.nodeDOM=l,f}return v(n,[{key:"parseRule",value:function(){var e=this;if(this.node.type.spec.reparseInView)return null;var t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(var n=this.children.length-1;n>=0;n--){var r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=function(){return y.Fragment.empty})}else t.contentElement=this.contentDOM;else t.getContent=function(){return e.node.content};return t}},{key:"matchesNode",value:function(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Pe(t,this.outerDeco)&&n.eq(this.innerDeco)}},{key:"size",get:function(){return this.node.nodeSize}},{key:"border",get:function(){return this.node.isLeaf?0:1}},{key:"updateChildren",value:function(e,t){var n=this,r=this.node.inlineContent,o=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,s=i&&i.pos<0,l=new Ie(this,a&&a.node,e);!function(e,t,n,r){var o=t.locals(e),i=0;if(0!=o.length)for(var a=0,s=[],l=null,c=0;;){for(var u=void 0,f=void 0;a<o.length&&o[a].to==i;){var d=o[a++];d.widget&&(u?(f||(f=[u])).push(d):u=d)}if(u)if(f){f.sort(je);for(var h=0;h<f.length;h++)n(f[h],c,!!l)}else n(u,c,!!l);var p=void 0,m=void 0;if(l)m=-1,p=l,l=null;else{if(!(c<e.childCount))break;m=c,p=e.child(c++)}for(var v=0;v<s.length;v++)s[v].to<=i&&s.splice(v--,1);for(;a<o.length&&o[a].from<=i&&o[a].to>i;)s.push(o[a++]);var g=i+p.nodeSize;if(p.isText){var y=g;a<o.length&&o[a].from<y&&(y=o[a].from);for(var b=0;b<s.length;b++)s[b].to<y&&(y=s[b].to);y<g&&(l=p.cut(y-i),p=p.cut(0,y-i),g=y,m=-1)}else for(;a<o.length&&o[a].to<g;)a++;r(p,p.isInline&&!p.isLeaf?s.filter((function(e){return!e.inline})):s.slice(),t.forChild(i,p),m),i=g}else for(var w=0;w<e.childCount;w++){var k=e.child(w);r(k,o,t.forChild(i,k),w),i+=k.nodeSize}}(this.node,this.innerDeco,(function(t,i,a){t.spec.marks?l.syncToMarks(t.spec.marks,r,e):t.type.side>=0&&!a&&l.syncToMarks(i==n.node.childCount?y.Mark.none:n.node.child(i).marks,r,e),l.placeWidget(t,e,o)}),(function(t,n,a,c){var u;l.syncToMarks(t.marks,r,e),l.findNodeMatch(t,n,a,c)||s&&e.state.selection.from>o&&e.state.selection.to<o+t.nodeSize&&(u=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(t,n,a,u,e)||l.updateNextNode(t,n,a,e,c,o)||l.addNode(t,n,a,e,o),o+=t.nodeSize})),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(a&&this.protectLocalComposition(e,a),Te(this.contentDOM,this.children,e),H&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}},{key:"localCompositionInfo",value:function(e,t){var n=e.state.selection,r=n.from,o=n.to;if(!(e.state.selection instanceof g.TextSelection)||r<t||o>t+this.node.content.size)return null;var i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){var a=i.nodeValue,s=function(e,t,n,r){for(var o=0,i=0;o<e.childCount&&i<=r;){var a=e.child(o++),s=i;if(i+=a.nodeSize,a.isText){for(var l=a.text;o<e.childCount;){var c=e.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-t.length-s,r-s)==t)return r-t.length;var u=s<r?l.lastIndexOf(t,r-s-1):-1;if(u>=0&&u+t.length+s>=n)return s+u;if(n==r&&l.length>=r+t.length-s&&l.slice(r-s,r-s+t.length)==t)return r}}}return-1}(this.node.content,a,r-t,o-t);return s<0?null:{node:i,pos:s,text:a}}return{node:i,pos:-1,text:""}}},{key:"protectLocalComposition",value:function(e,t){var n=t.node,r=t.pos,o=t.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}var a=new we(this,i,n,o);e.input.compositionNodes.push(a),this.children=Fe(this.children,r,r+o.length,e,a)}}},{key:"update",value:function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node)||(this.updateInner(e,t,n,r),0))}},{key:"updateInner",value:function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}},{key:"updateOuterDeco",value:function(e){if(!Pe(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=De(this.dom,this.nodeDOM,Re(this.outerDeco,this.node,t),Re(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}}},{key:"selectNode",value:function(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}},{key:"deselectNode",value:function(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable"))}},{key:"domAtom",get:function(){return this.node.isAtom}}],[{key:"create",value:function(e,t,r,o,i,a){var s,l=i.nodeViews[t.type.name],c=l&&l(t,i,(function(){return s?s.parent?s.parent.posBeforeChild(s):void 0:a}),r,o),u=c&&c.dom,f=c&&c.contentDOM;if(t.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(t.text);else if(!u){var d=y.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);u=d.dom,f=d.contentDOM}f||t.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));var h=u;return u=Ee(u,r,t),c?s=new Me(e,t,r,o,u,f||null,h,c,i,a+1):t.isText?new Ce(e,t,r,o,u,h,i):new n(e,t,r,o,u,f||null,h,i,a+1)}}]),n}(ye);function xe(e,t,n,r,o){Ee(r,t,e);var i=new Se(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}var Ce=function(e){l(n,e);var t=u(n);function n(e,r,o,i,a,s,l){return p(this,n),t.call(this,e,r,o,i,a,null,s,l,0)}return v(n,[{key:"parseRule",value:function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}},{key:"update",value:function(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node)||(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,0))}},{key:"inParent",value:function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}},{key:"domFromPos",value:function(e){return{node:this.nodeDOM,offset:e}}},{key:"localPosFromDOM",value:function(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):s(d(n.prototype),"localPosFromDOM",this).call(this,e,t,r)}},{key:"ignoreMutation",value:function(e){return"characterData"!=e.type&&"selection"!=e.type}},{key:"slice",value:function(e,t,r){var o=this.node.cut(e,t),i=document.createTextNode(o.text);return new n(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}},{key:"markDirty",value:function(e,t){s(d(n.prototype),"markDirty",this).call(this,e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}},{key:"domAtom",get:function(){return!1}},{key:"isText",value:function(e){return this.node.text==e}}]),n}(Se),Oe=function(e){l(n,e);var t=u(n);function n(){return p(this,n),t.apply(this,arguments)}return v(n,[{key:"parseRule",value:function(){return{ignore:!0}}},{key:"matchesHack",value:function(e){return 0==this.dirty&&this.dom.nodeName==e}},{key:"domAtom",get:function(){return!0}},{key:"ignoreForCoords",get:function(){return"IMG"==this.dom.nodeName}}]),n}(ye),Me=function(e){l(n,e);var t=u(n);function n(e,r,o,i,a,s,l,c,u,f){var d;return p(this,n),(d=t.call(this,e,r,o,i,a,s,l,u,f)).spec=c,d}return v(n,[{key:"update",value:function(e,t,r,o){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){var i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,o),i}return!(!this.contentDOM&&!e.isLeaf)&&s(d(n.prototype),"update",this).call(this,e,t,r,o)}},{key:"selectNode",value:function(){this.spec.selectNode?this.spec.selectNode():s(d(n.prototype),"selectNode",this).call(this)}},{key:"deselectNode",value:function(){this.spec.deselectNode?this.spec.deselectNode():s(d(n.prototype),"deselectNode",this).call(this)}},{key:"setSelection",value:function(e,t,r,o){this.spec.setSelection?this.spec.setSelection(e,t,r):s(d(n.prototype),"setSelection",this).call(this,e,t,r,o)}},{key:"destroy",value:function(){this.spec.destroy&&this.spec.destroy(),s(d(n.prototype),"destroy",this).call(this)}},{key:"stopEvent",value:function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}},{key:"ignoreMutation",value:function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):s(d(n.prototype),"ignoreMutation",this).call(this,e)}}]),n}(Se);function Te(e,t,n){for(var r=e.firstChild,o=!1,i=0;i<t.length;i++){var a=t[i],s=a.dom;if(s.parentNode==e){for(;s!=r;)r=ze(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(s,r);if(a instanceof ke){var l=r?r.previousSibling:e.lastChild;Te(a.contentDOM,a.children,n),r=l?l.nextSibling:e.firstChild}}for(;r;)r=ze(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}var Ae=function(e){e&&(this.nodeName=e)};Ae.prototype=Object.create(null);var Ne=[new Ae];function Re(e,t,n){if(0==e.length)return Ne;for(var r=n?Ne[0]:new Ae,o=[r],i=0;i<e.length;i++){var a=e[i].type.attrs;if(a)for(var s in a.nodeName&&o.push(r=new Ae(a.nodeName)),a){var l=a[s];null!=l&&(n&&1==o.length&&o.push(r=new Ae(t.isInline?"span":"div")),"class"==s?r.class=(r.class?r.class+" ":"")+l:"style"==s?r.style=(r.style?r.style+";":"")+l:"nodeName"!=s&&(r[s]=l))}}return o}function De(e,t,n,r){if(n==Ne&&r==Ne)return t;for(var o=t,i=0;i<r.length;i++){var a=r[i],s=n[i];if(i){var l=void 0;s&&s.nodeName==a.nodeName&&o!=e&&(l=o.parentNode)&&l.nodeName.toLowerCase()==a.nodeName||((l=document.createElement(a.nodeName)).pmIsDeco=!0,l.appendChild(o),s=Ne[0]),o=l}_e(o,s||Ne[0],a)}return o}function _e(e,t,n){for(var r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(var o in n)"class"!=o&&"style"!=o&&"nodeName"!=o&&n[o]!=t[o]&&e.setAttribute(o,n[o]);if(t.class!=n.class){for(var i=t.class?t.class.split(" ").filter(Boolean):[],a=n.class?n.class.split(" ").filter(Boolean):[],s=0;s<i.length;s++)-1==a.indexOf(i[s])&&e.classList.remove(i[s]);for(var l=0;l<a.length;l++)-1==i.indexOf(a[l])&&e.classList.add(a[l]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style)for(var c,u=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=u.exec(t.style);)e.style.removeProperty(c[1]);n.style&&(e.style.cssText+=n.style)}}function Ee(e,t,n){return De(e,e,Ne,Re(t,n,1!=e.nodeType))}function Pe(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function ze(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var Ie=function(){function e(t,n,r){p(this,e),this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=function(e,t){var n=t,r=n.children.length,o=e.childCount,i=new Map,a=[];e:for(;o>0;){for(var s=void 0;;)if(r){var l=n.children[r-1];if(!(l instanceof ke)){s=l,r--;break}n=l,r=l.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}var c=s.node;if(c){if(c!=e.child(o-1))break;--o,i.set(s,o),a.push(s)}}return{index:o,matched:i,matches:a.reverse()}}(t.node.content,t)}return v(e,[{key:"destroyBetween",value:function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}},{key:"destroyRest",value:function(){this.destroyBetween(this.index,this.top.children.length)}},{key:"syncToMarks",value:function(e,t,n){for(var r=0,o=this.stack.length>>1,i=Math.min(o,e.length);r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);for(var a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++){var l=this.top.children[s];if(l.matchesMark(e[o])&&!this.isLocked(l.dom)){a=s;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var c=ke.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}},{key:"findNodeMatch",value:function(e,t,n,r){var o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(var a=this.index,s=Math.min(this.top.children.length,a+5);a<s;a++){var l=this.top.children[a];if(l.matchesNode(e,t,n)&&!this.preMatch.matched.has(l)){i=a;break}}return!(i<0||(this.destroyBetween(this.index,i),this.index++,0))}},{key:"updateNodeAt",value:function(e,t,n,r,o){var i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}},{key:"findIndexWithChild",value:function(e){for(;;){var t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){var n=e.pmViewDesc;if(n)for(var r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==n)return r;return-1}e=t}}},{key:"updateNextNode",value:function(e,t,n,r,o,i){for(var a=this.index;a<this.top.children.length;a++){var s=this.top.children[a];if(s instanceof Se){var l=this.preMatch.matched.get(s);if(null!=l&&l!=o)return!1;var c=s.dom,u=void 0,f=this.isLocked(c)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&3!=s.dirty&&Pe(t,s.outerDeco));if(!f&&s.update(e,t,n,r))return this.destroyBetween(this.index,a),s.dom!=c&&(this.changed=!0),this.index++,!0;if(!f&&(u=this.recreateWrapper(s,e,t,n,r,i)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=2,u.updateChildren(r,i+1),u.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}},{key:"recreateWrapper",value:function(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Pe(n,e.outerDeco)||!r.eq(e.innerDeco))return null;var s=Se.create(this.top,t,n,r,i,a);if(s.contentDOM){s.children=e.children,e.children=[];var l,c=o(s.children);try{for(c.s();!(l=c.n()).done;)l.value.parent=s}catch(e){c.e(e)}finally{c.f()}}return e.destroy(),s}},{key:"addNode",value:function(e,t,n,r,o){var i=Se.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}},{key:"placeWidget",value:function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){var o=new be(this.top,e,t,n);this.top.children.splice(this.index++,0,o),this.changed=!0}else this.index++}},{key:"addTextblockHacks",value:function(){for(var e=this.top.children[this.index-1],t=this.top;e instanceof ke;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof Ce)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((K||L)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}},{key:"addHackNode",value:function(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{var n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");var r=new Oe(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}},{key:"isLocked",value:function(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}]),e}();function je(e,t){return e.type.side-t.type.side}function Fe(e,t,n,r,o){for(var i=[],a=0,s=0;a<e.length;a++){var l=e[a],c=s,u=s+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Be(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=e.domSelectionRange(),o=e.state.doc;if(!n.focusNode)return null;var i=e.docView.nearestDesc(n.focusNode),a=i&&0==i.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;var l,c,u=o.resolve(s);if(N(n)){for(l=s;i&&!i.node;)i=i.parent;var f=i.node;if(i&&f.isAtom&&g.NodeSelection.isSelectable(f)&&i.parent&&(!f.isInline||!function(e,t,n){for(var r=0==t,o=t==T(e);r||o;){if(e==n)return!0;var i=w(e);if(!(e=e.parentNode))return!1;r=r&&0==i,o=o&&i==T(e)}}(n.focusNode,n.focusOffset,i.dom))){var d=i.posBefore;c=new g.NodeSelection(s==d?u:o.resolve(d))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){for(var h=s,p=s,m=0;m<n.rangeCount;m++){var v=n.getRangeAt(m);h=Math.min(h,e.docView.posFromDOM(v.startContainer,v.startOffset,1)),p=Math.max(p,e.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(h<0)return null;var y=r(p==e.state.selection.anchor?[p,h]:[h,p],2);l=y[0],s=y[1],u=o.resolve(s)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}var b=o.resolve(l);return c||(c=Ue(e,b,u,"pointer"==t||e.state.selection.head<u.pos&&!a?1:-1)),c}function $e(e){return e.editable?e.hasFocus():Xe(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Le(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.state.selection;if(qe(e,n),$e(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&L){var r=e.domSelectionRange(),o=e.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&C(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){var t=e.domSelection(),n=document.createRange();if(t){var r=e.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setStart(r.parentNode,w(r)+1):n.setStart(r,0),n.collapse(!0),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&j&&F<=11&&(r.disabled=!0,r.disabled=!1)}}(e);else{var i,a,s=n.anchor,l=n.head;!Ve||n instanceof g.TextSelection||(n.$from.parent.inlineContent||(i=Ke(e,n.from)),n.empty||n.$from.parent.inlineContent||(a=Ke(e,n.to))),e.docView.setSelection(s,l,e.root,t),Ve&&(i&&We(i),a&&We(a)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);var n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((function(){$e(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var Ve=K||L&&V<63;function Ke(e,t){var n=e.docView.domFromPos(t,0),r=n.node,o=n.offset,i=o<r.childNodes.length?r.childNodes[o]:null,a=o?r.childNodes[o-1]:null;if(K&&i&&"false"==i.contentEditable)return He(i);if(!(i&&"false"!=i.contentEditable||a&&"false"!=a.contentEditable)){if(i)return He(i);if(a)return He(a)}}function He(e){return e.contentEditable="true",K&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function We(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function qe(e,t){if(t instanceof g.NodeSelection){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Je(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Je(e)}function Je(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Ue(e,t,n,r){return e.someProp("createSelectionBetween",(function(r){return r(e,t,n)}))||g.TextSelection.between(t,n,r)}function Ge(e){return!(e.editable&&!e.hasFocus())&&Xe(e)}function Xe(e){var t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Ye(e,t){var n=e.selection,r=n.$anchor,o=n.$head,i=t>0?r.max(o):r.min(o),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&g.Selection.findFrom(a,t)}function Qe(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Ze(e,t,n){var r=e.state.selection;if(!(r instanceof g.TextSelection)){if(r instanceof g.NodeSelection&&r.node.isInline)return Qe(e,new g.TextSelection(t>0?r.$to:r.$from));var o=Ye(e.state,t);return!!o&&Qe(e,o)}if(n.indexOf("s")>-1){var i=r.$head,a=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;var s=e.state.doc.resolve(i.pos+a.nodeSize*(t<0?-1:1));return Qe(e,new g.TextSelection(r.$anchor,s))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){var l=Ye(e.state,t);return!!(l&&l instanceof g.NodeSelection)&&Qe(e,l)}if(!(W&&n.indexOf("m")>-1)){var c,u=r.$head,f=u.textOffset?null:t<0?u.nodeBefore:u.nodeAfter;if(!f||f.isText)return!1;var d=t<0?u.pos-f.nodeSize:u.pos;return!!(f.isAtom||(c=e.docView.descAt(d))&&!c.contentDOM)&&(g.NodeSelection.isSelectable(f)?Qe(e,new g.NodeSelection(t<0?e.state.doc.resolve(u.pos-f.nodeSize):u)):!!U&&Qe(e,new g.TextSelection(e.state.doc.resolve(t<0?d:d+f.nodeSize))))}}function et(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function tt(e,t){var n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function nt(e,t){return t<0?function(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(n){var o,i,a=!1;for(B&&1==n.nodeType&&r<et(n)&&tt(n.childNodes[r],-1)&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;var s=n.childNodes[r-1];if(tt(s,-1))o=n,i=--r;else{if(3!=s.nodeType)break;r=(n=s).nodeValue.length}}else{if(rt(n))break;for(var l=n.previousSibling;l&&tt(l,-1);)o=n.parentNode,i=w(l),l=l.previousSibling;if(l)r=et(n=l);else{if((n=n.parentNode)==e.dom)break;r=0}}a?ot(e,n,r):o&&ot(e,o,i)}}(e):function(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(n){for(var o,i,a=et(n);;)if(r<a){if(1!=n.nodeType)break;if(!tt(n.childNodes[r],1))break;o=n,i=++r}else{if(rt(n))break;for(var s=n.nextSibling;s&&tt(s,1);)o=s.parentNode,i=w(s)+1,s=s.nextSibling;if(s)r=0,a=et(n=s);else{if((n=n.parentNode)==e.dom)break;r=a=0}}o&&ot(e,o,i)}}(e)}function rt(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function ot(e,t,n){var r,o;3!=t.nodeType&&((o=function(e,t){for(;e&&t==e.childNodes.length&&!A(e);)t=w(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){var n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=o,n=0):(r=function(e,t){for(;e&&!t&&!A(e);)t=w(e),e=e.parentNode;for(;e&&t;){var n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=r,n=r.nodeValue.length));var i=e.domSelection();if(i){if(N(i)){var a=document.createRange();a.setEnd(t,n),a.setStart(t,n),i.removeAllRanges(),i.addRange(a)}else i.extend&&i.extend(t,n);e.domObserver.setCurSelection();var s=e.state;setTimeout((function(){e.state==s&&Le(e)}),50)}}function it(e,t){var n=e.state.doc.resolve(t);if(!L&&!q&&n.parent.inlineContent){var r=e.coordsAtPos(t);if(t>n.start()){var o=e.coordsAtPos(t-1),i=(o.top+o.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(o.left-r.left)>1)return o.left<r.left?"ltr":"rtl"}if(t<n.end()){var a=e.coordsAtPos(t+1),s=(a.top+a.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(a.left-r.left)>1)return a.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function at(e,t,n){var r=e.state.selection;if(r instanceof g.TextSelection&&!r.empty||n.indexOf("s")>-1)return!1;if(W&&n.indexOf("m")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var a=Ye(e.state,t);if(a&&a instanceof g.NodeSelection)return Qe(e,a)}if(!o.parent.inlineContent){var s=t<0?o:i,l=r instanceof g.AllSelection?g.Selection.near(s,t):g.Selection.findFrom(s,t);return!!l&&Qe(e,l)}return!1}function st(e,t){if(!(e.state.selection instanceof g.TextSelection))return!0;var n=e.state.selection,r=n.$head,o=n.$anchor,i=n.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){var s=e.state.tr;return t<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),e.dispatch(s),!0}return!1}function lt(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function ct(e,t){e.someProp("transformCopied",(function(n){t=n(t,e)}));for(var n=[],r=t,o=r.content,i=r.openStart,a=r.openEnd;i>1&&a>1&&1==o.childCount&&1==o.firstChild.childCount;){i--,a--;var s=o.firstChild;n.push(s.type.name,s.attrs!=s.type.defaultAttrs?s.attrs:null),o=s.content}var l=e.someProp("clipboardSerializer")||y.DOMSerializer.fromSchema(e.state.schema),c=bt(),u=c.createElement("div");u.appendChild(l.serializeFragment(o,{document:c}));for(var f,d=u.firstChild,h=0;d&&1==d.nodeType&&(f=gt[d.nodeName.toLowerCase()]);){for(var p=f.length-1;p>=0;p--){for(var m=c.createElement(f[p]);u.firstChild;)m.appendChild(u.firstChild);u.appendChild(m),h++}d=u.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice","".concat(i," ").concat(a).concat(h?" -".concat(h):""," ").concat(JSON.stringify(n))),{dom:u,text:e.someProp("clipboardTextSerializer",(function(n){return n(t,e)}))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function ut(e,t,n,r,o){var i,a,s=o.parent.type.spec.code;if(!n&&!t)return null;var l=t&&(r||s||!n);if(l){if(e.someProp("transformPastedText",(function(n){t=n(t,s||r,e)})),s)return t?new y.Slice(y.Fragment.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):y.Slice.empty;var c=e.someProp("clipboardTextParser",(function(n){return n(t,o,r,e)}));if(c)a=c;else{var u=o.marks(),f=e.state.schema,d=y.DOMSerializer.fromSchema(f);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach((function(e){var t=i.appendChild(document.createElement("p"));e&&t.appendChild(d.serializeNode(f.text(e,u)))}))}}else e.someProp("transformPastedHTML",(function(t){n=t(n,e)})),i=function(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=bt().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);if((n=o&>[o[1].toLowerCase()])&&(e=n.map((function(e){return"<"+e+">"})).join("")+e+n.map((function(e){return"</"+e+">"})).reverse().join("")),r.innerHTML=function(e){var t=window.trustedTypes;return t?(wt||(wt=t.createPolicy("ProseMirrorClipboard",{createHTML:function(e){return e}})),wt.createHTML(e)):e}(e),n)for(var i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n),U&&function(e){for(var t=e.querySelectorAll(L?"span:not([class]):not([style])":"span.Apple-converted-space"),n=0;n<t.length;n++){var r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(i);var h=i&&i.querySelector("[data-pm-slice]"),p=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(p&&p[3])for(var m=+p[3];m>0;m--){for(var v=i.firstChild;v&&1!=v.nodeType;)v=v.nextSibling;if(!v)break;i=v}if(!a){var g=e.someProp("clipboardParser")||e.someProp("domParser")||y.DOMParser.fromSchema(e.state.schema);a=g.parseSlice(i,{preserveWhitespace:!(!l&&!p),context:o,ruleFromNode:function(e){return"BR"!=e.nodeName||e.nextSibling||!e.parentNode||ft.test(e.parentNode.nodeName)?null:{ignore:!0}}})}if(p)a=function(e,t){if(!e.size)return e;var n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}for(var o=e.content,i=e.openStart,a=e.openEnd,s=n.length-2;s>=0;s-=2){var l=r.nodes[n[s]];if(!l||l.hasRequiredAttrs())break;o=y.Fragment.from(l.create(n[s+1],o)),i++,a++}return new y.Slice(o,i,a)}(vt(a,+p[1],+p[2]),p[4]);else if(a=y.Slice.maxOpen(function(e,t){if(e.childCount<2)return e;for(var n,r=function(){var n,r=t.node(o).contentMatchAt(t.index(o)),i=[];if(e.forEach((function(e){if(i){var t,o=r.findWrapping(e.type);if(!o)return i=null;if(t=i.length&&n.length&&ht(o,n,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=pt(i[i.length-1],n.length));var a=dt(e,o);i.push(a),r=r.matchType(a.type),n=o}}})),i)return{v:y.Fragment.from(i)}},o=t.depth;o>=0;o--)if(n=r())return n.v;return e}(a.content,o),!0),a.openStart||a.openEnd){for(var b=0,w=0,k=a.content.firstChild;b<a.openStart&&!k.type.spec.isolating;b++,k=k.firstChild);for(var S=a.content.lastChild;w<a.openEnd&&!S.type.spec.isolating;w++,S=S.lastChild);a=vt(a,b,w)}return e.someProp("transformPasted",(function(t){a=t(a,e)})),a}var ft=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function dt(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t.length-1;r>=n;r--)e=t[r].create(null,y.Fragment.from(e));return e}function ht(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){var i=ht(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(y.Fragment.from(dt(n,e,o+1))))}}function pt(e,t){if(0==t)return e;var n=e.content.replaceChild(e.childCount-1,pt(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(y.Fragment.empty,!0);return e.copy(n.append(r))}function mt(e,t,n,r,o,i){var a=t<0?e.firstChild:e.lastChild,s=a.content;return e.childCount>1&&(i=0),o<r-1&&(s=mt(s,t,n,r,o+1,i)),o>=n&&(s=t<0?a.contentMatchAt(0).fillBefore(s,i<=o).append(s):s.append(a.contentMatchAt(a.childCount).fillBefore(y.Fragment.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(s))}function vt(e,t,n){return t<e.openStart&&(e=new y.Slice(mt(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new y.Slice(mt(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var gt={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},yt=null;function bt(){return yt||(yt=document.implementation.createHTMLDocument("title"))}var wt=null,kt={},St={},xt={touchstart:!0,touchmove:!0},Ct=v((function e(){p(this,e),this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}));function Ot(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Mt(e){e.someProp("handleDOMEvents",(function(t){for(var n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=function(t){return Tt(e,t)})}))}function Tt(e,t){return e.someProp("handleDOMEvents",(function(n){var r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function At(e){return{left:e.clientX,top:e.clientY}}function Nt(e,t,n,r,o){if(-1==r)return!1;for(var i,a=e.state.doc.resolve(r),s=function(r){if(e.someProp(t,(function(t){return r>a.depth?t(e,n,a.nodeAfter,a.before(r),o,!0):t(e,n,a.node(r),a.before(r),o,!1)})))return{v:!0}},l=a.depth+1;l>0;l--)if(i=s(l))return i.v;return!1}function Rt(e,t,n){if(e.focused||e.focus(),!e.state.selection.eq(t)){var r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}}function Dt(e,t,n,r){return Nt(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(function(n){return n(e,t,r)}))}function _t(e,t,n,r){return Nt(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(function(n){return n(e,t,r)}))||function(e,t,n){if(0!=n.button)return!1;var r=e.state.doc;if(-1==t)return!!r.inlineContent&&(Rt(e,g.TextSelection.create(r,0,r.content.size),"pointer"),!0);for(var o=r.resolve(t),i=o.depth+1;i>0;i--){var a=i>o.depth?o.nodeAfter:o.node(i),s=o.before(i);if(a.inlineContent)Rt(e,g.TextSelection.create(r,s+1,s+1+a.content.size),"pointer");else{if(!g.NodeSelection.isSelectable(a))continue;Rt(e,g.NodeSelection.create(r,s),"pointer")}return!0}}(e,n,r)}function Et(e){return $t(e)}St.keydown=function(e,t){var n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!It(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!J||!L||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!H||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",(function(t){return t(e,n)}))||function(e,t){var n=t.keyCode,r=function(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||W&&72==n&&"c"==r)return st(e,-1)||nt(e,-1);if(46==n&&!t.shiftKey||W&&68==n&&"c"==r)return st(e,1)||nt(e,1);if(13==n||27==n)return!0;if(37==n||W&&66==n&&"c"==r){var o=37==n?"ltr"==it(e,e.state.selection.from)?-1:1:-1;return Ze(e,o,r)||nt(e,o)}if(39==n||W&&70==n&&"c"==r){var i=39==n?"ltr"==it(e,e.state.selection.from)?1:-1:1;return Ze(e,i,r)||nt(e,i)}return 38==n||W&&80==n&&"c"==r?at(e,-1,r)||nt(e,-1):40==n||W&&78==n&&"c"==r?function(e){if(!K||e.state.selection.$head.parentOffset>0)return!1;var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var o=n.firstChild;lt(e,o,"true"),setTimeout((function(){return lt(e,o,"false")}),20)}return!1}(e)||at(e,1,r)||nt(e,1):r==(W?"m":"c")&&(66==n||73==n||89==n||90==n)}(e,n)?n.preventDefault():Ot(e,"key");else{var r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout((function(){e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",(function(t){return t(e,R(13,"Enter"))})),e.input.lastIOSEnter=0)}),200)}},St.keyup=function(e,t){16==t.keyCode&&(e.input.shiftKey=!1)},St.keypress=function(e,t){var n=t;if(!(It(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||W&&n.metaKey))if(e.someProp("handleKeyPress",(function(t){return t(e,n)})))n.preventDefault();else{var r=e.state.selection;if(!(r instanceof g.TextSelection&&r.$from.sameParent(r.$to))){var o=String.fromCharCode(n.charCode);/[\r\n]/.test(o)||e.someProp("handleTextInput",(function(t){return t(e,r.$from.pos,r.$to.pos,o)}))||e.dispatch(e.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}}};var Pt=W?"metaKey":"ctrlKey";kt.mousedown=function(e,t){var n=t;e.input.shiftKey=n.shiftKey;var r=Et(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[Pt]&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};var a=e.posAtCoords(At(n));a&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new zt(e,a,n,!!r)):("doubleClick"==i?Dt:_t)(e,a.pos,a.inside,n)?n.preventDefault():Ot(e,"pointer"))};var zt=function(){function e(t,n,r,o){var i,a,s=this;if(p(this,e),this.view=t,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[Pt],this.allowDefault=r.shiftKey,n.inside>-1)i=t.state.doc.nodeAt(n.inside),a=n.inside;else{var l=t.state.doc.resolve(n.pos);i=l.parent,a=l.depth?l.before():0}var c=o?null:r.target,u=c?t.docView.nearestDesc(c,!0):null;this.target=u&&1==u.dom.nodeType?u.dom:null;var f=t.state.selection;(0==r.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||f instanceof g.NodeSelection&&f.from<=a&&f.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!B||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((function(){s.view.input.mouseDown==s&&s.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ot(t,"pointer")}return v(e,[{key:"done",value:function(){var e=this;this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((function(){return Le(e.view)})),this.view.input.mouseDown=null}},{key:"up",value:function(e){if(this.done(),this.view.dom.contains(e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(At(e))),this.updateAllowDefault(e),this.allowDefault||!t?Ot(this.view,"pointer"):function(e,t,n,r,o){return Nt(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(function(n){return n(e,t,r)}))||(o?function(e,t){if(-1==t)return!1;var n,r,o=e.state.selection;o instanceof g.NodeSelection&&(n=o.node);for(var i=e.state.doc.resolve(t),a=i.depth+1;a>0;a--){var s=a>i.depth?i.nodeAfter:i.node(a);if(g.NodeSelection.isSelectable(s)){r=n&&o.$from.depth>0&&a>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(a);break}}return null!=r&&(Rt(e,g.NodeSelection.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&g.NodeSelection.isSelectable(r))&&(Rt(e,new g.NodeSelection(n),"pointer"),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||K&&this.mightDrag&&!this.mightDrag.node.isAtom||L&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Rt(this.view,g.Selection.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Ot(this.view,"pointer")}}},{key:"move",value:function(e){this.updateAllowDefault(e),Ot(this.view,"pointer"),0==e.buttons&&this.done()}},{key:"updateAllowDefault",value:function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}]),e}();function It(e,t){return!!e.composing||!!(K&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}kt.touchstart=function(e){e.input.lastTouch=Date.now(),Et(e),Ot(e,"pointer")},kt.touchmove=function(e){e.input.lastTouch=Date.now(),Ot(e,"pointer")},kt.contextmenu=function(e){return Et(e)};var jt=J?5e3:-1;function Ft(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout((function(){return $t(e)}),t))}function Bt(e){var t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function $t(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(J&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Bt(e),t||e.docView&&e.docView.dirty){var n=Be(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||e.state.selection.empty?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}St.compositionstart=St.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$to;if(t.selection instanceof g.TextSelection&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(e){return!1===e.type.spec.inclusive}))))e.markCursor=e.state.storedMarks||n.marks(),$t(e,!0),e.markCursor=null;else if($t(e,!t.selection.empty),B&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.domSelectionRange(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var a=i<0?o.lastChild:o.childNodes[i-1];if(!a)break;if(3==a.nodeType){var s=e.domSelection();s&&s.collapse(a,a.nodeValue.length);break}o=a,i=-1}e.input.composing=!0}Ft(e,jt)},St.compositionend=function(e,t){e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then((function(){return e.domObserver.flush()})),e.input.compositionID++,Ft(e,20))};var Lt=j&&F<15||H&&G<604;function Vt(e,t,n,r,o){var i=ut(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",(function(t){return t(e,o,i||y.Slice.empty)})))return!0;if(!i)return!1;var a=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),s=a?e.state.tr.replaceSelectionWith(a,r):e.state.tr.replaceSelection(i);return e.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Kt(e){var t=e.getData("text/plain")||e.getData("Text");if(t)return t;var n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}kt.copy=St.cut=function(e,t){var n=t,r=e.state.selection,o="cut"==n.type;if(!r.empty){var i=Lt?null:n.clipboardData,a=ct(e,r.content()),s=a.dom,l=a.text;i?(n.preventDefault(),i.clearData(),i.setData("text/html",s.innerHTML),i.setData("text/plain",l)):function(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}}(e,s),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},St.paste=function(e,t){var n=t;if(!e.composing||J){var r=Lt?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&Vt(e,Kt(r),r.getData("text/html"),o,n)?n.preventDefault():function(e,t){if(e.dom.parentNode){var n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();var o=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout((function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Vt(e,r.value,null,o,t):Vt(e,r.textContent,r.innerHTML,o,t)}),50)}}(e,n)}};var Ht=v((function e(t,n,r){p(this,e),this.slice=t,this.move=n,this.node=r})),Wt=W?"altKey":"ctrlKey";for(var qt in kt.dragstart=function(e,t){var n=t,r=e.input.mouseDown;if(r&&r.done(),n.dataTransfer){var o,i=e.state.selection,a=i.empty?null:e.posAtCoords(At(n));if(a&&a.pos>=i.from&&a.pos<=(i instanceof g.NodeSelection?i.to-1:i.to));else if(r&&r.mightDrag)o=g.NodeSelection.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){var s=e.docView.nearestDesc(n.target,!0);s&&s.node.type.spec.draggable&&s!=e.docView&&(o=g.NodeSelection.create(e.state.doc,s.posBefore))}var l=ct(e,(o||e.state.selection).content()),c=l.dom,u=l.text,f=l.slice;(!n.dataTransfer.files.length||!L||V>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Lt?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Lt||n.dataTransfer.setData("text/plain",u),e.dragging=new Ht(f,!n[Wt],o)}},kt.dragend=function(e){var t=e.dragging;window.setTimeout((function(){e.dragging==t&&(e.dragging=null)}),50)},St.dragover=St.dragenter=function(e,t){return t.preventDefault()},St.drop=function(e,t){var n=t,r=e.dragging;if(e.dragging=null,n.dataTransfer){var o=e.posAtCoords(At(n));if(o){var i=e.state.doc.resolve(o.pos),a=r&&r.slice;a?e.someProp("transformPasted",(function(t){a=t(a,e)})):a=ut(e,Kt(n.dataTransfer),Lt?null:n.dataTransfer.getData("text/html"),!1,i);var s=!(!r||n[Wt]);if(e.someProp("handleDrop",(function(t){return t(e,n,a||y.Slice.empty,s)})))n.preventDefault();else if(a){n.preventDefault();var l=a?b.dropPoint(e.state.doc,i.pos,a):i.pos;null==l&&(l=i.pos);var c=e.state.tr;if(s){var u=r.node;u?u.replace(c):c.deleteSelection()}var f=c.mapping.map(l),d=0==a.openStart&&0==a.openEnd&&1==a.content.childCount,h=c.doc;if(d?c.replaceRangeWith(f,f,a.content.firstChild):c.replaceRange(f,f,a),!c.doc.eq(h)){var p=c.doc.resolve(f);if(d&&g.NodeSelection.isSelectable(a.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new g.NodeSelection(p));else{var m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((function(e,t,n,r){return m=r})),c.setSelection(Ue(e,p,c.doc.resolve(m)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))}}}}},kt.focus=function(e){e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Le(e)}),20))},kt.blur=function(e,t){var n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},kt.beforeinput=function(e,t){if(L&&J&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();var n=e.input.domChangeCount;setTimeout((function(){if(e.input.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",(function(t){return t(e,R(8,"Backspace"))})))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}}),50)}},St)kt[qt]=St[qt];function Jt(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var Ut=function(){function e(t,n){p(this,e),this.toDOM=t,this.spec=n||Zt,this.side=this.spec.side||0}return v(e,[{key:"map",value:function(e,t,n,r){var o=e.mapResult(t.from+r,this.side<0?-1:1),i=o.pos;return o.deleted?null:new Yt(i-n,i-n,this)}},{key:"valid",value:function(){return!0}},{key:"eq",value:function(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Jt(this.spec,t.spec))}},{key:"destroy",value:function(e){this.spec.destroy&&this.spec.destroy(e)}}]),e}(),Gt=function(){function e(t,n){p(this,e),this.attrs=t,this.spec=n||Zt}return v(e,[{key:"map",value:function(e,t,n,r){var o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Yt(o,i,this)}},{key:"valid",value:function(e,t){return t.from<t.to}},{key:"eq",value:function(t){return this==t||t instanceof e&&Jt(this.attrs,t.attrs)&&Jt(this.spec,t.spec)}},{key:"destroy",value:function(){}}],[{key:"is",value:function(t){return t.type instanceof e}}]),e}(),Xt=function(){function e(t,n){p(this,e),this.attrs=t,this.spec=n||Zt}return v(e,[{key:"map",value:function(e,t,n,r){var o=e.mapResult(t.from+r,1);if(o.deleted)return null;var i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Yt(o.pos-n,i.pos-n,this)}},{key:"valid",value:function(e,t){var n,r=e.content.findIndex(t.from),o=r.index,i=r.offset;return i==t.from&&!(n=e.child(o)).isText&&i+n.nodeSize==t.to}},{key:"eq",value:function(t){return this==t||t instanceof e&&Jt(this.attrs,t.attrs)&&Jt(this.spec,t.spec)}},{key:"destroy",value:function(){}}]),e}(),Yt=function(){function e(t,n,r){p(this,e),this.from=t,this.to=n,this.type=r}return v(e,[{key:"copy",value:function(t,n){return new e(t,n,this.type)}},{key:"eq",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}},{key:"map",value:function(e,t,n){return this.type.map(e,this,t,n)}},{key:"spec",get:function(){return this.type.spec}},{key:"inline",get:function(){return this.type instanceof Gt}},{key:"widget",get:function(){return this.type instanceof Ut}}],[{key:"widget",value:function(t,n,r){return new e(t,t,new Ut(n,r))}},{key:"inline",value:function(t,n,r,o){return new e(t,n,new Gt(r,o))}},{key:"node",value:function(t,n,r,o){return new e(t,n,new Xt(r,o))}}]),e}(),Qt=[],Zt={},en=function(){function e(t,n){p(this,e),this.local=t.length?t:Qt,this.children=n.length?n:Qt}return v(e,[{key:"find",value:function(e,t,n){var r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}},{key:"findInner",value:function(e,t,n,r,o){for(var i=0;i<this.local.length;i++){var a=this.local[i];a.from<=t&&a.to>=e&&(!o||o(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){var l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,n,r+l,o)}}},{key:"map",value:function(e,t,n){return this==tn||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Zt)}},{key:"mapInner",value:function(t,n,r,o,i){for(var a,s=0;s<this.local.length;s++){var l=this.local[s].map(t,r,o);l&&l.type.valid(n,l)?(a||(a=[])).push(l):i.onRemove&&i.onRemove(this.local[s].spec)}return this.children.length?rn(this.children,a||[],t,n,r,o,i):a?new e(a.sort(cn),Qt):tn}},{key:"add",value:function(t,n){return n.length?this==tn?e.create(t,n):this.addInner(t,n,0):this}},{key:"addInner",value:function(t,n,r){var o,i=this,a=0;t.forEach((function(e,t){var s,l=t+r;if(s=an(n,e,l)){for(o||(o=i.children.slice());a<o.length&&o[a]<t;)a+=3;o[a]==t?o[a+2]=o[a+2].addInner(e,s,l+1):o.splice(a,0,t,t+e.nodeSize,ln(s,e,l+1,Zt)),a+=3}}));for(var s=on(a?sn(n):n,-r),l=0;l<s.length;l++)s[l].type.valid(t,s[l])||s.splice(l--,1);return new e(s.length?this.local.concat(s).sort(cn):this.local,o||this.children)}},{key:"remove",value:function(e){return 0==e.length||this==tn?this:this.removeInner(e,0)}},{key:"removeInner",value:function(t,n){for(var r=this.children,o=this.local,i=0;i<r.length;i+=3){for(var a,s=void 0,l=r[i]+n,c=r[i+1]+n,u=0;u<t.length;u++)(a=t[u])&&a.from>l&&a.to<c&&(t[u]=null,(s||(s=[])).push(a));if(s){r==this.children&&(r=this.children.slice());var f=r[i+2].removeInner(s,l+1);f!=tn?r[i+2]=f:(r.splice(i,3),i-=3)}}if(o.length)for(var d,h=0;h<t.length;h++)if(d=t[h])for(var p=0;p<o.length;p++)o[p].eq(d,n)&&(o==this.local&&(o=this.local.slice()),o.splice(p--,1));return r==this.children&&o==this.local?this:o.length||r.length?new e(o,r):tn}},{key:"forChild",value:function(t,n){if(this==tn)return this;if(n.isLeaf)return e.empty;for(var r,o,i=0;i<this.children.length;i+=3)if(this.children[i]>=t){this.children[i]==t&&(r=this.children[i+2]);break}for(var a=t+1,s=a+n.content.size,l=0;l<this.local.length;l++){var c=this.local[l];if(c.from<s&&c.to>a&&c.type instanceof Gt){var u=Math.max(a,c.from)-a,f=Math.min(s,c.to)-a;u<f&&(o||(o=[])).push(c.copy(u,f))}}if(o){var d=new e(o.sort(cn),Qt);return r?new nn([d,r]):d}return r||tn}},{key:"eq",value:function(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(var r=0;r<this.children.length;r+=3)if(this.children[r]!=t.children[r]||this.children[r+1]!=t.children[r+1]||!this.children[r+2].eq(t.children[r+2]))return!1;return!0}},{key:"locals",value:function(e){return un(this.localsInner(e))}},{key:"localsInner",value:function(e){if(this==tn)return Qt;if(e.inlineContent||!this.local.some(Gt.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Gt||t.push(this.local[n]);return t}},{key:"forEachSet",value:function(e){e(this)}}],[{key:"create",value:function(e,t){return t.length?ln(t,e,0,Zt):tn}}]),e}();en.empty=new en([],[]),en.removeOverlap=un;var tn=en.empty,nn=function(){function e(t){p(this,e),this.members=t}return v(e,[{key:"map",value:function(t,n){var r=this.members.map((function(e){return e.map(t,n,Zt)}));return e.from(r)}},{key:"forChild",value:function(t,n){if(n.isLeaf)return en.empty;for(var r=[],o=0;o<this.members.length;o++){var i=this.members[o].forChild(t,n);i!=tn&&(i instanceof e?r=r.concat(i.members):r.push(i))}return e.from(r)}},{key:"eq",value:function(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(var n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}},{key:"locals",value:function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(var i=0;i<o.length;i++)t.push(o[i])}else t=o}return t?un(n?t:t.sort(cn)):Qt}},{key:"forEachSet",value:function(e){for(var t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}],[{key:"from",value:function(t){switch(t.length){case 0:return tn;case 1:return t[0];default:return new e(t.every((function(e){return e instanceof en}))?t:t.reduce((function(e,t){return e.concat(t instanceof en?t:t.members)}),[]))}}}]),e}();function rn(e,t,n,r,o,i,a){for(var s=e.slice(),l=function(e){var t=0;n.maps[c].forEach((function(n,r,o,i){for(var a=i-o-(r-n),l=0;l<s.length;l+=3){var c=s[l+1];if(!(c<0||n>c+e-t)){var u=s[l]+e-t;r>=u?s[l+1]=n<=u?-2:-1:n>=e&&a&&(s[l]+=a,s[l+1]+=a)}}t+=a})),e=n.maps[c].map(e,-1),u=e},c=0,u=i;c<n.maps.length;c++)l(u);for(var f=!1,d=0;d<s.length;d+=3)if(s[d+1]<0){if(-2==s[d+1]){f=!0,s[d+1]=-1;continue}var h=n.map(e[d]+i),p=h-o;if(p<0||p>=r.content.size){f=!0;continue}var m=n.map(e[d+1]+i,-1)-o,v=r.content.findIndex(p),g=v.index,y=v.offset,b=r.maybeChild(g);if(b&&y==p&&y+b.nodeSize==m){var w=s[d+2].mapInner(n,b,h+1,e[d]+i+1,a);w!=tn?(s[d]=p,s[d+1]=m,s[d+2]=w):(s[d+1]=-2,f=!0)}else f=!0}if(f){var k=function(e,t,n,r,o,i,a){function s(e,t){for(var i=0;i<e.local.length;i++){var l=e.local[i].map(r,o,t);l?n.push(l):a.onRemove&&a.onRemove(e.local[i].spec)}for(var c=0;c<e.children.length;c+=3)s(e.children[c+2],e.children[c]+t+1)}for(var l=0;l<e.length;l+=3)-1==e[l+1]&&s(e[l+2],t[l]+i+1);return n}(s,e,t,n,o,i,a),S=ln(k,r,0,a);t=S.local;for(var x=0;x<s.length;x+=3)s[x+1]<0&&(s.splice(x,3),x-=3);for(var C=0,O=0;C<S.children.length;C+=3){for(var M=S.children[C];O<s.length&&s[O]<M;)O+=3;s.splice(O,0,S.children[C],S.children[C+1],S.children[C+2])}}return new en(t.sort(cn),s)}function on(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var o=e[r];n.push(new Yt(o.from+t,o.to+t,o.type))}return n}function an(e,t,n){if(t.isLeaf)return null;for(var r,o=n+t.nodeSize,i=null,a=0;a<e.length;a++)(r=e[a])&&r.from>n&&r.to<o&&((i||(i=[])).push(r),e[a]=null);return i}function sn(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function ln(e,t,n,r){var o=[],i=!1;t.forEach((function(t,a){var s=an(e,t,a+n);if(s){i=!0;var l=ln(s,t,n+a+1,r);l!=tn&&o.push(a,a+t.nodeSize,l)}}));for(var a=on(i?sn(e):e,-n).sort(cn),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||o.length?new en(a,o):tn}function cn(e,t){return e.from-t.from||e.to-t.to}function un(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var o=n+1;o<t.length;o++){var i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),fn(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),fn(t,o+1,i.copy(r.to,i.to)))}}return t}function fn(e,t,n){for(;t<e.length&&cn(n,e[t])>0;)t++;e.splice(t,0,n)}function dn(e){var t=[];return e.someProp("decorations",(function(n){var r=n(e.state);r&&r!=tn&&t.push(r)})),e.cursorWrapper&&t.push(en.create(e.state.doc,[e.cursorWrapper.deco])),nn.from(t)}var hn={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},pn=j&&F<=11,mn=function(){function e(){p(this,e),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return v(e,[{key:"set",value:function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}},{key:"clear",value:function(){this.anchorNode=this.focusNode=null}},{key:"eq",value:function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}]),e}(),vn=function(){function e(t,n){var r=this;p(this,e),this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new mn,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver((function(e){for(var t=0;t<e.length;t++)r.queue.push(e[t]);j&&F<=11&&e.some((function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length}))?r.flushSoon():r.flush()})),pn&&(this.onCharData=function(e){r.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),r.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}return v(e,[{key:"flushSoon",value:function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){e.flushingSoon=-1,e.flush()}),20))}},{key:"forceFlush",value:function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}},{key:"start",value:function(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,hn)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}},{key:"stop",value:function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout((function(){return e.flush()}),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}},{key:"connectSelection",value:function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}},{key:"disconnectSelection",value:function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"suppressSelectionUpdates",value:function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return e.suppressingSelectionUpdates=!1}),50)}},{key:"onSelectionChange",value:function(){if(Ge(this.view)){if(this.suppressingSelectionUpdates)return Le(this.view);if(j&&F<=11&&!this.view.state.selection.empty){var e=this.view.domSelectionRange();if(e.focusNode&&C(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}},{key:"setCurSelection",value:function(){this.currentSelection.set(this.view.domSelectionRange())}},{key:"ignoreSelectionChange",value:function(e){if(!e.focusNode)return!0;for(var t,n=new Set,r=e.focusNode;r;r=k(r))n.add(r);for(var o=e.anchorNode;o;o=k(o))if(n.has(o)){t=o;break}var i=t&&this.view.docView.nearestDesc(t);return i&&i.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}},{key:"pendingRecords",value:function(){if(this.observer){var e,t=o(this.observer.takeRecords());try{for(t.s();!(e=t.n()).done;){var n=e.value;this.queue.push(n)}}catch(e){t.e(e)}finally{t.f()}}return this.queue}},{key:"flush",value:function(){var e=this.view;if(e.docView&&!(this.flushingSoon>-1)){var t=this.pendingRecords();t.length&&(this.queue=[]);var n=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Ge(e)&&!this.ignoreSelectionChange(n),a=-1,s=-1,l=!1,c=[];if(e.editable)for(var u=0;u<t.length;u++){var f=this.registerMutation(t[u],c);f&&(a=a<0?f.from:Math.min(f.from,a),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if(B&&c.length){var d=c.filter((function(e){return"BR"==e.nodeName}));if(2==d.length){var h=r(d,2),p=h[0],m=h[1];p.parentNode&&p.parentNode.parentNode==m.parentNode?m.remove():p.remove()}else{var v,y=this.currentSelection.focusNode,b=o(d);try{for(b.s();!(v=b.n()).done;){var w=v.value,k=w.parentNode;!k||"LI"!=k.nodeName||y&&wn(e,y)==k||w.remove()}}catch(e){b.e(e)}finally{b.f()}}}var S=null;a<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&N(n)&&(S=Be(e))&&S.eq(g.Selection.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Le(e),this.currentSelection.set(n),e.scrollToSelection()):(a>-1||i)&&(a>-1&&(e.docView.markDirty(a,s),function(e){if(!gn.has(e)&&(gn.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=B,yn)return;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."),yn=!0}}(e)),this.handleDOMChange(a,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Le(e),this.currentSelection.set(n))}}},{key:"registerMutation",value:function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var r=0;r<e.addedNodes.length;r++){var o=e.addedNodes[r];t.push(o),3==o.nodeType&&(this.lastChangedTextNode=o)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var i=e.previousSibling,a=e.nextSibling;if(j&&F<=11&&e.addedNodes.length)for(var s=0;s<e.addedNodes.length;s++){var l=e.addedNodes[s],c=l.previousSibling,u=l.nextSibling;(!c||Array.prototype.indexOf.call(e.addedNodes,c)<0)&&(i=c),(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(a=u)}var f=i&&i.parentNode==e.target?w(i)+1:0,d=n.localPosFromDOM(e.target,f,-1),h=a&&a.parentNode==e.target?w(a):e.target.childNodes.length;return{from:d,to:n.localPosFromDOM(e.target,h,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}]),e}(),gn=new WeakMap,yn=!1;function bn(e,t){var n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,a=e.domAtPos(e.state.selection.anchor);if(C(a.node,a.offset,o,i)){var s=[o,i,n,r];n=s[0],r=s[1],o=s[2],i=s[3]}return{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function wn(e,t){for(var n=t.parentNode;n&&n!=e.dom;n=n.parentNode){var r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function kn(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(K&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||K&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}var Sn=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function xn(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Ue(e,t.resolve(n.anchor),t.resolve(n.head))}function Cn(e,t,n){for(var r=e.depth,o=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n)for(var i=e.node(r).maybeChild(e.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function On(e){if(2!=e.length)return!1;var t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var Mn=ct,Tn=ut,An=$t,Nn=function(){function e(t,n){var r=this;p(this,e),this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Ct,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Pn),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):"function"==typeof t?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=_n(this),Dn(this),this.nodeViews=En(this),this.docView=xe(this.state.doc,Rn(this),dn(this),this.dom,this),this.domObserver=new vn(this,(function(e,t,n,o){return function(e,t,n,r,o){var i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){var a=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,s=Be(e,a);if(s&&!e.state.selection.eq(s)){if(L&&J&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(function(t){return t(e,R(13,"Enter"))})))return;var l=e.state.tr.setSelection(s);"pointer"==a?l.setMeta("pointer",!0):"key"==a&&l.scrollIntoView(),i&&l.setMeta("composition",i),e.dispatch(l)}}else{var c=e.state.doc.resolve(t),u=c.sharedDepth(n);t=c.before(u+1),n=e.state.doc.resolve(n).after(u+1);var f,d,h=e.state.selection,p=function(e,t,n){var r,o=e.docView.parseRange(t,n),i=o.node,a=o.fromOffset,s=o.toOffset,l=o.from,c=o.to,u=e.domSelectionRange(),f=u.anchorNode;if(f&&e.dom.contains(1==f.nodeType?f:f.parentNode)&&(r=[{node:f,offset:u.anchorOffset}],N(u)||r.push({node:u.focusNode,offset:u.focusOffset})),L&&8===e.input.lastKeyCode)for(var d=s;d>a;d--){var h=i.childNodes[d-1],p=h.pmViewDesc;if("BR"==h.nodeName&&!p){s=d;break}if(!p||p.size)break}var m=e.state.doc,v=e.someProp("domParser")||y.DOMParser.fromSchema(e.state.schema),g=m.resolve(l),b=null,w=v.parse(i,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:a,to:s,preserveWhitespace:"pre"!=g.parent.type.whitespace||"full",findPositions:r,ruleFromNode:kn,context:g});if(r&&null!=r[0].pos){var k=r[0].pos,S=r[1]&&r[1].pos;null==S&&(S=k),b={anchor:k+l,head:S+l}}return{doc:w,sel:b,from:l,to:c}}(e,t,n),m=e.state.doc,v=m.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,d="end"):(f=e.state.selection.from,d="start"),e.input.lastKeyCode=null;var b=function(e,t,n,r,o){var i=e.findDiffStart(t,n);if(null==i)return null;var a=e.findDiffEnd(t,n+e.size,n+t.size),s=a.a,l=a.b;if("end"==o&&(r-=s+Math.max(0,i-Math.min(s,l))-i),s<i&&e.size<t.size){var c=r<=i&&r>=s?i-r:0;(i-=c)&&i<t.size&&On(t.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-s),s=i}else if(l<i){var u=r<=i&&r>=l?i-r:0;(i-=u)&&i<e.size&&On(e.textBetween(i-1,i+1))&&(i+=u?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}(v.content,p.doc.content,p.from,f,d);if(b&&e.input.domChangeCount++,(H&&e.input.lastIOSEnter>Date.now()-225||J)&&o.some((function(e){return 1==e.nodeType&&!Sn.test(e.nodeName)}))&&(!b||b.endA>=b.endB)&&e.someProp("handleKeyDown",(function(t){return t(e,R(13,"Enter"))})))e.input.lastIOSEnter=0;else{if(!b){if(!(r&&h instanceof g.TextSelection&&!h.empty&&h.$head.sameParent(h.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){var w=xn(e,e.state.doc,p.sel);if(w&&!w.eq(e.state.selection)){var k=e.state.tr.setSelection(w);i&&k.setMeta("composition",i),e.dispatch(k)}}return}b={start:h.from,endA:h.to,endB:h.to}}e.state.selection.from<e.state.selection.to&&b.start==b.endB&&e.state.selection instanceof g.TextSelection&&(b.start>e.state.selection.from&&b.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?b.start=e.state.selection.from:b.endA<e.state.selection.to&&b.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(b.endB+=e.state.selection.to-b.endA,b.endA=e.state.selection.to)),j&&F<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>p.from&&" "==p.doc.textBetween(b.start-p.from-1,b.start-p.from+1)&&(b.start--,b.endA--,b.endB--);var S,x=p.doc.resolveNoCache(b.start-p.from),C=p.doc.resolveNoCache(b.endB-p.from),O=m.resolve(b.start),M=x.sameParent(C)&&x.parent.inlineContent&&O.end()>=b.endA;if((H&&e.input.lastIOSEnter>Date.now()-225&&(!M||o.some((function(e){return"DIV"==e.nodeName||"P"==e.nodeName})))||!M&&x.pos<p.doc.content.size&&!x.sameParent(C)&&(S=g.Selection.findFrom(p.doc.resolve(x.pos+1),1,!0))&&S.head==C.pos)&&e.someProp("handleKeyDown",(function(t){return t(e,R(13,"Enter"))})))e.input.lastIOSEnter=0;else if(e.state.selection.anchor>b.start&&function(e,t,n,r,o){if(n-t<=o.pos-r.pos||Cn(r,!0,!1)<o.pos)return!1;var i=e.resolve(t);if(!r.parent.isTextblock){var a=i.nodeAfter;return null!=a&&n==t+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;var s=e.resolve(Cn(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||Cn(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(m,b.start,b.endA,x,C)&&e.someProp("handleKeyDown",(function(t){return t(e,R(8,"Backspace"))})))J&&L&&e.domObserver.suppressSelectionUpdates();else{L&&J&&b.endB==b.start&&(e.input.lastAndroidDelete=Date.now()),J&&!M&&x.start()!=C.start()&&0==C.parentOffset&&x.depth==C.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==b.endA&&(b.endB-=2,C=p.doc.resolveNoCache(b.endB-p.from),setTimeout((function(){e.someProp("handleKeyDown",(function(t){return t(e,R(13,"Enter"))}))}),20));var T,A,D,_=b.start,E=b.endA;if(M)if(x.pos==C.pos)j&&F<=11&&0==x.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((function(){return Le(e)}),20)),T=e.state.tr.delete(_,E),A=m.resolve(b.start).marksAcross(m.resolve(b.endA));else if(b.endA==b.endB&&(D=function(e,t){for(var n,r,o,i=e.firstChild.marks,a=t.firstChild.marks,s=i,l=a,c=0;c<a.length;c++)s=a[c].removeFromSet(s);for(var u=0;u<i.length;u++)l=i[u].removeFromSet(l);if(1==s.length&&0==l.length)r=s[0],n="add",o=function(e){return e.mark(r.addToSet(e.marks))};else{if(0!=s.length||1!=l.length)return null;r=l[0],n="remove",o=function(e){return e.mark(r.removeFromSet(e.marks))}}for(var f=[],d=0;d<t.childCount;d++)f.push(o(t.child(d)));if(y.Fragment.from(f).eq(e))return{mark:r,type:n}}(x.parent.content.cut(x.parentOffset,C.parentOffset),O.parent.content.cut(O.parentOffset,b.endA-O.start()))))T=e.state.tr,"add"==D.type?T.addMark(_,E,D.mark):T.removeMark(_,E,D.mark);else if(x.parent.child(x.index()).isText&&x.index()==C.index()-(C.textOffset?0:1)){var P=x.parent.textBetween(x.parentOffset,C.parentOffset);if(e.someProp("handleTextInput",(function(t){return t(e,_,E,P)})))return;T=e.state.tr.insertText(P,_,E)}if(T||(T=e.state.tr.replace(_,E,p.doc.slice(b.start-p.from,b.endB-p.from))),p.sel){var z=xn(e,T.doc,p.sel);z&&!(L&&J&&e.composing&&z.empty&&(b.start!=b.endB||e.input.lastAndroidDelete<Date.now()-100)&&(z.head==_||z.head==T.mapping.map(E)-1)||j&&z.empty&&z.head==_)&&T.setSelection(z)}A&&T.ensureMarks(A),i&&T.setMeta("composition",i),e.dispatch(T.scrollIntoView())}}}}(r,e,t,n,o)})),this.domObserver.start(),function(e){var t=function(){var t=kt[n];e.dom.addEventListener(n,e.input.eventHandlers[n]=function(n){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,n)||Tt(e,n)||!e.editable&&n.type in St||t(e,n)},xt[n]?{passive:!0}:void 0)};for(var n in kt)t();K&&e.dom.addEventListener("input",(function(){return null})),Mt(e)}(this),this.updatePluginViews()}return v(e,[{key:"composing",get:function(){return this.input.composing}},{key:"props",get:function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}},{key:"update",value:function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Mt(this);var t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Pn),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}},{key:"setProps",value:function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)}},{key:"updateState",value:function(e){this.updateStateInner(e,this._props)}},{key:"updateStateInner",value:function(e,t){var n,r=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(Bt(this),i=!0),this.state=e;var a=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){var s=En(this);(function(e,t){var n=0,r=0;for(var o in e){if(e[o]!=t[o])return!0;n++}for(var i in t)r++;return n!=r})(s,this.nodeViews)&&(this.nodeViews=s,o=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Mt(this),this.editable=_n(this),Dn(this);var l=dn(this),c=Rn(this),u=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",f=o||!this.docView.matchesNode(e.doc,c,l);!f&&e.selection.eq(r.selection)||(i=!0);var d,h,p,m,v,g,y,b,k,S,x="preserve"==u&&i&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,a=o+1;a<Math.min(innerHeight,r.bottom);a+=5){var s=e.root.elementFromPoint(i,a);if(s&&s!=e.dom&&e.dom.contains(s)){var l=s.getBoundingClientRect();if(l.top>=o-20){t=s,n=l.top;break}}}return{refDOM:t,refTop:n,stack:ee(e.dom)}}(this);if(i){this.domObserver.stop();var O=f&&(j||L)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&(m=r.selection,v=e.selection,g=Math.min(m.$anchor.sharedDepth(m.head),v.$anchor.sharedDepth(v.head)),m.$anchor.start(g)!=v.$anchor.start(g));if(f){var M=L?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){var t=e.domSelectionRange();if(!t.focusNode)return null;var n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=T(e=e.childNodes[t-1])}else{if(!e.parentNode||A(e))return null;t=w(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||A(e))return null;t=w(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){var o=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(e.input.compositionNode==r){var a=n.pmViewDesc;if(a&&a.isText(n.nodeValue))return r}}return n||r}(this)),!o&&this.docView.update(e.doc,c,l,this)||(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=xe(e.doc,c,l,this.dom,this)),M&&!this.trackWrites&&(O=!0)}O||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(d=this,h=d.docView.domFromPos(d.state.selection.anchor,0),p=d.domSelectionRange(),C(h.node,h.offset,p.anchorNode,p.anchorOffset)))?Le(this,O):(qe(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==u?this.dom.scrollTop=0:"to selection"==u?this.scrollToSelection():x&&(b=(y=x).refDOM,k=y.refTop,te(y.stack,0==(S=b?b.getBoundingClientRect().top:0)?0:S-k))}},{key:"scrollToSelection",value:function(){var e=this,t=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(function(t){return t(e)})));else if(this.state.selection instanceof g.NodeSelection){var n=this.docView.domAfterPos(this.state.selection.from);1==n.nodeType&&Z(this,n.getBoundingClientRect(),t)}else Z(this,this.coordsAtPos(this.state.selection.head,1),t)}},{key:"destroyPluginViews",value:function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()}},{key:"updatePluginViews",value:function(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var r=0;r<this.directPlugins.length;r++){var o=this.directPlugins[r];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(var i=0;i<this.state.plugins.length;i++){var a=this.state.plugins[i];a.spec.view&&this.pluginViews.push(a.spec.view(this))}}}},{key:"updateDraggedNode",value:function(e,t){var n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{var o=n.from+(this.state.doc.content.size-t.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==n.node&&(r=o)}this.dragging=new Ht(e.slice,e.move,r<0?void 0:g.NodeSelection.create(this.state.doc,r))}},{key:"someProp",value:function(e,t){var n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(var o=0;o<this.directPlugins.length;o++){var i=this.directPlugins[o].props[e];if(null!=i&&(n=t?t(i):i))return n}var a=this.state.plugins;if(a)for(var s=0;s<a.length;s++){var l=a[s].props[e];if(null!=l&&(n=t?t(l):l))return n}}},{key:"hasFocus",value:function(){if(j){var e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}},{key:"focus",value:function(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(ne)return e.focus(ne);var t=ee(e);e.focus(null==ne?{get preventScroll(){return ne={preventScroll:!0},!0}}:void 0),ne||(ne=!1,te(t,0))}(this.dom),Le(this),this.domObserver.start()}},{key:"root",get:function(){var e=this,t=this._root;if(null==t)for(var n,r=function(t){if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return t.ownerDocument.getSelection()}),{v:e._root=t}},o=this.dom.parentNode;o;o=o.parentNode)if(n=r(o))return n.v;return t||document}},{key:"updateRoot",value:function(){this._root=null}},{key:"posAtCoords",value:function(e){return ae(this,e)}},{key:"coordsAtPos",value:function(e){return ue(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)}},{key:"domAtPos",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.domFromPos(e,t)}},{key:"nodeDOM",value:function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null}},{key:"posAtDOM",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}},{key:"endOfTextblock",value:function(e,t){return function(e,t,n){return me==t&&ve==n?ge:(me=t,ve=n,ge="up"==n||"down"==n?function(e,t,n){var r=t.selection,o="up"==n?r.$from:r.$to;return he(e,t,(function(){for(var t=e.docView.domFromPos(o.pos,"up"==n?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.contentDOM||r.dom;break}t=r.dom.parentNode}for(var i=ue(e,o.pos,1),a=t.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=x(a,0,a.nodeValue.length).getClientRects()}for(var l=0;l<s.length;l++){var c=s[l];if(c.bottom>c.top+1&&("up"==n?i.top-c.top>2*(c.bottom-i.top):c.bottom-i.bottom>2*(i.bottom-c.top)))return!1}}return!0}))}(e,t,n):function(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,a=o==r.parent.content.size,s=e.domSelection();return s?pe.test(r.parent.textContent)&&s.modify?he(e,t,(function(){var t=e.domSelectionRange(),o=t.focusNode,i=t.focusOffset,a=t.anchorNode,l=t.anchorOffset,c=s.caretBidiLevel;s.modify("move",n,"character");var u=r.depth?e.docView.domAfterPos(r.before()):e.dom,f=e.domSelectionRange(),d=f.focusNode,h=f.focusOffset,p=d&&!u.contains(1==d.nodeType?d:d.parentNode)||o==d&&i==h;try{s.collapse(a,l),o&&(o!=a||i!=l)&&s.extend&&s.extend(o,i)}catch(e){}return null!=c&&(s.caretBidiLevel=c),p})):"left"==n||"backward"==n?i:a:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}},{key:"pasteHTML",value:function(e,t){return Vt(this,"",e,!1,t||new ClipboardEvent("paste"))}},{key:"pasteText",value:function(e,t){return Vt(this,e,null,!0,t||new ClipboardEvent("paste"))}},{key:"destroy",value:function(){this.docView&&(function(e){for(var t in e.domObserver.stop(),e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],dn(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,S=null)}},{key:"isDestroyed",get:function(){return null==this.docView}},{key:"dispatchEvent",value:function(e){return function(e,t){Tt(e,t)||!kt[t.type]||!e.editable&&t.type in St||kt[t.type](e,t)}(this,e)}},{key:"dispatch",value:function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}},{key:"domSelectionRange",value:function(){var e=this.domSelection();return e?K&&11===this.root.nodeType&&function(e){for(var t=e.activeElement;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){var n=t.getComposedRanges(e.root)[0];if(n)return bn(e,n)}var r;function o(e){e.preventDefault(),e.stopImmediatePropagation(),r=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",o,!0),r?bn(e,r):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}},{key:"domSelection",value:function(){return this.root.getSelection()}}]),e}();function Rn(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var r in n)"class"==r?t.class+=" "+n[r]:"style"==r?t.style=(t.style?t.style+";":"")+n[r]:t[r]||"contenteditable"==r||"nodeName"==r||(t[r]=String(n[r]))})),t.translate||(t.translate="no"),[Yt.node(0,e.state.doc.content.size,t)]}function Dn(e){if(e.markCursor){var t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Yt.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function _n(e){return!e.someProp("editable",(function(t){return!1===t(e.state)}))}function En(e){var t=Object.create(null);function n(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function Pn(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}t.Decoration=Yt,t.DecorationSet=en,t.EditorView=Nn,t.__endComposition=An,t.__parseFromClipboard=Tn,t.__serializeForClipboard=Mn},3958:e=>{var t=200,n=function(){};n.prototype.append=function(e){return e.length?(e=n.from(e),!this.length&&e||e.length<t&&this.leafAppend(e)||this.length<t&&e.leafPrepend(this)||this.appendInner(e)):this},n.prototype.prepend=function(e){return e.length?n.from(e).append(this):this},n.prototype.appendInner=function(e){return new o(this,e)},n.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?n.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},n.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},n.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},n.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},n.from=function(e){return e instanceof n?e:e&&e.length?new r(e):n.empty};var r=function(e){function n(t){e.call(this),this.values=t}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var r={length:{configurable:!0},depth:{configurable:!0}};return n.prototype.flatten=function(){return this.values},n.prototype.sliceInner=function(e,t){return 0==e&&t==this.length?this:new n(this.values.slice(e,t))},n.prototype.getInner=function(e){return this.values[e]},n.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},n.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},n.prototype.leafAppend=function(e){if(this.length+e.length<=t)return new n(this.values.concat(e.flatten()))},n.prototype.leafPrepend=function(e){if(this.length+e.length<=t)return new n(e.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(n.prototype,r),n}(n);n.empty=new r([]);var o=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(n);e.exports=n},6691:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});for(var n={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},r={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},o="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),i="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),a=0;a<10;a++)n[48+a]=n[96+a]=String(a);for(a=1;a<=24;a++)n[a+111]="F"+a;for(a=65;a<=90;a++)n[a]=String.fromCharCode(a+32),r[a]=String.fromCharCode(a);for(var s in n)r.hasOwnProperty(s)||(r[s]=n[s]);t.base=n,t.keyName=function(e){var t=!(o&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||i&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?r:n)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t},t.shift=r},7582:(e,t,n)=>{n.r(t),n.d(t,{__addDisposableResource:()=>z,__assign:()=>i,__asyncDelegator:()=>O,__asyncGenerator:()=>C,__asyncValues:()=>M,__await:()=>x,__awaiter:()=>p,__classPrivateFieldGet:()=>_,__classPrivateFieldIn:()=>P,__classPrivateFieldSet:()=>E,__createBinding:()=>v,__decorate:()=>s,__disposeResources:()=>j,__esDecorate:()=>c,__exportStar:()=>g,__extends:()=>o,__generator:()=>m,__importDefault:()=>D,__importStar:()=>R,__makeTemplateObject:()=>T,__metadata:()=>h,__param:()=>l,__propKey:()=>f,__read:()=>b,__rest:()=>a,__rewriteRelativeImportExtension:()=>F,__runInitializers:()=>u,__setFunctionName:()=>d,__spread:()=>w,__spreadArray:()=>S,__spreadArrays:()=>k,__values:()=>y,default:()=>B});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)};function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function s(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function l(e,t){return function(n,r){t(n,r,e)}}function c(e,t,n,r,o,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=r.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?r.static?e:e.prototype:null,f=t||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),d=!1,h=n.length-1;h>=0;h--){var p={};for(var m in r)p[m]="access"===m?{}:r[m];for(var m in r.access)p.access[m]=r.access[m];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var v=(0,n[h])("accessor"===l?{get:f.get,set:f.set}:f[c],p);if("accessor"===l){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(s=a(v.get))&&(f.get=s),(s=a(v.set))&&(f.set=s),(s=a(v.init))&&o.unshift(s)}else(s=a(v))&&("field"===l?o.unshift(s):f[c]=s)}u&&Object.defineProperty(u,r.name,f),d=!0}function u(e,t,n){for(var r=arguments.length>2,o=0;o<t.length;o++)n=r?t[o].call(e,n):t[o].call(e);return r?n:void 0}function f(e){return"symbol"==typeof e?e:"".concat(e)}function d(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function p(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))}function m(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}var v=Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]};function g(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||v(t,e,n)}function y(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function b(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function w(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(b(arguments[t]));return e}function k(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}function S(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function x(e){return this instanceof x?(this.v=e,this):new x(e)}function C(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),i=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),r[Symbol.asyncIterator]=function(){return this},r;function a(e,t){o[e]&&(r[e]=function(t){return new Promise((function(n,r){i.push([e,t,n,r])>1||s(e,t)}))},t&&(r[e]=t(r[e])))}function s(e,t){try{(n=o[e](t)).value instanceof x?Promise.resolve(n.value.v).then(l,c):u(i[0][2],n)}catch(e){u(i[0][3],e)}var n}function l(e){s("next",e)}function c(e){s("throw",e)}function u(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function O(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,o){t[r]=e[r]?function(t){return(n=!n)?{value:x(e[r](t)),done:!1}:o?o(t):t}:o}}function M(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=y(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){!function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)}(r,o,(t=e[n](t)).done,t.value)}))}}}function T(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var A=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},N=function(e){return N=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},N(e)};function R(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=N(e),r=0;r<n.length;r++)"default"!==n[r]&&v(t,e,n[r]);return A(t,e),t}function D(e){return e&&e.__esModule?e:{default:e}}function _(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function E(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}function P(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function z(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var r,o;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(void 0===r){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],n&&(o=r)}if("function"!=typeof r)throw new TypeError("Object not disposable.");o&&(r=function(){try{o.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}var I="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var r=new Error(n);return r.name="SuppressedError",r.error=e,r.suppressed=t,r};function j(e){function t(t){e.error=e.hasError?new I(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var n,r=0;return function o(){for(;n=e.stack.pop();)try{if(!n.async&&1===r)return r=0,e.stack.push(n),Promise.resolve().then(o);if(n.dispose){var i=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(i).then(o,(function(e){return t(e),o()}))}else r|=1}catch(e){t(e)}if(1===r)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function F(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,(function(e,n,r,o,i){return n?t?".jsx":".js":!r||o&&i?r+o+"."+i.toLowerCase()+"js":e})):e}const B={__extends:o,__assign:i,__rest:a,__decorate:s,__param:l,__esDecorate:c,__runInitializers:u,__propKey:f,__setFunctionName:d,__metadata:h,__awaiter:p,__generator:m,__createBinding:v,__exportStar:g,__values:y,__read:b,__spread:w,__spreadArrays:k,__spreadArray:S,__await:x,__asyncGenerator:C,__asyncDelegator:O,__asyncValues:M,__makeTemplateObject:T,__importStar:R,__importDefault:D,__classPrivateFieldGet:_,__classPrivateFieldSet:E,__classPrivateFieldIn:P,__addDisposableResource:z,__disposeResources:j,__rewriteRelativeImportExtension:F}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}return n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(6608)})()));
|