PageSourceSearch

https://go.chatway.app/assets/vendor-prosemirror-core-BRjRA0uN.js

js chatway.app collected 2026-10-02 02:29:05 UTC 404,353 bytes, 21 lines download raw bytes

vendor: 4,318 bytes, line 1
1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`release-202609300849`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`43fc4150-93ce-48aa-9641-afd6041f9940`,e._sentryDebugIdIdentifier=`sentry-dbid-43fc4150-93ce-48aa-9641-afd6041f9940`)}catch{}})();import{t as e}from"./rolldown-runtime-BT3GMMfx.js";function t(e){this.content=e}t.prototype={constructor:t,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,n,r){var i=r&&r!=e?this.remove(r):this,a=i.find(e),o=i.content.slice();return a==-1?o.push(r||e,n):(o[a+1]=n,r&&(o[a]=r)),new t(o)},remove:function(e){var n=this.find(e);if(n==-1)return this;var r=this.content.slice();return r.splice(n,2),new t(r)},addToStart:function(e,n){return new t([e,n].concat(this.remove(e).content))},addToEnd:function(e,n){var r=this.remove(e).content.slice();return r.push(e,n),new t(r)},addBefore:function(e,n,r){var i=this.remove(n),a=i.content.slice(),o=i.find(e);return a.splice(o==-1?a.length:o,0,n,r),new t(a)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=t.from(e),e.size?new t(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=t.from(e),e.size?new t(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var n=this;e=t.from(e);for(var r=0;r<e.content.length;r+=2)n=n.remove(e.content[r]);return n},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},t.from=function(e){if(e instanceof t)return e;var n=[];if(e)for(var r in e)n.push(r,e[r]);return new t(n)};function n(e,t,r){for(let i=0;;i++){if(i==e.childCount||i==t.childCount)return e.childCount==t.childCount?null:r;let a=e.child(i),o=t.child(i);if(a==o){r+=a.nodeSize;continue}if(!a.sameMarkup(o))return r;if(a.isText&&a.text!=o.text){for(let e=0;a.text[e]==o.text[e];e++)r++;return r}if(a.content.size||o.content.size){let e=n(a.content,o.content,r+1);if(e!=null)return e}r+=a.nodeSize}}function r(e,t,n,i){for(let a=e.childCount,o=t.childCount;;){if(a==0||o==0)return a==o?null:{a:n,b:i};let s=e.child(--a),c=t.child(--o),l=s.nodeSize;if(s==c){n-=l,i-=l;continue}if(!s.sameMarkup(c))return{a:n,b:i};if(s.isText&&s.text!=c.text){let e=0,t=Math.min(s.text.length,c.text.length);for(;e<t&&s.text[s.text.length-e-1]==c.text[c.text.length-e-1];)e++,n--,i--;return{a:n,b:i}}if(s.content.size||c.content.size){let e=r(s.content,c.content,n-1,i-1);if(e)return e}n-=l,i-=l}}var i=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.no
vendor: 14,315 bytes, line 1
1deSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.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 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 n(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return r(this,e,t,n)}findIndex(e,t=-1){if(e==0)return o(0,e);if(e==this.size)return o(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),a=r+i.nodeSize;if(a>=e)return a==e||t>0?o(n+1,a):o(n,r);r=a}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};i.empty=new i([],0);var a={index:0,offset:0};function o(e,t){return a.index=e,a.offset=t,a}function s(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))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(!s(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!s(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var c=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return 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&&s(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 RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}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(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};c.none=[];var l=class extends Error{},u=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=f(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(d(this.content,t+this.openStart,n+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(t,n){if(!n)return e.empty;let r=n.openStart||0,a=n.openEnd||0;if(typeof r!=`number`||typeof a!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(i.fromJSON(t,n.content),r,a)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};u.empty=new u(i.empty,0,0);function d(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(d(a.content,t-i-1,n-i-1)))}function f(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=f(o.content,t-a-1,n);return s&&e.replaceChild(i,o.copy(s))}function p(e,t,n){if(n.openStart>e.depth)throw new l(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new l(`Inconsistent open depths`);return m(e,t,n,0)}function m(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=m(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return y(a,x(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return y(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=S(n,e);return y(a,b(e,i,o,t,r))}}function h(e,t){if(!t.type.compatibleContent(e.type))throw new l(`Cannot join `+t.type.name+` onto `+e.type.name)}function g(e,t,n){let r=e.node(n);return h(r,t.node(n)),r}function _(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 v(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(_(e.nodeAfter,r),a++));for(let e=a;e<o;e++)_(i.child(e),r);t&&t.depth==n&&t.textOffset&&_(t.nodeBefore,r)}function y(e,t){return e.type.checkContent(t),e.copy(t)}function b(e,t,n,r,a){let o=e.depth>a&&g(e,t,a+1),s=r.depth>a&&g(n,r,a+1),c=[];return v(null,e,a,c),o&&s&&t.index(a)==n.index(a)?(h(o,s),_(y(o,b(e,t,n,r,a+1)),c)):(o&&_(y(o,x(e,t,a+1)),c),v(t,n,a,c),s&&_(y(s,x(n,r,a+1)),c)),v(r,null,a,c),new i(c)}function x(e,t,n){let r=[];return v(null,e,n,r),e.depth>n&&_(y(g(e,t,n+1),x(e,t,n+1)),r),v(t,null,n,r),new i(r)}function S(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(i.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var C=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?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[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].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):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return c.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 i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}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 i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].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 D(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(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=E.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else E.set(t,r=new w);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%T,i}},w=class{constructor(){this.elts=[],this.i=0}},T=12,E=new WeakMap,D=class{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)}},O=Object.create(null),k=class e{constructor(e,t,n,r=c.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||i.empty}get children(){return this.content.content}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&&s(this.attrs,t||e.defaultAttrs||O)&&c.sameSet(this.marks,n||c.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&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),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new u(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return p(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(e==0)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()+`)`),j(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=i.empty,r=0,a=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,r,a),s=o&&o.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<a;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}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),this.type.checkAttrs(this.attrs);let e=c.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!c.sameSet(e,this.marks))throw 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 RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=i.fromJSON(e,t.content),a=e.nodeType(t.type).create(t.attrs,r,n);return a.type.checkAttrs(a.attrs),a}};k.prototype.text=void 0;var A=class e extends k{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):j(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(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&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 j(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var M=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new ee(t,n);if(r.next==null)return e.empty;let i=N(r);r.next&&r.err(`Unexpected trailing text`);let a=se(ie(i));return ce(a,r),a}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 i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&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];function a(o,s){let c=o.matchFragment(e,n);if(c&&(!t||c.validEnd))return i.from(s.map(e=>e.createAndFill()));for(let e=0;e<o.next.length;e++){let{type:t,next:n}=o.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=a(n,s.concat(t));if(e)return e}}return null}return a(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+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(),i=r.match;if(i.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<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
2`)}};M.empty=new M(!0);var ee=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\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 SyntaxError(e+` (in content expression '`+this.string+`')`)}};function N(e){let t=[];do t.push(te(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function te(e){let t=[];do t.push(ne(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function ne(e){let t=I(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(`{`))t=P(e,t);else break;return t}function re(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function P(e,t){let n=re(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:re(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function F(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function I(e){if(e.eat(`(`)){let t=N(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=F(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function ie(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}
vendor: 50,023 bytes, lines 2-5
2function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function ae(e,t){return t-e}function oe(e,t){let n=[];return r(t),n.sort(ae);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function se(e){let t=Object.create(null);return n(oe(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);oe(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new M(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(ae);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function ce(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function le(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 ue(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function de(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function L(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new pe(e,r,t[r]);return n}var R=class e{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=L(e,n.attrs),this.defaultAttrs=le(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==M.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}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:ue(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new k(this,this.computeAttrs(e),i.from(t),c.setFrom(n))}createChecked(e=null,t,n){return t=i.from(t),this.checkContent(t),new k(this,this.computeAttrs(e),t,c.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=i.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),a=r&&r.fillBefore(i.empty,!0);return a?new k(this,e,t.append(a),c.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){de(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:c.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function fe(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var pe=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?fe(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},z=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=L(e,r.attrs),this.excluded=null;let i=le(this.attrs);this.instance=i?new c(this,i):null}create(e=null){return!e&&this.instance?this.instance:new c(this,ue(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}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]}checkAttrs(e){de(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},me=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let t in e)n[t]=e[t];n.nodes=t.from(e.nodes),n.marks=t.from(e.marks||{}),this.nodes=R.compile(this.spec.nodes,this),this.marks=z.compile(this.spec.marks,this);let r=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],n=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=r[n]||(r[n]=M.parse(n,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?B(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:B(this,n.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(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof R))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw 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 A(n,n.defaultAttrs,e,c.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return k.fromJSON(this,e)}markFromJSON(e){return c.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function B(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function he(e){return e.tag!=null}function ge(e){return e.style!=null}var _e=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(he(e))this.tags.push(e);else if(ge(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),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 Ee(this,t,!1);return n.addAll(e,c.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Ee(this,t,!0);return n.addAll(e,c.none,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)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=ke(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=ke(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},ve={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},ye={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},be={ol:!0,ul:!0},xe=1,Se=2,Ce=4;function we(e,t,n){return t==null?e&&e.whitespace==`pre`?xe|Se:n&~Ce:(t?xe:0)|(t===`full`?Se:0)}var Te=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=c.none,this.match=i||(a&Ce?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(i.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&xe)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=i.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(i.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ve.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Ee=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=we(null,t.preserveWhitespace,0)|(n?Ce:0);i=r?new Te(r.type,r.attrs,c.none,!0,t.topMatch||r.type.contentMatch,a):n?new Te(null,null,c.none,!0,null,a):new Te(e.schema.topNodeType,null,c.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Se?`full`:this.localPreserveWS||(r.options&xe)>0;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)n=i===`full`?n.replace(/\r\n?/g,`
3`):n.replace(/\r?\n|\r/g,` `);else if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;be.hasOwnProperty(a)&&this.parser.normalizeLists&&De(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:ye.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(ve.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t){let n,r;for(let t=this.open;t>=0;t--){let i=this.nodes[t],a=i.findWrapping(e);if(a&&(!n||n.length>a.length)&&(n=a,r=i,!a.length)||i.solid)break}if(!n)return null;this.sync(r);for(let e=0;e<n.length;e++)t=this.enterInner(n[e],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let n=this.findPlace(e,t);if(n){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let r=c.none;for(let i of n.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Ae(i.type,e.type))&&(r=i.addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=we(e,i,a.options);a.options&Ce&&a.content.length==0&&(o|=Ce);let s=c.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Ae(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new Te(e,t,s,r,null,o)),this.open++,n}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;else this.localPreserveWS&&(this.nodes[t].options|=xe);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++)this.find[t].pos==null&&e.nodeType==1&&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++)this.find[r].pos==null&&e.nodeType==1&&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),i=-(n?n.depth+1:0)+(r?0:1),a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(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 e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function De(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&be.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Oe(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ke(e){let t={};for(let n in e)t[n]=e[n];return t}function Ae(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var je=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=Ne(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=Le(Ne(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw 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 i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Le(Ne(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return Le(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=Me(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return Me(e.marks)}};function Me(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Ne(e){return e.document||window.document}var Pe=new WeakMap;function Fe(e){let t=Pe.get(e);return t===void 0&&Pe.set(e,t=Ie(e)),t}function Ie(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function Le(e,t,n,r){if(typeof t==`string`)return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=Fe(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else{let{dom:t,contentDOM:i}=Le(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Re=65535,ze=2**16;function Be(e,t){return e+t*ze}function Ve(e){return e&Re}function He(e){return(e-(e&Re))/ze}var Ue=1,We=2,Ge=4,Ke=8,qe=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Ke)>0}get deletedBefore(){return(this.delInfo&(Ue|Ge))>0}get deletedAfter(){return(this.delInfo&(We|Ge))>0}get deletedAcross(){return(this.delInfo&Ge)>0}},Je=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=Ve(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+He(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,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:Be(o/3,e-s),f=e==s?We:e==u?Ue:Ge;return(t<0?e!=s:e!=u)&&(f|=Ke),new qe(a,f,d)}r+=l-c}return n?e+r:new qe(e+r,0,null)}touches(e,t){let n=0,r=Ve(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Je.empty=new Je([]);var Ye=class e{constructor(e=[],t,n=0,r=e.length){this.maps=e,this.mirror=t,this.from=n,this.to=r}slice(t=0,n=this.maps.length){return new e(this.maps,this.mirror,t,n)}copy(){return new e(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&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],r!=null&&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.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(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}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 n=this.from;n<this.to;n++){let i=this.maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this.maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new qe(e,r,null)}},Xe=Object.create(null),V=class{getMap(){return Je.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=Xe[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Xe)throw RangeError(`Duplicate use of step JSON ID `+e);return Xe[e]=t,t.prototype.jsonID=e,t}},H=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof l)return e.fail(t.message);throw t}}};function U(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(U(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return i.fromArray(r)}var Ze=class e extends V{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),r=n.node(n.sharedDepth(this.to)),i=new u(U(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return H.fromReplace(e,this.from,this.to,i)}invert(){return new Qe(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};V.jsonID(`addMark`,Ze);var Qe=class e extends V{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 u(U(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return H.fromReplace(e,this.from,this.to,n)}invert(){return new Ze(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};V.jsonID(`removeMark`,Qe);var $e=class e extends V{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return H.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return H.fromReplace(e,this.pos,this.pos+1,new u(i.from(n),0,t.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new et(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};V.jsonID(`addNodeMark`,$e);var et=class e extends V{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return H.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return H.fromReplace(e,this.pos,this.pos+1,new u(i.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new $e(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};V.jsonID(`removeNodeMark`,et);var W=class e extends V{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&nt(e,this.from,this.to)?H.fail(`Structure replace would overwrite content`):H.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Je([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?u.empty:new u(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?u.empty:new u(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,u.fromJSON(t,n.slice),!!n.structure)}};V.jsonID(`replace`,W);var tt=class e extends V{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(nt(e,this.from,this.gapFrom)||nt(e,this.gapTo,this.to)))return H.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return H.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?H.fromReplace(e,this.from,this.to,n):H.fail(`Content does not fit in gap`)}getMap(){return new Je([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,u.fromJSON(t,n.slice),n.insert,!!n.structure)}};V.jsonID(`replaceAround`,tt);function nt(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function rt(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new Qe(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new Ze(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function it(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof z){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new Qe(t.from,t.to,t.style)))}function at(e,t,n,r=n.contentMatch,a=!0){let o=e.doc.nodeAt(t),s=[],c=t+1;for(let t=0;t<o.childCount;t++){let l=o.child(t),d=c+l.nodeSize,f=r.matchType(l.type);if(!f)s.push(new W(c,d,u.empty));else{r=f;for(let t=0;t<l.marks.length;t++)n.allowsMarkType(l.marks[t].type)||e.step(new Qe(c,d,l.marks[t]));if(a&&l.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(l.text);)r||=new u(i.from(n.schema.text(` `,n.allowedMarks(l.marks))),0,0),s.push(new W(c+e.index,c+e.index+e[0].length,r))}}c=d}if(!r.validEnd){let t=r.fillBefore(i.empty,!0);e.replace(c,c,new u(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function ot(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function st(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth;;--n){let r=e.$from.node(n),i=e.$from.index(n),a=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(i,a,t))return n;if(n==0||r.type.spec.isolating||!ot(r,i,a))break}return null}function ct(e,t,n){let{$from:r,$to:a,depth:o}=t,s=r.before(o+1),c=a.after(o+1),l=s,d=c,f=i.empty,p=0;for(let e=o,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,f=i.from(r.node(e).copy(f)),p++):l--;let m=i.empty,h=0;for(let e=o,t=!1;e>n;e--)t||a.after(e+1)<a.end(e)?(t=!0,m=i.from(a.node(e).copy(m)),h++):d++;e.step(new tt(l,d,s,c,new u(f.append(m),p,h),f.size-p,!0))}function lt(e,t,n=null,r=e){let i=dt(e,t),a=i&&ft(r,t);return a?i.map(ut).concat({type:t,attrs:n}).concat(a.map(ut)):null}function ut(e){return{type:e,attrs:null}}function dt(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function ft(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function pt(e,t,n){let r=i.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=i.from(n[e].type.create(n[e].attrs,r))}let a=t.start,o=t.end;e.step(new tt(a,o,a,o,new u(r,0,0),n.length,!0))}function mt(e,t,n,r,a){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let o=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let s=typeof a==`function`?a(t):a;if(t.isTextblock&&!t.hasMarkup(r,s)&&_t(e.doc,e.mapping.slice(o).map(n),r)){let a=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?a=!1:!e&&t&&(a=!0)}a===!1&&gt(e,t,n,o),at(e,e.mapping.slice(o).map(n,1),r,void 0,a===null);let c=e.mapping.slice(o),l=c.map(n,1),d=c.map(n+t.nodeSize,1);return e.step(new tt(l,d,l+1,d-1,new u(i.from(r.create(s,null,t.marks)),0,0),1,!0)),a===!0&&ht(e,t,n,o),!1}})}function ht(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function gt(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
5`))}})}function _t(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function vt(e,t,n,r,a){let o=e.doc.nodeAt(t);if(!o)throw RangeError(`No node at given position`);n||=o.type;let s=n.create(r,null,a||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,s);if(!n.validContent(o.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new tt(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new u(i.from(s),0,0),1,!0))}function yt(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function bt(e,t,n=1,r){let a=e.doc.resolve(t),o=i.empty,s=i.empty;for(let e=a.depth,t=a.depth-n,c=n-1;e>t;e--,c--){o=i.from(a.node(e).copy(o));let t=r&&r[c];s=i.from(t?t.type.create(t.attrs,s):a.node(e).copy(s))}e.step(new W(t,t,new u(o.append(s),n,n),!0))}function xt(e,t){let n=e.resolve(t),r=n.index();return Ct(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function St(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function Ct(e,t){return!!(e&&t&&!e.isLeaf&&St(e,t))}function wt(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&Ct(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function Tt(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);gt(e,r.node(),r.before(),s)}o.inlineContent&&at(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new W(l,c.map(t+n,-1),u.empty,!0)),r===!0){let t=e.doc.resolve(l);ht(e,t.node(),t.before(),e.steps.length)}return e}function Et(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function Dt(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+(n>0?1:0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function Ot(e,t,n=t,r=u.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return kt(i,a,r)?new W(t,n,r):new At(i,a,r).fit()}function kt(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var At=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=i.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=i.from(e.node(t).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,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new u(i,a,o);return e>-1?new tt(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new W(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Nt(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let a=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:o,match:s}=this.frontier[e],c,l=null;if(t==1&&(a?s.matchType(a.type)||(l=s.fillBefore(i.from(a),!1)):r&&o.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:l};if(t==2&&a&&(c=s.findWrapping(a.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:c};if(r&&s.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Nt(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new u(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Nt(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new u(jt(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new u(jt(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:a}){for(;this.depth>t;)this.closeFrontierNode();if(a)for(let e=0;e<a.length;e++)this.openFrontierNode(a[e]);let o=this.unplaced,s=n?n.content:o.content,c=o.openStart-e,l=0,d=[],{match:f,type:p}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)d.push(r.child(e));f=f.matchFragment(r)}let m=s.size+e-(o.content.size-o.openEnd);for(;l<s.childCount;){let e=s.child(l),t=f.matchType(e.type);if(!t)break;l++,(l>1||c==0||e.content.size)&&(f=t,d.push(Pt(e.mark(p.allowedMarks(e.marks)),l==1?c:0,l==s.childCount?m:-1)))}let h=l==s.childCount;h||(m=-1),this.placed=Mt(this.placed,t,i.from(d)),this.frontier[t].match=f,h&&m<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<m;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=h?e==0?u.empty:new u(jt(o.content,e-1,1),e-1,m<0?o.openEnd:e-1):new u(jt(o.content,e,l),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Ft(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.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){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Ft(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=Ft(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?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=Mt(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 r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Mt(this.placed,this.depth,i.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(i.empty,!0);e.childCount&&(this.placed=Mt(this.placed,this.frontier.length,e))}};function jt(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(jt(e.firstChild.content,t-1,n)))}function Mt(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Mt(e.lastChild.content,t-1,n)))}function Nt(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Pt(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Pt(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(i.empty,!0)))),e.copy(r)}function Ft(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!It(n,a.content,o)?s:null}function It(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function Lt(e){return e.spec.defining||e.spec.definingForContent}function Rt(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(kt(i,a,r))return e.step(new W(t,n,r));let o=Ht(i,e.doc.resolve(n));o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],d=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){let t=l[e],n=Lt(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))d=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+d+1)%(r.openStart+1),f=l[s];if(f)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],d=!0;l<0&&(d=!1,l=-l);let p=i.node(l-1),m=i.index(l-1);if(p.canReplaceWith(m,m,f.type,f.marks))return e.replace(i.before(l),d?a.after(l):n,new u(zt(r.content,0,r.openStart,s),s,r.openEnd))}}let f=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>f));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function zt(e,t,n,r,a){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(zt(i.content,t+1,n,r,i)))}if(t>r){let t=a.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(i.empty,!0))}return e}function Bt(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=Et(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new u(i.from(r),0,0))}function Vt(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n),a=Ht(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function Ht(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var Ut=class e extends V{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 H.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return H.fromReplace(e,this.pos,this.pos+1,new u(i.from(r),0,t.isLeaf?0:1))}getMap(){return Je.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};V.jsonID(`attr`,Ut);var Wt=class e extends V{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return H.ok(n)}getMap(){return Je.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};V.jsonID(`docAttr`,Wt);
vendor: 15,467 bytes, line 5
5var Gt=class extends Error{};Gt=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},Gt.prototype=Object.create(Error.prototype),Gt.prototype.constructor=Gt,Gt.prototype.name=`TransformError`;var Kt=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ye}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Gt(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=u.empty){let r=Ot(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new u(i.from(n),0,0))}delete(e,t){return this.replace(e,t,u.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return Rt(this,e,t,n),this}replaceRangeWith(e,t,n){return Bt(this,e,t,n),this}deleteRange(e,t){return Vt(this,e,t),this}lift(e,t){return ct(this,e,t),this}join(e,t=1){return Tt(this,e,t),this}wrap(e,t){return pt(this,e,t),this}setBlockType(e,t=e,n,r=null){return mt(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return vt(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Ut(e,t,n)),this}setDocAttribute(e,t){return this.step(new Wt(e,t)),this}addNodeMark(e,t){return this.step(new $e(e,t)),this}removeNodeMark(e,t){if(!(t instanceof c)){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t=t.isInSet(n.marks),!t)return this}return this.step(new et(e,t)),this}split(e,t=1,n){return bt(this,e,t,n),this}addMark(e,t,n){return rt(this,e,t,n),this}removeMark(e,t,n){return it(this,e,t,n),this}clearIncompatible(e,t,n){return at(this,e,t,n),this}},qt=Object.create(null),G=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Jt(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=u.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?u.empty:t),o==0&&nn(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),nn(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new K(e):tn(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?tn(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):tn(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new $t(e.node(0))}static atStart(e){return tn(e,e,0,0,1)||new $t(e)}static atEnd(e){return tn(e,e,e.content.size,e.childCount,-1)||new $t(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=qt[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in qt)throw RangeError(`Duplicate use of selection JSON ID `+e);return qt[e]=t,t.prototype.jsonID=e,t}getBookmark(){return K.between(this.$anchor,this.$head).getBookmark()}};G.prototype.visible=!0;var Jt=class{constructor(e,t){this.$from=e,this.$to=t}},Yt=!1;function Xt(e){!Yt&&!e.parent.inlineContent&&(Yt=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var K=class e extends G{constructor(e,t=e){Xt(e),Xt(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return G.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=u.empty){if(super.replace(e,t),t==u.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Zt(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=G.findFrom(n,r,!0)||G.findFrom(n,-r,!0);if(e)n=e.$head;else return G.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(G.findFrom(t,-r,!0)||G.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};G.jsonID(`text`,K);var Zt=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return K.between(e.resolve(this.anchor),e.resolve(this.head))}},q=class e extends G{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?G.near(a):new e(a)}content(){return new u(i.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new Qt(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};q.prototype.visible=!1,G.jsonID(`node`,q);var Qt=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new Zt(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&q.isSelectable(n)?new q(t):G.near(t)}},$t=class e extends G{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=u.empty){if(t==u.empty){e.delete(0,e.doc.content.size);let t=G.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return en}};G.jsonID(`all`,$t);var en={map(){return this},resolve(e){return new $t(e)}};function tn(e,t,n,r,i,a=!1){if(t.inlineContent)return K.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=tn(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&q.isSelectable(r))return q.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function nn(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof W||i instanceof tt))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(G.near(e.doc.resolve(o),n))}var rn=1,an=2,on=4,sn=class extends Kt{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 RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|rn)&~an,this.storedMarks=null,this}get selectionSet(){return(this.updated&rn)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=an,this}ensureMarks(e){return c.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(this.updated&an)>0}addStep(e,t){super.addStep(e,t),this.updated&=~an,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)||c.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.setSelection(G.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=on,this}get scrolledIntoView(){return(this.updated&on)>0}};function cn(e,t){return!t||!e?e:e.bind(t)}var ln=class{constructor(e,t,n){this.name=e,this.init=cn(t.init,n),this.apply=cn(t.apply,n)}},un=[new ln(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new ln(`selection`,{init(e,t){return e.selection||G.atStart(t.doc)},apply(e){return e.selection}}),new ln(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new ln(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],dn=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=un.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw 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 ln(e.key,e.spec.state,e))})}},fn=class e{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 i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new sn(this)}static create(t){let n=new dn(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new dn(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new dn(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=k.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=G.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function pn(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=pn(i,t,{})),n[r]=i}return n}var mn=class{constructor(e){this.spec=e,this.props={},e.props&&pn(e.props,this,this.props),this.key=e.key?e.key.key:gn(`plugin`)}getState(e){return e[this.key]}},hn=Object.create(null);function gn(e){return e in hn?e+`$`+ ++hn[e]:(hn[e]=0,e+`$`)}var _n=class{constructor(e=`key`){this.key=gn(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},J=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Y=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},X=null,vn=function(e,t,n){let r=X||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},yn=function(){X=null},bn=function(e,t,n,r){return n&&(Sn(e,t,n,r,-1)||Sn(e,t,n,r,1))},xn=/^(img|br|input|textarea|hr)$/i;function Sn(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Cn(e))){let n=e.parentNode;if(!n||n.nodeType!=1||Dn(e)||xn.test(e.nodeName)||e.contentEditable==`false`)return!1;t=J(e)+(i<0?0:1),e=n}else if(e.nodeType==1){if(e=e.childNodes[t+(i<0?-1:0)],e.contentEditable==`false`)return!1;t=i<0?Cn(e):0}else return!1}}function Cn(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function wn(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=Cn(e)}else if(e.parentNode&&!Dn(e))t=J(e),e=e.parentNode;else return null}}function Tn(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Dn(e))t=J(e)+1,e=e.parentNode;else return null}}function En(e,t,n){for(let r=t==0,i=t==Cn(e);r||i;){if(e==n)return!0;let t=J(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==Cn(e)}}function Dn(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)}var On=function(e){return e.focusNode&&bn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function kn(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function An(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function jn(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);
vendor: 56,251 bytes, lines 5-9
5if(r)return{node:r.offsetNode,offset:Math.min(Cn(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Cn(r.startContainer),r.startOffset)}}}var Mn=typeof navigator<`u`?navigator:null,Nn=typeof document<`u`?document:null,Pn=Mn&&Mn.userAgent||``,Fn=/Edge\/(\d+)/.exec(Pn),In=/MSIE \d/.exec(Pn),Ln=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Pn),Rn=!!(In||Ln||Fn),zn=In?document.documentMode:Ln?+Ln[1]:Fn?+Fn[1]:0,Bn=!Rn&&/gecko\/(\d+)/i.test(Pn);Bn&&+(/Firefox\/(\d+)/.exec(Pn)||[0,0])[1];var Vn=!Rn&&/Chrome\/(\d+)/.exec(Pn),Z=!!Vn,Hn=Vn?+Vn[1]:0,Un=!Rn&&!!Mn&&/Apple Computer/.test(Mn.vendor),Wn=Un&&(/Mobile\/\w+/.test(Pn)||!!Mn&&Mn.maxTouchPoints>2),Q=Wn||(Mn?/Mac/.test(Mn.platform):!1),Gn=Mn?/Win/.test(Mn.platform):!1,Kn=/Android \d/.test(Pn),qn=!!Nn&&`webkitFontSmoothing`in Nn.documentElement.style,Jn=qn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Yn(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Xn(e,t){return typeof e==`number`?e:e[t]}function Zn(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 Qn(e,t,n){let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;o=Y(o)){if(o.nodeType!=1)continue;let e=o,n=e==a.body,s=n?Yn(a):Zn(e),c=0,l=0;if(t.top<s.top+Xn(r,`top`)?l=-(s.top-t.top+Xn(i,`top`)):t.bottom>s.bottom-Xn(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+Xn(i,`top`)-s.top:t.bottom-s.bottom+Xn(i,`bottom`)),t.left<s.left+Xn(r,`left`)?c=-(s.left-t.left+Xn(i,`left`)):t.right>s.right-Xn(r,`right`)&&(c=t.right-s.right+Xn(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}if(n||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function $n(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:er(e.dom)}}function er(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Y(r));return t}function tr({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;nr(n,r==0?0:r-t)}function nr(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var rr=null;function ir(e){if(e.setActive)return e.setActive();if(rr)return e.focus(rr);let t=er(e);e.focus(rr==null?{get preventScroll(){return rr={preventScroll:!0},!0}}:void 0),rr||(rr=!1,nr(t,0))}function ar(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=vn(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?or(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:ar(n,i)}function or(e,t){let n=e.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);let n=pr(r,1);if(n.top!=n.bottom&&sr(t,n))return{node:e,offset:i+(t.left>=(n.left+n.right)/2?1:0)}}return{node:e,offset:0}}function sr(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function $(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function cr(e,t,n){let{node:r,offset:i}=ar(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function lr(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function ur(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(sr(t,i))return ur(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function dr(e,t){let n=e.dom.ownerDocument,r,i=0,a=jn(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!sr(t,n)||(o=ur(e.dom,t,n),!o))return null}if(Un)for(let e=o;r&&e;e=Y(e))e.draggable&&(r=void 0);if(o=$(o,t),r){if(Bn&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;qn&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=lr(e,r,i,t))}s??=cr(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function fr(e){return e.top<e.bottom||e.left<e.right}function pr(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(fr(e))return e}return Array.prototype.find.call(n,fr)||e.getBoundingClientRect()}var mr=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function hr(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=qn||Bn;if(r.nodeType==3)if(o&&(mr.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=pr(vn(r,i,i),n);if(Bn&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=pr(vn(r,i-1,i-1),-1);if(t.top==e.top){let n=pr(vn(r,i,i+1),-1);if(n.top!=e.top)return gr(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,gr(pr(vn(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Cn(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return _r(e.getBoundingClientRect(),!1)}if(a==null&&i<Cn(r)){let e=r.childNodes[i];if(e.nodeType==1)return _r(e.getBoundingClientRect(),!0)}return _r(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==Cn(r))){let e=r.childNodes[i-1],t=e.nodeType==3?vn(e,Cn(e)-(o?0:1)):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return gr(pr(t,1),!1)}if(a==null&&i<Cn(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?vn(e,0,o?0:1):e.nodeType==1?e:null:null;if(t)return gr(pr(t,-1),!0)}return gr(pr(r.nodeType==3?vn(r):r,-n),n>=0)}function gr(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function _r(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function vr(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function yr(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return vr(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=hr(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=vn(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var br=/[\u0590-\u08ac]/;function xr(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!br.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:vr(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Sr=null,Cr=null,wr=!1;function Tr(e,t,n){return Sr==t&&Cr==n?wr:(Sr=t,Cr=n,wr=n==`up`||n==`down`?yr(e,t,n):xr(e,t,n))}var Er=0,Dr=1,Or=2,kr=3,Ar=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Er,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(e.nodeType==1?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}else{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>J(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof Lr){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof jr&&e.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?J(e.dom)+1:0}}else{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?J(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=J(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=J(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((Bn||Un)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
6`),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:J(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(Bn&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&Un)&&bn(o.node,o.offset,l.anchorNode,l.anchorOffset)&&bn(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!u){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}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 i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?Or:Dr,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=kr:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Or:kr}n=a}this.dirty=Or}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Or:Dr;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}},jr=class extends Ar{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.contentEditable=`false`,a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Er&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}},Mr=class extends Ar{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.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},Nr=class e extends Ar{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=je.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&kr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=kr&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Er){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Er}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=ei(a,n,o,r)),t>0&&(a=ei(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},Pr=class e extends Ar{constructor(e,t,n,r,i,a,o,s,c){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=je.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Gr(u,r,n),l?c=new Rr(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new Ir(t,n,r,i,u,f,a):new e(t,n,r,i,u,d||null,f,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(e.preserveWhitespace=`full`),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{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=()=>i.empty)}return e}matchesNode(e,t,n){return this.dirty==Er&&e.eq(this.node)&&Kr(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,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new Jr(this,a&&a.node,e);Zr(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?c.none:this.node.child(i).marks,n,e),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==Or)&&(a&&this.protectLocalComposition(e,a),zr(this.contentDOM,this.children,e),Wn&&Qr(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof K)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=$r(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new Mr(this,i,t,r);e.input.compositionNodes.push(a),this.children=ei(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==kr||!e.sameMarkup(this.node)?!1:(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=Er}updateOuterDeco(e){if(Kr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=Ur(this.dom,this.nodeDOM,Hr(this.outerDeco,this.node,t),Hr(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function Fr(e,t,n,r,i){Gr(r,t,e);let a=new Pr(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var Ir=class e extends Pr{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i,null,a,o,0)}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 this.dirty==kr||this.dirty!=Er&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Er||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=Er,!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 e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=kr)}get domAtom(){return!1}isText(e){return this.node.text==e}},Lr=class extends Ar{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Er&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},Rr=class extends Pr{constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,c,l),this.spec=s}update(e,t,n,r){if(this.dirty==kr)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return 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.root):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):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function zr(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=qr(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof Nr){let t=r?r.previousSibling:e.lastChild;zr(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=qr(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var Br=function(e){e&&(this.nodeName=e)};Br.prototype=Object.create(null);var Vr=[new Br];function Hr(e,t,n){if(e.length==0)return Vr;let r=n?Vr[0]:new Br,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new Br(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new Br(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function Ur(e,t,n,r){if(n==Vr&&r==Vr)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=Vr[0],i=t)}Wr(i,o||Vr[0],a)}return i}function Wr(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function Gr(e,t,n){return Ur(e,e,Vr,Hr(t,n,e.nodeType!=1))}function Kr(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 qr(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var Jr=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Yr(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,i=this.stack.length>>1,a=Math.min(i,e.length);for(;r<a&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&e[r].type.spec.spanning!==!1;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=Er,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<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++){let n=this.top.children[t];if(n.matchesMark(e[i])&&!this.isLocked(n.dom)){r=t;break}}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let r=Nr.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==kr&&a.dom==a.contentDOM&&(a.dirty=Or),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}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,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof Pr){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=kr&&Kr(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Or,u.updateChildren(r,a+1),u.dirty=Er),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Kr(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=Pr.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=Pr.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),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))this.index++;else{let r=new jr(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Nr;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ir)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Un||Z)&&e&&e.dom.contentEditable==`false`&&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);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new Lr(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function Yr(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof Nr)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function Xr(e,t){return e.type.side-t.type.side}function Zr(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u)if(d){d.sort(Xr);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function Qr(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function $r(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function ei(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function ti(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(On(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&q.isSelectable(e)&&i.parent&&!(e.isInline&&En(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new q(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=fi(e,u,s,n)}return l}function ni(e){return e.editable?e.hasFocus():mi(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function ri(e,t=!1){let n=e.state.selection;if(ui(e,n),ni(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Z){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&bn(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)li(e);else{let{anchor:r,head:i}=n,a,o;ii&&!(n instanceof K)&&(n.$from.parent.inlineContent||(a=ai(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=ai(e,n.to))),e.docView.setSelection(r,i,e,t),ii&&(a&&si(a),o&&si(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&ci(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var ii=Un||Z&&Hn<63;function ai(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(Un&&i&&i.contentEditable==`false`)return oi(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return oi(i);if(a)return oi(a)}}function oi(e){return e.contentEditable=`true`,Un&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function si(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function ci(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!ni(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function li(e){let t=e.domSelection(),n=document.createRange();if(!t)return;let r=e.cursorWrapper.dom,i=r.nodeName==`IMG`;i?n.setStart(r.parentNode,J(r)+1):n.setStart(r,0),n.collapse(!0),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&Rn&&zn<=11&&(r.disabled=!0,r.disabled=!1)}function ui(e,t){if(t instanceof q){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(di(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else di(e)}function di(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function fi(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||K.between(t,n,r)}function pi(e){return e.editable&&!e.hasFocus()?!1:mi(e)}function mi(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function hi(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return bn(t.node,t.offset,n.anchorNode,n.anchorOffset)}function gi(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&G.findFrom(a,t)}function _i(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function vi(e,t,n){let r=e.state.selection;if(r instanceof K){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return _i(e,new K(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=gi(e.state,t);return n&&n instanceof q?_i(e,n):!1}else if(!(Q&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?q.isSelectable(i)?_i(e,new q(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):qn?_i(e,new K(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof q&&r.node.isInline)return _i(e,new K(t>0?r.$to:r.$from));else{let n=gi(e.state,t);return n?_i(e,n):!1}}function yi(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function bi(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function xi(e,t){return t<0?Si(e):Ci(e)}function Si(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(Bn&&n.nodeType==1&&r<yi(n)&&bi(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(bi(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(wi(n))break;else{let t=n.previousSibling;for(;t&&bi(t,-1);)i=n.parentNode,a=J(t),t=t.previousSibling;if(t)n=t,r=yi(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?Di(e,n,r):i&&Di(e,i,a)}function Ci(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=yi(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(bi(e,1))a=n,o=++r;else break}else if(wi(n))break;else{let t=n.nextSibling;for(;t&&bi(t,1);)a=t.parentNode,o=J(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=yi(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&Di(e,a,o)}function wi(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ti(e,t){for(;e&&t==e.childNodes.length&&!Dn(e);)t=J(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function Ei(e,t){for(;e&&!t&&!Dn(e);)t=J(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function Di(e,t,n){if(t.nodeType!=3){let e,r;(r=Ti(t,n))?(t=r,n=0):(e=Ei(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(On(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:i}=e;setTimeout(()=>{e.state==i&&ri(e)},50)}function Oi(e,t){let n=e.state.doc.resolve(t);if(!(Z||Gn)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function ki(e,t,n){let r=e.state.selection;if(r instanceof K&&!r.empty||n.indexOf(`s`)>-1||Q&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=gi(e.state,t);if(n&&n instanceof q)return _i(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof $t?G.near(n,t):G.findFrom(n,t);return o?_i(e,o):!1}return!1}function Ai(e,t){if(!(e.state.selection instanceof K))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function ji(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Mi(e){if(!Un||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;ji(e,n,`true`),setTimeout(()=>ji(e,n,`false`),20)}return!1}function Ni(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function Pi(e,t){let n=t.keyCode,r=Ni(t);if(n==8||Q&&n==72&&r==`c`)return Ai(e,-1)||xi(e,-1);if(n==46&&!t.shiftKey||Q&&n==68&&r==`c`)return Ai(e,1)||xi(e,1);if(n==13||n==27)return!0;if(n==37||Q&&n==66&&r==`c`){let t=n==37?Oi(e,e.state.selection.from)==`ltr`?-1:1:-1;return vi(e,t,r)||xi(e,t)}else if(n==39||Q&&n==70&&r==`c`){let t=n==39?Oi(e,e.state.selection.from)==`ltr`?1:-1:1;return vi(e,t,r)||xi(e,t)}else if(n==38||Q&&n==80&&r==`c`)return ki(e,-1,r)||xi(e,-1);else if(n==40||Q&&n==78&&r==`c`)return Mi(e)||ki(e,1,r)||xi(e,1);else if(r==(Q?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function Fi(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||je.fromSchema(e.state.schema),s=Ki(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=Wi[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
7
8`),slice:t}}function Ii(e,t,n,r,a){let o=a.parent.type.spec.code,s,c;if(!n&&!t)return null;let l=t&&(r||o||!n);if(l){if(e.someProp(`transformPastedText`,n=>{t=n(t,o||r,e)}),o)return t?new u(i.from(e.state.schema.text(t.replace(/\r\n?/g,`
9`))),0,0):u.empty;let n=e.someProp(`clipboardTextParser`,n=>n(t,a,r,e));if(n)c=n;else{let n=a.marks(),{schema:r}=e.state,i=je.fromSchema(r);s=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=s.appendChild(document.createElement(`p`));e&&t.appendChild(i.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),s=Yi(n),qn&&Xi(s);let d=s&&s.querySelector(`[data-pm-slice]`),f=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute(`data-pm-slice`)||``);if(f&&f[3])for(let e=+f[3];e>0;e--){let e=s.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;s=e}if(c||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||_e.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||f),context:a,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!Li.test(e.parentNode.nodeName)?{ignore:!0}:null}}),f)c=Zi(Ui(c,+f[1],+f[2]),f[4]);else if(c=u.maxOpen(Ri(c.content,a),!0),c.openStart||c.openEnd){let e=0,t=0;for(let t=c.content.firstChild;e<c.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=c.content.lastChild;t<c.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);c=Ui(c,e,t)}return e.someProp(`transformPasted`,t=>{c=t(c,e)}),c}var Li=/^(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 Ri(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),a,o=[];if(e.forEach(e=>{if(!o)return;let t=r.findWrapping(e.type),n;if(!t)return o=null;if(n=o.length&&a.length&&Bi(t,a,e,o[o.length-1],0))o[o.length-1]=n;else{o.length&&(o[o.length-1]=Vi(o[o.length-1],a.length));let n=zi(e,t);o.push(n),r=r.matchType(n.type),a=t}}),o)return i.from(o)}return e}function zi(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,i.from(e));return e}function Bi(e,t,n,r,a){if(a<e.length&&a<t.length&&e[a]==t[a]){let o=Bi(e,t,n,r.lastChild,a+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(a==e.length-1?n.type:e[a+1]))return r.copy(r.content.append(i.from(zi(n,e,a+1))))}}function Vi(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,Vi(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(i.empty,!0);return e.copy(n.append(r))}function Hi(e,t,n,r,a,o){let s=t<0?e.firstChild:e.lastChild,c=s.content;return e.childCount>1&&(o=0),a<r-1&&(c=Hi(c,t,n,r,a+1,o)),a>=n&&(c=t<0?s.contentMatchAt(0).fillBefore(c,o<=a).append(c):c.append(s.contentMatchAt(s.childCount).fillBefore(i.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(c))}function Ui(e,t,n){return t<e.openStart&&(e=new u(Hi(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new u(Hi(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var Wi={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},Gi=null;function Ki(){return Gi||=document.implementation.createHTMLDocument(`title`)}var qi=null;function Ji(e){let t=window.trustedTypes;return t?(qi||=t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),qi.createHTML(e)):e}function Yi(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=Ki().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&Wi[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>`</`+e+`>`).reverse().join(``)),n.innerHTML=Ji(e),i)for(let e=0;e<i.length;e++)n=n.querySelector(i[e])||n;return n}function Xi(e){let t=e.querySelectorAll(Z?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function Zi(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:a,openStart:o,openEnd:s}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;a=i.from(t.create(r[e+1],a)),o++,s++}return new u(a,o,s)}var Qi={},$i={},ea={touchstart:!0,touchmove:!0},ta=class{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.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function na(e){for(let t in Qi){let n=Qi[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{sa(e,t)&&!oa(e,t)&&(e.editable||!(t.type in $i))&&n(e,t)},ea[t]?{passive:!0}:void 0)}Un&&e.dom.addEventListener(`input`,()=>null),aa(e)}function ra(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ia(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)}function aa(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>oa(e,t))})}function oa(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function sa(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||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function ca(e,t){!oa(e,t)&&Qi[t.type]&&(e.editable||!(t.type in $i))&&Qi[t.type](e,t)}$i.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!Sa(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Kn&&Z&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),Wn&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,kn(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||Pi(e,n)?n.preventDefault():ra(e,`key`)},$i.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},$i.keypress=(e,t)=>{let n=t;if(Sa(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Q&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof K)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode);!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t))&&e.dispatch(e.state.tr.insertText(t).scrollIntoView()),n.preventDefault()}};function la(e){return{left:e.clientX,top:e.clientY}}function ua(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function da(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function fa(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function pa(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&q.isSelectable(r)?(fa(e,new q(n),`pointer`),!0):!1}function ma(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof q&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(q.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(fa(e,q.create(e.state.doc,i),`pointer`),!0)}function ha(e,t,n,r,i){return da(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?ma(e,n):pa(e,n))}function ga(e,t,n,r){return da(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function _a(e,t,n,r){return da(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||va(e,n,r)}function va(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(fa(e,K.create(r,0,r.content.size),`pointer`),!0):!1;let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),a=i.before(t);if(n.inlineContent)fa(e,K.create(r,a+1,a+1+n.content.size),`pointer`);else if(q.isSelectable(n))fa(e,q.create(r,a),`pointer`);else continue;return!0}}function ya(e){return Oa(e)}var ba=Q?`metaKey`:`ctrlKey`;Qi.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=ya(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&ua(n,e.input.lastClick)&&!n[ba]&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a};let o=e.posAtCoords(la(n));o&&(a==`singleClick`?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new xa(e,o,n,!!r)):(a==`doubleClick`?ga:_a)(e,o.pos,o.inside,n)?n.preventDefault():ra(e,`pointer`))};var xa=class{constructor(e,t,n,r){this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[ba],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.dom.nodeType==1?s.dom:null;let{selection:c}=e.state;(n.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof q&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Bn&&!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)),ra(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(()=>ri(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(la(e))),this.updateAllowDefault(e),this.allowDefault||!t?ra(this.view,`pointer`):ha(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Un&&this.mightDrag&&!this.mightDrag.node.isAtom||Z&&!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)?(fa(this.view,G.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):ra(this.view,`pointer`)}move(e){this.updateAllowDefault(e),ra(this.view,`pointer`),e.buttons==0&&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)}};Qi.touchstart=e=>{e.input.lastTouch=Date.now(),ya(e),ra(e,`pointer`)},Qi.touchmove=e=>{e.input.lastTouch=Date.now(),ra(e,`pointer`)},Qi.contextmenu=e=>ya(e);function Sa(e,t){return e.composing?!0:Un&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var Ca=Kn?5e3:-1;$i.compositionstart=$i.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof K&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)))e.markCursor=e.state.storedMarks||n.marks(),Oa(e,!0),e.markCursor=null;else if(Oa(e,!t.selection.empty),Bn&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;
vendor: 1,185 bytes, line 9
9if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}wa(e,Ca)},$i.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,wa(e,20))};function wa(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Oa(e),t))}function Ta(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Da());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Ea(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=wn(t.focusNode,t.focusOffset),r=Tn(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function Da(){let e=document.createEvent(`Event`);
vendor: 22,060 bytes, line 9
9return e.initEvent(`event`,!0,!0),e.timeStamp}function Oa(e,t=!1){if(!(Kn&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Ta(e),t||e.docView&&e.docView.dirty){let n=ti(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!e.state.selection.empty?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function ka(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(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var Aa=Rn&&zn<15||Wn&&Jn<604;Qi.copy=$i.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=Aa?null:n.clipboardData,{dom:o,text:s}=Fi(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):ka(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function ja(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function Ma(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();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Na(e,r.value,null,i,t):Na(e,r.textContent,r.innerHTML,i,t)},50)}function Na(e,t,n,r,i){let a=Ii(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||u.empty)))return!0;if(!a)return!1;let o=ja(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function Pa(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}$i.paste=(e,t)=>{let n=t;if(e.composing&&!Kn)return;let r=Aa?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Na(e,Pa(r),r.getData(`text/html`),i,n)?n.preventDefault():Ma(e,n)};var Fa=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},Ia=Q?`altKey`:`ctrlKey`;Qi.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(la(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof q?i.to-1:i.to))){if(r&&r.mightDrag)o=q.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=q.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=Fi(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!Z||Hn>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Aa?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,Aa||n.dataTransfer.setData(`text/plain`,c),e.dragging=new Fa(l,!n[Ia],o)},Qi.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},$i.dragover=$i.dragenter=(e,t)=>t.preventDefault(),$i.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let i=e.posAtCoords(la(n));if(!i)return;let a=e.state.doc.resolve(i.pos),o=r&&r.slice;o?e.someProp(`transformPasted`,t=>{o=t(o,e)}):o=Ii(e,Pa(n.dataTransfer),Aa?null:n.dataTransfer.getData(`text/html`),!1,a);let s=!!(r&&!n[Ia]);if(e.someProp(`handleDrop`,t=>t(e,n,o||u.empty,s))){n.preventDefault();return}if(!o)return;n.preventDefault();let c=o?Dt(e.state.doc,a.pos,o):a.pos;c??=a.pos;let l=e.state.tr;if(s){let{node:e}=r;e?e.replace(l):l.deleteSelection()}let d=l.mapping.map(c),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,p=l.doc;if(f?l.replaceRangeWith(d,d,o.content.firstChild):l.replaceRange(d,d,o),l.doc.eq(p))return;let m=l.doc.resolve(d);if(f&&q.isSelectable(o.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new q(m));else{let t=l.mapping.map(c);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),l.setSelection(fi(e,m,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta(`uiEvent`,`drop`))},Qi.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())&&ri(e)},20))},Qi.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(),!1)},Qi.beforeinput=(e,t)=>{if(Z&&Kn&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,kn(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 e in $i)Qi[e]=$i[e];function La(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}var Ra=class e{constructor(e,t){this.toDOM=e,this.spec=t||Ua,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new Va(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&La(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},za=class e{constructor(e,t){this.attrs=e,this.spec=t||Ua}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new Va(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&La(this.attrs,t.attrs)&&La(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},Ba=class e{constructor(e,t){this.attrs=e,this.spec=t||Ua}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new Va(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&La(this.attrs,t.attrs)&&La(this.spec,t.spec)}destroy(){}},Va=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,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(t,n,r){return new e(t,t,new Ra(n,r))}static inline(t,n,r,i){return new e(t,n,new za(r,i))}static node(t,n,r,i){return new e(t,n,new Ba(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof za}get widget(){return this.type instanceof Ra}},Ha=[],Ua={},Wa=class e{constructor(e,t){this.local=e.length?e:Ha,this.children=t.length?t:Ha}static create(e,t){return t.length?Qa(t,e,0,Ua):Ga}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==Ga||e.maps.length==0?this:this.mapInner(e,t,0,0,n||Ua)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?qa(this.children,o||[],t,n,r,i,a):o?new e(o.sort($a),Ha):Ga}add(t,n){return n.length?this==Ga?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=Xa(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,Qa(s,e,o+1,Ua)),a+=3}});let o=Ja(a?Za(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort($a):this.local,i||this.children)}remove(e){return e.length==0||this==Ga?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==Ga?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):Ga}forChild(t,n){if(this==Ga)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof za){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort($a),Ha);return r?new Ka([t,r]):t}return r||Ga}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return eo(this.localsInner(e))}localsInner(e){if(this==Ga)return Ha;if(e.inlineContent||!this.local.some(za.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof za||t.push(this.local[e]);return t}forEachSet(e){e(this)}};Wa.empty=new Wa([],[]),Wa.removeOverlap=eo;var Ga=Wa.empty,Ka=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,Ua));return e.from(r)}forChild(t,n){if(n.isLeaf)return Wa.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=Ga&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?eo(n?t:t.sort($a)):Ha}static from(t){switch(t.length){case 0:return Ga;case 1:return t[0];default:return new e(t.every(e=>e instanceof Wa)?t:t.reduce((e,t)=>e.concat(t instanceof Wa?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function qa(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==Ga?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=Qa(Ya(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new Wa(t.sort($a),s)}function Ja(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new Va(i.from+t,i.to+t,i.type))}return n}function Ya(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function Xa(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function Za(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function Qa(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=Xa(e,t,o+n);if(s){a=!0;let e=Qa(s,t,n+o+1,r);e!=Ga&&i.push(o,o+t.nodeSize,e)}});let o=Ja(a?Za(e):e,-n).sort($a);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new Wa(o,i):Ga}function $a(e,t){return e.from-t.from||e.to-t.to}function eo(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),to(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),to(t,i,r.copy(a.from,r.to)));break}}}return t}function to(e,t,n){for(;t<e.length&&$a(n,e[t])>0;)t++;e.splice(t,0,n)}function no(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=Ga&&t.push(r)}),e.cursorWrapper&&t.push(Wa.create(e.state.doc,[e.cursorWrapper.deco])),Ka.from(t)}var ro={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},io=Rn&&zn<=11,ao=class{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}},oo=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ao,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);Rn&&zn<=11&&e.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),io&&(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,ro)),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(pi(this.view)){if(this.suppressingSelectionUpdates)return ri(this.view);if(Rn&&zn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&bn(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=new Set,n;for(let n=e.focusNode;n;n=Y(n))t.add(n);for(let r=e.anchorNode;r;r=Y(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&pi(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(Bn&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||po(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&On(n)&&(c=ti(e))&&c.eq(G.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ri(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),lo(e)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||ri(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(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(Rn&&zn<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?J(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?J(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}},so=new WeakMap,co=!1;function lo(e){if(!so.has(e)&&(so.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Bn,co)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.`),co=!0}}function uo(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return bn(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function fo(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return uo(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?uo(e,n):null}function po(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function mo(e,t,n){let{node:r,fromOffset:i,toOffset:a,from:o,to:s}=e.docView.parseRange(t,n),c=e.domSelectionRange(),l,u=c.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(l=[{node:u,offset:c.anchorOffset}],On(c)||l.push({node:c.focusNode,offset:c.focusOffset})),Z&&e.input.lastKeyCode===8)for(let e=a;e>i;e--){let t=r.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){a=e;break}if(!n||n.size)break}let d=e.state.doc,f=e.someProp(`domParser`)||_e.fromSchema(e.state.schema),p=d.resolve(o),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace==`pre`?`full`:!0,findPositions:l,ruleFromNode:ho,context:p});if(l&&l[0].pos!=null){let e=l[0].pos,t=l[1]&&l[1].pos;t??=e,m={anchor:e+o,head:t+o}}return{doc:h,sel:m,from:o,to:s}}function ho(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(Un&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(e.parentNode.lastChild==e||Un&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName==`IMG`&&e.getAttribute(`mark-placeholder`))return{ignore:!0};return null}var go=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function _o(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=ti(e,t);
vendor: 4,287 bytes, line 9
9if(n&&!e.state.selection.eq(n)){if(Z&&Kn&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,kn(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=mo(e,t,n),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=So(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(Wn&&e.input.lastIOSEnter>Date.now()-225||Kn)&&i.some(e=>e.nodeType==1&&!go.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,kn(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof K&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=vo(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof K&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),Rn&&zn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA,y;if((Wn&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.pos<l.doc.content.size&&!h.sameParent(g)&&(y=G.findFrom(l.doc.resolve(h.pos+1),1,!0))&&y.head==g.pos)&&e.someProp(`handleKeyDown`,t=>t(e,kn(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&bo(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,kn(8,`Backspace`)))){Kn&&Z&&e.domObserver.suppressSelectionUpdates();return}Z&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),Kn&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,kn(13,`Enter`))})},20));let b=m.start,x=m.endA,S,C,w;if(v){if(h.pos==g.pos)Rn&&zn<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>ri(e),20)),S=e.state.tr.delete(b,x),C=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(w=yo(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start()))))S=e.state.tr,w.type==`add`?S.addMark(b,x,w.mark):S.removeMark(b,x,w.mark);else if(h.parent.child(h.index()).isText&&h.index()==g.index()-(g.textOffset?0:1)){let t=h.parent.textBetween(h.parentOffset,g.parentOffset);if(e.someProp(`handleTextInput`,n=>n(e,b,x,t)))return;S=e.state.tr.insertText(t,b,x)}}if(S||=e.state.tr.replace(b,x,l.doc.slice(m.start-l.from,m.endB-l.from)),l.sel){let t=vo(e,S.doc,l.sel);t&&!(Z&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==b||t.head==S.mapping.map(x)-1)||Rn&&t.empty&&t.head==b)&&S.setSelection(t)}C&&S.ensureMarks(C),a&&S.setMeta(`composition`,a),e.dispatch(S.scrollIntoView())}function vo(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:fi(e,t.resolve(n.anchor),t.resolve(n.head))}function yo(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,a=n,o=r,s,c,l;for(let e=0;e<r.length;e++)a=r[e].removeFromSet(a);for(let e=0;e<n.length;e++)o=n[e].removeFromSet(o);if(a.length==1&&o.length==0)c=a[0],s=`add`,l=e=>e.mark(c.addToSet(e.marks));else if(a.length==0&&o.length==1)c=o[0],s=`remove`,l=e=>e.mark(c.removeFromSet(e.marks));else return null;let u=[];for(let e=0;e<t.childCount;e++)u.push(l(t.child(e)));
vendor: 9,627 bytes, line 9
9if(i.from(u).eq(e))return{mark:c,type:s}}function bo(e,t,n,r,i){if(n-t<=i.pos-r.pos||xo(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(xo(a,!0,!0));return!o.parent.isTextblock||o.pos>n||xo(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function xo(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function So(e,t,n,r,i){let a=e.findDiffStart(t,n);if(a==null)return null;let{a:o,b:s}=e.findDiffEnd(t,n+e.size,n+t.size);if(i==`end`){let e=Math.max(0,a-Math.min(o,s));r-=o+e-a}if(o<a&&e.size<t.size){let e=r<=a&&r>=o?a-r:0;a-=e,a&&a<t.size&&Co(t.textBetween(a-1,a+1))&&(a+=e?1:-1),s=a+(s-o),o=a}else if(s<a){let t=r<=a&&r>=s?a-r:0;a-=t,a&&a<e.size&&Co(e.textBetween(a-1,a+1))&&(a+=t?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function Co(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var wo=class{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 ta,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(jo),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Do(this),Eo(this),this.nodeViews=ko(this),this.docView=Fr(this.state.doc,To(this),no(this),this.dom,this),this.domObserver=new oo(this,(e,t,n,r)=>_o(this,e,t,n,r)),this.domObserver.start(),na(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&&aa(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(jo),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];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,i=!1;e.storedMarks&&this.composing&&(Ta(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=ko(this);Ao(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&aa(this),this.editable=Do(this),Eo(this);let o=no(this),s=To(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&$n(this);if(i){this.domObserver.stop();let t=l&&(Rn||Z)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&Oo(n.selection,e.selection);if(l){let n=Z?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Ea(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=Fr(e.doc,s,o,this.dom,this)),n&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&hi(this))?ri(this,t):(ui(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&tr(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof q){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Qn(this,t.getBoundingClientRect(),e)}else Qn(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){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))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new Fa(e.slice,e.move,r<0?void 0:q.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(Rn){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(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&ir(this.dom),ri(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return dr(this,e)}coordsAtPos(e,t=1){return hr(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(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return Tr(this,t||this.state,e)}pasteHTML(e,t){return Na(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return Na(this,e,null,!0,t||new ClipboardEvent(`paste`))}destroy(){this.docView&&(ia(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],no(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,yn())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return ca(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?Un&&this.root.nodeType===11&&An(this.dom.ownerDocument)==this.dom&&fo(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};function To(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[Va.node(0,e.state.doc.content.size,t)]}function Eo(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:Va.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Do(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function Oo(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)}function ko(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 Ao(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function jo(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}var Mo=e(((e,t)=>{function n(e){this.content=e}n.prototype={constructor:n,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 t==-1?void 0:this.content[t+1]},update:function(e,t,r){var i=r&&r!=e?this.remove(r):this,a=i.find(e),o=i.content.slice();return a==-1?o.push(r||e,t):(o[a+1]=t,r&&(o[a]=r)),new n(o)},remove:function(e){var t=this.find(e);if(t==-1)return this;var r=this.content.slice();return r.splice(t,2),new n(r)},addToStart:function(e,t){return new n([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var r=this.remove(e).content.slice();return r.push(e,t),new n(r)},addBefore:function(e,t,r){var i=this.remove(t),a=i.content.slice(),o=i.find(e);return a.splice(o==-1?a.length:o,0,t,r),new n(a)}
9,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=n.from(e),e.size?new n(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=n.from(e),e.size?new n(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=n.from(e);for(var r=0;r<e.content.length;r+=2)t=t.remove(e.content[r]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},n.from=function(e){if(e instanceof n)return e;var t=[];if(e)for(var r in e)t.push(r,e[r]);return new n(t)},t.exports=n})),No=e((e=>{function t(e,t){var r=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!r){if(Array.isArray(e)||(r=n(e))||t&&e&&typeof e.length==`number`){r&&(e=r);var i=0,a=function(){};return{s:a,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:a}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
10In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,c=e},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function n(e,t){if(e){if(typeof e==`string`)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}}function r(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(){return i=typeof Reflect<`u`&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=a(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},i.apply(this,arguments)}function a(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=h(e),e!==null););return e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&m(e,t)}function s(e){var t=f();return function(){var n=h(e),r;if(t){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return c(this,r)}}function c(e,t){if(t&&(g(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return l(e)}function l(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function u(e){var t=typeof Map==`function`?new Map:void 0;return u=function(e){if(e===null||!p(e))return e;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return d(e,arguments,h(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),m(n,e)},u(e)}function d(e,t,n){return d=f()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&m(i,n.prototype),i},d.apply(null,arguments)}function f(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function p(e){try{return Function.toString.call(e).indexOf(`[native code]`)!==-1}catch{return typeof e==`function`}}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function g(e){"@babel/helpers - typeof";return g=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},g(e)}function _(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,b(r.key),r)}}function y(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function b(e){var t=x(e,`string`);return g(t)===`symbol`?t:String(t)}function x(e,t){if(g(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(g(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var S=Mo();
10function C(e,t,n){for(var r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;var i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(var o=0;i.text[o]==a.text[o];o++)n++;return n}if(i.content.size||a.content.size){var s=C(i.content,a.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function w(e,t,n,r){for(var i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};var o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){for(var l=0,u=Math.min(o.text.length,s.text.length);l<u&&o.text[o.text.length-l-1]==s.text[s.text.length-l-1];)l++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){var d=w(o.content,s.content,n-1,r-1);if(d)return d}n-=c,r-=c}}var T=function(){function e(t,n){if(_(this,e),this.content=t,this.size=n||0,n==null)for(var r=0;r<t.length;r++)this.size+=t[r].nodeSize}return y(e,[{key:`nodesBetween`,value:function(e,t,n){for(var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4?arguments[4]:void 0,a=0,o=0;o<t;a++){var s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){var l=o+1;s.nodesBetween(Math.max(0,e-l),Math.min(s.content.size,t-l),n,r+l)}o=c}}},{key:`descendants`,value:function(e){this.nodesBetween(0,this.size,e)}},{key:`textBetween`,value:function(e,t,n,r){var i=``,a=!0;return this.nodesBetween(e,t,function(o,s){var c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}},{key:`append`,value:function(t){if(!t.size)return this;if(!this.size)return t;var n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}},{key:`cut`,value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.size;if(t==0&&n==this.size)return this;var r=[],i=0;if(n>t)for(var a=0,o=0;o<n;a++){var s=this.content[a],c=o+s.nodeSize;c>t&&((o<t||c>n)&&(s=s.isText?s.cut(Math.max(0,t-o),Math.min(s.text.length,n-o)):s.cut(Math.max(0,t-o-1),Math.min(s.content.size,n-o-1))),r.push(s),i+=s.nodeSize),o=c}return new e(r,i)}},{key:`cutByIndex`,value:function(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}},{key:`replaceChild`,value:function(t,n){var r=this.content[t];if(r==n)return this;var i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}},{key:`addToStart`,value:function(t){return new e([t].concat(this.content),this.size+t.nodeSize)}},{key:`addToEnd`,value:function(t){return new e(this.content.concat(t),this.size+t.nodeSize)}},{key:`eq`,value:function(e){if(this.content.length!=e.content.length)return!1;for(var t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}},{key:`firstChild`,get:function(){return this.content.length?this.content[0]:null}},{key:`lastChild`,get:function(){return this.content.length?this.content[this.content.length-1]:null}},{key:`childCount`,get:function(){return this.content.length}},{key:`child`,value:function(e){var t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}},{key:`maybeChild`,value:function(e){return this.content[e]||null}},{key:`forEach`,value:function(e){for(var t=0,n=0;t<this.content.length;t++){var r=this.content[t];e(r,n,t),n+=r.nodeSize}}},{key:`findDiffStart`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return C(this,e,t)}},{key:`findDiffEnd`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.size,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.size;return w(this,e,t,n)}},{key:`findIndex`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1;if(e==0)return D(0,e);if(e==this.size)return D(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(var n=0,r=0;;n++){var i=this.child(n),a=r+i.nodeSize;if(a>=e)return a==e||t>0?D(n+1,a):D(n,r);r=a}}},{key:`toString`,value:function(){return`<`+this.toStringInner()+`>`}},{key:`toStringInner`,value:function(){return this.content.join(`, `)}},{key:`toJSON`,value:function(){return this.content.length?this.content.map(function(e){return e.toJSON()}):null}}],[{key:`fromJSON`,value:function(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}},{key:`fromArray`,value:function(t){if(!t.length)return e.empty;for(var n,r=0,i=0;i<t.length;i++){var a=t[i];r+=a.nodeSize,i&&a.isText&&t[i-1].sameMarkup(a)?(n||=t.slice(0,i),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new e(n||t,r)}},{key:`from`,value:function(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}}]),e}();T.empty=new T([],0);var E={index:0,offset:0};function D(e,t){return E.index=e,E.offset=t,E}function O(e,t){if(e===t)return!0;
10if(!(e&&g(e)==`object`)||!(t&&g(t)==`object`))return!1;var n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(!O(e[r],t[r]))return!1}else{for(var i in e)if(!(i in t)||!O(e[i],t[i]))return!1;for(var a in t)if(!(a in e))return!1}return!0}var k=function(){function e(t,n){_(this,e),this.type=t,this.attrs=n}return y(e,[{key:`addToSet`,value:function(e){for(var t,n=!1,r=0;r<e.length;r++){var i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}},{key:`removeFromSet`,value:function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}},{key:`isInSet`,value:function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}},{key:`eq`,value:function(e){return this==e||this.type==e.type&&O(this.attrs,e.attrs)}},{key:`toJSON`,value:function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return e}}],[{key:`fromJSON`,value:function(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);var n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);var r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}},{key:`sameSet`,value:function(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}},{key:`setFrom`,value:function(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];var n=t.slice();return n.sort(function(e,t){return e.type.rank-t.type.rank}),n}}]),e}();k.none=[];var A=function(e){o(n,e);var t=s(n);function n(){return _(this,n),t.apply(this,arguments)}return y(n)}(u(Error)),j=function(){function e(t,n,r){_(this,e),this.content=t,this.openStart=n,this.openEnd=r}return y(e,[{key:`size`,get:function(){return this.content.size-this.openStart-this.openEnd}},{key:`insertAt`,value:function(t,n){var r=ee(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}},{key:`removeBetween`,value:function(t,n){return new e(M(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}},{key:`eq`,value:function(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}},{key:`toString`,value:function(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}},{key:`toJSON`,value:function(){if(!this.content.size)return null;var e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}}],[{key:`fromJSON`,value:function(t,n){if(!n)return e.empty;var r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(T.fromJSON(t,n.content),r,i)}},{key:`maxOpen`,value:function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=0,i=0,a=t.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(var o=t.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new e(t,r,i)}}]),e}();j.empty=new j(T.empty,0,0);function M(e,t,n){var r=e.findIndex(t),i=r.index,a=r.offset,o=e.maybeChild(i),s=e.findIndex(n),c=s.index,l=s.offset;if(a==t||o.isText){if(l!=n&&!e.child(c).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(i!=c)throw RangeError(`Removing non-flat range`);return e.replaceChild(i,o.copy(M(o.content,t-a-1,n-a-1)))}function ee(e,t,n,r){var i=e.findIndex(t),a=i.index,o=i.offset,s=e.maybeChild(a);if(o==t||s.isText)return r&&!r.canReplace(a,a,n)?null:e.cut(0,t).append(n).append(e.cut(t));var c=ee(s.content,t-o-1,n);return c&&e.replaceChild(a,s.copy(c))}function N(e,t,n){if(n.openStart>e.depth)throw new A(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new A(`Inconsistent open depths`);return te(e,t,n,0)}function te(e,t,n,r){var i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){var o=te(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return I(a,ae(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){var s=e.parent,c=s.content;return I(s,c.cut(0,e.parentOffset).append(n.content).append(c.cut(t.parentOffset)))}else{var l=oe(n,e),u=l.start,d=l.end;return I(a,ie(e,u,d,t,r))}}function ne(e,t){if(!t.type.compatibleContent(e.type))throw new A(`Cannot join `+t.type.name+` onto `+e.type.n
10ame)}function re(e,t,n){var r=e.node(n);return ne(r,t.node(n)),r}function P(e,t){var n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function F(e,t,n,r){var i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(P(e.nodeAfter,r),a++));for(var s=a;s<o;s++)P(i.child(s),r);t&&t.depth==n&&t.textOffset&&P(t.nodeBefore,r)}function I(e,t){return e.type.checkContent(t),e.copy(t)}function ie(e,t,n,r,i){var a=e.depth>i&&re(e,t,i+1),o=r.depth>i&&re(n,r,i+1),s=[];return F(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(ne(a,o),P(I(a,ie(e,t,n,r,i+1)),s)):(a&&P(I(a,ae(e,t,i+1)),s),F(t,n,i,s),o&&P(I(o,ae(n,r,i+1)),s)),F(r,null,i,s),new T(s)}function ae(e,t,n){var r=[];return F(null,e,n,r),e.depth>n&&P(I(re(e,t,n+1),ae(e,t,n+1)),r),F(t,null,n,r),new T(r)}function oe(e,t){for(var n=t.depth-e.openStart,r=t.node(n).copy(e.content),i=n-1;i>=0;i--)r=t.node(i).copy(T.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var se=function(){function e(t,n,r){_(this,e),this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}return y(e,[{key:`resolveDepth`,value:function(e){return e==null?this.depth:e<0?this.depth+e:e}},{key:`parent`,get:function(){return this.node(this.depth)}},{key:`doc`,get:function(){return this.node(0)}},{key:`node`,value:function(e){return this.path[this.resolveDepth(e)*3]}},{key:`index`,value:function(e){return this.path[this.resolveDepth(e)*3+1]}},{key:`indexAfter`,value:function(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}},{key:`start`,value:function(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}},{key:`end`,value:function(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}},{key:`before`,value:function(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}},{key:`after`,value:function(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}},{key:`textOffset`,get:function(){return this.pos-this.path[this.path.length-1]}},{key:`nodeAfter`,get:function(){var e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}},{key:`nodeBefore`,get:function(){var e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}},{key:`posAtIndex`,value:function(e,t){t=this.resolveDepth(t);for(var n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1,i=0;i<e;i++)r+=n.child(i).nodeSize;return r}},{key:`marks`,value:function(){var e=this.parent,t=this.index();if(e.content.size==0)return k.none;if(this.textOffset)return e.child(t).marks;var n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){var i=n;n=r,r=i}for(var a=n.marks,o=0;o<a.length;o++)a[o].type.spec.inclusive===!1&&(!r||!a[o].isInSet(r.marks))&&(a=a[o--].removeFromSet(a));return a}},{key:`marksAcross`,value:function(e){var t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;for(var n=t.marks,r=e.parent.maybeChild(e.index()),i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}},{key:`sharedDepth`,value:function(e){for(var t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}},{key:`blockRange`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this,t=arguments.length>1?arguments[1]:void 0;if(e.pos<this.pos)return e.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new de(this,e,n);return null}},{key:`sameParent`,value:function(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}},{key:`max`,value:function(e){return e.pos>this.pos?e:this}},{key:`min`,value:function(e){return e.pos<this.pos?e:this}},{key:`toString`,value:function(){for(var e=``,t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}}],[{key:`resolve`,value:function(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);for(var r=[],i=0,a=n,o=t;;){var s=o.content.findIndex(a),c=s.index,l=s.offset,u=a-l;
10if(r.push(o,c,i+l),!u||(o=o.child(c),o.isText))break;a=u-1,i+=l+1}return new e(n,r,a)}},{key:`resolveCached`,value:function(t,n){var r=ue.get(t);if(r)for(var i=0;i<r.elts.length;i++){var a=r.elts[i];if(a.pos==n)return a}else ue.set(t,r=new ce);var o=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%le,o}}]),e}(),ce=y(function e(){_(this,e),this.elts=[],this.i=0}),le=12,ue=new WeakMap,de=function(){function e(t,n,r){_(this,e),this.$from=t,this.$to=n,this.depth=r}return y(e,[{key:`start`,get:function(){return this.$from.before(this.depth+1)}},{key:`end`,get:function(){return this.$to.after(this.depth+1)}},{key:`parent`,get:function(){return this.$from.node(this.depth)}},{key:`startIndex`,get:function(){return this.$from.index(this.depth)}},{key:`endIndex`,get:function(){return this.$to.indexAfter(this.depth)}}]),e}(),L=Object.create(null),R=function(){function e(t,n,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:k.none;_(this,e),this.type=t,this.attrs=n,this.marks=i,this.content=r||T.empty}return y(e,[{key:`children`,get:function(){return this.content.content}},{key:`nodeSize`,get:function(){return this.isLeaf?1:2+this.content.size}},{key:`childCount`,get:function(){return this.content.childCount}},{key:`child`,value:function(e){return this.content.child(e)}},{key:`maybeChild`,value:function(e){return this.content.maybeChild(e)}},{key:`forEach`,value:function(e){this.content.forEach(e)}},{key:`nodesBetween`,value:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;this.content.nodesBetween(e,t,n,r,this)}},{key:`descendants`,value:function(e){this.nodesBetween(0,this.content.size,e)}},{key:`textContent`,get:function(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}},{key:`textBetween`,value:function(e,t,n,r){return this.content.textBetween(e,t,n,r)}},{key:`firstChild`,get:function(){return this.content.firstChild}},{key:`lastChild`,get:function(){return this.content.lastChild}},{key:`eq`,value:function(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}},{key:`sameMarkup`,value:function(e){return this.hasMarkup(e.type,e.attrs,e.marks)}},{key:`hasMarkup`,value:function(e,t,n){return this.type==e&&O(this.attrs,t||e.defaultAttrs||L)&&k.sameSet(this.marks,n||k.none)}},{key:`copy`,value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}},{key:`mark`,value:function(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}},{key:`cut`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.content.size;return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}},{key:`slice`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.content.size,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e==t)return j.empty;var r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new j(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}},{key:`replace`,value:function(e,t,n){return N(this.resolve(e),this.resolve(t),n)}},{key:`nodeAt`,value:function(e){for(var t=this;;){var n=t.content.findIndex(e),r=n.index,i=n.offset;if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}},{key:`childAfter`,value:function(e){var t=this.content.findIndex(e),n=t.index,r=t.offset;return{node:this.content.maybeChild(n),index:n,offset:r}}},{key:`childBefore`,value:function(e){if(e==0)return{node:null,index:0,offset:0};var t=this.content.findIndex(e),n=t.index,r=t.offset;if(r<e)return{node:this.content.child(n),index:n,offset:r};var i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}},{key:`resolve`,value:function(e){return se.resolveCached(this,e)}},{key:`resolveNoCache`,value:function(e){return se.resolve(this,e)}},{key:`rangeHasMark`,value:function(e,t,n){var r=!1;return t>e&&this.nodesBetween(e,t,function(e){return n.isInSet(e.marks)&&(r=!0),!r}),r}},{key:`isBlock`,get:function(){return this.type.isBlock}}
10,{key:`isTextblock`,get:function(){return this.type.isTextblock}},{key:`inlineContent`,get:function(){return this.type.inlineContent}},{key:`isInline`,get:function(){return this.type.isInline}},{key:`isText`,get:function(){return this.type.isText}},{key:`isLeaf`,get:function(){return this.type.isLeaf}},{key:`isAtom`,get:function(){return this.type.isAtom}},{key:`toString`,value:function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),pe(this.marks,e)}},{key:`contentMatchAt`,value:function(e){var t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}},{key:`canReplace`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:T.empty,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:n.childCount,a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(var s=r;s<i;s++)if(!this.type.allowsMarks(n.child(s).marks))return!1;return!0}},{key:`canReplaceWith`,value:function(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;var i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}},{key:`canAppend`,value:function(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}},{key:`check`,value:function(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);for(var e=k.none,t=0;t<this.marks.length;t++){var n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!k.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(function(e){return e.type.name})}`);this.content.forEach(function(e){return e.check()})}},{key:`toJSON`,value:function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(function(e){return e.toJSON()})),e}}],[{key:`fromJSON`,value:function(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);var n=void 0;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}var r=T.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}}]),e}();R.prototype.text=void 0;var fe=function(e){o(n,e);var t=s(n);function n(e,r,i,a){var o;if(_(this,n),o=t.call(this,e,r,null,a),!i)throw RangeError(`Empty text nodes are not allowed`);return o.text=i,o}return y(n,[{key:`toString`,value:function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):pe(this.marks,JSON.stringify(this.text))}},{key:`textContent`,get:function(){return this.text}},{key:`textBetween`,value:function(e,t){return this.text.slice(e,t)}},{key:`nodeSize`,get:function(){return this.text.length}},{key:`mark`,value:function(e){return e==this.marks?this:new n(this.type,this.attrs,this.text,e)}},{key:`withText`,value:function(e){return e==this.text?this:new n(this.type,this.attrs,e,this.marks)}},{key:`cut`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.text.length;return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}},{key:`eq`,value:function(e){return this.sameMarkup(e)&&this.text==e.text}},{key:`toJSON`,value:function(){var e=i(h(n.prototype),`toJSON`,this).call(this);return e.text=this.text,e}}]),n}(R);function pe(e,t){for(var n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var z=function(){function e(t){_(this,e),this.validEnd=t,this.next=[],this.wrapCache=[]}return y(e,[{key:`matchType`,value:function(e){for(var t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}},{key:`matchFragment`,value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.childCount,r=this,i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}}
10,{key:`inlineContent`,get:function(){return this.next.length!=0&&this.next[0].type.isInline}},{key:`defaultType`,get:function(){for(var e=0;e<this.next.length;e++){var t=this.next[e].type;if(!(t.isText||t.hasRequiredAttrs()))return t}return null}},{key:`compatible`,value:function(e){for(var t=0;t<this.next.length;t++)for(var n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}},{key:`fillBefore`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=[this];function i(a,o){var s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return T.from(o.map(function(e){return e.createAndFill()}));for(var c=0;c<a.next.length;c++){var l=a.next[c],u=l.type,d=l.next;if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(d)==-1){r.push(d);var f=i(d,o.concat(u));if(f)return f}}return null}return i(this,[])}},{key:`findWrapping`,value:function(e){for(var t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];var n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}},{key:`computeWrapping`,value:function(e){for(var t=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),i=r.match;if(i.matchType(e)){for(var a=[],o=r;o.type;o=o.via)a.push(o.type);return a.reverse()}for(var s=0;s<i.next.length;s++){var c=i.next[s],l=c.type,u=c.next;!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!r.type||u.validEnd)&&(n.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}return null}},{key:`edgeCount`,get:function(){return this.next.length}},{key:`edge`,value:function(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}},{key:`toString`,value:function(){var e=[];function t(n){e.push(n);for(var r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map(function(t,n){for(var r=n+(t.validEnd?`*`:` `)+` `,i=0;i<t.next.length;i++)r+=(i?`, `:``)+t.next[i].type.name+`->`+e.indexOf(t.next[i].next);return r}).join(`
11`)}}],[{key:`parse`,value:function(t,n){var r=new me(t,n);if(r.next==null)return e.empty;var i=B(r);r.next&&r.err(`Unexpected trailing text`);var a=we(xe(i));return Te(a,r),a}}]),e}();z.empty=new z(!0);var me=function(){function e(t,n){_(this,e),this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}return y(e,[{key:`next`,get:function(){return this.tokens[this.pos]}},{key:`eat`,value:function(e){return this.next==e&&(this.pos++||!0)}},{key:`err`,value:function(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}}]),e}();function B(e){var t=[];do t.push(he(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function he(e){var t=[];do t.push(ge(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function ge(e){for(var t=be(e);;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=ve(e,t);else break;return t}function _e(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);var t=Number(e.next);return e.pos++,t}function ve(e,t){var n=_e(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:_e(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function ye(e,t){var n=e.nodeTypes,r=n[t];if(r)return[r];var i=[];for(var a in n){var o=n[a];o.isInGroup(t)&&i.push(o)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function be(e){if(e.eat(`(`)){var t=B(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{var n=ye(e,e.next).map(function(t){return e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}});return e.pos++,n.length==1?n[0]:{type:`choice`,exprs:n}}}function xe(e){var t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){var i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(function(e){return e.to=t})}function a(e,t){if(e.type==`choice`)return e.exprs.reduce(function(e,n){return e.concat(a(n,t))},[]);if(e.type==`seq`)for(var o=0;;o++){var s=a(e.exprs[o],t);if(o==e.exprs.length-1)return s;i(s,t=n())}else if(e.type==`star`){var c=n();return r(t,c),i(a(e.expr,c),c),[r(c)]}else if(e.type==`plus`){var l=n();return i(a(e.expr,t),l),i(a(e.expr,l),l),[r(l)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){for(var u=t,d=0;d<e.min;d++){var f=n();i(a(e.expr,u),f),u=f}if(e.max==-1)i(a(e.expr,u),u);else for(var p=e.min;p<e.max;p++){var m=n();r(u,m),i(a(e.expr,u),m),u=m}
11return[r(u)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Se(e,t){return t-e}function Ce(e,t){var n=[];return r(t),n.sort(Se);function r(t){var i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(var a=0;a<i.length;a++){var o=i[a],s=o.term,c=o.to;!s&&n.indexOf(c)==-1&&r(c)}}}function we(e){var t=Object.create(null);return n(Ce(e,0));function n(r){var i=[];r.forEach(function(t){e[t].forEach(function(t){var n=t.term,r=t.to;if(n){for(var a,o=0;o<i.length;o++)i[o][0]==n&&(a=i[o][1]);Ce(e,r).forEach(function(e){a||i.push([n,a=[]]),a.indexOf(e)==-1&&a.push(e)})}})});for(var a=t[r.join(`,`)]=new z(r.indexOf(e.length-1)>-1),o=0;o<i.length;o++){var s=i[o][1].sort(Se);a.next.push({type:i[o][0],next:t[s.join(`,`)]||n(s)})}return a}}function Te(e,t){for(var n=0,r=[e];n<r.length;n++){for(var i=r[n],a=!i.validEnd,o=[],s=0;s<i.next.length;s++){var c=i.next[s],l=c.type,u=c.next;o.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),r.indexOf(u)==-1&&r.push(u)}a&&t.err(`Only non-generatable nodes (`+o.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Ee(e){var t=Object.create(null);for(var n in e){var r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function De(e,t){var n=Object.create(null);for(var r in e){var i=t&&t[r];if(i===void 0){var a=e[r];if(a.hasDefault)i=a.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Oe(e,t,n,r){for(var i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(var a in e){var o=e[a];o.validate&&o.validate(t[a])}}function ke(e,t){var n=Object.create(null);if(t)for(var r in t)n[r]=new Me(e,r,t[r]);return n}var Ae=function(){function e(t,n,r){_(this,e),this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(` `):[],this.attrs=ke(t,r.attrs),this.defaultAttrs=Ee(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t==`text`),this.isText=t==`text`}return y(e,[{key:`isInline`,get:function(){return!this.isBlock}},{key:`isTextblock`,get:function(){return this.isBlock&&this.inlineContent}},{key:`isLeaf`,get:function(){return this.contentMatch==z.empty}}
11,{key:`isAtom`,get:function(){return this.isLeaf||!!this.spec.atom}},{key:`isInGroup`,value:function(e){return this.groups.indexOf(e)>-1}},{key:`whitespace`,get:function(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}},{key:`hasRequiredAttrs`,value:function(){for(var e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}},{key:`compatibleContent`,value:function(e){return this==e||this.contentMatch.compatible(e.contentMatch)}},{key:`computeAttrs`,value:function(e){return!e&&this.defaultAttrs?this.defaultAttrs:De(this.attrs,e)}},{key:`create`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new R(this,this.computeAttrs(e),T.from(t),k.setFrom(n))}},{key:`createChecked`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;return t=T.from(t),this.checkContent(t),new R(this,this.computeAttrs(e),t,k.setFrom(n))}},{key:`createAndFill`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(e=this.computeAttrs(e),t=T.from(t),t.size){var r=this.contentMatch.fillBefore(t);if(!r)return null;t=r.append(t)}var i=this.contentMatch.matchFragment(t),a=i&&i.fillBefore(T.empty,!0);return a?new R(this,e,t.append(a),k.setFrom(n)):null}},{key:`validContent`,value:function(e){var t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(var n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}},{key:`checkContent`,value:function(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}},{key:`checkAttrs`,value:function(e){Oe(this.attrs,e,`node`,this.name)}},{key:`allowsMarkType`,value:function(e){return this.markSet==null||this.markSet.indexOf(e)>-1}},{key:`allowsMarks`,value:function(e){if(this.markSet==null)return!0;for(var t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}},{key:`allowedMarks`,value:function(e){if(this.markSet==null)return e;for(var t,n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:k.none:e}}],[{key:`compile`,value:function(t,n){var r=Object.create(null);t.forEach(function(t,i){return r[t]=new e(t,n,i)});var i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(var a in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}}]),e}();function je(e,t,n){var r=n.split(`|`);return function(n){var i=n===null?`null`:g(n);if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var Me=function(){function e(t,n,r){_(this,e),this.hasDefault=Object.prototype.hasOwnProperty.call(r,`default`),this.default=r.default,this.validate=typeof r.validate==`string`?je(t,n,r.validate):r.validate}return y(e,[{key:`isRequired`,get:function(){return!this.hasDefault}}]),e}(),Ne=function(){function e(t,n,r,i){_(this,e),this.name=t,this.rank=n,this.schema=r,this.spec=i,this.attrs=ke(t,i.attrs),this.excluded=null;var a=Ee(this.attrs);this.instance=a?new k(this,a):null}return y(e,[{key:`create`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return!e&&this.instance?this.instance:new k(this,De(this.attrs,e))}},{key:`removeFromSet`,value:function(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}},{key:`isInSet`,value:function(e){for(var t=0;t<e.length;t++)if(e[t].type==this)return e[t]}},{key:`checkAttrs`,value:function(e){Oe(this.attrs,e,`mark`,this.name)}},{key:`excludes`,value:function(e){return this.excluded.indexOf(e)>-1}}],[{key:`compile`,value:function(t,n){var r=Object.create(null),i=0;return t.forEach(function(t,a){return r[t]=new e(t,i++,n,a)}),r}}]),e}(),Pe=function(){function e(t){_(this,e),this.linebreakReplacement=null,this.cached=Object.create(null);var n=this.spec={};for(var r in t)n[r]=t[r];n.nodes=S.from(t.nodes),n.marks=S.from(t.marks||{}),this.nodes=Ae.compile(this.spec.nodes,this),this.marks=Ne.compile(this.spec.marks,this);var i=Object.create(null);for(var a in this.nodes){if(a in this.marks)throw RangeError(a+` can not be both a node and a mark`);var o=this.nodes[a],s=o.spec.content||``,c=o.spec.marks;if(o.contentMatch=i[s]||(i[s]=z.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!o.isInline||!o.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=o}o.markSet=c==`_`?null:c?Fe(this,c.split(` `)):c==``||!o.inlineContent?[]:null}for(var l in this.marks){var u=this.marks[l],d=u.spec.excludes;u.excluded=d==null?[u]:d==``?[]:Fe(this,d.split(` `))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}return y(e,[{key:`node`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Ae))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}},{key:`text`,value:function(e,t){var n=this.nodes.text;return new fe(n,n.defaultAttrs,e,k.setFrom(t))}},{key:`mark`,value:function(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}},{key:`nodeFromJSON`,value:function(e){return R.fromJSON(this,e)}},{key:`markFromJSON`,value:function(e){return k.fromJSON(this,e)}},{key:`nodeType`,value:function(e){var t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}}]),e}();function Fe(e,t){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(var s in e.marks){var c=e.marks[s];(i==`_`||c.spec.group&&c.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=c)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function Ie(e){return e.tag!=null}function Le(e){return e.style!=null}var Re=function(){function e(t,n){var r=this;_(this,e),this.schema=t,this.rules=n,this.tags=[],this.styles=[];var i=this.matchedStyles=[];
11n.forEach(function(e){if(Ie(e))r.tags.push(e);else if(Le(e)){var t=/[^=]*/.exec(e.style)[0];i.indexOf(t)<0&&i.push(t),r.styles.push(e)}}),this.normalizeLists=!this.tags.some(function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)})}return y(e,[{key:`parse`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=new qe(this,t,!1);return n.addAll(e,k.none,t.from,t.to),n.finish()}},{key:`parseSlice`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=new qe(this,t,!0);return n.addAll(e,k.none,t.from,t.to),j.maxOpen(n.finish())}},{key:`matchTag`,value:function(e,t,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var i=this.tags[r];if(Ye(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){var a=i.getAttrs(e);if(a===!1)continue;i.attrs=a||void 0}return i}}}},{key:`matchStyle`,value:function(e,t,n,r){for(var i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){var a=this.styles[i],o=a.style;if(!(o.indexOf(e)!=0||a.context&&!n.matchesContext(a.context)||o.length>e.length&&(o.charCodeAt(e.length)!=61||o.slice(e.length+1)!=t))){if(a.getAttrs){var s=a.getAttrs(t);if(s===!1)continue;a.attrs=s||void 0}return a}}}}],[{key:`schemaRules`,value:function(e){var t=[];function n(e){for(var n=e.priority==null?50:e.priority,r=0;r<t.length;r++){var i=t[r];if((i.priority==null?50:i.priority)<n)break}t.splice(r,0,e)}var r=function(t){var r=e.marks[t].spec.parseDOM;r&&r.forEach(function(e){n(e=Xe(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})};for(var i in e.marks)r(i);var a=function(t){var r=e.nodes[t].spec.parseDOM;r&&r.forEach(function(e){n(e=Xe(e)),e.node||e.ignore||e.mark||(e.node=t)})};for(var o in e.nodes)a(o);return t}},{key:`fromSchema`,value:function(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}}]),e}(),ze={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},Be={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ve={ol:!0,ul:!0},He=1,Ue=2,We=4;function Ge(e,t,n){return t==null?e&&e.whitespace==`pre`?He|Ue:n&~We:(t?He:0)|(t===`full`?Ue:0)}var Ke=function(){function e(t,n,r,i,a,o){_(this,e),this.type=t,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=k.none,this.match=a||(o&We?null:t.contentMatch)}return y(e,[{key:`findWrapping`,value:function(e){if(!this.match){if(!this.type)return[];var t=this.type.contentMatch.fillBefore(T.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{var n=this.type.contentMatch,r;return(r=n.findWrapping(e.type))?(this.match=n,r):null}}return this.match.findWrapping(e.type)}},{key:`finish`,value:function(e){if(!(this.options&He)){var t=this.content[this.content.length-1],n;if(t&&t.isText&&(n=/[ \t\r\n\u000c]+$/.exec(t.text))){var r=t;t.text.length==n[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-n[0].length))}}var i=T.from(this.content);return!e&&this.match&&(i=i.append(this.match.fillBefore(T.empty,!0))),this.type?this.type.create(this.attrs,i,this.marks):i}},{key:`inlineContext`,value:function(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ze.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}]),e}(),qe=function(){function e(t,n,r){_(this,e),this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;var i=n.topNode,a,o=Ge(null,n.preserveWhitespace,0)|(r?We:0);a=i?new Ke(i.type,i.attrs,k.none,!0,n.topMatch||i.type.contentMatch,o):r?new Ke(null,null,k.none,!0,null,o):new Ke(t.schema.topNodeType,null,k.none,!0,null,o),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}return y(e,[{key:`top`,get:function(){return this.nodes[this.open]}},{key:`addDOM`,value:function(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}},{key:`addTextNode`,value:function(e,t){var n=e.nodeValue,r=this.top,i=r.options&Ue?`full`:this.localPreserveWS||(r.options&He)>0;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if
11(i)n=i===`full`?n.replace(/\r\n?/g,`
12`):n.replace(/\r?\n|\r/g,` `);else if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){var a=r.content[r.content.length-1],o=e.previousSibling;(!a||o&&o.nodeName==`BR`||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),t),this.findInText(e)}else this.findInside(e)}},{key:`addElement`,value:function(e,t,n){var r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);var a=e.nodeName.toLowerCase(),o;Ve.hasOwnProperty(a)&&this.parser.normalizeLists&&Je(e);var s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Be.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);var c,l=this.needsBlock;if(ze.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}var u=s&&s.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(i),this.needsBlock=l}else{var d=this.readStyles(e,t);d&&this.addElementByRule(e,s,d,s.consuming===!1?o:void 0)}this.localPreserveWS=r}},{key:`leafFallback`,value:function(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
13`),t)}},{key:`ignoreFallback`,value:function(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t)}},{key:`readStyles`,value:function(e,t){var n=this,r=e.style;if(r&&r.length)for(var i=0;i<this.parser.matchedStyles.length;i++){var a=this.parser.matchedStyles[i],o=r.getPropertyValue(a);if(o){for(var s=function(e){var r=n.parser.matchStyle(a,o,n,e);if(!r)return l=e,0;if(r.ignore)return{v:null};if(t=r.clearMark?t.filter(function(e){return!r.clearMark(e)}):t.concat(n.parser.schema.marks[r.mark].create(r.attrs)),r.consuming===!1)e=r;else return l=e,0;l=e},c,l=void 0;c=s(l),c!==0;)if(c)return c.v}}return t}},{key:`addElementByRule`,value:function(e,t,n,r){var i=this,a,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n)||this.leafFallback(e,n);else{var s=this.enter(o,t.attrs||null,n,t.preserveWhitespace);s&&(a=!0,n=s)}else{var c=this.parser.schema.marks[t.mark];n=n.concat(c.create(t.attrs))}var l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(function(e){return i.insertNode(e,n)});else{var u=e;typeof t.contentElement==`string`?u=e.querySelector(t.contentElement):typeof t.contentElement==`function`?u=t.contentElement(e):t.contentElement&&(u=t.contentElement),this.findAround(e,u,!0),this.addAll(u,n),this.findAround(e,u,!1)}a&&this.sync(l)&&this.open--}},{key:`addAll`,value:function(e,t,n,r){for(var i=n||0,a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}},{key:`findPlace`,value:function(e,t){for(var n,r,i=this.open;i>=0;i--){var a=this.nodes[i],o=a.findWrapping(e);if(o&&(!n||n.length>o.length)&&(n=o,r=a,!o.length)||a.solid)break}if(!n)return null;this.sync(r);for(var s=0;s<n.length;s++)t=this.enterInner(n[s],null,t,!1);return t}},{key:`insertNode`,value:function(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){var r=this.textblockFromContext();r&&(n=this.enterInner(r,null,n))}var i=this.findPlace(e,n);if(i){this.closeExtra();var a=this.top;a.match&&=a.match.matchType(e.type);var o=k.none,s=t(i.concat(e.marks)),c;try{for(s.s();!(c=s.n()).done;){var l=c.value;(a.type?a.type.allowsMarkType(l.type):V(l.type,e.type))&&(o=l.addToSet(o))}}catch(e){s.e(e)}finally{s.f()}return a.content.push(e.mark(o)),!0}return!1}},{key:`enter`,value:function(e,t,n,r){var i=this.findPlace(e.create(t),n);return i&&=this.enterInner(e,t,n,!0,r),i}},{key:`enterInner`,value:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=arguments.length>4?arguments[4]:void 0;this.closeExtra();var a=this.top;a.match=a.match&&a.match.matchType(e);var o=Ge(e,i,a.options);a.options&We&&a.content.length==0&&(o|=We);var s=k.none;return n=n.filter(function(t){return(a.type?a.type.allowsMarkType(t.type):V(t.type,e))?(s=t.addToSet(s),!1):!0}),this.nodes.push(new Ke(e,t,s,r,null,o)),this.open++,n}},{key:`closeExtra`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}},{key:`finish`,value:function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}},{key:`sync`,value:function(e){for(var t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=He);return!1}},{key:`currentPos`,get:function(){this.closeExtra();for(var e=0,t=this.open;t>=0;t--){for(var n=this.nodes[t].content,r=n.length-1;r>=0;r--)e+=n[r].nodeSize;t&&e++}return e}},{key:`findAtPoint`,value:function(e,t){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}},{key:`findInside`,value:function(e){if(this.find)for(var t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}},{key:`findAround`,value:function(e,t,n){if(e!=t&&this.find)for(var r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},{key:`findInText`,value:function(e){if(this.find)for(var t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}},{key:`matchesContext`,value:function(e){var t=this;if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);var n=e.split(`/`),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(i?0:1);return function e(o,s){for(;o>=0;o--){var c=n[o];if(c==``){if(o==n.length-1||o==0)continue;for(;s>=a;s--)if(e(o-1,s))return!0;return!1}else{var l=s>0||s==0&&i?t.nodes[s].type:r&&s>=a?r.node(s-a).type:null;if(!l||l.name!=c&&!l.isInGroup(c))return!1;s--}}return!0}(n.length-1,this.open)}},{key:`textblockFromContext`,value:function(){var e=this.options.context;if(e)for(var t=e.depth;t>=0;t--){var n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;
13if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var i=this.parser.schema.nodes[r];if(i.isTextblock&&i.defaultAttrs)return i}}}]),e}();function Je(e){for(var t=e.firstChild,n=null;t;t=t.nextSibling){var r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&Ve.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r==`li`?n=t:r&&(n=null)}}function Ye(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Xe(e){var t={};for(var n in e)t[n]=e[n];return t}function V(e,t){var n=t.schema.nodes,r=function(){var r=n[a];if(!r.allowsMarkType(e))return 0;var i=[];if(function e(n){i.push(n);for(var r=0;r<n.edgeCount;r++){var a=n.edge(r),o=a.type,s=a.next;if(o==t||i.indexOf(s)<0&&e(s))return!0}}(r.contentMatch))return{v:!0}},i;for(var a in n)if(i=r(),i!==0&&i)return i.v}var H=function(){function e(t,n){_(this,e),this.nodes=t,this.marks=n}return y(e,[{key:`serializeFragment`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;r||=Ze(n).createDocumentFragment();var i=r,a=[];return e.forEach(function(e){if(a.length||e.marks.length){for(var r=0,o=0;r<a.length&&o<e.marks.length;){var s=e.marks[o];if(!t.marks[s.type.name]){o++;continue}if(!s.eq(a[r][0])||s.type.spec.spanning===!1)break;r++,o++}for(;r<a.length;)i=a.pop()[1];for(;o<e.marks.length;){var c=e.marks[o++],l=t.serializeMark(c,e.isInline,n);l&&(a.push([c,i]),i.appendChild(l.dom),i=l.contentDOM||l.dom)}}i.appendChild(t.serializeNodeInner(e,n))}),r}},{key:`serializeNodeInner`,value:function(e,t){var n=W(Ze(t),this.nodes[e.type.name](e),null,e.attrs),r=n.dom,i=n.contentDOM;if(i){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,i)}return r}},{key:`serializeNode`,value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=this.serializeNodeInner(e,t),r=e.marks.length-1;r>=0;r--){var i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}},{key:`serializeMark`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=this.marks[e.type.name];return r&&W(Ze(n),r(e,t),null,e.attrs)}}],[{key:`renderSpec`,value:function(e,t){return W(e,t,arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,arguments.length>3?arguments[3]:void 0)}},{key:`fromSchema`,value:function(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}},{key:`nodesFromSchema`,value:function(e){var t=U(e.nodes);return t.text||=function(e){return e.text},t}},{key:`marksFromSchema`,value:function(e){return U(e.marks)}}]),e}();function U(e){var t={};for(var n in e){var r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Ze(e){return e.document||window.document}var Qe=new WeakMap;function $e(e){var t=Qe.get(e);return t===void 0&&Qe.set(e,t=et(e)),t}function et(e){var t=null;function n(e){if(e&&g(e)==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(var r=0;r<e.length;r++)n(e[r]);else for(var i in e)n(e[i])}return n(e),t}function W(e,t,n,r){if(typeof t==`string`)return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;var i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);
13if(r&&(a=$e(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);var o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));var s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&g(l)==`object`&&l.nodeType==null&&!Array.isArray(l)){for(var d in u=2,l)if(l[d]!=null){var f=d.indexOf(` `);f>0?c.setAttributeNS(d.slice(0,f),d.slice(f+1),l[d]):c.setAttribute(d,l[d])}}for(var p=u;p<t.length;p++){var m=t[p];if(m===0){if(p<t.length-1||p>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else{var h=W(e,m,n,r),_=h.dom,v=h.contentDOM;if(c.appendChild(_),v){if(s)throw RangeError(`Multiple content holes`);s=v}}}return{dom:c,contentDOM:s}}e.ContentMatch=z,e.DOMParser=Re,e.DOMSerializer=H,e.Fragment=T,e.Mark=k,e.MarkType=Ne,e.Node=R,e.NodeRange=de,e.NodeType=Ae,e.ReplaceError=A,e.ResolvedPos=se,e.Schema=Pe,e.Slice=j})),Po=e((e=>{function t(e){var i=typeof Map==`function`?new Map:void 0;return t=function(e){if(e===null||!r(e))return e;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(i!==void 0){if(i.has(e))return i.get(e);i.set(e,t)}function t(){return n(e,arguments,u(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),a(t,e)},t(e)}function n(e,t,r){return n=l()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&a(i,n.prototype),i},n.apply(null,arguments)}function r(e){try{return Function.toString.call(e).indexOf(`[native code]`)!==-1}catch{return typeof e==`function`}}function i(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&a(e,t)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}function o(e){var t=l();return function(){var n=u(e),r;if(t){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return s(this,r)}}function s(e,t){if(t&&(d(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return c(e)}function c(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function l(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function d(e){"@babel/helpers - typeof";return d=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},d(e)}function f(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,h(r.key),r)}}function m(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function h(e){var t=g(e,`string`);return d(t)===`symbol`?t:String(t)}function g(e,t){if(d(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(d(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var _=No(),v=65535,y=2**16;function b(e,t){return e+t*y}function x(e){return e&v}function S(e){return(e-(e&v))/y}var C=1,w=2,T=4,E=8,D=function(){function e(t,n,r){f(this,e),this.pos=t,this.delInfo=n,this.recover=r}return m(e,[{key:`deleted`,get:function(){return(this.delInfo&E)>0}},{key:`deletedBefore`,get:function(){return(this.delInfo&(C|T))>0}},{key:`deletedAfter`,get:function(){return(this.delInfo&(w|T))>0}},{key:`deletedAcross`,get:function(){return(this.delInfo&T)>0}}]),e}(),O=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(f(this,e),this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}return m(e,[{key:`recover`,value:function(e){var t=0,n=x(e);if(!this.inverted)for(var r=0;r<n;
13r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[n*3]+t+S(e)}},{key:`mapResult`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return this._map(e,t,!1)}},{key:`map`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return this._map(e,t,!0)}},{key:`_map`,value:function(e,t,n){for(var r=0,i=this.inverted?2:1,a=this.inverted?1:2,o=0;o<this.ranges.length;o+=3){var s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;var c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){var d=c?e==s?-1:e==u?1:t:t,f=s+r+(d<0?0:l);if(n)return f;var p=e==(t<0?s:u)?null:b(o/3,e-s),m=e==s?w:e==u?C:T;return(t<0?e!=s:e!=u)&&(m|=E),new D(f,m,p)}r+=l-c}return n?e+r:new D(e+r,0,null)}},{key:`touches`,value:function(e,t){for(var n=0,r=x(t),i=this.inverted?2:1,a=this.inverted?1:2,o=0;o<this.ranges.length;o+=3){var s=this.ranges[o]-(this.inverted?n:0);if(s>e)break;var c=this.ranges[o+i];if(e<=s+c&&o==r*3)return!0;n+=this.ranges[o+a]-c}return!1}},{key:`forEach`,value:function(e){for(var t=this.inverted?2:1,n=this.inverted?1:2,r=0,i=0;r<this.ranges.length;r+=3){var a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}},{key:`invert`,value:function(){return new e(this.ranges,!this.inverted)}},{key:`toString`,value:function(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}}],[{key:`offset`,value:function(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}}]),e}();O.empty=new O([]);var k=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:t.length;f(this,e),this.maps=t,this.mirror=n,this.from=r,this.to=i}return m(e,[{key:`slice`,value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.maps.length;return new e(this.maps,this.mirror,t,n)}},{key:`copy`,value:function(){return new e(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}},{key:`appendMap`,value:function(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}},{key:`appendMapping`,value:function(e){for(var t=0,n=this.maps.length;t<e.maps.length;t++){var r=e.getMirror(t);this.appendMap(e.maps[t],r!=null&&r<t?n+r:void 0)}}},{key:`getMirror`,value:function(e){if(this.mirror){for(var t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}},{key:`setMirror`,value:function(e,t){this.mirror||=[],this.mirror.push(e,t)}},{key:`appendMappingInverted`,value:function(e){for(var t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){var r=e.getMirror(t);this.appendMap(e.maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}},{key:`invert`,value:function(){var t=new e;return t.appendMappingInverted(this),t}},{key:`map`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;if(this.mirror)return this._map(e,t,!0);for(var n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}},{key:`mapResult`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return this._map(e,t,!1)}},{key:`_map`,value:function(e,t,n){for(var r=0,i=this.from;i<this.to;i++){var a=this.maps[i].mapResult(e,t);if(a.recover!=null){var o=this.getMirror(i);if(o!=null&&o>i&&o<this.to){i=o,e=this.maps[o].recover(a.recover);continue}}r|=a.delInfo,e=a.pos}return n?e:new D(e,r,null)}}]),e}(),A=Object.create(null),j=function(){function e(){f(this,e)}return m(e,[{key:`getMap`,value:function(){return O.empty}},{key:`merge`,value:function(e){return null}}],[{key:`fromJSON`,value:function(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);var n=A[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}},{key:`jsonID`,value:function(e,t){if(e in A)throw RangeError(`Duplicate use of step JSON ID `+e);return A[e]=t,t.prototype.jsonID=e,t}}]),e}(),M=function(){function e(t,n){f(this,e),this.doc=t,this.failed=n}return m(e,null,[{key:`ok`,value:function(t){return new e(t,null)}},{key:`fail`,value:function(t){return new e(null,t)}},{key:`fromReplace`,value:function(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof _.ReplaceError)return e.fail(t.message);throw t}}}]),e}();function ee(e,t,n){for(var r=[],i=0;i<e.childCount;i++){var a=e.child(i);a.content.size&&(a=a.copy(ee(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return _.Fragment.fromArray(r)}var N=function(e){i(n,e);var t=o(n);
13function n(e,r,i){var a;return f(this,n),a=t.call(this),a.from=e,a.to=r,a.mark=i,a}return m(n,[{key:`apply`,value:function(e){var t=this,n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),a=new _.Slice(ee(n.content,function(e,n){return!e.isAtom||!n.type.allowsMarkType(t.mark.type)?e:e.mark(t.mark.addToSet(e.marks))},i),n.openStart,n.openEnd);return M.fromReplace(e,this.from,this.to,a)}},{key:`invert`,value:function(){return new te(this.from,this.to,this.mark)}},{key:`map`,value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}},{key:`merge`,value:function(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}},{key:`toJSON`,value:function(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:`fromJSON`,value:function(e,t){if(typeof t.from!=`number`||typeof t.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new n(t.from,t.to,e.markFromJSON(t.mark))}}]),n}(j);j.jsonID(`addMark`,N);var te=function(e){i(n,e);var t=o(n);function n(e,r,i){var a;return f(this,n),a=t.call(this),a.from=e,a.to=r,a.mark=i,a}return m(n,[{key:`apply`,value:function(e){var t=this,n=e.slice(this.from,this.to),r=new _.Slice(ee(n.content,function(e){return e.mark(t.mark.removeFromSet(e.marks))},e),n.openStart,n.openEnd);return M.fromReplace(e,this.from,this.to,r)}},{key:`invert`,value:function(){return new N(this.from,this.to,this.mark)}},{key:`map`,value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}},{key:`merge`,value:function(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}},{key:`toJSON`,value:function(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:`fromJSON`,value:function(e,t){if(typeof t.from!=`number`||typeof t.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new n(t.from,t.to,e.markFromJSON(t.mark))}}]),n}(j);j.jsonID(`removeMark`,te);var ne=function(e){i(n,e);var t=o(n);function n(e,r){var i;return f(this,n),i=t.call(this),i.pos=e,i.mark=r,i}return m(n,[{key:`apply`,value:function(e){var t=e.nodeAt(this.pos);if(!t)return M.fail(`No node at mark step's position`);var n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return M.fromReplace(e,this.pos,this.pos+1,new _.Slice(_.Fragment.from(n),0,t.isLeaf?0:1))}},{key:`invert`,value:function(e){var t=e.nodeAt(this.pos);if(t){var r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(var i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new n(this.pos,t.marks[i]);return new n(this.pos,this.mark)}}return new re(this.pos,this.mark)}},{key:`map`,value:function(e){var t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.mark)}},{key:`toJSON`,value:function(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}}],[{key:`fromJSON`,value:function(e,t){if(typeof t.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new n(t.pos,e.markFromJSON(t.mark))}}]),n}(j);j.jsonID(`addNodeMark`,ne);var re=function(e){i(n,e);var t=o(n);function n(e,r){var i;return f(this,n),i=t.call(this),i.pos=e,i.mark=r,i}return m(n,[{key:`apply`,value:function(e){var t=e.nodeAt(this.pos);if(!t)return M.fail(`No node at mark step's position`);var n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return M.fromReplace(e,this.pos,this.pos+1,new _.Slice(_.Fragment.from(n),0,t.isLeaf?0:1))}},{key:`invert`,value:function(e){var t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new ne(this.pos,this.mark)}},{key:`map`,value:function(e){var t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.mark)}}
13,{key:`toJSON`,value:function(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}}],[{key:`fromJSON`,value:function(e,t){if(typeof t.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new n(t.pos,e.markFromJSON(t.mark))}}]),n}(j);j.jsonID(`removeNodeMark`,re);var P=function(e){i(n,e);var t=o(n);function n(e,r,i){var a,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return f(this,n),a=t.call(this),a.from=e,a.to=r,a.slice=i,a.structure=o,a}return m(n,[{key:`apply`,value:function(e){return this.structure&&I(e,this.from,this.to)?M.fail(`Structure replace would overwrite content`):M.fromReplace(e,this.from,this.to,this.slice)}},{key:`getMap`,value:function(){return new O([this.from,this.to-this.from,this.slice.size])}},{key:`invert`,value:function(e){return new n(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}},{key:`map`,value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new n(t.pos,Math.max(t.pos,r.pos),this.slice)}},{key:`merge`,value:function(e){if(!(e instanceof n)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){var t=this.slice.size+e.slice.size==0?_.Slice.empty:new _.Slice(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new n(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){var r=this.slice.size+e.slice.size==0?_.Slice.empty:new _.Slice(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new n(e.from,this.to,r,this.structure)}else return null}},{key:`toJSON`,value:function(){var e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}}],[{key:`fromJSON`,value:function(e,t){if(typeof t.from!=`number`||typeof t.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new n(t.from,t.to,_.Slice.fromJSON(e,t.slice),!!t.structure)}}]),n}(j);j.jsonID(`replace`,P);var F=function(e){i(n,e);var t=o(n);function n(e,r,i,a,o,s){var c,l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!1;return f(this,n),c=t.call(this),c.from=e,c.to=r,c.gapFrom=i,c.gapTo=a,c.slice=o,c.insert=s,c.structure=l,c}return m(n,[{key:`apply`,value:function(e){if(this.structure&&(I(e,this.from,this.gapFrom)||I(e,this.gapTo,this.to)))return M.fail(`Structure gap-replace would overwrite content`);var t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return M.fail(`Gap is not a flat range`);var n=this.slice.insertAt(this.insert,t.content);return n?M.fromReplace(e,this.from,this.to,n):M.fail(`Content does not fit in gap`)}},{key:`getMap`,value:function(){return new O([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}}
13,{key:`invert`,value:function(e){var t=this.gapTo-this.gapFrom;return new n(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}},{key:`map`,value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||a>r.pos?null:new n(t.pos,r.pos,i,a,this.slice,this.insert,this.structure)}},{key:`toJSON`,value:function(){var e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}}],[{key:`fromJSON`,value:function(e,t){if(typeof t.from!=`number`||typeof t.to!=`number`||typeof t.gapFrom!=`number`||typeof t.gapTo!=`number`||typeof t.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new n(t.from,t.to,t.gapFrom,t.gapTo,_.Slice.fromJSON(e,t.slice),t.insert,!!t.structure)}}]),n}(j);j.jsonID(`replaceAround`,F);function I(e,t,n){for(var r=e.resolve(t),i=n-t,a=r.depth;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0)for(var o=r.node(a).maybeChild(r.indexAfter(a));i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}return!1}function ie(e,t,n,r){var i=[],a=[],o,s;e.doc.nodesBetween(t,n,function(e,c,l){if(e.isInline){var u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){for(var d=Math.max(c,t),f=Math.min(c+e.nodeSize,n),p=r.addToSet(u),m=0;m<u.length;m++)u[m].isInSet(p)||(o&&o.to==d&&o.mark.eq(u[m])?o.to=f:i.push(o=new te(d,f,u[m])));s&&s.to==d?s.to=f:a.push(s=new N(d,f,r))}}}
13),i.forEach(function(t){return e.step(t)}),a.forEach(function(t){return e.step(t)})}function ae(e,t,n,r){var i=[],a=0;e.doc.nodesBetween(t,n,function(e,o){if(e.isInline){a++;var s=null;if(r instanceof _.MarkType)for(var c=e.marks,l;l=r.isInSet(c);)(s||=[]).push(l),c=l.removeFromSet(c);else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length)for(var u=Math.min(o+e.nodeSize,n),d=0;d<s.length;d++){for(var f=s[d],p=void 0,m=0;m<i.length;m++){var h=i[m];h.step==a-1&&f.eq(i[m].style)&&(p=h)}p?(p.to=u,p.step=a):i.push({style:f,from:Math.max(o,t),to:u,step:a})}}}),i.forEach(function(t){return e.step(new te(t.from,t.to,t.style))})}function oe(e,t,n){for(var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:n.contentMatch,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=e.doc.nodeAt(t),o=[],s=t+1,c=0;c<a.childCount;c++){var l=a.child(c),u=s+l.nodeSize,d=r.matchType(l.type);if(!d)o.push(new P(s,u,_.Slice.empty));else{r=d;for(var f=0;f<l.marks.length;f++)n.allowsMarkType(l.marks[f].type)||e.step(new te(s,u,l.marks[f]));if(i&&l.isText&&n.whitespace!=`pre`)for(var p=void 0,m=/\r?\n|\r/g,h=void 0;p=m.exec(l.text);)h||=new _.Slice(_.Fragment.from(n.schema.text(` `,n.allowedMarks(l.marks))),0,0),o.push(new P(s+p.index,s+p.index+p[0].length,h))}s=u}if(!r.validEnd){var g=r.fillBefore(_.Fragment.empty,!0);e.replace(s,s,new _.Slice(g,0,0))}for(var v=o.length-1;v>=0;v--)e.step(o[v])}function se(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function ce(e){for(var t=e.parent.content.cutByIndex(e.startIndex,e.endIndex),n=e.depth;;--n){var r=e.$from.node(n),i=e.$from.index(n),a=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(i,a,t))return n;if(n==0||r.type.spec.isolating||!se(r,i,a))break}return null}function le(e,t,n){for(var r=t.$from,i=t.$to,a=t.depth,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=_.Fragment.empty,d=0,f=a,p=!1;f>n;f--)p||r.index(f)>0?(p=!0,u=_.Fragment.from(r.node(f).copy(u)),d++):c--;for(var m=_.Fragment.empty,h=0,g=a,v=!1;g>n;g--)v||i.after(g+1)<i.end(g)?(v=!0,m=_.Fragment.from(i.node(g).copy(m)),h++):l++;e.step(new F(c,l,o,s,new _.Slice(u.append(m),d,h),u.size-d,!0))}function ue(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:e,i=L(e,t),a=i&&R(r,t);return a?i.map(de).concat({type:t,attrs:n}).concat(a.map(de)):null}function de(e){return{type:e,attrs:null}}function L(e,t){var n=e.parent,r=e.startIndex,i=e.endIndex,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;var o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function R(e,t){var n=e.parent,r=e.startIndex,i=e.endIndex,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;for(var s=(o.length?o[o.length-1]:t).contentMatch,c=r;s&&c<i;c++)s=s.matchType(n.child(c).type);return!s||!s.validEnd?null:o}function fe(e,t,n){for(var r=_.Fragment.empty,i=n.length-1;i>=0;i--){if(r.size){var a=n[i].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=_.Fragment.from(n[i].type.create(n[i].attrs,r))}var o=t.start,s=t.end;e.step(new F(o,s,o,s,new _.Slice(r,0,0),n.length,!0))}function pe(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);var a=e.steps.length;e.doc.nodesBetween(t,n,function(t,n){var o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&B(e.doc,e.mapping.slice(a).map(n),r)){var s=null;if(r.schema.linebreakReplacement){var c=r.whitespace==`pre`,l=!!r.contentMatch.matchType(r.schema.linebreakReplacement);c&&!l?s=!1:!c&&l&&(s=!0)}s===!1&&me(e,t,n,a),oe(e,e.mapping.slice(a).map(n,1),r,void 0,s===null);var u=e.mapping.slice(a),d=u.map(n,1),f=u.map(n+t.nodeSize,1);return e.step(new F(d,f,d+1,f-1,new _.Slice(_.Fragment.from(r.create(o,null,t.marks)),0,0),1,!0)),s===!0&&z(e,t,n,a),!1}})}function z(e,t,n,r){t.forEach(function(i,a){if(i.isText)for(var o,s=/\r?\n|\r/g;o=s.exec(i.text);){var c=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(c,c+1,t.type.schema.linebreakReplacement.create())}})}function me(e,t,n,r){t.forEach(function(i,a){if(i.type==i.type.schema.linebreakReplacement){var o=e.mapping.slice(r).map(n+1+a);e.replaceWith(o,o+1,t.type.schema.text(`
14`))}})}function B(e,t,n){var r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function he(e,t,n,r,i){var a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);
14n||=a.type;var o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new F(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new _.Slice(_.Fragment.from(o),0,0),1,!0))}function ge(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(var s=i.depth-1,c=n-2;s>a;s--,c--){var l=i.node(s),u=i.index(s);if(l.type.spec.isolating)return!1;var d=l.content.cutByIndex(u,l.childCount),f=r&&r[c+1];f&&(d=d.replaceChild(0,f.type.create(f.attrs)));var p=r&&r[c]||l;if(!l.canReplace(u+1,l.childCount)||!p.type.validContent(d))return!1}var m=i.indexAfter(a),h=r&&r[0];return i.node(a).canReplaceWith(m,m,h?h.type:i.node(a+1).type)}function _e(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,i=e.doc.resolve(t),a=_.Fragment.empty,o=_.Fragment.empty,s=i.depth,c=i.depth-n,l=n-1;s>c;s--,l--){a=_.Fragment.from(i.node(s).copy(a));var u=r&&r[l];o=_.Fragment.from(u?u.type.create(u.attrs,o):i.node(s).copy(o))}e.step(new P(t,t,new _.Slice(a.append(o),n,n),!0))}function ve(e,t){var n=e.resolve(t),r=n.index();return be(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function ye(e,t){t.content.size||e.type.compatibleContent(t.type);for(var n=e.contentMatchAt(e.childCount),r=e.type.schema.linebreakReplacement,i=0;i<t.childCount;i++){var a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function be(e,t){return!!(e&&t&&!e.isLeaf&&ye(e,t))}function xe(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-1,r=e.resolve(t),i=r.depth;;i--){var a=void 0,o=void 0,s=r.index(i);if(i==r.depth?(a=r.nodeBefore,o=r.nodeAfter):n>0?(a=r.node(i+1),s++,o=r.node(i).maybeChild(s)):(a=r.node(i).maybeChild(s-1),o=r.node(i+1)),a&&!a.isTextblock&&be(a,o)&&r.node(i).canReplace(s,s+1))return t;if(i==0)break;t=n<0?r.before(i):r.after(i)}}function Se(e,t,n){var r=null,i=e.doc.type.schema.linebreakReplacement,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){var s=o.whitespace==`pre`,c=!!o.contentMatch.matchType(i);s&&!c?r=!1:!s&&c&&(r=!0)}var l=e.steps.length;if(r===!1){var u=e.doc.resolve(t+n);me(e,u.node(),u.before(),l)}o.inlineContent&&oe(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);var d=e.mapping.slice(l),f=d.map(t-n);if(e.step(new P(f,d.map(t+n,-1),_.Slice.empty,!0)),r===!0){var p=e.doc.resolve(f);z(e,p.node(),p.before(),e.steps.length)}return e}function Ce(e,t,n){var r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(var i=r.depth-1;i>=0;i--){var a=r.index(i);if(r.node(i).canReplaceWith(a,a,n))return r.before(i+1);if(a>0)return null}if(r.parentOffset==r.parent.content.size)for(var o=r.depth-1;o>=0;o--){var s=r.indexAfter(o);if(r.node(o).canReplaceWith(s,s,n))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function we(e,t,n){var r=e.resolve(t);if(!n.content.size)return t;for(var i=n.content,a=0;a<n.openStart;a++)i=i.firstChild.content;for(var o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(var s=r.depth;s>=0;s--){var c=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.
14index(s)+(c>0?1:0),u=r.node(s),d=!1;if(o==1)d=u.canReplace(l,l,i);else{var f=u.contentMatchAt(l).findWrapping(i.firstChild.type);d=f&&u.canReplaceWith(l,l,f[0])}if(d)return c==0?r.pos:c<0?r.before(s+1):r.after(s+1)}return null}function Te(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:_.Slice.empty;if(t==n&&!r.size)return null;var i=e.resolve(t),a=e.resolve(n);return Ee(i,a,r)?new P(t,n,r):new De(i,a,r).fit()}function Ee(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var De=function(){function e(t,n,r){f(this,e),this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=_.Fragment.empty;for(var i=0;i<=t.depth;i++){var a=t.node(i);this.frontier.push({type:a.type,match:a.contentMatchAt(t.indexAfter(i))})}for(var o=t.depth;o>0;o--)this.placed=_.Fragment.from(t.node(o).copy(this.placed))}return m(e,[{key:`depth`,get:function(){return this.frontier.length-1}},{key:`fit`,value:function(){for(;this.unplaced.size;){var e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}var t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;for(var a=this.placed,o=r.depth,s=i.depth;o&&s&&a.childCount==1;)a=a.firstChild.content,o--,s--;var c=new _.Slice(a,o,s);return t>-1?new F(r.pos,t,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new P(r.pos,i.pos,c):null}},{key:`findFittable`,value:function(){for(var e=this.unplaced.openStart,t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){var i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(var a=1;a<=2;a++)for(var o=a==1?e:this.unplaced.openStart;o>=0;o--){var s=void 0,c=null;o?(c=Ae(this.unplaced.content,o-1).firstChild,s=c.content):s=this.unplaced.content;for(var l=s.firstChild,u=this.depth;u>=0;u--){var d=this.frontier[u],f=d.type,p=d.match,m=void 0,h=null;if(a==1&&(l?p.matchType(l.type)||(h=p.fillBefore(_.Fragment.from(l),!1)):c&&f.compatibleContent(c.type)))return{sliceDepth:o,frontierDepth:u,parent:c,inject:h};if(a==2&&l&&(m=p.findWrapping(l.type)))return{sliceDepth:o,frontierDepth:u,parent:c,wrap:m};if(c&&p.matchType(c.type))break}}}},{key:`openMore`,value:function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,i=Ae(t,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new _.Slice(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)}},{key:`dropNode`,value:function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,i=Ae(t,n);if(i.childCount<=1&&n>0){var a=t.size-n<=n+i.size;this.unplaced=new _.Slice(Oe(t,n-1,1),n-1,a?n-1:r)}else this.unplaced=new _.Slice(Oe(t,n,1),n,r)}},{key:`placeNodes`,value:function(e){for(var t=e.sliceDepth,n=e.frontierDepth,r=e.parent,i=e.inject,a=e.wrap;this.depth>n;)this.closeFrontierNode();if(a)for(var o=0;o<a.length;o++)this.openFrontierNode(a[o]);var s=this.unplaced,c=r?r.content:s.content,l=s.openStart-t,u=0,d=[],f=this.frontier[n],p=f.match,m=f.type;if(i){for(var h=0;h<i.childCount;h++)d.push(i.child(h));p=p.matchFragment(i)}for(var g=c.size+t-(s.content.size-s.openEnd);u<c.childCount;){var v=c.child(u),y=p.matchType(v.type);if(!y)break;u++,(u>1||l==0||v.content.size)&&(p=y,d.push(je(v.mark(m.allowedMarks(v.marks)),u==1?l:0,u==c.childCount?g:-1)))}var b=u==c.childCount;b||(g=-1),this.placed=ke(this.placed,n,_.Fragment.from(d)),this.frontier[n].match=p,b&&g<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var x=0,S=c;x<g;x++){var C=S.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),S=C.content}this.unplaced=b?t==0?_.Slice.empty:new _.Slice(Oe(s.content,t-1,1),t-1,g<0?s.openEnd:t-1):new _.Slice(Oe(s.content,t,u),s.openStart,s.openEnd)}},{key:`mustMoveInline`,value:function(){if(!this.$to.parent.isTextblock)return-1;var e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Me(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r}},{key:`findCloseLevel`,value:function(e){scan:for(var t=Math.min(this.depth,e.depth);t>=0;t--){var n=this.frontier[t],r=n.match,i=n.type,a=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=Me(e,t,i,r,a);if(o){for(var s=t-1;s>=0;s--){var c=this.frontier[s],l=c.match,u=c.type,d=Me(e,s,u,l,!0);if(!d||d.childCount)continue scan}return{depth:t,fit:o,move:a?e.doc.resolve(e.after(t+1)):e}}}}},{key:`close`,value:function(e){var t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=ke(this.placed,t.depth,t.fit)),e=t.move;for(var n=t.depth+1;n<=e.depth;n++){var r=e.node(n),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(n));this.openFrontierNode(r.type,r.attrs,i)}return e}},{key:`openFrontierNode`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=ke(this.placed,this.depth,_.Fragment.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}},{key:`closeFrontierNode`,value:function(){var e=this.frontier.pop().match.fillBefore(_.Fragment.empty,!0);e.childCount&&(this.placed=ke(this.placed,this.frontier.length,e))}}]),e}();function Oe(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Oe(e.firstChild.content,t-1,n)))}function ke(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(ke(e.lastChild.content,t-1,n)))}function Ae(e,t){for(var n=0;n<t;n++)e=e.firstChild.content;return e}function je(e,t,n){if(t<=0)return e;var r=e.content;return t>1&&(r=r.replaceChild(0,je(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(_.Fragment.empty,!0)))),e.copy(r)}
14function Me(e,t,n,r,i){var a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;var s=r.fillBefore(a.content,!0,o);return s&&!Ne(n,a.content,o)?s:null}function Ne(e,t,n){for(var r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function Pe(e){return e.spec.defining||e.spec.definingForContent}function Fe(e,t,n,r){if(!r.size)return e.deleteRange(t,n);var i=e.doc.resolve(t),a=e.doc.resolve(n);if(Ee(i,a,r))return e.step(new P(t,n,r));var o=ze(i,e.doc.resolve(n));o[o.length-1]==0&&o.pop();var s=-(i.depth+1);o.unshift(s);for(var c=i.depth,l=i.pos-1;c>0;c--,l--){var u=i.node(c).type.spec;if(u.defining||u.definingAsContext||u.isolating)break;o.indexOf(c)>-1?s=c:i.before(c)==l&&o.splice(1,0,-c)}for(var d=o.indexOf(s),f=[],p=r.openStart,m=r.content,h=0;;h++){var g=m.firstChild;if(f.push(g),h==r.openStart)break;m=g.content}for(var v=p-1;v>=0;v--){var y=f[v],b=Pe(y.type);if(b&&!y.sameMarkup(i.node(Math.abs(s)-1)))p=v;else if(b||!y.type.isTextblock)break}for(var x=r.openStart;x>=0;x--){var S=(x+p+1)%(r.openStart+1),C=f[S];if(C)for(var w=0;w<o.length;w++){var T=o[(w+d)%o.length],E=!0;T<0&&(E=!1,T=-T);var D=i.node(T-1),O=i.index(T-1);if(D.canReplaceWith(O,O,C.type,C.marks))return e.replace(i.before(T),E?a.after(T):n,new _.Slice(Ie(r.content,0,r.openStart,S),S,r.openEnd))}}for(var k=e.steps.length,A=o.length-1;A>=0&&(e.replace(t,n,r),!(e.steps.length>k));A--){var j=o[A];j<0||(t=i.before(j),n=a.after(j))}}function Ie(e,t,n,r,i){if(t<n){var a=e.firstChild;e=e.replaceChild(0,a.copy(Ie(a.content,t+1,n,r,a)))}if(t>r){var o=i.contentMatchAt(0),s=o.fillBefore(e).append(e);e=s.append(o.matchFragment(s).fillBefore(_.Fragment.empty,!0))}return e}function Le(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){var i=Ce(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new _.Slice(_.Fragment.from(r),0,0))}function Re(e,t,n){for(var r=e.doc.resolve(t),i=e.doc.resolve(n),a=ze(r,i),o=0;o<a.length;o++){var s=a[o],c=o==a.length-1;if(c&&s==0||r.node(s).type.contentMatch.validEnd)return e.delete(r.start(s),i.end(s));if(s>0&&(c||r.node(s-1).canReplace(r.index(s-1),i.indexAfter(s-1))))return e.delete(r.before(s),i.after(s))}for(var l=1;l<=r.depth&&l<=i.depth;l++)if(t-r.start(l)==r.depth-l&&n>r.end(l)&&i.end(l)-n!=i.depth-l&&r.start(l-1)==i.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),i.index(l-1)))return e.delete(r.before(l),n);e.delete(t,n)}function ze(e,t){for(var n=[],r=Math.min(e.depth,t.depth);r>=0;r--){var i=e.start(r);if(i<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;(i==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==i-1)&&n.push(r)}return n}var Be=function(e){i(n,e);var t=o(n);function n(e,r,i){var a;return f(this,n),a=t.call(this),a.pos=e,a.attr=r,a.value=i,a}return m(n,[{key:`apply`,value:function(e){var t=e.nodeAt(this.pos);if(!t)return M.fail(`No node at attribute step's position`);var n=Object.create(null);for(var r in t.attrs)n[r]=t.attrs[r];n[this.attr]=this.value;var i=t.type.create(n,null,t.marks);return M.fromReplace(e,this.pos,this.pos+1,new _.Slice(_.Fragment.from(i),0,t.isLeaf?0:1))}},{key:`getMap`,value:function(){return O.empty}}
14,{key:`invert`,value:function(e){return new n(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}},{key:`map`,value:function(e){var t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.attr,this.value)}},{key:`toJSON`,value:function(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}}],[{key:`fromJSON`,value:function(e,t){if(typeof t.pos!=`number`||typeof t.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new n(t.pos,t.attr,t.value)}}]),n}(j);j.jsonID(`attr`,Be);var Ve=function(e){i(n,e);var t=o(n);function n(e,r){var i;return f(this,n),i=t.call(this),i.attr=e,i.value=r,i}return m(n,[{key:`apply`,value:function(e){var t=Object.create(null);for(var n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;var r=e.type.create(t,e.content,e.marks);return M.ok(r)}},{key:`getMap`,value:function(){return O.empty}},{key:`invert`,value:function(e){return new n(this.attr,e.attrs[this.attr])}},{key:`map`,value:function(e){return this}},{key:`toJSON`,value:function(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}}],[{key:`fromJSON`,value:function(e,t){if(typeof t.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new n(t.attr,t.value)}}]),n}(j);j.jsonID(`docAttr`,Ve),e.TransformError=function(e){i(n,e);var t=o(n);function n(){return f(this,n),t.apply(this,arguments)}return m(n)}(t(Error)),e.TransformError=function e(t){var n=Error.call(this,t);return n.__proto__=e.prototype,n},e.TransformError.prototype=Object.create(Error.prototype),e.TransformError.prototype.constructor=e.TransformError,e.TransformError.prototype.name=`TransformError`;var He=function(){function t(e){f(this,t),this.doc=e,this.steps=[],this.docs=[],this.mapping=new k}return m(t,[{key:`before`,get:function(){return this.docs.length?this.docs[0]:this.doc}},{key:`step`,value:function(t){var n=this.maybeStep(t);if(n.failed)throw new e.TransformError(n.failed);return this}},{key:`maybeStep`,value:function(e){var t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}},{key:`docChanged`,get:function(){return this.steps.length>0}},{key:`addStep`,value:function(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}},{key:`replace`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_.Slice.empty,r=Te(this.doc,e,t,n);return r&&this.step(r),this}},{key:`replaceWith`,value:function(e,t,n){return this.replace(e,t,new _.Slice(_.Fragment.from(n),0,0))}},{key:`delete`,value:function(e,t){return this.replace(e,t,_.Slice.empty)}},{key:`insert`,value:function(e,t){return this.replaceWith(e,e,t)}},{key:`replaceRange`,value:function(e,t,n){return Fe(this,e,t,n),this}},{key:`replaceRangeWith`,value:function(e,t,n){return Le(this,e,t,n),this}},{key:`deleteRange`,value:function(e,t){return Re(this,e,t),this}},{key:`lift`,value:function(e,t){return le(this,e,t),this}},{key:`join`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Se(this,e,t),this}},{key:`wrap`,value:function(e,t){return fe(this,e,t),this}},{key:`setBlockType`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return pe(this,e,t,n,r),this}},{key:`setNodeMarkup`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,r=arguments.length>3?arguments[3]:void 0;return he(this,e,t,n,r),this}},{key:`setNodeAttribute`,value:function(e,t,n){return this.step(new Be(e,t,n)),this}},{key:`setDocAttribute`,value:function(e,t){return this.step(new Ve(e,t)),this}},{key:`addNodeMark`,value:function(e,t){return this.step(new ne(e,t)),this}},{key:`removeNodeMark`,value:function(e,t){if(!(t instanceof _.Mark)){var n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t=t.isInSet(n.marks),!t)return this}return this.step(new re(e,t)),this}},{key:`split`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=arguments.length>2?arguments[2]:void 0;return _e(this,e,t,n),this}},{key:`addMark`,value:function(e,t,n){return ie(this,e,t,n),this}},{key:`removeMark`,value:function(e,t,n){return ae(this,e,t,n),this}},{key:`clearIncompatible`,value:function(e,t,n){return oe(this,e,t,n),this}}]),t}();e.AddMarkStep=N,e.AddNodeMarkStep=ne,e.AttrStep=Be,e.DocAttrStep=Ve,e.MapResult=D,e.Mapping=k,e.RemoveMarkStep=te,e.RemoveNodeMar
14kStep=re,e.ReplaceAroundStep=F,e.ReplaceStep=P,e.Step=j,e.StepMap=O,e.StepResult=M,e.Transform=He,e.canJoin=ve,e.canSplit=ge,e.dropPoint=we,e.findWrapping=ue,e.insertPoint=Ce,e.joinPoint=xe,e.liftTarget=ce,e.replaceStep=Te})),Fo=e((e=>{function t(e){"@babel/helpers - typeof";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}function n(){return n=typeof Reflect<`u`&&Reflect.get?Reflect.get:function(e,t,n){var i=r(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(arguments.length<3?e:n):a.value}},n.apply(this,arguments)}function r(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=u(e),e!==null););return e}function i(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&a(e,t)}function a(e,t){return a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},a(e,t)}function o(e){var t=l();return function(){var n=u(e),r;if(t){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return s(this,r)}}function s(e,n){if(n&&(t(n)===`object`||typeof n==`function`))return n;if(n!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return c(e)}function c(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function l(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function d(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}Object.defineProperty(e,`__esModule`,{value:!0});var m=No(),h=Po(),g=Object.create(null),_=function(){function e(t,n,r){d(this,e),this.$anchor=t,this.$head=n,this.ranges=r||[new v(t.min(n),t.max(n))]}return p(e,[{key:`anchor`,get:function(){return this.$anchor.pos}},{key:`head`,get:function(){return this.$head.pos}},{key:`from`,get:function(){return this.$from.pos}},{key:`to`,get:function(){return this.$to.pos}},{key:`$from`,get:function(){return this.ranges[0].$from}},{key:`$to`,get:function(){return this.ranges[0].$to}},{key:`empty`,get:function(){for(var e=this.ranges,t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}},{key:`content`,value:function(){return this.$from.doc.slice(this.from,this.to,!0)}},{key:`replace`,value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m.Slice.empty,n=t.content.lastChild,r=null,i=0;i<t.openEnd;i++)r=n,n=n.lastChild;for(var a=e.steps.length,o=this.ranges,s=0;s<o.length;s++){var c=o[s],l=c.$from,u=c.$to,d=e.mapping.slice(a);e.replaceRange(d.map(l.pos),d.map(u.pos),s?m.Slice.empty:t),s==0&&O(e,a,(n?n.isInline:r&&r.isTextblock)?-1:1)}}},{key:`replaceWith`,value:function(e,t){for(var n=e.steps.length,r=this.ranges,i=0;i<r.length;i++){var a=r[i],o=a.$from,s=a.$to,c=e.mapping.slice(n),l=c.map(o.pos),u=c.map(s.pos);i?e.deleteRange(l,u):(e.replaceRangeWith(l,u,t),O(e,n,t.isInline?-1:1))}}},{key:`getBookmark`,value:function(){return x.between(this.$anchor,this.$head).getBookmark()}}],[{key:`findFrom`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=e.parent.inlineContent?new x(e):D(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(var i=e.depth-1;i>=0;i--){var a=t<0?D(e.node(0),e.node(i),e.before(i+1),e.index(i),t,n):D(e.n
14ode(0),e.node(i),e.after(i+1),e.index(i)+1,t,n);if(a)return a}return null}},{key:`near`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return this.findFrom(e,t)||this.findFrom(e,-t)||new T(e.node(0))}},{key:`atStart`,value:function(e){return D(e,e,0,0,1)||new T(e)}},{key:`atEnd`,value:function(e){return D(e,e,e.content.size,e.childCount,-1)||new T(e)}},{key:`fromJSON`,value:function(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);var n=g[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}},{key:`jsonID`,value:function(e,t){if(e in g)throw RangeError(`Duplicate use of selection JSON ID `+e);return g[e]=t,t.prototype.jsonID=e,t}}]),e}();_.prototype.visible=!0;var v=p(function e(t,n){d(this,e),this.$from=t,this.$to=n}),y=!1;function b(e){!y&&!e.parent.inlineContent&&(y=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var x=function(e){i(r,e);var t=o(r);function r(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e;return d(this,r),b(e),b(n),t.call(this,e,n)}return p(r,[{key:`$cursor`,get:function(){return this.$anchor.pos==this.$head.pos?this.$head:null}},{key:`map`,value:function(e,t){var n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return _.near(n);var i=e.resolve(t.map(this.anchor));return new r(i.parent.inlineContent?i:n,n)}},{key:`replace`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m.Slice.empty;if(n(u(r.prototype),`replace`,this).call(this,e,t),t==m.Slice.empty){var i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}},{key:`eq`,value:function(e){return e instanceof r&&e.anchor==this.anchor&&e.head==this.head}},{key:`getBookmark`,value:function(){return new S(this.anchor,this.head)}},{key:`toJSON`,value:function(){return{type:`text`,anchor:this.anchor,head:this.head}}}],[{key:`fromJSON`,value:function(e,t){if(typeof t.anchor!=`number`||typeof t.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new r(e.resolve(t.anchor),e.resolve(t.head))}},{key:`create`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t,r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}},{key:`between`,value:function(e,t,n){var i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){var a=_.findFrom(t,n,!0)||_.findFrom(t,-n,!0);if(a)t=a.$head;else return _.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(_.findFrom(e,-n,!0)||_.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new r(e,t)}}]),r}(_);_.jsonID(`text`,x);var S=function(){function e(t,n){d(this,e),this.anchor=t,this.head=n}return p(e,[{key:`map`,value:function(t){return new e(t.map(this.anchor),t.map(this.head))}},{key:`resolve`,value:function(e){return x.between(e.resolve(this.anchor),e.resolve(this.head))}}]),e}(),C=function(e){i(n,e);var t=o(n);function n(e){var r;d(this,n);var i=e.nodeAfter,a=e.node(0).resolve(e.pos+i.nodeSize);return r=t.call(this,e,a),r.node=i,r}return p(n,[{key:`map`,value:function(e,t){var r=t.mapResult(this.anchor),i=r.deleted,a=r.pos,o=e.resolve(a);return i?_.near(o):new n(o)}},{key:`content`,value:function(){return new m.Slice(m.Fragment.from(this.node),0,0)}},{key:`eq`,value:function(e){return e instanceof n&&e.anchor==this.anchor}},{key:`toJSON`,value:function(){return{type:`node`,anchor:this.anchor}}},{key:`getBookmark`,value:function(){return new w(this.anchor)}}],[{key:`fromJSON`,value:function(e,t){if(typeof t.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new n(e.resolve(t.anchor))}},{key:`create`,value:function(e,t){return new n(e.resolve(t))}}
14,{key:`isSelectable`,value:function(e){return!e.isText&&e.type.spec.selectable!==!1}}]),n}(_);C.prototype.visible=!1,_.jsonID(`node`,C);var w=function(){function e(t){d(this,e),this.anchor=t}return p(e,[{key:`map`,value:function(t){var n=t.mapResult(this.anchor),r=n.deleted,i=n.pos;return r?new S(i,i):new e(i)}},{key:`resolve`,value:function(e){var t=e.resolve(this.anchor),n=t.nodeAfter;return n&&C.isSelectable(n)?new C(t):_.near(t)}}]),e}(),T=function(e){i(r,e);var t=o(r);function r(e){return d(this,r),t.call(this,e.resolve(0),e.resolve(e.content.size))}return p(r,[{key:`replace`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m.Slice.empty;if(t==m.Slice.empty){e.delete(0,e.doc.content.size);var i=_.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else n(u(r.prototype),`replace`,this).call(this,e,t)}},{key:`toJSON`,value:function(){return{type:`all`}}},{key:`map`,value:function(e){return new r(e)}},{key:`eq`,value:function(e){return e instanceof r}},{key:`getBookmark`,value:function(){return E}}],[{key:`fromJSON`,value:function(e){return new r(e)}}]),r}(_);_.jsonID(`all`,T);var E={map:function(){return this},resolve:function(e){return new T(e)}};function D(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1;if(t.inlineContent)return x.create(e,n);for(var o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){var s=t.child(o);if(!s.isAtom){var c=D(e,s,n+i,i<0?s.childCount:0,i,a);if(c)return c}else if(!a&&C.isSelectable(s))return C.create(e,n-(i<0?s.nodeSize:0));n+=s.nodeSize*i}return null}function O(e,t,n){var r=e.steps.length-1;if(!(r<t)){var i=e.steps[r];if(i instanceof h.ReplaceStep||i instanceof h.ReplaceAroundStep){var a=e.mapping.maps[r],o;a.forEach(function(e,t,n,r){o??=r}),e.setSelection(_.near(e.doc.resolve(o),n))}}}var k=1,A=2,j=4,M=function(e){i(r,e);var t=o(r);function r(e){var n;return d(this,r),n=t.call(this,e.doc),n.curSelectionFor=0,n.updated=0,n.meta=Object.create(null),n.time=Date.now(),n.curSelection=e.selection,n.storedMarks=e.storedMarks,n}return p(r,[{key:`selection`,get:function(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}},{key:`setSelection`,value:function(e){if(e.$from.doc!=this.doc)throw RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|k)&~A,this.storedMarks=null,this}},{key:`selectionSet`,get:function(){return(this.updated&k)>0}},{key:`setStoredMarks`,value:function(e){return this.storedMarks=e,this.updated|=A,this}},{key:`ensureMarks`,value:function(e){return m.Mark.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}},{key:`addStoredMark`,value:function(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}},{key:`removeStoredMark`,value:function(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}},{key:`storedMarksSet`,get:function(){return(this.updated&A)>0}},{key:`addStep`,value:function(e,t){n(u(r.prototype),`addStep`,this).call(this,e,t),this.updated&=~A,this.storedMarks=null}},{key:`setTime`,value:function(e){return this.time=e,this}},{key:`replaceSelection`,value:function(e){return this.selection.replace(this,e),this}},{key:`replaceSelectionWith`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||m.Mark.none))),n.replaceWith(this,e),this}},{key:`deleteSelection`,value:function(){return this.selection.replace(this),this}},{key:`insertText`,value:function(e,t,n){var r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();if(n??=t,n??=t,!e)return this.deleteRange(t,n);var i=this.storedMarks;if(!i){var a=this.doc.resolve(t);i=n==t?a.marks():a.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.setSelection(_.near(this.selection.$to)),this}},{key:`setMeta`,value:function(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}},{key:`getMeta`,value:function(e){return this.meta[typeof e==`string`?e:e.key]}}
14,{key:`isGeneric`,get:function(){for(var e in this.meta)return!1;return!0}},{key:`scrollIntoView`,value:function(){return this.updated|=j,this}},{key:`scrolledIntoView`,get:function(){return(this.updated&j)>0}}]),r}(h.Transform);function ee(e,t){return!t||!e?e:e.bind(t)}var N=p(function e(t,n,r){d(this,e),this.name=t,this.init=ee(n.init,r),this.apply=ee(n.apply,r)}),te=[new N(`doc`,{init:function(e){return e.doc||e.schema.topNodeType.createAndFill()},apply:function(e){return e.doc}}),new N(`selection`,{init:function(e,t){return e.selection||_.atStart(t.doc)},apply:function(e){return e.selection}}),new N(`storedMarks`,{init:function(e){return e.storedMarks||null},apply:function(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new N(`scrollToSelection`,{init:function(){return 0},apply:function(e,t){return e.scrolledIntoView?t+1:t}})],ne=p(function e(t,n){var r=this;d(this,e),this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=te.slice(),n&&n.forEach(function(e){if(r.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);r.plugins.push(e),r.pluginsByKey[e.key]=e,e.spec.state&&r.fields.push(new N(e.key,e.spec.state,e))})}),re=function(){function e(t){d(this,e),this.config=t}return p(e,[{key:`schema`,get:function(){return this.config.schema}},{key:`plugins`,get:function(){return this.config.plugins}},{key:`apply`,value:function(e){return this.applyTransaction(e).state}},{key:`filterTransaction`,value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,n=0;n<this.config.plugins.length;n++)if(n!=t){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}},{key:`applyTransaction`,value:function(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};for(var t=[e],n=this.applyInner(e),r=null;;){for(var i=!1,a=0;a<this.config.plugins.length;a++){var o=this.config.plugins[a];if(o.spec.appendTransaction){var s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(var u=0;u<this.config.plugins.length;u++)r.push(u<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}},{key:`applyInner`,value:function(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);for(var n=new e(this.config),r=this.config.fields,i=0;i<r.length;i++){var a=r[i];n[a.name]=a.apply(t,this[a.name],this,n)}return n}},{key:`tr`,get:function(){return new M(this)}},{key:`reconfigure`,value:function(t){for(var n=new ne(this.schema,t.plugins),r=n.fields,i=new e(n),a=0;a<r.length;a++){var o=r[a].name;i[o]=this.hasOwnProperty(o)?this[o]:r[a].init(t,i)}return i}},{key:`toJSON`,value:function(e){var n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(function(e){return e.toJSON()})),e&&t(e)==`object`)for(var r in e){if(r==`doc`||r==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");var i=e[r],a=i.spec.state;a&&a.toJSON&&(n[r]=a.toJSON.call(i,this[i.key]))}return n}}],[{key:`create`,value:function(t){for(var n=new ne(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n),i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(t,r);return r}},{key:`fromJSON`,value:function(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);var i=new ne(t.schema,t.plugins),a=new e(i);return i.fields.forEach(function(e){if(e.name==`doc`)a.doc=m.Node.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=_.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(var i in r){var o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}}]),e}();function P(e,t,n){for(var r in e){var i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=P(i,t,{})),n[r]=i}return n}var F=function(){function e(t){d(this,e),this.spec=t,this.props={},t.props&&P(t.props,this,this.props),this.key=t.key?t.key.key:ie(`plugin`)}return p(e,[{key:`getState`,value:function(e){return e[this.key]}}]),e}(),I=Object.create(null);function ie(e){return e in I?e+`$`+ ++I[e]:(I[e]=0,e+`$`)}var ae=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`key`;d(this,e),this.key=ie(t)}return p(e,[{key:`get`,value:function(e){return e.config.pluginsByKey[this.key]}},{key:`getState`,value:function(e){return e[this.key]}}]),e}();e.AllSelection=T,e.EditorState=re,e.NodeSelection=C,e.Plugin=F,e.PluginKey=ae,e.Selection=_,e.SelectionRange=v,e.TextSelection=x,e.Transaction=M})),Io=e((e=>{function t(e,t){return i(e)||r(e,t)||o(e,t)||n()}
14function n(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
15In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function r(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function i(e){if(Array.isArray(e))return e}function a(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=o(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
16In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,s=!1,c;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,c=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(s)throw c}}}}function o(e,t){if(e){if(typeof e==`string`)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}}function s(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(){return c=typeof Reflect<`u`&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=l(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},c.apply(this,arguments)}function l(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=g(e),e!==null););return e}function u(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&d(e,t)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}function f(e){var t=h();return function(){var n=g(e),r;if(t){var i=g(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return p(this,r)}}function p(e,t){if(t&&(_(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return m(e)}function m(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function h(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}function _(e){"@babel/helpers - typeof";return _=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},_(e)}function v(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,x(r.key),r)}}function b(e,t,n){return t&&y(e.prototype,t),n&&y(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function x(e){var t=S(e,`string`);return _(t)===`symbol`?t:String(t)}function S(e,t){if(_(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(_(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var C=Fo(),w=No(),T=Po(),E=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},D=function(e){var t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},O=null,k=function(e,t,n){var r=O||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},A=function(){O=null},j=function(e,t,n,r){return n&&(ee(e,t,n,r,-1)||ee(e,t,n,r,1))},M=/^(img|br|input|textarea|hr)$/i;function ee(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;
vendor: 4,561 bytes, line 16
16if(t==(i<0?0:N(e))){var a=e.parentNode;if(!a||a.nodeType!=1||P(e)||M.test(e.nodeName)||e.contentEditable==`false`)return!1;t=E(e)+(i<0?0:1),e=a}else if(e.nodeType==1){if(e=e.childNodes[t+(i<0?-1:0)],e.contentEditable==`false`)return!1;t=i<0?N(e):0}else return!1}}function N(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function te(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=N(e)}else if(e.parentNode&&!P(e))t=E(e),e=e.parentNode;else return null}}function ne(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!P(e))t=E(e)+1,e=e.parentNode;else return null}}function re(e,t,n){for(var r=t==0,i=t==N(e);r||i;){if(e==n)return!0;var a=E(e);if(e=e.parentNode,!e)return!1;r&&=a==0,i&&=a==N(e)}}function P(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var F=function(e){return e.focusNode&&j(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function I(e,t){var n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function ie(e){for(var t=e.activeElement;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function ae(e,t,n){if(e.caretPositionFromPoint)try{var r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(N(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){var i=e.caretRangeFromPoint(t,n);if(i)return{node:i.startContainer,offset:Math.min(N(i.startContainer),i.startOffset)}}}var oe=typeof navigator<`u`?navigator:null,se=typeof document<`u`?document:null,ce=oe&&oe.userAgent||``,le=/Edge\/(\d+)/.exec(ce),ue=/MSIE \d/.exec(ce),de=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ce),L=!!(ue||de||le),R=ue?document.documentMode:de?+de[1]:le?+le[1]:0,fe=!L&&/gecko\/(\d+)/i.test(ce);fe&&+(/Firefox\/(\d+)/.exec(ce)||[0,0])[1];var pe=!L&&/Chrome\/(\d+)/.exec(ce),z=!!pe,me=pe?+pe[1]:0,B=!L&&!!oe&&/Apple Computer/.test(oe.vendor),he=B&&(/Mobile\/\w+/.test(ce)||!!oe&&oe.maxTouchPoints>2),ge=he||(oe?/Mac/.test(oe.platform):!1),_e=oe?/Win/.test(oe.platform):!1,ve=/Android \d/.test(ce),ye=!!se&&`webkitFontSmoothing`in se.documentElement.style,be=ye?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function xe(e){var t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Se(e,t){return typeof e==`number`?e:e[t]}function Ce(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function we(e,t,n){for(var r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument,o=n||e.dom;o;o=D(o))if(o.nodeType==1){var s=o,c=s==a.body,l=c?xe(a):Ce(s),u=0,d=0;if(t.top<l.top+Se(r,`top`)?d=-(l.top-t.top+Se(i,`top`)):t.bottom>l.bottom-Se(r,`bottom`)&&(d=t.bottom-t.top>l.bottom-l.top?t.top+Se(i,`top`)-l.top:t.bottom-l.bottom+Se(i,`bottom`)),t.left<l.left+Se(r,`left`)?u=-(l.left-t.left+Se(i,`left`)):t.right>l.right-Se(r,`right`)&&(u=t.right-l.right+Se(i,`right`)),u||d)if(c)a.defaultView.scrollBy(u,d);else{var f=s.scrollLeft,p=s.scrollTop;d&&(s.scrollTop+=d),u&&(s.scrollLeft+=u);var m=s.scrollLeft-f,h=s.scrollTop-p;t={left:t.left-m,top:t.top-h,right:t.right-m,bottom:t.bottom-h}}if(c||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function Te(e){for(var t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i,a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){var s=e.root.elementFromPoint(a,o);if(!(!s||s==e.dom||!e.dom.contains(s))){var c=s.getBoundingClientRect();if(c.top>=n-20){r=s,i=c.top;break}}}return{refDOM:r,refTop:i,stack:Ee(e.dom)}}function Ee(e){for(var t=[],n=e.ownerDocument,r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=D(r));return t}function De(e){var t=e.refDOM,n=e.refTop,r=e.stack,i=t?t.getBoundingClientRect().top:0;Oe(r,i==0?0:i-n)}function Oe(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=r.dom,a=r.top,o=r.left;i.scrollTop!=a+t&&(i.scrollTop=a+t),i.scrollLeft!=o&&(i.scrollLeft=o)}}var ke=null;function Ae(e){if(e.setActive)return e.setActive();if(ke)return e.focus(ke);var t=Ee(e);e.focus(ke==null?{get preventScroll(){return ke={preventScroll:!0},!0}}:void 0),ke||(ke=!1,Oe(t,0))}
vendor: 4,672 bytes, line 16
16function je(e,t){for(var n,r=2e8,i,a=0,o=t.top,s=t.top,c,l,u=e.firstChild,d=0;u;u=u.nextSibling,d++){var f=void 0;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=k(u).getClientRects();else continue;for(var p=0;p<f.length;p++){var m=f[p];if(m.top<=o&&m.bottom>=s){o=Math.max(m.bottom,o),s=Math.min(m.top,s);var h=m.left>t.left?m.left-t.left:m.right<t.left?t.left-m.right:0;if(h<r){n=u,r=h,i=h&&n.nodeType==3?{left:m.right<t.left?m.right:m.left,top:t.top}:t,u.nodeType==1&&h&&(a=d+(t.left>=(m.left+m.right)/2?1:0));continue}}else m.top>t.top&&!c&&m.left<=t.left&&m.right>=t.left&&(c=u,l={left:Math.max(m.left,Math.min(m.right,t.left)),top:m.top});!n&&(t.left>=m.right&&t.top>=m.top||t.left>=m.left&&t.top>=m.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?Me(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:je(n,i)}function Me(e,t){for(var n=e.nodeValue.length,r=document.createRange(),i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);var a=Be(r,1);if(a.top!=a.bottom&&Ne(t,a))return{node:e,offset:i+(t.left>=(a.left+a.right)/2?1:0)}}return{node:e,offset:0}}function Ne(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Pe(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Fe(e,t,n){var r=je(t,n),i=r.node,a=r.offset,o=-1;if(i.nodeType==1&&!i.firstChild){var s=i.getBoundingClientRect();o=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(i,a,o)}function Ie(e,t,n,r){for(var i=-1,a=t,o=!1;a!=e.dom;){var s=e.docView.nearestDesc(a,!0),c=void 0;if(!s)return null;if(s.dom.nodeType==1&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((c=s.dom.getBoundingClientRect()).width||c.height)&&(s.node.isBlock&&s.parent&&(!o&&c.left>r.left||c.top>r.top?i=s.posBefore:(!o&&c.right<r.left||c.bottom<r.top)&&(i=s.posAfter),o=!0),!s.contentDOM&&i<0&&!s.node.isText))return(s.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?s.posBefore:s.posAfter;a=s.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function Le(e,t,n){var r=e.childNodes.length;if(r&&n.top<n.bottom)for(var i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){var o=e.childNodes[a];if(o.nodeType==1)for(var s=o.getClientRects(),c=0;c<s.length;c++){var l=s[c];if(Ne(t,l))return Le(o,t,l)}if((a=(a+1)%r)==i)break}return e}function Re(e,t){var n=e.dom.ownerDocument,r,i=0,a=ae(n,t.left,t.top);a&&(r=a.node,i=a.offset);var o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){var c=e.dom.getBoundingClientRect();if(!Ne(t,c)||(o=Le(e.dom,t,c),!o))return null}if(B)for(var l=o;r&&l;l=D(l))l.draggable&&(r=void 0);if(o=Pe(o,t),r){if(fe&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){var u=r.childNodes[i],d;u.nodeName==`IMG`&&(d=u.getBoundingClientRect()).right<=t.left&&d.bottom>t.top&&i++}var f;ye&&i&&r.nodeType==1&&(f=r.childNodes[i-1]).nodeType==1&&f.contentEditable==`false`&&f.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=Ie(e,r,i,t))}s??=Fe(e,o,t);var p=e.docView.nearestDesc(o,!0);return{pos:s,inside:p?p.posAtStart-p.border:-1}}function ze(e){return e.top<e.bottom||e.left<e.right}function Be(e,t){var n=e.getClientRects();if(n.length){var r=n[t<0?0:n.length-1];if(ze(r))return r}return Array.prototype.find.call(n,ze)||e.getBoundingClientRect()}var Ve=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function He(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),i=r.node,a=r.offset,o=r.atom,s=ye||fe;if(i.nodeType==3)if(s&&(Ve.test(i.nodeValue)||(n<0?!a:a==i.nodeValue.length))){var c=Be(k(i,a,a),n);if(fe&&a&&/\s/.test(i.nodeValue[a-1])&&a<i.nodeValue.length){var l=Be(k(i,a-1,a-1),-1);if(l.top==c.top){var u=Be(k(i,a,a+1),-1);if(u.top!=c.top)return Ue(u,u.left<l.left)}}return c}else{var d=a,f=a,p=n<0?1:-1;return n<0&&!a?(f++,p=-1):n>=0&&a==i.nodeValue.length?(d--,p=1):n<0?d--:f++,Ue(Be(k(i,d,f),p),p<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&a&&(n<0||a==N(i))){var m=i.childNodes[a-1];if(m.nodeType==1)return We(m.getBoundingClientRect(),!1)}if(o==null&&a<N(i)){var h=i.childNodes[a];if(h.nodeType==1)return We(h.getBoundingClientRect(),!0)}return We(i.getBoundingClientRect(),n>=0)}if(o==null&&a&&(n<0||a==N(i))){var g=i.childNodes[a-1],_=g.nodeType==3?k(g,N(g)-(s?0:1)):g.nodeType==1&&(g.nodeName!=`BR`||!g.nextSibling)?g:null;if(_)return Ue(Be(_,1),!1)}if(o==null&&a<N(i)){for(var v=i.childNodes[a];
16v.pmViewDesc&&v.pmViewDesc.ignoreForCoords;)v=v.nextSibling;var y=v?v.nodeType==3?k(v,0,s?0:1):v.nodeType==1?v:null:null;if(y)return Ue(Be(y,-1),!0)}return Ue(Be(i.nodeType==3?k(i):i,-n),n>=0)}function Ue(e,t){if(e.width==0)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function We(e,t){if(e.height==0)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Ge(e,t,n){var r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function Ke(e,t,n){var r=t.selection,i=n==`up`?r.$from:r.$to;return Ge(e,t,function(){for(var t=e.docView.domFromPos(i.pos,n==`up`?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.contentDOM||r.dom;break}t=r.dom.parentNode}for(var a=He(e,i.pos,1),o=t.firstChild;o;o=o.nextSibling){var s=void 0;if(o.nodeType==1)s=o.getClientRects();else if(o.nodeType==3)s=k(o,0,o.nodeValue.length).getClientRects();else continue;for(var c=0;c<s.length;c++){var l=s[c];if(l.bottom>l.top+1&&(n==`up`?a.top-l.top>(l.bottom-a.top)*2:l.bottom-a.bottom>(a.bottom-l.top)*2))return!1}}return!0})}var qe=/[\u0590-\u08ac]/;function Je(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!qe.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Ge(e,t,function(){var t=e.domSelectionRange(),i=t.focusNode,a=t.focusOffset,o=t.anchorNode,c=t.anchorOffset,l=s.caretBidiLevel;s.modify(`move`,n,`character`);var u=r.depth?e.docView.domAfterPos(r.before()):e.dom,d=e.domSelectionRange(),f=d.focusNode,p=d.focusOffset,m=f&&!u.contains(f.nodeType==1?f:f.parentNode)||i==f&&a==p;try{s.collapse(o,c),i&&(i!=o||a!=c)&&s.extend&&s.extend(i,a)}catch{}return l!=null&&(s.caretBidiLevel=l),m}):r.pos==r.start()||r.pos==r.end()}var Ye=null,Xe=null,V=!1;function H(e,t,n){return Ye==t&&Xe==n?V:(Ye=t,Xe=n,V=n==`up`||n==`down`?Ke(e,t,n):Je(e,t,n))}var U=0,Ze=1,Qe=2,$e=3,et=function(){function e(t,n,r,i){v(this,e),this.parent=t,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=U,r.pmViewDesc=this}return b(e,[{key:`matchesWidget`,value:function(e){return!1}},{key:`matchesMark`,value:function(e){return!1}},{key:`matchesNode`,value:function(e,t,n){return!1}},{key:`matchesHack`,value:function(e){return!1}},{key:`parseRule`,value:function(){return null}},{key:`stopEvent`,value:function(e){return!1}},{key:`size`,get:function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e}},{key:`border`,get:function(){return 0}},{key:`destroy`,value:function(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(var e=0;e<this.children.length;e++)this.children[e].destroy()}},{key:`posBeforeChild`,value:function(e){for(var t=0,n=this.posAtStart;;t++){var r=this.children[t];if(r==e)return n;n+=r.size}}},{key:`posBefore`,get:function(){return this.parent.posBeforeChild(this)}},{key:`posAtStart`,get:function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}},{key:`posAfter`,get:function(){return this.posBefore+this.size}},{key:`posAtEnd`,get:function(){return this.posAtStart+this.size-2*this.border}},{key:`localPosFromDOM`,value:function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){var r,i;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&!((i=r.pmViewDesc)&&i.parent==this);)r=r.previousSibling;return r?this.posBeforeChild(i)+i.size:this.posAtStart}else{var a,o;if(e==this.contentDOM)a=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.nextSibling}for(;a&&!((o=a.pmViewDesc)&&o.parent==this);)a=a.nextSibling;return a?this.posBeforeChild(o):this.posAtEnd}var s;if(e==this.dom&&this.contentDOM)s=t>E(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(var c=e;;c=c.parentNode){if(c==this.dom){s=!1;break}if(c.previousSibling)break}if(s==null&&t==e.childNodes.length)for(var l=e;;l=l.parentNode){if(l==this.dom){s=!0;break}if(l.nextSibling)break}}return s??n>0?this.posAtEnd:this.posAtStart}},{key:`nearestDesc`,value:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=!0,r=e;r;r=r.parentNode){var i=this.getDesc(r),a=void 0;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}},{key:`getDesc`,value:function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t}},{key:`posFromDOM`,value:function(e,t,n){for(var r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}},{key:`descAt`,value:function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<i)return r.descAt(e-n-r.border);n=i}}},{key:`domFromPos`,value:function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};for(var n=0,r=0,i=0;n<this.children.length;n++){var a=this.children[n],o=i+a.size;if(o>e||a instanceof ot){r=e-i;break}i=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(var s;n&&!(s=this.children[n-1]).size&&s instanceof W&&s.side>=0;n--);if(t<=0){for(var c,l=!0;c=n?this.children[n-1]:null,!(!c||c.dom.parentNode==this.contentDOM);n--,l=!1);return c&&t&&l&&!c.border&&!c.domAtom?c.domFromPos(c.size,t):{node:this.contentDOM,offset:c?E(c.dom)+1:0}}else{for(var u,d=!0;u=n<this.children.length?this.children[n]:null,!(!u||u.dom.parentNode==this.contentDOM);n++,d=!1);return u&&d&&!u.border&&!u.domAtom?u.domFromPos(0,t):{node:this.contentDOM,offset:u?E(u.dom):this.contentDOM.childNodes.length}}}},{key:`parseRange`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,i=-1,a=n,o=0;;o++){var s=this.children[o],c=a+s.size;if(r==-1&&e<=c){var l=a+s.border;if(e>=l&&t<=c-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,t,l);e=a;for(var u=o;u>0;u--){var d=this.children[u-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){r=E(d.dom)+1;break}e-=d.size}r==-1&&(r=0)}if(r>-1&&(c>t||o==this.children.length-1)){t=c;for(var f=o+1;f<this.children.length;f++){var p=this.children[f];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){i=E(p.dom);break}t+=p.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=c}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}},{key:`emptyChildAt`,value:function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}},{key:`domAfterPos`,value:function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(n.nodeType!=1||r==n.childNodes.length)throw RangeError(`No node after pos `+e);return n.childNodes[r]}},{key:`setSelection`,value:function(e,t,n){for(var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=Math.min(e,t),a=Math.max(e,t),o=0,s=0;o<this.children.length;o++){var c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}var u=this.domFromPos(e,e?-1:1),d=t==e?u:this.domFromPos(t,t?-1:1),f=n.root.getSelection(),p=n.domSelectionRange(),m=!1;if((fe||B)&&e==t){var h=u,g=h.node,_=h.offset;if(g.nodeType==3){if(m=!!(_&&g.nodeValue[_-1]==`
17`),m&&_==g.nodeValue.length)for(var v=g,y;v;v=v.parentNode){if(y=v.nextSibling){y.nodeName==`BR`&&(u=d={node:y.parentNode,offset:E(y)+1});break}var b=v.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{var x=g.childNodes[_-1];m=x&&(x.nodeName==`BR`||x.contentEditable==`false`)}}if(fe&&p.focusNode&&p.focusNode!=d.node&&p.focusNode.nodeType==1){var S=p.focusNode.childNodes[p.focusOffset];S&&S.contentEditable==`false`&&(r=!0)}
17if(!(!(r||m&&B)&&j(u.node,u.offset,p.anchorNode,p.anchorOffset)&&j(d.node,d.offset,p.focusNode,p.focusOffset))){var C=!1;if((f.extend||e==t)&&!m){f.collapse(u.node,u.offset);try{e!=t&&f.extend(d.node,d.offset),C=!0}catch{}}if(!C){if(e>t){var w=u;u=d,d=w}var T=document.createRange();T.setEnd(d.node,d.offset),T.setStart(u.node,u.offset),f.removeAllRanges(),f.addRange(T)}}}},{key:`ignoreMutation`,value:function(e){return!this.contentDOM&&e.type!=`selection`}},{key:`contentLost`,get:function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}},{key:`markDirty`,value:function(e,t){for(var n=0,r=0;r<this.children.length;r++){var i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){var o=n+i.border,s=a-i.border;if(e>=o&&t<=s){this.dirty=e==n||t==a?Qe:Ze,e==o&&t==s&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=$e:i.markDirty(e-o,t-o);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Qe:$e}n=a}this.dirty=Qe}},{key:`markParentsDirty`,value:function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=e==1?Qe:Ze;t.dirty<n&&(t.dirty=n)}}},{key:`domAtom`,get:function(){return!1}},{key:`ignoreForCoords`,get:function(){return!1}},{key:`isText`,value:function(e){return!1}}]),e}(),W=function(e){u(n,e);var t=f(n);function n(e,r,i,a){var o;v(this,n);var s,c=r.type.toDOM;if(typeof c==`function`&&(c=c(i,function(){if(!s)return a;if(s.parent)return s.parent.posBeforeChild(s)})),!r.type.spec.raw){if(c.nodeType!=1){var l=document.createElement(`span`);l.appendChild(c),c=l}c.contentEditable=`false`,c.classList.add(`ProseMirror-widget`)}return o=t.call(this,e,[],c,null),o.widget=r,o.widget=r,s=m(o),o}return b(n,[{key:`matchesWidget`,value:function(e){return this.dirty==U&&e.type.eq(this.widget.type)}},{key:`parseRule`,value:function(){return{ignore:!0}}},{key:`stopEvent`,value:function(e){var t=this.widget.spec.stopEvent;return t?t(e):!1}},{key:`ignoreMutation`,value:function(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}},{key:`destroy`,value:function(){this.widget.type.destroy(this.dom),c(g(n.prototype),`destroy`,this).call(this)}},{key:`domAtom`,get:function(){return!0}},{key:`side`,get:function(){return this.widget.type.side}}]),n}(et),tt=function(e){u(n,e);var t=f(n);function n(e,r,i,a){var o;return v(this,n),o=t.call(this,e,[],r,null),o.textDOM=i,o.text=a,o}return b(n,[{key:`size`,get:function(){return this.text.length}},{key:`localPosFromDOM`,value:function(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}},{key:`domFromPos`,value:function(e){return{node:this.textDOM,offset:e}}},{key:`ignoreMutation`,value:function(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}}]),n}(et),nt=function(e){u(n,e);var t=f(n);function n(e,r,i,a,o){var s;return v(this,n),s=t.call(this,e,[],i,a),s.mark=r,s.spec=o,s}return b(n,[{key:`parseRule`,value:function(){return this.dirty&$e||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}},{key:`matchesMark`,value:function(e){return this.dirty!=$e&&this.mark.eq(e)}},{key:`markDirty`,value:function(e,t){if(c(g(n.prototype),`markDirty`,this).call(this,e,t),this.dirty!=U){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=U}}},{key:`slice`,value:function(e,t,r){var i=n.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;t<o&&(a=Ct(a,t,o,r)),e>0&&(a=Ct(a,0,e,r));for(var s=0;s<a.length;s++)a[s].parent=i;return i.children=a,i}},{key:`ignoreMutation`,value:function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):c(g(n.prototype),`ignoreMutation`,this).call(this,e)}},{key:`destroy`,value:function(){this.spec.destroy&&this.spec.destroy(),c(g(n.prototype),`destroy`,this).call(this)}}],[{key:`create`,value:function(e,t,r,i){var a=i.nodeViews[t.type.name],o=a&&a(t,i,r);return(!o||!o.dom)&&(o=w.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new n(e,t,o.dom,o.contentDOM||o.dom,o)}}]),n}(et),rt=function(e){u(n,e);var t=f(n);function n(e,r,i,a,o,s,c,l,u){var d;return v(this,n),d=t.call(this,e,[],o,s),d.node=r,d.outerDeco=i,d.innerDeco=a,d.nodeDOM=c,d}return b(n,[{key:`parseRule`,value:function(){var e=this;if(this.node.type.spec.reparseInView)return null;
17var t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(t.preserveWhitespace=`full`),!this.contentDOM)t.getContent=function(){return e.node.content};else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(var n=this.children.length-1;n>=0;n--){var r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=function(){return w.Fragment.empty})}return t}},{key:`matchesNode`,value:function(e,t,n){return this.dirty==U&&e.eq(this.node)&&ht(t,this.outerDeco)&&n.eq(this.innerDeco)}},{key:`size`,get:function(){return this.node.nodeSize}},{key:`border`,get:function(){return this.node.isLeaf?0:1}},{key:`updateChildren`,value:function(e,t){var n=this,r=this.node.inlineContent,i=t,a=e.composing?this.localCompositionInfo(e,t):null,o=a&&a.pos>-1?a:null,s=a&&a.pos<0,c=new _t(this,o&&o.node,e);bt(this.node,this.innerDeco,function(t,a,o){t.spec.marks?c.syncToMarks(t.spec.marks,r,e):t.type.side>=0&&!o&&c.syncToMarks(a==n.node.childCount?w.Mark.none:n.node.child(a).marks,r,e),c.placeWidget(t,e,i)},function(t,n,o,l){c.syncToMarks(t.marks,r,e);var u;c.findNodeMatch(t,n,o,l)||s&&e.state.selection.from>i&&e.state.selection.to<i+t.nodeSize&&(u=c.findIndexWithChild(a.node))>-1&&c.updateNodeAt(t,n,o,u,e)||c.updateNextNode(t,n,o,e,l,i)||c.addNode(t,n,o,e,i),i+=t.nodeSize}),c.syncToMarks([],r,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Qe)&&(o&&this.protectLocalComposition(e,o),ct(this.contentDOM,this.children,e),he&&xt(this.dom))}},{key:`localCompositionInfo`,value:function(e,t){var n=e.state.selection,r=n.from,i=n.to;if(!(e.state.selection instanceof C.TextSelection)||r<t||i>t+this.node.content.size)return null;var a=e.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){var o=a.nodeValue,s=St(this.node.content,o,r-t,i-t);return s<0?null:{node:a,pos:s,text:o}}else return{node:a,pos:-1,text:``}}},{key:`protectLocalComposition`,value:function(e,t){var n=t.node,r=t.pos,i=t.text;if(!this.getDesc(n)){for(var a=n;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&=void 0}var o=new tt(this,a,n,i);e.input.compositionNodes.push(o),this.children=Ct(this.children,r,r+i.length,e,o)}}},{key:`update`,value:function(e,t,n,r){return this.dirty==$e||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}},{key:`updateInner`,value:function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=U}},{key:`updateOuterDeco`,value:function(e){if(!ht(e,this.outerDeco)){var t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=ft(this.dom,this.nodeDOM,dt(this.outerDeco,this.node,t),dt(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}}},{key:`selectNode`,value:function(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}},{key:`deselectNode`,value:function(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute(`draggable`))}},{key:`domAtom`,get:function(){return this.node.isAtom}}],[{key:`create`,value:function(e,t,r,i,a,o){var s=a.nodeViews[t.type.name],c,l=s&&s(t,a,function(){if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){var f=w.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);u=f.dom,d=f.contentDOM}!d&&!t.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),t.type.spec.draggable&&(u.draggable=!0));var p=u;return u=mt(u,r,t),l?c=new st(e,t,r,i,u,d||null,p,l,a,o+1):t.isText?new at(e,t,r,i,u,p,a):new n(e,t,r,i,u,d||null,p,a,o+1)}}]),n}(et);function it(e,t,n,r,i){mt(r,t,e);var a=new rt(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var at=function(e){u(n,e);var t=f(n);function n(e,r,i,a,o,s,c){return v(this,n),t.call(this,e,r,i,a,o,null,s,c,0)}return b(n,[{key:`parseRule`,value:function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}},{key:`update`,value:function(e,t,n,r){return this.dirty==$e||this.dirty!=U&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=U||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=U,!0)}}
17,{key:`inParent`,value:function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}},{key:`domFromPos`,value:function(e){return{node:this.nodeDOM,offset:e}}},{key:`localPosFromDOM`,value:function(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):c(g(n.prototype),`localPosFromDOM`,this).call(this,e,t,r)}},{key:`ignoreMutation`,value:function(e){return e.type!=`characterData`&&e.type!=`selection`}},{key:`slice`,value:function(e,t,r){var i=this.node.cut(e,t),a=document.createTextNode(i.text);return new n(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}},{key:`markDirty`,value:function(e,t){c(g(n.prototype),`markDirty`,this).call(this,e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=$e)}},{key:`domAtom`,get:function(){return!1}},{key:`isText`,value:function(e){return this.node.text==e}}]),n}(rt),ot=function(e){u(n,e);var t=f(n);function n(){return v(this,n),t.apply(this,arguments)}return b(n,[{key:`parseRule`,value:function(){return{ignore:!0}}},{key:`matchesHack`,value:function(e){return this.dirty==U&&this.dom.nodeName==e}},{key:`domAtom`,get:function(){return!0}},{key:`ignoreForCoords`,get:function(){return this.dom.nodeName==`IMG`}}]),n}(et),st=function(e){u(n,e);var t=f(n);function n(e,r,i,a,o,s,c,l,u,d){var f;return v(this,n),f=t.call(this,e,r,i,a,o,s,c,u,d),f.spec=l,f}return b(n,[{key:`update`,value:function(e,t,r,i){if(this.dirty==$e)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){var a=this.spec.update(e,t,r);return a&&this.updateInner(e,t,r,i),a}else if(!this.contentDOM&&!e.isLeaf)return!1;else return c(g(n.prototype),`update`,this).call(this,e,t,r,i)}},{key:`selectNode`,value:function(){this.spec.selectNode?this.spec.selectNode():c(g(n.prototype),`selectNode`,this).call(this)}},{key:`deselectNode`,value:function(){this.spec.deselectNode?this.spec.deselectNode():c(g(n.prototype),`deselectNode`,this).call(this)}},{key:`setSelection`,value:function(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):c(g(n.prototype),`setSelection`,this).call(this,e,t,r,i)}},{key:`destroy`,value:function(){this.spec.destroy&&this.spec.destroy(),c(g(n.prototype),`destroy`,this).call(this)}},{key:`stopEvent`,value:function(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}},{key:`ignoreMutation`,value:function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):c(g(n.prototype),`ignoreMutation`,this).call(this,e)}}]),n}(rt);function ct(e,t,n){for(var r=e.firstChild,i=!1,a=0;a<t.length;a++){var o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=gt(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof nt){var c=r?r.previousSibling:e.lastChild;ct(o.contentDOM,o.children,n),r=c?c.nextSibling:e.firstChild}}for(;r;)r=gt(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var lt=function(e){e&&(this.nodeName=e)};lt.prototype=Object.create(null);var ut=[new lt];function dt(e,t,n){if(e.length==0)return ut;for(var r=n?ut[0]:new lt,i=[r],a=0;a<e.length;a++){var o=e[a].type.attrs;if(o)for(var s in o.nodeName&&i.push(r=new lt(o.nodeName)),o){var c=o[s];c!=null&&(n&&i.length==1&&i.push(r=new lt(t.isInline?`span`:`div`)),s==`class`?r.class=(r.class?r.class+` `:``)+c:s==`style`?r.style=(r.style?r.style+`;`:``)+c:s!=`nodeName`&&(r[s]=c))}}return i}function ft(e,t,n,r){if(n==ut&&r==ut)return t;for(var i=t,a=0;a<r.length;a++){var o=r[a],s=n[a];if(a){var c=void 0;s&&s.nodeName==o.nodeName&&i!=e&&(c=i.parentNode)&&c.nodeName.toLowerCase()==o.nodeName?i=c:(c=document.createElement(o.nodeName),c.pmIsDeco=!0,c.appendChild(i),s=ut[0],i=c)}pt(i,s||ut[0],o)}return i}function pt(e,t,n){for(var r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(var i in n)i!=`class`&&i!=`style`&&i!=`nodeName`&&n[i]!=t[i]&&e.setAttribute(i,n[i]);if(t.class!=n.class){for(var a=t.class?t.class.split(` `).filter(Boolean):[],o=n.class?n.class.split(` `).filter(Boolean):[],s=0;s<a.length;s++)o.indexOf(a[s])==-1&&e.classList.remove(a[s]);for(var c=0;c<o.length;c++)a.indexOf(o[c])==-1&&e.classList.add(o[c]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style)for(var l=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,u;u=l.exec(t.style);)e.style.removeProperty(u[1]);n.style&&(e.style.cssText+=n.style)}}function mt(e,t,n){return ft(e,e,ut,dt(t,n,e.nodeType!=1))}function ht(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function gt(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var _t=function(){function e(t,n,r){v(this,e),this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=vt(t.node.content,t)}return b(e,[{key:`destroyBetween`,value:function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}},{key:`destroyRest`,value:function(){this.destroyBetween(this.index,this.top.children.length)}},{key:`syncToMarks`,value:function(e,t,n){for(var r=0,i=this.stack.length>>1,a=Math.min(i,e.length);r<a&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&e[r].type.spec.spanning!==!1;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=U,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);for(var o=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++){var c=this.top.children[s];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){o=s;break}}if(o>-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{var l=nt.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}},{key:`findNodeMatch`,value:function(e,t,n,r){var i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(var o=this.index,s=Math.min(this.top.children.length,o+5);o<s;o++){var c=this.top.children[o];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){i=o;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}},{key:`updateNodeAt`,value:function(e,t,n,r,i){var a=this.top.children[r];
17return a.dirty==$e&&a.dom==a.contentDOM&&(a.dirty=Qe),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}},{key:`findIndexWithChild`,value:function(e){for(;;){var t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){var n=e.pmViewDesc;if(n){for(var r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==n)return r}return-1}e=t}}},{key:`updateNextNode`,value:function(e,t,n,r,i,a){for(var o=this.index;o<this.top.children.length;o++){var s=this.top.children[o];if(s instanceof rt){var c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;var l=s.dom,u=void 0,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=$e&&ht(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Qe,u.updateChildren(r,a+1),u.dirty=U),this.changed=!0,this.index++,!0;break}}return!1}},{key:`recreateWrapper`,value:function(e,t,n,r,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!ht(n,e.outerDeco)||!r.eq(e.innerDeco))return null;var s=rt.create(this.top,t,n,r,i,o);if(s.contentDOM){s.children=e.children,e.children=[];var c=a(s.children),l;try{for(c.s();!(l=c.n()).done;){var u=l.value;u.parent=s}}catch(e){c.e(e)}finally{c.f()}}return e.destroy(),s}},{key:`addNode`,value:function(e,t,n,r,i){var a=rt.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}},{key:`placeWidget`,value:function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{var i=new W(this.top,e,t,n);this.top.children.splice(this.index++,0,i),this.changed=!0}}},{key:`addTextblockHacks`,value:function(){for(var e=this.top.children[this.index-1],t=this.top;e instanceof nt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof at)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((B||z)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}},{key:`addHackNode`,value:function(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{var n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);var r=new ot(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}},{key:`isLocked`,value:function(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}]),e}();function vt(e,t){var n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){for(var s=void 0;;)if(r){var c=n.children[r-1];if(c instanceof nt)n=c,r=c.children.length;else{s=c,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;var l=s.node;if(l){if(l!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function yt(e,t){return e.type.side-t.type.side}function bt(e,t,n,r){var i=t.locals(e),a=0;if(i.length==0){for(var o=0;o<e.childCount;o++){var s=e.child(o);r(s,i,t.forChild(a,s),o),a+=s.nodeSize}return}for(var c=0,l=[],u=null,d=0;;){for(var f=void 0,p=void 0;c<i.length&&i[c].to==a;){var m=i[c++];m.widget&&(f?(p||=[f]).push(m):f=m)}if(f)if(p){p.sort(yt);for(var h=0;h<p.length;h++)n(p[h],d,!!u)}else n(f,d,!!u);var g=void 0,_=void 0;if(u)_=-1,g=u,u=null;else if(d<e.childCount)_=d,g=e.child(d++);else break;for(var v=0;v<l.length;v++)l[v].to<=a&&l.splice(v--,1);for(;c<i.length&&i[c].from<=a&&i[c].to>a;)l.push(i[c++]);var y=a+g.nodeSize;if(g.isText){var b=y;c<i.length&&i[c].from<b&&(b=i[c].from);for(var x=0;x<l.length;x++)l[x].to<b&&(b=l[x].to);b<y&&(u=g.cut(b-a),g=g.cut(0,b-a),y=b,_=-1)}else for(;c<i.length&&i[c].to<y;)c++;var S=g.isInline&&!g.isLeaf?l.filter(function(e){return!e.inline}):l.slice();r(g,S,t.forChild(a,g),_),a=y}}function xt(e){if(e.nodeName==`UL`||e.nodeName==`OL`){var t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function St(e,t,n,r){for(var i=0,a=0;i<e.childCount&&a<=r;){var o=e.child(i++),s=a;if(a+=o.nodeSize,o.isText){for(var c=o.text;i<e.childCount;){var l=e.child(i++);if(a+=l.nodeSize,!l.isText)break;c+=l.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;var u=s<r?c.lastIndexOf(t,r-s-1):-1;
17if(u>=0&&u+t.length+s>=n)return s+u;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}}return-1}function Ct(e,t,n,r,i){for(var a=[],o=0,s=0;o<e.length;o++){var c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function wt(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=e.domSelectionRange(),i=e.state.doc;if(!r.focusNode)return null;var a=e.docView.nearestDesc(r.focusNode),o=a&&a.size==0,s=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(s<0)return null;var c=i.resolve(s),l,u;if(F(r)){for(l=s;a&&!a.node;)a=a.parent;var d=a.node;if(a&&d.isAtom&&C.NodeSelection.isSelectable(d)&&a.parent&&!(d.isInline&&re(r.focusNode,r.focusOffset,a.dom))){var f=a.posBefore;u=new C.NodeSelection(s==f?c:i.resolve(f))}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){for(var p=s,m=s,h=0;h<r.rangeCount;h++){var g=r.getRangeAt(h);p=Math.min(p,e.docView.posFromDOM(g.startContainer,g.startOffset,1)),m=Math.max(m,e.docView.posFromDOM(g.endContainer,g.endOffset,-1))}if(p<0)return null;var _=t(m==e.state.selection.anchor?[m,p]:[p,m],2);l=_[0],s=_[1],c=i.resolve(s)}else l=e.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(l<0)return null}var v=i.resolve(l);if(!u){var y=n==`pointer`||e.state.selection.head<c.pos&&!o?1:-1;u=Ft(e,v,c,y)}return u}function Tt(e){return e.editable?e.hasFocus():Lt(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Et(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=e.state.selection;if(Nt(e,n),Tt(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&z){var r=e.domSelectionRange(),i=e.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&j(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)Mt(e);else{var a=n.anchor,o=n.head,s,c;Dt&&!(n instanceof C.TextSelection)&&(n.$from.parent.inlineContent||(s=Ot(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(c=Ot(e,n.to))),e.docView.setSelection(a,o,e,t),Dt&&(s&&At(s),c&&At(c)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&jt(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var Dt=B||z&&me<63;function Ot(e,t){var n=e.docView.domFromPos(t,0),r=n.node,i=n.offset,a=i<r.childNodes.length?r.childNodes[i]:null,o=i?r.childNodes[i-1]:null;if(B&&a&&a.contentEditable==`false`)return kt(a);if((!a||a.contentEditable==`false`)&&(!o||o.contentEditable==`false`)){if(a)return kt(a);if(o)return kt(o)}}function kt(e){return e.contentEditable=`true`,B&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function At(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function jt(e){var t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);var n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=function(){(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(function(){(!Tt(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function Mt(e){var t=e.domSelection(),n=document.createRange();if(t){var r=e.cursorWrapper.dom,i=r.nodeName==`IMG`;i?n.setStart(r.parentNode,E(r)+1):n.setStart(r,0),n.collapse(!0),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&L&&R<=11&&(r.disabled=!0,r.disabled=!1)}}function Nt(e,t){if(t instanceof C.NodeSelection){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Pt(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Pt(e)}function Pt(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function Ft(e,t,n,r){return e.someProp(`createSelectionBetween`,function(r){return r(e,t,n)})||C.TextSelection.between(t,n,r)}function It(e){return e.editable&&!e.hasFocus()?!1:Lt(e)}function Lt(e){var t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focu
17sNode.parentNode:t.focusNode))}catch{return!1}}function Rt(e){var t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return j(t.node,t.offset,n.anchorNode,n.anchorOffset)}function zt(e,t){var n=e.selection,r=n.$anchor,i=n.$head,a=t>0?r.max(i):r.min(i),o=a.parent.inlineContent?a.depth?e.doc.resolve(t>0?a.after():a.before()):null:a;return o&&C.Selection.findFrom(o,t)}function Bt(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Vt(e,t,n){var r=e.state.selection;if(r instanceof C.TextSelection){if(n.indexOf(`s`)>-1){var i=r.$head,a=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;var o=e.state.doc.resolve(i.pos+a.nodeSize*(t<0?-1:1));return Bt(e,new C.TextSelection(r.$anchor,o))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){var s=zt(e.state,t);return s&&s instanceof C.NodeSelection?Bt(e,s):!1}else if(!(ge&&n.indexOf(`m`)>-1)){var c=r.$head,l=c.textOffset?null:t<0?c.nodeBefore:c.nodeAfter,u;if(!l||l.isText)return!1;var d=t<0?c.pos-l.nodeSize:c.pos;return l.isAtom||(u=e.docView.descAt(d))&&!u.contentDOM?C.NodeSelection.isSelectable(l)?Bt(e,new C.NodeSelection(t<0?e.state.doc.resolve(c.pos-l.nodeSize):c)):ye?Bt(e,new C.TextSelection(e.state.doc.resolve(t<0?d:d+l.nodeSize))):!1:!1}}else if(r instanceof C.NodeSelection&&r.node.isInline)return Bt(e,new C.TextSelection(t>0?r.$to:r.$from));else{var f=zt(e.state,t);return f?Bt(e,f):!1}}function Ht(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Ut(e,t){var n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function Wt(e,t){return t<0?Gt(e):Kt(e)}function Gt(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(n){var i,a,o=!1;for(fe&&n.nodeType==1&&r<Ht(n)&&Ut(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;var s=n.childNodes[r-1];if(Ut(s,-1))i=n,a=--r;else if(s.nodeType==3)n=s,r=n.nodeValue.length;else break}else if(qt(n))break;else{for(var c=n.previousSibling;c&&Ut(c,-1);)i=n.parentNode,a=E(c),c=c.previousSibling;if(c)n=c,r=Ht(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?Yt(e,n,r):i&&Yt(e,i,a)}}function Kt(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(n){for(var i=Ht(n),a,o;;)if(r<i){if(n.nodeType!=1)break;var s=n.childNodes[r];if(Ut(s,1))a=n,o=++r;else break}else if(qt(n))break;else{for(var c=n.nextSibling;c&&Ut(c,1);)a=c.parentNode,o=E(c)+1,c=c.nextSibling;if(c)n=c,r=0,i=Ht(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&Yt(e,a,o)}}function qt(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function G(e,t){for(;e&&t==e.childNodes.length&&!P(e);)t=E(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){var n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function Jt(e,t){for(;e&&!t&&!P(e);)t=E(e),e=e.parentNode;for(;e&&t;){var n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function Yt(e,t,n){if(t.nodeType!=3){var r,i;(i=G(t,n))?(t=i,n=0):(r=Jt(t,n))&&(t=r,n=r.nodeValue.length)}var a=e.domSelection();if(a){if(F(a)){var o=document.createRange();o.setEnd(t,n),o.setStart(t,n),a.removeAllRanges(),a.addRange(o)}else a.extend&&a.extend(t,n);e.domObserver.setCurSelection();var s=e.state;setTimeout(function(){e.state==s&&Et(e)},50)}}function Xt(e,t){var n=e.state.doc.resolve(t);if(!(z||_e)&&n.parent.inlineContent){var r=e.coordsAtPos(t);if(t>n.start()){var i=e.coordsAtPos(t-1),a=(i.top+i.bottom)/2;if(a>r.top&&a<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?`ltr`:`rtl`}if(t<n.end()){var o=e.coordsAtPos(t+1),s=(o.top+o.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(o.left-r.left)>1)return o.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function K(e,t,n){var r=e.state.selection;if(r instanceof C.TextSelection&&!r.empty||n.indexOf(`s`)>-1||ge&&n.indexOf(`m`)>-1)return!1;var i=r.$from,a=r.$to;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){var o=zt(e.state,t);if(o&&o instanceof C.NodeSelection)return Bt(e,o)}if(!i.parent.inlineContent){var s=t<0?i:a,c=r instanceof C.AllSelection?C.Selection.near(s,t):C.Selection.findFrom(s,t);return c?Bt(e,c):!1}return!1}function Zt(e,t){if(!(e.state.selection instanceof C.TextSelection))return!0;var n=e.state.selection,r=n.$head,i=n.$anchor,a=n.empty;if(!r.sameParent(i))return!0;
17if(!a)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;var o=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(o&&!o.isText){var s=e.state.tr;return t<0?s.delete(r.pos-o.nodeSize,r.pos):s.delete(r.pos,r.pos+o.nodeSize),e.dispatch(s),!0}return!1}function q(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Qt(e){if(!B||e.state.selection.$head.parentOffset>0)return!1;var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(n&&n.nodeType==1&&r==0&&n.firstChild&&n.firstChild.contentEditable==`false`){var i=n.firstChild;q(e,i,`true`),setTimeout(function(){return q(e,i,`false`)},20)}return!1}function $t(e){var t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function en(e,t){var n=t.keyCode,r=$t(t);if(n==8||ge&&n==72&&r==`c`)return Zt(e,-1)||Wt(e,-1);if(n==46&&!t.shiftKey||ge&&n==68&&r==`c`)return Zt(e,1)||Wt(e,1);if(n==13||n==27)return!0;if(n==37||ge&&n==66&&r==`c`){var i=n==37?Xt(e,e.state.selection.from)==`ltr`?-1:1:-1;return Vt(e,i,r)||Wt(e,i)}else if(n==39||ge&&n==70&&r==`c`){var a=n==39?Xt(e,e.state.selection.from)==`ltr`?1:-1:1;return Vt(e,a,r)||Wt(e,a)}else if(n==38||ge&&n==80&&r==`c`)return K(e,-1,r)||Wt(e,-1);else if(n==40||ge&&n==78&&r==`c`)return Qt(e)||K(e,1,r)||Wt(e,1);else if(r==(ge?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function tn(e,t){e.someProp(`transformCopied`,function(n){t=n(t,e)});for(var n=[],r=t,i=r.content,a=r.openStart,o=r.openEnd;a>1&&o>1&&i.childCount==1&&i.firstChild.childCount==1;){a--,o--;var s=i.firstChild;n.push(s.type.name,s.attrs==s.type.defaultAttrs?null:s.attrs),i=s.content}var c=e.someProp(`clipboardSerializer`)||w.DOMSerializer.fromSchema(e.state.schema),l=pn(),u=l.createElement(`div`);u.appendChild(c.serializeFragment(i,{document:l}));for(var d=u.firstChild,f,p=0;d&&d.nodeType==1&&(f=dn[d.nodeName.toLowerCase()]);){for(var m=f.length-1;m>=0;m--){for(var h=l.createElement(f[m]);u.firstChild;)h.appendChild(u.firstChild);u.appendChild(h),p++}d=u.firstChild}return d&&d.nodeType==1&&d.setAttribute(`data-pm-slice`,`${a} ${o}${p?` -${p}`:``} ${JSON.stringify(n)}`),{dom:u,text:e.someProp(`clipboardTextSerializer`,function(n){return n(t,e)})||t.content.textBetween(0,t.content.size,`
18
19`),slice:t}}function nn(e,t,n,r,i){var a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;var c=t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,function(n){t=n(t,a||r,e)}),a)return t?new w.Slice(w.Fragment.from(e.state.schema.text(t.replace(/\r\n?/g,`
20`))),0,0):w.Slice.empty;var l=e.someProp(`clipboardTextParser`,function(n){return n(t,i,r,e)});if(l)s=l;else{var u=i.marks(),d=e.state.schema,f=w.DOMSerializer.fromSchema(d);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(function(e){var t=o.appendChild(document.createElement(`p`));e&&t.appendChild(f.serializeNode(d.text(e,u)))})}}else e.someProp(`transformPastedHTML`,function(t){n=t(n,e)}),o=gn(n),ye&&_n(o);
20var p=o&&o.querySelector(`[data-pm-slice]`),m=p&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(p.getAttribute(`data-pm-slice`)||``);if(m&&m[3])for(var h=+m[3];h>0;h--){for(var g=o.firstChild;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||w.DOMParser.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||m),context:i,ruleFromNode:function(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!rn.test(e.parentNode.nodeName)?{ignore:!0}:null}}),m)s=J(un(s,+m[1],+m[2]),m[4]);else if(s=w.Slice.maxOpen(an(s.content,i),!0),s.openStart||s.openEnd){for(var _=0,v=0,y=s.content.firstChild;_<s.openStart&&!y.type.spec.isolating;_++,y=y.firstChild);for(var b=s.content.lastChild;v<s.openEnd&&!b.type.spec.isolating;v++,b=b.lastChild);s=un(s,_,v)}return e.someProp(`transformPasted`,function(t){s=t(s,e)}),s}var rn=/^(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 an(e,t){if(e.childCount<2)return e;for(var n=function(){var n=t.node(i).contentMatchAt(t.index(i)),r,a=[];if(e.forEach(function(e){if(a){var t=n.findWrapping(e.type),i;if(!t)return a=null;if(i=a.length&&r.length&&sn(t,r,e,a[a.length-1],0))a[a.length-1]=i;else{a.length&&(a[a.length-1]=cn(a[a.length-1],r.length));var o=on(e,t);a.push(o),n=n.matchType(o.type),r=t}}}),a)return{v:w.Fragment.from(a)}},r,i=t.depth;i>=0;i--)if(r=n(),r)return r.v;return e}function on(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=t.length-1;r>=n;r--)e=t[r].create(null,w.Fragment.from(e));return e}function sn(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){var a=sn(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(w.Fragment.from(on(n,e,i+1))))}}function cn(e,t){if(t==0)return e;var n=e.content.replaceChild(e.childCount-1,cn(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(w.Fragment.empty,!0);return e.copy(n.append(r))}function ln(e,t,n,r,i,a){var o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=ln(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(w.Fragment.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function un(e,t,n){return t<e.openStart&&(e=new w.Slice(ln(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new w.Slice(ln(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var dn={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},fn=null;function pn(){return fn||=document.implementation.createHTMLDocument(`title`)}var mn=null;function hn(e){var t=window.trustedTypes;return t?(mn||=t.createPolicy(`ProseMirrorClipboard`,{createHTML:function(e){return e}}),mn.createHTML(e)):e}function gn(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n=pn().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&dn[r[1].toLowerCase()])&&(e=i.map(function(e){return`<`+e+`>`}).join(``)+e+i.map(function(e){return`</`+e+`>`}).reverse().join(``)),n.innerHTML=hn(e),i)for(var a=0;a<i.length;a++)n=n.querySelector(i[a])||n;return n}function _n(e){for(var t=e.querySelectorAll(z?`span:not([class]):not([style])`:`span.Apple-converted-space`),n=0;n<t.length;n++){var r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function J(e,t){if(!e.size)return e;var n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}for(var i=e.content,a=e.openStart,o=e.openEnd,s=r.length-2;s>=0;s-=2){var c=n.nodes[r[s]];if(!c||c.hasRequiredAttrs())break;i=w.Fragment.from(c.create(r[s+1],i)),a++,o++}return new w.Slice(i,a,o)}var Y={},X={},vn={touchstart:!0,touchmove:!0},yn=b(function e(){v(this,e),this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null});function bn(e){var t=function(){var t=Y[n];e.dom.addEventListener(n,e.input.eventHandlers[n]=function(n){Tn(e,n)&&!wn(e,n)&&(e.editable||!(n.type in X))&&t(e,n)},vn[n]?{passive:!0}:void 0)};for(var n in Y)t();B&&e.dom.addEventListener(`input`,function(){return null}),Cn(e)}function xn(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Sn(e){for(var t in e.domObserver.stop(),e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Cn(e){e.someProp(`handleDOMEvents`,function(t){for(var n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=function(t){return wn(e,t)})})}function wn(e,t){return e.someProp(`handleDOMEvents`,function(n){var r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function Tn(e,t){if(!t.bubbles)return!0;
20if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function En(e,t){!wn(e,t)&&Y[t.type]&&(e.editable||!(t.type in X))&&Y[t.type](e,t)}X.keydown=function(e,t){var n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!Bn(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(ve&&z&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),he&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){var r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(function(){e.input.lastIOSEnter==r&&(e.someProp(`handleKeyDown`,function(t){return t(e,I(13,`Enter`))}),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,function(t){return t(e,n)})||en(e,n)?n.preventDefault():xn(e,`key`)},X.keyup=function(e,t){t.keyCode==16&&(e.input.shiftKey=!1)},X.keypress=function(e,t){var n=t;if(!(Bn(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||ge&&n.metaKey)){if(e.someProp(`handleKeyPress`,function(t){return t(e,n)})){n.preventDefault();return}var r=e.state.selection;if(!(r instanceof C.TextSelection)||!r.$from.sameParent(r.$to)){var i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!e.someProp(`handleTextInput`,function(t){return t(e,r.$from.pos,r.$to.pos,i)})&&e.dispatch(e.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}}};function Dn(e){return{left:e.clientX,top:e.clientY}}function On(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function kn(e,t,n,r,i){if(r==-1)return!1;for(var a=e.state.doc.resolve(r),o=function(r){if(e.someProp(t,function(t){return r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)}))return{v:!0}},s,c=a.depth+1;c>0;c--)if(s=o(c),s)return s.v;return!1}function An(e,t,n){if(e.focused||e.focus(),!e.state.selection.eq(t)){var r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}}function jn(e,t){if(t==-1)return!1;var n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&C.NodeSelection.isSelectable(r)?(An(e,new C.NodeSelection(n),`pointer`),!0):!1}function Mn(e,t){if(t==-1)return!1;var n=e.state.selection,r,i;n instanceof C.NodeSelection&&(r=n.node);for(var a=e.state.doc.resolve(t),o=a.depth+1;o>0;o--){var s=o>a.depth?a.nodeAfter:a.node(o);if(C.NodeSelection.isSelectable(s)){i=r&&n.$from.depth>0&&o>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(o);break}}return i==null?!1:(An(e,C.NodeSelection.create(e.state.doc,i),`pointer`),!0)}function Nn(e,t,n,r,i){return kn(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,function(n){return n(e,t,r)})||(i?Mn(e,n):jn(e,n))}function Pn(e,t,n,r){return kn(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,function(n){return n(e,t,r)})}function Fn(e,t,n,r){return kn(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,function(n){return n(e,t,r)})||In(e,n,r)}function In(e,t,n){if(n.button!=0)return!1;var r=e.state.doc;if(t==-1)return r.inlineContent?(An(e,C.TextSelection.create(r,0,r.content.size),`pointer`),!0):!1;for(var i=r.resolve(t),a=i.depth+1;a>0;a--){var o=a>i.depth?i.nodeAfter:i.node(a),s=i.before(a);if(o.inlineContent)An(e,C.TextSelection.create(r,s+1,s+1+o.content.size),`pointer`);else if(C.NodeSelection.isSelectable(o))An(e,C.NodeSelection.create(r,s),`pointer`);else continue;return!0}}function Ln(e){return Q(e)}var Rn=ge?`metaKey`:`ctrlKey`;Y.mousedown=function(e,t){var n=t;e.input.shiftKey=n.shiftKey;var r=Ln(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&On(n,e.input.lastClick)&&!n[Rn]&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a};var o=e.posAtCoords(Dn(n));o&&(a==`singleClick`?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new zn(e,o,n,!!r)):(a==`doubleClick`?Pn:Fn)(e,o.pos,o.inside,n)?n.preventDefault():xn(e,`pointer`))};var zn=function(){function e(t,n,r,i){var a=this;v(this,e),this.view=t,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[Rn],this.allowDefault=r.shiftKey;var o,s;if(n.inside>-1)o=t.state.doc.nodeAt(n.inside),s=n.inside;else{var c=t.state.doc.resolve(n.pos);o=c.parent,s=c.depth?c.before():0}var l=i?null:r.target,u=l?t.docView.nearestDesc(l,!0):null;this.target=u&&u.dom.nodeType==1?u.dom:null;var d=t.state.selection;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||d instanceof C.NodeSelection&&d.from<=s&&d.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&fe&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(function(){a.view.input.mouseDown==a&&a.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),t.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),t.root.addEventListener(`mousemove`,this.move=this.move.bind(this)),xn(t,`pointer`)}return b(e,[{key:`done`,value:function(){var e=this;this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(function(){return Et(e.view)}),this.view.input.mouseDown=null}},{key:`up`,value:function(e){if(this.done(),this.view.dom.contains(e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Dn(e))),this.updateAllowDefault(e),this.allowDefault||!t?xn(this.view,`pointer`):Nn(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||B&&this.mightDrag&&!this.mightDrag.node.isAtom||z&&!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)?(An(this.view,C.Selection.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):xn(this.view,`pointer`)}}},{key:`move`,value:function(e){this.updateAllowDefault(e),xn(this.view,`pointer`),e.buttons==0&&this.done()}},{key:`updateAllowDefault`,value:function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}]),e}();Y.touchstart=function(e){e.input.lastTouch=Date.now(),Ln(e),xn(e,`pointer`)},Y.touchmove=function(e){e.input.lastTouch=Date.now(),xn(e,`pointer`)},Y.contextmenu=function(e){return Ln(e)};function Bn(e,t){return e.composing?!0:B&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var Vn=ve?5e3:-1;X.compositionstart=X.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$to;if(t.selection instanceof C.TextSelection&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(function(e){return e.type.spec.inclusive===!1})))e.markCursor=e.state.storedMarks||n.marks(),Q(e,!0),e.markCursor=null;else if(Q(e,!t.selection.empty),fe&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.domSelectionRange(),i=r.focusNode,a=r.focusOffset;i&&i.nodeType==1&&a!=0;){var o=a<0?i.lastChild:i.childNodes[a-1];if(!o)break;if(o.nodeType==3){var s=e.domSelection();s&&s.collapse(o,o.nodeValue.length);break}else i=o,a=-1}e.input.composing=!0}Z(e,Vn)},X.compositionend=function(e,t){e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(function(){return e.domObserver.flush()}),e.input.compositionID++,Z(e,20))};function Z(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(function(){return Q(e)},t))}function Hn(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Wn());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Un(e){var t=e.domSelectionRange();if(!t.focusNode)return null;var n=te(t.focusNode,t.focusOffset),r=ne(t.focusNode,t.focusOffset);
20if(n&&r&&n!=r){var i=r.pmViewDesc,a=e.domObserver.lastChangedTextNode;if(n==a||r==a)return a;if(!i||!i.isText(r.nodeValue))return r;if(e.input.compositionNode==r){var o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Wn(){var e=document.createEvent(`Event`);return e.initEvent(`event`,!0,!0),e.timeStamp}function Q(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!(ve&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Hn(e),t||e.docView&&e.docView.dirty){var n=wt(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!e.state.selection.empty?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function Gn(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;var r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}}var Kn=L&&R<15||he&&be<604;Y.copy=X.cut=function(e,t){var n=t,r=e.state.selection,i=n.type==`cut`;if(!r.empty){var a=Kn?null:n.clipboardData,o=tn(e,r.content()),s=o.dom,c=o.text;a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,s.innerHTML),a.setData(`text/plain`,c)):Gn(e,s),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))}};function qn(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function Jn(e,t){if(e.dom.parentNode){var n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();var i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Yn(e,r.value,null,i,t):Yn(e,r.textContent,r.innerHTML,i,t)},50)}}function Yn(e,t,n,r,i){var a=nn(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,function(t){return t(e,i,a||w.Slice.empty)}))return!0;if(!a)return!1;var o=qn(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function Xn(e){var t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;
20var n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}X.paste=function(e,t){var n=t;if(!(e.composing&&!ve)){var r=Kn?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Yn(e,Xn(r),r.getData(`text/html`),i,n)?n.preventDefault():Jn(e,n)}};var Zn=b(function e(t,n,r){v(this,e),this.slice=t,this.move=n,this.node=r}),Qn=ge?`altKey`:`ctrlKey`;for(var $n in Y.dragstart=function(e,t){var n=t,r=e.input.mouseDown;if(r&&r.done(),n.dataTransfer){var i=e.state.selection,a=i.empty?null:e.posAtCoords(Dn(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof C.NodeSelection?i.to-1:i.to))){if(r&&r.mightDrag)o=C.NodeSelection.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){var s=e.docView.nearestDesc(n.target,!0);s&&s.node.type.spec.draggable&&s!=e.docView&&(o=C.NodeSelection.create(e.state.doc,s.posBefore))}}var c=tn(e,(o||e.state.selection).content()),l=c.dom,u=c.text,d=c.slice;(!n.dataTransfer.files.length||!z||me>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Kn?`Text`:`text/html`,l.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,Kn||n.dataTransfer.setData(`text/plain`,u),e.dragging=new Zn(d,!n[Qn],o)}},Y.dragend=function(e){var t=e.dragging;window.setTimeout(function(){e.dragging==t&&(e.dragging=null)},50)},X.dragover=X.dragenter=function(e,t){return t.preventDefault()},X.drop=function(e,t){var n=t,r=e.dragging;if(e.dragging=null,n.dataTransfer){var i=e.posAtCoords(Dn(n));if(i){var a=e.state.doc.resolve(i.pos),o=r&&r.slice;o?e.someProp(`transformPasted`,function(t){o=t(o,e)}):o=nn(e,Xn(n.dataTransfer),Kn?null:n.dataTransfer.getData(`text/html`),!1,a);var s=!!(r&&!n[Qn]);if(e.someProp(`handleDrop`,function(t){return t(e,n,o||w.Slice.empty,s)})){n.preventDefault();return}if(o){n.preventDefault();var c=o?T.dropPoint(e.state.doc,a.pos,o):a.pos;c??=a.pos;var l=e.state.tr;if(s){var u=r.node;u?u.replace(l):l.deleteSelection()}var d=l.mapping.map(c),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,p=l.doc;if(f?l.replaceRangeWith(d,d,o.content.firstChild):l.replaceRange(d,d,o),!l.doc.eq(p)){var m=l.doc.resolve(d);if(f&&C.NodeSelection.isSelectable(o.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new C.NodeSelection(m));else{var h=l.mapping.map(c);l.mapping.maps[l.mapping.maps.length-1].forEach(function(e,t,n,r){return h=r}),l.setSelection(Ft(e,m,l.doc.resolve(h)))}
20e.focus(),e.dispatch(l.setMeta(`uiEvent`,`drop`))}}}}},Y.focus=function(e){e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Et(e)},20))},Y.blur=function(e,t){var n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},Y.beforeinput=function(e,t){if(z&&ve&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();var n=e.input.domChangeCount;setTimeout(function(){if(e.input.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp(`handleKeyDown`,function(t){return t(e,I(8,`Backspace`))}))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}},50)}},X)Y[$n]=X[$n];function er(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var tr=function(){function e(t,n){v(this,e),this.toDOM=t,this.spec=n||or,this.side=this.spec.side||0}return b(e,[{key:`map`,value:function(e,t,n,r){var i=e.mapResult(t.from+r,this.side<0?-1:1),a=i.pos;return i.deleted?null:new ir(a-n,a-n,this)}},{key:`valid`,value:function(){return!0}},{key:`eq`,value:function(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&er(this.spec,t.spec))}},{key:`destroy`,value:function(e){this.spec.destroy&&this.spec.destroy(e)}}]),e}(),nr=function(){function e(t,n){v(this,e),this.attrs=t,this.spec=n||or}return b(e,[{key:`map`,value:function(e,t,n,r){var i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new ir(i,a,this)}},{key:`valid`,value:function(e,t){return t.from<t.to}},{key:`eq`,value:function(t){return this==t||t instanceof e&&er(this.attrs,t.attrs)&&er(this.spec,t.spec)}},{key:`destroy`,value:function(){}}],[{key:`is`,value:function(t){return t.type instanceof e}}]),e}(),rr=function(){function e(t,n){v(this,e),this.attrs=t,this.spec=n||or}return b(e,[{key:`map`,value:function(e,t,n,r){var i=e.mapResult(t.from+r,1);if(i.deleted)return null;var a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new ir(i.pos-n,a.pos-n,this)}},{key:`valid`,value:function(e,t){var n=e.content.findIndex(t.from),r=n.index,i=n.offset,a;return i==t.from&&!(a=e.child(r)).isText&&i+a.nodeSize==t.to}},{key:`eq`,value:function(t){return this==t||t instanceof e&&er(this.attrs,t.attrs)&&er(this.spec,t.spec)}},{key:`destroy`,value:function(){}}]),e}(),ir=function(){function e(t,n,r){v(this,e),this.from=t,this.to=n,this.type=r}return b(e,[{key:`copy`,value:function(t,n){return new e(t,n,this.type)}},{key:`eq`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}},{key:`map`,value:function(e,t,n){return this.type.map(e,this,t,n)}},{key:`spec`,get:function(){return this.type.spec}}
20,{key:`inline`,get:function(){return this.type instanceof nr}},{key:`widget`,get:function(){return this.type instanceof tr}}],[{key:`widget`,value:function(t,n,r){return new e(t,t,new tr(n,r))}},{key:`inline`,value:function(t,n,r,i){return new e(t,n,new nr(r,i))}},{key:`node`,value:function(t,n,r,i){return new e(t,n,new rr(r,i))}}]),e}(),ar=[],or={},sr=function(){function e(t,n){v(this,e),this.local=t.length?t:ar,this.children=n.length?n:ar}return b(e,[{key:`find`,value:function(e,t,n){var r=[];return this.findInner(e??0,t??1e9,r,0,n),r}},{key:`findInner`,value:function(e,t,n,r,i){for(var a=0;a<this.local.length;a++){var o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){var c=this.children[s]+1;this.children[s+2].findInner(e-c,t-c,n,r+c,i)}}},{key:`map`,value:function(e,t,n){return this==$||e.maps.length==0?this:this.mapInner(e,t,0,0,n||or)}},{key:`mapInner`,value:function(t,n,r,i,a){for(var o,s=0;s<this.local.length;s++){var c=this.local[s].map(t,r,i);c&&c.type.valid(n,c)?(o||=[]).push(c):a.onRemove&&a.onRemove(this.local[s].spec)}return this.children.length?lr(this.children,o||[],t,n,r,i,a):o?new e(o.sort(hr),ar):$}},{key:`add`,value:function(t,n){return n.length?this==$?e.create(t,n):this.addInner(t,n,0):this}},{key:`addInner`,value:function(t,n,r){var i=this,a,o=0;t.forEach(function(e,t){var s=t+r,c;if(c=fr(n,e,s)){for(a||=i.children.slice();o<a.length&&a[o]<t;)o+=3;a[o]==t?a[o+2]=a[o+2].addInner(e,c,s+1):a.splice(o,0,t,t+e.nodeSize,mr(c,e,s+1,or)),o+=3}});for(var s=ur(o?pr(n):n,-r),c=0;c<s.length;c++)s[c].type.valid(t,s[c])||s.splice(c--,1);return new e(s.length?this.local.concat(s).sort(hr):this.local,a||this.children)}},{key:`remove`,value:function(e){return e.length==0||this==$?this:this.removeInner(e,0)}},{key:`removeInner`,value:function(t,n){for(var r=this.children,i=this.local,a=0;a<r.length;a+=3){for(var o=void 0,s=r[a]+n,c=r[a+1]+n,l=0,u;l<t.length;l++)(u=t[l])&&u.from>s&&u.to<c&&(t[l]=null,(o||=[]).push(u));if(o){r==this.children&&(r=this.children.slice());var d=r[a+2].removeInner(o,s+1);d==$?(r.splice(a,3),a-=3):r[a+2]=d}}if(i.length){for(var f=0,p;f<t.length;f++)if(p=t[f])for(var m=0;m<i.length;m++)i[m].eq(p,n)&&(i==this.local&&(i=this.local.slice()),i.splice(m--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):$}},{key:`forChild`,value:function(t,n){if(this==$)return this;if(n.isLeaf)return e.empty;for(var r,i,a=0;a<this.children.length;a+=3)if(this.children[a]>=t){this.children[a]==t&&(r=this.children[a+2]);break}for(var o=t+1,s=o+n.content.size,c=0;c<this.local.length;c++){var l=this.local[c];if(l.from<s&&l.to>o&&l.type instanceof nr){var u=Math.max(o,l.from)-o,d=Math.min(s,l.to)-o;u<d&&(i||=[]).push(l.copy(u,d))}}if(i){var f=new e(i.sort(hr),ar);return r?new cr([f,r]):f}return r||$}},{key:`eq`,value:function(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(var r=0;r<this.children.length;r+=3)if(this.children[r]!=t.children[r]||this.children[r+1]!=t.children[r+1]||!this.children[r+2].eq(t.children[r+2]))return!1;return!0}},{key:`locals`,value:function(e){return gr(this.localsInner(e))}},{key:`localsInner`,value:function(e){if(this==$)return ar;if(e.inlineContent||!this.local.some(nr.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof nr||t.push(this.local[n]);return t}},{key:`forEachSet`,value:function(e){e(this)}}],[{key:`create`,value:function(e,t){return t.length?mr(t,e,0,or):$}}]),e}();sr.empty=new sr([],[]),sr.removeOverlap=gr;var $=sr.empty,cr=function(){function e(t){v(this,e),this.members=t}return b(e,[{key:`map`,value:function(t,n){var r=this.members.map(function(e){return e.map(t,n,or)});return e.from(r)}},{key:`forChild`,value:function(t,n){if(n.isLeaf)return sr.empty;for(var r=[],i=0;i<this.members.length;i++){var a=this.members[i].forChild(t,n);
20a!=$&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}},{key:`eq`,value:function(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(var n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}},{key:`locals`,value:function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(var a=0;a<i.length;a++)t.push(i[a])}}return t?gr(n?t:t.sort(hr)):ar}},{key:`forEachSet`,value:function(e){for(var t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}],[{key:`from`,value:function(t){switch(t.length){case 0:return $;case 1:return t[0];default:return new e(t.every(function(e){return e instanceof sr})?t:t.reduce(function(e,t){return e.concat(t instanceof sr?t:t.members)},[]))}}}]),e}();function lr(e,t,n,r,i,a,o){for(var s=e.slice(),c=function(e){var t=0;n.maps[l].forEach(function(n,r,i,a){for(var o=a-i-(r-n),c=0;c<s.length;c+=3){var l=s[c+1];if(!(l<0||n>l+e-t)){var u=s[c]+e-t;r>=u?s[c+1]=n<=u?-2:-1:n>=e&&o&&(s[c]+=o,s[c+1]+=o)}}t+=o}),e=n.maps[l].map(e,-1),u=e},l=0,u=a;l<n.maps.length;l++)c(u);for(var d=!1,f=0;f<s.length;f+=3)if(s[f+1]<0){if(s[f+1]==-2){d=!0,s[f+1]=-1;continue}var p=n.map(e[f]+a),m=p-i;
20if(m<0||m>=r.content.size){d=!0;continue}var h=n.map(e[f+1]+a,-1)-i,g=r.content.findIndex(m),_=g.index,v=g.offset,y=r.maybeChild(_);if(y&&v==m&&v+y.nodeSize==h){var b=s[f+2].mapInner(n,y,p+1,e[f]+a+1,o);b==$?(s[f+1]=-2,d=!0):(s[f]=m,s[f+1]=h,s[f+2]=b)}else d=!0}if(d){var x=mr(dr(s,e,t,n,i,a,o),r,0,o);t=x.local;for(var S=0;S<s.length;S+=3)s[S+1]<0&&(s.splice(S,3),S-=3);for(var C=0,w=0;C<x.children.length;C+=3){for(var T=x.children[C];w<s.length&&s[w]<T;)w+=3;s.splice(w,0,x.children[C],x.children[C+1],x.children[C+2])}}return new sr(t.sort(hr),s)}function ur(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var i=e[r];n.push(new ir(i.from+t,i.to+t,i.type))}return n}function dr(e,t,n,r,i,a,o){function s(e,t){for(var a=0;a<e.local.length;a++){var c=e.local[a].map(r,i,t);c?n.push(c):o.onRemove&&o.onRemove(e.local[a].spec)}for(var l=0;l<e.children.length;l+=3)s(e.children[l+2],e.children[l]+t+1)}for(var c=0;c<e.length;c+=3)e[c+1]==-1&&s(e[c+2],t[c]+a+1);return n}function fr(e,t,n){if(t.isLeaf)return null;for(var r=n+t.nodeSize,i=null,a=0,o;a<e.length;a++)(o=e[a])&&o.from>n&&o.to<r&&((i||=[]).push(o),e[a]=null);return i}function pr(e){for(var t=[],n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function mr(e,t,n,r){var i=[],a=!1;t.forEach(function(t,o){var s=fr(e,t,o+n);if(s){a=!0;var c=mr(s,t,n+o+1,r);c!=$&&i.push(o,o+t.nodeSize,c)}});for(var o=ur(a?pr(e):e,-n).sort(hr),s=0;s<o.length;s++)o[s].type.valid(t,o[s])||(r.onRemove&&r.onRemove(o[s].spec),o.splice(s--,1));return o.length||i.length?new sr(o,i):$}function hr(e,t){return e.from-t.from||e.to-t.to}function gr(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var i=n+1;i<t.length;i++){var a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),_r(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),_r(t,i,r.copy(a.from,r.to)));break}}}return t}function _r(e,t,n){for(;t<e.length&&hr(n,e[t])>0;)t++;e.splice(t,0,n)}function vr(e){var t=[];return e.someProp(`decorations`,function(n){var r=n(e.state);r&&r!=$&&t.push(r)}),e.cursorWrapper&&t.push(sr.create(e.state.doc,[e.cursorWrapper.deco])),cr.from(t)}var yr={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},br=L&&R<=11,xr=function(){function e(){v(this,e),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return b(e,[{key:`set`,value:function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}},{key:`clear`,value:function(){this.anchorNode=this.focusNode=null}},{key:`eq`,value:function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}]),e}(),Sr=function(){function e(t,n){var r=this;v(this,e),this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new xr,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(function(e){for(var t=0;t<e.length;t++)r.queue.push(e[t]);L&&R<=11&&e.some(function(e){return e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length})?r.flushSoon():r.flush()}),br&&(this.onCharData=function(e){r.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),r.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}return b(e,[{key:`flushSoon`,value:function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(function(){e.flushingSoon=-1,e.flush()},20))}},{key:`forceFlush`,value:function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}},{key:`start`,value:function(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,yr)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}},{key:`stop`,value:function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout(function(){return e.flush()},20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}},{key:`connectSelection`,value:function(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}},{key:`disconnectSelection`,value:function(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}},{key:`suppressSelectionUpdates`,value:function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout(function(){return e.suppressingSelectionUpdates=!1},50)}},{key:`onSelectionChange`,value:function(){if(It(this.view)){if(this.suppressingSelectionUpdates)return Et(this.view);if(L&&R<=11&&!this.view.state.selection.empty){var e=this.view.domSelectionRange();if(e.focusNode&&j(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}}
20,{key:`setCurSelection`,value:function(){this.currentSelection.set(this.view.domSelectionRange())}},{key:`ignoreSelectionChange`,value:function(e){if(!e.focusNode)return!0;for(var t=new Set,n,r=e.focusNode;r;r=D(r))t.add(r);for(var i=e.anchorNode;i;i=D(i))if(t.has(i)){n=i;break}var a=n&&this.view.docView.nearestDesc(n);if(a&&a.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}},{key:`pendingRecords`,value:function(){if(this.observer){var e=a(this.observer.takeRecords()),t;try{for(e.s();!(t=e.n()).done;){var n=t.value;this.queue.push(n)}}catch(t){e.e(t)}finally{e.f()}}return this.queue}},{key:`flush`,value:function(){var e=this.view;if(!(!e.docView||this.flushingSoon>-1)){var n=this.pendingRecords();n.length&&(this.queue=[]);var r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&It(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,c=!1,l=[];if(e.editable)for(var u=0;u<n.length;u++){var d=this.registerMutation(n[u],l);d&&(o=o<0?d.from:Math.min(d.from,o),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(c=!0))}if(fe&&l.length){var f=l.filter(function(e){return e.nodeName==`BR`});if(f.length==2){var p=t(f,2),m=p[0],h=p[1];m.parentNode&&m.parentNode.parentNode==h.parentNode?h.remove():m.remove()}else{var g=this.currentSelection.focusNode,_=a(f),v;try{for(_.s();!(v=_.n()).done;){var y=v.value,b=y.parentNode;b&&b.nodeName==`LI`&&(!g||Or(e,g)!=b)&&y.remove()}}catch(e){_.e(e)}finally{_.f()}}}var x=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&F(r)&&(x=wt(e))&&x.eq(C.Selection.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Et(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Tr(e)),this.handleDOMChange(o,s,c,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Et(e),this.currentSelection.set(r))}}},{key:`registerMutation`,value:function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(var r=0;r<e.addedNodes.length;r++){var i=e.addedNodes[r];t.push(i),i.nodeType==3&&(this.lastChangedTextNode=i)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var a=e.previousSibling,o=e.nextSibling;if(L&&R<=11&&e.addedNodes.length)for(var s=0;s<e.addedNodes.length;s++){var c=e.addedNodes[s],l=c.previousSibling,u=c.nextSibling;(!l||Array.prototype.indexOf.call(e.addedNodes,l)<0)&&(a=l),(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(o=u)}var d=a&&a.parentNode==e.target?E(a)+1:0,f=n.localPosFromDOM(e.target,d,-1),p=o&&o.parentNode==e.target?E(o):e.target.childNodes.length;return{from:f,to:n.localPosFromDOM(e.target,p,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}]),e}(),Cr=new WeakMap,wr=!1;function Tr(e){if(!Cr.has(e)&&(Cr.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=fe,wr)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.`),wr=!0}}function Er(e,t){var n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);if(j(o.node,o.offset,i,a)){var s=[i,a,n,r];n=s[0],r=s[1],i=s[2],a=s[3]}return{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function Dr(e,t){if(t.getComposedRanges){var n=t.getComposedRanges(e.root)[0];if(n)return Er(e,n)}var r;function i(e){e.preventDefault(),e.stopImmediatePropagation(),r=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,i,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,i,!0),r?Er(e,r):null}function Or(e,t){for(var n=t.parentNode;n&&n!=e.dom;n=n.parentNode){var r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function kr(e,t,n){var r=e.docView.parseRange(t,n),i=r.node,a=r.fromOffset,o=r.toOffset,s=r.from,c=r.to,l=e.domSelectionRange(),u,d=l.anchorNode;
20if(d&&e.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:l.anchorOffset}],F(l)||u.push({node:l.focusNode,offset:l.focusOffset})),z&&e.input.lastKeyCode===8)for(var f=o;f>a;f--){var p=i.childNodes[f-1],m=p.pmViewDesc;if(p.nodeName==`BR`&&!m){o=f;break}if(!m||m.size)break}var h=e.state.doc,g=e.someProp(`domParser`)||w.DOMParser.fromSchema(e.state.schema),_=h.resolve(s),v=null,y=g.parse(i,{topNode:_.parent,topMatch:_.parent.contentMatchAt(_.index()),topOpen:!0,from:a,to:o,preserveWhitespace:_.parent.type.whitespace==`pre`?`full`:!0,findPositions:u,ruleFromNode:Ar,context:_});if(u&&u[0].pos!=null){var b=u[0].pos,x=u[1]&&u[1].pos;x??=b,v={anchor:b+s,head:x+s}}return{doc:y,sel:v,from:s,to:c}}function Ar(e){var t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(B&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement(`div`);return n.appendChild(document.createElement(`li`)),{skip:n}}else if(e.parentNode.lastChild==e||B&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName==`IMG`&&e.getAttribute(`mark-placeholder`))return{ignore:!0};return null}var jr=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Mr(e,t,n,r,i){var a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){var o=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,s=wt(e,o);if(s&&!e.state.selection.eq(s)){if(z&&ve&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,function(t){return t(e,I(13,`Enter`))}))return;var c=e.state.tr.setSelection(s);o==`pointer`?c.setMeta(`pointer`,!0):o==`key`&&c.scrollIntoView(),a&&c.setMeta(`composition`,a),e.dispatch(c)}return}var l=e.state.doc.resolve(t),u=l.sharedDepth(n);t=l.before(u+1),n=e.state.doc.resolve(n).after(u+1);var d=e.state.selection,f=kr(e,t,n),p=e.state.doc,m=p.slice(f.from,f.to),h,g;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(h=e.state.selection.to,g=`end`):(h=e.state.selection.from,g=`start`),e.input.lastKeyCode=null;var _=Lr(m.content,f.doc.content,f.from,h,g);if(_&&e.input.domChangeCount++,(he&&e.input.lastIOSEnter>Date.now()-225||ve)&&i.some(function(e){return e.nodeType==1&&!jr.test(e.nodeName)})&&(!_||_.endA>=_.endB)&&e.someProp(`handleKeyDown`,function(t){return t(e,I(13,`Enter`))})){e.input.lastIOSEnter=0;return}if(!_)if(r&&d instanceof C.TextSelection&&!d.empty&&d.$head.sameParent(d.$anchor)&&!e.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))_={start:d.from,endA:d.to,endB:d.to};else{if(f.sel){var v=Nr(e,e.state.doc,f.sel);if(v&&!v.eq(e.state.selection)){var y=e.state.tr.setSelection(v);a&&y.setMeta(`composition`,a),e.dispatch(y)}}return}e.state.selection.from<e.state.selection.to&&_.start==_.endB&&e.state.selection instanceof C.TextSelection&&(_.start>e.state.selection.from&&_.start<=e.state.selection.from+2&&e.state.selection.from>=f.from?_.start=e.state.selection.from:_.endA<e.state.selection.to&&_.endA>=e.state.selection.to-2&&e.state.selection.to<=f.to&&(_.endB+=e.state.selection.to-_.endA,_.endA=e.state.selection.to)),L&&R<=11&&_.endB==_.start+1&&_.endA==_.start&&_.start>f.from&&f.doc.textBetween(_.start-f.from-1,_.start-f.from+1)==` \xA0`&&(_.start--,_.endA--,_.endB--);var b=f.doc.resolveNoCache(_.start-f.from),x=f.doc.resolveNoCache(_.endB-f.from),S=p.resolve(_.start),w=b.sameParent(x)&&b.parent.inlineContent&&S.end()>=_.endA,T;if((he&&e.input.lastIOSEnter>Date.now()-225&&(!w||i.some(function(e){return e.nodeName==`DIV`||e.nodeName==`P`}))||!w&&b.pos<f.doc.content.size&&!b.sameParent(x)&&(T=C.Selection.findFrom(f.doc.resolve(b.pos+1),1,!0))&&T.head==x.pos)&&e.someProp(`handleKeyDown`,function(t){return t(e,I(13,`Enter`))})){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>_.start&&Fr(p,_.start,_.endA,b,x)&&e.someProp(`handleKeyDown`,function(t){return t(e,I(8,`Backspace`))})){ve&&z&&e.domObserver.suppressSelectionUpdates();return}
20z&&_.endB==_.start&&(e.input.lastChromeDelete=Date.now()),ve&&!w&&b.start()!=x.start()&&x.parentOffset==0&&b.depth==x.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==_.endA&&(_.endB-=2,x=f.doc.resolveNoCache(_.endB-f.from),setTimeout(function(){e.someProp(`handleKeyDown`,function(t){return t(e,I(13,`Enter`))})},20));var E=_.start,D=_.endA,O,k,A;if(w){if(b.pos==x.pos)L&&R<=11&&b.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(function(){return Et(e)},20)),O=e.state.tr.delete(E,D),k=p.resolve(_.start).marksAcross(p.resolve(_.endA));else if(_.endA==_.endB&&(A=Pr(b.parent.content.cut(b.parentOffset,x.parentOffset),S.parent.content.cut(S.parentOffset,_.endA-S.start()))))O=e.state.tr,A.type==`add`?O.addMark(E,D,A.mark):O.removeMark(E,D,A.mark);else if(b.parent.child(b.index()).isText&&b.index()==x.index()-(x.textOffset?0:1)){var j=b.parent.textBetween(b.parentOffset,x.parentOffset);if(e.someProp(`handleTextInput`,function(t){return t(e,E,D,j)}))return;O=e.state.tr.insertText(j,E,D)}}if(O||=e.state.tr.replace(E,D,f.doc.slice(_.start-f.from,_.endB-f.from)),f.sel){var M=Nr(e,O.doc,f.sel);M&&!(z&&e.composing&&M.empty&&(_.start!=_.endB||e.input.lastChromeDelete<Date.now()-100)&&(M.head==E||M.head==O.mapping.map(D)-1)||L&&M.empty&&M.head==E)&&O.setSelection(M)}k&&O.ensureMarks(k),a&&O.setMeta(`composition`,a),e.dispatch(O.scrollIntoView())}function Nr(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Ft(e,t.resolve(n.anchor),t.resolve(n.head))}function Pr(e,t){for(var n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c,l=0;l<r.length;l++)i=r[l].removeFromSet(i);for(var u=0;u<n.length;u++)a=n[u].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=function(e){return e.mark(s.addToSet(e.marks))};else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=function(e){return e.mark(s.removeFromSet(e.marks))};else return null;for(var d=[],f=0;f<t.childCount;f++)d.push(c(t.child(f)));if(w.Fragment.from(d).eq(e))return{mark:s,type:o}}function Fr(e,t,n,r,i){if(n-t<=i.pos-r.pos||Ir(r,!0,!1)<i.pos)return!1;var a=e.resolve(t);if(!r.parent.isTextblock){var o=a.nodeAfter;return o!=null&&n==t+o.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;var s=e.resolve(Ir(a,!0,!0));return!s.parent.isTextblock||s.pos>n||Ir(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Ir(e,t,n){for(var r=e.depth,i=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n)for(var a=e.node(r).maybeChild(e.indexAfter(r));a&&!a.isLeaf;)a=a.firstChild,i++;return i}function Lr(e,t,n,r,i){var a=e.findDiffStart(t,n);if(a==null)return null;var o=e.findDiffEnd(t,n+e.size,n+t.size),s=o.a,c=o.b;if(i==`end`){var l=Math.max(0,a-Math.min(s,c));r-=s+l-a}if(s<a&&e.size<t.size){var u=r<=a&&r>=s?a-r:0;a-=u,a&&a<t.size&&Rr(t.textBetween(a-1,a+1))&&(a+=u?1:-1),c=a+(c-s),s=a}else if(c<a){var d=r<=a&&r>=c?a-r:0;a-=d,a&&a<e.size&&Rr(e.textBetween(a-1,a+1))&&(a+=d?1:-1),s=a+(s-c),c=a}return{start:a,endA:s,endB:c}}function Rr(e){if(e.length!=2)return!1;var t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var zr=tn,Br=nn,Vr=Q,Hr=function(){function e(t,n){var r=this;v(this,e),this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new yn,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Yr),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement(`div`),t&&(t.appendChild?t.appendChild(this.dom):typeof t==`function`?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=Gr(this),Wr(this),this.nodeViews=qr(this),this.docView=it(this.state.doc,Ur(this),vr(this),this.dom,this),this.domObserver=new Sr(this,function(e,t,n,i){return Mr(r,e,t,n,i)}),this.domObserver.start(),bn(this),this.updatePluginViews()}return b(e,[{key:`composing`,get:function(){return this.input.composing}},{key:`props`,get:function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}},{key:`update`,value:function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Cn(this);var t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Yr),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}},{key:`setProps`,value:function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)}},{key:`updateState`,value:function(e){this.updateStateInner(e,this._props)}},{key:`updateStateInner`,value:function(e,t){var n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(Hn(this),i=!0),this.state=e;var a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){var o=qr(this);Jr(o,this.nodeViews)&&(this.nodeViews=o,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Cn(this),this.editable=Gr(this),Wr(this);var s=vr(this),c=Ur(this),l=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,u=r||!this.docView.matchesNode(e.doc,c,s);(u||!e.selection.eq(n.selection))&&(i=!0);var d=l==`preserve`&&i&&this.dom.style.overflowAnchor==null&&Te(this);if(i){this.domObserver.stop();var f=u&&(L||z)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&Kr(n.selection,e.selection);if(u){var p=z?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Un(this)),(r||!this.docView.update(e.doc,c,s,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=it(e.doc,c,s,this.dom,this)),p&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Rt(this))?Et(this,f):(Nt(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),l==`reset`?this.dom.scrollTop=0:l==`to selection`?this.scrollToSelection():d&&De(d)}},{key:`scrollToSelection`,value:function(){var e=this,t=this.domSelectionRange().focusNode;if(!this.someProp(`handleScrollToSelection`,function(t){return t(e)}))if(this.state.selection instanceof C.NodeSelection){var n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&we(this,n.getBoundingClientRect(),t)}else we(this,this.coordsAtPos(this.state.selection.head,1),t)}},{key:`destroyPluginViews`,value:function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()}},{key:`updatePluginViews`,value:function(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var t=0;t<this.directPlugins.length;t++){var n=this.directPlugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(var r=0;r<this.state.plugins.length;r++){var i=this.state.plugins[r];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}else for(var a=0;a<this.pluginViews.length;a++){var o=this.pluginViews[a];o.update&&o.update(this,e)}}},{key:`updateDraggedNode`,value:function(e,t){var n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;
20else{var i=n.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==n.node&&(r=i)}this.dragging=new Zn(e.slice,e.move,r<0?void 0:C.NodeSelection.create(this.state.doc,r))}},{key:`someProp`,value:function(e,t){var n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(var i=0;i<this.directPlugins.length;i++){var a=this.directPlugins[i].props[e];if(a!=null&&(r=t?t(a):a))return r}var o=this.state.plugins;if(o)for(var s=0;s<o.length;s++){var c=o[s].props[e];if(c!=null&&(r=t?t(c):c))return r}}},{key:`hasFocus`,value:function(){if(L){var e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}},{key:`focus`,value:function(){this.domObserver.stop(),this.editable&&Ae(this.dom),Et(this),this.domObserver.start()}},{key:`root`,get:function(){var e=this,t=this._root;if(t==null){for(var n=function(t){if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return t.ownerDocument.getSelection()}),{v:e._root=t}},r,i=this.dom.parentNode;i;i=i.parentNode)if(r=n(i),r)return r.v}return t||document}},{key:`updateRoot`,value:function(){this._root=null}},{key:`posAtCoords`,value:function(e){return Re(this,e)}},{key:`coordsAtPos`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return He(this,e,t)}},{key:`domAtPos`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return this.docView.domFromPos(e,t)}},{key:`nodeDOM`,value:function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null}},{key:`posAtDOM`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-1,r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}},{key:`endOfTextblock`,value:function(e,t){return H(this,t||this.state,e)}},{key:`pasteHTML`,value:function(e,t){return Yn(this,``,e,!1,t||new ClipboardEvent(`paste`))}},{key:`pasteText`,value:function(e,t){return Yn(this,e,null,!0,t||new ClipboardEvent(`paste`))}},{key:`destroy`,value:function(){this.docView&&(Sn(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],vr(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,A())}},{key:`isDestroyed`,get:function(){return this.docView==null}},{key:`dispatchEvent`,value:function(e){return En(this,e)}},{key:`dispatch`,value:function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}},{key:`domSelectionRange`,value:function(){var e=this.domSelection();return e?B&&this.root.nodeType===11&&ie(this.dom.ownerDocument)==this.dom&&Dr(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}},{key:`domSelection`,value:function(){return this.root.getSelection()}}]),e}();function Ur(e){var t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,function(n){if(typeof n==`function`&&(n=n(e.state)),n)for(var r in n)r==`class`?t.class+=` `+n[r]:r==`style`?t.style=(t.style?t.style+`;`:``)+n[r]:!t[r]&&r!=`contenteditable`&&r!=`nodeName`&&(t[r]=String(n[r]))}),t.translate||=`no`,[ir.node(0,e.state.doc.content.size,t)]}function Wr(e){if(e.markCursor){var t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:ir.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Gr(e){return!e.someProp(`editable`,function(t){return t(e.state)===!1})}function Kr(e,t){var n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function qr(e){var t=Object.create(null);function n(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}
20return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function Jr(e,t){var n=0,r=0;for(var i in e){if(e[i]!=t[i])return!0;n++}for(var a in t)r++;return n!=r}function Yr(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}e.Decoration=ir,e.DecorationSet=sr,e.EditorView=Hr,e.__endComposition=Vr,e.__parseFromClipboard=Br,e.__serializeForClipboard=zr}));export{i as A,Dt as C,Ot as D,st as E,u as F,k as M,D as N,_e as O,me as P,yt as S,wt as T,Qe as _,Va as a,Kt as b,$t as c,mn as d,_n as f,Ye as g,K as h,No as i,c as j,je as k,fn as l,Jt as m,Fo as n,Wa as o,G as p,Po as r,wo as s,Io as t,q as u,tt as v,lt as w,xt as x,W as y};
21//# sourceMappingURL=vendor-prosemirror-core-BRjRA0uN.js.map

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.