PageSourceSearch

https://www.foodtalkdaily.com/resources/combined/js/vendors-node_m…-bold-fbdb81.42d071fda032b13898f2.bundle.js

js foodtalkdaily.com collected 2026-09-24 08:45:58 UTC 277,357 bytes, 1 lines download raw bytes

1"use strict";(self.hometalkChunk=self.hometalkChunk||[]).push([["vendors-node_modules_tiptap_react_dist_tiptap-react_esm_js-node_modules_tiptap_extension-bold-fbdb81"],{1575(e,t,n){n.d(t,{Lz:()=>nn,NZ:()=>$t,zF:()=>Ft});var r=n(42845),o=n(58903),i=n(38262);const s=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},l=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let a=null;const c=function(e,t,n){let r=a||(a=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},d=function(e,t,n,r){return n&&(p(e,t,n,r,-1)||p(e,t,n,r,1))},h=/^(img|br|input|textarea|hr)$/i;function p(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:u(e))){let n=e.parentNode;if(!n||1!=n.nodeType||f(e)||h.test(e.nodeName)||"false"==e.contentEditable)return!1;t=s(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(o<0?-1:0)]).contentEditable)return!1;t=o<0?u(e):0}}}function u(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function f(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const m=function(e){return e.focusNode&&d(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function g(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const y="undefined"!=typeof navigator?navigator:null,w="undefined"!=typeof document?document:null,b=y&&y.userAgent||"",v=/Edge\/(\d+)/.exec(b),k=/MSIE \d/.exec(b),S=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(b),x=!!(k||S||v),M=k?document.documentMode:S?+S[1]:v?+v[1]:0,C=!x&&/gecko\/(\d+)/i.test(b);C&&(/Firefox\/(\d+)/.exec(b)||[0,0])[1];const O=!x&&/Chrome\/(\d+)/.exec(b),N=!!O,T=O?+O[1]:0,A=!x&&!!y&&/Apple Computer/.test(y.vendor),E=A&&(/Mobile\/\w+/.test(b)||!!y&&y.maxTouchPoints>2),D=E||!!y&&/Mac/.test(y.platform),R=/Android \d/.test(b),$=!!w&&"webkitFontSmoothing"in w.documentElement.style,z=$?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function I(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function F(e,t){return"number"==typeof e?e:e[t]}function P(e){let 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 B(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;s=l(s)){if(1!=s.nodeType)continue;let e=s,n=e==i.body,l=n?I(i):P(e),a=0,c=0;if(t.top<l.top+F(r,"top")?c=-(l.top-t.top+F(o,"top")):t.bottom>l.bottom-F(r,"bottom")&&(c=t.bottom-l.bottom+F(o,"bottom")),t.left<l.left+F(r,"left")?a=-(l.left-t.left+F(o,"left")):t.right>l.right-F(r,"right")&&(a=t.right-l.right+F(o,"right")),a||c)if(n)i.defaultView.scrollBy(a,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),a&&(e.scrollLeft+=a);let o=e.scrollLeft-n,i=e.scrollTop-r;t={left:t.left-o,top:t.top-i,right:t.right-o,bottom:t.bottom-i}}if(n)break}}function L(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=l(r));return t}function V(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let J=null;function K(e,t){let n,r,o=2e8,i=0,s=t.top,l=t.top;for(let a=e.firstChild,d=0;a;a=a.nextSibling,d++){let e;if(1==a.nodeType)e=a.getClientRects();else{if(3!=a.nodeType)continue;e=c(a).getClientRects()}for(let c=0;c<e.length;c++){let h=e[c];if(h.top<=s&&h.bottom>=l){s=Math.max(h.bottom,s),l=Math.min(h.top,l);let e=h.left>t.left?h.left-t.left:h.right<t.left?t.left-h.right:0;if(e<o){n=a,o=e,r=e&&3==n.nodeType?{left:h.right<t.left?h.right:h.left,top:t.top}:t,1==a.nodeType&&e&&(i=d+(t.left>=(h.left+h.right)/2?1:0));continue}}!n&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(i=d+1)}}return n&&3==n.nodeType?function(e,t){let n=e.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=_(r,1);if(n.top!=n.bottom&&j(t,n))return{node:e,offset:o+(t.left>=(n.left+n.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:e,offset:i}:K(n,r)}function j(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>
1=t.top-1&&e.top<=t.bottom+1}function H(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let o=e[r];if(j(t,o))return H(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function W(e,t){let n,r=e.dom.ownerDocument,o=0;if(r.caretPositionFromPoint)try{let e=r.caretPositionFromPoint(t.left,t.top);e&&({offsetNode:n,offset:o}=e)}catch(c){}if(!n&&r.caretRangeFromPoint){let e=r.caretRangeFromPoint(t.left,t.top);e&&({startContainer:n,startOffset:o}=e)}let i,s=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!s||!e.dom.contains(1!=s.nodeType?s.parentNode:s)){let n=e.dom.getBoundingClientRect();if(!j(t,n))return null;if(s=H(e.dom,t,n),!s)return null}if(A)for(let d=s;n&&d;d=l(d))d.draggable&&(n=void 0);if(s=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(s,t),n){if(C&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(i=function(e,t,n,r){let o=-1;for(let i=t;i!=e.dom;){let t=e.docView.nearestDesc(i,!0);if(!t)return null;if(t.node.isBlock&&t.parent){let e=t.dom.getBoundingClientRect();if(e.left>r.left||e.top>r.top)o=t.posBefore;else{if(!(e.right<r.left||e.bottom<r.top))break;o=t.posAfter}}i=t.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,1)}(e,n,o,t))}null==i&&(i=function(e,t,n){let{node:r,offset:o}=K(t,n),i=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}(e,s,t));let a=e.docView.nearestDesc(s,!0);return{pos:i,inside:a?a.posAtStart-a.border:-1}}function _(e,t){let n=e.getClientRects();return n.length?n[t<0?0:n.length-1]:e.getBoundingClientRect()}const q=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function U(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=$||C;if(3==r.nodeType){if(!s||!q.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,G(_(c(r,e,t),1),i<0)}{let e=_(c(r,o,o),n);if(C&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=_(c(r,o-1,o-1),-1);if(t.top==e.top){let n=_(c(r,o,o+1),-1);if(n.top!=e.top)return G(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==u(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return X(e.getBoundingClientRect(),!1)}if(null==i&&o<u(r)){let e=r.childNodes[o];if(1==e.nodeType)return X(e.getBoundingClientRect(),!0)}return X(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==u(r))){let e=r.childNodes[o-1],t=3==e.nodeType?c(e,u(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return G(_(t,1),!1)}if(null==i&&o<u(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?c(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return G(_(t,-1),!0)}return G(_(3==r.nodeType?c(r):r,-n),n>=0)}function G(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function X(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Z(e,t,n){let 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()}}const Y=/[\u0590-\u08ac]/;let Q=null,ee=null,te=!1;class ne{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>s(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let 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}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let o=0;n<this.children.length;n++){let t=this.children[n],i=o+t.size;if(i>e||t instanceof ce){r=e-o;break}o=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let o;n&&!(o=this.children[n-1]).size&&o instanceof re&&o.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?s(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?s(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,l=0;;l++){let n=this.children[l],a=i+n.size;if(-1==r&&e<=a){let o=i+n.border;if(e>=o&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=l;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=s(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||l==this.children.length-1)){t=a;for(let e=l+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=s(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let s=0,d=0;s<this.children.length;s++){let l=this.children[s],a=d+l.size;if(o>d&&i<a)return l.setSelection(e-d-l.border,t-d-l.border,n,r);d=a}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=n.getSelection(),h=!1;if((C||A)&&e==t){let{node:e,offset:t}=l;if(3==e.nodeType){if(h=!(!t||"\n"!=e.nodeValue[t-1]),h&&t==e.nodeValue.length)for(let n,r=e;r;r=r.parentNode){if(n=r.nextSibling){"BR"==n.nodeName&&(l=a={node:n.parentNode,offset:s(n)+1});break}
1let e=r.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];h=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(C&&c.focusNode&&c.focusNode!=a.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||h&&A)&&d(l.node,l.offset,c.anchorNode,c.anchorOffset)&&d(a.node,a.offset,c.focusNode,c.focusOffset))return;let p=!1;if((c.extend||e==t)&&!h){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),p=!0}catch(u){}}if(!p){if(e>t){let e=l;l=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,s=i-o.border;if(e>=r&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=r||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class re extends ne{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r)),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class oe extends ne{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class ie extends ne{constructor(e,t,n,r){super(e,[],n,r),this.mark=t}static create(e,t,n,r){let i=r.nodeViews[t.type.name],s=i&&i(t,r,n);return s&&s.dom||(s=o.ZF.renderSpec(document,t.type.spec.toDOM(t,n))),new ie(e,t,s.dom,s.contentDOM||s.dom)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM||void 0}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=ie.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=Se(o,t,i,n)),e>0&&(o=Se(o,0,e,n));for(let s=0;s<o.length;s++)o[s].parent=r;return r.children=o,r}}class se extends ne{constructor(e,t,n,r,o,i,s,l,a){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s,i&&this.updateChildren(l,a)}static create(e,t,n,r,i,s){let l,a=i.nodeViews[t.type.name],c=a&&a(t,i,()=>l?l.parent?l.parent.posBeforeChild(l):void 0:s,n,r),d=c&&c.dom,h=c&&c.contentDOM;if(t.isText)if(d){if(3!=d.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else d=document.createTextNode(t.text);else d||({dom:d,contentDOM:h}=o.ZF.renderSpec(document,t.type.spec.toDOM(t)));h||t.isText||"BR"==d.nodeName||(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let p=d;return d=ye(d,n,t),c?l=new de(e,t,n,r,d,h||null,p,c,i,s+1):t.isText?new ae(e,t,n,r,d,p,i):new se(e,t,n,r,d,h||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;
1let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>o.FK.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&we(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new ve(this,s&&s.node,e);!function(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,o,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){if(s<o.length&&o[s].to==i){let e,t=o[s++];for(;s<o.length&&o[s].to==i;)(e||(e=[t])).push(o[s++]);if(e){e.sort(ke);for(let t=0;t<e.length;t++)n(e[t],c,!!a)}else n(t,c,!!a)}let d,h;if(a)h=-1,d=a,a=null;else{if(!(c<e.childCount))break;h=c,d=e.child(c++)}for(let e=0;e<l.length;e++)l[e].to<=i&&l.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let p=i+d.nodeSize;if(d.isText){let e=p;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<l.length;t++)l[t].to<e&&(e=l[t].to);e<p&&(a=d.cut(e-i),d=d.cut(0,e-i),p=e,h=-1)}r(d,d.isInline&&!d.isLeaf?l.filter(e=>!e.inline):l.slice(),t.forChild(i,d),h),i=p}}(this.node,this.innerDeco,(t,i,s)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!s&&a.syncToMarks(i==this.node.childCount?o.CU.none:this.node.child(i).marks,n,e),a.placeWidget(t,e,r)},(t,o,s,c)=>{let d;a.syncToMarks(t.marks,n,e),a.findNodeMatch(t,o,s,c)||l&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(d=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(t,o,s,d,e)||a.updateNextNode(t,o,s,e,c)||a.addNode(t,o,s,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(s&&this.protectLocalComposition(e,s),he(this.contentDOM,this.children,e),E&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:o}=e.state.selection;if(!(e.state.selection instanceof r.U3)||n<t||o>t+this.node.content.size)return null;let i=e.domSelectionRange(),s=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];t=u(e=e.childNodes[t-1])}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(i.focusNode,i.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let e=s.nodeValue,r=function(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;a+=t.text}if(i>=n){let e=l<r?a.lastIndexOf(t,r-l-1):-1;if(e>=0&&e+t.length+l>=n)return l+e;if(n==r&&a.length>=r+t.length-l&&a.slice(r-l,r-l+t.length)==t)return r}}return-1}(this.node.content,e,n-t,o-t);return r<0?null:{node:s,pos:r,text:e}}return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new oe(this,o,t,r);e.input.compositionNodes.push(i),this.children=Se(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node)||(this.updateInner(e,t,n,r),0))}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(we(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=me(this.dom,this.nodeDOM,fe(this.outerDeco,this.node,t),fe(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function le(e,t,n,r,o){return ye(r,t,e),new se(void 0,e,t,n,r,r,r,o,0)}class ae extends se{constructor(e,t,n,r,o,i,s){super(e,t,n,r,o,null,i,s,0
1)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(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))}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new ae(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}}class ce extends ne{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class de extends se{constructor(e,t,n,r,o,i,s,l,a,c){super(e,t,n,r,o,i,s,a,c),this.spec=l}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function he(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],l=s.dom;if(l.parentNode==e){for(;l!=r;)r=be(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(l,r);if(s instanceof ie){let t=r?r.previousSibling:e.lastChild;he(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=be(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const pe=function(e){e&&(this.nodeName=e)};pe.prototype=Object.create(null);const ue=[new pe];function fe(e,t,n){if(0==e.length)return ue;let r=n?ue[0]:new pe,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new pe(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new pe(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function me(e,t,n,r){if(n==ue&&r==ue)return t;let o=t;for(let i=0;i<r.length;i++){let t=r[i],s=n[i];if(i){let n;s&&s.nodeName==t.nodeName&&o!=e&&(n=o.parentNode)&&n.nodeName.toLowerCase()==t.nodeName||(n=document.createElement(t.nodeName),n.pmIsDeco=!0,n.appendChild(o),s=ue[0]),o=n}ge(o,s||ue[0],t)}return o}function ge(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function ye(e,t,n){return me(e,e,ue,fe(t,n,1!=e.nodeType))}function we(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function be(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class ve{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let l;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof ie)){l=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=e.child(o-1))break;--o,i.set(l,o),s.push(l)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let r=0,o=this.stack.length>>1,i=Math.min(o,e.length);for(;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);let r=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++)if(this.top.children[t].matchesMark(e[o])){r=t;break}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];
1else{let r=ie.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let 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(let s=this.index,l=Math.min(this.top.children.length,s+5);s<l;s++){let r=this.top.children[s];if(r.matchesNode(e,t,n)&&!this.preMatch.matched.has(r)){i=s;break}}return!(i<0||(this.destroyBetween(this.index,i),this.index++,0))}updateNodeAt(e,t,n,r,o){let 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)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o){for(let i=this.index;i<this.top.children.length;i++){let s=this.top.children[i];if(s instanceof se){let l=this.preMatch.matched.get(s);if(null!=l&&l!=o)return!1;let a=s.dom;if((!this.lock||!(a==this.lock||1==a.nodeType&&a.contains(this.lock.parentNode))||e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&3!=s.dirty&&we(t,s.outerDeco))&&s.update(e,t,n,r))return this.destroyBetween(this.index,i),s.dom!=a&&(this.changed=!0),this.index++,!0;break}}return!1}addNode(e,t,n,r,o){this.top.children.splice(this.index++,0,se.create(this.top,e,t,n,r,o)),this.changed=!0}placeWidget(e,t,n){let 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){let r=new re(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof ie;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof ae)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((A||N)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new ce(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}}function ke(e,t){return e.type.side-t.type.side}function Se(e,t,n,r,o){let i=[];for(let s=0,l=0;s<e.length;s++){let a=e[s],c=l,d=l+=a.size;c>=n||d<=t?i.push(a):(c<t&&i.push(a.slice(0,t-c,r)),o&&(i.push(o),o=void 0),d>n&&i.push(a.slice(n-c,a.size,r)))}return i}function xe(e,t=null){let n=e.domSelectionRange(),o=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),l=i&&0==i.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let c,d,h=o.resolve(a);if(m(n)){for(c=h;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&r.nh.isSelectable(e)&&i.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==u(e);r||o;){if(e==n)return!0;let t=s(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==u(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;d=new r.nh(a==e?h:o.resolve(e))}}else{let t=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(t<0)return null;c=o.resolve(t)}return d||(d=Re(e,c,h,"pointer"==t||e.state.selection.head<h.pos&&!l?1:-1)),d}function Me(e){return e.editable?e.hasFocus():ze(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Ce(e,t=!1){let n=e.state.selection;if(Ee(e,n),Me(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&N){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&d(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection(),n=document.createRange(),r=e.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,s(r)+1):n.setEnd(r,0),n.collapse(!1),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&x&&M<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{let o,i,{anchor:s,head:l}=n;!Oe||n instanceof r.U3||(n.$from.parent.inlineContent||(o=Ne(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=Ne(e,n.to))
1),e.docView.setSelection(s,l,e.root,t),Oe&&(o&&Ae(o),i&&Ae(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{Me(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Oe=A||N&&T<63;function Ne(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(A&&o&&"false"==o.contentEditable)return Te(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return Te(o);if(i)return Te(i)}}function Te(e){return e.contentEditable="true",A&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Ae(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Ee(e,t){if(t instanceof r.nh){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(De(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else De(e)}function De(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Re(e,t,n,o){return e.someProp("createSelectionBetween",r=>r(e,t,n))||r.U3.between(t,n,o)}function $e(e){return!(e.editable&&!e.hasFocus())&&ze(e)}function ze(e){let 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(n){return!1}}function Ie(e,t){let{$anchor:n,$head:o}=e.selection,i=t>0?n.max(o):n.min(o),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&r.LN.findFrom(s,t)}function Fe(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Pe(e,t,n){let o=e.state.selection;if(!(o instanceof r.U3)){if(o instanceof r.nh&&o.node.isInline)return Fe(e,new r.U3(t>0?o.$to:o.$from));{let n=Ie(e.state,t);return!!n&&Fe(e,n)}}if(!o.empty||n.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"right":"left")){let n=Ie(e.state,t);return!!(n&&n instanceof r.nh)&&Fe(e,n)}if(!(D&&n.indexOf("m")>-1)){let n,i=o.$head,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText)return!1;let l=t<0?i.pos-s.nodeSize:i.pos;return!!(s.isAtom||(n=e.docView.descAt(l))&&!n.contentDOM)&&(r.nh.isSelectable(s)?Fe(e,new r.nh(t<0?e.state.doc.resolve(i.pos-s.nodeSize):i)):!!$&&Fe(e,new r.U3(e.state.doc.resolve(t<0?l:l+s.nodeSize))))}}function Be(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Le(e){let t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function Ve(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,l=!1;for(C&&1==n.nodeType&&r<Be(n)&&Le(n.childNodes[r])&&(l=!0);;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(Le(e))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(Ke(n))break;{let t=n.previousSibling;for(;t&&Le(t);)o=n.parentNode,i=s(t),t=t.previousSibling;if(t)n=t,r=Be(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}l?je(e,n,r):o&&je(e,o,i)}function Je(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,l=Be(n);for(;;)if(r<l){if(1!=n.nodeType)break;if(!Le(n.childNodes[r]))break;o=n,i=++r}else{if(Ke(n))break;{let t=n.nextSibling;for(;t&&Le(t);)o=t.parentNode,i=s(t)+1,t=t.nextSibling;if(t)n=t,r=0,l=Be(n);else{if(n=n.parentNode,n==e.dom)break;r=l=0}}}o&&je(e,o,i)}function Ke(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function je(e,t,n){let r=e.domSelection();if(m(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&Ce(e)},50)}function He(e,t,n){let o=e.state.selection;if(o instanceof r.U3&&!o.empty||n.indexOf("s")>-1)return!1;if(D&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=o;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=Ie(e.state,t);if(n&&n instanceof r.nh)return Fe(e,n)}if(!i.parent.inlineContent){let n=t<0?i:s,l=o instanceof r.i5?r.LN.near
1(n,t):r.LN.findFrom(n,t);return!!l&&Fe(e,l)}return!1}function We(e,t){if(!(e.state.selection instanceof r.U3))return!0;let{$head:n,$anchor:o,empty:i}=e.state.selection;if(!n.sameParent(o))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let s=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let r=e.state.tr;return t<0?r.delete(n.pos-s.nodeSize,n.pos):r.delete(n.pos,n.pos+s.nodeSize),e.dispatch(r),!0}return!1}function _e(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function qe(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:s}=t;for(;i>1&&s>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,s--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let l=e.someProp("clipboardSerializer")||o.ZF.fromSchema(e.state.schema),a=rt(),c=a.createElement("div");c.appendChild(l.serializeFragment(r,{document:a}));let d,h=c.firstChild,p=0;for(;h&&1==h.nodeType&&(d=tt[h.nodeName.toLowerCase()]);){for(let e=d.length-1;e>=0;e--){let t=a.createElement(d[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),p++}h=c.firstChild}return h&&1==h.nodeType&&h.setAttribute("data-pm-slice",`${i} ${s}${p?` -${p}`:""} ${JSON.stringify(n)}`),{dom:c,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n")}}function Ue(e,t,n,r,i){let s,l,a=i.parent.type.spec.code;if(!n&&!t)return null;let c=t&&(r||a||!n);if(c){if(e.someProp("transformPastedText",n=>{t=n(t,a||r,e)}),a)return t?new o.Ji(o.FK.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):o.Ji.empty;let n=e.someProp("clipboardTextParser",n=>n(t,i,r,e));if(n)l=n;else{let n=i.marks(),{schema:r}=e.state,l=o.ZF.fromSchema(r);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(l.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),s=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=rt().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);if((n=o&&tt[o[1].toLowerCase()])&&(e=n.map(e=>"<"+e+">").join("")+e+n.map(e=>"</"+e+">").reverse().join("")),r.innerHTML=e,n)for(let i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n),$&&function(e){let t=e.querySelectorAll(N?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(s);let d=s&&s.querySelector("[data-pm-slice]"),h=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let o=+h[3];o>0;o--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(!l){let t=e.someProp("clipboardParser")||e.someProp("domParser")||o.S4.fromSchema(e.state.schema);l=t.parseSlice(s,{preserveWhitespace:!(!c&&!h),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Ge.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(h)l=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(a){return e}let{content:i,openStart:s,openEnd:l}=e;for(let c=n.length-2;c>=0;c-=2){let e=r.nodes[n[c]];if(!e||e.hasRequiredAttrs())break;i=o.FK.from(e.create(n[c+1],i)),s++,l++}return new o.Ji(i,s,l)}(et(l,+h[1],+h[2]),h[4]);else if(l=o.Ji.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,i=t.node(n).contentMatchAt(t.index(n)),s=[];if(e.forEach(e=>{if(!s)return;let t,n=i.findWrapping(e.type);if(!n)return s=null;if(t=s.length&&r.length&&Ze(n,r,e,s[s.length-1],0))s[s.length-1]=t;else{s.length&&(s[s.length-1]=Ye(s[s.length-1],r.length));let t=Xe(e,n);s.push(t),i=i.matchType(t.type),r=n}}),s)return o.FK.from(s)}return e}(l.content,i),!0),l.openStart||l.openEnd){let e=0,t=0;for(let n=l.content.firstChild;e<l.openStart&&!n.type.spec.isolating;e++,n=n.firstChild);for(let n=l.content.lastChild;t<l.openEnd&&!n.type.spec.isolating;t++,n=n.lastChild);l=et(l,e,t)}return e.someProp("transformPasted",t=>{l=t(l,e)}),l}const Ge=/^(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 Xe(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,o.FK.from(e));return e}function Ze(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let s=Ze(e,t,n,r.last
1Child,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(o.FK.from(Xe(n,e,i+1))))}}function Ye(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,Ye(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(o.FK.empty,!0);return e.copy(n.append(r))}function Qe(e,t,n,r,i,s){let l=t<0?e.firstChild:e.lastChild,a=l.content;return i<r-1&&(a=Qe(a,t,n,r,i+1,s)),i>=n&&(a=t<0?l.contentMatchAt(0).fillBefore(a,e.childCount>1||s<=i).append(a):a.append(l.contentMatchAt(l.childCount).fillBefore(o.FK.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,l.copy(a))}function et(e,t,n){return t<e.openStart&&(e=new o.Ji(Qe(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new o.Ji(Qe(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const tt={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let nt=null;function rt(){return nt||(nt=document.implementation.createHTMLDocument("title"))}const ot={},it={},st={touchstart:!0,touchmove:!0};class lt{constructor(){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.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function at(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ct(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>dt(e,t))})}function dt(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function ht(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function pt(e){return{left:e.clientX,top:e.clientY}}function ut(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(e.someProp(t,t=>s>i.depth?t(e,n,i.nodeAfter,i.before(s),o,!0):t(e,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function ft(e,t,n){e.focused||e.focus();let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function mt(e,t,n,r){return ut(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function gt(e,t,n,o){return ut(e,"handleTripleClickOn",t,n,o)||e.someProp("handleTripleClick",n=>n(e,t,o))||function(e,t,n){if(0!=n.button)return!1;let o=e.state.doc;if(-1==t)return!!o.inlineContent&&(ft(e,r.U3.create(o,0,o.content.size),"pointer"),!0);let i=o.resolve(t);for(let s=i.depth+1;s>0;s--){let t=s>i.depth?i.nodeAfter:i.node(s),n=i.before(s);if(t.inlineContent)ft(e,r.U3.create(o,n+1,n+1+t.content.size),"pointer");else{if(!r.nh.isSelectable(t))continue;ft(e,r.nh.create(o,n),"pointer")}return!0}}(e,n,o)}function yt(e){return Mt(e)}it.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!vt(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!R||!N||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!E||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",t=>t(e,n))||function(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);return 8==n||D&&72==n&&"c"==r?We(e,-1)||Ve(e):46==n||D&&68==n&&"c"==r?We(e,1)||Je(e):13==n||27==n||(37==n||D&&66==n&&"c"==r?Pe(e,-1,r)||Ve(e):39==n||D&&70==n&&"c"==r?Pe(e,1,r)||Je(e):38==n||D&&80==n&&"c"==r?He(e,-1,r)||Ve(e):40==n||D&&78==n&&"c"==r?function(e){if(!A||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;_e(e,n,"true"),setTimeout(()=>_e(e,n,"false"),20)}return!1}(e)||He(e,1,r)||Je(e):r==(D?"m":"c")&&(66==n||73==n||89==n||90==n))}
1(e,n)?n.preventDefault():at(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,g(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},it.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},it.keypress=(e,t)=>{let n=t;if(vt(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||D&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let o=e.state.selection;if(!(o instanceof r.U3&&o.$from.sameParent(o.$to))){let t=String.fromCharCode(n.charCode);e.someProp("handleTextInput",n=>n(e,o.$from.pos,o.$to.pos,t))||e.dispatch(e.state.tr.insertText(t).scrollIntoView()),n.preventDefault()}};const wt=D?"metaKey":"ctrlKey";ot.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=yt(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[wt]&&("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};let s=e.posAtCoords(pt(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new bt(e,s,n,!!r)):("doubleClick"==i?mt:gt)(e,s.pos,s.inside,n)?n.preventDefault():at(e,"pointer"))};class bt{constructor(e,t,n,o){let i,s;if(this.view=e,this.pos=t,this.event=n,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[wt],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,s=n.depth?n.before():0}const l=o?null:n.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a?a.dom:null;let{selection:c}=e.state;(0==n.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||c instanceof r.nh&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!C||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(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),at(e,"pointer")}done(){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(()=>Ce(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(pt(e))),this.updateAllowDefault(e),this.allowDefault||!t?at(this.view,"pointer"):function(e,t,n,o,i){return ut(e,"handleClickOn",t,n,o)||e.someProp("handleClick",n=>n(e,t,o))||(i?function(e,t){if(-1==t)return!1;let n,o,i=e.state.selection;i instanceof r.nh&&(n=i.node);let s=e.state.doc.resolve(t);for(let l=s.depth+1;l>0;l--){let e=l>s.depth?s.nodeAfter:s.node(l);if(r.nh.isSelectable(e)){o=n&&i.$from.depth>0&&l>=i.$from.depth&&s.before(i.$from.depth+1)==i.$from.pos?s.before(i.$from.depth):s.before(l);break}}return null!=o&&(ft(e,r.nh.create(e.state.doc,o),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),o=n.nodeAfter;return!!(o&&o.isAtom&&r.nh.isSelectable(o))&&(ft(e,new r.nh(n),"pointer"),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||A&&this.mightDrag&&!this.mightDrag.node.isAtom||N&&!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)?(ft(this.view,r.LN.near
1(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):at(this.view,"pointer")}move(e){this.updateAllowDefault(e),at(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function vt(e,t){return!!e.composing||!!(A&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}ot.touchstart=e=>{e.input.lastTouch=Date.now(),yt(e),at(e,"pointer")},ot.touchmove=e=>{e.input.lastTouch=Date.now(),at(e,"pointer")},ot.contextmenu=e=>yt(e);const kt=R?5e3:-1;function St(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Mt(e),t))}function xt(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Mt(e,t=!1){if(!(R&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),xt(e),t||e.docView&&e.docView.dirty){let t=xe(e);return t&&!t.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(t)):e.updateState(e.state),!0}return!1}}it.compositionstart=it.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)))e.markCursor=e.state.storedMarks||n.marks(),Mt(e,!0),e.markCursor=null;else if(Mt(e),C&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){e.domSelection().collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}St(e,kt)},it.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,St(e,20))};const Ct=x&&M<15||E&&z<604;function Ot(e,t,n,r){let i=Ue(e,t,n,e.input.shiftKey,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,r,i||o.Ji.empty)))return!0;if(!i)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),l=s?e.state.tr.replaceSelectionWith(s,e.input.shiftKey):e.state.tr.replaceSelection(i);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}ot.copy=it.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=Ct?null:n.clipboardData,s=r.content(),{dom:l,text:a}=qe(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,l),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},it.paste=(e,t)=>{let n=t;if(e.composing&&!R)return;let r=Ct?null:n.clipboardData;r&&Ot(e,r.getData("text/plain"),r.getData("text/html"),n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let 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(),setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ot(e,r.value,null,t):Ot(e,r.textContent,r.innerHTML,t)},50)}(e,n)};class Nt{constructor(e,t){this.slice=e,this.move=t}}const Tt=D?"altKey":"ctrlKey";ot.dragstart=(e,t)=>{let n=t,o=e.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let i=e.state.selection,s=i.empty?null:e.posAtCoords(pt(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof r.nh?i.to-1:i.to));else if(o&&o.mightDrag)e.dispatch(e.state.tr.setSelection(r.nh.create(e.state.doc,o.mightDrag.pos)));else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&e.dispatch(e.state.tr.setSelection(r.nh.create(e.state.doc,t.posBefore)))}let l=e.state.selection.content(),{dom:a,text:c}=qe(e,l);n.dataTransfer.clearData(),n.dataTransfer.setData(Ct?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Ct||n.dataTransfer.setData("text/plain",c),e.dragging=new Nt(l,!n[Tt])},ot.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},it.dragover=it.dragenter=(e,t)=>t.preventDefault(),it.drop=(e,t)=>{let n=t,s=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let l=e.posAtCoords(pt(n));if(!l)return;let a=e.state.doc.resolve(l.pos),c=s&&s.slice;c?e.someProp("transformPasted",t=>{c=t(c,e)}):c=Ue(e,n.dataTransfer.getData(Ct?"Text":"text/plain"),Ct?null:n.dataTransfer.getData("text/html"),!1,a);let d=!(!s||n[Tt]);if(e.someProp("handleDrop",t=>t(e,n,c||o.Ji.empty,d)))return void n.preventDefault();if(!c)return;n.preventDefault();let h=c?(0,i.Um)(e.state.doc,a.pos,c):a.pos;null==h&&(h=a.pos);let p=e.state.tr;d&&p.deleteSelection();let u=p.mapping.map(h),f=0==c.openStart&&0==c.openEnd&&1==c.content.childCount,m=p.doc;
vendor: 10,580 bytes, line 1
1if(f?p.replaceRangeWith(u,u,c.content.firstChild):p.replaceRange(u,u,c),p.doc.eq(m))return;let g=p.doc.resolve(u);if(f&&r.nh.isSelectable(c.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(c.content.firstChild))p.setSelection(new r.nh(g));else{let t=p.mapping.map(h);p.mapping.maps[p.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),p.setSelection(Re(e,g,p.doc.resolve(t)))}e.focus(),e.dispatch(p.setMeta("uiEvent","drop"))},ot.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Ce(e)},20))},ot.blur=(e,t)=>{let 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)},ot.beforeinput=(e,t)=>{if(N&&R&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,g(8,"Backspace"))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let cn in it)ot[cn]=it[cn];function At(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Et{constructor(e,t){this.toDOM=e,this.spec=t||It,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new $t(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Et&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&At(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Dt{constructor(e,t){this.attrs=e,this.spec=t||It}map(e,t,n,r){let 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 $t(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Dt&&At(this.attrs,e.attrs)&&At(this.spec,e.spec)}static is(e){return e.type instanceof Dt}destroy(){}}class Rt{constructor(e,t){this.attrs=e,this.spec=t||It}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new $t(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof Rt&&At(this.attrs,e.attrs)&&At(this.spec,e.spec)}destroy(){}}class $t{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new $t(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new $t(e,e,new Et(t,n))}static inline(e,t,n,r){return new $t(e,t,new Dt(n,r))}static node(e,t,n,r){return new $t(e,t,new Rt(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Dt}}const zt=[],It={};class Ft{constructor(e,t){this.local=e.length?e:zt,this.children=t.length?t:zt}static create(e,t){return t.length?Kt(t,e,0,It):Pt}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==Pt||0==e.maps.length?this:this.mapInner(e,t,0,0,n||It)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let l=this.local[s].map(e,n,r);l&&l.type.valid(t,l)?(i||(i=[])).push(l):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let l=e.slice();for(let c=0,d=i;c<n.maps.length;c++){let e=0;n.maps[c].forEach((t,n,r,i)=>{let s=i-r-(n-t);for(let a=0;a<l.length;a+=3){let i=l[a+1];if(i<0||t>i+d-e)continue;let c=l[a]+d-e;n>=c?l[a+1]=t<=c?-2:-1:r>=o&&s&&(l[a]+=s,l[a+1]+=s)}e+=s}),d=n.maps[c].map(d,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(-2==l[c+1]){a=!0,l[c+1]=-1;continue}let t=n.map(e[c]+i),d=t-o;if(d<0||d>=r.content.size){a=!0;continue}let h=n.map(e[c+1]+i,-1)-o,{index:p,offset:u}=r.content.findIndex(d),f=r.maybeChild(p);if(f&&u==d&&u+f.nodeSize==h){let r=l[c+2].mapInner(n,f,t+1,e[c]+i+1,s);r!=Pt?(l[c]=d,l[c+1]=h,l[c+2]=r):(l[c+1]=-2,a=!0)}else a=!0}if(a){let a=function(e,t,n,r,o,i,s){function l(e,t){for(let i=0;i<e.local.length;i++){let l=e.local[i].map(r,o,t);l?n.push(l):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)l(e.children[n+2],e.children[n]+t+1)}for(let a=0;a<e.length;a+=3)-1==e[a+1]&&l(e[a+2],t[a]+i+1);return n}(l,e,t,n,o,i,s),c=Kt(a,r,0,s);t=c.local;for(let e=0;e<l.length;e+=3)l[e+1]<0&&(l.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<l.length&&l[t]<n;)t+=3;l.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new Ft(t.sort(jt),l)}(this.children,i||[],e,t,n,r,o):i?new Ft(i.sort(jt),zt):Pt}add(e,t){return t.length?this==Pt?Ft.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach((e,i)=>{let s,l=i+n;if(s=Vt(t,e,l)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,l+1):r.splice(o,0,i,i+e.nodeSize,Kt(s,e,l+1,It)),o+=3}});let i=Lt(o?Jt(t):t,-n);for(let s=0;s<i.length;s++)i[s].type.valid(e,i[s])||i.splice(s--,1);return new Ft(i.length?this.local.concat(i).sort(jt):this.local,r||this.children)}remove(e){return 0==e.length||this==Pt?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let o=0;o<n.length;o+=3){let r,i=n[o]+t,s=n[o+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(r||(r=[])).push(t));if(!r)continue;n==this.children&&(n=this.children.slice());let l=n[o+2].removeInner(r,i+1);l!=Pt?n[o+2]=l:(n.splice(o,3),o-=3)}if(r.length)for(let o,i=0;i<e.length;i++)if(o=e[i])for(let e=0;e<r.length;e++)r[e].eq(o,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Ft(r,n):Pt}forChild(e,t){if(this==Pt)return this;if(t.isLeaf)return Ft.empty;let n,r;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=e){this.children[s]==e&&(n=this.children[s+2]);break}let o=e+1,i=o+t.content.size;for(let s=0;s<this.local.length;s++){let e=this.local[s];if(e.from<i&&e.to>o&&e.type instanceof Dt){let t=Math.max(o,e.from)-o,n=Math.min(i,e.to)-o;t<n&&(r||(r=[])).push(e.copy(t,n))}}if(r){let e=new Ft(r.sort(jt),zt);return n?new Bt([e,n]):e}return n||Pt}eq(e){if(this==e)return!0;if(!(e instanceof Ft)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ht(this.localsInner(e))}localsInner(e){if(this==Pt)return zt;if(e.inlineContent||!this.local.some(Dt.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof Dt||t.push(this.local[n]);return t}}Ft.empty=new Ft([],[]),Ft.removeOverlap=Ht;const Pt=Ft.empty;class Bt{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,It));return Bt.from(n)}forChild(e,t){if(t.isLeaf)return Ft.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=Pt&&(o instanceof Bt?n=n.concat(o.members):n.push(o))}return Bt.from(n)}eq(e){if(!(e instanceof Bt)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?Ht(n?t:t.sort(jt)):zt}static from(e){switch(e.length){case 0:return Pt;case 1:return e[0];default:return new Bt(e.every(e=>e instanceof Ft)?e:e.reduce((e,t)=>e.concat(t instanceof Ft?t:t.members),[]))}}}function Lt(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new $t(o.from+t,o.to+t,o.type))}return n}function Vt(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let i,s=0;s<e.length;s++)(i=e[s])&&i.from>n&&i.to<r&&((o||(o=[])).push(i),e[s]=null);return o}function Jt(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Kt(e,t,n,r){let o=[],i=!1;t.forEach((t,s)=>{let l=Vt(e,t,s+n);if(l){i=!0;let e=Kt(l,t,n+s+1,r);e!=Pt&&o.push(s,s+t.nodeSize,e)}});let s=Lt(i?Jt(e):e,-n).sort(jt);for(let l=0;l<s.length;l++)s[l].type.valid(t,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||o.length?new Ft(s,o):Pt}function jt(e,t){return e.from-t.from||e.to-t.to}function Ht(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let 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),Wt(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),Wt(t,o+1,i.copy(r.to,i.to)))}}return t}function Wt(e,t,n){for(;t<e.length&&jt(n,e[t])>0;)t++;e.splice(t,0,n)}function _t(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Pt&&t.push(r)}),e.cursorWrapper&&t.push(Ft.create(e.state.doc,[e.cursorWrapper.deco])),Bt.from(t)}const qt={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ut=x&&M<=11;class Gt{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Xt{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Gt,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);x&&M<=11&&e.some(e=>
1"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),Ut&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,qt)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if($e(this.view)){if(this.suppressingSelectionUpdates)return Ce(this.view);if(x&&M<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&d(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let o=e.focusNode;o;o=l(o))n.add(o);for(let o=e.anchorNode;o;o=l(o))if(n.has(o)){t=o;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);let n=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&$e(e)&&!this.ignoreSelectionChange(n),i=-1,s=-1,l=!1,a=[];if(e.editable)for(let r=0;r<t.length;r++){let e=this.registerMutation(t[r],a);e&&(i=i<0?e.from:Math.min(e.from,i),s=s<0?e.to:Math.max(e.to,s),e.typeOver&&(l=!0))}if(C&&a.length>1){let e=a.filter(e=>"BR"==e.nodeName);if(2==e.length){let t=e[0],n=e[1];t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&e.input.lastTouch<Date.now()-300&&m(n)&&(c=xe(e))&&c.eq(r.LN.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ce(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),function(e){if(!Zt.has(e)&&(Zt.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=C,Yt)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."),Yt=!0}}(e)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Ce(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let 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(let n=0;n<e.addedNodes.length;n++)t.push(e.addedNodes[n]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(x&&M<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?s(r)+1:0,l=n.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?s(o):e.target.childNodes.length;return{from:l,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}let Zt=new WeakMap,Yt=!1;function Qt(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(A&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||A&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}
1function en(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Re(e,t.resolve(n.anchor),t.resolve(n.head))}function tn(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,o++}return o}class nn{constructor(e,t){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 lt,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(an),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=sn(this),on(this),this.nodeViews=ln(this),this.docView=le(this.state.doc,rn(this),_t(this),this.dom,this),this.domObserver=new Xt(this,(e,t,n,i)=>function(e,t,n,i,s){if(t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=xe(e,t);if(n&&!e.state.selection.eq(n)){let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),e.dispatch(r)}return}let l=e.state.doc.resolve(t),a=l.sharedDepth(n);t=l.before(a+1),n=e.state.doc.resolve(n).after(a+1);let c,d,h=e.state.selection,p=function(e,t,n){let r,{node:i,fromOffset:s,toOffset:l,from:a,to:c}=e.docView.parseRange(t,n),d=e.domSelectionRange(),h=d.anchorNode;if(h&&e.dom.contains(1==h.nodeType?h:h.parentNode)&&(r=[{node:h,offset:d.anchorOffset}],m(d)||r.push({node:d.focusNode,offset:d.focusOffset})),N&&8===e.input.lastKeyCode)for(let o=l;o>s;o--){let e=i.childNodes[o-1],t=e.pmViewDesc;if("BR"==e.nodeName&&!t){l=o;break}if(!t||t.size)break}let p=e.state.doc,u=e.someProp("domParser")||o.S4.fromSchema(e.state.schema),f=p.resolve(a),g=null,y=u.parse(i,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:l,preserveWhitespace:"pre"!=f.parent.type.whitespace||"full",findPositions:r,ruleFromNode:Qt,context:f});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),g={anchor:e+a,head:t+a}}return{doc:y,sel:g,from:a,to:c}}(e,t,n),u=e.state.doc,f=u.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(c=e.state.selection.to,d="end"):(c=e.state.selection.from,d="start"),e.input.lastKeyCode=null;let y=function(e,t,n,r,o){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:l}=e.findDiffEnd(t,n+e.size,n+t.size);return"end"==o&&(r-=s+Math.max(0,i-Math.min(s,l))-i),s<i&&e.size<t.size?(i-=r<=i&&r>=s?i-r:0,l=i+(l-s),s=i):l<i&&(i-=r<=i&&r>=l?i-r:0,s=i+(s-l),l=i),{start:i,endA:s,endB:l}}(f.content,p.doc.content,p.from,c,d);if((E&&e.input.lastIOSEnter>Date.now()-225||R)&&s.some(e=>"DIV"==e.nodeName||"P"==e.nodeName||"LI"==e.nodeName)&&(!y||y.endA>=y.endB)&&e.someProp("handleKeyDown",t=>t(e,g(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!y){if(!(i&&h instanceof r.U3&&!h.empty&&h.$head.sameParent(h.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){let t=en(e,e.state.doc,p.sel);t&&!t.eq(e.state.selection)&&e.dispatch(e.state.tr.setSelection(t))}return}y={start:h.from,endA:h.to,endB:h.to}}if(N&&e.cursorWrapper&&p.sel&&p.sel.anchor==e.cursorWrapper.deco.from&&p.sel.head==p.sel.anchor){let e=y.endB-y.start;p.sel={anchor:p.sel.anchor+e,head:p.sel.anchor+e}}e.input.domChangeCount++,e.state.selection.from<e.state.selection.to&&y.start==y.endB&&e.state.selection instanceof r.U3&&(y.start>e.state.selection.from&&y.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?y.start=e.state.selection.from:y.endA<e.state.selection.to&&y.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(y.endB+=e.state.selection.to-y.endA,y.endA=e.state.selection.to)),x&&M<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>p.from&&"  "==p.doc.textBetween(y.start-p.from-1,y.start-p.from+1)&&(y.start--,y.endA--,y.endB--);let w,b=p.doc.resolveNoCache(y.start-p.from),v=p.doc.resolveNoCache(y.endB-p.from),k=u.resolve(y.start),S=b.sameParent(v)&&b.parent.inlineContent&&k.end()>=y.endA;if((E&&e.input.lastIOSEnter>Date.now()-225&&(!S||s.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!S&&b.pos<p.doc.content.size&&(w=r.LN.findFrom(p.doc.resolve(b.pos+1),1,!0))&&w.head==v.pos)&&e.someProp("handleKeyDown",t=>t(e,g(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>y.start&&function(e,t,n,r,o){if(!r.parent.isTextblock||n-t<=o.pos-r.pos||tn(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(tn(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||tn(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(u,y.start,y.endA,b,v)&&e.someProp("handleKeyDown",t=>t(e,g(8,"Backspace"))))return void(R&&N&&e.domObserver.suppressSelectionUpdates());N&&R&&y.endB==y.start&&(e.input.lastAndroidDelete=Date.now()),R&&!S&&b.start()!=v.start()&&0==v.parentOffset&&b.depth==v.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==y.endA&&(y.endB-=2,v=p.doc.resolveNoCache(y.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,g(13,"Enter"))})},20));let C,O,T,A=y.start,D=y.endA;if(S)if(b.pos==v.pos)x&&M<=11&&0==b.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ce(e),20)),C=e.state.tr.delete(A,D),O=u.resolve(y.start).marksAcross(u.resolve(y.endA));else if(y.endA==y.endB&&(T=function(e,t){let n,r,i,s=e.firstChild.marks,l=t.firstChild.marks,a=s,c=l;for(let o=0;o<l.length;o++)a=l[o].removeFromSet(a);for(let o=0;o<s.length;o++)c=s[o].removeFromSet(c);if(1==a.length&&0==c.length)r=a[0],n="add",i=e=>e.mark(r.addToSet(e.marks));else{if(0!=a.length||1!=c.length)return null;r=c[0],n="remove",i=e=>e.mark(r.removeFromSet(e.marks))}let d=[];for(let o=0;o<t.childCount;o++)d.push(i(t.child(o)));if(o.FK.from(d).eq(e))return{mark:r,type:n}}(b.parent.content.cut(b.parentOffset,v.parentOffset),k.parent.content.cut(k.parentOffset,y.endA-k.start()))))C=e.state.tr,"add"==T.type?C.addMark(A,D,T.mark):C.removeMark(A,D,T.mark);else if(b.parent.child(b.index()).isText&&b.index()==v.index()-(v.textOffset?0:1)){let t=b.parent.textBetween(b.parentOffset,v.parentOffset);if(e.someProp("handleTextInput",n=>n(e,A,D,t)))return;C=e.state.tr.insertText(t,A,D)}if(C||(C=e.state.tr.replace(A,D,p.doc.slice(y.start-p.from,y.endB-p.from))),p.sel){let t=en(e,C.doc,p.sel);t&&!(N&&R&&e.composing&&t.empty&&(y.start!=y.endB||e.input.lastAndroidDelete<Date.now()-100)&&(t.head==A||t.head==C.mapping.map(D)-1)||x&&t.empty&&t.head==A)&&C.setSelection(t)}O&&C.ensureMarks(O),e.dispatch(C.scrollIntoView())}(this,e,t,n,i)),this.domObserver.start(),function(e){for(let t in ot){let n=ot[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!ht(e,t)||dt(e,t)||!e.editable&&t.type in it||n(e,t)},st[t]?{passive:!0}:void 0)}A&&e.dom.addEventListener("input",()=>null),ct(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ct(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(an),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,o=!1;e.storedMarks&&this.composing&&(xt(this),o=!0),this.state=e;let i=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(i||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=ln(this);(function(e,t){let n=0,r=0;for(let o in e){if(e[o]!=t[o])return!0;n++}for(let o in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(i||t.handleDOMEvents!=this._props.handleDOMEvents)&&ct(this),this.editable=sn(this),on(this);let s=_t(this),l=rn(this),a=n.plugins==e.plugins||n.doc.eq(e.doc)?e.scrollToSelection>n.scrollToSelection?"to selection":"preserve":"reset",c=r||!this.docView.matchesNode(e.doc,l,s);!c&&e.selection.eq(n.selection)||(o=!0);let h="preserve"==a&&o&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(i,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let l=r.getBoundingClientRect();if(l.top>=o-20){t=r,n=l.top;break}}return{refDOM:t,refTop:n,stack:L(e.dom)}}(this);if(o){this.domObserver.stop();let t=c&&(x||N)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(n.selection,e.selection);if(c){let n=N?this.trackWrites=this.domSelectionRange().focusNode:null;!r&&this.docView.update(e.doc,l,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=le(e.doc,l,s,this.dom,this)),n&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return d(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?Ce(this,t):(Ee(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),"reset"==a?this.dom.scrollTop=0:"to selection"==a?this.scrollToSelection():h&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;V(n,0==r?0:r-t)}(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof r.nh){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&B(this,t.getBoundingClientRect(),e)}else B(this,this.coordsAtPos(this.state.selection.head,1),e)}
1destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let i=0;i<this.directPlugins.length;i++){let r=this.directPlugins[i].props[e];if(null!=r&&(n=t?t(r):r))return n}let o=this.state.plugins;if(o)for(let i=0;i<o.length;i++){let r=o[i].props[e];if(null!=r&&(n=t?t(r):r))return n}}hasFocus(){if(x){let 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}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(J)return e.focus(J);let t=L(e);e.focus(null==J?{get preventScroll(){return J={preventScroll:!0},!0}}:void 0),J||(J=!1,V(t,0))}(this.dom),Ce(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t;return e||document}posAtCoords(e){return W(this,e)}coordsAtPos(e,t=1){return U(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){return Q==t&&ee==n?te:(Q=t,ee=n,te="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Z(e,t,()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.dom;break}t=n.dom.parentNode}let r=U(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=c(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0})}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=e.domSelection();return Y.test(r.parent.textContent)&&l.modify?Z(e,t,()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),a=l.caretBidiLevel;l.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:d,focusOffset:h}=e.domSelectionRange(),p=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&o==h;try{l.collapse(i,s),t&&(t!=i||o!=s)&&l.extend&&l.extend(t,o)}catch(u){}return null!=a&&(l.caretBidiLevel=a),p}):"left"==n||"backward"==n?i:s}(e,t,n))}(this,t||this.state,e)}destroy(){this.docView&&(function(e){e.domObserver.stop();for(let t in 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,[],_t(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){dt(e,t)||!ot[t.type]||!e.editable&&t.type in it||ot[t.type](e,t)}(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return A&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom?function(e){let t;function n(e){e.preventDefault(),e.stopImmediatePropagation(),t=e.getTargetRanges()[0]}e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0);let r=t.startContainer,o=t.startOffset,i=t.endContainer,s=t.endOffset,l=e.domAtPos(e.state.selection.anchor);return d(l.node,l.offset,i,s)&&([r,o,i,s]=[i,s,r,o]),{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}}(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function rn(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),t.translate="no",e.
1someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e&&(t.class+=" "+n[e]),"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),[$t.node(0,e.state.doc.content.size,t)]}function on(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:$t.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function sn(e){return!e.someProp("editable",t=>!1===t(e.state))}function ln(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function an(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")}},8974(e,t,n){n.d(t,{A:()=>o});var r=n(45163);const o=r.bP.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,(0,r.KV)(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>(0,r.JJ)({find:new RegExp(`^(#{1,${e}}
1)\\s$`),type:this.type,getAttributes:{level:e}}))}})},12554(e,t,n){n.d(t,{Ay:()=>we});var r=n(45163),o=n(42845),i=n(58903),s=n(38701),l=n(1575),a=n(38262);let c,d;if("undefined"!=typeof WeakMap){let e=new WeakMap;c=t=>e.get(t),d=(t,n)=>(e.set(t,n),n)}else{let e=[],t=10,n=0;c=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},d=(r,o)=>(n==t&&(n=0),e[n++]=r,e[n++]=o)}class h{constructor(e,t,n,r){this.left=e,this.top=t,this.right=n,this.bottom=r}}class p{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++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,o=t/this.width|0,i=r+1,s=o+1;for(let e=1;i<this.width&&this.map[t+e]==n;e++)i++;for(let e=1;s<this.height&&this.map[t+this.width*e]==n;e++)s++;return new h(r,o,i,s)}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){let{left:r,right:o,top:i,bottom:s}=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:s==this.height)?null:this.map[r+this.width*(n<0?i-1:s)]}rectBetween(e,t){let{left:n,right:r,top:o,bottom:i}=this.findCell(e),{left:s,right:l,top:a,bottom:c}=this.findCell(t);return new h(Math.min(n,s),Math.min(o,a),Math.max(r,l),Math.max(i,c))}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let o=e.left;o<e.right;o++){let i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,o==e.left&&o&&this.map[i-1]==s||r==e.top&&r&&this.map[i-this.width]==s||t.push(s))}return t}positionAt(e,t,n){for(let r=0,o=0;;r++){let i=o+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,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)||d(e,function(e){if("table"!=e.type.spec.tableRole)throw new RangeError("Not a table node: "+e.type.name);let t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let o=e.child(r),i=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let o=n.child(e);t+o.attrs.rowspan>r&&(i+=o.attrs.colspan)}}for(let e=0;e<o.childCount;e++){let 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=[],o=0,i=null,s=[];for(let c=0,d=t*n;c<d;c++)r[c]=0;for(let c=0,d=0;c<n;c++){let l=e.child(c);d++;for(let e=0;;e++){for(;o<r.length&&0!=r[o];)o++;if(e==l.childCount)break;let a=l.child(e),{colspan:h,rowspan:p,colwidth:u}=a.attrs;for(let e=0;e<p;e++){if(e+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:p-e});break}let l=o+e*t;for(let e=0;e<h;e++){0==r[l+e]?r[l+e]=d:(i||(i=[])).push({type:"collision",row:c,pos:d,n:h-e});let n=u&&u[e];if(n){let r=(l+e)%t*2,o=s[r];null==o||o!=n&&1==s[r+1]?(s[r]=n,s[r+1]=1):o==n&&s[r+1]++}}}o+=h,d+=a.nodeSize}let a=(c+1)*t,h=0;for(;o<a;)0==r[o++]&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),d++}let l=new p(t,n,r,i),a=!1;for(let c=0;!a&&c<s.length;c+=2)null!=s[c]&&s[c+1]<n&&(a=!0);return a&&function(e,t,n){e.problems||(e.problems=[]);for(let r=0,o={};r<e.map.length;r++){let i=e.map[r];if(o[i])continue;o[i]=!0;let s=n.nodeAt(i),l=null;for(let n=0;n<s.attrs.colspan;n++){let o=t[(r+n)%e.width*2];null==o||s.attrs.colwidth&&s.attrs.colwidth[n]==o||((l||(l=u(s.attrs)))[n]=o)}l&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}(l,s,e),l}(e))}}function u(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function f(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],o=r.spec.tableRole;o&&(t[o]=r)}}return t}const m=new o.hs("selectingCells");function g(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 y(e){let t=e.selection.$head;for(let n=t.depth;n>0;n--)if("row"==t.node(n).type.spec.tableRole)return!0;return!1}function w(e){let t=e.selection;return t.$anchorCell?t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell:t.node&&"cell"==t.node.type.spec.tableRole?t.$anchor:g(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let 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--){let r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}(t.$head)}function b(e){return"row"==e.parent.type.spec.tableRole&&e.nodeAfter}function v(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}
1function k(e,t,n){let r=e.start(-1),o=p.get(e.node(-1)).nextCell(e.pos-r,t,n);return null==o?null:e.node(0).resolve(r+o)}function S(e,t,n){let r={};for(let o in e)r[o]=e[o];return r[t]=n,r}function x(e,t,n=1){let r=S(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 M(e,t,n=1){let r=S(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}class C extends o.LN{constructor(e,t=e){let n=e.node(-1),r=p.get(n),i=e.start(-1),s=r.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=r.cellsInRect(s).filter(e=>e!=t.pos-i);a.unshift(t.pos-i);let c=a.map(e=>{let t=n.nodeAt(e),r=e+i+1;return new o.yn(l.resolve(r),l.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){let n=e.resolve(t.map(this.$anchorCell.pos)),r=e.resolve(t.map(this.$headCell.pos));if(b(n)&&b(r)&&v(n,r)){let e=this.$anchorCell.node(-1)!=n.node(-1);return e&&this.isRowSelection()?C.rowSelection(n,r):e&&this.isColSelection()?C.colSelection(n,r):new C(n,r)}return o.U3.between(n,r)}content(){let e=this.$anchorCell.node(-1),t=p.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},s=[];for(let a=r.top;a<r.bottom;a++){let n=[];for(let i=a*t.width+r.left,s=r.left;s<r.right;s++,i++){let s=t.map[i];if(!o[s]){o[s]=!0;let i=t.findCell(s),l=e.nodeAt(s),a=r.left-i.left,c=i.right-r.right;if(a>0||c>0){let e=l.attrs;a>0&&(e=x(e,0,a)),c>0&&(e=x(e,e.colspan-c,c)),l=i.left<r.left?l.type.createAndFill(e):l.type.create(e,l.content)}if(i.top<r.top||i.bottom>r.bottom){let e=S(l.attrs,"rowspan",Math.min(i.bottom,r.bottom)-Math.max(i.top,r.top));l=i.top<r.top?l.type.createAndFill(e):l.type.create(e,l.content)}n.push(l)}}s.push(e.child(a).copy(i.FK.from(n)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new i.Ji(i.FK.from(l),1,1)}replace(e,t=i.Ji.empty){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:s,$to:l}=r[o],a=e.mapping.slice(n);e.replace(a.map(s.pos),a.map(l.pos),o?i.Ji.empty:t)}let s=o.LN.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new i.Ji(i.FK.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=p.get(t),r=this.$anchorCell.start(-1),o=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let i=0;i<o.length;i++)e(t.nodeAt(o[i]),r+o[i])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}
1static colSelection(e,t=e){let n=p.get(e.node(-1)),r=e.start(-1),o=n.findCell(e.pos-r),i=n.findCell(t.pos-r),s=e.node(0);return o.top<=i.top?(o.top>0&&(e=s.resolve(r+n.map[o.left])),i.bottom<n.height&&(t=s.resolve(r+n.map[n.width*(n.height-1)+i.right-1]))):(i.top>0&&(t=s.resolve(r+n.map[i.left])),o.bottom<n.height&&(e=s.resolve(r+n.map[n.width*(n.height-1)+o.right-1]))),new C(e,t)}isRowSelection(){let e=p.get(this.$anchorCell.node(-1)),t=this.$anchorCell.start(-1),n=e.colCount(this.$anchorCell.pos-t),r=e.colCount(this.$headCell.pos-t);if(Math.min(n,r)>0)return!1;let o=n+this.$anchorCell.nodeAfter.attrs.colspan,i=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,i)==e.width}eq(e){return e instanceof C&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){let n=p.get(e.node(-1)),r=e.start(-1),o=n.findCell(e.pos-r),i=n.findCell(t.pos-r),s=e.node(0);return o.left<=i.left?(o.left>0&&(e=s.resolve(r+n.map[o.top*n.width])),i.right<n.width&&(t=s.resolve(r+n.map[n.width*(i.top+1)-1]))):(i.left>0&&(t=s.resolve(r+n.map[i.top*n.width])),o.right<n.width&&(e=s.resolve(r+n.map[n.width*(o.top+1)-1]))),new C(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new C(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){return new C(e.resolve(t),e.resolve(n))}getBookmark(){return new O(this.$anchorCell.pos,this.$headCell.pos)}}C.prototype.visible=!1,o.LN.jsonID("cell",C);class O{constructor(e,t){this.anchor=e,this.head=t}map(e){return new O(e.map(this.anchor),e.map(this.head))}resolve(e){let 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&&v(t,n)?new C(t,n):o.LN.near(n,1)}}function N(e){if(!(e.selection instanceof C))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(l.NZ.node(n,n+e.nodeSize,{class:"selectedCell"}))}),l.zF.create(e.doc,t)}function T(e,t){let n=e.createAndFill();return new a.dL(n).replace(0,n.content.size,t).doc}function A(e,t,n,r,o,i,s,l){if(0==s||s==t.height)return!1;let a=!1;for(let c=o;c<i;c++){let o=s*t.width+c,i=t.map[o];if(t.map[o-t.width]==i){a=!0;let o=n.nodeAt(i),{top:d,left:h}=t.findCell(i);e.setNodeMarkup(e.mapping.slice(l).map(i+r),null,S(o.attrs,"rowspan",s-d)),e.insert(e.mapping.slice(l).map(t.positionAt(s,h,n)),o.type.createAndFill(S(o.attrs,"rowspan",d+o.attrs.rowspan-s))),c+=o.attrs.colspan-1}}return a}function E(e,t,n,r,o,i,s,l){if(0==s||s==t.width)return!1;let a=!1;for(let c=o;c<i;c++){let o=c*t.width+s,i=t.map[o];if(t.map[o-1]==i){a=!0;let o=n.nodeAt(i),d=t.colCount(i),h=e.mapping.slice(l).map(i+r);e.setNodeMarkup(h,null,x(o.attrs,s-d,o.attrs.colspan-(s-d))),e.insert(h+o.nodeSize,o.type.createAndFill(x(o.attrs,0,s-d))),c+=o.attrs.rowspan-1}}return a}function D(e,t,n,r,o){let s=n?e.doc.nodeAt(n-1):e.doc,l=p.get(s),{top:a,left:c}=r,d=c+o.width,h=a+o.height,u=e.tr,m=0;function g(){s=n?u.doc.nodeAt(n-1):u.doc,l=p.get(s),m=u.mapping.maps.length}(function(e,t,n,r,o,s,l){let a,c,d=f(e.doc.type.schema);if(o>t.width)for(let i=0,h=0;i<t.height;i++){let s=n.child(i);h+=s.nodeSize;let p,u=[];p=null==s.lastChild||s.lastChild.type==d.cell?a||(a=d.cell.createAndFill()):c||(c=d.header_cell.createAndFill());for(let e=t.width;e<o;e++)u.push(p);e.insert(e.mapping.slice(l).map(h-1+r),u)}if(s>t.height){let h=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,o);e++){let o=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==d.header_cell;h.push(o?c||(c=d.header_cell.createAndFill()):a||(a=d.cell.createAndFill()))}let p=d.row.create(null,i.FK.from(h)),u=[];for(let e=t.height;e<s;e++)u.push(p);e.insert(e.mapping.slice(l).map(r+n.nodeSize-2),u)}return!(!a&&!c)})(u,l,s,n,d,h,m)&&g(),A(u,l,s,n,c,d,a,m)&&g(),A(u,l,s,n,c,d,h,m)&&g(),E(u,l,s,n,a,h,c,m)&&g(),E(u,l,s,n,a,h,d,m)&&g();for(let p=a;p<h;p++){let e=l.positionAt(p,c,s),t=l.positionAt(p,d,s);u.replace(u.mapping.slice(m).map(e+n),u.mapping.slice(m).map(t+n),new i.Ji(o.rows[p-a],0,0))}g(),u.setSelection(new C(u.doc.resolve(n+l.positionAt(a,c,s)),u.doc.resolve(n+l.positionAt(h-1,d-1,s)))),t(u)}const R=(0,s.K)({ArrowLeft:z("horiz",-1),ArrowRight:z("horiz",1),ArrowUp:z("vert",
1-1),ArrowDown:z("vert",1),"Shift-ArrowLeft":I("horiz",-1),"Shift-ArrowRight":I("horiz",1),"Shift-ArrowUp":I("vert",-1),"Shift-ArrowDown":I("vert",1),Backspace:F,"Mod-Backspace":F,Delete:F,"Mod-Delete":F});function $(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function z(e,t){return(n,r,i)=>{let s=n.selection;if(s instanceof C)return $(n,r,o.LN.near(s.$headCell,t));if("horiz"!=e&&!s.empty)return!1;let l=V(i,e,t);if(null==l)return!1;if("horiz"==e)return $(n,r,o.LN.near(n.doc.resolve(s.head+t),t));{let i,s=n.doc.resolve(l),a=k(s,e,t);return i=a?o.LN.near(a,1):t<0?o.LN.near(n.doc.resolve(s.before(-1)),-1):o.LN.near(n.doc.resolve(s.after(-1)),1),$(n,r,i)}}}function I(e,t){return(n,r,o)=>{let i=n.selection;if(!(i instanceof C)){let r=V(o,e,t);if(null==r)return!1;i=new C(n.doc.resolve(r))}let s=k(i.$headCell,e,t);return!!s&&$(n,r,new C(i.$anchorCell,s))}}function F(e,t){let n=e.selection;if(!(n instanceof C))return!1;if(t){let r=e.tr,o=f(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 i.Ji(o,0,0))}),r.docChanged&&t(r)}return!0}function P(e,t){let n=g(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new C(n))),!0)}function B(e,t,n){if(!y(e.state))return!1;let r=function(e){if(!e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.firstChild.type.spec.tableRole);)n--,r--,t=t.firstChild.content;let o=t.firstChild,s=o.type.spec.tableRole,l=o.type.schema,a=[];if("row"==s)for(let c=0;c<t.childCount;c++){let e=t.child(c).content,o=c?0:Math.max(0,n-1),s=c<t.childCount-1?0:Math.max(0,r-1);(o||s)&&(e=T(f(l).row,new i.Ji(e,o,s)).content),a.push(e)}else{if("cell"!=s&&"header_cell"!=s)return null;a.push(n||r?T(f(l).row,new i.Ji(t,n,r)).content:t)}return function(e,t){let n=[];for(let o=0;o<t.length;o++){let e=t[o];for(let t=e.childCount-1;t>=0;t--){let{rowspan:r,colspan:i}=e.child(t).attrs;for(let e=o;e<o+r;e++)n[e]=(n[e]||0)+i}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=t.length&&t.push(i.FK.empty),n[o]<r){let s=f(e).cell.createAndFill(),l=[];for(let e=n[o];e<r;e++)l.push(s);t[o]=t[o].append(i.FK.from(l))}return{height:t.length,width:r,rows:t}}(l,a)}(n),o=e.state.selection;if(o instanceof C){r||(r={width:1,height:1,rows:[i.FK.from(T(f(e.state.schema).cell,n))]});let t=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),l=p.get(t).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=function({width:e,height:t,rows:n},r,o){if(e!=r){let t=[],o=[];for(let e=0;e<n.length;e++){let s=n[e],l=[];for(let n=t[e]||0,o=0;n<r;o++){let i=s.child(o%s.childCount);n+i.attrs.colspan>r&&(i=i.type.create(x(i.attrs,i.attrs.colspan,n+i.attrs.colspan-r),i.content)),l.push(i),n+=i.attrs.colspan;for(let n=1;n<i.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+i.attrs.colspan}o.push(i.FK.from(l))}n=o,e=r}if(t!=o){let e=[];for(let r=0,s=0;r<o;r++,s++){let l=[],a=n[s%t];for(let e=0;e<a.childCount;e++){let t=a.child(e);r+t.attrs.rowspan>o&&(t=t.type.create(S(t.attrs,"rowspan",Math.max(1,o-t.attrs.rowspan)),t.content)),l.push(t)}e.push(i.FK.from(l))}n=e,t=o}return{width:e,height:t,rows:n}}(r,l.right-l.left,l.bottom-l.top),D(e.state,e.dispatch,s,l,r),!0}if(r){let t=w(e.state),n=t.start(-1);return D(e.state,e.dispatch,n,p.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function L(e,t){if(t.ctrlKey||t.metaKey)return;let n,r=J(e,t.target);if(t.shiftKey&&e.state.selection instanceof C)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&null!=(n=g(e.state.selection.$anchor))&&K(e,t).pos!=n.pos)o(n,t),t.preventDefault();else if(!r)return;function o(t,n){let r=K(e,n),o=null==m.getState(e.state);if(!r||!v(t,r)){if(!o)return;r=t}let i=new C(t,r);if(o||!e.state.selection.eq(i)){let n=e.state.tr.setSelection(i);o&&n.setMeta(m,t.pos),e.dispatch(n)}}function i(){e.root.removeEventListener("mouseup",i),e.root.removeEventListener("dragstart",i),e.root.removeEventListener("mousemove",s),null!=m.getState(e.state)&&e.dispatch(e.state.tr.setMeta(m,-1))}function s(n){let s,l=m.getState(e.state);if(null!=l)s=e.state.doc.resolve(l);else if(J(e,n.target)!=r&&(s=K(e,t),!s))return i();s&&o(s,n)}e.root.addEventListener("mouseup",i),e.root.addEventListener("dragstart",i),e.root.addEventListener("mousemove",s)}
1function V(e,t,n){if(!(e.state.selection instanceof o.U3))return null;let{$head:r}=e.state.selection;for(let o=r.depth-1;o>=0;o--){let 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){let i=r.before(o),s="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?i:null}}return null}function J(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t}function K(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});return n&&n?g(e.state.doc.resolve(n.pos)):null}const j=new o.hs("fix-tables");function H(e,t,n,r){let o=e.childCount,i=t.childCount;e:for(let s=0,l=0;s<i;s++){let i=t.child(s);for(let t=l,r=Math.min(o,s+3);t<r;t++)if(e.child(t)==i){l=t+1,n+=i.nodeSize;continue e}r(i,n),l<o&&e.child(l).sameMarkup(i)?H(e.child(l),i,n+1,r):i.nodesBetween(0,i.content.size,r,n+1),n+=i.nodeSize}}function W(e,t){let n,r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){let o=p.get(t);if(!o.problems)return r;r||(r=e.tr);let i,s,l=[];for(let a=0;a<o.height;a++)l.push(0);for(let a=0;a<o.problems.length;a++){let e=o.problems[a];if("collision"==e.type){let o=t.nodeAt(e.pos);for(let t=0;t<o.attrs.rowspan;t++)l[e.row+t]+=e.n;r.setNodeMarkup(r.mapping.map(n+1+e.pos),null,x(o.attrs,o.attrs.colspan-e.n,e.n))}else if("missing"==e.type)l[e.row]+=e.n;else if("overlong_rowspan"==e.type){let o=t.nodeAt(e.pos);r.setNodeMarkup(r.mapping.map(n+1+e.pos),null,S(o.attrs,"rowspan",o.attrs.rowspan-e.n))}else if("colwidth mismatch"==e.type){let o=t.nodeAt(e.pos);r.setNodeMarkup(r.mapping.map(n+1+e.pos),null,S(o.attrs,"colwidth",e.colwidth))}}for(let a=0;a<l.length;a++)l[a]&&(null==i&&(i=a),s=a);for(let a=0,c=n+1;a<o.height;a++){let n=t.child(a),o=c+n.nodeSize,d=l[a];if(d>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);let l=[];for(let n=0;n<d;n++)l.push(f(e.schema)[t].createAndFill());let h=0!=a&&i!=a-1||s!=a?o-1:c+1;r.insert(r.mapping.map(h),l)}c=o}return r.setMeta(j,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&H(t.doc,e.doc,0,r):e.doc.descendants(r),n}function _(e){let t,n=e.selection,r=w(e),o=r.node(-1),i=r.start(-1),s=p.get(o);return t=n instanceof C?s.rectBetween(n.$anchorCell.pos-i,n.$headCell.pos-i):s.findCell(r.pos-i),t.tableStart=i,t.map=s,t.table=o,t}function q(e,{map:t,tableStart:n,table:r},o){let i=o>0?-1:0;(function(e,t,n){let r=f(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})(t,r,o+i)&&(i=0==o||o==t.width?null:0);for(let s=0;s<t.height;s++){let l=s*t.width+o;if(o>0&&o<t.width&&t.map[l-1]==t.map[l]){let i=t.map[l],a=r.nodeAt(i);e.setNodeMarkup(e.mapping.map(n+i),null,M(a.attrs,o-t.colCount(i))),s+=a.attrs.rowspan-1}else{let a=null==i?f(r.type.schema).cell:r.nodeAt(t.map[l+i]).type,c=t.positionAt(s,o,r);e.insert(e.mapping.map(n+c),a.createAndFill())}}return e}function U(e,{map:t,table:n,tableStart:r},o){let i=e.mapping.maps.length;for(let s=0;s<t.height;){let l=s*t.width+o,a=t.map[l],c=n.nodeAt(a);if(o>0&&t.map[l-1]==a||o<t.width-1&&t.map[l+1]==a)e.setNodeMarkup(e.mapping.slice(i).map(r+a),null,x(c.attrs,o-t.colCount(a)));else{let t=e.mapping.slice(i).map(r+a);e.delete(t,t+c.nodeSize)}s+=c.attrs.rowspan}}function G(e,{map:t,tableStart:n,table:r},o){let i=n;for(let a=0;a<o;a++)i+=r.child(a).nodeSize;let s=[],l=o>0?-1:0;(function(e,t,n){let r=f(t.type.schema).header_cell;for(let o=0;o<e.width;o++)if(t.nodeAt(e.map[o+n*e.width]).type!=r)return!1;return!0})(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]){let o=t.map[c],i=r.nodeAt(o).attrs;e.setNodeMarkup(n+o,null,S(i,"rowspan",i.rowspan+1)),a+=i.colspan-1}else{let e=null==l?f(r.type.schema).cell:r.nodeAt(t.map[c+l*t.width]).type;s.push(e.createAndFill())}return e.insert(i,f(r.type.schema).row.create(null,s)),e}function X(e,{map:t,table:n,tableStart:r},o){let i=0;for(let a=0;a<o;a++)i+=n.child(a).nodeSize;let s=i+n.child(o).nodeSize,l=e.mapping.maps.length;e.delete(i+r,s+r);for(let a=0,c=o*t.width;a<t.width;a++,c++){let i=t.map[c];if(o>
10&&i==t.map[c-t.width]){let t=n.nodeAt(i).attrs;e.setNodeMarkup(e.mapping.slice(l).map(i+r),null,S(t,"rowspan",t.rowspan-1)),a+=t.colspan-1}else if(o<t.width&&i==t.map[c+t.width]){let s=n.nodeAt(i),c=s.type.create(S(s.attrs,"rowspan",s.attrs.rowspan-1),s.content),d=t.positionAt(o+1,a,n);e.insert(e.mapping.slice(l).map(r+d),c),a+=s.attrs.colspan-1}}}function Z(e){let t=e.content;return 1==t.childCount&&t.firstChild.isTextblock&&0==t.firstChild.childCount}function Y(e,t){let n=e.selection;if(!(n instanceof C)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=_(e),{map:o}=r;if(function({width:e,height:t,map:n},r){let o=r.top*e+r.left,i=o,s=(r.bottom-1)*e+r.left,l=o+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&n[i]==n[i-1]||r.right<e&&n[l]==n[l+1])return!0;i+=e,l+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[o]==n[o-e]||r.bottom<t&&n[s]==n[s+e])return!0;o++,s++}return!1}(o,r))return!1;if(t){let n,s,l=e.tr,a={},c=i.FK.empty;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let i=o.map[e*o.width+t],d=r.table.nodeAt(i);if(!a[i])if(a[i]=!0,null==n)n=i,s=d;else{Z(d)||(c=c.append(d.content));let e=l.mapping.map(i+r.tableStart);l.delete(e,e+d.nodeSize)}}if(l.setNodeMarkup(n+r.tableStart,null,S(M(s.attrs,s.attrs.colspan,r.right-r.left-s.attrs.colspan),"rowspan",r.bottom-r.top)),c.size){let e=n+1+s.content.size,t=Z(s)?n+1:e;l.replaceWith(t+r.tableStart,e+r.tableStart,c)}l.setSelection(new C(l.doc.resolve(n+r.tableStart))),t(l)}return!0}function Q(e,t){const n=f(e.schema);return(r=({node:e})=>n[e.type.spec.tableRole],(e,t)=>{let n,o,i=e.selection;if(i instanceof C){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;n=i.$anchorCell.nodeAfter,o=i.$anchorCell.pos}else{if(n=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}(i.$from),!n)return!1;o=g(i.$from).pos}if(1==n.attrs.colspan&&1==n.attrs.rowspan)return!1;if(t){let s=n.attrs,l=[],a=s.colwidth;s.rowspan>1&&(s=S(s,"rowspan",1)),s.colspan>1&&(s=S(s,"colspan",1));let c,d=_(e),h=e.tr;for(let e=0;e<d.right-d.left;e++)l.push(a?S(s,"colwidth",a&&a[e]?[a[e]]:null):s);for(let e=d.top;e<d.bottom;e++){let t=d.map.positionAt(e,d.left,d.table);e==d.top&&(t+=n.nodeSize);for(let o=d.left,i=0;o<d.right;o++,i++)o==d.left&&e==d.top||h.insert(c=h.mapping.map(t+d.tableStart,1),r({node:n,row:e,col:o}).createAndFill(l[i]))}h.setNodeMarkup(o,r({node:n,row:d.top,col:d.left}),l[0]),i instanceof C&&h.setSelection(new C(h.doc.resolve(i.$anchorCell.pos),c&&h.doc.resolve(c))),t(h)}return!0})(e,t);var r}function ee(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 o=0;o<r.length;o++){const e=t.table.nodeAt(r[o]);if(e&&e.type!==n.header_cell)return!1}return!0}function te(e,t){return(t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(e){return function(t,n){if(!y(t))return!1;if(n){let r=f(t.schema),o=_(t),i=t.tr,s=o.map.cellsInRect("column"==e?new h(o.left,0,o.right,o.map.height):"row"==e?new h(0,o.top,o.map.width,o.bottom):o),l=s.map(e=>o.table.nodeAt(e));for(let e=0;e<s.length;e++)l[e].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[e],r.cell,l[e].attrs);if(0==i.steps.length)for(let e=0;e<s.length;e++)i.setNodeMarkup(o.tableStart+s[e],r.header_cell,l[e].attrs);n(i)}return!0}}(e):function(t,n){if(!y(t))return!1;if(n){let r=f(t.schema),o=_(t),i=t.tr,s=ee("row",o,r),l=ee("column",o,r),a=("column"===e?s:"row"===e&&l)?1:0,c="column"==e?new h(0,a,1,o.map.height):"row"==e?new h(a,0,o.map.width,1):o,d="column"==e?l?r.cell:r.header_cell:"row"==e?s?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,d,n.attrs)}),n(i)}return!0}}te("row",{useDeprecatedLogic:!0}),te("column",{useDeprecatedLogic:!0});let ne=te("cell",{useDeprecatedLogic:!0});function re(e){return function(t,n){if(!y(t))return!1;let r=function(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let n=e.index(-1)-1,r=e.before();n>=0;n--){let t=e.node(-1).child(n);if(t.childCount)return r-1-t.lastChild.nodeSize;r-=t.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}}(w(t),e);if(null!=r){if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(o.U3.between(e,(i=e,i.node(0).resolve(i.pos+i.nodeAfter.nodeSize)))).scrollIntoView())}var i;return!0}}}class oe{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ie(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,ie(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}}function ie(e,t,n,r,o,i){let s=0,l=!0,a=t.firstChild,c=e.firstChild;for(let d=0,h=0;d<c.childCount;d++){let{colspan:e,colwidth:n}=c.child(d).attrs;for(let c=0;c<e;c++,h++){let e=o==h?i:n&&n[c],d=e?e+"px":"";s+=e||r,e||(l=!1),a?(a.style.width!=d&&(a.style.width=d),a=a.nextSibling):t.a
1ppendChild(document.createElement("col")).style.width=d}}for(;a;){let e=a.nextSibling;a.parentNode.removeChild(a),a=e}l?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}const se=new o.hs("tableColumnResizing");function le({handleWidth:e=5,cellMinWidth:t=25,View:n=oe,lastColumnResizable:r=!0}={}){let i=new o.k_({key:se,state:{init(e,r){return this.spec.props.nodeViews[f(r.schema).table.name]=(e,r)=>new n(e,t,r),new ae(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>se.getState(e).activeHandle>-1?{class:"resize-cursor"}:null,handleDOMEvents:{mousemove(t,n){!function(e,t,n,r,o){let i=se.getState(e.state);if(!i.dragging){let r=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target),s=-1;if(r){let{left:o,right:i}=r.getBoundingClientRect();t.clientX-o<=n?s=ce(e,t,"left"):i-t.clientX<=n&&(s=ce(e,t,"right"))}if(s!=i.activeHandle){if(!o&&-1!==s){let t=e.state.doc.resolve(s),n=t.node(-1),r=p.get(n),o=t.start(-1);if(r.colCount(t.pos-o)+t.nodeAfter.attrs.colspan-1==r.width-1)return}he(e,s)}}}(t,n,e,0,r)},mouseleave(e){!function(e){let t=se.getState(e.state);t.activeHandle>-1&&!t.dragging&&he(e,-1)}(e)},mousedown(e,n){!function(e,t,n){let r=se.getState(e.state);if(-1==r.activeHandle||r.dragging)return!1;let o=e.state.doc.nodeAt(r.activeHandle),i=function(e,t,{colspan:n,colwidth:r}){let o=r&&r[r.length-1];if(o)return o;let i=e.domAtPos(t),s=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let a=0;a<n;a++)r[a]&&(s-=r[a],l--);return s/l}(e,r.activeHandle,o.attrs);function s(t){window.removeEventListener("mouseup",s),window.removeEventListener("mousemove",l);let r=se.getState(e.state);r.dragging&&(function(e,t,n){let r=e.state.doc.resolve(t),o=r.node(-1),i=p.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=e.state.tr;for(let c=0;c<i.height;c++){let e=c*i.width+l;if(c&&i.map[e]==i.map[e-i.width])continue;let t=i.map[e],{attrs:r}=o.nodeAt(t),d=1==r.colspan?0:l-i.colCount(t);if(r.colwidth&&r.colwidth[d]==n)continue;let h=r.colwidth?r.colwidth.slice():pe(r.colspan);h[d]=n,a.setNodeMarkup(s+t,null,S(r,"colwidth",h))}a.docChanged&&e.dispatch(a)}(e,r.activeHandle,de(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(se,{setDragging:null})))}function l(t){if(!t.which)return s(t);let r=se.getState(e.state),o=de(r.dragging,t,n);!function(e,t,n,r){let o=e.state.doc.resolve(t),i=o.node(-1),s=o.start(-1),l=p.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=e.domAtPos(o.start(-1)).node;for(;"TABLE"!=a.nodeName;)a=a.parentNode;ie(i,a.firstChild,a,r,l,n)}(e,r.activeHandle,o,n)}e.dispatch(e.state.tr.setMeta(se,{setDragging:{startX:t.clientX,startWidth:i}})),window.addEventListener("mouseup",s),window.addEventListener("mousemove",l),t.preventDefault()}(e,n,t)}},decorations(e){let t=se.getState(e);if(t.activeHandle>-1)return function(e,t){let n=[],r=e.doc.resolve(t),o=r.node(-1),i=p.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan;for(let c=0;c<i.height;c++){let e=a+c*i.width-1;if(!(a!=i.width&&i.map[e]==i.map[e+1]||0!=c&&i.map[e-1]==i.map[e-1-i.width])){let t=i.map[e],r=s+t+o.nodeAt(t).nodeSize-1,a=document.createElement("div");a.className="column-resize-handle",n.push(l.NZ.widget(r,a))}}return l.zF.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return i}class ae{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){let t=this,n=e.getMeta(se);if(n&&null!=n.setHandle)return new ae(n.setHandle,null);if(n&&void 0!==n.setDragging)return new ae(t.activeHandle,n.setDragging);if(t.activeHandle>-1&&e.docChanged){let n=e.mapping.map(t.activeHandle,-1);b(e.doc.resolve(n))||(n=null),t=new ae(n,t.dragging)}return t}}function ce(e,t,n){let r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return-1;let{pos:o}=r,i=g(e.state.doc.resolve(o));if(!i)return-1;if("right"==n)return i.pos;let s=p.get(i.node(-1)),l=i.start(-1),a=s.map.indexOf(i.pos-l);return a%s.width==0?-1:l+s.map[a-1]}function de(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function he(e,t){e.dispatch(e.state.tr.setMeta(se,{setHandle:t}))}function pe(e){let t=[];for(let n=0;n<e;n++)t.push(0);return t}function ue({allowTableNodeSelection:e=!1}={}){return new o.k_({key:m,state:{init:()=>null,apply(e,t){let n=e.getMeta(m);if(null!=n)return-1==n?null:n;if(null==t||!e.docChanged)return t;let{deleted:r,pos:o}=e.mapping.mapResult(t);return r?null:o}},props:{decorations:N,handleDOMEvents:{mousedown:L},createSelectionBetween(e){if(null!=m.getState(e.state))return e.state.selection},handleTripleClick:P,handleKeyDown:R,handlePaste:B},appendTransaction:(t,n,r)=>function(e,t,n){let r,i,s=(t||e).selection,l=(t||e).doc;if(s instanceof o.nh&&(i=s.node.type.spec.tableRole)){if("cell"==i||"header_cell"==i)r=C.create(l,s.from);else if("row"==i){let e=l.resolve(s.from+1);r=C.rowSelection(e,e)}else if(!n){let e=p.get(s.node),t=s.from+1,n=t+e.map[e.width*e.height-1];r=C.create(l,t+1,n)}}else s instanceof o.U3&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<e.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 i=t.depth;i>=0&&!(t.before(i+1)>t.start(i));i--,r--);return n==r&&/row|table/.test(e.node(o).type.spec.tableRole)}(s)?r=o.U3.create(l,s.from):s instanceof o.U3&&function({$from:e,$to:t}){let n,r;for(let o=e.depth;o>0;o--){let t=e.node(o);if("cell"===t.type.spec.tableRole||"header_cell"===t.type.spec.tableRole){n=t;break}}for(let o=t.depth;o>0;o--){let e=t.node(o);if("cell"===e.type.spec.tableRole||"header_cell"===e.type.spec.tableRole){r=e;break}}return n!==r&&0===t.parentOffset}(s)&&(r=o.U3.create(l,s.$from.start(),s.$from.end()));return r&&(t||(t=e.tr)).setSelection(r),t}(r,W(r,n),e)})}function fe(e,t,n,r,o,i){let s=0,l=!0,a=t.firstChild;
1const c=e.firstChild;for(let d=0,h=0;d<c.childCount;d+=1){const{colspan:e,colwidth:n}=c.child(d).attrs;for(let c=0;c<e;c+=1,h+=1){const e=o===h?i:n&&n[c],d=e?`${e}px`:"";s+=e||r,e||(l=!1),a?(a.style.width!==d&&(a.style.width=d),a=a.nextSibling):t.appendChild(document.createElement("col")).style.width=d}}for(;a;){const e=a.nextSibling;a.parentNode.removeChild(a),a=e}l?(n.style.width=`${s}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${s}px`)}class me{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),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.cellMinWidth),!0)}ignoreMutation(e){return"attributes"===e.type&&(e.target===this.table||this.colgroup.contains(e.target))}}function ge(e,t){return t?e.createChecked(null,t):e.createAndFill()}const ye=({editor:e})=>{const{selection:t}=e.state;if(!(t instanceof C))return!1;let n=0;const o=(0,r.eL)(t.ranges[0].$from,e=>"table"===e.type.name);return null==o||o.node.descendants(e=>{if("table"===e.type.name)return!1;["tableCell","tableHeader"].includes(e.type.name)&&(n+=1)}),n===t.ranges.length&&(e.commands.deleteTable(),!0)},we=r.bP.create({name:"table",addOptions:()=>({HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:me,lastColumnResizable:!0,allowTableNodeSelection:!1}),content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML:()=>[{tag:"table"}],renderHTML({HTMLAttributes:e}){return["table",(0,r.KV)(this.options.HTMLAttributes,e),["tbody",0]]},addCommands:()=>({insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const l=function(e,t,n,r,o){const i=function(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;const t={};return Object.keys(e.nodes).forEach(n=>{const r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}(e),s=[],l=[];for(let c=0;c<n;c+=1){const e=ge(i.cell,o);if(e&&l.push(e),r){const e=ge(i.header_cell,o);e&&s.push(e)}}const a=[];for(let c=0;c<t;c+=1)a.push(i.row.createChecked(null,r&&0===c?s:l));return i.table.createChecked(null,a)}(s.schema,e,t,n);if(i){const e=r.selection.anchor+1;r.replaceSelectionWith(l).scrollIntoView().setSelection(o.U3.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>function(e,t){if(!y(e))return!1;if(t){let n=_(e);t(q(e.tr,n,n.left))}return!0}(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>function(e,t){if(!y(e))return!1;if(t){let n=_(e);t(q(e.tr,n,n.right))}return!0}(e,t),deleteColumn:()=>({state:e,dispatch:t})=>function(e,t){if(!y(e))return!1;if(t){let n=_(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;U(r,n,e),e!=n.left;e--)n.table=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc,n.map=p.get(n.table);t(r)}return!0}(e,t),addRowBefore:()=>({state:e,dispatch:t})=>function(e,t){if(!y(e))return!1;if(t){let n=_(e);t(G(e.tr,n,n.top))}return!0}(e,t),addRowAfter:()=>({state:e,dispatch:t})=>function(e,t){if(!y(e))return!1;if(t){let n=_(e);t(G(e.tr,n,n.bottom))}return!0}(e,t),deleteRow:()=>({state:e,dispatch:t})=>function(e,t){if(!y(e))return!1;if(t){let n=_(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;X(r,n,e),e!=n.top;e--)n.table=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc,n.map=p.get(n.table);t(r)}return!0}(e,t),deleteTable:()=>({state:e,dispatch:t})=>function(e,t){let 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}(e,t),mergeCells:()=>({state:e,dispatch:t})=>Y(e,t),splitCell:()=>({state:e,dispatch:t})=>Q(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>te("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>te("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>ne(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>!!Y(e,t)||Q(e,t),setCellAttribute:(e,t)=>
1({state:n,dispatch:r})=>function(e,t){return function(n,r){if(!y(n))return!1;let o=w(n);if(o.nodeAfter.attrs[e]===t)return!1;if(r){let i=n.tr;n.selection instanceof C?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&i.setNodeMarkup(r,null,S(n.attrs,e,t))}):i.setNodeMarkup(o.pos,null,S(o.nodeAfter.attrs,e,t)),r(i)}return!0}}(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>re(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>re(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&W(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){const n=C.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}),addKeyboardShortcuts(){return{Tab:()=>!!this.editor.commands.goToNextCell()||!!this.editor.can().addRowAfter()&&this.editor.chain().addRowAfter().goToNextCell().run(),"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:ye,"Mod-Backspace":ye,Delete:ye,"Mod-Delete":ye}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[le({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],ue({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){const t={name:e.name,options:e.options,storage:e.storage};return{tableRole:(0,r.gk)((0,r.iI)(e,"tableRole",t))}}})},14450(e,t,n){n.d(t,{A:()=>r});const r=n(45163).bP.create({name:"text",group:"inline"})},14458(e,t,n){n.d(t,{n:()=>r});const r=n(45163).YY.create({name:"textAlign",addOptions:()=>({types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}),addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>e.style.textAlign||this.options.defaultAlignment,renderHTML:e=>e.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${e.textAlign}`}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>!!this.options.alignments.includes(e)&&this.options.types.every(n=>t.updateAttributes(n,{textAlign:e})),unsetTextAlign:()=>({commands:e})=>this.options.types.every(t=>e.resetAttributes(t,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}})},36822(e,t,n){n.d(t,{A:()=>o});var r=n(45163);const o=r.CU.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",(0,r.KV)(this.options.HTMLAttributes,e),0]},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}})},38262(e,t,n){n.d(t,{$L:()=>E,Ln:()=>w,N0:()=>T,Um:()=>A,Wg:()=>b,dL:()=>j,jP:()=>S,n9:()=>O,oM:()=>x,zy:()=>C});var r=n(58903);const o=Math.pow(2,16);function i(e,t){return e+t*o}function s(e){return 65535&e}class l{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class a{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&a.empty)return a.empty}recover(e){let t=0,n=s(e);if(!this.inverted)for(let 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))/o}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[a+o],h=this.ranges[a+s],p=c+d;if(e<=p){let o=c+r+((d?e==c?-1:e==p?1:t:t)<0?0:h);if(n)return o;let s=e==(t<0?c:p)?null:i(a/3,e-c),u=e==c?2:e==p?1:4;return(t<0?e!=c:e!=p)&&(u|=8),new l(o,u,s)}r+=h-d}return n?e+r:new l(e+r,0,null)}touches(e,t){let n=0,r=s(t),o=this.inverted?2:1,i=this.inverted?1:2;
vendor: 18,799 bytes, line 1
1for(let s=0;s<this.ranges.length;s+=3){let t=this.ranges[s]-(this.inverted?n:0);if(t>e)break;let l=this.ranges[s+o];if(e<=t+l&&s==3*r)return!0;n+=this.ranges[s+i]-l}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),l=i+(this.inverted?0:o),a=this.ranges[r+t],c=this.ranges[r+n];e(s,s+a,l,l+c),o+=c-a}}invert(){return new a(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?a.empty:new a(e<0?[0,-e,0]:[0,0,e])}}a.empty=new a([]);class c{constructor(e=[],t,n=0,r=e.length){this.maps=e,this.mirror=t,this.from=n,this.to=r}slice(e=0,t=this.maps.length){return new c(this.maps,this.mirror,e,t)}copy(){return new c(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,n=this.maps.length;t<e.maps.length;t++){let r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new c;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let o=this.from;o<this.to;o++){let n=this.maps[o].mapResult(e,t);if(null!=n.recover){let t=this.getMirror(o);if(null!=t&&t>o&&t<this.to){o=t,e=this.maps[t].recover(n.recover);continue}}r|=n.delInfo,e=n.pos}return n?e:new l(e,r,null)}}const d=Object.create(null);class h{getMap(){return a.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=d[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in d)throw new RangeError("Duplicate use of step JSON ID "+e);return d[e]=t,t.prototype.jsonID=e,t}}class p{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new p(e,null)}static fail(e){return new p(null,e)}static fromReplace(e,t,n,o){try{return p.ok(e.replace(t,n,o))}catch(i){if(i instanceof r.vI)return p.fail(i.message);throw i}}}function u(e,t,n){let o=[];for(let r=0;r<e.childCount;r++){let i=e.child(r);i.content.size&&(i=i.copy(u(i.content,t,i))),i.isInline&&(i=t(i,n,r)),o.push(i)}return r.FK.fromArray(o)}class f extends h{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),o=n.node(n.sharedDepth(this.to)),i=new r.Ji(u(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,o),t.openStart,t.openEnd);return p.fromReplace(e,this.from,this.to,i)}invert(){return new m(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new f(t.pos,n.pos,this.mark)}merge(e){return e instanceof f&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new f(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new f(t.from,t.to,e.markFromJSON(t.mark))}}h.jsonID("addMark",f);class m extends h{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new r.Ji(u(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return p.fromReplace(e,this.from,this.to,n)}invert(){return new f(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new m(t.pos,n.pos,this.mark)}merge(e){return e instanceof m&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new m(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new m(t.from,t.to,e.markFromJSON(t.mark))}}h.jsonID("removeMark",m);class g extends h{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return p.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return p.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new g(this.pos,t.marks[n]);return new g(this.pos,this.mark)}}return new y(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new g(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new g(t.pos,e.markFromJSON(t.mark))}}h.jsonID("addNodeMark",g);class y extends h{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return p.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return p.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new g(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new y(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new y(t.pos,e.markFromJSON(t.mark))}}h.jsonID("removeNodeMark",y);class w extends h{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&v(e,this.from,this.to)?p.fail("Structure replace would overwrite content"):p.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new a([this.from,this.to-this.from,this.slice.size])}invert(e){return new w(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new w(t.pos,Math.max(t.pos,n.pos),this.slice)}merge(e){if(!(e instanceof w)||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;{let t=this.slice.size+e.slice.size==0?r.Ji.empty:new r.Ji(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new w(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?r.Ji.empty:new r.Ji(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new w(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new w(t.from,t.to,r.Ji.fromJSON(e,t.slice),!!t.structure)}}h.jsonID("replace",w);class b extends h{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(v(e,this.from,this.gapFrom)||v(e,this.gapTo,this.to)))return p.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return p.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?p.fromReplace(e,this.from,this.to,n):p.fail("Content does not fit in gap")}getMap(){return new a([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new b(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)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=e.map(this.gapFrom,-1),o=e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new b(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let 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}static fromJSON(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 b(t.from,t.to,t.gapFrom,t.gapTo,r.Ji.fromJSON(e,t.slice),t.insert,!!t.structure)}}function v(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function k(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function S(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth;;--n){let 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||!k(r,o,i))break}return null}function x(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let a=r;l&&a<o;a++)l=l.matchType(n.child(a).type);return l&&l.validEnd?s:null}(r,t);return i?o.map(M).concat({type:t,attrs:n}).concat(i.map(M)):null}function M(e){return{type:e,attrs:null}}function C(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,d=n-2;c>i;c--,d--){let e=o.node(c),t=o.index(c);if(e.type.spec.isolating)return!1;let n=e.content.cutByIndex(t,e.childCount),i=r&&r[d]||e;if(i!=e&&(n=n.replaceChild(0,i.type.create(i.attrs))),!e.canReplace(t+1,e.childCount)||!i.type.validContent(n))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function O(e,t){let n=e.resolve(t),r=n.index();return N(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function N(e,t){return!(!e||!t||e.isLeaf||!e.canAppend(t))}function T(e,t,n=-1){let r=e.resolve(t);for(let o=r.depth;;o--){let e,i,s=r.index(o);if(o==r.depth?(e=r.nodeBefore,i=r.nodeAfter):n>0?(e=r.node(o+1),s++,i=r.node(o).maybeChild(s)):(e=r.node(o).maybeChild(s-1),i=r.node(o+1)),e&&!e.isTextblock&&N(e,i)&&r.node(o).canReplace(s,s+1))return t;if(0==o)break;t=n<0?r.before(o):r.after(o)}}function A(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(0==n.openStart&&n.size?2:1);i++)for(let e=r.depth;e>=0;e--){let t=e==r.depth?0:r.pos<=(r.start(e+1)+r.end(e+1))/2?-1:1,n=r.index(e)+(t>0?1:0),s=r.node(e),l=!1;if(1==i)l=s.canReplace(n,n,o);else{let e=s.contentMatchAt(n).findWrapping(o.firstChild.type);l=e&&s.canReplaceWith(n,n,e[0])}if(l)return 0==t?r.pos:t<0?r.before(e+1):r.after(e+1)}return null}function E(e,t,n=t,o=r.Ji.empty){if(t==n&&!o.size)return null;let i=e.resolve(t),s=e.resolve(n);return D(i,s,o)?new w(t,n,o):new R(i,s,o).fit()}function D(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}h.jsonID("replaceAround",b);class R{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=r.FK.empty;for(let r=0;r<=e.depth;r++){let t=e.node(r);this.frontier.push({type:t.type,match:t.contentMatchAt(e.indexAfter(r))})}for(let o=e.depth;o>0;o--)this.placed=r.FK.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,o=this.close(e<0?this.$to:n.doc.resolve(e));if(!o)return null;let i=this.placed,s=n.depth,l=o.depth;for(;s&&l&&1==i.childCount;)i=i.firstChild.content,s--,l--;let a=new r.Ji(i,s,l);return e>-1?new b(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new w(n.pos,o.pos,a):null}findFittable(){for(let e=1;e<=2;e++)for(let t=this.unplaced.openStart;t>=0;t--){let n,o=null;t?(o=I(this.unplaced.content,t-1).firstChild,n=o.content):n=this.unplaced.content;let i=n.firstChild;for(let s=this.depth;s>=0;s--){let n,{type:l,match:a}=this.frontier[s],c=null;if(1==e&&(i?a.matchType(i.type)||(c=a.fillBefore(r.FK.from(i),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:t,frontierDepth:s,parent:o,inject:c};if(2==e&&i&&(n=a.findWrapping(i.type)))return{sliceDepth:t,frontierDepth:s,parent:o,wrap:n};if(o&&a.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,o=I(e,t);return!(!o.childCount||o.firstChild.isLeaf||(this.unplaced=new r.Ji(e,t+1,Math.max(n,o.size+t>=e.size-n?t+1:0)),0))}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,o=I(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new r.Ji($(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new r.Ji($(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let r=0;r<i.length;r++)this.openFrontierNode(i[r]);let s=this.unplaced,l=n?n.content:s.content,a=s.openStart-e,c=0,d=[],{match:h,type:p}=this.frontier[t];if(o){for(let e=0;e<o.childCount;e++)d.push(o.child(e));h=h.matchFragment(o)}let u=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let e=l.child(c),t=h.matchType(e.type);if(!t)break;c++,(c>1||0==a||e.content.size)&&(h=t,d.push(F(e.mark(p.allowedMarks(e.marks)),1==c?a:0,c==l.childCount?u:-1)))}let f=c==l.childCount;f||(u=-1),this.placed=z(this.placed,t,r.FK.from(d)),this.frontier[t].match=h,f&&u<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let r=0,m=l;r<u;r++){let e=m.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),m=e.content}this.unplaced=f?0==e?r.Ji.empty:new r.Ji($(s.content,e-1,1),e-1,u<0?s.openEnd:e-1):new r.Ji($(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!P(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;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=P(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=P(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=z(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=z(this.placed,this.depth,r.FK.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(r.FK.empty,!0);e.childCount&&(this.placed=z(this.placed,this.frontier.length,e))}}function $(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy($(e.firstChild.content,t-1,n)))}function z(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(z(e.lastChild.content,t-1,n)))}function I(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function F(e,t,n){if(t<=0)return e;let o=e.content;return t>1&&(o=o.replaceChild(0,F(o.firstChild,t-1,1==o.childCount?n-1:0))),t>0&&(o=e.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(e.type.contentMatch.matchFragment(o).fillBefore(r.FK.empty,!0)))),e.copy(o)}function P(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?l:null}function B(e){return e.spec.defining||e.spec.definingForContent}function L(e,t,n,o,i){if(t<n){let r=e.firstChild;e=e.replaceChild(0,r.copy(L(r.content,t+1,n,o,r)))}if(t>o){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(r.FK.empty,!0))}return e}function V(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let 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}class J extends h{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return p.fail("No node at attribute step's position");let n=Object.create(null);for(let r in t.attrs)n[r]=t.attrs[r];n[this.attr]=this.value;let o=t.type.create(n,null,t.marks);return p.fromReplace(e,this.pos,this.pos+1,new r.Ji(r.FK.from(o),0,t.isLeaf?0:1))}getMap(){return a.empty}
1invert(e){return new J(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new J(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new J(t.pos,t.attr,t.value)}}h.jsonID("attr",J);let K=class extends Error{};K=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(K.prototype=Object.create(Error.prototype)).constructor=K,K.prototype.name="TransformError";class j{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new c}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new K(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=r.Ji.empty){let o=E(this.doc,e,t,n);return o&&this.step(o),this}replaceWith(e,t,n){return this.replace(e,t,new r.Ji(r.FK.from(n),0,0))}delete(e,t){return this.replace(e,t,r.Ji.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,o){if(!o.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),s=e.doc.resolve(n);if(D(i,s,o))return e.step(new w(t,n,o));let l=V(i,e.doc.resolve(n));0==l[l.length-1]&&l.pop();let a=-(i.depth+1);l.unshift(a);for(let r=i.depth,u=i.pos-1;r>0;r--,u--){let e=i.node(r).type.spec;if(e.defining||e.definingAsContext||e.isolating)break;l.indexOf(r)>-1?a=r:i.before(r)==u&&l.splice(1,0,-r)}let c=l.indexOf(a),d=[],h=o.openStart;for(let r=o.content,u=0;;u++){let e=r.firstChild;if(d.push(e),u==o.openStart)break;r=e.content}for(let r=h-1;r>=0;r--){let e=d[r].type,t=B(e);if(t&&i.node(c).type!=e)h=r;else if(t||!e.isTextblock)break}for(let u=o.openStart;u>=0;u--){let t=(u+h+1)%(o.openStart+1),a=d[t];if(a)for(let d=0;d<l.length;d++){let h=l[(d+c)%l.length],p=!0;h<0&&(p=!1,h=-h);let u=i.node(h-1),f=i.index(h-1);if(u.canReplaceWith(f,f,a.type,a.marks))return e.replace(i.before(h),p?s.after(h):n,new r.Ji(L(o.content,0,o.openStart,t),t,o.openEnd))}}let p=e.steps.length;for(let r=l.length-1;r>=0&&(e.replace(t,n,o),!(e.steps.length>p));r--){let e=l[r];e<0||(t=i.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,o){if(!o.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let r=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let o=r.depth-1;o>=0;o--){let e=r.index(o);if(r.node(o).canReplaceWith(e,e,n))return r.before(o+1);if(e>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let e=r.indexAfter(o);if(r.node(o).canReplaceWith(e,e,n))return r.after(o+1);if(e<r.node(o).childCount)return null}return null}(e.doc,t,o.type);null!=r&&(t=n=r)}e.replaceRange(t,n,new r.Ji(r.FK.from(o),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=V(r,o);for(let s=0;s<i.length;s++){let t=i[s],n=s==i.length-1;if(n&&0==t||r.node(t).type.contentMatch.validEnd)return e.delete(r.start(t),o.end(t));if(t>0&&(n||r.node(t-1).canReplace(r.index(t-1),o.indexAfter(t-1))))return e.delete(r.before(t),o.after(t))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(t-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s)return e.delete(r.before(s),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:o,$to:i,depth:s}=t,l=o.before(s+1),a=i.after(s+1),c=l,d=a,h=r.FK.empty,p=0;for(let m=s,g=!1;m>n;m--)g||o.index(m)>0?(g=!0,h=r.FK.from(o.node(m).copy(h)),p++):c--;let u=r.FK.empty,f=0;for(let m=s,g=!1;m>n;m--)g||i.after(m+1)<i.end(m)?(g=!0,u=r.FK.from(i.node(m).copy(u)),f++):d++;e.step(new b(c,d,l,a,new r.Ji(h.append(u),p,f),h.size-p,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let o=new w(t-n,t+n,r.Ji.empty,!0);e.step(o)}(this,e,t),this}wrap(e,t){return function(e,t,n){let o=r.FK.empty;for(let l=n.length-1;l>=0;l--){if(o.size){let e=n[l].type.contentMatch.matchFragment(o);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=r.FK.from(n[l].type.create(n[l].attrs,o))}let i=t.start,s=t.end;e.step(new b(i,s,i,s,new r.Ji(o,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,o=null){return function(e,t,n,o,i){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{if(t.isTextblock&&!t.hasMarkup(o,i)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(s).map(n),o)){e.clearIncompatible(e.mapping.slice(s).map(n,1),o);let l=e.mapping.slice(s),a=l.map(n,1),c=l.map(n+t.nodeSize,1);return e.step(new b(a,c,a+1,c-1,new r.Ji(r.FK.from(o.create(i,null,t.marks)),0,0),1,!0)),!1}})}(this,e,t,n,o),this}setNodeMarkup(e,t,n=null,o=[]){return function(e,t,n,o,i){let s=e.doc.nodeAt(t);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let l=n.create(o,null,i||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,l);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new b(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new r.Ji(r.FK.from(l),0,0),1,!0))}(this,e,t,n,o),this}setNodeAttribute(e,t,n){return this.step(new J(e,t,n)),this}addNodeMark(e,t){return this.step(new g(e,t)),this}
1removeNodeMark(e,t){if(!(t instanceof r.CU)){let 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 y(e,t)),this}split(e,t=1,n){return function(e,t,n=1,o){let i=e.doc.resolve(t),s=r.FK.empty,l=r.FK.empty;for(let a=i.depth,c=i.depth-n,d=n-1;a>c;a--,d--){s=r.FK.from(i.node(a).copy(s));let e=o&&o[d];l=r.FK.from(e?e.type.create(e.attrs,l):i.node(a).copy(l))}e.step(new w(t,t,new r.Ji(s.append(l),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],l=[];e.doc.nodesBetween(t,n,(e,a,c)=>{if(!e.isInline)return;let d=e.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let c=Math.max(a,t),h=Math.min(a+e.nodeSize,n),p=r.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(p)||(o&&o.to==c&&o.mark.eq(d[e])?o.to=h:s.push(o=new m(c,h,d[e])));i&&i.to==c?i.to=h:l.push(i=new f(c,h,r))}}),s.forEach(t=>e.step(t)),l.forEach(t=>e.step(t))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,o){let i=[],s=0;e.doc.nodesBetween(t,n,(e,l)=>{if(!e.isInline)return;s++;let a=null;if(o instanceof r.sX){let t,n=e.marks;for(;t=o.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else o?o.isInSet(e.marks)&&(a=[o]):a=e.marks;if(a&&a.length){let r=Math.min(l+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,o=a[e];for(let e=0;e<i.length;e++){let t=i[e];t.step==s-1&&o.eq(i[e].style)&&(n=t)}n?(n.to=r,n.step=s):i.push({style:o,from:Math.max(l,t),to:r,step:s})}}}
1),i.forEach(t=>e.step(new m(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return function(e,t,n,o=n.contentMatch){let i=e.doc.nodeAt(t),s=[],l=t+1;for(let a=0;a<i.childCount;a++){let t=i.child(a),c=l+t.nodeSize,d=o.matchType(t.type);if(d){o=d;for(let r=0;r<t.marks.length;r++)n.allowsMarkType(t.marks[r].type)||e.step(new m(l,c,t.marks[r]))}else s.push(new w(l,c,r.Ji.empty));l=c}if(!o.validEnd){let t=o.fillBefore(r.FK.empty,!0);e.replace(l,l,new r.Ji(t,0,0))}for(let r=s.length-1;r>=0;r--)e.step(s[r])}(this,e,t,n),this}}},38701(e,t,n){n.d(t,{K:()=>g,w:()=>m});for(var r={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:"'"},o={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},i="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),s=("undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)),l="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),a=s||i&&+i[1]<57,c=0;c<10;c++)r[48+c]=r[96+c]=String(c);for(c=1;c<=24;c++)r[c+111]="F"+c;for(c=65;c<=90;c++)r[c]=String.fromCharCode(c+32),o[c]=String.fromCharCode(c);for(var d in r)o.hasOwnProperty(d)||(o[d]=r[d]);var h=n(42845);const p="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function u(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let l=0;l<i.length-1;l++){let e=i[l];if(/^(cmd|meta|m)$/i.test(e))o=!0;else if(/^a(lt)?$/i.test(e))t=!0;else if(/^(c|ctrl|control)$/i.test(e))n=!0;else if(/^s(hift)?$/i.test(e))r=!0;else{if(!/^mod$/i.test(e))throw new Error("Unrecognized modifier name: "+e);p?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function f(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}function m(e){return new h.k_({props:{handleKeyDown:g(e)}})}function g(e){let t=function(e){let t=Object.create(null);for(let n in e)t[u(n)]=e[n];return t}(e);return function(e,n){let i,s=function(e){var t=!(a&&(e.ctrlKey||e.altKey||e.metaKey)||l&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?o:r)[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}(n),c=1==s.length&&" "!=s,d=t[f(s,n,!c)];if(d&&d(e.state,e.dispatch,e))return!0;if(c&&(n.shiftKey||n.altKey||n.metaKey||s.charCodeAt(0)>127)&&(i=r[n.keyCode])&&i!=s){let r=t[f(i,n,!0)];if(r&&r(e.state,e.dispatch,e))return!0}else if(c&&n.shiftKey){let r=t[f(s,n,!0)];if(r&&r(e.state,e.dispatch,e))return!0}return!1}}},42845(e,t,n){n.d(t,{$t:()=>x,LN:()=>s,U3:()=>d,hs:()=>T,i5:()=>f,k_:()=>C,nh:()=>p,yn:()=>l});var r=n(58903),o=n(38262);const i=Object.create(null);class s{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new l(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=r.Ji.empty){let n=t.content.lastChild,o=null;for(let r=0;r<t.openEnd;r++)o=n,n=n.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(c.pos),l?r.Ji.empty:t),0==l&&y(e,i,(n?n.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],l=e.mapping.slice(n),a=l.map(i.pos),c=l.map(s.pos);o?e.deleteRange(a,c):(e.replaceRangeWith(a,c,t),y(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new d(e):g(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let o=e.depth-1;o>=0;o--){let r=t<0?g(e.node(0),e.node(o),e.before(o+1),e.index(o),t,n):g(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,n);if(r)return r}return null}
1static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new f(e.node(0))}static atStart(e){return g(e,e,0,0,1)||new f(e)}static atEnd(e){return g(e,e,e.content.size,e.childCount,-1)||new f(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=i[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in i)throw new RangeError("Duplicate use of selection JSON ID "+e);return i[e]=t,t.prototype.jsonID=e,t}getBookmark(){return d.between(this.$anchor,this.$head).getBookmark()}}s.prototype.visible=!0;class l{constructor(e,t){this.$from=e,this.$to=t}}let a=!1;function c(e){a||e.parent.inlineContent||(a=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class d extends s{constructor(e,t=e){c(e),c(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return s.near(n);let r=e.resolve(t.map(this.anchor));return new d(r.parent.inlineContent?r:n,n)}replace(e,t=r.Ji.empty){if(super.replace(e,t),t==r.Ji.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof d&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new h(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new d(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=s.findFrom(t,n,!0)||s.findFrom(t,-n,!0);if(!e)return s.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(s.findFrom(e,-n,!0)||s.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new d(e,t)}}s.jsonID("text",d);class h{constructor(e,t){this.anchor=e,this.head=t}map(e){return new h(e.map(this.anchor),e.map(this.head))}resolve(e){return d.between(e.resolve(this.anchor),e.resolve(this.head))}}class p extends s{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?s.near(o):new p(o)}content(){return new r.Ji(r.FK.from(this.node),0,0)}eq(e){return e instanceof p&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new u(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new p(e.resolve(t.anchor))}static create(e,t){return new p(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}p.prototype.visible=!1,s.jsonID("node",p);class u{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new h(n,n):new u(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&p.isSelectable(n)?new p(t):s.near(t)}}class f extends s{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=r.Ji.empty){if(t==r.Ji.empty){e.delete(0,e.doc.content.size);let t=s.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new f(e)}map(e){return new f(e)}eq(e){return e instanceof f}getBookmark(){return m}}s.jsonID("all",f);const m={map(){return this},resolve:e=>new f(e)};function g(e,t,n,r,o,i=!1){if(t.inlineContent)return d.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&p.isSelectable(r))return p.create(e,n-(o<0?r.nodeSize:0))}else{let t=g(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function y(e,t,n){let r=e.steps.length-1;if(r<t)return;let i,l=e.steps[r];(l instanceof o.Ln||l instanceof o.Wg)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==i&&(i=r)}),e.setSelection(s.near(e.doc.resolve(i),n)))}class w extends o.dL{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){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}setSelection(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}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return r.CU.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||r.CU.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let 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);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.setSelection(s.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function b(e,t){return t&&e?e.bind(t):e}
1class v{constructor(e,t,n){this.name=e,this.init=b(t.init,n),this.apply=b(t.apply,n)}}const k=[new v("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new v("selection",{init:(e,t)=>e.selection||s.atStart(t.doc),apply:e=>e.selection}),new v("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new v("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class S{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=k.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new v(e.key,e.spec.state,e))})}}class x{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let l=r?r[i].n:0,a=r?r[i].state:this,c=l<t.length&&s.spec.appendTransaction.call(s,l?t.slice(l):t,a,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<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}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new x(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new w(this)}static create(e){let t=new S(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new x(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new S(this.schema,e.plugins),n=t.fields,r=new x(t);for(let o=0;o<n.length;o++){let t=n[o].name;r[t]=this.hasOwnProperty(t)?this[t]:n[o].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new S(e.schema,e.plugins),i=new x(o);return o.fields.forEach(o=>{if("doc"==o.name)i.doc=r.bP.fromJSON(e.schema,t.doc);else if("selection"==o.name)i.selection=s.fromJSON(i.doc,t.selection);else if("storedMarks"==o.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let r in n){let s=n[r],l=s.spec.state;if(s.key==o.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(t,r))return void(i[o.name]=l.fromJSON.call(s,e,t[r],i))}i[o.name]=o.init(e,i)}}),i}}function M(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=M(o,t,{})),n[r]=o}return n}class C{constructor(e){this.spec=e,this.props={},e.props&&M(e.props,this,this.props),this.key=e.key?e.key.key:N("plugin")}getState(e){return e[this.key]}}const O=Object.create(null);function N(e){return e in O?e+"$"+ ++O[e]:(O[e]=0,e+"$")}class T{constructor(e="key"){this.key=N(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}},42985(e,t,n){n.d(t,{$Z:()=>h,hG:()=>u});var r=n(96540),o=n.n(r),i=n(45163),s=n(40961),l=n.n(s);class a extends i.KE{constructor(){super(...arguments),this.contentComponent=null}}const c=({renderers:e})=>o().createElement(o().Fragment,null,Object.entries(e).map(([e,t])=>l().createPortal(t.reactElement,t.element,e)));class d extends o().Component{constructor(e){super(e),this.editorContentRef=o().createRef(),this.initialized=!1,this.state={renderers:{}}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const{editor:e}=this.props;if(e&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=this,e.createNodeViews(),this.initialized=!0}}maybeFlushSync(e){this.initialized?(0,s.flushSync)(e):e()}setRenderer(e,t){this.maybeFlushSync(()=>{this.setState(({renderers:n})=>({renderers:{...n,[e]:t}}))})}removeRenderer(e){this.maybeFlushSync(()=>{this.setState(({renderers:t})=>{const n={...t};return delete n[e],{renderers:n}})})}componentWillUnmount(){const{editor:e}=this.props;if(!e)return;if(e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null,!e.options.element.firstChild)return;const t=document.createElement("div");t.append(...e.options.element.childNodes),e.setOptions({element:t})}render(){const{editor:e,...t}=this.props;return o().createElement(o().Fragment,null,o().createElement("div",{ref:this.editorContentRef,...t}),o().createElement(c,{renderers:this.state.renderers}))}}const h=o().memo(d),p=(0,r.createContext)({onDragStart:void 0});o().forwardRef((e,t)=>
1{const{onDragStart:n}=(0,r.useContext)(p),i=e.as||"div";return o().createElement(i,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});const u=(e={},t=[])=>{const[n,o]=(0,r.useState)(null),i=function(){const[,e]=(0,r.useState)(0);return()=>e(e=>e+1)}();return(0,r.useEffect)(()=>{let t=!0;const n=new a(e);return o(n),n.on("transaction",()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t&&i()})})}),()=>{n.destroy(),t=!1}},t),n}},43138(e,t,n){n.d(t,{A:()=>o});var r=n(45163);const o=r.bP.create({name:"tableRow",addOptions:()=>({HTMLAttributes:{}}),content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML:()=>[{tag:"tr"}],renderHTML({HTMLAttributes:e}){return["tr",(0,r.KV)(this.options.HTMLAttributes,e),0]}})},45163(e,t,n){n.d(t,{KE:()=>Le,YY:()=>ne,CU:()=>Ke,bP:()=>je,gk:()=>K,eL:()=>Se,iI:()=>I,OX:()=>Ve,Zc:()=>He,KV:()=>L,JJ:()=>Je});var r=n(42845),o=n(1575),i=n(38701),s=n(58903),l=n(38262);const a=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);const c=(e,t,n)=>{let o=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}(e,n);if(!o)return!1;let i=p(o);if(!i){let n=o.blockRange(),r=n&&(0,l.jP)(n);return null!=r&&(t&&t(e.tr.lift(n,r).scrollIntoView()),!0)}let a=i.nodeBefore;if(!a.type.spec.isolating&&S(e,i,t))return!0;if(0==o.parent.content.size&&(d(a,"end")||r.nh.isSelectable(a))){let n=(0,l.$L)(e.doc,o.before(),o.after(),s.Ji.empty);if(n&&n.slice.size<n.to-n.from){if(t){let o=e.tr.step(n);o.setSelection(d(a,"end")?r.LN.findFrom(o.doc.resolve(o.mapping.map(i.pos,-1)),-1):r.nh.create(o.doc,i.pos-a.nodeSize)),t(o.scrollIntoView())}return!0}}return!(!a.isAtom||i.depth!=o.depth-1||(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),0))};function d(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const h=(e,t,n)=>{let{$head:o,empty:i}=e.selection,s=o;if(!i)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):o.parentOffset>0)return!1;s=p(o)}let l=s&&s.nodeBefore;return!(!l||!r.nh.isSelectable(l)||(t&&t(e.tr.setSelection(r.nh.create(e.doc,s.pos-l.nodeSize)).scrollIntoView()),0))};function p(e){if(!e.parent.type.spec.isolating)for(let 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}const u=(e,t,n)=>{let o=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}(e,n);if(!o)return!1;let i=m(o);if(!i)return!1;let a=i.nodeAfter;if(S(e,i,t))return!0;if(0==o.parent.content.size&&(d(a,"start")||r.nh.isSelectable(a))){let n=(0,l.$L)(e.doc,o.before(),o.after(),s.Ji.empty);if(n&&n.slice.size<n.to-n.from){if(t){let o=e.tr.step(n);o.setSelection(d(a,"start")?r.LN.findFrom(o.doc.resolve(o.mapping.map(i.pos)),1):r.nh.create(o.doc,o.mapping.map(i.pos))),t(o.scrollIntoView())}return!0}}return!(!a.isAtom||i.depth!=o.depth-1||(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),0))},f=(e,t,n)=>{let{$head:o,empty:i}=e.selection,s=o;if(!i)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):o.parentOffset<o.parent.content.size)return!1;s=m(o)}let l=s&&s.nodeAfter;return!(!l||!r.nh.isSelectable(l)||(t&&t(e.tr.setSelection(r.nh.create(e.doc,s.pos)).scrollIntoView()),0))};function m(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let 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}const g=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))};function y(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const w=(e,t)=>{let{$head:n,$anchor:o}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(o))return!1;let i=n.node(-1),s=n.indexAfter(-1),l=y(i.contentMatchAt(s));if(!l||!i.canReplaceWith(s,s,l))return!1;if(t){let o=n.after(),i=e.tr.replaceWith(o,o,l.createAndFill());
1i.setSelection(r.LN.near(i.doc.resolve(o),1)),t(i.scrollIntoView())}return!0},b=(e,t)=>{let n=e.selection,{$from:o,$to:i}=n;if(n instanceof r.i5||o.parent.inlineContent||i.parent.inlineContent)return!1;let s=y(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let n=(!o.parentOffset&&i.index()<i.parent.childCount?o:i).pos,l=e.tr.insert(n,s.createAndFill());l.setSelection(r.U3.create(l.doc,n+1)),t(l.scrollIntoView())}return!0},v=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if((0,l.zy)(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&(0,l.jP)(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};var k;function S(e,t,n){let o,i,a=t.nodeBefore,c=t.nodeAfter;if(a.type.spec.isolating||c.type.spec.isolating)return!1;if(function(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(i,i+1)||!o.isTextblock&&!(0,l.n9)(e.doc,t.pos)||(n&&n(e.tr.clearIncompatible(t.pos,r.type,r.contentMatchAt(r.childCount)).join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let h=t.parent.canReplace(t.index(),t.index()+1);if(h&&(o=(i=a.contentMatchAt(a.childCount)).findWrapping(c.type))&&i.matchType(o[0]||c.type).validEnd){if(n){let r=t.pos+c.nodeSize,i=s.FK.empty;for(let e=o.length-1;e>=0;e--)i=s.FK.from(o[e].create(null,i));i=s.FK.from(a.copy(i));let d=e.tr.step(new l.Wg(t.pos-1,r,t.pos,r,new s.Ji(i,1,0),o.length,!0)),h=r+2*o.length;(0,l.n9)(d.doc,h)&&d.join(h),n(d.scrollIntoView())}return!0}let p=r.LN.findFrom(t,1),u=p&&p.$from.blockRange(p.$to),f=u&&(0,l.jP)(u);if(null!=f&&f>=t.depth)return n&&n(e.tr.lift(u,f).scrollIntoView()),!0;if(h&&d(c,"start",!0)&&d(a,"end")){let r=a,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let i=c,d=1;for(;!i.isTextblock;i=i.firstChild)d++;if(r.canReplace(r.childCount,r.childCount,i.content)){if(n){let r=s.FK.empty;for(let e=o.length-1;e>=0;e--)r=s.FK.from(o[e].copy(r));n(e.tr.step(new l.Wg(t.pos-o.length,t.pos+c.nodeSize,t.pos+d,t.pos+c.nodeSize-d,new s.Ji(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function x(e){return function(t,n){let o=t.selection,i=e<0?o.$from:o.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return!!i.node(s).isTextblock&&(n&&n(t.tr.setSelection(r.U3.create(t.doc,e<0?i.start(s):i.end(s)))),!0)}}const M=x(-1),C=x(1);function O(e,t=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:r},$to:{pos:s}}=n.selection.ranges[i];n.doc.nodesBetween(r,s,(r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}})}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,e,t)}r(o.scrollIntoView())}return!0}}function N(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let T=N(a,c,h),A=N(a,u,f);const E={Enter:N(g,b,v,(e,t)=>{let{$from:n,$to:o}=e.selection;if(e.selection instanceof r.nh&&e.selection.node.isBlock)return!(!n.parentOffset||!(0,l.zy)(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.parent.isBlock)return!1;if(t){let i=o.parentOffset==o.parent.content.size,s=e.tr;(e.selection instanceof r.U3||e.selection instanceof r.i5)&&s.deleteSelection();let a=0==n.depth?null:y(n.node(-1).contentMatchAt(n.indexAfter(-1))),c=k?[k]:i&&a?[{type:a}]:void 0,d=(0,l.zy)(s.doc,s.mapping.map(n.pos),1,c);if(c||d||!(0,l.zy)(s.doc,s.mapping.map(n.pos),1,a?[{type:a}]:void 0)||(a&&(c=[{type:a}]),d=!0),d&&(s.split(s.mapping.map(n.pos),1,c),!i&&!n.parentOffset&&n.parent.type!=a)){let e=s.mapping.map(n.before()),t=s.doc.resolve(e);a&&n.node(-1).canReplaceWith(t.index(),t.index()+1,a)&&s.setNodeMarkup(s.mapping.map(n.before()),a)}t(s.scrollIntoView())}return!0}),"Mod-Enter":w,Backspace:T,"Mod-Backspace":T,"Shift-Backspace":T,Delete:A,"Mod-Delete":A,"Mod-a":(e,t)=>
1(t&&t(e.tr.setSelection(new r.i5(e.doc))),!0)},D={"Ctrl-h":E.Backspace,"Alt-Backspace":E["Mod-Backspace"],"Ctrl-d":E.Delete,"Ctrl-Alt-Backspace":E["Mod-Delete"],"Alt-Delete":E["Mod-Delete"],"Alt-d":E["Mod-Delete"],"Ctrl-a":M,"Ctrl-e":C};for(let We in E)D[We]=E[We];function R(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),filterTransaction:t.filterTransaction,plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();class ${constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{const n=t(...e)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],l=!!e,a=e||o.tr,c={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{const r=this.buildProps(a,t),o=n(...e)(r);return s.push(o),c}])),run:()=>(l||!t||a.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(a),s.every(e=>!0===e))};return c}createCan(e){const{rawCommands:t,state:n}=this,r=!1,o=e||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r;o.storedMarks&&e.setStoredMarks(o.storedMarks);const s={tr:e,editor:r,view:i,state:R({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}}class z{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}function I(e,t,n){return void 0===e.config[t]&&e.parent?I(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?I(e.parent,t,n):null}):e.config[t]}function F(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function P(e){const t=[],{nodeExtensions:n,markExtensions:r}=F(e),o=[...n,...r],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(e=>{const n=I(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage});n&&n().forEach(e=>{e.types.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...i,...r}})})})})}),o.forEach(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=I(e,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach(([n,r])=>{const o={...i,...r};(null==r?void 0:r.isRequired)&&void 0===(null==r?void 0:r.default)&&delete o.default,t.push({type:e.name,name:n,attribute:o})})}),t}function B(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function L(...e){return e.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([e,t])=>{n[e]?n[e]="class"===e?[n[e],t].join(" "):"style"===e?[n[e],t].join("; "):t:n[e]=t}),n},{})}function V(e,t){return t.filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>
1L(e,t),{})}function J(e){return"function"==typeof e}function K(e,t=void 0,...n){return J(e)?t?e.bind(t)(...n):e(...n):e}function j(e,t){return e.style?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;const o=t.reduce((e,t)=>{const r=t.attribute.parseHTML?t.attribute.parseHTML(n):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(n.getAttribute(t.name));return null==r?e:{...e,[t.name]:r}},{});return{...r,...o}}}}function H(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function W(e,t){return t.nodes[e]||t.marks[e]||null}function _(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function q(e){return"[object RegExp]"===Object.prototype.toString.call(e)}class U{constructor(e){this.find=e.find,this.handler=e.handler}}function G(e){var t;const{editor:n,from:r,to:o,text:i,rules:s,plugin:l}=e,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(null===(t=c.nodeBefore||c.nodeAfter)||void 0===t?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let d=!1;const h=((e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,o,i)=>{var s,l;const a=(null===(l=(s=e.type.spec).toText)||void 0===l?void 0:l.call(s,{node:e,pos:t,parent:o,index:i}))||e.textContent||"%leaf%";n+=a.slice(0,Math.max(0,r-t))}),n})(c)+i;return s.forEach(e=>{if(d)return;const t=((e,t)=>{if(q(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[];return r.push(n.text),r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(h,e.find);if(!t)return;const s=a.state.tr,c=R({state:a.state,transaction:s}),p={from:r-(t[0].length-i.length),to:o},{commands:u,chain:f,can:m}=new $({editor:n,state:c});null!==e.handler({state:c,range:p,match:t,commands:u,chain:f,can:m})&&s.steps.length&&(s.setMeta(l,{transform:s,from:r,to:o,text:i}),a.dispatch(s),d=!0)}),d}function X(e){const{editor:t,rules:n}=e,o=new r.k_({state:{init:()=>null,apply:(e,t)=>e.getMeta(o)||(e.selectionSet||e.docChanged?null:t)},props:{handleTextInput:(e,r,i,s)=>G({editor:t,from:r,to:i,text:s,rules:n,plugin:o}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{const{$cursor:r}=e.state.selection;r&&G({editor:t,from:r.pos,to:r.pos,text:"",rules:n,plugin:o})}),!1)},handleKeyDown(e,r){if("Enter"!==r.key)return!1;const{$cursor:i}=e.state.selection;return!!i&&G({editor:t,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:o})}},isInputRules:!0});return o}class Z{constructor(e){this.find=e.find,this.handler=e.handler}}function Y(e){const{editor:t,rules:n}=e;let o=null,i=!1,s=!1;return n.map(e=>new r.k_({view(e){const t=t=>{var n;o=(null===(n=e.dom.parentElement)||void 0===n?void 0:n.contains(t.target))?e.dom.parentElement:null};return window.addEventListener("dragstart",t),{destroy(){window.removeEventListener("dragstart",t)}}},props:{handleDOMEvents:{drop:e=>(s=o===e.dom.parentElement,!1),paste:(e,t)=>{var n;const r=null===(n=t.clipboardData)||void 0===n?void 0:n.getData("text/html");return i=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(n,r,o)=>{const l=n[0],a="paste"===l.getMeta("uiEvent")&&!i,c="drop"===l.getMeta("uiEvent")&&!s;if(!a&&!c)return;const d=r.doc.content.findDiffStart(o.doc.content),h=r.doc.content.findDiffEnd(o.doc.content);if("number"!=typeof d||!h||d===h.b)return;const p=o.tr,u=R({state:o,transaction:p});return function(e){const{editor:t,state:n,from:r,to:o,rule:i}=e,{commands:s,chain:l,can:a}=new $({editor:t,state:n}),c=[];return n.doc.nodesBetween(r,o,(e,t)=>{if(!e.isTextblock||e.type.spec.code)return;const d=Math.max(r,t),h=Math.min(o,t+e.content.size);((e,t)=>{if(q(t))return[...e.matchAll(t)];const n=t(e);return n?n.map(t=>{const n=[];return n.push(t.text),n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]}
1)(e.textBetween(d-t,h-t,void 0,""),i.find).forEach(e=>{if(void 0===e.index)return;const t=d+e.index+1,r=t+e[0].length,o={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},h=i.handler({state:n,range:o,match:e,commands:s,chain:l,can:a});c.push(h)})}),c.every(e=>null!==e)}({editor:t,state:u,from:Math.max(d-1,0),to:h.b-1,rule:e})&&p.steps.length?p:void 0}}))}class Q{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Q.resolve(e),this.schema=function(e){var t;const n=P(e),{nodeExtensions:r,markExtensions:o}=F(e),i=null===(t=r.find(e=>I(e,"topNode")))||void 0===t?void 0:t.name,l=Object.fromEntries(r.map(t=>{const r=n.filter(e=>e.type===t.name),o={name:t.name,options:t.options,storage:t.storage},i=H({...e.reduce((e,n)=>{const r=I(n,"extendNodeSchema",o);return{...e,...r?r(t):{}}},{}),content:K(I(t,"content",o)),marks:K(I(t,"marks",o)),group:K(I(t,"group",o)),inline:K(I(t,"inline",o)),atom:K(I(t,"atom",o)),selectable:K(I(t,"selectable",o)),draggable:K(I(t,"draggable",o)),code:K(I(t,"code",o)),defining:K(I(t,"defining",o)),isolating:K(I(t,"isolating",o)),attrs:Object.fromEntries(r.map(e=>{var t;return[e.name,{default:null===(t=null==e?void 0:e.attribute)||void 0===t?void 0:t.default}]}))}),s=K(I(t,"parseHTML",o));s&&(i.parseDOM=s.map(e=>j(e,r)));const l=I(t,"renderHTML",o);l&&(i.toDOM=e=>l({node:e,HTMLAttributes:V(e,r)}));const a=I(t,"renderText",o);return a&&(i.toText=a),[t.name,i]})),a=Object.fromEntries(o.map(t=>{const r=n.filter(e=>e.type===t.name),o={name:t.name,options:t.options,storage:t.storage},i=H({...e.reduce((e,n)=>{const r=I(n,"extendMarkSchema",o);return{...e,...r?r(t):{}}},{}),inclusive:K(I(t,"inclusive",o)),excludes:K(I(t,"excludes",o)),group:K(I(t,"group",o)),spanning:K(I(t,"spanning",o)),code:K(I(t,"code",o)),attrs:Object.fromEntries(r.map(e=>{var t;return[e.name,{default:null===(t=null==e?void 0:e.attribute)||void 0===t?void 0:t.default}]}))}),s=K(I(t,"parseHTML",o));s&&(i.parseDOM=s.map(e=>j(e,r)));const l=I(t,"renderHTML",o);return l&&(i.toDOM=e=>l({mark:e,HTMLAttributes:V(e,r)})),[t.name,i]}));return new s.Sj({topNode:i,nodes:l,marks:a})}(this.extensions),this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const n={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:W(e.name,this.schema)};"mark"===e.type&&(null===(t=K(I(e,"keepOnSplit",n)))||void 0===t||t)&&this.splittableMarks.push(e.name);const r=I(e,"onBeforeCreate",n);r&&this.editor.on("beforeCreate",r);const o=I(e,"onCreate",n);o&&this.editor.on("create",o);const i=I(e,"onUpdate",n);i&&this.editor.on("update",i);const s=I(e,"onSelectionUpdate",n);s&&this.editor.on("selectionUpdate",s);const l=I(e,"onTransaction",n);l&&this.editor.on("transaction",l);const a=I(e,"onFocus",n);a&&this.editor.on("focus",a);const c=I(e,"onBlur",n);c&&this.editor.on("blur",c);const d=I(e,"onDestroy",n);d&&this.editor.on("destroy",d)})}static resolve(e){const t=Q.sort(Q.flatten(e)),n=function(e){const t=e.filter((t,n)=>e.indexOf(t)!==n);return[...new Set(t)]}(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(e=>{const t=I(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...this.flatten(t())]:e}).flat(10)}static sort(e){return e.sort((e,t)=>{const n=I(e,"priority")||100,r=I(t,"priority")||100;return n>r?-1:n<r?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const n=I(t,"addCommands",{name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:W(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){const{editor:e}=this,t=Q.sort([...this.extensions].reverse()),n=[],r=[],o=t.map(t=>{const o={name:t.name,options:t.options,storage:t.storage,editor:e,type:W(t.name,this.schema)},s=[],l=I(t,"addKeyboardShortcuts",o);let a={};if("mark"===t.type&&t.config.exitable&&(a.ArrowRight=()=>Ke.handleExit({editor:e,mark:t})),l){const t=Object.fromEntries(Object.entries(l()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}const c=(0,i.w)(a);s.push(c);const d=I(t,"addInputRules",o);_(t,e.options.enableInputRules)&&d&&n.push(...d());const h=I(t,"addPasteRules",o);_(t,e.options.enablePasteRules)&&h&&r.push(...h());const p=I(t,"addProseMirrorPlugins",o);if(p){const e=p();s.push(...e)}return s}).flat();
1return[X({editor:e,rules:n}),...Y({editor:e,rules:r}),...o]}get attributes(){return P(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=F(this.extensions);return Object.fromEntries(t.filter(e=>!!I(e,"addNodeView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:t.storage,editor:e,type:B(t.name,this.schema)},o=I(t,"addNodeView",r);return o?[t.name,(r,i,s,l)=>{const a=V(r,n);return o()({editor:e,node:r,getPos:s,decorations:l,HTMLAttributes:a,extension:t})}]:[]}))}}function ee(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function te(e,t){const n={...e};return ee(e)&&ee(t)&&Object.keys(t).forEach(r=>{ee(t[r])?r in e?n[r]=te(e[r],t[r]):Object.assign(n,{[r]:t[r]}):Object.assign(n,{[r]:t[r]})}),n}class ne{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=K(I(this,"addOptions",{name:this.name}))),this.storage=K(I(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ne(e)}configure(e={}){const t=this.extend();return t.options=te(this.options,e),t.storage=K(I(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new ne(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=K(I(t,"addOptions",{name:t.name})),t.storage=K(I(t,"addStorage",{name:t.name,options:t.options})),t}}function re(e,t,n){const{from:r,to:o}=t,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let l="",a=!0;return e.nodesBetween(r,o,(e,n,c,d)=>{var h;const p=null==s?void 0:s[e.type.name];p?(e.isBlock&&!a&&(l+=i,a=!0),c&&(l+=p({node:e,pos:n,parent:c,index:d,range:t}))):e.isText?(l+=null===(h=null==e?void 0:e.text)||void 0===h?void 0:h.slice(Math.max(r,n)-n,o-n),a=!1):e.isBlock&&!a&&(l+=i,a=!0)}),l}function oe(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const ie=ne.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new r.k_({key:new r.hs("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:i}=o;return re(r,{from:Math.min(...i.map(e=>e.$from.pos)),to:Math.max(...i.map(e=>e.$to.pos))},{textSerializers:oe(n)})}}})]}});function se(e,t,n={strict:!0}){const r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:q(t[r])?t[r].test(e[r]):t[r]===e[r])}function le(e,t,n={}){return e.find(e=>e.type===t&&se(e.attrs,n))}function ae(e,t,n={}){return!!le(e,t,n)}function ce(e,t,n={}){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(e.parentOffset===r.offset&&0!==r.offset&&(r=e.parent.childBefore(e.parentOffset)),!r.node)return;const o=le([...r.node.marks],t,n);if(!o)return;let i=r.index,s=e.start()+r.offset,l=i+1,a=s+r.node.nodeSize;for(le([...r.node.marks],t,n);i>0&&o.isInSet(e.parent.child(i-1).marks);)i-=1,s-=e.parent.child(i).nodeSize;for(;l<e.parent.childCount&&ae([...e.parent.child(l).marks],t,n);)a+=e.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function de(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}function he(e){return e instanceof r.U3}function pe(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function ue(e,t=null){if(!t)return null;const n=r.LN.atStart(e),o=r.LN.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return o;const i=n.from,s=o.to;return"all"===t?r.U3.create(e,pe(0,i,s),pe(e.content.size,i,s)):r.U3.create(e,pe(t,i,s),pe(t,i,s))}function fe(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function me(e){const t=`<body>${e}</body>`;return(new window.DOMParser).parseFromString(t,"text/html").body}
1function ge(e,t,n){if(n={slice:!0,parseOptions:{},...n},"object"==typeof e&&null!==e)try{return Array.isArray(e)?s.FK.fromArray(e.map(e=>t.nodeFromJSON(e))):t.nodeFromJSON(e)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),ge("",t,n)}if("string"==typeof e){const r=s.S4.fromSchema(t);return n.slice?r.parseSlice(me(e),n.parseOptions).content:r.parse(me(e),n.parseOptions)}return ge("",t,n)}function ye(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function we(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?B(t,e.schema):null,l=[];e.doc.nodesBetween(r,o,(e,t)=>{if(e.isText)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);l.push({node:e,from:n,to:i})});const a=o-r,c=l.filter(e=>!s||s.name===e.node.type.name).filter(e=>se(e.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((e,t)=>e+t.to-t.from,0)>=a}function be(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function ve(e,t){const n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}function ke(e,t,n={}){return ge(e,t,{slice:!1,parseOptions:n})}function Se(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function xe(e){return t=>Se(t.$from,e)}function Me(e,t){const n=de(t,e.schema),{from:r,to:o,empty:i}=e.selection,s=[];i?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,e=>{s.push(...e.marks)});const l=s.find(e=>e.type.name===n.name);return l?{...l.attrs}:{}}function Ce(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(t=>{const o=ce(n.resolve(e-1),t.type);o&&r.push({mark:t,...o})}):n.nodesBetween(e,t,(e,t)=>{r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function Oe(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?de(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>se(e.attrs,n,{strict:!1}));let s=0;const l=[];if(o.forEach(({$from:t,$to:n})=>{const r=t.pos,o=n.pos;e.doc.nodesBetween(r,o,(e,t)=>{if(!e.isText&&!e.marks.length)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);s+=i-n,l.push(...e.marks.map(e=>({mark:e,from:n,to:i})))})}),0===s)return!1;const a=l.filter(e=>!i||i.name===e.mark.type.name).filter(e=>se(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=l.filter(e=>!i||e.mark.type!==i&&e.mark.type.excludes(i)).reduce((e,t)=>e+t.to-t.from,0);return(a>0?a+c:a)>=s}function Ne(e,t){const{nodeExtensions:n}=F(t),r=n.find(t=>t.name===e);if(!r)return!1;const o=K(I(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function Te(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{const r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function Ae(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}const Ee=(e,t)=>{const n=xe(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!(0,l.n9)(e.doc,n.pos)||(e.join(n.pos),!0)},De=(e,t)=>{const n=xe(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!(0,l.n9)(e.doc,r)||(e.join(r),!0)};var Re=Object.freeze({__proto__:null,blur:()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null===(n=null===window||void 0===window?void 0:window.getSelection())||void 0===n||n.removeAllRanges())}),!0),clearContent:(e=!1)=>({commands:t})=>t.setContent("",e),clearNodes:()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:o}=r;return!n||(o.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;const{doc:r,mapping:o}=t,i=r.resolve(o.map(n)),s=r.resolve(o.map(n+e.nodeSize)),a=i.blockRange(s);if(!a)return;const c=(0,l.jP)(a);if(e.type.isTextblock){const{defaultType:e}=i.parent.contentMatchAt(i.index());t.setNodeMarkup(a.start,e)}(c||0===c)&&t.lift(a,c)})}),!0)},command:e=>t=>e(t),createParagraphNear:()=>({state:e,dispatch:t})=>b(e,t),deleteCurrentNode:()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const o=e.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(t){const t=o.before(i),n=o.after(i);e.delete(t,n).scrollIntoView()}return!0}return!1},deleteNode:e=>({tr:t,state:n,dispatch:r})=>{const o=B(e,n.schema),i=t.selection.$anchor;for(let e=i.depth;e>0;e-=1)if(i.node(e).type===o){if(r){const n=i.before(e),r=i.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},deleteRange:e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},deleteSelection:()=>({state:e,dispatch:t})=>a(e,t),enter:()=>({commands:e})=>e.keyboardShortcut("Enter"),exitCode:()=>({state:e,dispatch:t})=>w(e,t),extendMarkRange:(e,t={})=>({tr:n,state:o,dispatch:i})=>{const s=de(e,o.schema),{doc:l,selection:a}
1=n,{$from:c,from:d,to:h}=a;if(i){const e=ce(c,s,t);if(e&&e.from<=d&&e.to>=h){const t=r.U3.create(l,e.from,e.to);n.setSelection(t)}}return!0},first:e=>t=>{const n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1},focus:(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{fe()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};if(r.hasFocus()&&null===e||!1===e)return!0;if(i&&null===e&&!he(n.state.selection))return s(),!0;const l=ue(o.doc,e)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},forEach:(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),insertContent:(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),insertContentAt:(e,t,n)=>({tr:o,dispatch:i,editor:s})=>{if(i){n={parseOptions:{},updateSelection:!0,...n};const i=ge(t,s.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if("<>"===i.toString())return!0;let{from:a,to:c}="number"==typeof e?{from:e,to:e}:e,d=!0,h=!0;if((i.toString().startsWith("<")?i:[i]).forEach(e=>{e.check(),d=!!d&&e.isText&&0===e.marks.length,h=!!h&&e.isBlock}),a===c&&h){const{parent:e}=o.doc.resolve(a);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(a-=1,c+=1)}d?o.insertText(t,a,c):o.replaceWith(a,c,i),n.updateSelection&&function(e,t){const n=e.steps.length-1;if(n<t)return;const o=e.steps[n];if(!(o instanceof l.Ln||o instanceof l.Wg))return;const i=e.mapping.maps[n];let s=0;i.forEach((e,t,n,r)=>{0===s&&(s=r)}),e.setSelection(r.LN.near(e.doc.resolve(s),-1))}(o,o.steps.length-1)}return!0},joinUp:()=>({state:e,dispatch:t})=>((e,t)=>{let n,o=e.selection,i=o instanceof r.nh;if(i){if(o.node.isTextblock||!(0,l.n9)(e.doc,o.from))return!1;n=o.from}else if(n=(0,l.N0)(e.doc,o.from,-1),null==n)return!1;if(t){let o=e.tr.join(n);i&&o.setSelection(r.nh.create(o.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0})(e,t),joinDown:()=>({state:e,dispatch:t})=>((e,t)=>{let n,o=e.selection;if(o instanceof r.nh){if(o.node.isTextblock||!(0,l.n9)(e.doc,o.to))return!1;n=o.to}else if(n=(0,l.N0)(e.doc,o.to,1),null==n)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),joinBackward:()=>({state:e,dispatch:t})=>c(e,t),joinForward:()=>({state:e,dispatch:t})=>u(e,t),keyboardShortcut:e=>({editor:t,view:n,tr:r,dispatch:o})=>{const i=function(e){const t=e.split(/-(?!$)/);let n,r,o,i,s=t[t.length-1];"Space"===s&&(s=" ");for(let l=0;l<t.length-1;l+=1){const e=t[l];if(/^(cmd|meta|m)$/i.test(e))i=!0;else if(/^a(lt)?$/i.test(e))n=!0;else if(/^(c|ctrl|control)$/i.test(e))r=!0;else if(/^s(hift)?$/i.test(e))o=!0;else{if(!/^mod$/i.test(e))throw new Error(`Unrecognized modifier name: ${e}`);fe()||ye()?i=!0:r=!0}}return n&&(s=`Alt-${s}`),r&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),o&&(s=`Shift-${s}`),s}(e).split(/-(?!$)/),s=i.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),l=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,l))});return null==a||a.steps.forEach(e=>{const t=e.map(r.mapping);t&&o&&r.maybeStep(t)}),!0},lift:(e,t={})=>({state:n,dispatch:r})=>!!we(n,B(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&(0,l.jP)(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)})(n,r),liftEmptyBlock:()=>({state:e,dispatch:t})=>v(e,t),liftListItem:e=>({state:t,dispatch:n})=>{return(r=B(e,t.schema),function(e,t){let{$from:n,$to:o}=e.selection,i=n.blockRange(o,e=>e.childCount>0&&e.firstChild.type==r);return!!i&&(!t||(n.node(i.depth-1).type==r?function(e,t,n,r){let o=e.tr,i=r.end,a=r.$to.end(r.depth);i<a&&(o.step(new l.Wg(i-1,a,i,a,new s.Ji(s.FK.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new s.u$(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));const c=(0,l.jP)(r);if(null==c)return!1;o.lift(r,c);let d=o.mapping.map(i,-1)-1;return(0,l.n9)(o.doc,d)&&o.join(d),t(o.scrollIntoView()),!0}(e,t,r,i):function(e,t,n){let r=e.tr,o=n.parent;for(let s=n.end,l=n.endIndex-1,m=n.startIndex;l>m;l--)s-=o.child(l).nodeSize,r.delete(s-1,s+1);let i=r.doc.resolve(n.start),a=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let c=0==n.startIndex,d=n.endIndex==o.childCount,h=i.node(-1),p=i.index(-1);if(!h.canReplace(p+(c?0:1),p+1,a.content.append(d?s.FK.empty:s.FK.from(o))))return!1;let u=i.pos,f=u+a.nodeSize;return r.step(new l.Wg(u-(c?1:0),f+(d?1:0),u+1,f-1,new s.Ji((c?s.FK.empty:s.FK.from(o.copy(s.FK.empty))).append(d?s.FK.empty:s.FK.from(o.copy(s.FK.empty))),c?0:1,d?0:1),c?0:1)),t(r.scrollIntoView()),!0}(e,t,i)))})(t,n);var r},newlineInCode:()=>({state:e,dispatch:t})=>g(e,t),resetAttributes:(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=be("string"==typeof e?e:e.name,r.schema);return!!l&&("node"===l&&(i=B(e,r.schema)),"mark"===l&&(s=de(e,r.schema)),o&&n.selection.ranges.forEac
1h(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{i&&i===e.type&&n.setNodeMarkup(r,void 0,ve(e.attrs,t)),s&&e.marks.length&&e.marks.forEach(o=>{s===o.type&&n.addMark(r,r+e.nodeSize,s.create(ve(o.attrs,t)))})})}),!0)},scrollIntoView:()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),selectAll:()=>({tr:e,commands:t})=>t.setTextSelection({from:0,to:e.doc.content.size}),selectNodeBackward:()=>({state:e,dispatch:t})=>h(e,t),selectNodeForward:()=>({state:e,dispatch:t})=>f(e,t),selectParentNode:()=>({state:e,dispatch:t})=>((e,t)=>{let n,{$from:o,to:i}=e.selection,s=o.sharedDepth(i);return 0!=s&&(n=o.before(s),t&&t(e.tr.setSelection(r.nh.create(e.doc,n))),!0)})(e,t),selectTextblockEnd:()=>({state:e,dispatch:t})=>C(e,t),selectTextblockStart:()=>({state:e,dispatch:t})=>M(e,t),setContent:(e,t=!1,n={})=>({tr:r,editor:o,dispatch:i})=>{const{doc:s}=r,l=ke(e,o.schema,n);return i&&r.replaceWith(0,s.content.size,l).setMeta("preventUpdate",!t),!0},setMark:(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:l}=i,a=de(e,r.schema);if(o)if(s){const e=Me(r,a);n.addStoredMark(a.create({...e,...t}))}else l.forEach(e=>{const o=e.$from.pos,i=e.$to.pos;r.doc.nodesBetween(o,i,(e,r)=>{const s=Math.max(r,o),l=Math.min(r+e.nodeSize,i);e.marks.find(e=>e.type===a)?e.marks.forEach(e=>{a===e.type&&n.addMark(s,l,a.create({...e.attrs,...t}))}):n.addMark(s,l,a.create(t))})});return function(e,t,n){var r;const{selection:o}=t;let i=null;if(he(o)&&(i=o.$cursor),i){const t=null!==(r=e.storedMarks)&&void 0!==r?r:i.marks();return!!n.isInSet(t)||!t.some(e=>e.type.excludes(n))}const{ranges:s}=o;return s.some(({$from:t,$to:r})=>{let o=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(o)return!1;if(e.isInline){const t=!r||r.type.allowsMarkType(n),i=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));o=t&&i}return!o}),o})}(r,n,a)},setMeta:(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),setNode:(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=B(e,n.schema);return i.isTextblock?o().command(({commands:e})=>!!O(i,t)(n)||e.clearNodes()).command(({state:e})=>O(i,t)(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,o=pe(e,0,n.content.size),i=r.nh.create(n,o);t.setSelection(i)}return!0},setTextSelection:e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,{from:o,to:i}="number"==typeof e?{from:e,to:e}:e,s=r.U3.atStart(n).from,l=r.U3.atEnd(n).to,a=pe(o,s,l),c=pe(i,s,l),d=r.U3.create(n,a,c);t.setSelection(d)}return!0},sinkListItem:e=>({state:t,dispatch:n})=>{const r=B(e,t.schema);return(o=r,function(e,t){let{$from:n,$to:r}=e.selection,i=n.blockRange(r,e=>e.childCount>0&&e.firstChild.type==o);if(!i)return!1;let a=i.startIndex;if(0==a)return!1;let c=i.parent,d=c.child(a-1);if(d.type!=o)return!1;if(t){let n=d.lastChild&&d.lastChild.type==c.type,r=s.FK.from(n?o.create():null),a=new s.Ji(s.FK.from(o.create(null,s.FK.from(c.type.create(null,r)))),n?3:1,0),h=i.start,p=i.end;t(e.tr.step(new l.Wg(h-(n?3:1),p,h,p,a,1,!0)).scrollIntoView())}return!0})(t,n);var o},splitBlock:({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:o,editor:i})=>{const{selection:s,doc:a}=t,{$from:c,$to:d}=s,h=Te(i.extensionManager.attributes,c.node().type.name,c.node().attrs);if(s instanceof r.nh&&s.node.isBlock)return!(!c.parentOffset||!(0,l.zy)(a,c.pos)||(o&&(e&&Ae(n,i.extensionManager.splittableMarks),t.split(c.pos).scrollIntoView()),0));if(!c.parent.isBlock)return!1;if(o){const o=d.parentOffset===d.parent.content.size;s instanceof r.U3&&t.deleteSelection();const a=0===c.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(c.node(-1).contentMatchAt(c.indexAfter(-1)));let p=o&&a?[{type:a,attrs:h}]:void 0,u=(0,l.zy)(t.doc,t.mapping.map(c.pos),1,p);if(p||u||!(0,l.zy)(t.doc,t.mapping.map(c.pos),1,a?[{type:a}]:void 0)||(u=!0,p=a?[{type:a,attrs:h}]:void 0),u&&(t.split(t.mapping.map(c.pos),1,p),a&&!o&&!c.parentOffset&&c.parent.type!==a)){const e=t.mapping.map(c.before()),n=t.doc.resolve(e);
1c.node(-1).canReplaceWith(n.index(),n.index()+1,a)&&t.setNodeMarkup(t.mapping.map(c.before()),a)}e&&Ae(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return!0},splitListItem:e=>({tr:t,state:n,dispatch:o,editor:i})=>{var a;const c=B(e,n.schema),{$from:d,$to:h}=n.selection,p=n.selection.node;if(p&&p.isBlock||d.depth<2||!d.sameParent(h))return!1;const u=d.node(-1);if(u.type!==c)return!1;const f=i.extensionManager.attributes;if(0===d.parent.content.size&&d.node(-1).childCount===d.indexAfter(-1)){if(2===d.depth||d.node(-3).type!==c||d.index(-2)!==d.node(-2).childCount-1)return!1;if(o){let e=s.FK.empty;const n=d.index(-1)?1:d.index(-2)?2:3;for(let t=d.depth-n;t>=d.depth-3;t-=1)e=s.FK.from(d.node(t).copy(e));const o=d.indexAfter(-1)<d.node(-2).childCount?1:d.indexAfter(-2)<d.node(-3).childCount?2:3,i=Te(f,d.node().type.name,d.node().attrs),l=(null===(a=c.contentMatch.defaultType)||void 0===a?void 0:a.createAndFill(i))||void 0;e=e.append(s.FK.from(c.createAndFill(null,l)||void 0));const h=d.before(d.depth-(n-1));t.replace(h,d.after(-o),new s.Ji(e,4-n,0));let p=-1;t.doc.nodesBetween(h,t.doc.content.size,(e,t)=>{if(p>-1)return!1;e.isTextblock&&0===e.content.size&&(p=t+1)}),p>-1&&t.setSelection(r.U3.near(t.doc.resolve(p))),t.scrollIntoView()}return!0}const m=h.pos===d.end()?u.contentMatchAt(0).defaultType:null,g=Te(f,u.type.name,u.attrs),y=Te(f,d.node().type.name,d.node().attrs);t.delete(d.pos,h.pos);const w=m?[{type:c,attrs:g},{type:m,attrs:y}]:[{type:c,attrs:g}];return!!(0,l.zy)(t.doc,d.pos,2)&&(o&&t.split(d.pos,2,w).scrollIntoView(),!0)},toggleList:(e,t)=>({editor:n,tr:r,state:o,dispatch:i,chain:s,commands:l,can:a})=>{const{extensions:c}=n.extensionManager,d=B(e,o.schema),h=B(t,o.schema),{selection:p}=o,{$from:u,$to:f}=p,m=u.blockRange(f);if(!m)return!1;const g=xe(e=>Ne(e.type.name,c))(p);if(m.depth>=1&&g&&m.depth-g.depth<=1){if(g.node.type===d)return l.liftListItem(h);if(Ne(g.node.type.name,c)&&d.validContent(g.node.content)&&i)return s().command(()=>(r.setNodeMarkup(g.pos,d),!0)).command(()=>Ee(r,d)).command(()=>De(r,d)).run()}return s().command(()=>!!a().wrapInList(d)||l.clearNodes()).wrapInList(d).command(()=>Ee(r,d)).command(()=>De(r,d)).run()},toggleMark:(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=de(e,r.schema);return Oe(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},toggleNode:(e,t,n={})=>({state:r,commands:o})=>{const i=B(e,r.schema),s=B(t,r.schema);return we(r,i,n)?o.setNode(s):o.setNode(i,n)},toggleWrap:(e,t={})=>({state:n,commands:r})=>{const o=B(e,n.schema);return we(n,o,t)?r.lift(o):r.wrapIn(o,t)},undoInputRule:()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){const t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){const n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},unsetAllMarks:()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:o}=n;return r||t&&o.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},unsetMark:(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:l}=n,a=de(e,r.schema),{$from:c,empty:d,ranges:h}=l;if(!o)return!0;if(d&&s){let{from:e,to:t}=l;const r=null===(i=c.marks().find(e=>e.type===a))||void 0===i?void 0:i.attrs,o=ce(c,a,r);o&&(e=o.from,t=o.to),n.removeMark(e,t,a)}else h.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,a)});return n.removeStoredMark(a),!0},updateAttributes:(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=be("string"==typeof e?e:e.name,r.schema);return!!l&&("node"===l&&(i=B(e,r.schema)),"mark"===l&&(s=de(e,r.schema)),o&&n.selection.ranges.forEach(e=>{const o=e.$from.pos,l=e.$to.pos;r.doc.nodesBetween(o,l,(e,r)=>{i&&i===e.type&&n.setNodeMarkup(r,void 0,{...e.attrs,...t}),s&&e.marks.length&&e.marks.forEach(i=>{if(s===i.type){const a=Math.max(r,o),c=Math.min(r+e.nodeSize,l);n.addMark(a,c,s.create({...i.attrs,...t}))}})})}),!0)},wrapIn:(e,t={})=>({state:n,dispatch:r})=>function(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&(0,l.oM)(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}(B(e,n.schema),t)(n,r),wrapInList:(e,t={})=>({state:n,dispatch:r})=>function(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,a=o.blockRange(i),c=!1,d=a;if(!a)return!1;if(a.depth>=2&&o.node(a.depth-1).type.compatibleContent(e)&&0==a.startIndex){
1if(0==o.index(a.depth-1))return!1;let e=n.doc.resolve(a.start-2);d=new s.u$(e,e,a.depth),a.endIndex<a.parent.childCount&&(a=new s.u$(o,n.doc.resolve(i.end(a.depth)),a.depth)),c=!0}let h=(0,l.oM)(d,e,t,a);return!!h&&(r&&r(function(e,t,n,r,o){let i=s.FK.empty;for(let l=n.length-1;l>=0;l--)i=s.FK.from(n[l].type.create(n[l].attrs,i));e.step(new l.Wg(t.start-(r?2:0),t.end,t.start,t.end,new s.Ji(i,0,0),n.length,!0));let a=0;for(let s=0;s<n.length;s++)n[s].type==o&&(a=s+1);let c=n.length-a,d=t.start+n.length-(r?2:0),h=t.parent;for(let s=t.startIndex,p=t.endIndex,u=!0;s<p;s++,u=!1)!u&&(0,l.zy)(e.doc,d,c)&&(e.split(d,c),d+=2*c),d+=h.child(s).nodeSize;return e}(n.tr,a,h,c,e).scrollIntoView()),!0)}}(B(e,n.schema),t)(n,r)});const $e=ne.create({name:"commands",addCommands:()=>({...Re})}),ze=ne.create({name:"editable",addProseMirrorPlugins(){return[new r.k_({key:new r.hs("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ie=ne.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new r.k_({key:new r.hs("focusEvents"),props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),Fe=ne.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{const{selection:n,doc:o}=t,{empty:i,$anchor:s}=n,{pos:l,parent:a}=s,c=r.LN.atStart(o).from===l;return!(!(i&&c&&a.type.isTextblock)||a.textContent.length)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},o={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return fe()||ye()?i:o},addProseMirrorPlugins(){return[new r.k_({key:new r.hs("clearDocument"),appendTransaction:(e,t,n)=>{if(!e.some(e=>e.docChanged)||t.doc.eq(n.doc))return;const{empty:o,from:i,to:s}=t.selection,l=r.LN.atStart(t.doc).from,a=r.LN.atEnd(t.doc).to,c=i===l&&s===a,d=0===n.doc.textBetween(0,n.doc.content.size," "," ").length;if(o||!c||!d)return;const h=n.tr,p=R({state:n,transaction:h}),{commands:u}=new $({editor:this.editor,state:p});return u.clearNodes(),h.steps.length?h:void 0}})]}}),Pe=ne.create({name:"tabindex",addProseMirrorPlugins(){return[new r.k_({key:new r.hs("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});var Be=Object.freeze({__proto__:null,ClipboardTextSerializer:ie,Commands:$e,Editable:ze,FocusEvents:Ie,Keymap:Fe,Tabindex:Pe});class Le extends z{constructor(e={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit
1("create",{editor:this}))},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=function(e,t){const n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;const r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML='.ProseMirror {\n  position: relative;\n}\n\n.ProseMirror {\n  word-wrap: break-word;\n  white-space: pre-wrap;\n  white-space: break-spaces;\n  -webkit-font-variant-ligatures: none;\n  font-variant-ligatures: none;\n  font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n  white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n  white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n  white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n  display: inline !important;\n  border: none !important;\n  margin: 0 !important;\n  width: 1px !important;\n  height: 1px !important;\n}\n\n.ProseMirror-gapcursor {\n  display: none;\n  pointer-events: none;\n  position: absolute;\n  margin: 0;\n}
1\n\n.ProseMirror-gapcursor:after {\n  content: "";\n  display: block;\n  position: absolute;\n  top: -2px;\n  width: 20px;\n  border-top: 1px solid black;\n  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n  to {\n    visibility: hidden;\n  }\n}\n\n.ProseMirror-hideselection *::selection {\n  background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n  background: transparent;\n}\n\n.ProseMirror-hideselection * {\n  caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n  display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n  opacity: 0\n}',document.getElementsByTagName("head")[0].appendChild(r),r}(0,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e){this.setOptions({editable:e}),this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){const n=J(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});this.view.updateState(r)}unregisterPlugin(e){if(this.isDestroyed)return;const t="string"==typeof e?`${e}$`:e.key,n=this.state.reconfigure({plugins:this.state.plugins.filter(e=>!e.key.startsWith(t))});this.view.updateState(n)}createExtensionManager(){const e=[...this.options.enableCoreExtensions?Object.values(Be):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new Q(e,this)}createCommandManager(){this.commandManager=new $({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const e=ke(this.options.content,this.schema,this.options.parseOptions),t=ue(e,this.options.autofocus);this.view=new o.Lz(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:r.$t.create({doc:e,selection:t||void 0})});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.view.dom.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach(e=>{var t;return null===(t=this.capturedTransaction)||void 0===t?void 0:t.step(e)}):void(this.capturedTransaction=e);const t=this.state.apply(e),n=!this.state.selection.eq(t.selection);this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),n&&this.emit("selectionUpdate",{editor:this,transaction:e});const r=e.getMeta("focus"),o=e.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event,transaction:e}),o&&this.emit("blur",{editor:this,event:o.event,transaction:e}),e.docChanged&&!e.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return function(e,t){const n=be("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){const n=B(t,e.schema),{from:r,to:o}=e.selection,i=[];e.doc.nodesBetween(r,o,e=>{i.push(e)});const s=i.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?Me(e,t):{}}(this.state,e)}isActive(e,t){const n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return we(e,null,n)||Oe(e,null,n);const r=be(t,e.schema);return"node"===r?we(e,t,n):"mark"===r&&Oe(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return function(e,t){const n=s.ZF.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}(this.state.doc.content,this.schema)}
1getText(e){const{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return function(e,t){return re(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:t,textSerializers:{...n,...oe(this.schema)}})}get isEmpty(){return function(e){var t;const n=null===(t=e.type.createAndFill())||void 0===t?void 0:t.toJSON(),r=e.toJSON();return JSON.stringify(n)===JSON.stringify(r)}(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(null===(e=this.view)||void 0===e?void 0:e.docView)}}function Ve(e){return new U({find:e.find,handler:({state:t,range:n,match:r})=>{const o=K(e.getAttributes,void 0,r);if(!1===o||null===o)return null;const{tr:i}=t,s=r[r.length-1],l=r[0];let a=n.to;if(s){const r=l.search(/\S/),c=n.from+l.indexOf(s),d=c+s.length;if(Ce(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;d<n.to&&i.delete(d,n.to),c>n.from&&i.delete(n.from+r,c),a=n.from+r+s.length,i.addMark(n.from+r,a,e.type.create(o||{})),i.removeStoredMark(e.type)}}})}function Je(e){return new U({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=K(e.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)}})}class Ke{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=K(I(this,"addOptions",{name:this.name}))),this.storage=K(I(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ke(e)}configure(e={}){const t=this.extend();return t.options=te(this.options,e),t.storage=K(I(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new Ke(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=K(I(t,"addOptions",{name:t.name})),t.storage=K(I(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const o=r.marks();if(!o.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;const i=o.find(e=>(null==e?void 0:e.type.name)===t.name);return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}}class je{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=K(I(this,"addOptions",{name:this.name}))),this.storage=K(I(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new je(e)}configure(e={}){const t=this.extend();return t.options=te(this.options,e),t.storage=K(I(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new je(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=K(I(t,"addOptions",{name:t.name})),t.storage=K(I(t,"addStorage",{name:t.name,options:t.options})),t}}function He(e){return new Z({find:e.find,handler:({state:t,range:n,match:r})=>{const o=K(e.getAttributes,void 0,r);if(!1===o||null===o)return null;const{tr:i}=t,s=r[r.length-1],l=r[0];let a=n.to;if(s){const r=l.search(/\S/),c=n.from+l.indexOf(s),d=c+s.length;if(Ce(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;
1d<n.to&&i.delete(d,n.to),c>n.from&&i.delete(n.from+r,c),a=n.from+r+s.length,i.addMark(n.from+r,a,e.type.create(o||{})),i.removeStoredMark(e.type)}}})}},47352(e,t,n){n.d(t,{h:()=>o});var r=n(45163);const o=r.bP.create({name:"tableHeader",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?[parseInt(t,10)]:null}}}),tableRole:"header_cell",isolating:!0,parseHTML:()=>[{tag:"th"}],renderHTML({HTMLAttributes:e}){return["th",(0,r.KV)(this.options.HTMLAttributes,e),0]}})},55770(e,t,n){n.d(t,{A:()=>o});var r=n(45163);const o=r.bP.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",(0,r.KV)(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}})},57714(e,t,n){n.d(t,{A:()=>r});const r=n(45163).bP.create({name:"doc",topNode:!0,content:"block+"})},58903(e,t,n){function r(e){this.content=e}n.d(t,{S4:()=>Z,ZF:()=>le,FK:()=>l,CU:()=>h,sX:()=>U,bP:()=>D,u$:()=>A,vI:()=>p,Sj:()=>G,Ji:()=>u}),r.prototype={constructor:r,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,t,n){var o=n&&n!=e?this.remove(n):this,i=o.find(e),s=o.content.slice();return-1==i?s.push(n||e,t):(s[i+1]=t,n&&(s[i]=n)),new r(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new r(n)},addToStart:function(e,t){return new r([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new r(n)},addBefore:function(e,t,n){var o=this.remove(t),i=o.content.slice(),s=o.find(e);return i.splice(-1==s?i.length:s,0,t,n),new r(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=r.from(e)).size?new r(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=r.from(e)).size?new r(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=r.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},r.from=function(e){if(e instanceof r)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new r(t)};const o=r;function i(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),s=t.child(r);if(o!=s){if(!o.sameMarkup(s))return n;if(o.isText&&o.text!=s.text){for(let e=0;o.text[e]==s.text[e];e++)n++;return n}if(o.content.size||s.content.size){let e=i(o.content,s.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function s(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let l=e.child(--o),a=t.child(--i),c=l.nodeSize;if(l!=a){if(!l.sameMarkup(a))return{a:n,b:r};if(l.isText&&l.text!=a.text){let e=0,t=Math.min(l.text.length,a.text.length);for(;e<t&&l.text[l.text.length-e-1]==a.text[a.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(l.content.size||a.content.size){let e=s(l.content,a.content,n-1,r-1);if(e)return e}n-=c,r-=c}else n-=c,r-=c}}class l{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;if(a>e&&!1!==n(l,r+s,o||null,i)&&l.content.size){let o=s+1;l.nodesBetween(Math.max(0,e-o),Math.min(l.content.size,t-o),n,r+o)}s=a}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,(s,l)=>{s.isText?(o+=s.text.slice(Math.max(e,l)-l,t-l),i=!n):s.isLeaf?(r?o+="function"==typeof r?r(s):r:s.type.spec.leafText&&(o+=s.type.spec.leafText(s)),i=!n):!i&&s.isBlock&&(o+=n,i=!0)},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new l(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],l=i+s.nodeSize;l>e&&((i<e||l>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),r+=s.nodeSize),i=l}return new l(n,r)}cutByIndex(e,t){return e==t?l.empty:0==e&&t==this.content.length?this:new l(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;
vendor: 3,710 bytes, line 1
1let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new l(r,o)}addToStart(e){return new l([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new l(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return i(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return s(this,e,t,n)}findIndex(e,t=-1){if(0==e)return c(0,e);if(e==this.size)return c(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=r+this.child(n).nodeSize;if(o>=e)return o==e||t>0?c(n+1,o):c(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return l.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new l(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return l.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new l(t||e,n)}static from(e){if(!e)return l.empty;if(e instanceof l)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new l([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}l.empty=new l([],0);const a={index:0,offset:0};function c(e,t){return a.index=e,a.offset=t,a}function d(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!d(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!d(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class h{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let 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}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&d(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return h.none;if(e instanceof h)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}h.none=[];
vendor: 6,415 bytes, line 1
1class p extends Error{}class u{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=m(this.content,e+this.openStart,t);return n&&new u(n,this.openStart,this.openEnd)}removeBetween(e,t){return new u(f(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return u.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new u(l.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)n++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)r++;return new u(e,n,r)}}function f(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:l}=e.findIndex(n);if(o==t||i.isText){if(l!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(f(i.content,t-o-1,n-o-1)))}function m(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=m(s.content,t-i-1,n);return l&&e.replaceChild(o,s.copy(l))}function g(e,t,n){if(n.openStart>e.depth)throw new p("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new p("Inconsistent open depths");return y(e,t,n,0)}function y(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=y(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)r=t.node(o).copy(l.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return S(i,x(e,o,s,t,r))}{let r=e.parent,o=r.content;return S(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return S(i,M(e,t,r))}function w(e,t){if(!t.type.compatibleContent(e.type))throw new p("Cannot join "+t.type.name+" onto "+e.type.name)}function b(e,t,n){let r=e.node(n);return w(r,t.node(n)),r}function v(e,t){let 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 k(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(v(e.nodeAfter,r),i++));for(let l=i;l<s;l++)v(o.child(l),r);t&&t.depth==n&&t.textOffset&&v(t.nodeBefore,r)}function S(e,t){return e.type.checkContent(t),e.copy(t)}function x(e,t,n,r,o){let i=e.depth>o&&b(e,t,o+1),s=r.depth>o&&b(n,r,o+1),a=[];return k(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(w(i,s),v(S(i,x(e,t,n,r,o+1)),a)):(i&&v(S(i,M(e,t,o+1)),a),k(t,n,o,a),s&&v(S(s,M(n,r,o+1)),a)),k(r,null,o,a),new l(a)}function M(e,t,n){let r=[];return k(null,e,n,r),e.depth>n&&v(S(b(e,t,n+1),M(e,t,n+1)),r),k(t,null,n,r),new l(r)}u.empty=new u(l.empty,0,0);class C{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(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]}after(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}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let 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)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let o=0;o<e;o++)r+=n.child(o).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return h.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var 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}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let 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 A(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let i=e;;){let{index:e,offset:t}=i.content.findIndex(o),s=o-t;if(n.push(i,e,r+t),!s)break;if(i=i.child(e),i.isText)break;o=s-1,r+=t+1}return new C(t,n,o)}
vendor: 4,119 bytes, line 1
1static resolveCached(e,t){for(let r=0;r<O.length;r++){let n=O[r];if(n.pos==t&&n.doc==e)return n}let n=O[N]=C.resolve(e,t);return N=(N+1)%T,n}}let O=[],N=0,T=12;class A{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const E=Object.create(null);class D{constructor(e,t,n,r=h.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||l.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&d(this.attrs,t||e.defaultAttrs||E)&&h.sameSet(this.marks,n||h.none)}copy(e=null){return e==this.content?this:new D(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new D(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return u.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),l=r.node(i).content.cut(r.pos-s,o.pos-s);return new u(l,r.depth-i,o.depth-i)}replace(e,t,n){return g(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return C.resolveCached(this,e)}resolveNoCache(e){return C.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),$(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=l.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let l=r;l<o;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=h.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!h.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>
1e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let 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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n=null;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)}let r=l.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}}D.prototype.text=void 0;class R extends D{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):$(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new R(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new R(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function $(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class z{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new I(e,t);if(null==n.next)return z.empty;let r=F(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return function n(r){let o=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);K(e,n).forEach(e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let i=t[r.join(",")]=new z(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(J);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}(K(e,0))}(function(e){let t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,i)),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(i,s),o(e(t.expr,s),s),[r(s)]}if("plus"==t.type){let 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){let s=i;for(let r=0;r<t.min;r++){let r=n();o(e(t.expr,s),r),s=r}if(-1==t.max)o(e(t.expr,s),s);else for(let i=t.min;i<t.max;i++){let i=n();r(s,i),o(e(t.expr,s),i),s=i}return[r(s)]}if("name"==t.type)return[r(i,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=e(t.exprs[r],i);if(r==t.exprs.length-1)return s;o(s,i=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach(e=>e.to=t)}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(i,s){let a=i.matchFragment(e,n);if(a&&(!t||a.validEnd))return l.from(s.map(e=>e.createAndFill()));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let o=0;o<t.next.length;o++)r+=(o?", ":"")+t.next[o].type.name+"->"+e.indexOf(t.next[o].next);return r}).join("\n")}}z.empty=new z(!0);class I{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?
1=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function F(e){let t=[];do{t.push(P(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function P(e){let t=[];do{t.push(B(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function B(e){let t=function(e){if(e.eat("(")){let t=F(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let i in n){let e=n[i];e.groups.indexOf(t)>-1&&o.push(e)}return 0==o.length&&e.err("No node type or group '"+t+"' found"),o}(e,e.next).map(t=>(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==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)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=V(e,t)}return t}function L(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function V(e,t){let n=L(e),r=n;return e.eat(",")&&(r="}"!=e.next?L(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function J(e,t){return t-e}function K(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(J)}function j(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function H(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function W(e){let t=Object.create(null);if(e)for(let n in e)t[n]=new q(e[n]);return t}class _{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=W(n.attrs),this.defaultAttrs=j(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==z.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:H(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new D(this,this.computeAttrs(e),l.from(t),h.setFrom(n))}createChecked(e=null,t,n){return t=l.from(t),this.checkContent(t),new D(this,this.computeAttrs(e),t,h.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=l.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(l.empty,!0);return o?new D(this,e,t.append(o),h.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let 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:h.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new _(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");
1if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class q{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class U{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=W(r.attrs),this.excluded=null;let o=j(this.attrs);this.instance=o?new h(this,o):null}create(e=null){return!e&&this.instance?this.instance:new h(this,H(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,o)=>n[e]=new U(e,r++,t,o)),n}removeFromSet(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}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class G{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=o.from(e.nodes),t.marks=o.from(e.marks||{}),this.nodes=_.compile(this.spec.nodes,this),this.marks=U.compile(this.spec.marks,this);let n=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let e=this.nodes[r],t=e.spec.content||"",o=e.spec.marks;e.contentMatch=n[t]||(n[t]=z.parse(t,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.markSet="_"==o?null:o?X(this,o.split(" ")):""!=o&&e.inlineContent?null:[]}for(let r in this.marks){let e=this.marks[r],t=e.spec.excludes;e.excluded=null==t?[e]:""==t?[]:X(this,t.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)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof _))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)}text(e,t){let n=this.nodes.text;return new R(n,n.defaultAttrs,e,h.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return D.fromJSON(this,e)}markFromJSON(e){return h.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function X(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class Z{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(e=>{e.tag?this.tags.push(e):e.style&&this.styles.push(e)}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new re(this,t,!1);return n.addAll(e,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new re(this,t,!0);return n.addAll(e,t.from,t.to),u.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(oe(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let r in e.marks){let t=e.marks[r].spec.parseDOM;t&&t.forEach(e=>{n(e=ie(e)),e.mark=r})}for(let r in e.nodes){let t=e.nodes[r].spec.parseDOM;
1t&&t.forEach(e=>{n(e=ie(e)),e.node=r})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Z(e,Z.schemaRules(e)))}}const Y={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},Q={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ee={ol:!0,ul:!0};function te(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class ne{constructor(e,t,n,r,o,i,s){this.type=e,this.attrs=t,this.marks=n,this.pendingMarks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=h.none,this.stashMarks=[],this.match=i||(4&s?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(l.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=l.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(l.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,n=this.pendingMarks;t<n.length;t++){let r=n[t];(this.type?this.type.allowsMarkType(r.type):se(r.type,e))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Y.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class re{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0;let r,o=t.topNode,i=te(null,t.preserveWhitespace,0)|(n?4:0);r=o?new ne(o.type,o.attrs,h.none,h.none,!0,t.topMatch||o.type.contentMatch,i):new ne(n?null:e.schema.topNodeType,null,h.none,h.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){if(3==e.nodeType)this.addTextNode(e);else if(1==e.nodeType){let t=e.getAttribute("style"),n=t?this.readStyles(function(e){let t,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;t=n.exec(e);)r.push(t[1],t[2].trim());return r}(t)):null,r=this.top;if(null!=n)for(let e=0;e<n.length;e++)this.addPendingMark(n[e]);if(this.addElement(e),null!=n)for(let e=0;e<n.length;e++)this.removePendingMark(n[e],r)}}addTextNode(e){let t=e.nodeValue,n=this.top;if(2&n.options||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(1&n.options)t=2&n.options?t.replace(/\r\n?/g,"\n"):t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let r=n.content[n.content.length-1],o=e.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let n,r=e.nodeName.toLowerCase();ee.hasOwnProperty(r)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&ee.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(n=this.parser.matchTag(e,this,t));if(o?o.ignore:Q.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);let t,n=this.top,i=this.needsBlock;if(Y.hasOwnProperty(r))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),t=!0,n.type||(this.needsBlock=!0);else if(!e.firstChild)return void this.leafFallback(e);this.addAll(e),t&&this.sync(n),this.needsBlock=i}else this.addElementByRule(e,o,!1===o.consuming?n:void 0)}leafFallback(e){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"))}ignoreFallback(e){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=h.none;e:for(let n=0;n<e.length;n+=2)for(let r;;){let o=this.parser.matchStyle(e[n],e[n+1],this,r);if(!o)continue e;if(o.ignore)return null;if(t=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(t),!1!==o.consuming)break;r=o}return t}addElementByRule(e,t,n){let r,o,i;t.node?(o=this.parser.schema.nodes[t.node],o.isLeaf?this.insertNode(o.create(t.attrs))||this.leafFallback(e):r=this.enter(o,t.attrs||null,t.preserveWhitespace)):(i=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(i));let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(n)this.addElement(e,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEac
1h(e=>this.insertNode(e));else{let n=e;"string"==typeof t.contentElement?n=e.querySelector(t.contentElement):"function"==typeof t.contentElement?n=t.contentElement(e):t.contentElement&&(n=t.contentElement),this.findAround(e,n,!0),this.addAll(n)}r&&this.sync(s)&&this.open--,i&&this.removePendingMark(i,s)}addAll(e,t,n){let r=t||0;for(let o=t?e.childNodes[t]:e.firstChild,i=null==n?null:e.childNodes[n];o!=i;o=o.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(o);this.findAtPoint(e,r)}findPlace(e){let t,n;for(let r=this.open;r>=0;r--){let o=this.nodes[r],i=o.findWrapping(e);if(i&&(!t||t.length>i.length)&&(t=i,n=o,!i.length))break;if(o.solid)break}if(!t)return!1;this.sync(n);for(let r=0;r<t.length;r++)this.enterInner(t[r],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let n=t.activeMarks;for(let r=0;r<e.marks.length;r++)t.type&&!t.type.allowsMarkType(e.marks[r].type)||(n=e.marks[r].addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n){let r=this.findPlace(e.create(t));return r&&this.enterInner(e,t,!0,n),r}enterInner(e,t=null,n=!1,r){this.closeExtra();let o=this.top;o.applyPending(e),o.match=o.match&&o.match.matchType(e);let i=te(e,r,o.options);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new ne(e,t,o.activeMarks,o.pendingMarks,n,null,i)),this.open++}closeExtra(e=!1){let 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}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let 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)}findAround(e,t,n){if(e!=t&&this.find)for(let 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)}findInText(e){if(this.find)for(let 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))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let l=t[e];if(""==l){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=l&&-1==e.groups.indexOf(l))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}addPendingMark(e){let t=function(e,t){for(let n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let n=this.open;n>=0;n--){let r=this.nodes[n];if(r.pendingMarks.lastIndexOf(e)>-1)r.pendingMarks=e.removeFromSet(r.pendingMarks);else{r.activeMarks=e.removeFromSet(r.activeMarks);let t=r.popFromStashMark(e);t&&r.type&&r.type.allowsMarkType(t.type)&&(r.activeMarks=t.addToSet(r.activeMarks))}if(r==t)break}}}function oe(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ie(e){let t={};for(let n in e)t[n]=e[n];return t}function se(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;
1if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class le{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=ce(t).createDocumentFragment());let r=n,o=[];return e.forEach(e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=le.renderSpec(ce(t),this.nodes[e.type.name](e));if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&le.renderSpec(ce(n),r(e,t))}static renderSpec(e,t,n=null){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;let r,o=t[0],i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));let s=n?e.createElementNS(n,o):e.createElement(o),l=t[1],a=1;if(l&&"object"==typeof l&&null==l.nodeType&&!Array.isArray(l)){a=2;for(let e in l)if(null!=l[e]){let t=e.indexOf(" ");t>0?s.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):s.setAttribute(e,l[e])}}for(let c=a;c<t.length;c++){let o=t[c];if(0===o){if(c<t.length-1||c>a)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}{let{dom:t,contentDOM:i}=le.renderSpec(e,o,n);if(s.appendChild(t),i){if(r)throw new RangeError("Multiple content holes");r=i}}}return{dom:s,contentDOM:r}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new le(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ae(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return ae(e.marks)}}function ae(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function ce(e){return e.document||window.document}},59202(e,t,n){n.d(t,{Ay:()=>a});var r=n(45163);const o=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,i=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,s=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,l=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,a=r.CU.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],renderHTML({HTMLAttributes:e}){return["strong",(0,r.KV)(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}}
1,addInputRules(){return[(0,r.OX)({find:o,type:this.type}),(0,r.OX)({find:s,type:this.type})]},addPasteRules(){return[(0,r.Zc)({find:i,type:this.type}),(0,r.Zc)({find:l,type:this.type})]}})},61444(e,t,n){n.d(t,{Ay:()=>a});var r=n(45163);const o=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,i=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,s=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,l=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,a=r.CU.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=italic"}],renderHTML({HTMLAttributes:e}){return["em",(0,r.KV)(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[(0,r.OX)({find:o,type:this.type}
1),(0,r.OX)({find:s,type:this.type})]},addPasteRules(){return[(0,r.Zc)({find:i,type:this.type}),(0,r.Zc)({find:l,type:this.type})]}})},87458(e,t,n){n.d(t,{A:()=>o});var r=n(45163);const o=r.bP.create({name:"tableCell",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?[parseInt(t,10)]:null}}}),tableRole:"cell",isolating:!0,parseHTML:()=>[{tag:"td"}],renderHTML({HTMLAttributes:e}){return["td",(0,r.KV)(this.options.HTMLAttributes,e),0]}})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.