74 lines
293 KiB
JavaScript
74 lines
293 KiB
JavaScript
import{bo as Pa,bp as za,aZ as lr,g as zr,W as Kn,aB as Br,bq as ve,br as Ba,al as La,bn as Fa,m as Va,bs as Ha,F as ja,bt as qa,bu as Ja,X as wt,o as gt,c as St,b as T,Y as Wa,bv as Ka,bw as $a,bx as Ua,bf as Ga,z as Ya,a8 as Xa,r as X,n as Qa,w as en,a as F,H as B,I as Za}from"./main-vzIkKseS.js";function ut(e){this.content=e}ut.prototype={constructor:ut,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 n=r&&r!=e?this.remove(r):this,o=n.find(e),i=n.content.slice();return o==-1?i.push(r||e,t):(i[o+1]=t,r&&(i[o]=r)),new ut(i)},remove:function(e){var t=this.find(e);if(t==-1)return this;var r=this.content.slice();return r.splice(t,2),new ut(r)},addToStart:function(e,t){return new ut([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var r=this.remove(e).content.slice();return r.push(e,t),new ut(r)},addBefore:function(e,t,r){var n=this.remove(t),o=n.content.slice(),i=n.find(e);return o.splice(i==-1?o.length:i,0,t,r),new ut(o)},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=ut.from(e),e.size?new ut(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=ut.from(e),e.size?new ut(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=ut.from(e);for(var r=0;r<e.content.length;r+=2)t=t.remove(e.content[r]);return t},get size(){return this.content.length>>1}};ut.from=function(e){if(e instanceof ut)return e;var t=[];if(e)for(var r in e)t.push(r,e[r]);return new ut(t)};var Fo=ut;function Ii(e,t,r){for(var n=0;;n++){if(n==e.childCount||n==t.childCount)return e.childCount==t.childCount?null:r;var o=e.child(n),i=t.child(n);if(o==i){r+=o.nodeSize;continue}if(!o.sameMarkup(i))return r;if(o.isText&&o.text!=i.text){for(var s=0;o.text[s]==i.text[s];s++)r++;return r}if(o.content.size||i.content.size){var a=Ii(o.content,i.content,r+1);if(a!=null)return a}r+=o.nodeSize}}function Ri(e,t,r,n){for(var o=e.childCount,i=t.childCount;;){if(o==0||i==0)return o==i?null:{a:r,b:n};var s=e.child(--o),a=t.child(--i),c=s.nodeSize;if(s==a){r-=c,n-=c;continue}if(!s.sameMarkup(a))return{a:r,b:n};if(s.isText&&s.text!=a.text){for(var l=0,u=Math.min(s.text.length,a.text.length);l<u&&s.text[s.text.length-l-1]==a.text[a.text.length-l-1];)l++,r--,n--;return{a:r,b:n}}if(s.content.size||a.content.size){var f=Ri(s.content,a.content,r-1,n-1);if(f)return f}r-=c,n-=c}}var k=function(t,r){if(this.content=t,this.size=r||0,r==null)for(var n=0;n<t.length;n++)this.size+=t[n].nodeSize},Lr={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};k.prototype.nodesBetween=function(t,r,n,o,i){o===void 0&&(o=0);for(var s=0,a=0;a<r;s++){var c=this.content[s],l=a+c.nodeSize;if(l>t&&n(c,o+a,i,s)!==!1&&c.content.size){var u=a+1;c.nodesBetween(Math.max(0,t-u),Math.min(c.content.size,r-u),n,o+u)}a=l}};k.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)};k.prototype.textBetween=function(t,r,n,o){var i="",s=!0;return this.nodesBetween(t,r,function(a,c){a.isText?(i+=a.text.slice(Math.max(t,c)-c,r-c),s=!n):a.isLeaf&&o?(i+=o,s=!n):!s&&a.isBlock&&(i+=n,s=!0)},0),i};k.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var r=this.lastChild,n=t.firstChild,o=this.content.slice(),i=0;for(r.isText&&r.sameMarkup(n)&&(o[o.length-1]=r.withText(r.text+n.text),i=1);i<t.content.length;i++)o.push(t.content[i]);return new k(o,this.size+t.size)};k.prototype.cut=function(t,r){if(r==null&&(r=this.size),t==0&&r==this.size)return this;var n=[],o=0;if(r>t)for(var i=0,s=0;s<r;i++){var a=this.content[i],c=s+a.nodeSize;c>t&&((s<t||c>r)&&(a.isText?a=a.cut(Math.max(0,t-s),Math.min(a.text.length,r-s)):a=a.cut(Math.max(0,t-s-1),Math.min(a.content.size,r-s-1))),n.push(a),o+=a.nodeSize),s=c}return new k(n,o)};k.prototype.cutByIndex=function(t,r){return t==r?k.empty:t==0&&r==this.content.length?this:new k(this.content.slice(t,r))};k.prototype.replaceChild=function(t,r){var n=this.content[t];if(n==r)return this;var o=this.content.slice(),i=this.size+r.nodeSize-n.nodeSize;return o[t]=r,new k(o,i)};k.prototype.addToStart=function(t){return new k([t].concat(this.content),this.size+t.nodeSize)};k.prototype.addToEnd=function(t){return new k(this.content.concat(t),this.size+t.nodeSize)};k.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var r=0;r<this.content.length;r++)if(!this.content[r].eq(t.content[r]))return!1;return!0};Lr.firstChild.get=function(){return this.content.length?this.content[0]:null};Lr.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null};Lr.childCount.get=function(){return this.content.length};k.prototype.child=function(t){var r=this.content[t];if(!r)throw new RangeError("Index "+t+" out of range for "+this);return r};k.prototype.maybeChild=function(t){return this.content[t]};k.prototype.forEach=function(t){for(var r=0,n=0;r<this.content.length;r++){var o=this.content[r];t(o,n,r),n+=o.nodeSize}};k.prototype.findDiffStart=function(t,r){return r===void 0&&(r=0),Ii(this,t,r)};k.prototype.findDiffEnd=function(t,r,n){return r===void 0&&(r=this.size),n===void 0&&(n=t.size),Ri(this,t,r,n)};k.prototype.findIndex=function(t,r){if(r===void 0&&(r=-1),t==0)return yr(0,t);if(t==this.size)return yr(this.content.length,t);if(t>this.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var n=0,o=0;;n++){var i=this.child(n),s=o+i.nodeSize;if(s>=t)return s==t||r>0?yr(n+1,s):yr(n,o);o=s}};k.prototype.toString=function(){return"<"+this.toStringInner()+">"};k.prototype.toStringInner=function(){return this.content.join(", ")};k.prototype.toJSON=function(){return this.content.length?this.content.map(function(t){return t.toJSON()}):null};k.fromJSON=function(t,r){if(!r)return k.empty;if(!Array.isArray(r))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(r.map(t.nodeFromJSON))};k.fromArray=function(t){if(!t.length)return k.empty;for(var r,n=0,o=0;o<t.length;o++){var i=t[o];n+=i.nodeSize,o&&i.isText&&t[o-1].sameMarkup(i)?(r||(r=t.slice(0,o)),r[r.length-1]=i.withText(r[r.length-1].text+i.text)):r&&r.push(i)}return new k(r||t,n)};k.from=function(t){if(!t)return k.empty;if(t instanceof k)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new k([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))};Object.defineProperties(k.prototype,Lr);var rn={index:0,offset:0};function yr(e,t){return rn.index=e,rn.offset=t,rn}k.empty=new k([],0);function Cr(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;var r=Array.isArray(e);if(Array.isArray(t)!=r)return!1;if(r){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!Cr(e[n],t[n]))return!1}else{for(var o in e)if(!(o in t)||!Cr(e[o],t[o]))return!1;for(var i in t)if(!(i in e))return!1}return!0}var R=function(t,r){this.type=t,this.attrs=r};R.prototype.addToSet=function(t){for(var r,n=!1,o=0;o<t.length;o++){var i=t[o];if(this.eq(i))return t;if(this.type.excludes(i.type))r||(r=t.slice(0,o));else{if(i.type.excludes(this.type))return t;!n&&i.type.rank>this.type.rank&&(r||(r=t.slice(0,o)),r.push(this),n=!0),r&&r.push(i)}}return r||(r=t.slice()),n||r.push(this),r};R.prototype.removeFromSet=function(t){for(var r=0;r<t.length;r++)if(this.eq(t[r]))return t.slice(0,r).concat(t.slice(r+1));return t};R.prototype.isInSet=function(t){for(var r=0;r<t.length;r++)if(this.eq(t[r]))return!0;return!1};R.prototype.eq=function(t){return this==t||this.type==t.type&&Cr(this.attrs,t.attrs)};R.prototype.toJSON=function(){var t={type:this.type.name};for(var r in this.attrs){t.attrs=this.attrs;break}return t};R.fromJSON=function(t,r){if(!r)throw new RangeError("Invalid input for Mark.fromJSON");var n=t.marks[r.type];if(!n)throw new RangeError("There is no mark type "+r.type+" in this schema");return n.create(r.attrs)};R.sameSet=function(t,r){if(t==r)return!0;if(t.length!=r.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].eq(r[n]))return!1;return!0};R.setFrom=function(t){if(!t||t.length==0)return R.none;if(t instanceof R)return[t];var r=t.slice();return r.sort(function(n,o){return n.type.rank-o.type.rank}),r};R.none=[];function Wt(e){var t=Error.call(this,e);return t.__proto__=Wt.prototype,t}Wt.prototype=Object.create(Error.prototype);Wt.prototype.constructor=Wt;Wt.prototype.name="ReplaceError";var x=function(t,r,n){this.content=t,this.openStart=r,this.openEnd=n},Pi={size:{configurable:!0}};Pi.size.get=function(){return this.content.size-this.openStart-this.openEnd};x.prototype.insertAt=function(t,r){var n=Bi(this.content,t+this.openStart,r,null);return n&&new x(n,this.openStart,this.openEnd)};x.prototype.removeBetween=function(t,r){return new x(zi(this.content,t+this.openStart,r+this.openStart),this.openStart,this.openEnd)};x.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd};x.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"};x.prototype.toJSON=function(){if(!this.content.size)return null;var t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t};x.fromJSON=function(t,r){if(!r)return x.empty;var n=r.openStart||0,o=r.openEnd||0;if(typeof n!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new x(k.fromJSON(t,r.content),n,o)};x.maxOpen=function(t,r){r===void 0&&(r=!0);for(var n=0,o=0,i=t.firstChild;i&&!i.isLeaf&&(r||!i.type.spec.isolating);i=i.firstChild)n++;for(var s=t.lastChild;s&&!s.isLeaf&&(r||!s.type.spec.isolating);s=s.lastChild)o++;return new x(t,n,o)};Object.defineProperties(x.prototype,Pi);function zi(e,t,r){var n=e.findIndex(t),o=n.index,i=n.offset,s=e.maybeChild(o),a=e.findIndex(r),c=a.index,l=a.offset;if(i==t||s.isText){if(l!=r&&!e.child(c).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(r))}if(o!=c)throw new RangeError("Removing non-flat range");return e.replaceChild(o,s.copy(zi(s.content,t-i-1,r-i-1)))}function Bi(e,t,r,n){var o=e.findIndex(t),i=o.index,s=o.offset,a=e.maybeChild(i);if(s==t||a.isText)return n&&!n.canReplace(i,i,r)?null:e.cut(0,t).append(r).append(e.cut(t));var c=Bi(a.content,t-s-1,r);return c&&e.replaceChild(i,a.copy(c))}x.empty=new x(k.empty,0,0);function tc(e,t,r){if(r.openStart>e.depth)throw new Wt("Inserted content deeper than insertion position");if(e.depth-r.openStart!=t.depth-r.openEnd)throw new Wt("Inconsistent open depths");return Li(e,t,r,0)}function Li(e,t,r,n){var o=e.index(n),i=e.node(n);if(o==t.index(n)&&n<e.depth-r.openStart){var s=Li(e,t,r,n+1);return i.copy(i.content.replaceChild(o,s))}else if(r.content.size)if(!r.openStart&&!r.openEnd&&e.depth==n&&t.depth==n){var a=e.parent,c=a.content;return ye(a,c.cut(0,e.parentOffset).append(r.content).append(c.cut(t.parentOffset)))}else{var l=ec(r,e),u=l.start,f=l.end;return ye(i,Vi(e,u,f,t,n))}else return ye(i,Or(e,t,n))}function Fi(e,t){if(!t.type.compatibleContent(e.type))throw new Wt("Cannot join "+t.type.name+" onto "+e.type.name)}function wn(e,t,r){var n=e.node(r);return Fi(n,t.node(r)),n}function ge(e,t){var r=t.length-1;r>=0&&e.isText&&e.sameMarkup(t[r])?t[r]=e.withText(t[r].text+e.text):t.push(e)}function Ke(e,t,r,n){var o=(t||e).node(r),i=0,s=t?t.index(r):o.childCount;e&&(i=e.index(r),e.depth>r?i++:e.textOffset&&(ge(e.nodeAfter,n),i++));for(var a=i;a<s;a++)ge(o.child(a),n);t&&t.depth==r&&t.textOffset&&ge(t.nodeBefore,n)}function ye(e,t){if(!e.type.validContent(t))throw new Wt("Invalid content for node "+e.type.name);return e.copy(t)}function Vi(e,t,r,n,o){var i=e.depth>o&&wn(e,t,o+1),s=n.depth>o&&wn(r,n,o+1),a=[];return Ke(null,e,o,a),i&&s&&t.index(o)==r.index(o)?(Fi(i,s),ge(ye(i,Vi(e,t,r,n,o+1)),a)):(i&&ge(ye(i,Or(e,t,o+1)),a),Ke(t,r,o,a),s&&ge(ye(s,Or(r,n,o+1)),a)),Ke(n,null,o,a),new k(a)}function Or(e,t,r){var n=[];if(Ke(null,e,r,n),e.depth>r){var o=wn(e,t,r+1);ge(ye(o,Or(e,t,r+1)),n)}return Ke(t,null,r,n),new k(n)}function ec(e,t){for(var r=t.depth-e.openStart,n=t.node(r),o=n.copy(e.content),i=r-1;i>=0;i--)o=t.node(i).copy(k.from(o));return{start:o.resolveNoCache(e.openStart+r),end:o.resolveNoCache(o.content.size-e.openEnd-r)}}var K=function(t,r,n){this.pos=t,this.path=r,this.depth=r.length/3-1,this.parentOffset=n},Le={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};K.prototype.resolveDepth=function(t){return t==null?this.depth:t<0?this.depth+t:t};Le.parent.get=function(){return this.node(this.depth)};Le.doc.get=function(){return this.node(0)};K.prototype.node=function(t){return this.path[this.resolveDepth(t)*3]};K.prototype.index=function(t){return this.path[this.resolveDepth(t)*3+1]};K.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)};K.prototype.start=function(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1};K.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size};K.prototype.before=function(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]};K.prototype.after=function(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize};Le.textOffset.get=function(){return this.pos-this.path[this.path.length-1]};Le.nodeAfter.get=function(){var e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;var r=this.pos-this.path[this.path.length-1],n=e.child(t);return r?e.child(t).cut(r):n};Le.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)};K.prototype.posAtIndex=function(t,r){r=this.resolveDepth(r);for(var n=this.path[r*3],o=r==0?0:this.path[r*3-1]+1,i=0;i<t;i++)o+=n.child(i).nodeSize;return o};K.prototype.marks=function(){var t=this.parent,r=this.index();if(t.content.size==0)return R.none;if(this.textOffset)return t.child(r).marks;var n=t.maybeChild(r-1),o=t.maybeChild(r);if(!n){var i=n;n=o,o=i}for(var s=n.marks,a=0;a<s.length;a++)s[a].type.spec.inclusive===!1&&(!o||!s[a].isInSet(o.marks))&&(s=s[a--].removeFromSet(s));return s};K.prototype.marksAcross=function(t){var r=this.parent.maybeChild(this.index());if(!r||!r.isInline)return null;for(var n=r.marks,o=t.parent.maybeChild(t.index()),i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!o||!n[i].isInSet(o.marks))&&(n=n[i--].removeFromSet(n));return n};K.prototype.sharedDepth=function(t){for(var r=this.depth;r>0;r--)if(this.start(r)<=t&&this.end(r)>=t)return r;return 0};K.prototype.blockRange=function(t,r){if(t===void 0&&(t=this),t.pos<this.pos)return t.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!r||r(this.node(n))))return new Ze(this,t,n)};K.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset};K.prototype.max=function(t){return t.pos>this.pos?t:this};K.prototype.min=function(t){return t.pos<this.pos?t:this};K.prototype.toString=function(){for(var t="",r=1;r<=this.depth;r++)t+=(t?"/":"")+this.node(r).type.name+"_"+this.index(r-1);return t+":"+this.parentOffset};K.resolve=function(t,r){if(!(r>=0&&r<=t.content.size))throw new RangeError("Position "+r+" out of range");for(var n=[],o=0,i=r,s=t;;){var a=s.content.findIndex(i),c=a.index,l=a.offset,u=i-l;if(n.push(s,c,o+l),!u||(s=s.child(c),s.isText))break;i=u-1,o+=l+1}return new K(r,n,i)};K.resolveCached=function(t,r){for(var n=0;n<nn.length;n++){var o=nn[n];if(o.pos==r&&o.doc==t)return o}var i=nn[on]=K.resolve(t,r);return on=(on+1)%rc,i};Object.defineProperties(K.prototype,Le);var nn=[],on=0,rc=12,Ze=function(t,r,n){this.$from=t,this.$to=r,this.depth=n},Fe={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};Fe.start.get=function(){return this.$from.before(this.depth+1)};Fe.end.get=function(){return this.$to.after(this.depth+1)};Fe.parent.get=function(){return this.$from.node(this.depth)};Fe.startIndex.get=function(){return this.$from.index(this.depth)};Fe.endIndex.get=function(){return this.$to.indexAfter(this.depth)};Object.defineProperties(Ze.prototype,Fe);var nc=Object.create(null),P=function(t,r,n,o){this.type=t,this.attrs=r,this.content=n||k.empty,this.marks=o||R.none},Tt={nodeSize:{configurable:!0},childCount:{configurable:!0},textContent:{configurable:!0},firstChild:{configurable:!0},lastChild:{configurable:!0},isBlock:{configurable:!0},isTextblock:{configurable:!0},inlineContent:{configurable:!0},isInline:{configurable:!0},isText:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};Tt.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size};Tt.childCount.get=function(){return this.content.childCount};P.prototype.child=function(t){return this.content.child(t)};P.prototype.maybeChild=function(t){return this.content.maybeChild(t)};P.prototype.forEach=function(t){this.content.forEach(t)};P.prototype.nodesBetween=function(t,r,n,o){o===void 0&&(o=0),this.content.nodesBetween(t,r,n,o,this)};P.prototype.descendants=function(t){this.nodesBetween(0,this.content.size,t)};Tt.textContent.get=function(){return this.textBetween(0,this.content.size,"")};P.prototype.textBetween=function(t,r,n,o){return this.content.textBetween(t,r,n,o)};Tt.firstChild.get=function(){return this.content.firstChild};Tt.lastChild.get=function(){return this.content.lastChild};P.prototype.eq=function(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)};P.prototype.sameMarkup=function(t){return this.hasMarkup(t.type,t.attrs,t.marks)};P.prototype.hasMarkup=function(t,r,n){return this.type==t&&Cr(this.attrs,r||t.defaultAttrs||nc)&&R.sameSet(this.marks,n||R.none)};P.prototype.copy=function(t){return t===void 0&&(t=null),t==this.content?this:new this.constructor(this.type,this.attrs,t,this.marks)};P.prototype.mark=function(t){return t==this.marks?this:new this.constructor(this.type,this.attrs,this.content,t)};P.prototype.cut=function(t,r){return t==0&&r==this.content.size?this:this.copy(this.content.cut(t,r))};P.prototype.slice=function(t,r,n){if(r===void 0&&(r=this.content.size),n===void 0&&(n=!1),t==r)return x.empty;var o=this.resolve(t),i=this.resolve(r),s=n?0:o.sharedDepth(r),a=o.start(s),c=o.node(s),l=c.content.cut(o.pos-a,i.pos-a);return new x(l,o.depth-s,i.depth-s)};P.prototype.replace=function(t,r,n){return tc(this.resolve(t),this.resolve(r),n)};P.prototype.nodeAt=function(t){for(var r=this;;){var n=r.content.findIndex(t),o=n.index,i=n.offset;if(r=r.maybeChild(o),!r)return null;if(i==t||r.isText)return r;t-=i+1}};P.prototype.childAfter=function(t){var r=this.content.findIndex(t),n=r.index,o=r.offset;return{node:this.content.maybeChild(n),index:n,offset:o}};P.prototype.childBefore=function(t){if(t==0)return{node:null,index:0,offset:0};var r=this.content.findIndex(t),n=r.index,o=r.offset;if(o<t)return{node:this.content.child(n),index:n,offset:o};var i=this.content.child(n-1);return{node:i,index:n-1,offset:o-i.nodeSize}};P.prototype.resolve=function(t){return K.resolveCached(this,t)};P.prototype.resolveNoCache=function(t){return K.resolve(this,t)};P.prototype.rangeHasMark=function(t,r,n){var o=!1;return r>t&&this.nodesBetween(t,r,function(i){return n.isInSet(i.marks)&&(o=!0),!o}),o};Tt.isBlock.get=function(){return this.type.isBlock};Tt.isTextblock.get=function(){return this.type.isTextblock};Tt.inlineContent.get=function(){return this.type.inlineContent};Tt.isInline.get=function(){return this.type.isInline};Tt.isText.get=function(){return this.type.isText};Tt.isLeaf.get=function(){return this.type.isLeaf};Tt.isAtom.get=function(){return this.type.isAtom};P.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),Hi(this.marks,t)};P.prototype.contentMatchAt=function(t){var r=this.type.contentMatch.matchFragment(this.content,0,t);if(!r)throw new Error("Called contentMatchAt on a node with invalid content");return r};P.prototype.canReplace=function(t,r,n,o,i){n===void 0&&(n=k.empty),o===void 0&&(o=0),i===void 0&&(i=n.childCount);var s=this.contentMatchAt(t).matchFragment(n,o,i),a=s&&s.matchFragment(this.content,r);if(!a||!a.validEnd)return!1;for(var c=o;c<i;c++)if(!this.type.allowsMarks(n.child(c).marks))return!1;return!0};P.prototype.canReplaceWith=function(t,r,n,o){if(o&&!this.type.allowsMarks(o))return!1;var i=this.contentMatchAt(t).matchType(n),s=i&&i.matchFragment(this.content,r);return s?s.validEnd:!1};P.prototype.canAppend=function(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)};P.prototype.check=function(){if(!this.type.validContent(this.content))throw new RangeError("Invalid content for node "+this.type.name+": "+this.content.toString().slice(0,50));for(var t=R.none,r=0;r<this.marks.length;r++)t=this.marks[r].addToSet(t);if(!R.sameSet(t,this.marks))throw new RangeError("Invalid collection of marks for node "+this.type.name+": "+this.marks.map(function(n){return n.type.name}));this.content.forEach(function(n){return n.check()})};P.prototype.toJSON=function(){var t={type:this.type.name};for(var r in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(function(n){return n.toJSON()})),t};P.fromJSON=function(t,r){if(!r)throw new RangeError("Invalid input for Node.fromJSON");var n=null;if(r.marks){if(!Array.isArray(r.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=r.marks.map(t.markFromJSON)}if(r.type=="text"){if(typeof r.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(r.text,n)}var o=k.fromJSON(t,r.content);return t.nodeType(r.type).create(r.attrs,o,n)};Object.defineProperties(P.prototype,Tt);var oc=function(e){function t(n,o,i,s){if(e.call(this,n,o,null,s),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={textContent:{configurable:!0},nodeSize:{configurable:!0}};return t.prototype.toString=function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Hi(this.marks,JSON.stringify(this.text))},r.textContent.get=function(){return this.text},t.prototype.textBetween=function(o,i){return this.text.slice(o,i)},r.nodeSize.get=function(){return this.text.length},t.prototype.mark=function(o){return o==this.marks?this:new t(this.type,this.attrs,this.text,o)},t.prototype.withText=function(o){return o==this.text?this:new t(this.type,this.attrs,o,this.marks)},t.prototype.cut=function(o,i){return o===void 0&&(o=0),i===void 0&&(i=this.text.length),o==0&&i==this.text.length?this:this.withText(this.text.slice(o,i))},t.prototype.eq=function(o){return this.sameMarkup(o)&&this.text==o.text},t.prototype.toJSON=function(){var o=e.prototype.toJSON.call(this);return o.text=this.text,o},Object.defineProperties(t.prototype,r),t}(P);function Hi(e,t){for(var r=e.length-1;r>=0;r--)t=e[r].type.name+"("+t+")";return t}var ft=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},Fr={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};ft.parse=function(t,r){var n=new Vr(t,r);if(n.next==null)return ft.empty;var o=qi(n);n.next&&n.err("Unexpected trailing text");var i=fc(uc(o));return pc(i,n),i};ft.prototype.matchType=function(t){for(var r=0;r<this.next.length;r+=2)if(this.next[r]==t)return this.next[r+1];return null};ft.prototype.matchFragment=function(t,r,n){r===void 0&&(r=0),n===void 0&&(n=t.childCount);for(var o=this,i=r;o&&i<n;i++)o=o.matchType(t.child(i).type);return o};Fr.inlineContent.get=function(){var e=this.next[0];return e?e.isInline:!1};Fr.defaultType.get=function(){for(var e=0;e<this.next.length;e+=2){var t=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}};ft.prototype.compatible=function(t){for(var r=0;r<this.next.length;r+=2)for(var n=0;n<t.next.length;n+=2)if(this.next[r]==t.next[n])return!0;return!1};ft.prototype.fillBefore=function(t,r,n){r===void 0&&(r=!1),n===void 0&&(n=0);var o=[this];function i(s,a){var c=s.matchFragment(t,n);if(c&&(!r||c.validEnd))return k.from(a.map(function(d){return d.createAndFill()}));for(var l=0;l<s.next.length;l+=2){var u=s.next[l],f=s.next[l+1];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(f)==-1){o.push(f);var p=i(f,a.concat(u));if(p)return p}}}return i(this,[])};ft.prototype.findWrapping=function(t){for(var r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];var n=this.computeWrapping(t);return this.wrapCache.push(t,n),n};ft.prototype.computeWrapping=function(t){for(var r=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var o=n.shift(),i=o.match;if(i.matchType(t)){for(var s=[],a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(var c=0;c<i.next.length;c+=2){var l=i.next[c];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in r)&&(!o.type||i.next[c+1].validEnd)&&(n.push({match:l.contentMatch,type:l,via:o}),r[l.name]=!0)}}};Fr.edgeCount.get=function(){return this.next.length>>1};ft.prototype.edge=function(t){var r=t<<1;if(r>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[r],next:this.next[r+1]}};ft.prototype.toString=function(){var t=[];function r(n){t.push(n);for(var o=1;o<n.next.length;o+=2)t.indexOf(n.next[o])==-1&&r(n.next[o])}return r(this),t.map(function(n,o){for(var i=o+(n.validEnd?"*":" ")+" ",s=0;s<n.next.length;s+=2)i+=(s?", ":"")+n.next[s].name+"->"+t.indexOf(n.next[s+1]);return i}).join(`
|
||
`)};Object.defineProperties(ft.prototype,Fr);ft.empty=new ft(!0);var Vr=function(t,r){this.string=t,this.nodeTypes=r,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()},ji={next:{configurable:!0}};ji.next.get=function(){return this.tokens[this.pos]};Vr.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)};Vr.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")};Object.defineProperties(Vr.prototype,ji);function qi(e){var t=[];do t.push(ic(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function ic(e){var t=[];do t.push(sc(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function sc(e){for(var t=lc(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=ac(e,t);else break;return t}function Vo(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");var t=Number(e.next);return e.pos++,t}function ac(e,t){var r=Vo(e),n=r;return e.eat(",")&&(e.next!="}"?n=Vo(e):n=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:t}}function cc(e,t){var r=e.nodeTypes,n=r[t];if(n)return[n];var o=[];for(var i in r){var s=r[i];s.groups.indexOf(t)>-1&&o.push(s)}return o.length==0&&e.err("No node type or group '"+t+"' found"),o}function lc(e){if(e.eat("(")){var t=qi(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{var r=cc(e,e.next).map(function(n){return e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}});return e.pos++,r.length==1?r[0]:{type:"choice",exprs:r}}}function uc(e){var t=[[]];return o(i(e,0),r()),t;function r(){return t.push([])-1}function n(s,a,c){var l={term:c,to:a};return t[s].push(l),l}function o(s,a){s.forEach(function(c){return c.to=a})}function i(s,a){if(s.type=="choice")return s.exprs.reduce(function(S,y){return S.concat(i(y,a))},[]);if(s.type=="seq")for(var c=0;;c++){var l=i(s.exprs[c],a);if(c==s.exprs.length-1)return l;o(l,a=r())}else if(s.type=="star"){var u=r();return n(a,u),o(i(s.expr,u),u),[n(u)]}else if(s.type=="plus"){var f=r();return o(i(s.expr,a),f),o(i(s.expr,f),f),[n(f)]}else{if(s.type=="opt")return[n(a)].concat(i(s.expr,a));if(s.type=="range"){for(var p=a,d=0;d<s.min;d++){var h=r();o(i(s.expr,p),h),p=h}if(s.max==-1)o(i(s.expr,p),p);else for(var v=s.min;v<s.max;v++){var g=r();n(p,g),o(i(s.expr,p),g),p=g}return[n(p)]}else if(s.type=="name")return[n(a,null,s.value)]}}}function Ji(e,t){return t-e}function Ho(e,t){var r=[];return n(t),r.sort(Ji);function n(o){var i=e[o];if(i.length==1&&!i[0].term)return n(i[0].to);r.push(o);for(var s=0;s<i.length;s++){var a=i[s],c=a.term,l=a.to;!c&&r.indexOf(l)==-1&&n(l)}}}function fc(e){var t=Object.create(null);return r(Ho(e,0));function r(n){var o=[];n.forEach(function(c){e[c].forEach(function(l){var u=l.term,f=l.to;if(u){var p=o.indexOf(u),d=p>-1&&o[p+1];Ho(e,f).forEach(function(h){d||o.push(u,d=[]),d.indexOf(h)==-1&&d.push(h)})}})});for(var i=t[n.join(",")]=new ft(n.indexOf(e.length-1)>-1),s=0;s<o.length;s+=2){var a=o[s+1].sort(Ji);i.next.push(o[s],t[a.join(",")]||r(a))}return i}}function pc(e,t){for(var r=0,n=[e];r<n.length;r++){for(var o=n[r],i=!o.validEnd,s=[],a=0;a<o.next.length;a+=2){var c=o.next[a],l=o.next[a+1];s.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),n.indexOf(l)==-1&&n.push(l)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Wi(e){var t=Object.create(null);for(var r in e){var n=e[r];if(!n.hasDefault)return null;t[r]=n.default}return t}function Ki(e,t){var r=Object.create(null);for(var n in e){var o=t&&t[n];if(o===void 0){var i=e[n];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+n)}r[n]=o}return r}function $i(e){var t=Object.create(null);if(e)for(var r in e)t[r]=new Ui(e[r]);return t}var yt=function(t,r,n){this.name=t,this.schema=r,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=$i(n.attrs),this.defaultAttrs=Wi(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||t=="text"),this.isText=t=="text"},ur={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};ur.isInline.get=function(){return!this.isBlock};ur.isTextblock.get=function(){return this.isBlock&&this.inlineContent};ur.isLeaf.get=function(){return this.contentMatch==ft.empty};ur.isAtom.get=function(){return this.isLeaf||this.spec.atom};yt.prototype.hasRequiredAttrs=function(){for(var t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1};yt.prototype.compatibleContent=function(t){return this==t||this.contentMatch.compatible(t.contentMatch)};yt.prototype.computeAttrs=function(t){return!t&&this.defaultAttrs?this.defaultAttrs:Ki(this.attrs,t)};yt.prototype.create=function(t,r,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new P(this,this.computeAttrs(t),k.from(r),R.setFrom(n))};yt.prototype.createChecked=function(t,r,n){if(r=k.from(r),!this.validContent(r))throw new RangeError("Invalid content for node "+this.name);return new P(this,this.computeAttrs(t),r,R.setFrom(n))};yt.prototype.createAndFill=function(t,r,n){if(t=this.computeAttrs(t),r=k.from(r),r.size){var o=this.contentMatch.fillBefore(r);if(!o)return null;r=o.append(r)}var i=this.contentMatch.matchFragment(r).fillBefore(k.empty,!0);return i?new P(this,t,r.append(i),R.setFrom(n)):null};yt.prototype.validContent=function(t){var r=this.contentMatch.matchFragment(t);if(!r||!r.validEnd)return!1;for(var n=0;n<t.childCount;n++)if(!this.allowsMarks(t.child(n).marks))return!1;return!0};yt.prototype.allowsMarkType=function(t){return this.markSet==null||this.markSet.indexOf(t)>-1};yt.prototype.allowsMarks=function(t){if(this.markSet==null)return!0;for(var r=0;r<t.length;r++)if(!this.allowsMarkType(t[r].type))return!1;return!0};yt.prototype.allowedMarks=function(t){if(this.markSet==null)return t;for(var r,n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?r&&r.push(t[n]):r||(r=t.slice(0,n));return r?r.length?r:R.empty:t};yt.compile=function(t,r){var n=Object.create(null);t.forEach(function(s,a){return n[s]=new yt(s,r,a)});var o=r.spec.topNode||"doc";if(!n[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(var i in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n};Object.defineProperties(yt.prototype,ur);var Ui=function(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default},Gi={isRequired:{configurable:!0}};Gi.isRequired.get=function(){return!this.hasDefault};Object.defineProperties(Ui.prototype,Gi);var oe=function(t,r,n,o){this.name=t,this.schema=n,this.spec=o,this.attrs=$i(o.attrs),this.rank=r,this.excluded=null;var i=Wi(this.attrs);this.instance=i&&new R(this,i)};oe.prototype.create=function(t){return!t&&this.instance?this.instance:new R(this,Ki(this.attrs,t))};oe.compile=function(t,r){var n=Object.create(null),o=0;return t.forEach(function(i,s){return n[i]=new oe(i,o++,r,s)}),n};oe.prototype.removeFromSet=function(t){for(var r=0;r<t.length;r++)t[r].type==this&&(t=t.slice(0,r).concat(t.slice(r+1)),r--);return t};oe.prototype.isInSet=function(t){for(var r=0;r<t.length;r++)if(t[r].type==this)return t[r]};oe.prototype.excludes=function(t){return this.excluded.indexOf(t)>-1};var Se=function(t){this.spec={};for(var r in t)this.spec[r]=t[r];this.spec.nodes=Fo.from(t.nodes),this.spec.marks=Fo.from(t.marks),this.nodes=yt.compile(this.spec.nodes,this),this.marks=oe.compile(this.spec.marks,this);var n=Object.create(null);for(var o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");var i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;i.contentMatch=n[s]||(n[s]=ft.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet=a=="_"?null:a?jo(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(var c in this.marks){var l=this.marks[c],u=l.spec.excludes;l.excluded=u==null?[l]:u==""?[]:jo(this,u.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached=Object.create(null),this.cached.wrappings=Object.create(null)};Se.prototype.node=function(t,r,n,o){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof yt){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(r,n,o)};Se.prototype.text=function(t,r){var n=this.nodes.text;return new oc(n,n.defaultAttrs,t,R.setFrom(r))};Se.prototype.mark=function(t,r){return typeof t=="string"&&(t=this.marks[t]),t.create(r)};Se.prototype.nodeFromJSON=function(t){return P.fromJSON(this,t)};Se.prototype.markFromJSON=function(t){return R.fromJSON(this,t)};Se.prototype.nodeType=function(t){var r=this.nodes[t];if(!r)throw new RangeError("Unknown node type: "+t);return r};function jo(e,t){for(var r=[],n=0;n<t.length;n++){var o=t[n],i=e.marks[o],s=i;if(i)r.push(i);else for(var a in e.marks){var c=e.marks[a];(o=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(o)>-1)&&r.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[n]+"'")}return r}var Bt=function(t,r){var n=this;this.schema=t,this.rules=r,this.tags=[],this.styles=[],r.forEach(function(o){o.tag?n.tags.push(o):o.style&&n.styles.push(o)}),this.normalizeLists=!this.tags.some(function(o){if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;var i=t.nodes[o.node];return i.contentMatch.matchType(i)})};Bt.prototype.parse=function(t,r){r===void 0&&(r={});var n=new W(this,r,!1);return n.addAll(t,null,r.from,r.to),n.finish()};Bt.prototype.parseSlice=function(t,r){r===void 0&&(r={});var n=new W(this,r,!0);return n.addAll(t,null,r.from,r.to),x.maxOpen(n.finish())};Bt.prototype.matchTag=function(t,r,n){for(var o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){var i=this.tags[o];if(mc(t,i.tag)&&(i.namespace===void 0||t.namespaceURI==i.namespace)&&(!i.context||r.matchesContext(i.context))){if(i.getAttrs){var s=i.getAttrs(t);if(s===!1)continue;i.attrs=s}return i}}};Bt.prototype.matchStyle=function(t,r,n,o){for(var i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){var s=this.styles[i];if(!(s.style.indexOf(t)!=0||s.context&&!n.matchesContext(s.context)||s.style.length>t.length&&(s.style.charCodeAt(t.length)!=61||s.style.slice(t.length+1)!=r))){if(s.getAttrs){var a=s.getAttrs(r);if(a===!1)continue;s.attrs=a}return s}}};Bt.schemaRules=function(t){var r=[];function n(c){for(var l=c.priority==null?50:c.priority,u=0;u<r.length;u++){var f=r[u],p=f.priority==null?50:f.priority;if(p<l)break}r.splice(u,0,c)}var o=function(c){var l=t.marks[c].spec.parseDOM;l&&l.forEach(function(u){n(u=qo(u)),u.mark=c})};for(var i in t.marks)o(i);var s=function(c){var l=t.nodes[a].spec.parseDOM;l&&l.forEach(function(u){n(u=qo(u)),u.node=a})};for(var a in t.nodes)s();return r};Bt.fromSchema=function(t){return t.cached.domParser||(t.cached.domParser=new Bt(t,Bt.schemaRules(t)))};var $n={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},dc={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Yi={ol:!0,ul:!0},Un=1,Tn=2,$e=4;function Xi(e){return(e?Un:0)|(e==="full"?Tn:0)}var Xt=function(t,r,n,o,i,s,a){this.type=t,this.attrs=r,this.solid=i,this.match=s||(a&$e?null:t.contentMatch),this.options=a,this.content=[],this.marks=n,this.activeMarks=R.none,this.pendingMarks=o,this.stashMarks=[]};Xt.prototype.findWrapping=function(t){if(!this.match){if(!this.type)return[];var r=this.type.contentMatch.fillBefore(k.from(t));if(r)this.match=this.type.contentMatch.matchFragment(r);else{var n=this.type.contentMatch,o;return(o=n.findWrapping(t.type))?(this.match=n,o):null}}return this.match.findWrapping(t.type)};Xt.prototype.finish=function(t){if(!(this.options&Un)){var r=this.content[this.content.length-1],n;r&&r.isText&&(n=/[ \t\r\n\u000c]+$/.exec(r.text))&&(r.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 o=k.from(this.content);return!t&&this.match&&(o=o.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,o,this.marks):o};Xt.prototype.popFromStashMark=function(t){for(var r=this.stashMarks.length-1;r>=0;r--)if(t.eq(this.stashMarks[r]))return this.stashMarks.splice(r,1)[0]};Xt.prototype.applyPending=function(t){for(var r=0,n=this.pendingMarks;r<n.length;r++){var o=n[r];(this.type?this.type.allowsMarkType(o.type):gc(o.type,t))&&!o.isInSet(this.activeMarks)&&(this.activeMarks=o.addToSet(this.activeMarks),this.pendingMarks=o.removeFromSet(this.pendingMarks))}};Xt.prototype.inlineContext=function(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!$n.hasOwnProperty(t.parentNode.nodeName.toLowerCase())};var W=function(t,r,n){this.parser=t,this.options=r,this.isOpen=n;var o=r.topNode,i,s=Xi(r.preserveWhitespace)|(n?$e:0);o?i=new Xt(o.type,o.attrs,R.none,R.none,!0,r.topMatch||o.type.contentMatch,s):n?i=new Xt(null,null,R.none,R.none,!0,null,s):i=new Xt(t.schema.topNodeType,null,R.none,R.none,!0,null,s),this.nodes=[i],this.open=0,this.find=r.findPositions,this.needsBlock=!1},Gn={top:{configurable:!0},currentPos:{configurable:!0}};Gn.top.get=function(){return this.nodes[this.open]};W.prototype.addDOM=function(t){if(t.nodeType==3)this.addTextNode(t);else if(t.nodeType==1){var r=t.getAttribute("style"),n=r?this.readStyles(vc(r)):null,o=this.top;if(n!=null)for(var i=0;i<n.length;i++)this.addPendingMark(n[i]);if(this.addElement(t),n!=null)for(var s=0;s<n.length;s++)this.removePendingMark(n[s],o)}};W.prototype.addTextNode=function(t){var r=t.nodeValue,n=this.top;if(n.options&Tn||n.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(n.options&Un)n.options&Tn?r=r.replace(/\r\n?/g,`
|
||
`):r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){var o=n.content[n.content.length-1],i=t.previousSibling;(!o||i&&i.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r)),this.findInText(t)}else this.findInside(t)};W.prototype.addElement=function(t,r){var n=t.nodeName.toLowerCase(),o;Yi.hasOwnProperty(n)&&this.parser.normalizeLists&&hc(t);var i=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(o=this.parser.matchTag(t,this,r));if(i?i.ignore:dc.hasOwnProperty(n))this.findInside(t),this.ignoreFallback(t);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(t=i.skip);var s,a=this.top,c=this.needsBlock;if($n.hasOwnProperty(n))s=!0,a.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t);return}this.addAll(t),s&&this.sync(a),this.needsBlock=c}else this.addElementByRule(t,i,i.consuming===!1?o:null)};W.prototype.leafFallback=function(t){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
|
||
`))};W.prototype.ignoreFallback=function(t){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))};W.prototype.readStyles=function(t){var r=R.none;t:for(var n=0;n<t.length;n+=2)for(var o=null;;){var i=this.parser.matchStyle(t[n],t[n+1],this,o);if(!i)continue t;if(i.ignore)return null;if(r=this.parser.schema.marks[i.mark].create(i.attrs).addToSet(r),i.consuming===!1)o=i;else break}return r};W.prototype.addElementByRule=function(t,r,n){var o=this,i,s,a,c;r.node?(s=this.parser.schema.nodes[r.node],s.isLeaf?this.insertNode(s.create(r.attrs))||this.leafFallback(t):i=this.enter(s,r.attrs,r.preserveWhitespace)):(a=this.parser.schema.marks[r.mark],c=a.create(r.attrs),this.addPendingMark(c));var l=this.top;if(s&&s.isLeaf)this.findInside(t);else if(n)this.addElement(t,n);else if(r.getContent)this.findInside(t),r.getContent(t,this.parser.schema).forEach(function(f){return o.insertNode(f)});else{var u=r.contentElement;typeof u=="string"?u=t.querySelector(u):typeof u=="function"&&(u=u(t)),u||(u=t),this.findAround(t,u,!0),this.addAll(u,i)}i&&(this.sync(l),this.open--),c&&this.removePendingMark(c,l)};W.prototype.addAll=function(t,r,n,o){for(var i=n||0,s=n?t.childNodes[n]:t.firstChild,a=o==null?null:t.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(s),r&&$n.hasOwnProperty(s.nodeName.toLowerCase())&&this.sync(r);this.findAtPoint(t,i)};W.prototype.findPlace=function(t){for(var r,n,o=this.open;o>=0;o--){var i=this.nodes[o],s=i.findWrapping(t);if(s&&(!r||r.length>s.length)&&(r=s,n=i,!s.length)||i.solid)break}if(!r)return!1;this.sync(n);for(var a=0;a<r.length;a++)this.enterInner(r[a],null,!1);return!0};W.prototype.insertNode=function(t){if(t.isInline&&this.needsBlock&&!this.top.type){var r=this.textblockFromContext();r&&this.enterInner(r)}if(this.findPlace(t)){this.closeExtra();var n=this.top;n.applyPending(t.type),n.match&&(n.match=n.match.matchType(t.type));for(var o=n.activeMarks,i=0;i<t.marks.length;i++)(!n.type||n.type.allowsMarkType(t.marks[i].type))&&(o=t.marks[i].addToSet(o));return n.content.push(t.mark(o)),!0}return!1};W.prototype.enter=function(t,r,n){var o=this.findPlace(t.create(r));return o&&this.enterInner(t,r,!0,n),o};W.prototype.enterInner=function(t,r,n,o){this.closeExtra();var i=this.top;i.applyPending(t),i.match=i.match&&i.match.matchType(t,r);var s=o==null?i.options&~$e:Xi(o);i.options&$e&&i.content.length==0&&(s|=$e),this.nodes.push(new Xt(t,r,i.activeMarks,i.pendingMarks,n,null,s)),this.open++};W.prototype.closeExtra=function(t){var r=this.nodes.length-1;if(r>this.open){for(;r>this.open;r--)this.nodes[r-1].content.push(this.nodes[r].finish(t));this.nodes.length=this.open+1}};W.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)};W.prototype.sync=function(t){for(var r=this.open;r>=0;r--)if(this.nodes[r]==t){this.open=r;return}};Gn.currentPos.get=function(){this.closeExtra();for(var e=0,t=this.open;t>=0;t--){for(var r=this.nodes[t].content,n=r.length-1;n>=0;n--)e+=r[n].nodeSize;t&&e++}return e};W.prototype.findAtPoint=function(t,r){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==r&&(this.find[n].pos=this.currentPos)};W.prototype.findInside=function(t){if(this.find)for(var r=0;r<this.find.length;r++)this.find[r].pos==null&&t.nodeType==1&&t.contains(this.find[r].node)&&(this.find[r].pos=this.currentPos)};W.prototype.findAround=function(t,r,n){if(t!=r&&this.find){for(var o=0;o<this.find.length;o++)if(this.find[o].pos==null&&t.nodeType==1&&t.contains(this.find[o].node)){var i=r.compareDocumentPosition(this.find[o].node);i&(n?2:4)&&(this.find[o].pos=this.currentPos)}}};W.prototype.findInText=function(t){if(this.find)for(var r=0;r<this.find.length;r++)this.find[r].node==t&&(this.find[r].pos=this.currentPos-(t.nodeValue.length-this.find[r].offset))};W.prototype.matchesContext=function(t){var r=this;if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var n=t.split("/"),o=this.options.context,i=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),s=-(o?o.depth+1:0)+(i?0:1),a=function(c,l){for(;c>=0;c--){var u=n[c];if(u==""){if(c==n.length-1||c==0)continue;for(;l>=s;l--)if(a(c-1,l))return!0;return!1}else{var f=l>0||l==0&&i?r.nodes[l].type:o&&l>=s?o.node(l-s).type:null;if(!f||f.name!=u&&f.groups.indexOf(u)==-1)return!1;l--}}return!0};return a(n.length-1,this.open)};W.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var r=t.depth;r>=0;r--){var n=t.node(r).contentMatchAt(t.indexAfter(r)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var o in this.parser.schema.nodes){var i=this.parser.schema.nodes[o];if(i.isTextblock&&i.defaultAttrs)return i}};W.prototype.addPendingMark=function(t){var r=yc(t,this.top.pendingMarks);r&&this.top.stashMarks.push(r),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)};W.prototype.removePendingMark=function(t,r){for(var n=this.open;n>=0;n--){var o=this.nodes[n],i=o.pendingMarks.lastIndexOf(t);if(i>-1)o.pendingMarks=t.removeFromSet(o.pendingMarks);else{o.activeMarks=t.removeFromSet(o.activeMarks);var s=o.popFromStashMark(t);s&&o.type&&o.type.allowsMarkType(s.type)&&(o.activeMarks=s.addToSet(o.activeMarks))}if(o==r)break}};Object.defineProperties(W.prototype,Gn);function hc(e){for(var t=e.firstChild,r=null;t;t=t.nextSibling){var n=t.nodeType==1?t.nodeName.toLowerCase():null;n&&Yi.hasOwnProperty(n)&&r?(r.appendChild(t),t=r):n=="li"?r=t:n&&(r=null)}}function mc(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function vc(e){for(var t=/\s*([\w-]+)\s*:\s*([^;]+)/g,r,n=[];r=t.exec(e);)n.push(r[1],r[2].trim());return n}function qo(e){var t={};for(var r in e)t[r]=e[r];return t}function gc(e,t){var r=t.schema.nodes,n=function(s){var a=r[s];if(a.allowsMarkType(e)){var c=[],l=function(u){c.push(u);for(var f=0;f<u.edgeCount;f++){var p=u.edge(f),d=p.type,h=p.next;if(d==t||c.indexOf(h)<0&&l(h))return!0}};if(l(a.contentMatch))return{v:!0}}};for(var o in r){var i=n(o);if(i)return i.v}}function yc(e,t){for(var r=0;r<t.length;r++)if(e.eq(t[r]))return t[r]}var st=function(t,r){this.nodes=t||{},this.marks=r||{}};st.prototype.serializeFragment=function(t,r,n){var o=this;r===void 0&&(r={}),n||(n=Yn(r).createDocumentFragment());var i=n,s=null;return t.forEach(function(a){if(s||a.marks.length){s||(s=[]);for(var c=0,l=0;c<s.length&&l<a.marks.length;){var u=a.marks[l];if(!o.marks[u.type.name]){l++;continue}if(!u.eq(s[c])||u.type.spec.spanning===!1)break;c+=2,l++}for(;c<s.length;)i=s.pop(),s.pop();for(;l<a.marks.length;){var f=a.marks[l++],p=o.serializeMark(f,a.isInline,r);p&&(s.push(f,i),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(o.serializeNodeInner(a,r))}),n};st.prototype.serializeNodeInner=function(t,r){r===void 0&&(r={});var n=st.renderSpec(Yn(r),this.nodes[t.type.name](t)),o=n.dom,i=n.contentDOM;if(i){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");r.onContent?r.onContent(t,i,r):this.serializeFragment(t.content,r,i)}return o};st.prototype.serializeNode=function(t,r){r===void 0&&(r={});for(var n=this.serializeNodeInner(t,r),o=t.marks.length-1;o>=0;o--){var i=this.serializeMark(t.marks[o],t.isInline,r);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n};st.prototype.serializeMark=function(t,r,n){n===void 0&&(n={});var o=this.marks[t.type.name];return o&&st.renderSpec(Yn(n),o(t,r))};st.renderSpec=function(t,r,n){if(n===void 0&&(n=null),typeof r=="string")return{dom:t.createTextNode(r)};if(r.nodeType!=null)return{dom:r};if(r.dom&&r.dom.nodeType!=null)return r;var o=r[0],i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));var s=null,a=n?t.createElementNS(n,o):t.createElement(o),c=r[1],l=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){l=2;for(var u in c)if(c[u]!=null){var f=u.indexOf(" ");f>0?a.setAttributeNS(u.slice(0,f),u.slice(f+1),c[u]):a.setAttribute(u,c[u])}}for(var p=l;p<r.length;p++){var d=r[p];if(d===0){if(p<r.length-1||p>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{var h=st.renderSpec(t,d,n),v=h.dom,g=h.contentDOM;if(a.appendChild(v),g){if(s)throw new RangeError("Multiple content holes");s=g}}}return{dom:a,contentDOM:s}};st.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new st(this.nodesFromSchema(t),this.marksFromSchema(t)))};st.nodesFromSchema=function(t){var r=Qi(t.nodes);return r.text||(r.text=function(n){return n.text}),r};st.marksFromSchema=function(t){return Qi(t.marks)};function Qi(e){var t={};for(var r in e){var n=e[r].spec.toDOM;n&&(t[r]=n)}return t}function Yn(e){return e.document||window.document}var Zi=65535,ts=Math.pow(2,16);function bc(e,t){return e+t*ts}function es(e){return e&Zi}function kc(e){return(e-(e&Zi))/ts}var An=function(t,r,n){r===void 0&&(r=!1),n===void 0&&(n=null),this.pos=t,this.deleted=r,this.recover=n},ot=function(t,r){r===void 0&&(r=!1),this.ranges=t,this.inverted=r};ot.prototype.recover=function(t){var r=0,n=es(t);if(!this.inverted)for(var o=0;o<n;o++)r+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[n*3]+r+kc(t)};ot.prototype.mapResult=function(t,r){return r===void 0&&(r=1),this._map(t,r,!1)};ot.prototype.map=function(t,r){return r===void 0&&(r=1),this._map(t,r,!0)};ot.prototype._map=function(t,r,n){for(var o=0,i=this.inverted?2:1,s=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var c=this.ranges[a]-(this.inverted?o:0);if(c>t)break;var l=this.ranges[a+i],u=this.ranges[a+s],f=c+l;if(t<=f){var p=l?t==c?-1:t==f?1:r:r,d=c+o+(p<0?0:u);if(n)return d;var h=t==(r<0?c:f)?null:bc(a/3,t-c);return new An(d,r<0?t!=c:t!=f,h)}o+=u-l}return n?t+o:new An(t+o)};ot.prototype.touches=function(t,r){for(var n=0,o=es(r),i=this.inverted?2:1,s=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var c=this.ranges[a]-(this.inverted?n:0);if(c>t)break;var l=this.ranges[a+i],u=c+l;if(t<=u&&a==o*3)return!0;n+=this.ranges[a+s]-l}return!1};ot.prototype.forEach=function(t){for(var r=this.inverted?2:1,n=this.inverted?1:2,o=0,i=0;o<this.ranges.length;o+=3){var s=this.ranges[o],a=s-(this.inverted?i:0),c=s+(this.inverted?0:i),l=this.ranges[o+r],u=this.ranges[o+n];t(a,a+l,c,c+u),i+=u-l}};ot.prototype.invert=function(){return new ot(this.ranges,!this.inverted)};ot.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)};ot.offset=function(t){return t==0?ot.empty:new ot(t<0?[0,-t,0]:[0,0,t])};ot.empty=new ot([]);var pt=function(t,r,n,o){this.maps=t||[],this.from=n||0,this.to=o??this.maps.length,this.mirror=r};pt.prototype.slice=function(t,r){return t===void 0&&(t=0),r===void 0&&(r=this.maps.length),new pt(this.maps,this.mirror,t,r)};pt.prototype.copy=function(){return new pt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)};pt.prototype.appendMap=function(t,r){this.to=this.maps.push(t),r!=null&&this.setMirror(this.maps.length-1,r)};pt.prototype.appendMapping=function(t){for(var r=0,n=this.maps.length;r<t.maps.length;r++){var o=t.getMirror(r);this.appendMap(t.maps[r],o!=null&&o<r?n+o:null)}};pt.prototype.getMirror=function(t){if(this.mirror){for(var r=0;r<this.mirror.length;r++)if(this.mirror[r]==t)return this.mirror[r+(r%2?-1:1)]}};pt.prototype.setMirror=function(t,r){this.mirror||(this.mirror=[]),this.mirror.push(t,r)};pt.prototype.appendMappingInverted=function(t){for(var r=t.maps.length-1,n=this.maps.length+t.maps.length;r>=0;r--){var o=t.getMirror(r);this.appendMap(t.maps[r].invert(),o!=null&&o>r?n-o-1:null)}};pt.prototype.invert=function(){var t=new pt;return t.appendMappingInverted(this),t};pt.prototype.map=function(t,r){if(r===void 0&&(r=1),this.mirror)return this._map(t,r,!0);for(var n=this.from;n<this.to;n++)t=this.maps[n].map(t,r);return t};pt.prototype.mapResult=function(t,r){return r===void 0&&(r=1),this._map(t,r,!1)};pt.prototype._map=function(t,r,n){for(var o=!1,i=this.from;i<this.to;i++){var s=this.maps[i],a=s.mapResult(t,r);if(a.recover!=null){var c=this.getMirror(i);if(c!=null&&c>i&&c<this.to){i=c,t=this.maps[c].recover(a.recover);continue}}a.deleted&&(o=!0),t=a.pos}return n?t:new An(t,o)};function De(e){var t=Error.call(this,e);return t.__proto__=De.prototype,t}De.prototype=Object.create(Error.prototype);De.prototype.constructor=De;De.prototype.name="TransformError";var Y=function(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new pt},Xn={before:{configurable:!0},docChanged:{configurable:!0}};Xn.before.get=function(){return this.docs.length?this.docs[0]:this.doc};Y.prototype.step=function(t){var r=this.maybeStep(t);if(r.failed)throw new De(r.failed);return this};Y.prototype.maybeStep=function(t){var r=t.apply(this.doc);return r.failed||this.addStep(t,r.doc),r};Xn.docChanged.get=function(){return this.steps.length>0};Y.prototype.addStep=function(t,r){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=r};Object.defineProperties(Y.prototype,Xn);function Hr(){throw new Error("Override me")}var _n=Object.create(null),ht=function(){};ht.prototype.apply=function(t){return Hr()};ht.prototype.getMap=function(){return ot.empty};ht.prototype.invert=function(t){return Hr()};ht.prototype.map=function(t){return Hr()};ht.prototype.merge=function(t){return null};ht.prototype.toJSON=function(){return Hr()};ht.fromJSON=function(t,r){if(!r||!r.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=_n[r.stepType];if(!n)throw new RangeError("No step type "+r.stepType+" defined");return n.fromJSON(t,r)};ht.jsonID=function(t,r){if(t in _n)throw new RangeError("Duplicate use of step JSON ID "+t);return _n[t]=r,r.prototype.jsonID=t,r};var vt=function(t,r){this.doc=t,this.failed=r};vt.ok=function(t){return new vt(t,null)};vt.fail=function(t){return new vt(null,t)};vt.fromReplace=function(t,r,n,o){try{return vt.ok(t.replace(r,n,o))}catch(i){if(i instanceof Wt)return vt.fail(i.message);throw i}};var Qt=function(e){function t(r,n,o,i){e.call(this),this.from=r,this.to=n,this.slice=o,this.structure=!!i}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(n){return this.structure&&Nn(n,this.from,this.to)?vt.fail("Structure replace would overwrite content"):vt.fromReplace(n,this.from,this.to,this.slice)},t.prototype.getMap=function(){return new ot([this.from,this.to-this.from,this.slice.size])},t.prototype.invert=function(n){return new t(this.from,this.from+this.slice.size,n.slice(this.from,this.to))},t.prototype.map=function(n){var o=n.mapResult(this.from,1),i=n.mapResult(this.to,-1);return o.deleted&&i.deleted?null:new t(o.pos,Math.max(o.pos,i.pos),this.slice)},t.prototype.merge=function(n){if(!(n instanceof t)||n.structure||this.structure)return null;if(this.from+this.slice.size==n.from&&!this.slice.openEnd&&!n.slice.openStart){var o=this.slice.size+n.slice.size==0?x.empty:new x(this.slice.content.append(n.slice.content),this.slice.openStart,n.slice.openEnd);return new t(this.from,this.to+(n.to-n.from),o,this.structure)}else if(n.to==this.from&&!this.slice.openStart&&!n.slice.openEnd){var i=this.slice.size+n.slice.size==0?x.empty:new x(n.slice.content.append(this.slice.content),n.slice.openStart,this.slice.openEnd);return new t(n.from,this.to,i,this.structure)}else return null},t.prototype.toJSON=function(){var n={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(n.slice=this.slice.toJSON()),this.structure&&(n.structure=!0),n},t.fromJSON=function(n,o){if(typeof o.from!="number"||typeof o.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new t(o.from,o.to,x.fromJSON(n,o.slice),!!o.structure)},t}(ht);ht.jsonID("replace",Qt);var Mt=function(e){function t(r,n,o,i,s,a,c){e.call(this),this.from=r,this.to=n,this.gapFrom=o,this.gapTo=i,this.slice=s,this.insert=a,this.structure=!!c}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(n){if(this.structure&&(Nn(n,this.from,this.gapFrom)||Nn(n,this.gapTo,this.to)))return vt.fail("Structure gap-replace would overwrite content");var o=n.slice(this.gapFrom,this.gapTo);if(o.openStart||o.openEnd)return vt.fail("Gap is not a flat range");var i=this.slice.insertAt(this.insert,o.content);return i?vt.fromReplace(n,this.from,this.to,i):vt.fail("Content does not fit in gap")},t.prototype.getMap=function(){return new ot([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},t.prototype.invert=function(n){var o=this.gapTo-this.gapFrom;return new t(this.from,this.from+this.slice.size+o,this.from+this.insert,this.from+this.insert+o,n.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},t.prototype.map=function(n){var o=n.mapResult(this.from,1),i=n.mapResult(this.to,-1),s=n.map(this.gapFrom,-1),a=n.map(this.gapTo,1);return o.deleted&&i.deleted||s<o.pos||a>i.pos?null:new t(o.pos,i.pos,s,a,this.slice,this.insert,this.structure)},t.prototype.toJSON=function(){var n={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(n.slice=this.slice.toJSON()),this.structure&&(n.structure=!0),n},t.fromJSON=function(n,o){if(typeof o.from!="number"||typeof o.to!="number"||typeof o.gapFrom!="number"||typeof o.gapTo!="number"||typeof o.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(o.from,o.to,o.gapFrom,o.gapTo,x.fromJSON(n,o.slice),o.insert,!!o.structure)},t}(ht);ht.jsonID("replaceAround",Mt);function Nn(e,t,r){for(var n=e.resolve(t),o=r-t,i=n.depth;o>0&&i>0&&n.indexAfter(i)==n.node(i).childCount;)i--,o--;if(o>0)for(var s=n.node(i).maybeChild(n.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function Sc(e,t,r){return(t==0||e.canReplace(t,e.childCount))&&(r==e.childCount||e.canReplace(0,r))}function Ve(e){for(var t=e.parent,r=t.content.cutByIndex(e.startIndex,e.endIndex),n=e.depth;;--n){var o=e.$from.node(n),i=e.$from.index(n),s=e.$to.indexAfter(n);if(n<e.depth&&o.canReplace(i,s,r))return n;if(n==0||o.type.spec.isolating||!Sc(o,i,s))break}}Y.prototype.lift=function(e,t){for(var r=e.$from,n=e.$to,o=e.depth,i=r.before(o+1),s=n.after(o+1),a=i,c=s,l=k.empty,u=0,f=o,p=!1;f>t;f--)p||r.index(f)>0?(p=!0,l=k.from(r.node(f).copy(l)),u++):a--;for(var d=k.empty,h=0,v=o,g=!1;v>t;v--)g||n.after(v+1)<n.end(v)?(g=!0,d=k.from(n.node(v).copy(d)),h++):c++;return this.step(new Mt(a,c,i,s,new x(l.append(d),u,h),l.size-u,!0))};function Qn(e,t,r,n){n===void 0&&(n=e);var o=Mc(e,t),i=o&&xc(n,t);return i?o.map(Jo).concat({type:t,attrs:r}).concat(i.map(Jo)):null}function Jo(e){return{type:e,attrs:null}}function Mc(e,t){var r=e.parent,n=e.startIndex,o=e.endIndex,i=r.contentMatchAt(n).findWrapping(t);if(!i)return null;var s=i.length?i[0]:t;return r.canReplaceWith(n,o,s)?i:null}function xc(e,t){var r=e.parent,n=e.startIndex,o=e.endIndex,i=r.child(n),s=t.contentMatch.findWrapping(i.type);if(!s)return null;for(var a=s.length?s[s.length-1]:t,c=a.contentMatch,l=n;c&&l<o;l++)c=c.matchType(r.child(l).type);return!c||!c.validEnd?null:s}Y.prototype.wrap=function(e,t){for(var r=k.empty,n=t.length-1;n>=0;n--)r=k.from(t[n].type.create(t[n].attrs,r));var o=e.start,i=e.end;return this.step(new Mt(o,i,o,i,new x(r,0,0),t.length,!0))};Y.prototype.setBlockType=function(e,t,r,n){var o=this;if(t===void 0&&(t=e),!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=this.steps.length;return this.doc.nodesBetween(e,t,function(s,a){if(s.isTextblock&&!s.hasMarkup(r,n)&&Cc(o.doc,o.mapping.slice(i).map(a),r)){o.clearIncompatible(o.mapping.slice(i).map(a,1),r);var c=o.mapping.slice(i),l=c.map(a,1),u=c.map(a+s.nodeSize,1);return o.step(new Mt(l,u,l+1,u-1,new x(k.from(r.create(n,null,s.marks)),0,0),1,!0)),!1}}),this};function Cc(e,t,r){var n=e.resolve(t),o=n.index();return n.parent.canReplaceWith(o,o+1,r)}Y.prototype.setNodeMarkup=function(e,t,r,n){var o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);var i=t.create(r,null,n||o.marks);if(o.isLeaf)return this.replaceWith(e,e+o.nodeSize,i);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);return this.step(new Mt(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new x(k.from(i),0,0),1,!0))};function _e(e,t,r,n){r===void 0&&(r=1);var o=e.resolve(t),i=o.depth-r,s=n&&n[n.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var a=o.depth-1,c=r-2;a>i;a--,c--){var l=o.node(a),u=o.index(a);if(l.type.spec.isolating)return!1;var f=l.content.cutByIndex(u,l.childCount),p=n&&n[c]||l;if(p!=l&&(f=f.replaceChild(0,p.type.create(p.attrs))),!l.canReplace(u+1,l.childCount)||!p.type.validContent(f))return!1}var d=o.indexAfter(i),h=n&&n[0];return o.node(i).canReplaceWith(d,d,h?h.type:o.node(i+1).type)}Y.prototype.split=function(e,t,r){t===void 0&&(t=1);for(var n=this.doc.resolve(e),o=k.empty,i=k.empty,s=n.depth,a=n.depth-t,c=t-1;s>a;s--,c--){o=k.from(n.node(s).copy(o));var l=r&&r[c];i=k.from(l?l.type.create(l.attrs,i):n.node(s).copy(i))}return this.step(new Qt(e,e,new x(o.append(i),t,t),!0))};function Zn(e,t){var r=e.resolve(t),n=r.index();return Oc(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function Oc(e,t){return e&&t&&!e.isLeaf&&e.canAppend(t)}Y.prototype.join=function(e,t){t===void 0&&(t=1);var r=new Qt(e-t,e+t,x.empty,!0);return this.step(r)};function wc(e,t,r){var n=e.resolve(t);if(n.parent.canReplaceWith(n.index(),n.index(),r))return t;if(n.parentOffset==0)for(var o=n.depth-1;o>=0;o--){var i=n.index(o);if(n.node(o).canReplaceWith(i,i,r))return n.before(o+1);if(i>0)return null}if(n.parentOffset==n.parent.content.size)for(var s=n.depth-1;s>=0;s--){var a=n.indexAfter(s);if(n.node(s).canReplaceWith(a,a,r))return n.after(s+1);if(a<n.node(s).childCount)return null}}function rs(e,t,r){var n=e.resolve(t);if(!r.content.size)return t;for(var o=r.content,i=0;i<r.openStart;i++)o=o.firstChild.content;for(var s=1;s<=(r.openStart==0&&r.size?2:1);s++)for(var a=n.depth;a>=0;a--){var c=a==n.depth?0:n.pos<=(n.start(a+1)+n.end(a+1))/2?-1:1,l=n.index(a)+(c>0?1:0),u=n.node(a),f=!1;if(s==1)f=u.canReplace(l,l,o);else{var p=u.contentMatchAt(l).findWrapping(o.firstChild.type);f=p&&u.canReplaceWith(l,l,p[0])}if(f)return c==0?n.pos:c<0?n.before(a+1):n.after(a+1)}return null}function to(e,t,r){for(var n=[],o=0;o<e.childCount;o++){var i=e.child(o);i.content.size&&(i=i.copy(to(i.content,t,i))),i.isInline&&(i=t(i,r,o)),n.push(i)}return k.fromArray(n)}var eo=function(e){function t(r,n,o){e.call(this),this.from=r,this.to=n,this.mark=o}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(n){var o=this,i=n.slice(this.from,this.to),s=n.resolve(this.from),a=s.node(s.sharedDepth(this.to)),c=new x(to(i.content,function(l,u){return!l.isAtom||!u.type.allowsMarkType(o.mark.type)?l:l.mark(o.mark.addToSet(l.marks))},a),i.openStart,i.openEnd);return vt.fromReplace(n,this.from,this.to,c)},t.prototype.invert=function(){return new fr(this.from,this.to,this.mark)},t.prototype.map=function(n){var o=n.mapResult(this.from,1),i=n.mapResult(this.to,-1);return o.deleted&&i.deleted||o.pos>=i.pos?null:new t(o.pos,i.pos,this.mark)},t.prototype.merge=function(n){if(n instanceof t&&n.mark.eq(this.mark)&&this.from<=n.to&&this.to>=n.from)return new t(Math.min(this.from,n.from),Math.max(this.to,n.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(n,o){if(typeof o.from!="number"||typeof o.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(o.from,o.to,n.markFromJSON(o.mark))},t}(ht);ht.jsonID("addMark",eo);var fr=function(e){function t(r,n,o){e.call(this),this.from=r,this.to=n,this.mark=o}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.apply=function(n){var o=this,i=n.slice(this.from,this.to),s=new x(to(i.content,function(a){return a.mark(o.mark.removeFromSet(a.marks))}),i.openStart,i.openEnd);return vt.fromReplace(n,this.from,this.to,s)},t.prototype.invert=function(){return new eo(this.from,this.to,this.mark)},t.prototype.map=function(n){var o=n.mapResult(this.from,1),i=n.mapResult(this.to,-1);return o.deleted&&i.deleted||o.pos>=i.pos?null:new t(o.pos,i.pos,this.mark)},t.prototype.merge=function(n){if(n instanceof t&&n.mark.eq(this.mark)&&this.from<=n.to&&this.to>=n.from)return new t(Math.min(this.from,n.from),Math.max(this.to,n.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(n,o){if(typeof o.from!="number"||typeof o.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(o.from,o.to,n.markFromJSON(o.mark))},t}(ht);ht.jsonID("removeMark",fr);Y.prototype.addMark=function(e,t,r){var n=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(e,t,function(c,l,u){if(c.isInline){var f=c.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){for(var p=Math.max(l,e),d=Math.min(l+c.nodeSize,t),h=r.addToSet(f),v=0;v<f.length;v++)f[v].isInSet(h)||(s&&s.to==p&&s.mark.eq(f[v])?s.to=d:o.push(s=new fr(p,d,f[v])));a&&a.to==p?a.to=d:i.push(a=new eo(p,d,r))}}}),o.forEach(function(c){return n.step(c)}),i.forEach(function(c){return n.step(c)}),this};Y.prototype.removeMark=function(e,t,r){var n=this;r===void 0&&(r=null);var o=[],i=0;return this.doc.nodesBetween(e,t,function(s,a){if(s.isInline){i++;var c=null;if(r instanceof oe)for(var l=s.marks,u;u=r.isInSet(l);)(c||(c=[])).push(u),l=u.removeFromSet(l);else r?r.isInSet(s.marks)&&(c=[r]):c=s.marks;if(c&&c.length)for(var f=Math.min(a+s.nodeSize,t),p=0;p<c.length;p++){for(var d=c[p],h=void 0,v=0;v<o.length;v++){var g=o[v];g.step==i-1&&d.eq(o[v].style)&&(h=g)}h?(h.to=f,h.step=i):o.push({style:d,from:Math.max(a,e),to:f,step:i})}}}),o.forEach(function(s){return n.step(new fr(s.from,s.to,s.style))}),this};Y.prototype.clearIncompatible=function(e,t,r){r===void 0&&(r=t.contentMatch);for(var n=this.doc.nodeAt(e),o=[],i=e+1,s=0;s<n.childCount;s++){var a=n.child(s),c=i+a.nodeSize,l=r.matchType(a.type,a.attrs);if(!l)o.push(new Qt(i,c,x.empty));else{r=l;for(var u=0;u<a.marks.length;u++)t.allowsMarkType(a.marks[u].type)||this.step(new fr(i,c,a.marks[u]))}i=c}if(!r.validEnd){var f=r.fillBefore(k.empty,!0);this.replace(i,i,new x(f,0,0))}for(var p=o.length-1;p>=0;p--)this.step(o[p]);return this};function Tc(e,t,r,n){if(r===void 0&&(r=t),n===void 0&&(n=x.empty),t==r&&!n.size)return null;var o=e.resolve(t),i=e.resolve(r);return ns(o,i,n)?new Qt(t,r,n):new It(o,i,n).fit()}Y.prototype.replace=function(e,t,r){t===void 0&&(t=e),r===void 0&&(r=x.empty);var n=Tc(this.doc,e,t,r);return n&&this.step(n),this};Y.prototype.replaceWith=function(e,t,r){return this.replace(e,t,new x(k.from(r),0,0))};Y.prototype.delete=function(e,t){return this.replace(e,t,x.empty)};Y.prototype.insert=function(e,t){return this.replaceWith(e,e,t)};function ns(e,t,r){return!r.openStart&&!r.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),r.content)}var It=function(t,r,n){this.$to=r,this.$from=t,this.unplaced=n,this.frontier=[];for(var o=0;o<=t.depth;o++){var i=t.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(t.indexAfter(o))})}this.placed=k.empty;for(var s=t.depth;s>0;s--)this.placed=k.from(t.node(s).copy(this.placed))},is={depth:{configurable:!0}};is.depth.get=function(){return this.frontier.length-1};It.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var r=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,i=this.close(r<0?this.$to:o.doc.resolve(r));if(!i)return null;for(var s=this.placed,a=o.depth,c=i.depth;a&&c&&s.childCount==1;)s=s.firstChild.content,a--,c--;var l=new x(s,a,c);if(r>-1)return new Mt(o.pos,r,this.$to.pos,this.$to.end(),l,n);if(l.size||o.pos!=this.$to.pos)return new Qt(o.pos,i.pos,l)};It.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var r=this.unplaced.openStart;r>=0;r--){var n=void 0,o=void 0;r?(o=ro(this.unplaced.content,r-1).firstChild,n=o.content):n=this.unplaced.content;for(var i=n.firstChild,s=this.depth;s>=0;s--){var a=this.frontier[s],c=a.type,l=a.match,u=void 0,f=void 0;if(t==1&&(i?l.matchType(i.type)||(f=l.fillBefore(k.from(i),!1)):c.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:s,parent:o,inject:f};if(t==2&&i&&(u=l.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:s,parent:o,wrap:u};if(o&&l.matchType(o.type))break}}};It.prototype.openMore=function(){var t=this.unplaced,r=t.content,n=t.openStart,o=t.openEnd,i=ro(r,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new x(r,n+1,Math.max(o,i.size+n>=r.size-o?n+1:0)),!0)};It.prototype.dropNode=function(){var t=this.unplaced,r=t.content,n=t.openStart,o=t.openEnd,i=ro(r,n);if(i.childCount<=1&&n>0){var s=r.size-n<=n+i.size;this.unplaced=new x(tr(r,n-1,1),n-1,s?n-1:o)}else this.unplaced=new x(tr(r,n,1),n,o)};It.prototype.placeNodes=function(t){for(var r=t.sliceDepth,n=t.frontierDepth,o=t.parent,i=t.inject,s=t.wrap;this.depth>n;)this.closeFrontierNode();if(s)for(var a=0;a<s.length;a++)this.openFrontierNode(s[a]);var c=this.unplaced,l=o?o.content:c.content,u=c.openStart-r,f=0,p=[],d=this.frontier[n],h=d.match,v=d.type;if(i){for(var g=0;g<i.childCount;g++)p.push(i.child(g));h=h.matchFragment(i)}for(var S=l.size+r-(c.content.size-c.openEnd);f<l.childCount;){var y=l.child(f),I=h.matchType(y.type);if(!I)break;f++,(f>1||u==0||y.content.size)&&(h=I,p.push(ss(y.mark(v.allowedMarks(y.marks)),f==1?u:0,f==l.childCount?S:-1)))}var m=f==l.childCount;m||(S=-1),this.placed=pr(this.placed,n,k.from(p)),this.frontier[n].match=h,m&&S<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var D=0,C=l;D<S;D++){var L=C.lastChild;this.frontier.push({type:L.type,match:L.contentMatchAt(L.childCount)}),C=L.content}this.unplaced=m?r==0?x.empty:new x(tr(c.content,r-1,1),r-1,S<0?c.openEnd:r-1):new x(tr(c.content,r,f),c.openStart,c.openEnd)};It.prototype.mustMoveInline=function(){if(!this.$to.parent.isTextblock||this.$to.end()==this.$to.pos)return-1;var t=this.frontier[this.depth],r;if(!t.type.isTextblock||!En(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(r=this.findCloseLevel(this.$to))&&r.depth==this.depth)return-1;for(var n=this.$to,o=n.depth,i=this.$to.after(o);o>1&&i==this.$to.end(--o);)++i;return i};It.prototype.findCloseLevel=function(t){t:for(var r=Math.min(this.depth,t.depth);r>=0;r--){var n=this.frontier[r],o=n.match,i=n.type,s=r<t.depth&&t.end(r+1)==t.pos+(t.depth-(r+1)),a=En(t,r,i,o,s);if(a){for(var c=r-1;c>=0;c--){var l=this.frontier[c],u=l.match,f=l.type,p=En(t,c,f,u,!0);if(!p||p.childCount)continue t}return{depth:r,fit:a,move:s?t.doc.resolve(t.after(r+1)):t}}}};It.prototype.close=function(t){var r=this.findCloseLevel(t);if(!r)return null;for(;this.depth>r.depth;)this.closeFrontierNode();r.fit.childCount&&(this.placed=pr(this.placed,r.depth,r.fit)),t=r.move;for(var n=r.depth+1;n<=t.depth;n++){var o=t.node(n),i=o.type.contentMatch.fillBefore(o.content,!0,t.index(n));this.openFrontierNode(o.type,o.attrs,i)}return t};It.prototype.openFrontierNode=function(t,r,n){var o=this.frontier[this.depth];o.match=o.match.matchType(t),this.placed=pr(this.placed,this.depth,k.from(t.create(r,n))),this.frontier.push({type:t,match:t.contentMatch})};It.prototype.closeFrontierNode=function(){var t=this.frontier.pop(),r=t.match.fillBefore(k.empty,!0);r.childCount&&(this.placed=pr(this.placed,this.frontier.length,r))};Object.defineProperties(It.prototype,is);function tr(e,t,r){return t==0?e.cutByIndex(r):e.replaceChild(0,e.firstChild.copy(tr(e.firstChild.content,t-1,r)))}function pr(e,t,r){return t==0?e.append(r):e.replaceChild(e.childCount-1,e.lastChild.copy(pr(e.lastChild.content,t-1,r)))}function ro(e,t){for(var r=0;r<t;r++)e=e.firstChild.content;return e}function ss(e,t,r){if(t<=0)return e;var n=e.content;return t>1&&(n=n.replaceChild(0,ss(n.firstChild,t-1,n.childCount==1?r-1:0))),t>0&&(n=e.type.contentMatch.fillBefore(n).append(n),r<=0&&(n=n.append(e.type.contentMatch.matchFragment(n).fillBefore(k.empty,!0)))),e.copy(n)}function En(e,t,r,n,o){var i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!r.compatibleContent(i.type))return null;var a=n.fillBefore(i.content,!0,s);return a&&!Ac(r,i.content,s)?a:null}function Ac(e,t,r){for(var n=r;n<t.childCount;n++)if(!e.allowsMarks(t.child(n).marks))return!0;return!1}Y.prototype.replaceRange=function(e,t,r){if(!r.size)return this.deleteRange(e,t);var n=this.doc.resolve(e),o=this.doc.resolve(t);if(ns(n,o,r))return this.step(new Qt(e,t,r));var i=cs(n,this.doc.resolve(t));i[i.length-1]==0&&i.pop();var s=-(n.depth+1);i.unshift(s);for(var a=n.depth,c=n.pos-1;a>0;a--,c--){var l=n.node(a).type.spec;if(l.defining||l.isolating)break;i.indexOf(a)>-1?s=a:n.before(a)==c&&i.splice(1,0,-a)}for(var u=i.indexOf(s),f=[],p=r.openStart,d=r.content,h=0;;h++){var v=d.firstChild;if(f.push(v),h==r.openStart)break;d=v.content}p>0&&f[p-1].type.spec.defining&&n.node(u).type!=f[p-1].type?p-=1:p>=2&&f[p-1].isTextblock&&f[p-2].type.spec.defining&&n.node(u).type!=f[p-2].type&&(p-=2);for(var g=r.openStart;g>=0;g--){var S=(g+p+1)%(r.openStart+1),y=f[S];if(y)for(var I=0;I<i.length;I++){var m=i[(I+u)%i.length],D=!0;m<0&&(D=!1,m=-m);var C=n.node(m-1),L=n.index(m-1);if(C.canReplaceWith(L,L,y.type,y.marks))return this.replace(n.before(m),D?o.after(m):t,new x(as(r.content,0,r.openStart,S),S,r.openEnd))}}for(var q=this.steps.length,$=i.length-1;$>=0&&(this.replace(e,t,r),!(this.steps.length>q));$--){var w=i[$];w<0||(e=n.before(w),t=o.after(w))}return this};function as(e,t,r,n,o){if(t<r){var i=e.firstChild;e=e.replaceChild(0,i.copy(as(i.content,t+1,r,n,i)))}if(t>n){var s=o.contentMatchAt(0),a=s.fillBefore(e).append(e);e=a.append(s.matchFragment(a).fillBefore(k.empty,!0))}return e}Y.prototype.replaceRangeWith=function(e,t,r){if(!r.isInline&&e==t&&this.doc.resolve(e).parent.content.size){var n=wc(this.doc,e,r.type);n!=null&&(e=t=n)}return this.replaceRange(e,t,new x(k.from(r),0,0))};Y.prototype.deleteRange=function(e,t){for(var r=this.doc.resolve(e),n=this.doc.resolve(t),o=cs(r,n),i=0;i<o.length;i++){var s=o[i],a=i==o.length-1;if(a&&s==0||r.node(s).type.contentMatch.validEnd)return this.delete(r.start(s),n.end(s));if(s>0&&(a||r.node(s-1).canReplace(r.index(s-1),n.indexAfter(s-1))))return this.delete(r.before(s),n.after(s))}for(var c=1;c<=r.depth&&c<=n.depth;c++)if(e-r.start(c)==r.depth-c&&t>r.end(c)&&n.end(c)-t!=n.depth-c)return this.delete(r.before(c),t);return this.delete(e,t)};function cs(e,t){for(var r=[],n=Math.min(e.depth,t.depth),o=n;o>=0;o--){var i=e.start(o);if(i<e.pos-(e.depth-o)||t.end(o)>t.pos+(t.depth-o)||e.node(o).type.spec.isolating||t.node(o).type.spec.isolating)break;i==t.start(o)&&r.push(o)}return r}var Dn=Object.create(null),E=function(t,r,n){this.ranges=n||[new _c(t.min(r),t.max(r))],this.$anchor=t,this.$head=r},ce={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};ce.anchor.get=function(){return this.$anchor.pos};ce.head.get=function(){return this.$head.pos};ce.from.get=function(){return this.$from.pos};ce.to.get=function(){return this.$to.pos};ce.$from.get=function(){return this.ranges[0].$from};ce.$to.get=function(){return this.ranges[0].$to};ce.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};E.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)};E.prototype.replace=function(t,r){r===void 0&&(r=x.empty);for(var n=r.content.lastChild,o=null,i=0;i<r.openEnd;i++)o=n,n=n.lastChild;for(var s=t.steps.length,a=this.ranges,c=0;c<a.length;c++){var l=a[c],u=l.$from,f=l.$to,p=t.mapping.slice(s);t.replaceRange(p.map(u.pos),p.map(f.pos),c?x.empty:r),c==0&&ls(t,s,(n?n.isInline:o&&o.isTextblock)?-1:1)}};E.prototype.replaceWith=function(t,r){for(var n=t.steps.length,o=this.ranges,i=0;i<o.length;i++){var s=o[i],a=s.$from,c=s.$to,l=t.mapping.slice(n),u=l.map(a.pos),f=l.map(c.pos);i?t.deleteRange(u,f):(t.replaceRangeWith(u,f,r),ls(t,n,r.isInline?-1:1))}};E.findFrom=function(t,r,n){var o=t.parent.inlineContent?new H(t):Ne(t.node(0),t.parent,t.pos,t.index(),r,n);if(o)return o;for(var i=t.depth-1;i>=0;i--){var s=r<0?Ne(t.node(0),t.node(i),t.before(i+1),t.index(i),r,n):Ne(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,r,n);if(s)return s}};E.near=function(t,r){return r===void 0&&(r=1),this.findFrom(t,r)||this.findFrom(t,-r)||new le(t.node(0))};E.atStart=function(t){return Ne(t,t,0,0,1)||new le(t)};E.atEnd=function(t){return Ne(t,t,t.content.size,t.childCount,-1)||new le(t)};E.fromJSON=function(t,r){if(!r||!r.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Dn[r.type];if(!n)throw new RangeError("No selection type "+r.type+" defined");return n.fromJSON(t,r)};E.jsonID=function(t,r){if(t in Dn)throw new RangeError("Duplicate use of selection JSON ID "+t);return Dn[t]=r,r.prototype.jsonID=t,r};E.prototype.getBookmark=function(){return H.between(this.$anchor,this.$head).getBookmark()};Object.defineProperties(E.prototype,ce);E.prototype.visible=!0;var _c=function(t,r){this.$from=t,this.$to=r},H=function(e){function t(n,o){o===void 0&&(o=n),e.call(this,n,o)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={$cursor:{configurable:!0}};return r.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},t.prototype.map=function(o,i){var s=o.resolve(i.map(this.head));if(!s.parent.inlineContent)return e.near(s);var a=o.resolve(i.map(this.anchor));return new t(a.parent.inlineContent?a:s,s)},t.prototype.replace=function(o,i){if(i===void 0&&(i=x.empty),e.prototype.replace.call(this,o,i),i==x.empty){var s=this.$from.marksAcross(this.$to);s&&o.ensureMarks(s)}},t.prototype.eq=function(o){return o instanceof t&&o.anchor==this.anchor&&o.head==this.head},t.prototype.getBookmark=function(){return new er(this.anchor,this.head)},t.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},t.fromJSON=function(o,i){if(typeof i.anchor!="number"||typeof i.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new t(o.resolve(i.anchor),o.resolve(i.head))},t.create=function(o,i,s){s===void 0&&(s=i);var a=o.resolve(i);return new this(a,s==i?a:o.resolve(s))},t.between=function(o,i,s){var a=o.pos-i.pos;if((!s||a)&&(s=a>=0?1:-1),!i.parent.inlineContent){var c=e.findFrom(i,s,!0)||e.findFrom(i,-s,!0);if(c)i=c.$head;else return e.near(i,s)}return o.parent.inlineContent||(a==0?o=i:(o=(e.findFrom(o,-s,!0)||e.findFrom(o,s,!0)).$anchor,o.pos<i.pos!=a<0&&(o=i))),new t(o,i)},Object.defineProperties(t.prototype,r),t}(E);E.jsonID("text",H);var er=function(t,r){this.anchor=t,this.head=r};er.prototype.map=function(t){return new er(t.map(this.anchor),t.map(this.head))};er.prototype.resolve=function(t){return H.between(t.resolve(this.anchor),t.resolve(this.head))};var N=function(e){function t(r){var n=r.nodeAfter,o=r.node(0).resolve(r.pos+n.nodeSize);e.call(this,r,o),this.node=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.map=function(n,o){var i=o.mapResult(this.anchor),s=i.deleted,a=i.pos,c=n.resolve(a);return s?e.near(c):new t(c)},t.prototype.content=function(){return new x(k.from(this.node),0,0)},t.prototype.eq=function(n){return n instanceof t&&n.anchor==this.anchor},t.prototype.toJSON=function(){return{type:"node",anchor:this.anchor}},t.prototype.getBookmark=function(){return new wr(this.anchor)},t.fromJSON=function(n,o){if(typeof o.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new t(n.resolve(o.anchor))},t.create=function(n,o){return new this(n.resolve(o))},t.isSelectable=function(n){return!n.isText&&n.type.spec.selectable!==!1},t}(E);N.prototype.visible=!1;E.jsonID("node",N);var wr=function(t){this.anchor=t};wr.prototype.map=function(t){var r=t.mapResult(this.anchor),n=r.deleted,o=r.pos;return n?new er(o,o):new wr(o)};wr.prototype.resolve=function(t){var r=t.resolve(this.anchor),n=r.nodeAfter;return n&&N.isSelectable(n)?new N(r):E.near(r)};var le=function(e){function t(r){e.call(this,r.resolve(0),r.resolve(r.content.size))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.replace=function(n,o){if(o===void 0&&(o=x.empty),o==x.empty){n.delete(0,n.doc.content.size);var i=e.atStart(n.doc);i.eq(n.selection)||n.setSelection(i)}else e.prototype.replace.call(this,n,o)},t.prototype.toJSON=function(){return{type:"all"}},t.fromJSON=function(n){return new t(n)},t.prototype.map=function(n){return new t(n)},t.prototype.eq=function(n){return n instanceof t},t.prototype.getBookmark=function(){return Nc},t}(E);E.jsonID("all",le);var Nc={map:function(){return this},resolve:function(t){return new le(t)}};function Ne(e,t,r,n,o,i){if(t.inlineContent)return H.create(e,r);for(var s=n-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){var a=t.child(s);if(a.isAtom){if(!i&&N.isSelectable(a))return N.create(e,r-(o<0?a.nodeSize:0))}else{var c=Ne(e,a,r+o,o<0?a.childCount:0,o,i);if(c)return c}r+=a.nodeSize*o}}function ls(e,t,r){var n=e.steps.length-1;if(!(n<t)){var o=e.steps[n];if(o instanceof Qt||o instanceof Mt){var i=e.mapping.maps[n],s;i.forEach(function(a,c,l,u){s==null&&(s=u)}),e.setSelection(E.near(e.doc.resolve(s),r))}}}var Wo=1,br=2,Ko=4,Ec=function(e){function t(n){e.call(this,n.doc),this.time=Date.now(),this.curSelection=n.selection,this.curSelectionFor=0,this.storedMarks=n.storedMarks,this.updated=0,this.meta=Object.create(null)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={selection:{configurable:!0},selectionSet:{configurable:!0},storedMarksSet:{configurable:!0},isGeneric:{configurable:!0},scrolledIntoView:{configurable:!0}};return r.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},t.prototype.setSelection=function(o){if(o.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=o,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Wo)&~br,this.storedMarks=null,this},r.selectionSet.get=function(){return(this.updated&Wo)>0},t.prototype.setStoredMarks=function(o){return this.storedMarks=o,this.updated|=br,this},t.prototype.ensureMarks=function(o){return R.sameSet(this.storedMarks||this.selection.$from.marks(),o)||this.setStoredMarks(o),this},t.prototype.addStoredMark=function(o){return this.ensureMarks(o.addToSet(this.storedMarks||this.selection.$head.marks()))},t.prototype.removeStoredMark=function(o){return this.ensureMarks(o.removeFromSet(this.storedMarks||this.selection.$head.marks()))},r.storedMarksSet.get=function(){return(this.updated&br)>0},t.prototype.addStep=function(o,i){e.prototype.addStep.call(this,o,i),this.updated=this.updated&~br,this.storedMarks=null},t.prototype.setTime=function(o){return this.time=o,this},t.prototype.replaceSelection=function(o){return this.selection.replace(this,o),this},t.prototype.replaceSelectionWith=function(o,i){var s=this.selection;return i!==!1&&(o=o.mark(this.storedMarks||(s.empty?s.$from.marks():s.$from.marksAcross(s.$to)||R.none))),s.replaceWith(this,o),this},t.prototype.deleteSelection=function(){return this.selection.replace(this),this},t.prototype.insertText=function(o,i,s){s===void 0&&(s=i);var a=this.doc.type.schema;if(i==null)return o?this.replaceSelectionWith(a.text(o),!0):this.deleteSelection();if(!o)return this.deleteRange(i,s);var c=this.storedMarks;if(!c){var l=this.doc.resolve(i);c=s==i?l.marks():l.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(i,s,a.text(o,c)),this.selection.empty||this.setSelection(E.near(this.selection.$to)),this},t.prototype.setMeta=function(o,i){return this.meta[typeof o=="string"?o:o.key]=i,this},t.prototype.getMeta=function(o){return this.meta[typeof o=="string"?o:o.key]},r.isGeneric.get=function(){for(var n in this.meta)return!1;return!0},t.prototype.scrollIntoView=function(){return this.updated|=Ko,this},r.scrolledIntoView.get=function(){return(this.updated&Ko)>0},Object.defineProperties(t.prototype,r),t}(Y);function $o(e,t){return!t||!e?e:e.bind(t)}var Je=function(t,r,n){this.name=t,this.init=$o(r.init,n),this.apply=$o(r.apply,n)},Dc=[new Je("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new Je("selection",{init:function(t,r){return t.selection||E.atStart(r.doc)},apply:function(t){return t.selection}}),new Je("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,r,n,o){return o.selection.$cursor?t.storedMarks:null}}),new Je("scrollToSelection",{init:function(){return 0},apply:function(t,r){return t.scrolledIntoView?r+1:r}})],no=function(t,r){var n=this;this.schema=t,this.fields=Dc.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),r&&r.forEach(function(o){if(n.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");n.plugins.push(o),n.pluginsByKey[o.key]=o,o.spec.state&&n.fields.push(new Je(o.key,o.spec.state,o))})},dt=function(t){this.config=t},jr={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};jr.schema.get=function(){return this.config.schema};jr.plugins.get=function(){return this.config.plugins};dt.prototype.apply=function(t){return this.applyTransaction(t).state};dt.prototype.filterTransaction=function(t,r){r===void 0&&(r=-1);for(var n=0;n<this.config.plugins.length;n++)if(n!=r){var o=this.config.plugins[n];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,t,this))return!1}return!0};dt.prototype.applyTransaction=function(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};for(var r=[t],n=this.applyInner(t),o=null;;){for(var i=!1,s=0;s<this.config.plugins.length;s++){var a=this.config.plugins[s];if(a.spec.appendTransaction){var c=o?o[s].n:0,l=o?o[s].state:this,u=c<r.length&&a.spec.appendTransaction.call(a,c?r.slice(c):r,l,n);if(u&&n.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",t),!o){o=[];for(var f=0;f<this.config.plugins.length;f++)o.push(f<s?{state:n,n:r.length}:{state:this,n:0})}r.push(u),n=n.applyInner(u),i=!0}o&&(o[s]={state:n,n:r.length})}}if(!i)return{state:n,transactions:r}}};dt.prototype.applyInner=function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var r=new dt(this.config),n=this.config.fields,o=0;o<n.length;o++){var i=n[o];r[i.name]=i.apply(t,this[i.name],this,r)}for(var s=0;s<rr.length;s++)rr[s](this,t,r);return r};jr.tr.get=function(){return new Ec(this)};dt.create=function(t){for(var r=new no(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new dt(r),o=0;o<r.fields.length;o++)n[r.fields[o].name]=r.fields[o].init(t,n);return n};dt.prototype.reconfigure=function(t){for(var r=new no(this.schema,t.plugins),n=r.fields,o=new dt(r),i=0;i<n.length;i++){var s=n[i].name;o[s]=this.hasOwnProperty(s)?this[s]:n[i].init(t,o)}return o};dt.prototype.toJSON=function(t){var r={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(r.storedMarks=this.storedMarks.map(function(s){return s.toJSON()})),t&&typeof t=="object")for(var n in t){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");var o=t[n],i=o.spec.state;i&&i.toJSON&&(r[n]=i.toJSON.call(o,this[o.key]))}return r};dt.fromJSON=function(t,r,n){if(!r)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var o=new no(t.schema,t.plugins),i=new dt(o);return o.fields.forEach(function(s){if(s.name=="doc")i.doc=P.fromJSON(t.schema,r.doc);else if(s.name=="selection")i.selection=E.fromJSON(i.doc,r.selection);else if(s.name=="storedMarks")r.storedMarks&&(i.storedMarks=r.storedMarks.map(t.schema.markFromJSON));else{if(n)for(var a in n){var c=n[a],l=c.spec.state;if(c.key==s.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(r,a)){i[s.name]=l.fromJSON.call(c,t,r[a],i);return}}i[s.name]=s.init(t,i)}}),i};dt.addApplyListener=function(t){rr.push(t)};dt.removeApplyListener=function(t){var r=rr.indexOf(t);r>-1&&rr.splice(r,1)};Object.defineProperties(dt.prototype,jr);var rr=[];function us(e,t,r){for(var n in e){var o=e[n];o instanceof Function?o=o.bind(t):n=="handleDOMEvents"&&(o=us(o,t,{})),r[n]=o}return r}var Rt=function(t){this.props={},t.props&&us(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:fs("plugin")};Rt.prototype.getState=function(t){return t[this.key]};var sn=Object.create(null);function fs(e){return e in sn?e+"$"+ ++sn[e]:(sn[e]=0,e+"$")}var Kt=function(t){t===void 0&&(t="key"),this.key=fs(t)};Kt.prototype.get=function(t){return t.config.pluginsByKey[this.key]};Kt.prototype.getState=function(t){return t[this.key]};var M={};if(typeof navigator<"u"&&typeof document<"u"){var an=/Edge\/(\d+)/.exec(navigator.userAgent),Uo=/MSIE \d/.test(navigator.userAgent),cn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);M.mac=/Mac/.test(navigator.platform);var ln=M.ie=!!(Uo||cn||an);M.ie_version=Uo?document.documentMode||6:cn?+cn[1]:an?+an[1]:null,M.gecko=!ln&&/gecko\/(\d+)/i.test(navigator.userAgent),M.gecko_version=M.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var un=!ln&&/Chrome\/(\d+)/.exec(navigator.userAgent);M.chrome=!!un,M.chrome_version=un&&+un[1],M.safari=!ln&&/Apple Computer/.test(navigator.vendor),M.ios=M.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),M.android=/Android \d/.test(navigator.userAgent),M.webkit="webkitFontSmoothing"in document.documentElement.style,M.webkit_version=M.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Dt=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},oo=function(e){var t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},Go=null,Yt=function(e,t,r){var n=Go||(Go=document.createRange());return n.setEnd(e,r??e.nodeValue.length),n.setStart(e,t||0),n},Tr=function(e,t,r,n){return r&&(Yo(e,t,r,n,-1)||Yo(e,t,r,n,1))},Ic=/^(img|br|input|textarea|hr)$/i;function Yo(e,t,r,n,o){for(;;){if(e==r&&t==n)return!0;if(t==(o<0?0:qt(e))){var i=e.parentNode;if(i.nodeType!=1||Pc(e)||Ic.test(e.nodeName)||e.contentEditable=="false")return!1;t=Dt(e)+(o<0?0:1),e=i}else if(e.nodeType==1){if(e=e.childNodes[t+(o<0?-1:0)],e.contentEditable=="false")return!1;t=o<0?qt(e):0}else return!1}}function qt(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Rc(e,t,r){for(var n=t==0,o=t==qt(e);n||o;){if(e==r)return!0;var i=Dt(e);if(e=e.parentNode,!e)return!1;n=n&&i==0,o=o&&i==qt(e)}}function Pc(e){for(var t,r=e;r&&!(t=r.pmViewDesc);r=r.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var io=function(e){var t=e.isCollapsed;return t&&M.chrome&&e.rangeCount&&!e.getRangeAt(0).collapsed&&(t=!1),t};function Ae(e,t){var r=document.createEvent("Event");return r.initEvent("keydown",!0,!0),r.keyCode=e,r.key=r.code=t,r}function zc(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function te(e,t){return typeof e=="number"?e:e[t]}function Bc(e){var t=e.getBoundingClientRect(),r=t.width/e.offsetWidth||1,n=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*r,top:t.top,bottom:t.top+e.clientHeight*n}}function Xo(e,t,r){for(var n=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument,s=r||e.dom;s;s=oo(s))if(s.nodeType==1){var a=s==i.body||s.nodeType!=1,c=a?zc(i):Bc(s),l=0,u=0;if(t.top<c.top+te(n,"top")?u=-(c.top-t.top+te(o,"top")):t.bottom>c.bottom-te(n,"bottom")&&(u=t.bottom-c.bottom+te(o,"bottom")),t.left<c.left+te(n,"left")?l=-(c.left-t.left+te(o,"left")):t.right>c.right-te(n,"right")&&(l=t.right-c.right+te(o,"right")),l||u)if(a)i.defaultView.scrollBy(l,u);else{var f=s.scrollLeft,p=s.scrollTop;u&&(s.scrollTop+=u),l&&(s.scrollLeft+=l);var d=s.scrollLeft-f,h=s.scrollTop-p;t={left:t.left-d,top:t.top-h,right:t.right-d,bottom:t.bottom-h}}if(a)break}}function Lc(e){for(var t=e.dom.getBoundingClientRect(),r=Math.max(0,t.top),n,o,i=(t.left+t.right)/2,s=r+1;s<Math.min(innerHeight,t.bottom);s+=5){var a=e.root.elementFromPoint(i,s);if(!(a==e.dom||!e.dom.contains(a))){var c=a.getBoundingClientRect();if(c.top>=r-20){n=a,o=c.top;break}}}return{refDOM:n,refTop:o,stack:ps(e.dom)}}function ps(e){for(var t=[],r=e.ownerDocument;e&&(t.push({dom:e,top:e.scrollTop,left:e.scrollLeft}),e!=r);e=oo(e));return t}function Fc(e){var t=e.refDOM,r=e.refTop,n=e.stack,o=t?t.getBoundingClientRect().top:0;ds(n,o==0?0:o-r)}function ds(e,t){for(var r=0;r<e.length;r++){var n=e[r],o=n.dom,i=n.top,s=n.left;o.scrollTop!=i+t&&(o.scrollTop=i+t),o.scrollLeft!=s&&(o.scrollLeft=s)}}var Te=null;function Vc(e){if(e.setActive)return e.setActive();if(Te)return e.focus(Te);var t=ps(e);e.focus(Te==null?{get preventScroll(){return Te={preventScroll:!0},!0}}:void 0),Te||(Te=!1,ds(t,0))}function hs(e,t){for(var r,n=2e8,o,i=0,s=t.top,a=t.top,c=e.firstChild,l=0;c;c=c.nextSibling,l++){var u=void 0;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=Yt(c).getClientRects();else continue;for(var f=0;f<u.length;f++){var p=u[f];if(p.top<=s&&p.bottom>=a){s=Math.max(p.bottom,s),a=Math.min(p.top,a);var d=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(d<n){r=c,n=d,o=d&&r.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,c.nodeType==1&&d&&(i=l+(t.left>=(p.left+p.right)/2?1:0));continue}}!r&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(i=l+1)}}return r&&r.nodeType==3?Hc(r,o):!r||n&&r.nodeType==1?{node:e,offset:i}:hs(r,o)}function Hc(e,t){for(var r=e.nodeValue.length,n=document.createRange(),o=0;o<r;o++){n.setEnd(e,o+1),n.setStart(e,o);var i=ee(n,1);if(i.top!=i.bottom&&so(t,i))return{node:e,offset:o+(t.left>=(i.left+i.right)/2?1:0)}}return{node:e,offset:0}}function so(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function jc(e,t){var r=e.parentNode;return r&&/^li$/i.test(r.nodeName)&&t.left<e.getBoundingClientRect().left?r:e}function qc(e,t,r){var n=hs(t,r),o=n.node,i=n.offset,s=-1;if(o.nodeType==1&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&r.left>(a.left+a.right)/2?1:-1}return e.docView.posFromDOM(o,i,s)}function Jc(e,t,r,n){for(var o=-1,i=t;i!=e.dom;){var s=e.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>n.left||a.top>n.top)o=s.posBefore;else if(a.right<n.left||a.bottom<n.top)o=s.posAfter;else break}i=s.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,r)}function ms(e,t,r){var n=e.childNodes.length;if(n&&r.top<r.bottom)for(var o=Math.max(0,Math.min(n-1,Math.floor(n*(t.top-r.top)/(r.bottom-r.top))-2)),i=o;;){var s=e.childNodes[i];if(s.nodeType==1)for(var a=s.getClientRects(),c=0;c<a.length;c++){var l=a[c];if(so(t,l))return ms(s,t,l)}if((i=(i+1)%n)==o)break}return e}function Wc(e,t){var r,n,o=e.root,i,s;if(o.caretPositionFromPoint)try{var a=o.caretPositionFromPoint(t.left,t.top);a&&(r=a,i=r.offsetNode,s=r.offset)}catch{}if(!i&&o.caretRangeFromPoint){var c=o.caretRangeFromPoint(t.left,t.top);c&&(n=c,i=n.startContainer,s=n.startOffset)}var l=o.elementFromPoint(t.left,t.top+1),u;if(!l||!e.dom.contains(l.nodeType!=1?l.parentNode:l)){var f=e.dom.getBoundingClientRect();if(!so(t,f)||(l=ms(e.dom,t,f),!l))return null}if(M.safari)for(var p=l;i&&p;p=oo(p))p.draggable&&(i=s=null);if(l=jc(l,t),i){if(M.gecko&&i.nodeType==1&&(s=Math.min(s,i.childNodes.length),s<i.childNodes.length)){var d=i.childNodes[s],h;d.nodeName=="IMG"&&(h=d.getBoundingClientRect()).right<=t.left&&h.bottom>t.top&&s++}i==e.dom&&s==i.childNodes.length-1&&i.lastChild.nodeType==1&&t.top>i.lastChild.getBoundingClientRect().bottom?u=e.state.doc.content.size:(s==0||i.nodeType!=1||i.childNodes[s-1].nodeName!="BR")&&(u=Jc(e,i,s,t))}u==null&&(u=qc(e,l,t));var v=e.docView.nearestDesc(l,!0);return{pos:u,inside:v?v.posAtStart-v.border:-1}}function ee(e,t){var r=e.getClientRects();return r.length?r[t<0?0:r.length-1]:e.getBoundingClientRect()}var Kc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function vs(e,t,r){var n=e.docView.domFromPos(t,r<0?-1:1),o=n.node,i=n.offset,s=M.webkit||M.gecko;if(o.nodeType==3)if(s&&(Kc.test(o.nodeValue)||(r<0?!i:i==o.nodeValue.length))){var a=ee(Yt(o,i,i),r);if(M.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){var c=ee(Yt(o,i-1,i-1),-1);if(c.top==a.top){var l=ee(Yt(o,i,i+1),-1);if(l.top!=a.top)return qe(l,l.left<c.left)}}return a}else{var u=i,f=i,p=r<0?1:-1;return r<0&&!i?(f++,p=-1):r>=0&&i==o.nodeValue.length?(u--,p=1):r<0?u--:f++,qe(ee(Yt(o,u,f),p),p<0)}if(!e.state.doc.resolve(t).parent.inlineContent){if(i&&(r<0||i==qt(o))){var d=o.childNodes[i-1];if(d.nodeType==1)return fn(d.getBoundingClientRect(),!1)}if(i<qt(o)){var h=o.childNodes[i];if(h.nodeType==1)return fn(h.getBoundingClientRect(),!0)}return fn(o.getBoundingClientRect(),r>=0)}if(i&&(r<0||i==qt(o))){var v=o.childNodes[i-1],g=v.nodeType==3?Yt(v,qt(v)-(s?0:1)):v.nodeType==1&&(v.nodeName!="BR"||!v.nextSibling)?v:null;if(g)return qe(ee(g,1),!1)}if(i<qt(o)){var S=o.childNodes[i],y=S.nodeType==3?Yt(S,0,s?0:1):S.nodeType==1?S:null;if(y)return qe(ee(y,-1),!0)}return qe(ee(o.nodeType==3?Yt(o):o,-r),r>=0)}function qe(e,t){if(e.width==0)return e;var r=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:r,right:r}}function fn(e,t){if(e.height==0)return e;var r=t?e.top:e.bottom;return{top:r,bottom:r,left:e.left,right:e.right}}function gs(e,t,r){var n=e.state,o=e.root.activeElement;n!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return r()}finally{n!=t&&e.updateState(n),o!=e.dom&&o&&o.focus()}}function $c(e,t,r){var n=t.selection,o=r=="up"?n.$from:n.$to;return gs(e,t,function(){for(var i=e.docView.domFromPos(o.pos,r=="up"?-1:1),s=i.node;;){var a=e.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.dom;break}s=a.dom.parentNode}for(var c=vs(e,o.pos,1),l=s.firstChild;l;l=l.nextSibling){var u=void 0;if(l.nodeType==1)u=l.getClientRects();else if(l.nodeType==3)u=Yt(l,0,l.nodeValue.length).getClientRects();else continue;for(var f=0;f<u.length;f++){var p=u[f];if(p.bottom>p.top&&(r=="up"?p.bottom<c.top+1:p.top>c.bottom-1))return!1}}return!0})}var Uc=/[\u0590-\u08ac]/;function Gc(e,t,r){var n=t.selection,o=n.$head;if(!o.parent.isTextblock)return!1;var i=o.parentOffset,s=!i,a=i==o.parent.content.size,c=e.root.getSelection();return!Uc.test(o.parent.textContent)||!c.modify?r=="left"||r=="backward"?s:a:gs(e,t,function(){var l=c.getRangeAt(0),u=c.focusNode,f=c.focusOffset,p=c.caretBidiLevel;c.modify("move",r,"character");var d=o.depth?e.docView.domAfterPos(o.before()):e.dom,h=!d.contains(c.focusNode.nodeType==1?c.focusNode:c.focusNode.parentNode)||u==c.focusNode&&f==c.focusOffset;return c.removeAllRanges(),c.addRange(l),p!=null&&(c.caretBidiLevel=p),h})}var Qo=null,Zo=null,ti=!1;function Yc(e,t,r){return Qo==t&&Zo==r?ti:(Qo=t,Zo=r,ti=r=="up"||r=="down"?$c(e,t,r):Gc(e,t,r))}var Lt=0,ys=1,Ue=2,ie=3,J=function(t,r,n,o){this.parent=t,this.children=r,this.dom=n,n.pmViewDesc=this,this.contentDOM=o,this.dirty=Lt},$t={beforePosition:{configurable:!0},size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0}};J.prototype.matchesWidget=function(){return!1};J.prototype.matchesMark=function(){return!1};J.prototype.matchesNode=function(){return!1};J.prototype.matchesHack=function(t){return!1};$t.beforePosition.get=function(){return!1};J.prototype.parseRule=function(){return null};J.prototype.stopEvent=function(){return!1};$t.size.get=function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e};$t.border.get=function(){return 0};J.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var t=0;t<this.children.length;t++)this.children[t].destroy()};J.prototype.posBeforeChild=function(t){for(var r=0,n=this.posAtStart;r<this.children.length;r++){var o=this.children[r];if(o==t)return n;n+=o.size}};$t.posBefore.get=function(){return this.parent.posBeforeChild(this)};$t.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0};$t.posAfter.get=function(){return this.posBefore+this.size};$t.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border};J.prototype.localPosFromDOM=function(t,r,n){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(n<0){var o,i;if(t==this.contentDOM)o=t.childNodes[r-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.previousSibling}for(;o&&!((i=o.pmViewDesc)&&i.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(i)+i.size:this.posAtStart}else{var s,a;if(t==this.contentDOM)s=t.childNodes[r];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;s=t.nextSibling}for(;s&&!((a=s.pmViewDesc)&&a.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(a):this.posAtEnd}var c;if(t==this.dom&&this.contentDOM)c=r>Dt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))c=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(r==0)for(var l=t;;l=l.parentNode){if(l==this.dom){c=!1;break}if(l.parentNode.firstChild!=l)break}if(c==null&&r==t.childNodes.length)for(var u=t;;u=u.parentNode){if(u==this.dom){c=!0;break}if(u.parentNode.lastChild!=u)break}}return c??n>0?this.posAtEnd:this.posAtStart};J.prototype.nearestDesc=function(t,r){for(var n=!0,o=t;o;o=o.parentNode){var i=this.getDesc(o);if(i&&(!r||i.node))if(n&&i.nodeDOM&&!(i.nodeDOM.nodeType==1?i.nodeDOM.contains(t.nodeType==1?t:t.parentNode):i.nodeDOM==t))n=!1;else return i}};J.prototype.getDesc=function(t){for(var r=t.pmViewDesc,n=r;n;n=n.parent)if(n==this)return r};J.prototype.posFromDOM=function(t,r,n){for(var o=t;o;o=o.parentNode){var i=this.getDesc(o);if(i)return i.localPosFromDOM(t,r,n)}return-1};J.prototype.descAt=function(t){for(var r=0,n=0;r<this.children.length;r++){var o=this.children[r],i=n+o.size;if(n==t&&i!=n){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(t<i)return o.descAt(t-n-o.border);n=i}};J.prototype.domFromPos=function(t,r){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,o=0,i=!0;;o++,i=!1){for(;o<this.children.length&&(this.children[o].beforePosition||this.children[o].dom.parentNode!=this.contentDOM);)n+=this.children[o++].size;var s=o==this.children.length?null:this.children[o];if(n==t&&(r==0||!s||!s.size||s.border||r<0&&i)||s&&s.domAtom&&t<n+s.size)return{node:this.contentDOM,offset:s?Dt(s.dom):this.contentDOM.childNodes.length};if(!s)throw new Error("Invalid position "+t);var a=n+s.size;if(!s.domAtom&&(r<0&&!s.border?a>=t:a>t)&&(a>t||o+1>=this.children.length||!this.children[o+1].beforePosition))return s.domFromPos(t-n-s.border,r);n=a}};J.prototype.parseRange=function(t,r,n){if(n===void 0&&(n=0),this.children.length==0)return{node:this.contentDOM,from:t,to:r,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var o=-1,i=-1,s=n,a=0;;a++){var c=this.children[a],l=s+c.size;if(o==-1&&t<=l){var u=s+c.border;if(t>=u&&r<=l-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(t,r,u);t=s;for(var f=a;f>0;f--){var p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){o=Dt(p.dom)+1;break}t-=p.size}o==-1&&(o=0)}if(o>-1&&(l>r||a==this.children.length-1)){r=l;for(var d=a+1;d<this.children.length;d++){var h=this.children[d];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){i=Dt(h.dom);break}r+=h.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=l}return{node:this.contentDOM,from:t,to:r,fromOffset:o,toOffset:i}};J.prototype.emptyChildAt=function(t){if(this.border||!this.contentDOM||!this.children.length)return!1;var r=this.children[t<0?0:this.children.length-1];return r.size==0||r.emptyChildAt(t)};J.prototype.domAfterPos=function(t){var r=this.domFromPos(t,0),n=r.node,o=r.offset;if(n.nodeType!=1||o==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[o]};J.prototype.setSelection=function(t,r,n,o){for(var i=Math.min(t,r),s=Math.max(t,r),a=0,c=0;a<this.children.length;a++){var l=this.children[a],u=c+l.size;if(i>c&&s<u)return l.setSelection(t-c-l.border,r-c-l.border,n,o);c=u}var f=this.domFromPos(t,t?-1:1),p=r==t?f:this.domFromPos(r,r?-1:1),d=n.getSelection(),h=!1;if((M.gecko||M.safari)&&t==r){var v=f.node,g=f.offset;if(v.nodeType==3){if(h=g&&v.nodeValue[g-1]==`
|
||
`,h&&g==v.nodeValue.length)for(var S=v,y=void 0;S;S=S.parentNode){if(y=S.nextSibling){y.nodeName=="BR"&&(f=p={node:y.parentNode,offset:Dt(y)+1});break}var I=S.pmViewDesc;if(I&&I.node&&I.node.isBlock)break}}else{var m=v.childNodes[g-1];h=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(M.gecko&&d.focusNode&&d.focusNode!=p.node&&d.focusNode.nodeType==1){var D=d.focusNode.childNodes[d.focusOffset];D&&D.contentEditable=="false"&&(o=!0)}if(!(!(o||h&&M.safari)&&Tr(f.node,f.offset,d.anchorNode,d.anchorOffset)&&Tr(p.node,p.offset,d.focusNode,d.focusOffset))){var C=!1;if((d.extend||t==r)&&!h){d.collapse(f.node,f.offset);try{t!=r&&d.extend(p.node,p.offset),C=!0}catch($){if(!($ instanceof DOMException))throw $}}if(!C){if(t>r){var L=f;f=p,p=L}var q=document.createRange();q.setEnd(p.node,p.offset),q.setStart(f.node,f.offset),d.removeAllRanges(),d.addRange(q)}}};J.prototype.ignoreMutation=function(t){return!this.contentDOM&&t.type!="selection"};$t.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)};J.prototype.markDirty=function(t,r){for(var n=0,o=0;o<this.children.length;o++){var i=this.children[o],s=n+i.size;if(n==s?t<=s&&r>=n:t<s&&r>n){var a=n+i.border,c=s-i.border;if(t>=a&&r<=c){this.dirty=t==n||r==s?Ue:ys,t==a&&r==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=ie:i.markDirty(t-a,r-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM?Ue:ie}n=s}this.dirty=Ue};J.prototype.markParentsDirty=function(){for(var t=1,r=this.parent;r;r=r.parent,t++){var n=t==1?Ue:ys;r.dirty<n&&(r.dirty=n)}};$t.domAtom.get=function(){return!1};Object.defineProperties(J.prototype,$t);var se=[],Xc=function(e){function t(n,o,i,s){var a,c=o.type.toDOM;if(typeof c=="function"&&(c=c(i,function(){if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)})),!o.type.spec.raw){if(c.nodeType!=1){var l=document.createElement("span");l.appendChild(c),c=l}c.contentEditable=!1,c.classList.add("ProseMirror-widget")}e.call(this,n,se,c,null),this.widget=o,a=this}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={beforePosition:{configurable:!0},domAtom:{configurable:!0}};return r.beforePosition.get=function(){return this.widget.type.side<0},t.prototype.matchesWidget=function(o){return this.dirty==Lt&&o.type.eq(this.widget.type)},t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.stopEvent=function(o){var i=this.widget.spec.stopEvent;return i?i(o):!1},t.prototype.ignoreMutation=function(o){return o.type!="selection"||this.widget.spec.ignoreSelection},r.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,r),t}(J),Qc=function(e){function t(n,o,i,s){e.call(this,n,se,o,null),this.textDOM=i,this.text=s}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={size:{configurable:!0}};return r.size.get=function(){return this.text.length},t.prototype.localPosFromDOM=function(o,i){return o!=this.textDOM?this.posAtStart+(i?this.size:0):this.posAtStart+i},t.prototype.domFromPos=function(o){return{node:this.textDOM,offset:o}},t.prototype.ignoreMutation=function(o){return o.type==="characterData"&&o.target.nodeValue==o.oldValue},Object.defineProperties(t.prototype,r),t}(J),ao=function(e){function t(r,n,o,i){e.call(this,r,[],o,i),this.mark=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.create=function(n,o,i,s){var a=s.nodeViews[o.type.name],c=a&&a(o,s,i);return(!c||!c.dom)&&(c=st.renderSpec(document,o.type.spec.toDOM(o,i))),new t(n,o,c.dom,c.contentDOM||c.dom)},t.prototype.parseRule=function(){return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},t.prototype.matchesMark=function(n){return this.dirty!=ie&&this.mark.eq(n)},t.prototype.markDirty=function(n,o){if(e.prototype.markDirty.call(this,n,o),this.dirty!=Lt){for(var i=this.parent;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=Lt}},t.prototype.slice=function(n,o,i){var s=t.create(this.parent,this.mark,!0,i),a=this.children,c=this.size;o<c&&(a=Pn(a,o,c,i)),n>0&&(a=Pn(a,0,n,i));for(var l=0;l<a.length;l++)a[l].parent=s;return s.children=a,s},t}(J),dr=function(e){function t(n,o,i,s,a,c,l,u,f){e.call(this,n,o.isLeaf?se:[],a,c),this.nodeDOM=l,this.node=o,this.outerDeco=i,this.innerDeco=s,c&&this.updateChildren(u,f)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return t.create=function(o,i,s,a,c,l){var u,f=c.nodeViews[i.type.name],p,d=f&&f(i,c,function(){if(!p)return l;if(p.parent)return p.parent.posBeforeChild(p)},s,a),h=d&&d.dom,v=d&&d.contentDOM;if(i.isText){if(!h)h=document.createTextNode(i.text);else if(h.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else h||(u=st.renderSpec(document,i.type.spec.toDOM(i)),h=u.dom,v=u.contentDOM);!v&&!i.isText&&h.nodeName!="BR"&&(h.hasAttribute("contenteditable")||(h.contentEditable=!1),i.type.spec.draggable&&(h.draggable=!0));var g=h;return h=xs(h,s,i),d?p=new tl(o,i,s,a,h,v,g,d,c,l+1):i.isText?new ks(o,i,s,a,h,g,c):new t(o,i,s,a,h,v,g,c,l+1)},t.prototype.parseRule=function(){var o=this;if(this.node.type.spec.reparseInView)return null;var i={node:this.node.type.name,attrs:this.node.attrs};return this.node.type.spec.code&&(i.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?i.contentElement=this.contentDOM:i.getContent=function(){return o.contentDOM?k.empty:o.node.content},i},t.prototype.matchesNode=function(o,i,s){return this.dirty==Lt&&o.eq(this.node)&&Rn(i,this.outerDeco)&&s.eq(this.innerDeco)},r.size.get=function(){return this.node.nodeSize},r.border.get=function(){return this.node.isLeaf?0:1},t.prototype.updateChildren=function(o,i){var s=this,a=this.node.inlineContent,c=i,l=o.composing&&this.localCompositionInfo(o,i),u=l&&l.pos>-1?l:null,f=l&&l.pos<0,p=new Pt(this,u&&u.node);ol(this.node,this.innerDeco,function(d,h,v){d.spec.marks?p.syncToMarks(d.spec.marks,a,o):d.type.side>=0&&!v&&p.syncToMarks(h==s.node.childCount?R.none:s.node.child(h).marks,a,o),p.placeWidget(d,o,c)},function(d,h,v,g){p.syncToMarks(d.marks,a,o);var S;p.findNodeMatch(d,h,v,g)||f&&o.state.selection.from>c&&o.state.selection.to<c+d.nodeSize&&(S=p.findIndexWithChild(l.node))>-1&&p.updateNodeAt(d,h,v,S,o)||p.updateNextNode(d,h,v,o,g)||p.addNode(d,h,v,o,c),c+=d.nodeSize}),p.syncToMarks(se,a,o),this.node.isTextblock&&p.addTextblockHacks(),p.destroyRest(),(p.changed||this.dirty==Ue)&&(u&&this.protectLocalComposition(o,u),Ss(this.contentDOM,this.children,o),M.ios&&il(this.dom))},t.prototype.localCompositionInfo=function(o,i){var s=o.state.selection,a=s.from,c=s.to;if(!(!(o.state.selection instanceof H)||a<i||c>i+this.node.content.size)){var l=o.root.getSelection(),u=sl(l.focusNode,l.focusOffset);if(!(!u||!this.dom.contains(u.parentNode)))if(this.node.inlineContent){var f=u.nodeValue,p=al(this.node.content,f,a-i,c-i);return p<0?null:{node:u,pos:p,text:f}}else return{node:u,pos:-1}}},t.prototype.protectLocalComposition=function(o,i){var s=i.node,a=i.pos,c=i.text;if(!this.getDesc(s)){for(var l=s;l.parentNode!=this.contentDOM;l=l.parentNode){for(;l.previousSibling;)l.parentNode.removeChild(l.previousSibling);for(;l.nextSibling;)l.parentNode.removeChild(l.nextSibling);l.pmViewDesc&&(l.pmViewDesc=null)}var u=new Qc(this,l,s,c);o.compositionNodes.push(u),this.children=Pn(this.children,a,a+c.length,o,u)}},t.prototype.update=function(o,i,s,a){return this.dirty==ie||!o.sameMarkup(this.node)?!1:(this.updateInner(o,i,s,a),!0)},t.prototype.updateInner=function(o,i,s,a){this.updateOuterDeco(i),this.node=o,this.innerDeco=s,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=Lt},t.prototype.updateOuterDeco=function(o){if(!Rn(o,this.outerDeco)){var i=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=Ms(this.dom,this.nodeDOM,In(this.outerDeco,this.node,i),In(o,this.node,i)),this.dom!=s&&(s.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=o}},t.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)},t.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable")},r.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(t.prototype,r),t}(J);function bs(e,t,r,n,o){return xs(n,t,e),new dr(null,e,t,r,n,n,n,o,0)}var ks=function(e){function t(n,o,i,s,a,c,l){e.call(this,n,o,i,s,a,null,c,l)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){for(var o=this.nodeDOM.parentNode;o&&o!=this.dom&&!o.pmIsDeco;)o=o.parentNode;return{skip:o||!0}},t.prototype.update=function(o,i,s,a){return this.dirty==ie||this.dirty!=Lt&&!this.inParent()||!o.sameMarkup(this.node)?!1:(this.updateOuterDeco(i),(this.dirty!=Lt||o.text!=this.node.text)&&o.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=o.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=o,this.dirty=Lt,!0)},t.prototype.inParent=function(){for(var o=this.parent.contentDOM,i=this.nodeDOM;i;i=i.parentNode)if(i==o)return!0;return!1},t.prototype.domFromPos=function(o){return{node:this.nodeDOM,offset:o}},t.prototype.localPosFromDOM=function(o,i,s){return o==this.nodeDOM?this.posAtStart+Math.min(i,this.node.text.length):e.prototype.localPosFromDOM.call(this,o,i,s)},t.prototype.ignoreMutation=function(o){return o.type!="characterData"&&o.type!="selection"},t.prototype.slice=function(o,i,s){var a=this.node.cut(o,i),c=document.createTextNode(a.text);return new t(this.parent,a,this.outerDeco,this.innerDeco,c,c,s)},t.prototype.markDirty=function(o,i){e.prototype.markDirty.call(this,o,i),this.dom!=this.nodeDOM&&(o==0||i==this.nodeDOM.nodeValue.length)&&(this.dirty=ie)},r.domAtom.get=function(){return!1},Object.defineProperties(t.prototype,r),t}(dr),Zc=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={domAtom:{configurable:!0}};return t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.matchesHack=function(o){return this.dirty==Lt&&this.dom.nodeName==o},r.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,r),t}(J),tl=function(e){function t(r,n,o,i,s,a,c,l,u,f){e.call(this,r,n,o,i,s,a,c,u,f),this.spec=l}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.update=function(n,o,i,s){if(this.dirty==ie)return!1;if(this.spec.update){var a=this.spec.update(n,o,i);return a&&this.updateInner(n,o,i,s),a}else return!this.contentDOM&&!n.isLeaf?!1:e.prototype.update.call(this,n,o,i,s)},t.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():e.prototype.selectNode.call(this)},t.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():e.prototype.deselectNode.call(this)},t.prototype.setSelection=function(n,o,i,s){this.spec.setSelection?this.spec.setSelection(n,o,i):e.prototype.setSelection.call(this,n,o,i,s)},t.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),e.prototype.destroy.call(this)},t.prototype.stopEvent=function(n){return this.spec.stopEvent?this.spec.stopEvent(n):!1},t.prototype.ignoreMutation=function(n){return this.spec.ignoreMutation?this.spec.ignoreMutation(n):e.prototype.ignoreMutation.call(this,n)},t}(dr);function Ss(e,t,r){for(var n=e.firstChild,o=!1,i=0;i<t.length;i++){var s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=n;)n=ei(n),o=!0;n=n.nextSibling}else o=!0,e.insertBefore(a,n);if(s instanceof ao){var c=n?n.previousSibling:e.lastChild;Ss(s.contentDOM,s.children,r),n=c?c.nextSibling:e.firstChild}}for(;n;)n=ei(n),o=!0;o&&r.trackWrites==e&&(r.trackWrites=null)}function Ge(e){e&&(this.nodeName=e)}Ge.prototype=Object.create(null);var me=[new Ge];function In(e,t,r){if(e.length==0)return me;for(var n=r?me[0]:new Ge,o=[n],i=0;i<e.length;i++){var s=e[i].type.attrs;if(s){s.nodeName&&o.push(n=new Ge(s.nodeName));for(var a in s){var c=s[a];c!=null&&(r&&o.length==1&&o.push(n=new Ge(t.isInline?"span":"div")),a=="class"?n.class=(n.class?n.class+" ":"")+c:a=="style"?n.style=(n.style?n.style+";":"")+c:a!="nodeName"&&(n[a]=c))}}}return o}function Ms(e,t,r,n){if(r==me&&n==me)return t;for(var o=t,i=0;i<n.length;i++){var s=n[i],a=r[i];if(i){var c=void 0;a&&a.nodeName==s.nodeName&&o!=e&&(c=o.parentNode)&&c.tagName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(o),a=me[0]),o=c}el(o,a||me[0],s)}return o}function el(e,t,r){for(var n in t)n!="class"&&n!="style"&&n!="nodeName"&&!(n in r)&&e.removeAttribute(n);for(var o in r)o!="class"&&o!="style"&&o!="nodeName"&&r[o]!=t[o]&&e.setAttribute(o,r[o]);if(t.class!=r.class){for(var i=t.class?t.class.split(" ").filter(Boolean):se,s=r.class?r.class.split(" ").filter(Boolean):se,a=0;a<i.length;a++)s.indexOf(i[a])==-1&&e.classList.remove(i[a]);for(var c=0;c<s.length;c++)i.indexOf(s[c])==-1&&e.classList.add(s[c])}if(t.style!=r.style){if(t.style)for(var l=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,u;u=l.exec(t.style);)e.style.removeProperty(u[1]);r.style&&(e.style.cssText+=r.style)}}function xs(e,t,r){return Ms(e,e,me,In(t,r,e.nodeType!=1))}function Rn(e,t){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(!e[r].type.eq(t[r].type))return!1;return!0}function ei(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var Pt=function(t,r){this.top=t,this.lock=r,this.index=0,this.stack=[],this.changed=!1,this.preMatch=rl(t.node.content,t.children)};Pt.prototype.destroyBetween=function(t,r){if(t!=r){for(var n=t;n<r;n++)this.top.children[n].destroy();this.top.children.splice(t,r-t),this.changed=!0}};Pt.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)};Pt.prototype.syncToMarks=function(t,r,n){for(var o=0,i=this.stack.length>>1,s=Math.min(i,t.length);o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(t[o])&&t[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=Lt,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<t.length;){this.stack.push(this.top,this.index+1);for(var a=-1,c=this.index;c<Math.min(this.index+3,this.top.children.length);c++)if(this.top.children[c].matchesMark(t[i])){a=c;break}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var l=ao.create(this.top,t[i],r,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}};Pt.prototype.findNodeMatch=function(t,r,n,o){var i=this.top.children,s=-1;if(o>=this.preMatch.index){for(var a=this.index;a<i.length;a++)if(i[a].matchesNode(t,r,n)){s=a;break}}else for(var c=this.index,l=Math.min(i.length,c+1);c<l;c++){var u=i[c];if(u.matchesNode(t,r,n)&&!this.preMatch.matched.has(u)){s=c;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)};Pt.prototype.updateNodeAt=function(t,r,n,o,i){var s=this.top.children[o];return s.update(t,r,n,i)?(this.destroyBetween(this.index,o),this.index=o+1,!0):!1};Pt.prototype.findIndexWithChild=function(t){for(;;){var r=t.parentNode;if(!r)return-1;if(r==this.top.contentDOM){var n=t.pmViewDesc;if(n){for(var o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==n)return o}return-1}t=r}};Pt.prototype.updateNextNode=function(t,r,n,o,i){for(var s=this.index;s<this.top.children.length;s++){var a=this.top.children[s];if(a instanceof dr){var c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;var l=a.dom,u=this.lock&&(l==this.lock||l.nodeType==1&&l.contains(this.lock.parentNode))&&!(t.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==t.text&&a.dirty!=ie&&Rn(r,a.outerDeco));if(!u&&a.update(t,r,n,o))return this.destroyBetween(this.index,s),a.dom!=l&&(this.changed=!0),this.index++,!0;break}}return!1};Pt.prototype.addNode=function(t,r,n,o,i){this.top.children.splice(this.index++,0,dr.create(this.top,t,r,n,o,i)),this.changed=!0};Pt.prototype.placeWidget=function(t,r,n){var o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(t)&&(t==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{var i=new Xc(this.top,t,r,n);this.top.children.splice(this.index++,0,i),this.changed=!0}};Pt.prototype.addTextblockHacks=function(){for(var t=this.top.children[this.index-1];t instanceof ao;)t=t.children[t.children.length-1];(!t||!(t instanceof ks)||/\n$/.test(t.node.text))&&((M.safari||M.chrome)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG"),this.addHackNode("BR"))};Pt.prototype.addHackNode=function(t){if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack(t))this.index++;else{var r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator"),this.top.children.splice(this.index++,0,new Zc(this.top,se,r,null)),this.changed=!0}};function rl(e,t){for(var r=e.childCount,n=t.length,o=new Map;r>0&&n>0;n--){var i=t[n-1],s=i.node;if(s){if(s!=e.child(r-1))break;--r,o.set(i,r)}}return{index:r,matched:o}}function nl(e,t){return e.type.side-t.type.side}function ol(e,t,r,n){var o=t.locals(e),i=0;if(o.length==0){for(var s=0;s<e.childCount;s++){var a=e.child(s);n(a,o,t.forChild(i,a),s),i+=a.nodeSize}return}for(var c=0,l=[],u=null,f=0;;){if(c<o.length&&o[c].to==i){for(var p=o[c++],d=void 0;c<o.length&&o[c].to==i;)(d||(d=[p])).push(o[c++]);if(d){d.sort(nl);for(var h=0;h<d.length;h++)r(d[h],f,!!u)}else r(p,f,!!u)}var v=void 0,g=void 0;if(u)g=-1,v=u,u=null;else if(f<e.childCount)g=f,v=e.child(f++);else break;for(var S=0;S<l.length;S++)l[S].to<=i&&l.splice(S--,1);for(;c<o.length&&o[c].from<=i&&o[c].to>i;)l.push(o[c++]);var y=i+v.nodeSize;if(v.isText){var I=y;c<o.length&&o[c].from<I&&(I=o[c].from);for(var m=0;m<l.length;m++)l[m].to<I&&(I=l[m].to);I<y&&(u=v.cut(I-i),v=v.cut(0,I-i),y=I,g=-1)}var D=l.length?v.isInline&&!v.isLeaf?l.filter(function(C){return!C.inline}):l.slice():se;n(v,D,t.forChild(i,v),g),i=y}}function il(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 sl(e,t){for(;;){if(e.nodeType==3)return e;if(e.nodeType==1&&t>0){if(e.childNodes.length>t&&e.childNodes[t].nodeType==3)return e.childNodes[t];e=e.childNodes[t-1],t=qt(e)}else if(e.nodeType==1&&t<e.childNodes.length)e=e.childNodes[t],t=0;else return null}}function al(e,t,r,n){for(var o=0,i=0;o<e.childCount&&i<=n;){var s=e.child(o++),a=i;if(i+=s.nodeSize,!!s.isText){for(var c=s.text;o<e.childCount;){var l=e.child(o++);if(i+=l.nodeSize,!l.isText)break;c+=l.text}if(i>=r){var u=c.lastIndexOf(t,n-a);if(u>=0&&u+t.length+a>=r)return a+u}}}return-1}function Pn(e,t,r,n,o){for(var i=[],s=0,a=0;s<e.length;s++){var c=e[s],l=a,u=a+=c.size;l>=r||u<=t?i.push(c):(l<t&&i.push(c.slice(0,t-l,n)),o&&(i.push(o),o=null),u>r&&i.push(c.slice(r-l,c.size,n)))}return i}function Cs(e,t){var r=e.root.getSelection(),n=e.state.doc;if(!r.focusNode)return null;var o=e.docView.nearestDesc(r.focusNode),i=o&&o.size==0,s=e.docView.posFromDOM(r.focusNode,r.focusOffset);if(s<0)return null;var a=n.resolve(s),c,l;if(io(r)){for(c=a;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&N.isSelectable(o.node)&&o.parent&&!(o.node.isInline&&Rc(r.focusNode,r.focusOffset,o.dom))){var u=o.posBefore;l=new N(s==u?a:n.resolve(u))}}else{var f=e.docView.posFromDOM(r.anchorNode,r.anchorOffset);if(f<0)return null;c=n.resolve(f)}if(!l){var p=t=="pointer"||e.state.selection.head<a.pos&&!i?1:-1;l=co(e,c,a,p)}return l}function Os(e){return e.editable?e.hasFocus():lo(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function ue(e,t){var r=e.state.selection;if(ws(e,r),!!Os(e)){if(!t&&e.mouseDown&&e.mouseDown.allowDefault){e.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}if(e.domObserver.disconnectSelection(),e.cursorWrapper)ll(e);else{var n=r.anchor,o=r.head,i,s;ri&&!(r instanceof H)&&(r.$from.parent.inlineContent||(i=ni(e,r.from)),!r.empty&&!r.$from.parent.inlineContent&&(s=ni(e,r.to))),e.docView.setSelection(n,o,e.root,t),ri&&(i&&oi(i),s&&oi(s)),r.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&cl(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var ri=M.safari||M.chrome&&M.chrome_version<63;function ni(e,t){var r=e.docView.domFromPos(t,0),n=r.node,o=r.offset,i=o<n.childNodes.length?n.childNodes[o]:null,s=o?n.childNodes[o-1]:null;if(M.safari&&i&&i.contentEditable=="false")return pn(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return pn(i);if(s)return pn(s)}}function pn(e){return e.contentEditable="true",M.safari&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function oi(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function cl(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.hideSelectionGuard);var r=e.root.getSelection(),n=r.anchorNode,o=r.anchorOffset;t.addEventListener("selectionchange",e.hideSelectionGuard=function(){(r.anchorNode!=n||r.anchorOffset!=o)&&(t.removeEventListener("selectionchange",e.hideSelectionGuard),setTimeout(function(){(!Os(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function ll(e){var t=e.root.getSelection(),r=document.createRange(),n=e.cursorWrapper.dom,o=n.nodeName=="IMG";o?r.setEnd(n.parentNode,Dt(n)+1):r.setEnd(n,0),r.collapse(!1),t.removeAllRanges(),t.addRange(r),!o&&!e.state.selection.visible&&M.ie&&M.ie_version<=11&&(n.disabled=!0,n.disabled=!1)}function ws(e,t){if(t instanceof N){var r=e.docView.descAt(t.from);r!=e.lastSelectedViewDesc&&(ii(e),r&&r.selectNode(),e.lastSelectedViewDesc=r)}else ii(e)}function ii(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=null)}function co(e,t,r,n){return e.someProp("createSelectionBetween",function(o){return o(e,t,r)})||H.between(t,r,n)}function ul(e){return e.editable&&e.root.activeElement!=e.dom?!1:lo(e)}function lo(e){var t=e.root.getSelection();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 fl(e){var t=e.docView.domFromPos(e.state.selection.anchor,0),r=e.root.getSelection();return Tr(t.node,t.offset,r.anchorNode,r.anchorOffset)}function zn(e,t){var r=e.selection,n=r.$anchor,o=r.$head,i=t>0?n.max(o):n.min(o),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&E.findFrom(s,t)}function he(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function si(e,t,r){var n=e.state.selection;if(n instanceof H){if(!n.empty||r.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"right":"left")){var o=zn(e.state,t);return o&&o instanceof N?he(e,o):!1}else if(!(M.mac&&r.indexOf("m")>-1)){var i=n.$head,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,a;if(!s||s.isText)return!1;var c=t<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(a=e.docView.descAt(c))&&!a.contentDOM?N.isSelectable(s)?he(e,new N(t<0?e.state.doc.resolve(i.pos-s.nodeSize):i)):M.webkit?he(e,new H(e.state.doc.resolve(t<0?c:c+s.nodeSize))):!1:!1}}else{if(n instanceof N&&n.node.isInline)return he(e,new H(t>0?n.$to:n.$from));var l=zn(e.state,t);return l?he(e,l):!1}}function Ar(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Ye(e){var t=e.pmViewDesc;return t&&t.size==0&&(e.nextSibling||e.nodeName!="BR")}function dn(e){var t=e.root.getSelection(),r=t.focusNode,n=t.focusOffset;if(r){var o,i,s=!1;for(M.gecko&&r.nodeType==1&&n<Ar(r)&&Ye(r.childNodes[n])&&(s=!0);;)if(n>0){if(r.nodeType!=1)break;var a=r.childNodes[n-1];if(Ye(a))o=r,i=--n;else if(a.nodeType==3)r=a,n=r.nodeValue.length;else break}else{if(Ts(r))break;for(var c=r.previousSibling;c&&Ye(c);)o=r.parentNode,i=Dt(c),c=c.previousSibling;if(c)r=c,n=Ar(r);else{if(r=r.parentNode,r==e.dom)break;n=0}}s?Bn(e,t,r,n):o&&Bn(e,t,o,i)}}function hn(e){var t=e.root.getSelection(),r=t.focusNode,n=t.focusOffset;if(r){for(var o=Ar(r),i,s;;)if(n<o){if(r.nodeType!=1)break;var a=r.childNodes[n];if(Ye(a))i=r,s=++n;else break}else{if(Ts(r))break;for(var c=r.nextSibling;c&&Ye(c);)i=c.parentNode,s=Dt(c)+1,c=c.nextSibling;if(c)r=c,n=0,o=Ar(r);else{if(r=r.parentNode,r==e.dom)break;n=o=0}}i&&Bn(e,t,i,s)}}function Ts(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Bn(e,t,r,n){if(io(t)){var o=document.createRange();o.setEnd(r,n),o.setStart(r,n),t.removeAllRanges(),t.addRange(o)}else t.extend&&t.extend(r,n);e.domObserver.setCurSelection();var i=e.state;setTimeout(function(){e.state==i&&ue(e)},50)}function ai(e,t,r){var n=e.state.selection;if(n instanceof H&&!n.empty||r.indexOf("s")>-1||M.mac&&r.indexOf("m")>-1)return!1;var o=n.$from,i=n.$to;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var s=zn(e.state,t);if(s&&s instanceof N)return he(e,s)}if(!o.parent.inlineContent){var a=t<0?o:i,c=n instanceof le?E.near(a,t):E.findFrom(a,t);return c?he(e,c):!1}return!1}function ci(e,t){if(!(e.state.selection instanceof H))return!0;var r=e.state.selection,n=r.$head,o=r.$anchor,i=r.empty;if(!n.sameParent(o))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var s=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){var a=e.state.tr;return t<0?a.delete(n.pos-s.nodeSize,n.pos):a.delete(n.pos,n.pos+s.nodeSize),e.dispatch(a),!0}return!1}function li(e,t,r){e.domObserver.stop(),t.contentEditable=r,e.domObserver.start()}function pl(e){if(!(!M.safari||e.state.selection.$head.parentOffset>0)){var t=e.root.getSelection(),r=t.focusNode,n=t.focusOffset;if(r&&r.nodeType==1&&n==0&&r.firstChild&&r.firstChild.contentEditable=="false"){var o=r.firstChild;li(e,o,!0),setTimeout(function(){return li(e,o,!1)},20)}}}function dl(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function hl(e,t){var r=t.keyCode,n=dl(t);return r==8||M.mac&&r==72&&n=="c"?ci(e,-1)||dn(e):r==46||M.mac&&r==68&&n=="c"?ci(e,1)||hn(e):r==13||r==27?!0:r==37?si(e,-1,n)||dn(e):r==39?si(e,1,n)||hn(e):r==38?ai(e,-1,n)||dn(e):r==40?pl(e)||ai(e,1,n)||hn(e):n==(M.mac?"m":"c")&&(r==66||r==73||r==89||r==90)}function ml(e,t,r){var n=e.docView.parseRange(t,r),o=n.node,i=n.fromOffset,s=n.toOffset,a=n.from,c=n.to,l=e.root.getSelection(),u=null,f=l.anchorNode;if(f&&e.dom.contains(f.nodeType==1?f:f.parentNode)&&(u=[{node:f,offset:l.anchorOffset}],io(l)||u.push({node:l.focusNode,offset:l.focusOffset})),M.chrome&&e.lastKeyCode===8)for(var p=s;p>i;p--){var d=o.childNodes[p-1],h=d.pmViewDesc;if(d.nodeName=="BR"&&!h){s=p;break}if(!h||h.size)break}var v=e.state.doc,g=e.someProp("domParser")||Bt.fromSchema(e.state.schema),S=v.resolve(a),y=null,I=g.parse(o,{topNode:S.parent,topMatch:S.parent.contentMatchAt(S.index()),topOpen:!0,from:i,to:s,preserveWhitespace:S.parent.type.spec.code?"full":!0,editableContent:!0,findPositions:u,ruleFromNode:vl,context:S});if(u&&u[0].pos!=null){var m=u[0].pos,D=u[1]&&u[1].pos;D==null&&(D=m),y={anchor:m+a,head:D+a}}return{doc:I,sel:y,from:a,to:c}}function vl(e){var t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(M.safari&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||M.safari&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0}}function gl(e,t,r,n,o){if(t<0){var i=e.lastSelectionTime>Date.now()-50?e.lastSelectionOrigin:null,s=Cs(e,i);if(s&&!e.state.selection.eq(s)){var a=e.state.tr.setSelection(s);i=="pointer"?a.setMeta("pointer",!0):i=="key"&&a.scrollIntoView(),e.dispatch(a)}return}var c=e.state.doc.resolve(t),l=c.sharedDepth(r);t=c.before(l+1),r=e.state.doc.resolve(r).after(l+1);var u=e.state.selection,f=ml(e,t,r);if(M.chrome&&e.cursorWrapper&&f.sel&&f.sel.anchor==e.cursorWrapper.deco.from){var p=e.cursorWrapper.deco.type.toDOM.nextSibling,d=p&&p.nodeValue?p.nodeValue.length:1;f.sel={anchor:f.sel.anchor+d,head:f.sel.anchor+d}}var h=e.state.doc,v=h.slice(f.from,f.to),g,S;e.lastKeyCode===8&&Date.now()-100<e.lastKeyCodeTime?(g=e.state.selection.to,S="end"):(g=e.state.selection.from,S="start"),e.lastKeyCode=null;var y=kl(v.content,f.doc.content,f.from,g,S);if(!y)if(n&&u instanceof H&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))y={start:u.from,endA:u.to,endB:u.to};else if((M.ios&&e.lastIOSEnter>Date.now()-225||M.android)&&o.some(function(G){return G.nodeName=="DIV"||G.nodeName=="P"})&&e.someProp("handleKeyDown",function(G){return G(e,Ae(13,"Enter"))})){e.lastIOSEnter=0;return}else{if(f.sel){var I=ui(e,e.state.doc,f.sel);I&&!I.eq(e.state.selection)&&e.dispatch(e.state.tr.setSelection(I))}return}e.domChangeCount++,e.state.selection.from<e.state.selection.to&&y.start==y.endB&&e.state.selection instanceof H&&(y.start>e.state.selection.from&&y.start<=e.state.selection.from+2?y.start=e.state.selection.from:y.endA<e.state.selection.to&&y.endA>=e.state.selection.to-2&&(y.endB+=e.state.selection.to-y.endA,y.endA=e.state.selection.to)),M.ie&&M.ie_version<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>f.from&&f.doc.textBetween(y.start-f.from-1,y.start-f.from+1)==" "&&(y.start--,y.endA--,y.endB--);var m=f.doc.resolveNoCache(y.start-f.from),D=f.doc.resolveNoCache(y.endB-f.from),C=m.sameParent(D)&&m.parent.inlineContent,L;if((M.ios&&e.lastIOSEnter>Date.now()-225&&(!C||o.some(function(G){return G.nodeName=="DIV"||G.nodeName=="P"}))||!C&&m.pos<f.doc.content.size&&(L=E.findFrom(f.doc.resolve(m.pos+1),1,!0))&&L.head==D.pos)&&e.someProp("handleKeyDown",function(G){return G(e,Ae(13,"Enter"))})){e.lastIOSEnter=0;return}if(e.state.selection.anchor>y.start&&bl(h,y.start,y.endA,m,D)&&e.someProp("handleKeyDown",function(G){return G(e,Ae(8,"Backspace"))})){M.android&&M.chrome&&e.domObserver.suppressSelectionUpdates();return}M.chrome&&M.android&&y.toB==y.from&&(e.lastAndroidDelete=Date.now()),M.android&&!C&&m.start()!=D.start()&&D.parentOffset==0&&m.depth==D.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==y.endA&&(y.endB-=2,D=f.doc.resolveNoCache(y.endB-f.from),setTimeout(function(){e.someProp("handleKeyDown",function(G){return G(e,Ae(13,"Enter"))})},20));var q=y.start,$=y.endA,w,Gt,et,lt;if(C){if(m.pos==D.pos)M.ie&&M.ie_version<=11&&m.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(function(){return ue(e)},20)),w=e.state.tr.delete(q,$),Gt=h.resolve(y.start).marksAcross(h.resolve(y.endA));else if(y.endA==y.endB&&(lt=h.resolve(y.start))&&(et=yl(m.parent.content.cut(m.parentOffset,D.parentOffset),lt.parent.content.cut(lt.parentOffset,y.endA-lt.start()))))w=e.state.tr,et.type=="add"?w.addMark(q,$,et.mark):w.removeMark(q,$,et.mark);else if(m.parent.child(m.index()).isText&&m.index()==D.index()-(D.textOffset?0:1)){var Ht=m.parent.textBetween(m.parentOffset,D.parentOffset);if(e.someProp("handleTextInput",function(G){return G(e,q,$,Ht)}))return;w=e.state.tr.insertText(Ht,q,$)}}if(w||(w=e.state.tr.replace(q,$,f.doc.slice(y.start-f.from,y.endB-f.from))),f.sel){var U=ui(e,w.doc,f.sel);U&&!(M.chrome&&M.android&&e.composing&&U.empty&&(y.start!=y.endB||e.lastAndroidDelete<Date.now()-100)&&(U.head==q||U.head==w.mapping.map($)-1)||M.ie&&U.empty&&U.head==q)&&w.setSelection(U)}Gt&&w.ensureMarks(Gt),e.dispatch(w.scrollIntoView())}function ui(e,t,r){return Math.max(r.anchor,r.head)>t.content.size?null:co(e,t.resolve(r.anchor),t.resolve(r.head))}function yl(e,t){for(var r=e.firstChild.marks,n=t.firstChild.marks,o=r,i=n,s,a,c,l=0;l<n.length;l++)o=n[l].removeFromSet(o);for(var u=0;u<r.length;u++)i=r[u].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",c=function(d){return d.mark(a.addToSet(d.marks))};else if(o.length==0&&i.length==1)a=i[0],s="remove",c=function(d){return d.mark(a.removeFromSet(d.marks))};else return null;for(var f=[],p=0;p<t.childCount;p++)f.push(c(t.child(p)));if(k.from(f).eq(e))return{mark:a,type:s}}function bl(e,t,r,n,o){if(!n.parent.isTextblock||r-t<=o.pos-n.pos||mn(n,!0,!1)<o.pos)return!1;var i=e.resolve(t);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;var s=e.resolve(mn(i,!0,!0));return!s.parent.isTextblock||s.pos>r||mn(s,!0,!1)<r?!1:n.parent.content.cut(n.parentOffset).eq(s.parent.content)}function mn(e,t,r){for(var n=e.depth,o=t?e.end():e.pos;n>0&&(t||e.indexAfter(n)==e.node(n).childCount);)n--,o++,t=!1;if(r)for(var i=e.node(n).maybeChild(e.indexAfter(n));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function kl(e,t,r,n,o){var i=e.findDiffStart(t,r);if(i==null)return null;var s=e.findDiffEnd(t,r+e.size,r+t.size),a=s.a,c=s.b;if(o=="end"){var l=Math.max(0,i-Math.min(a,c));n-=a+l-i}if(a<i&&e.size<t.size){var u=n<=i&&n>=a?i-n:0;i-=u,c=i+(c-a),a=i}else if(c<i){var f=n<=i&&n>=c?i-n:0;i-=f,a=i+(a-c),c=i}return{start:i,endA:a,endB:c}}function As(e,t){for(var r=[],n=t.content,o=t.openStart,i=t.openEnd;o>1&&i>1&&n.childCount==1&&n.firstChild.childCount==1;){o--,i--;var s=n.firstChild;r.push(s.type.name,s.attrs!=s.type.defaultAttrs?s.attrs:null),n=s.content}var a=e.someProp("clipboardSerializer")||st.fromSchema(e.state.schema),c=Rs(),l=c.createElement("div");l.appendChild(a.serializeFragment(n,{document:c}));for(var u=l.firstChild,f;u&&u.nodeType==1&&(f=Is[u.nodeName.toLowerCase()]);){for(var p=f.length-1;p>=0;p--){for(var d=c.createElement(f[p]);l.firstChild;)d.appendChild(l.firstChild);l.appendChild(d),f[p]!="tbody"&&(o++,i++)}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(r));var h=e.someProp("clipboardTextSerializer",function(v){return v(t)})||t.content.textBetween(0,t.content.size,`
|
||
|
||
`);return{dom:l,text:h}}function _s(e,t,r,n,o){var i,s=o.parent.type.spec.code,a;if(!r&&!t)return null;var c=t&&(n||s||!r);if(c){if(e.someProp("transformPastedText",function(S){t=S(t,s||n)}),s)return new x(k.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
||
`))),0,0);var l=e.someProp("clipboardTextParser",function(S){return S(t,o,n)});if(l)a=l;else{var u=o.marks(),f=e.state,p=f.schema,d=st.fromSchema(p);i=document.createElement("div"),t.trim().split(/(?:\r\n?|\n)+/).forEach(function(S){i.appendChild(document.createElement("p")).appendChild(d.serializeNode(p.text(S,u)))})}}else e.someProp("transformPastedHTML",function(S){r=S(r)}),i=xl(r),M.webkit&&Cl(i);var h=i&&i.querySelector("[data-pm-slice]"),v=h&&/^(\d+) (\d+) (.*)/.exec(h.getAttribute("data-pm-slice"));if(!a){var g=e.someProp("clipboardParser")||e.someProp("domParser")||Bt.fromSchema(e.state.schema);a=g.parseSlice(i,{preserveWhitespace:!!(c||v),context:o})}return v?a=Ol(Ml(a,+v[1],+v[2]),v[3]):a=x.maxOpen(Sl(a.content,o),!1),e.someProp("transformPasted",function(S){a=S(a)}),a}function Sl(e,t){if(e.childCount<2)return e;for(var r=function(i){var s=t.node(i),a=s.contentMatchAt(t.index(i)),c=void 0,l=[];if(e.forEach(function(u){if(l){var f=a.findWrapping(u.type),p;if(!f)return l=null;if(p=l.length&&c.length&&Es(f,c,u,l[l.length-1],0))l[l.length-1]=p;else{l.length&&(l[l.length-1]=Ds(l[l.length-1],c.length));var d=Ns(u,f);l.push(d),a=a.matchType(d.type,d.attrs),c=f}}}),l)return{v:k.from(l)}},n=t.depth;n>=0;n--){var o=r(n);if(o)return o.v}return e}function Ns(e,t,r){r===void 0&&(r=0);for(var n=t.length-1;n>=r;n--)e=t[n].create(null,k.from(e));return e}function Es(e,t,r,n,o){if(o<e.length&&o<t.length&&e[o]==t[o]){var i=Es(e,t,r,n.lastChild,o+1);if(i)return n.copy(n.content.replaceChild(n.childCount-1,i));var s=n.contentMatchAt(n.childCount);if(s.matchType(o==e.length-1?r.type:e[o+1]))return n.copy(n.content.append(k.from(Ns(r,e,o+1))))}}function Ds(e,t){if(t==0)return e;var r=e.content.replaceChild(e.childCount-1,Ds(e.lastChild,t-1)),n=e.contentMatchAt(e.childCount).fillBefore(k.empty,!0);return e.copy(r.append(n))}function Ln(e,t,r,n,o,i){var s=t<0?e.firstChild:e.lastChild,a=s.content;return o<n-1&&(a=Ln(a,t,r,n,o+1,i)),o>=r&&(a=t<0?s.contentMatchAt(0).fillBefore(a,e.childCount>1||i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(k.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function Ml(e,t,r){return t<e.openStart&&(e=new x(Ln(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),r<e.openEnd&&(e=new x(Ln(e.content,1,r,e.openEnd,0,0),e.openStart,r)),e}var Is={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},fi=null;function Rs(){return fi||(fi=document.implementation.createHTMLDocument("title"))}function xl(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var r=Rs().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(e),o;if((o=n&&Is[n[1].toLowerCase()])&&(e=o.map(function(s){return"<"+s+">"}).join("")+e+o.map(function(s){return"</"+s+">"}).reverse().join("")),r.innerHTML=e,o)for(var i=0;i<o.length;i++)r=r.querySelector(o[i])||r;return r}function Cl(e){for(var t=e.querySelectorAll(M.chrome?"span:not([class]):not([style])":"span.Apple-converted-space"),r=0;r<t.length;r++){var n=t[r];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),n)}}function Ol(e,t){if(!e.size)return e;var r=e.content.firstChild.type.schema,n;try{n=JSON.parse(t)}catch{return e}for(var o=e.content,i=e.openStart,s=e.openEnd,a=n.length-2;a>=0;a-=2){var c=r.nodes[n[a]];if(!c||c.hasRequiredAttrs())break;o=k.from(c.create(n[a+1],o)),i++,s++}return new x(o,i,s)}var wl={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},uo=M.ie&&M.ie_version<=11,fo=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};fo.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset};fo.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var At=function(t,r){var n=this;this.view=t,this.handleDOMChange=r,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver(function(o){for(var i=0;i<o.length;i++)n.queue.push(o[i]);M.ie&&M.ie_version<=11&&o.some(function(s){return s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length})?n.flushSoon():n.flush()}),this.currentSelection=new fo,uo&&(this.onCharData=function(o){n.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};At.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(function(){t.flushingSoon=-1,t.flush()},20))};At.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())};At.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,wl),uo&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()};At.prototype.stop=function(){var t=this;if(this.observer){var r=this.observer.takeRecords();if(r.length){for(var n=0;n<r.length;n++)this.queue.push(r[n]);window.setTimeout(function(){return t.flush()},20)}this.observer.disconnect()}uo&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()};At.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)};At.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)};At.prototype.suppressSelectionUpdates=function(){var t=this;this.suppressingSelectionUpdates=!0,setTimeout(function(){return t.suppressingSelectionUpdates=!1},50)};At.prototype.onSelectionChange=function(){if(ul(this.view)){if(this.suppressingSelectionUpdates)return ue(this.view);if(M.ie&&M.ie_version<=11&&!this.view.state.selection.empty){var t=this.view.root.getSelection();if(t.focusNode&&Tr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}};At.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())};At.prototype.ignoreSelectionChange=function(t){if(t.rangeCount==0)return!0;var r=t.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(r);if(n&&n.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0};At.prototype.flush=function(){if(!(!this.view.docView||this.flushingSoon>-1)){var t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);var r=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&lo(this.view)&&!this.ignoreSelectionChange(r),o=-1,i=-1,s=!1,a=[];if(this.view.editable)for(var c=0;c<t.length;c++){var l=this.registerMutation(t[c],a);l&&(o=o<0?l.from:Math.min(l.from,o),i=i<0?l.to:Math.max(l.to,i),l.typeOver&&(s=!0))}if(M.gecko&&a.length>1){var u=a.filter(function(d){return d.nodeName=="BR"});if(u.length==2){var f=u[0],p=u[1];f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}}(o>-1||n)&&(o>-1&&(this.view.docView.markDirty(o,i),Tl(this.view)),this.handleDOMChange(o,i,s,a),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(r)||ue(this.view),this.currentSelection.set(r))}};At.prototype.registerMutation=function(t,r){if(r.indexOf(t.target)>-1)return null;var n=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(n==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!n||n.ignoreMutation(t))return null;if(t.type=="childList"){for(var o=0;o<t.addedNodes.length;o++)r.push(t.addedNodes[o]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(t.target))return{from:n.posBefore,to:n.posAfter};var i=t.previousSibling,s=t.nextSibling;if(M.ie&&M.ie_version<=11&&t.addedNodes.length)for(var a=0;a<t.addedNodes.length;a++){var c=t.addedNodes[a],l=c.previousSibling,u=c.nextSibling;(!l||Array.prototype.indexOf.call(t.addedNodes,l)<0)&&(i=l),(!u||Array.prototype.indexOf.call(t.addedNodes,u)<0)&&(s=u)}var f=i&&i.parentNode==t.target?Dt(i)+1:0,p=n.localPosFromDOM(t.target,f,-1),d=s&&s.parentNode==t.target?Dt(s):t.target.childNodes.length,h=n.localPosFromDOM(t.target,d,1);return{from:p,to:h}}else return t.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}};var pi=!1;function Tl(e){pi||(pi=!0,getComputedStyle(e.dom).whiteSpace=="normal"&&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."))}var xt={},bt={};function Al(e){e.shiftKey=!1,e.mouseDown=null,e.lastKeyCode=null,e.lastKeyCodeTime=0,e.lastClick={time:0,x:0,y:0,type:""},e.lastSelectionOrigin=null,e.lastSelectionTime=0,e.lastIOSEnter=0,e.lastIOSEnterFallbackTimeout=null,e.lastAndroidDelete=0,e.composing=!1,e.composingTimeout=null,e.compositionNodes=[],e.compositionEndedAt=-2e8,e.domObserver=new At(e,function(n,o,i,s){return gl(e,n,o,i,s)}),e.domObserver.start(),e.domChangeCount=0,e.eventHandlers=Object.create(null);var t=function(n){var o=xt[n];e.dom.addEventListener(n,e.eventHandlers[n]=function(i){Nl(e,i)&&!ho(e,i)&&(e.editable||!(i.type in bt))&&o(e,i)})};for(var r in xt)t(r);M.safari&&e.dom.addEventListener("input",function(){return null}),po(e)}function be(e,t){e.lastSelectionOrigin=t,e.lastSelectionTime=Date.now()}function _l(e){e.domObserver.stop();for(var t in e.eventHandlers)e.dom.removeEventListener(t,e.eventHandlers[t]);clearTimeout(e.composingTimeout),clearTimeout(e.lastIOSEnterFallbackTimeout)}function po(e){e.someProp("handleDOMEvents",function(t){for(var r in t)e.eventHandlers[r]||e.dom.addEventListener(r,e.eventHandlers[r]=function(n){return ho(e,n)})})}function ho(e,t){return e.someProp("handleDOMEvents",function(r){var n=r[t.type];return n?n(e,t)||t.defaultPrevented:!1})}function Nl(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var r=t.target;r!=e.dom;r=r.parentNode)if(!r||r.nodeType==11||r.pmViewDesc&&r.pmViewDesc.stopEvent(t))return!1;return!0}function El(e,t){!ho(e,t)&&xt[t.type]&&(e.editable||!(t.type in bt))&&xt[t.type](e,t)}bt.keydown=function(e,t){if(e.shiftKey=t.keyCode==16||t.shiftKey,!zs(e,t))if(t.keyCode!=229&&e.domObserver.forceFlush(),e.lastKeyCode=t.keyCode,e.lastKeyCodeTime=Date.now(),M.ios&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){var r=Date.now();e.lastIOSEnter=r,e.lastIOSEnterFallbackTimeout=setTimeout(function(){e.lastIOSEnter==r&&(e.someProp("handleKeyDown",function(n){return n(e,Ae(13,"Enter"))}),e.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",function(n){return n(e,t)})||hl(e,t)?t.preventDefault():be(e,"key")};bt.keyup=function(e,t){t.keyCode==16&&(e.shiftKey=!1)};bt.keypress=function(e,t){if(!(zs(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||M.mac&&t.metaKey)){if(e.someProp("handleKeyPress",function(o){return o(e,t)})){t.preventDefault();return}var r=e.state.selection;if(!(r instanceof H)||!r.$from.sameParent(r.$to)){var n=String.fromCharCode(t.charCode);e.someProp("handleTextInput",function(o){return o(e,r.$from.pos,r.$to.pos,n)})||e.dispatch(e.state.tr.insertText(n).scrollIntoView()),t.preventDefault()}}};function qr(e){return{left:e.clientX,top:e.clientY}}function Dl(e,t){var r=t.x-e.clientX,n=t.y-e.clientY;return r*r+n*n<100}function mo(e,t,r,n,o){if(n==-1)return!1;for(var i=e.state.doc.resolve(n),s=function(l){if(e.someProp(t,function(u){return l>i.depth?u(e,r,i.nodeAfter,i.before(l),o,!0):u(e,r,i.node(l),i.before(l),o,!1)}))return{v:!0}},a=i.depth+1;a>0;a--){var c=s(a);if(c)return c.v}return!1}function Ee(e,t,r){e.focused||e.focus();var n=e.state.tr.setSelection(t);r=="pointer"&&n.setMeta("pointer",!0),e.dispatch(n)}function Il(e,t){if(t==-1)return!1;var r=e.state.doc.resolve(t),n=r.nodeAfter;return n&&n.isAtom&&N.isSelectable(n)?(Ee(e,new N(r),"pointer"),!0):!1}function Rl(e,t){if(t==-1)return!1;var r=e.state.selection,n,o;r instanceof N&&(n=r.node);for(var i=e.state.doc.resolve(t),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(N.isSelectable(a)){n&&r.$from.depth>0&&s>=r.$from.depth&&i.before(r.$from.depth+1)==r.$from.pos?o=i.before(r.$from.depth):o=i.before(s);break}}return o!=null?(Ee(e,N.create(e.state.doc,o),"pointer"),!0):!1}function Pl(e,t,r,n,o){return mo(e,"handleClickOn",t,r,n)||e.someProp("handleClick",function(i){return i(e,t,n)})||(o?Rl(e,r):Il(e,r))}function zl(e,t,r,n){return mo(e,"handleDoubleClickOn",t,r,n)||e.someProp("handleDoubleClick",function(o){return o(e,t,n)})}function Bl(e,t,r,n){return mo(e,"handleTripleClickOn",t,r,n)||e.someProp("handleTripleClick",function(o){return o(e,t,n)})||Ll(e,r,n)}function Ll(e,t,r){if(r.button!=0)return!1;var n=e.state.doc;if(t==-1)return n.inlineContent?(Ee(e,H.create(n,0,n.content.size),"pointer"),!0):!1;for(var o=n.resolve(t),i=o.depth+1;i>0;i--){var s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)Ee(e,H.create(n,a+1,a+1+s.content.size),"pointer");else if(N.isSelectable(s))Ee(e,N.create(n,a),"pointer");else continue;return!0}}function vo(e){return _r(e)}var Ps=M.mac?"metaKey":"ctrlKey";xt.mousedown=function(e,t){e.shiftKey=t.shiftKey;var r=vo(e),n=Date.now(),o="singleClick";n-e.lastClick.time<500&&Dl(t,e.lastClick)&&!t[Ps]&&(e.lastClick.type=="singleClick"?o="doubleClick":e.lastClick.type=="doubleClick"&&(o="tripleClick")),e.lastClick={time:n,x:t.clientX,y:t.clientY,type:o};var i=e.posAtCoords(qr(t));i&&(o=="singleClick"?(e.mouseDown&&e.mouseDown.done(),e.mouseDown=new Jr(e,i,t,r)):(o=="doubleClick"?zl:Bl)(e,i.pos,i.inside,t)?t.preventDefault():be(e,"pointer"))};var Jr=function(t,r,n,o){var i=this;this.view=t,this.startDoc=t.state.doc,this.pos=r,this.event=n,this.flushed=o,this.selectNode=n[Ps],this.allowDefault=n.shiftKey,this.delayedSelectionSync=!1;var s,a;if(r.inside>-1)s=t.state.doc.nodeAt(r.inside),a=r.inside;else{var c=t.state.doc.resolve(r.pos);s=c.parent,a=c.depth?c.before():0}this.mightDrag=null;var l=o?null:n.target,u=l?t.docView.nearestDesc(l,!0):null;this.target=u?u.dom:null;var f=t.state,p=f.selection;(n.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||p instanceof N&&p.from<=a&&p.to>a)&&(this.mightDrag={node:s,pos:a,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&M.gecko&&!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(){i.view.mouseDown==i&&i.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)),be(t,"pointer")};Jr.prototype.done=function(){var t=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 ue(t.view)}),this.view.mouseDown=null};Jr.prototype.up=function(t){if(this.done(),!!this.view.dom.contains(t.target.nodeType==3?t.target.parentNode:t.target)){var r=this.pos;this.view.state.doc!=this.startDoc&&(r=this.view.posAtCoords(qr(t))),this.allowDefault||!r?be(this.view,"pointer"):Pl(this.view,r.pos,r.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||M.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||M.chrome&&!(this.view.state.selection instanceof H)&&Math.min(Math.abs(r.pos-this.view.state.selection.from),Math.abs(r.pos-this.view.state.selection.to))<=2)?(Ee(this.view,E.near(this.view.state.doc.resolve(r.pos)),"pointer"),t.preventDefault()):be(this.view,"pointer")}};Jr.prototype.move=function(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0),be(this.view,"pointer"),t.buttons==0&&this.done()};xt.touchdown=function(e){vo(e),be(e,"pointer")};xt.contextmenu=function(e){return vo(e)};function zs(e,t){return e.composing?!0:M.safari&&Math.abs(t.timeStamp-e.compositionEndedAt)<500?(e.compositionEndedAt=-2e8,!0):!1}var Fl=M.android?5e3:-1;bt.compositionstart=bt.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,r=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some(function(a){return a.type.spec.inclusive===!1})))e.markCursor=e.state.storedMarks||r.marks(),_r(e,!0),e.markCursor=null;else if(_r(e),M.gecko&&t.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length)for(var n=e.root.getSelection(),o=n.focusNode,i=n.focusOffset;o&&o.nodeType==1&&i!=0;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){n.collapse(s,s.nodeValue.length);break}else o=s,i=-1}e.composing=!0}Bs(e,Fl)};bt.compositionend=function(e,t){e.composing&&(e.composing=!1,e.compositionEndedAt=t.timeStamp,Bs(e,20))};function Bs(e,t){clearTimeout(e.composingTimeout),t>-1&&(e.composingTimeout=setTimeout(function(){return _r(e)},t))}function Ls(e){for(e.composing&&(e.composing=!1,e.compositionEndedAt=Vl());e.compositionNodes.length>0;)e.compositionNodes.pop().markParentsDirty()}function Vl(){var e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function _r(e,t){if(e.domObserver.forceFlush(),Ls(e),t||e.docView.dirty){var r=Cs(e);return r&&!r.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(r)):e.updateState(e.state),!0}return!1}function Hl(e,t){if(e.dom.parentNode){var r=e.dom.parentNode.appendChild(document.createElement("div"));r.appendChild(t),r.style.cssText="position: fixed; left: -10000px; top: 10px";var n=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),n.removeAllRanges(),n.addRange(o),setTimeout(function(){r.parentNode&&r.parentNode.removeChild(r),e.focus()},50)}}var Ie=M.ie&&M.ie_version<15||M.ios&&M.webkit_version<604;xt.copy=bt.cut=function(e,t){var r=e.state.selection,n=t.type=="cut";if(!r.empty){var o=Ie?null:t.clipboardData,i=r.content(),s=As(e,i),a=s.dom,c=s.text;o?(t.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",c)):Hl(e,a),n&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}};function jl(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function ql(e,t){if(e.dom.parentNode){var r=e.shiftKey||e.state.selection.$from.parent.type.spec.code,n=e.dom.parentNode.appendChild(document.createElement(r?"textarea":"div"));r||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(function(){e.focus(),n.parentNode&&n.parentNode.removeChild(n),r?Fn(e,n.value,null,t):Fn(e,n.textContent,n.innerHTML,t)},50)}}function Fn(e,t,r,n){var o=_s(e,t,r,e.shiftKey,e.state.selection.$from);if(e.someProp("handlePaste",function(a){return a(e,n,o||x.empty)}))return!0;if(!o)return!1;var i=jl(o),s=i?e.state.tr.replaceSelectionWith(i,e.shiftKey):e.state.tr.replaceSelection(o);return e.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}bt.paste=function(e,t){var r=Ie?null:t.clipboardData;r&&Fn(e,r.getData("text/plain"),r.getData("text/html"),t)?t.preventDefault():ql(e,t)};var Jl=function(t,r){this.slice=t,this.move=r},Fs=M.mac?"altKey":"ctrlKey";xt.dragstart=function(e,t){var r=e.mouseDown;if(r&&r.done(),!!t.dataTransfer){var n=e.state.selection,o=n.empty?null:e.posAtCoords(qr(t));if(!(o&&o.pos>=n.from&&o.pos<=(n instanceof N?n.to-1:n.to))){if(r&&r.mightDrag)e.dispatch(e.state.tr.setSelection(N.create(e.state.doc,r.mightDrag.pos)));else if(t.target&&t.target.nodeType==1){var i=e.docView.nearestDesc(t.target,!0);i&&i.node.type.spec.draggable&&i!=e.docView&&e.dispatch(e.state.tr.setSelection(N.create(e.state.doc,i.posBefore)))}}var s=e.state.selection.content(),a=As(e,s),c=a.dom,l=a.text;t.dataTransfer.clearData(),t.dataTransfer.setData(Ie?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",Ie||t.dataTransfer.setData("text/plain",l),e.dragging=new Jl(s,!t[Fs])}};xt.dragend=function(e){var t=e.dragging;window.setTimeout(function(){e.dragging==t&&(e.dragging=null)},50)};bt.dragover=bt.dragenter=function(e,t){return t.preventDefault()};bt.drop=function(e,t){var r=e.dragging;if(e.dragging=null,!!t.dataTransfer){var n=e.posAtCoords(qr(t));if(n){var o=e.state.doc.resolve(n.pos);if(o){var i=r&&r.slice;i?e.someProp("transformPasted",function(h){i=h(i)}):i=_s(e,t.dataTransfer.getData(Ie?"Text":"text/plain"),Ie?null:t.dataTransfer.getData("text/html"),!1,o);var s=r&&!t[Fs];if(e.someProp("handleDrop",function(h){return h(e,t,i||x.empty,s)})){t.preventDefault();return}if(i){t.preventDefault();var a=i?rs(e.state.doc,o.pos,i):o.pos;a==null&&(a=o.pos);var c=e.state.tr;s&&c.deleteSelection();var l=c.mapping.map(a),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(l,l,i.content.firstChild):c.replaceRange(l,l,i),!c.doc.eq(f)){var p=c.doc.resolve(l);if(u&&N.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new N(p));else{var d=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach(function(h,v,g,S){return d=S}),c.setSelection(co(e,p,c.doc.resolve(d)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))}}}}}};xt.focus=function(e){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.root.getSelection())&&ue(e)},20))};xt.blur=function(e,t){e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.set({}),e.focused=!1)};xt.beforeinput=function(e,t){if(M.chrome&&M.android&&t.inputType=="deleteContentBackward"){var r=e.domChangeCount;setTimeout(function(){if(e.domChangeCount==r&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",function(i){return i(e,Ae(8,"Backspace"))}))){var n=e.state.selection,o=n.$cursor;o&&o.pos>0&&e.dispatch(e.state.tr.delete(o.pos-1,o.pos).scrollIntoView())}},50)}};for(var di in bt)xt[di]=bt[di];function nr(e,t){if(e==t)return!0;for(var r in e)if(e[r]!==t[r])return!1;for(var n in t)if(!(n in e))return!1;return!0}var or=function(t,r){this.spec=r||Me,this.side=this.spec.side||0,this.toDOM=t};or.prototype.map=function(t,r,n,o){var i=t.mapResult(r.from+o,this.side<0?-1:1),s=i.pos,a=i.deleted;return a?null:new rt(s-n,s-n,this)};or.prototype.valid=function(){return!0};or.prototype.eq=function(t){return this==t||t instanceof or&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&nr(this.spec,t.spec))};var Ft=function(t,r){this.spec=r||Me,this.attrs=t};Ft.prototype.map=function(t,r,n,o){var i=t.map(r.from+o,this.spec.inclusiveStart?-1:1)-n,s=t.map(r.to+o,this.spec.inclusiveEnd?1:-1)-n;return i>=s?null:new rt(i,s,this)};Ft.prototype.valid=function(t,r){return r.from<r.to};Ft.prototype.eq=function(t){return this==t||t instanceof Ft&&nr(this.attrs,t.attrs)&&nr(this.spec,t.spec)};Ft.is=function(t){return t.type instanceof Ft};var ir=function(t,r){this.spec=r||Me,this.attrs=t};ir.prototype.map=function(t,r,n,o){var i=t.mapResult(r.from+o,1);if(i.deleted)return null;var s=t.mapResult(r.to+o,-1);return s.deleted||s.pos<=i.pos?null:new rt(i.pos-n,s.pos-n,this)};ir.prototype.valid=function(t,r){var n=t.content.findIndex(r.from),o=n.index,i=n.offset;return i==r.from&&i+t.child(o).nodeSize==r.to};ir.prototype.eq=function(t){return this==t||t instanceof ir&&nr(this.attrs,t.attrs)&&nr(this.spec,t.spec)};var rt=function(t,r,n){this.from=t,this.to=r,this.type=n},go={spec:{configurable:!0},inline:{configurable:!0}};rt.prototype.copy=function(t,r){return new rt(t,r,this.type)};rt.prototype.eq=function(t,r){return r===void 0&&(r=0),this.type.eq(t.type)&&this.from+r==t.from&&this.to+r==t.to};rt.prototype.map=function(t,r,n){return this.type.map(t,this,r,n)};rt.widget=function(t,r,n){return new rt(t,t,new or(r,n))};rt.inline=function(t,r,n,o){return new rt(t,r,new Ft(n,o))};rt.node=function(t,r,n,o){return new rt(t,r,new ir(n,o))};go.spec.get=function(){return this.type.spec};go.inline.get=function(){return this.type instanceof Ft};Object.defineProperties(rt.prototype,go);var Nr=[],Me={},j=function(t,r){this.local=t&&t.length?t:Nr,this.children=r&&r.length?r:Nr};j.create=function(t,r){return r.length?Wr(r,t,0,Me):at};j.prototype.find=function(t,r,n){var o=[];return this.findInner(t??0,r??1e9,o,0,n),o};j.prototype.findInner=function(t,r,n,o,i){for(var s=0;s<this.local.length;s++){var a=this.local[s];a.from<=r&&a.to>=t&&(!i||i(a.spec))&&n.push(a.copy(a.from+o,a.to+o))}for(var c=0;c<this.children.length;c+=3)if(this.children[c]<r&&this.children[c+1]>t){var l=this.children[c]+1;this.children[c+2].findInner(t-l,r-l,n,o+l,i)}};j.prototype.map=function(t,r,n){return this==at||t.maps.length==0?this:this.mapInner(t,r,0,0,n||Me)};j.prototype.mapInner=function(t,r,n,o,i){for(var s,a=0;a<this.local.length;a++){var c=this.local[a].map(t,n,o);c&&c.type.valid(r,c)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?Wl(this.children,s,t,r,n,o,i):s?new j(s.sort(xe)):at};j.prototype.add=function(t,r){return r.length?this==at?j.create(t,r):this.addInner(t,r,0):this};j.prototype.addInner=function(t,r,n){var o=this,i,s=0;t.forEach(function(l,u){var f=u+n,p;if(p=Hs(r,l,f)){for(i||(i=o.children.slice());s<i.length&&i[s]<u;)s+=3;i[s]==u?i[s+2]=i[s+2].addInner(l,p,f+1):i.splice(s,0,u,u+l.nodeSize,Wr(p,l,f+1,Me)),s+=3}});for(var a=Vs(s?js(r):r,-n),c=0;c<a.length;c++)a[c].type.valid(t,a[c])||a.splice(c--,1);return new j(a.length?this.local.concat(a).sort(xe):this.local,i||this.children)};j.prototype.remove=function(t){return t.length==0||this==at?this:this.removeInner(t,0)};j.prototype.removeInner=function(t,r){for(var n=this.children,o=this.local,i=0;i<n.length;i+=3){for(var s=void 0,a=n[i]+r,c=n[i+1]+r,l=0,u=void 0;l<t.length;l++)(u=t[l])&&u.from>a&&u.to<c&&(t[l]=null,(s||(s=[])).push(u));if(s){n==this.children&&(n=this.children.slice());var f=n[i+2].removeInner(s,a+1);f!=at?n[i+2]=f:(n.splice(i,3),i-=3)}}if(o.length){for(var p=0,d=void 0;p<t.length;p++)if(d=t[p])for(var h=0;h<o.length;h++)o[h].eq(d,r)&&(o==this.local&&(o=this.local.slice()),o.splice(h--,1))}return n==this.children&&o==this.local?this:o.length||n.length?new j(o,n):at};j.prototype.forChild=function(t,r){if(this==at)return this;if(r.isLeaf)return j.empty;for(var n,o,i=0;i<this.children.length;i+=3)if(this.children[i]>=t){this.children[i]==t&&(n=this.children[i+2]);break}for(var s=t+1,a=s+r.content.size,c=0;c<this.local.length;c++){var l=this.local[c];if(l.from<a&&l.to>s&&l.type instanceof Ft){var u=Math.max(s,l.from)-s,f=Math.min(a,l.to)-s;u<f&&(o||(o=[])).push(l.copy(u,f))}}if(o){var p=new j(o.sort(xe));return n?new Et([p,n]):p}return n||at};j.prototype.eq=function(t){if(this==t)return!0;if(!(t instanceof j)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var r=0;r<this.local.length;r++)if(!this.local[r].eq(t.local[r]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0};j.prototype.locals=function(t){return yo(this.localsInner(t))};j.prototype.localsInner=function(t){if(this==at)return Nr;if(t.inlineContent||!this.local.some(Ft.is))return this.local;for(var r=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Ft||r.push(this.local[n]);return r};var at=new j;j.empty=at;j.removeOverlap=yo;var Et=function(t){this.members=t};Et.prototype.map=function(t,r){var n=this.members.map(function(o){return o.map(t,r,Me)});return Et.from(n)};Et.prototype.forChild=function(t,r){if(r.isLeaf)return j.empty;for(var n=[],o=0;o<this.members.length;o++){var i=this.members[o].forChild(t,r);i!=at&&(i instanceof Et?n=n.concat(i.members):n.push(i))}return Et.from(n)};Et.prototype.eq=function(t){if(!(t instanceof Et)||t.members.length!=this.members.length)return!1;for(var r=0;r<this.members.length;r++)if(!this.members[r].eq(t.members[r]))return!1;return!0};Et.prototype.locals=function(t){for(var r,n=!0,o=0;o<this.members.length;o++){var i=this.members[o].localsInner(t);if(i.length)if(!r)r=i;else{n&&(r=r.slice(),n=!1);for(var s=0;s<i.length;s++)r.push(i[s])}}return r?yo(n?r:r.sort(xe)):Nr};Et.from=function(t){switch(t.length){case 0:return at;case 1:return t[0];default:return new Et(t)}};function Wl(e,t,r,n,o,i,s){for(var a=e.slice(),c=function(Gt,et,lt,Ht){for(var U=0;U<a.length;U+=3){var G=a[U+1],Zt=void 0;G==-1||Gt>G+i||(et>=a[U]+i?a[U+1]=-1:lt>=o&&(Zt=Ht-lt-(et-Gt))&&(a[U]+=Zt,a[U+1]+=Zt))}},l=0;l<r.maps.length;l++)r.maps[l].forEach(c);for(var u=!1,f=0;f<a.length;f+=3)if(a[f+1]==-1){var p=r.map(e[f]+i),d=p-o;if(d<0||d>=n.content.size){u=!0;continue}var h=r.map(e[f+1]+i,-1),v=h-o,g=n.content.findIndex(d),S=g.index,y=g.offset,I=n.maybeChild(S);if(I&&y==d&&y+I.nodeSize==v){var m=a[f+2].mapInner(r,I,p+1,e[f]+i+1,s);m!=at?(a[f]=d,a[f+1]=v,a[f+2]=m):(a[f+1]=-2,u=!0)}else u=!0}if(u){var D=Kl(a,e,t||[],r,o,i,s),C=Wr(D,n,0,s);t=C.local;for(var L=0;L<a.length;L+=3)a[L+1]<0&&(a.splice(L,3),L-=3);for(var q=0,$=0;q<C.children.length;q+=3){for(var w=C.children[q];$<a.length&&a[$]<w;)$+=3;a.splice($,0,C.children[q],C.children[q+1],C.children[q+2])}}return new j(t&&t.sort(xe),a)}function Vs(e,t){if(!t||!e.length)return e;for(var r=[],n=0;n<e.length;n++){var o=e[n];r.push(new rt(o.from+t,o.to+t,o.type))}return r}function Kl(e,t,r,n,o,i,s){function a(l,u){for(var f=0;f<l.local.length;f++){var p=l.local[f].map(n,o,u);p?r.push(p):s.onRemove&&s.onRemove(l.local[f].spec)}for(var d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+u+1)}for(var c=0;c<e.length;c+=3)e[c+1]==-1&&a(e[c+2],t[c]+i+1);return r}function Hs(e,t,r){if(t.isLeaf)return null;for(var n=r+t.nodeSize,o=null,i=0,s=void 0;i<e.length;i++)(s=e[i])&&s.from>r&&s.to<n&&((o||(o=[])).push(s),e[i]=null);return o}function js(e){for(var t=[],r=0;r<e.length;r++)e[r]!=null&&t.push(e[r]);return t}function Wr(e,t,r,n){var o=[],i=!1;t.forEach(function(c,l){var u=Hs(e,c,l+r);if(u){i=!0;var f=Wr(u,c,r+l+1,n);f!=at&&o.push(l,l+c.nodeSize,f)}});for(var s=Vs(i?js(e):e,-r).sort(xe),a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(n.onRemove&&n.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new j(s,o):at}function xe(e,t){return e.from-t.from||e.to-t.to}function yo(e){for(var t=e,r=0;r<t.length-1;r++){var n=t[r];if(n.from!=n.to)for(var o=r+1;o<t.length;o++){var i=t[o];if(i.from==n.from){i.to!=n.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,n.to),hi(t,o+1,i.copy(n.to,i.to)));continue}else{i.from<n.to&&(t==e&&(t=e.slice()),t[r]=n.copy(n.from,i.from),hi(t,o,n.copy(i.from,n.to)));break}}}return t}function hi(e,t,r){for(;t<e.length&&xe(r,e[t])>0;)t++;e.splice(t,0,r)}function bo(e){var t=[];return e.someProp("decorations",function(r){var n=r(e.state);n&&n!=at&&t.push(n)}),e.cursorWrapper&&t.push(j.create(e.state.doc,[e.cursorWrapper.deco])),Et.from(t)}var Q=function(t,r){this._props=r,this.state=r.state,this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):t.apply?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=Ws(this),this.markCursor=null,this.cursorWrapper=null,Js(this),this.nodeViews=Ks(this),this.docView=bs(this.state.doc,qs(this),bo(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,Al(this),this.pluginViews=[],this.updatePluginViews()},ko={props:{configurable:!0},root:{configurable:!0}};ko.props.get=function(){if(this._props.state!=this.state){var e=this._props;this._props={};for(var t in e)this._props[t]=e[t];this._props.state=this.state}return this._props};Q.prototype.update=function(t){t.handleDOMEvents!=this._props.handleDOMEvents&&po(this),this._props=t,this.updateStateInner(t.state,!0)};Q.prototype.setProps=function(t){var r={};for(var n in this._props)r[n]=this._props[n];r.state=this.state;for(var o in t)r[o]=t[o];this.update(r)};Q.prototype.updateState=function(t){this.updateStateInner(t,this.state.plugins!=t.plugins)};Q.prototype.updateStateInner=function(t,r){var n=this,o=this.state,i=!1,s=!1;if(t.storedMarks&&this.composing&&(Ls(this),s=!0),this.state=t,r){var a=Ks(this);Ul(a,this.nodeViews)&&(this.nodeViews=a,i=!0),po(this)}this.editable=Ws(this),Js(this);var c=bo(this),l=qs(this),u=r?"reset":t.scrollToSelection>o.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(t.doc,l,c);(f||!t.selection.eq(o.selection))&&(s=!0);var p=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Lc(this);if(s){this.domObserver.stop();var d=f&&(M.ie||M.chrome)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&$l(o.selection,t.selection);if(f){var h=M.chrome?this.trackWrites=this.root.getSelection().focusNode:null;(i||!this.docView.update(t.doc,l,c,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=bs(t.doc,l,c,this.dom,this)),h&&!this.trackWrites&&(d=!0)}d||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&fl(this))?ue(this,d):(ws(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(o),u=="reset")this.dom.scrollTop=0;else if(u=="to selection"){var v=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",function(g){return g(n)})||(t.selection instanceof N?Xo(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),v):Xo(this,this.coordsAtPos(t.selection.head,1),v))}else p&&Fc(p)};Q.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()};Q.prototype.updatePluginViews=function(t){if(!t||t.plugins!=this.state.plugins){this.destroyPluginViews();for(var r=0;r<this.state.plugins.length;r++){var n=this.state.plugins[r];n.spec.view&&this.pluginViews.push(n.spec.view(this))}}else for(var o=0;o<this.pluginViews.length;o++){var i=this.pluginViews[o];i.update&&i.update(this,t)}};Q.prototype.someProp=function(t,r){var n=this._props&&this._props[t],o;if(n!=null&&(o=r?r(n):n))return o;var i=this.state.plugins;if(i)for(var s=0;s<i.length;s++){var a=i[s].props[t];if(a!=null&&(o=r?r(a):a))return o}};Q.prototype.hasFocus=function(){return this.root.activeElement==this.dom};Q.prototype.focus=function(){this.domObserver.stop(),this.editable&&Vc(this.dom),ue(this),this.domObserver.start()};ko.root.get=function(){var e=this._root;if(e==null){for(var t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return document.getSelection()}),this._root=t}return e||document};Q.prototype.posAtCoords=function(t){return Wc(this,t)};Q.prototype.coordsAtPos=function(t,r){return r===void 0&&(r=1),vs(this,t,r)};Q.prototype.domAtPos=function(t,r){return r===void 0&&(r=0),this.docView.domFromPos(t,r)};Q.prototype.nodeDOM=function(t){var r=this.docView.descAt(t);return r?r.nodeDOM:null};Q.prototype.posAtDOM=function(t,r,n){n===void 0&&(n=-1);var o=this.docView.posFromDOM(t,r,n);if(o==null)throw new RangeError("DOM position not inside the editor");return o};Q.prototype.endOfTextblock=function(t,r){return Yc(this,r||this.state,t)};Q.prototype.destroy=function(){this.docView&&(_l(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],bo(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)};Q.prototype.dispatchEvent=function(t){return El(this,t)};Q.prototype.dispatch=function(t){var r=this._props.dispatchTransaction;r?r.call(this,t):this.updateState(this.state.apply(t))};Object.defineProperties(Q.prototype,ko);function qs(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),t.translate="no",e.someProp("attributes",function(r){if(typeof r=="function"&&(r=r(e.state)),r)for(var n in r)n=="class"?t.class+=" "+r[n]:!t[n]&&n!="contenteditable"&&n!="nodeName"&&(t[n]=String(r[n]))}),[rt.node(0,e.state.doc.content.size,t)]}function Js(e){if(e.markCursor){var t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),e.cursorWrapper={dom:t,deco:rt.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Ws(e){return!e.someProp("editable",function(t){return t(e.state)===!1})}function $l(e,t){var r=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(r)!=t.$anchor.start(r)}function Ks(e){var t={};return e.someProp("nodeViews",function(r){for(var n in r)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=r[n])}),t}function Ul(e,t){var r=0,n=0;for(var o in e){if(e[o]!=t[o])return!0;r++}for(var i in t)n++;return r!=n}var ae={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",229:"q"},Er={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},mi=typeof navigator<"u"&&/Chrome\/(\d+)/.exec(navigator.userAgent),Gl=typeof navigator<"u"&&/Apple Computer/.test(navigator.vendor),Yl=typeof navigator<"u"&&/Gecko\/\d+/.test(navigator.userAgent),vi=typeof navigator<"u"&&/Mac/.test(navigator.platform),Xl=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ql=mi&&(vi||+mi[1]<57)||Yl&&vi;for(var nt=0;nt<10;nt++)ae[48+nt]=ae[96+nt]=String(nt);for(var nt=1;nt<=24;nt++)ae[nt+111]="F"+nt;for(var nt=65;nt<=90;nt++)ae[nt]=String.fromCharCode(nt+32),Er[nt]=String.fromCharCode(nt);for(var vn in ae)Er.hasOwnProperty(vn)||(Er[vn]=ae[vn]);function Zl(e){var t=Ql&&(e.ctrlKey||e.altKey||e.metaKey)||(Gl||Xl)&&e.shiftKey&&e.key&&e.key.length==1,r=!t&&e.key||(e.shiftKey?Er:ae)[e.keyCode]||e.key||"Unidentified";return r=="Esc"&&(r="Escape"),r=="Del"&&(r="Delete"),r=="Left"&&(r="ArrowLeft"),r=="Up"&&(r="ArrowUp"),r=="Right"&&(r="ArrowRight"),r=="Down"&&(r="ArrowDown"),r}var tu=typeof navigator<"u"?/Mac/.test(navigator.platform):!1;function eu(e){var t=e.split(/-(?!$)/),r=t[t.length-1];r=="Space"&&(r=" ");for(var n,o,i,s,a=0;a<t.length-1;a++){var c=t[a];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))n=!0;else if(/^(c|ctrl|control)$/i.test(c))o=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))tu?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+c)}return n&&(r="Alt-"+r),o&&(r="Ctrl-"+r),s&&(r="Meta-"+r),i&&(r="Shift-"+r),r}function ru(e){var t=Object.create(null);for(var r in e)t[eu(r)]=e[r];return t}function gn(e,t,r){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),r!==!1&&t.shiftKey&&(e="Shift-"+e),e}function nu(e){return new Rt({props:{handleKeyDown:$s(e)}})}function $s(e){var t=ru(e);return function(r,n){var o=Zl(n),i=o.length==1&&o!=" ",s,a=t[gn(o,n,!i)];if(a&&a(r.state,r.dispatch,r))return!0;if(i&&(n.shiftKey||n.altKey||n.metaKey||o.charCodeAt(0)>127)&&(s=ae[n.keyCode])&&s!=o){var c=t[gn(s,n,!0)];if(c&&c(r.state,r.dispatch,r))return!0}else if(i&&n.shiftKey){var l=t[gn(o,n,!0)];if(l&&l(r.state,r.dispatch,r))return!0}return!1}}var Kr=function(t,r){this.match=t,this.handler=typeof r=="string"?ou(r):r};function ou(e){return function(t,r,n,o){var i=e;if(r[1]){var s=r[0].lastIndexOf(r[1]);i+=r[0].slice(s+r[1].length),n+=s;var a=n-o;a>0&&(i=r[0].slice(s-a,s)+i,n=o)}return t.tr.insertText(i,n,o)}}var iu=500;function su(e){var t=e.rules,r=new Rt({state:{init:function(){return null},apply:function(o,i){var s=o.getMeta(this);return s||(o.selectionSet||o.docChanged?null:i)}},props:{handleTextInput:function(o,i,s,a){return gi(o,i,s,a,t,r)},handleDOMEvents:{compositionend:function(n){setTimeout(function(){var o=n.state.selection,i=o.$cursor;i&&gi(n,i.pos,i.pos,"",t,r)})}}},isInputRules:!0});return r}function gi(e,t,r,n,o,i){if(e.composing)return!1;var s=e.state,a=s.doc.resolve(t);if(a.parent.type.spec.code)return!1;for(var c=a.parent.textBetween(Math.max(0,a.parentOffset-iu),a.parentOffset,null,"")+n,l=0;l<o.length;l++){var u=o[l].match.exec(c),f=u&&o[l].handler(s,u,t-(u[0].length-n.length),r);if(f)return e.dispatch(f.setMeta(i,{transform:f,from:t,to:r,text:n})),!0}return!1}function au(e,t){for(var r=e.plugins,n=0;n<r.length;n++){var o=r[n],i=void 0;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){for(var s=e.tr,a=i.transform,c=a.steps.length-1;c>=0;c--)s.step(a.steps[c].invert(a.docs[c]));if(i.text){var l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,e.schema.text(i.text,l))}else s.delete(i.from,i.to);t(s)}return!0}}return!1}function So(e,t,r,n){return new Kr(e,function(o,i,s,a){var c=r instanceof Function?r(i):r,l=o.tr.delete(s,a),u=l.doc.resolve(s),f=u.blockRange(),p=f&&Qn(f,t,c);if(!p)return null;l.wrap(f,p);var d=l.doc.resolve(s-1).nodeBefore;return d&&d.type==t&&Zn(l.doc,s-1)&&(!n||n(i,d))&&l.join(s-1),l})}function Vn(e,t,r){return new Kr(e,function(n,o,i,s){var a=n.doc.resolve(i),c=r instanceof Function?r(o):r;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t)?n.tr.delete(i,s).setBlockType(i,i,t,c):null})}function cu(e,t){return e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0)}function lu(e,t,r){var n=e.selection,o=n.$cursor;if(!o||(r?!r.endOfTextblock("backward",e):o.parentOffset>0))return!1;var i=Us(o);if(!i){var s=o.blockRange(),a=s&&Ve(s);return a==null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)}var c=i.nodeBefore;if(!c.type.spec.isolating&&Qs(e,i,t))return!0;if(o.parent.content.size==0&&(Re(c,"end")||N.isSelectable(c))){if(t){var l=e.tr.deleteRange(o.before(),o.after());l.setSelection(Re(c,"end")?E.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):N.create(l.doc,i.pos-c.nodeSize)),t(l.scrollIntoView())}return!0}return c.isAtom&&i.depth==o.depth-1?(t&&t(e.tr.delete(i.pos-c.nodeSize,i.pos).scrollIntoView()),!0):!1}function Re(e,t,r){for(;e;e=t=="start"?e.firstChild:e.lastChild){if(e.isTextblock)return!0;if(r&&e.childCount!=1)return!1}return!1}function uu(e,t,r){var n=e.selection,o=n.$head,i=n.empty,s=o;if(!i)return!1;if(o.parent.isTextblock){if(r?!r.endOfTextblock("backward",e):o.parentOffset>0)return!1;s=Us(o)}var a=s&&s.nodeBefore;return!a||!N.isSelectable(a)?!1:(t&&t(e.tr.setSelection(N.create(e.doc,s.pos-a.nodeSize)).scrollIntoView()),!0)}function Us(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function fu(e,t,r){var n=e.selection,o=n.$cursor;if(!o||(r?!r.endOfTextblock("forward",e):o.parentOffset<o.parent.content.size))return!1;var i=Gs(o);if(!i)return!1;var s=i.nodeAfter;if(Qs(e,i,t))return!0;if(o.parent.content.size==0&&(Re(s,"start")||N.isSelectable(s))){if(t){var a=e.tr.deleteRange(o.before(),o.after());a.setSelection(Re(s,"start")?E.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):N.create(a.doc,a.mapping.map(i.pos))),t(a.scrollIntoView())}return!0}return s.isAtom&&i.depth==o.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1}function pu(e,t,r){var n=e.selection,o=n.$head,i=n.empty,s=o;if(!i)return!1;if(o.parent.isTextblock){if(r?!r.endOfTextblock("forward",e):o.parentOffset<o.parent.content.size)return!1;s=Gs(o)}var a=s&&s.nodeAfter;return!a||!N.isSelectable(a)?!1:(t&&t(e.tr.setSelection(N.create(e.doc,s.pos)).scrollIntoView()),!0)}function Gs(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){var r=e.node(t);if(e.index(t)+1<r.childCount)return e.doc.resolve(e.after(t+1));if(r.type.spec.isolating)break}return null}function Ys(e,t){var r=e.selection,n=r.$from,o=r.$to,i=n.blockRange(o),s=i&&Ve(i);return s==null?!1:(t&&t(e.tr.lift(i,s).scrollIntoView()),!0)}function du(e,t){var r=e.selection,n=r.$head,o=r.$anchor;return!n.parent.type.spec.code||!n.sameParent(o)?!1:(t&&t(e.tr.insertText(`
|
||
`).scrollIntoView()),!0)}function Xs(e){for(var t=0;t<e.edgeCount;t++){var r=e.edge(t),n=r.type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function hu(e,t){var r=e.selection,n=r.$head,o=r.$anchor;if(!n.parent.type.spec.code||!n.sameParent(o))return!1;var i=n.node(-1),s=n.indexAfter(-1),a=Xs(i.contentMatchAt(s));if(!i.canReplaceWith(s,s,a))return!1;if(t){var c=n.after(),l=e.tr.replaceWith(c,c,a.createAndFill());l.setSelection(E.near(l.doc.resolve(c),1)),t(l.scrollIntoView())}return!0}function mu(e,t){var r=e.selection,n=r.$from,o=r.$to;if(r instanceof le||n.parent.inlineContent||o.parent.inlineContent)return!1;var i=Xs(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){var s=(!n.parentOffset&&o.index()<o.parent.childCount?n:o).pos,a=e.tr.insert(s,i.createAndFill());a.setSelection(H.create(a.doc,s+1)),t(a.scrollIntoView())}return!0}function vu(e,t){var r=e.selection,n=r.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var o=n.before();if(_e(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}var i=n.blockRange(),s=i&&Ve(i);return s==null?!1:(t&&t(e.tr.lift(i,s).scrollIntoView()),!0)}function gu(e,t){var r=e.selection,n=r.$from,o=r.to,i,s=n.sharedDepth(o);return s==0?!1:(i=n.before(s),t&&t(e.tr.setSelection(N.create(e.doc,i))),!0)}function yu(e,t){return t&&t(e.tr.setSelection(new le(e.doc))),!0}function bu(e,t,r){var n=t.nodeBefore,o=t.nodeAfter,i=t.index();return!n||!o||!n.type.compatibleContent(o.type)?!1:!n.content.size&&t.parent.canReplace(i-1,i)?(r&&r(e.tr.delete(t.pos-n.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(o.isTextblock||Zn(e.doc,t.pos))?!1:(r&&r(e.tr.clearIncompatible(t.pos,n.type,n.contentMatchAt(n.childCount)).join(t.pos).scrollIntoView()),!0)}function Qs(e,t,r){var n=t.nodeBefore,o=t.nodeAfter,i,s;if(n.type.spec.isolating||o.type.spec.isolating)return!1;if(bu(e,t,r))return!0;var a=t.parent.canReplace(t.index(),t.index()+1);if(a&&(i=(s=n.contentMatchAt(n.childCount)).findWrapping(o.type))&&s.matchType(i[0]||o.type).validEnd){if(r){for(var c=t.pos+o.nodeSize,l=k.empty,u=i.length-1;u>=0;u--)l=k.from(i[u].create(null,l));l=k.from(n.copy(l));var f=e.tr.step(new Mt(t.pos-1,c,t.pos,c,new x(l,1,0),i.length,!0)),p=c+2*i.length;Zn(f.doc,p)&&f.join(p),r(f.scrollIntoView())}return!0}var d=E.findFrom(t,1),h=d&&d.$from.blockRange(d.$to),v=h&&Ve(h);if(v!=null&&v>=t.depth)return r&&r(e.tr.lift(h,v).scrollIntoView()),!0;if(a&&Re(o,"start",!0)&&Re(n,"end")){for(var g=n,S=[];S.push(g),!g.isTextblock;)g=g.lastChild;for(var y=o,I=1;!y.isTextblock;y=y.firstChild)I++;if(g.canReplace(g.childCount,g.childCount,y.content)){if(r){for(var m=k.empty,D=S.length-1;D>=0;D--)m=k.from(S[D].copy(m));var C=e.tr.step(new Mt(t.pos-S.length,t.pos+o.nodeSize,t.pos+I,t.pos+o.nodeSize-I,new x(m,S.length,0),0,!0));r(C.scrollIntoView())}return!0}}return!1}function Zs(e,t){return function(r,n){var o=r.selection,i=o.$from,s=o.$to,a=i.blockRange(s),c=a&&Qn(a,e,t);return c?(n&&n(r.tr.wrap(a,c).scrollIntoView()),!0):!1}}function ku(e,t){return function(r,n){var o=r.selection,i=o.from,s=o.to,a=!1;return r.doc.nodesBetween(i,s,function(c,l){if(a)return!1;if(!(!c.isTextblock||c.hasMarkup(e,t)))if(c.type==e)a=!0;else{var u=r.doc.resolve(l),f=u.index();a=u.parent.canReplaceWith(f,f+1,e)}}),a?(n&&n(r.tr.setBlockType(i,s,e,t).scrollIntoView()),!0):!1}}typeof navigator<"u"?/Mac/.test(navigator.platform):typeof os<"u"&&os.platform()=="darwin";function Su(e,t){return function(r,n){var o=r.selection,i=o.$from,s=o.$to,a=i.blockRange(s),c=!1,l=a;if(!a)return!1;if(a.depth>=2&&i.node(a.depth-1).type.compatibleContent(e)&&a.startIndex==0){if(i.index(a.depth-1)==0)return!1;var u=r.doc.resolve(a.start-2);l=new Ze(u,u,a.depth),a.endIndex<a.parent.childCount&&(a=new Ze(i,r.doc.resolve(s.end(a.depth)),a.depth)),c=!0}var f=Qn(l,e,t,a);return f?(n&&n(Mu(r.tr,a,f,c,e).scrollIntoView()),!0):!1}}function Mu(e,t,r,n,o){for(var i=k.empty,s=r.length-1;s>=0;s--)i=k.from(r[s].type.create(r[s].attrs,i));e.step(new Mt(t.start-(n?2:0),t.end,t.start,t.end,new x(i,0,0),r.length,!0));for(var a=0,c=0;c<r.length;c++)r[c].type==o&&(a=c+1);for(var l=r.length-a,u=t.start+r.length-(n?2:0),f=t.parent,p=t.startIndex,d=t.endIndex,h=!0;p<d;p++,h=!1)!h&&_e(e.doc,u,l)&&(e.split(u,l),u+=2*l),u+=f.child(p).nodeSize;return e}function xu(e){return function(t,r){var n=t.selection,o=n.$from,i=n.$to,s=o.blockRange(i,function(a){return a.childCount&&a.firstChild.type==e});return s?r?o.node(s.depth-1).type==e?Cu(t,r,e,s):Ou(t,r,s):!0:!1}}function Cu(e,t,r,n){var o=e.tr,i=n.end,s=n.$to.end(n.depth);return i<s&&(o.step(new Mt(i-1,s,i,s,new x(k.from(r.create(null,n.parent.copy())),1,0),1,!0)),n=new Ze(o.doc.resolve(n.$from.pos),o.doc.resolve(s),n.depth)),t(o.lift(n,Ve(n)).scrollIntoView()),!0}function Ou(e,t,r){for(var n=e.tr,o=r.parent,i=r.end,s=r.endIndex-1,a=r.startIndex;s>a;s--)i-=o.child(s).nodeSize,n.delete(i-1,i+1);var c=n.doc.resolve(r.start),l=c.nodeAfter,u=r.startIndex==0,f=r.endIndex==o.childCount,p=c.node(-1),d=c.index(-1);if(!p.canReplace(d+(u?0:1),d+1,l.content.append(f?k.empty:k.from(o))))return!1;var h=c.pos,v=h+l.nodeSize;return n.step(new Mt(h-(u?1:0),v+(f?1:0),h+1,v-1,new x((u?k.empty:k.from(o.copy(k.empty))).append(f?k.empty:k.from(o.copy(k.empty))),u?0:1,f?0:1),u?0:1)),t(n.scrollIntoView()),!0}function wu(e){return function(t,r){var n=t.selection,o=n.$from,i=n.$to,s=o.blockRange(i,function(v){return v.childCount&&v.firstChild.type==e});if(!s)return!1;var a=s.startIndex;if(a==0)return!1;var c=s.parent,l=c.child(a-1);if(l.type!=e)return!1;if(r){var u=l.lastChild&&l.lastChild.type==c.type,f=k.from(u?e.create():null),p=new x(k.from(e.create(null,k.from(c.type.create(null,f)))),u?3:1,0),d=s.start,h=s.end;r(t.tr.step(new Mt(d-(u?3:1),h,d,h,p,1,!0)).scrollIntoView())}return!0}}function $r(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function tt(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function Tu(e,t){const r=tt(t,e.schema),{from:n,to:o}=e.selection;let i=[];e.doc.nodesBetween(n,o,a=>{i=[...i,a]});const s=i.reverse().find(a=>a.type.name===r.name);return s?{...s.attrs}:{}}function fe(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}function ta(e,t){const r=fe(t,e.schema),{from:n,to:o,empty:i}=e.selection;let s=[];i?s=e.selection.$head.marks():e.doc.nodesBetween(n,o,c=>{s=[...s,...c.marks]});const a=s.find(c=>c.type.name===r.name);return a?{...a.attrs}:{}}function Au(e,t){const r=$r(typeof t=="string"?t:t.name,e.schema);return r==="node"?Tu(e,t):r==="mark"?ta(e,t):{}}function sr(e,t){const r=Object.keys(t);return r.length?!!r.filter(n=>t[n]===e[n]).length:!0}function Pe(e,t,r={}){const{from:n,to:o,empty:i}=e.selection,s=t?tt(t,e.schema):null;let a=[];if(e.doc.nodesBetween(n,o,(u,f)=>{if(!u.isText){const p=Math.max(n,f),d=Math.min(o,f+u.nodeSize);a=[...a,{node:u,from:p,to:d}]}}),i)return!!a.filter(u=>s?s.name===u.node.type.name:!0).find(u=>sr(u.node.attrs,r));const c=o-n;return a.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>sr(u.node.attrs,r)).reduce((u,f)=>{const p=f.to-f.from;return u+p},0)>=c}function Hn(e,t,r={}){const{from:n,to:o,empty:i}=e.selection,s=t?fe(t,e.schema):null;if(i)return!!(e.storedMarks||e.selection.$from.marks()).filter(p=>s?s.name===p.type.name:!0).find(p=>sr(p.attrs,r));let a=0,c=[];if(e.doc.nodesBetween(n,o,(p,d)=>{if(p.isText){const h=Math.max(n,d),v=Math.min(o,d+p.nodeSize),g=v-h;a+=g,c=[...c,...p.marks.map(S=>({mark:S,from:h,to:v}))]}}),a===0)return!1;const l=c.filter(p=>s?s.name===p.mark.type.name:!0).filter(p=>sr(p.mark.attrs,r)).reduce((p,d)=>{const h=d.to-d.from;return p+h},0),u=c.filter(p=>s?p.mark.type!==s&&p.mark.type.excludes(s):!0).reduce((p,d)=>{const h=d.to-d.from;return p+h},0);return(l>0?l+u:l)>=a}function _u(e,t,r={}){if(!t)return Pe(e,null,r)||Hn(e,null,r);const n=$r(t,e.schema);return n==="node"?Pe(e,t,r):n==="mark"?Hn(e,t,r):!1}function Nu(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function yi(e){const t=`<body>${e}</body>`;return new window.DOMParser().parseFromString(t,"text/html").body}function Dr(e,t,r){if(r={slice:!0,parseOptions:{},...r},typeof e=="object"&&e!==null)try{return Array.isArray(e)?k.fromArray(e.map(n=>t.nodeFromJSON(n))):t.nodeFromJSON(e)}catch(n){return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",n),Dr("",t,r)}if(typeof e=="string"){const n=Bt.fromSchema(t);return r.slice?n.parseSlice(yi(e),r.parseOptions).content:n.parse(yi(e),r.parseOptions)}return Dr("",t,r)}function ea(e,t,r={}){return Dr(e,t,{slice:!1,parseOptions:r})}function Eu(e,t){const r=st.fromSchema(t).serializeFragment(e.content),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(r),o.innerHTML}function Du(e){var t;const r=(t=e.type.createAndFill())===null||t===void 0?void 0:t.toJSON(),n=e.toJSON();return JSON.stringify(r)===JSON.stringify(n)}function Iu(e){const t=document.querySelector("style[data-tiptap-style]");if(t!==null)return t;const r=document.createElement("style");return r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}class Ru{constructor(t,r){this.editor=t,this.commands=r}createCommands(){const{commands:t,editor:r}=this,{state:n,view:o}=r,{tr:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...u)=>{const f=c(...u)(s);return i.getMeta("preventDispatch")||o.dispatch(i),f}]))}createChain(t,r=!0){const{commands:n,editor:o}=this,{state:i,view:s}=o,a=[],c=!!t,l=t||i.tr,u=()=>(!c&&r&&!l.getMeta("preventDispatch")&&s.dispatch(l),a.every(p=>p===!0)),f={...Object.fromEntries(Object.entries(n).map(([p,d])=>[p,(...v)=>{const g=this.buildProps(l,r),S=d(...v)(g);return a.push(S),f}])),run:u};return f}createCan(t){const{commands:r,editor:n}=this,{state:o}=n,i=void 0,s=t||o.tr,a=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(r).map(([l,u])=>[l,(...f)=>u(...f)({...a,dispatch:i})])),chain:()=>this.createChain(s,i)}}buildProps(t,r=!0){const{editor:n,commands:o}=this,{state:i,view:s}=n;i.storedMarks&&t.setStoredMarks(i.storedMarks);const a={tr:t,editor:n,view:s,state:this.chainableState(t,i),dispatch:r?()=>{}:void 0,chain:()=>this.createChain(t),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(o).map(([c,l])=>[c,(...u)=>l(...u)(a)]))}};return a}chainableState(t,r){let{selection:n}=t,{doc:o}=t,{storedMarks:i}=t;return{...r,schema:r.schema,plugins:r.plugins,apply:r.apply.bind(r),applyTransaction:r.applyTransaction.bind(r),reconfigure:r.reconfigure.bind(r),toJSON:r.toJSON.bind(r),get storedMarks(){return i},get selection(){return n},get doc(){return o},get tr(){return n=t.selection,o=t.doc,i=t.storedMarks,t}}}}function A(e,t,r={}){return e.config[t]===void 0&&e.parent?A(e.parent,t,r):typeof e.config[t]=="function"?e.config[t].bind({...r,parent:e.parent?A(e.parent,t,r):null}):e.config[t]}function ar(e){const t=e.filter(o=>o.type==="extension"),r=e.filter(o=>o.type==="node"),n=e.filter(o=>o.type==="mark");return{baseExtensions:t,nodeExtensions:r,markExtensions:n}}function ra(e){const t=[],{nodeExtensions:r,markExtensions:n}=ar(e),o=[...r,...n],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0};return e.forEach(s=>{const a={name:s.name,options:s.options},c=A(s,"addGlobalAttributes",a);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([p,d])=>{t.push({type:f,name:p,attribute:{...i,...d}})})})})}),o.forEach(s=>{const a={name:s.name,options:s.options},c=A(s,"addAttributes",a);if(!c)return;const l=c();Object.entries(l).forEach(([u,f])=>{t.push({type:s.name,name:u,attribute:{...i,...f}})})}),t}function Ct(...e){return e.filter(t=>!!t).reduce((t,r)=>{const n={...t};return Object.entries(r).forEach(([o,i])=>{if(!n[o]){n[o]=i;return}o==="class"?n[o]=[n[o],i].join(" "):o==="style"?n[o]=[n[o],i].join("; "):n[o]=i}),n},{})}function jn(e,t){return t.filter(r=>r.attribute.rendered).map(r=>r.attribute.renderHTML?r.attribute.renderHTML(e.attrs)||{}:{[r.name]:e.attrs[r.name]}).reduce((r,n)=>Ct(r,n),{})}function Pu(e={}){return Object.keys(e).length===0&&e.constructor===Object}function zu(e){return typeof e!="string"?e:e.match(/^\d*(\.\d+)?$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function bi(e,t){return e.style?e:{...e,getAttrs:r=>{const n=e.getAttrs?e.getAttrs(r):e.attrs;if(n===!1)return!1;const o=t.filter(i=>i.attribute.rendered).reduce((i,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(r)||{}:{[s.name]:zu(r.getAttribute(s.name))},c=Object.fromEntries(Object.entries(a).filter(([,l])=>l!=null));return{...i,...c}},{});return{...n,...o}}}}function Z(e,t=void 0,...r){return typeof e=="function"?t?e.bind(t)(...r):e(...r):e}function ki(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>t==="attrs"&&Pu(r)?!1:r!=null))}function Bu(e){var t;const r=ra(e),{nodeExtensions:n,markExtensions:o}=ar(e),i=(t=n.find(c=>A(c,"topNode")))===null||t===void 0?void 0:t.name,s=Object.fromEntries(n.map(c=>{const l=r.filter(v=>v.type===c.name),u={name:c.name,options:c.options},f=e.reduce((v,g)=>{const S=A(g,"extendNodeSchema",u);return{...v,...S?S(c):{}}},{}),p=ki({...f,content:Z(A(c,"content",u)),marks:Z(A(c,"marks",u)),group:Z(A(c,"group",u)),inline:Z(A(c,"inline",u)),atom:Z(A(c,"atom",u)),selectable:Z(A(c,"selectable",u)),draggable:Z(A(c,"draggable",u)),code:Z(A(c,"code",u)),defining:Z(A(c,"defining",u)),isolating:Z(A(c,"isolating",u)),attrs:Object.fromEntries(l.map(v=>{var g;return[v.name,{default:(g=v==null?void 0:v.attribute)===null||g===void 0?void 0:g.default}]}))}),d=Z(A(c,"parseHTML",u));d&&(p.parseDOM=d.map(v=>bi(v,l)));const h=A(c,"renderHTML",u);return h&&(p.toDOM=v=>h({node:v,HTMLAttributes:jn(v,l)})),[c.name,p]})),a=Object.fromEntries(o.map(c=>{const l=r.filter(v=>v.type===c.name),u={name:c.name,options:c.options},f=e.reduce((v,g)=>{const S=A(g,"extendMarkSchema",u);return{...v,...S?S(c):{}}},{}),p=ki({...f,inclusive:Z(A(c,"inclusive",u)),excludes:Z(A(c,"excludes",u)),group:Z(A(c,"group",u)),spanning:Z(A(c,"spanning",u)),attrs:Object.fromEntries(l.map(v=>{var g;return[v.name,{default:(g=v==null?void 0:v.attribute)===null||g===void 0?void 0:g.default}]}))}),d=Z(A(c,"parseHTML",u));d&&(p.parseDOM=d.map(v=>bi(v,l)));const h=A(c,"renderHTML",u);return h&&(p.toDOM=v=>h({mark:v,HTMLAttributes:jn(v,l)})),[c.name,p]}));return new Se({topNode:i,nodes:s,marks:a})}function yn(e,t){return t.nodes[e]?t.nodes[e]:t.marks[e]?t.marks[e]:null}class Xe{constructor(t,r){this.splittableMarks=[],this.editor=r,this.extensions=Xe.resolve(t),this.schema=Bu(this.extensions),this.extensions.forEach(n=>{var o;const i={name:n.name,options:n.options,editor:this.editor,type:yn(n.name,this.schema)};n.type==="mark"&&(!((o=Z(A(n,"keepOnSplit",i)))!==null&&o!==void 0)||o)&&this.splittableMarks.push(n.name);const s=A(n,"onBeforeCreate",i);s&&this.editor.on("beforeCreate",s);const a=A(n,"onCreate",i);a&&this.editor.on("create",a);const c=A(n,"onUpdate",i);c&&this.editor.on("update",c);const l=A(n,"onSelectionUpdate",i);l&&this.editor.on("selectionUpdate",l);const u=A(n,"onTransaction",i);u&&this.editor.on("transaction",u);const f=A(n,"onFocus",i);f&&this.editor.on("focus",f);const p=A(n,"onBlur",i);p&&this.editor.on("blur",p);const d=A(n,"onDestroy",i);d&&this.editor.on("destroy",d)})}static resolve(t){return Xe.sort(Xe.flatten(t))}static flatten(t){return t.map(r=>{const n={name:r.name,options:r.options},o=A(r,"addExtensions",n);return o?[r,...this.flatten(o())]:r}).flat(10)}static sort(t){return t.sort((n,o)=>{const i=A(n,"priority")||100,s=A(o,"priority")||100;return i>s?-1:i<s?1:0})}get commands(){return this.extensions.reduce((t,r)=>{const n={name:r.name,options:r.options,editor:this.editor,type:yn(r.name,this.schema)},o=A(r,"addCommands",n);return o?{...t,...o()}:t},{})}get plugins(){return[...this.extensions].reverse().map(t=>{const r={name:t.name,options:t.options,editor:this.editor,type:yn(t.name,this.schema)},n=[],o=A(t,"addKeyboardShortcuts",r);if(o){const c=Object.fromEntries(Object.entries(o()).map(([u,f])=>[u,()=>f({editor:this.editor})])),l=nu(c);n.push(l)}const i=A(t,"addInputRules",r);if(this.editor.options.enableInputRules&&i){const c=i(),l=c.length?[su({rules:c})]:[];n.push(...l)}const s=A(t,"addPasteRules",r);if(this.editor.options.enablePasteRules&&s){const c=s();n.push(...c)}const a=A(t,"addProseMirrorPlugins",r);if(a){const c=a();n.push(...c)}return n}).flat()}get attributes(){return ra(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:r}=ar(this.extensions);return Object.fromEntries(r.filter(n=>!!A(n,"addNodeView")).map(n=>{const o=this.attributes.filter(c=>c.type===n.name),i={name:n.name,options:n.options,editor:t,type:tt(n.name,this.schema)},s=A(n,"addNodeView",i);if(!s)return[];const a=(c,l,u,f)=>{const p=jn(c,o);return s()({editor:t,node:c,getPos:u,decorations:f,HTMLAttributes:p,extension:n})};return[n.name,a]}))}get textSerializers(){const{editor:t}=this,{nodeExtensions:r}=ar(this.extensions);return Object.fromEntries(r.filter(n=>!!A(n,"renderText")).map(n=>{const o={name:n.name,options:n.options,editor:t,type:tt(n.name,this.schema)},i=A(n,"renderText",o);if(!i)return[];const s=a=>i(a);return[n.name,s]}))}}class Lu{constructor(){this.callbacks={}}on(t,r){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(r),this}emit(t,...r){const n=this.callbacks[t];return n&&n.forEach(o=>o.apply(this,r)),this}off(t,r){const n=this.callbacks[t];return n&&(r?this.callbacks[t]=n.filter(o=>o!==r):delete this.callbacks[t]),this}removeAllListeners(){this.callbacks={}}}function Fu(e){return Object.prototype.toString.call(e).slice(8,-1)}function bn(e){return Fu(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Ur(e,t){const r={...e};return bn(e)&&bn(t)&&Object.keys(t).forEach(n=>{bn(t[n])?n in e?r[n]=Ur(e[n],t[n]):Object.assign(r,{[n]:t[n]}):Object.assign(r,{[n]:t[n]})}),r}class kt{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,this.options=this.config.defaultOptions}static create(t={}){return new kt(t)}configure(t={}){const r=this.extend();return r.options=Ur(this.options,t),r}extend(t={}){const r=new kt(t);return r.parent=this,this.child=r,r.name=t.name?t.name:r.parent.name,r.options=t.defaultOptions?t.defaultOptions:r.parent.options,r}}const Vu=(e,t,r,n,o)=>{let i="",s=!0;return e.state.doc.nodesBetween(t,r,(a,c)=>{var l;const u=e.extensionManager.textSerializers[a.type.name];u?(i+=u({node:a}),s=!n):a.isText?(i+=(l=a==null?void 0:a.text)===null||l===void 0?void 0:l.slice(Math.max(t,c)-c,r-c),s=!n):a.isLeaf&&o?(i+=o,s=!n):!s&&a.isBlock&&(i+=n,s=!0)},0),i},Hu=kt.create({name:"editable",addProseMirrorPlugins(){return[new Rt({key:new Kt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{from:t,to:r}=e.state.selection;return Vu(e,t,r,`
|
||
`)}}})]}}),ju=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{e.isDestroyed||t.dom.blur()}),!0);var qu=Object.freeze({__proto__:null,blur:ju});const Ju=(e=!1)=>({commands:t})=>t.setContent("",e);var Wu=Object.freeze({__proto__:null,clearContent:Ju});const Ku=()=>({state:e,tr:t,dispatch:r})=>{const{selection:n}=t,{ranges:o}=n;return o.forEach(i=>{e.doc.nodesBetween(i.$from.pos,i.$to.pos,(s,a)=>{if(s.type.isText)return;const c=t.doc.resolve(t.mapping.map(a)),l=t.doc.resolve(t.mapping.map(a+s.nodeSize)),u=c.blockRange(l);if(!u)return;const f=Ve(u);if(s.type.isTextblock&&r){const{defaultType:p}=c.parent.contentMatchAt(c.index());t.setNodeMarkup(u.start,p)}(f||f===0)&&r&&t.lift(u,f)})}),!0};var $u=Object.freeze({__proto__:null,clearNodes:Ku});const Uu=e=>t=>e(t);var Gu=Object.freeze({__proto__:null,command:Uu});const Yu=()=>({state:e,dispatch:t})=>mu(e,t);var Xu=Object.freeze({__proto__:null,createParagraphNear:Yu});const Qu=e=>({tr:t,state:r,dispatch:n})=>{const o=tt(e,r.schema),i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(n){const c=i.before(s),l=i.after(s);t.delete(c,l).scrollIntoView()}return!0}return!1};var Zu=Object.freeze({__proto__:null,deleteNode:Qu});const tf=e=>({tr:t,dispatch:r})=>{const{from:n,to:o}=e;return r&&t.delete(n,o),!0};var ef=Object.freeze({__proto__:null,deleteRange:tf});const rf=()=>({state:e,dispatch:t})=>cu(e,t);var nf=Object.freeze({__proto__:null,deleteSelection:rf});const of=()=>({commands:e})=>e.keyboardShortcut("Enter");var sf=Object.freeze({__proto__:null,enter:of});const af=()=>({state:e,dispatch:t})=>hu(e,t);var cf=Object.freeze({__proto__:null,exitCode:af});function qn(e,t,r={}){return e.find(n=>n.type===t&&sr(n.attrs,r))}function lf(e,t,r={}){return!!qn(e,t,r)}function na(e,t,r={}){if(!e||!t)return;const n=e.parent.childAfter(e.parentOffset);if(!n.node)return;const o=qn(n.node.marks,t,r);if(!o)return;let i=e.index(),s=e.start()+n.offset,a=i+1,c=s+n.node.nodeSize;for(qn(n.node.marks,t,r);i>0&&o.isInSet(e.parent.child(i-1).marks);)i-=1,s-=e.parent.child(i).nodeSize;for(;a<e.parent.childCount&&lf(e.parent.child(a).marks,t,r);)c+=e.parent.child(a).nodeSize,a+=1;return{from:s,to:c}}const uf=(e,t={})=>({tr:r,state:n,dispatch:o})=>{const i=fe(e,n.schema),{doc:s,selection:a}=r,{$from:c,from:l,to:u}=a;if(o){const f=na(c,i,t);if(f&&f.from<=l&&f.to>=u){const p=H.create(s,f.from,f.to);r.setSelection(p)}}return!0};var ff=Object.freeze({__proto__:null,extendMarkRange:uf});const pf=e=>t=>{const r=typeof e=="function"?e(t):e;for(let n=0;n<r.length;n+=1)if(r[n](t))return!0;return!1};var df=Object.freeze({__proto__:null,first:pf});function cr(e=0,t=0,r=0){return Math.min(Math.max(e,t),r)}function hf(e){var t;return((t=e.constructor)===null||t===void 0?void 0:t.toString().substring(0,5))==="class"}function oa(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!hf(e)}function ia(e){return oa(e)&&e instanceof H}function mf(e,t=null){if(!t)return null;if(t==="start"||t===!0)return{from:0,to:0};if(t==="end"){const{size:r}=e.doc.content;return{from:r,to:r}}return{from:t,to:t}}const vf=(e=null)=>({editor:t,view:r,tr:n,dispatch:o})=>{const i=()=>{requestAnimationFrame(()=>{t.isDestroyed||r.focus()})};if(r.hasFocus()&&e===null||e===!1)return!0;if(o&&e===null&&!ia(t.state.selection))return i(),!0;const{from:s,to:a}=mf(t.state,e)||t.state.selection,{doc:c,storedMarks:l}=n,u=E.atStart(c).from,f=E.atEnd(c).to,p=cr(s,u,f),d=cr(a,u,f),h=H.create(c,p,d),v=t.state.selection.eq(h);return o&&(v||n.setSelection(h),v&&l&&n.setStoredMarks(l),i()),!0};var gf=Object.freeze({__proto__:null,focus:vf});const yf=(e,t)=>r=>e.every((n,o)=>t(n,{...r,index:o}));var bf=Object.freeze({__proto__:null,forEach:yf});const kf=(e,t)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},e,t);var Sf=Object.freeze({__proto__:null,insertContent:kf});function Mf(e,t,r){const n=e.steps.length-1;if(n<t)return;const o=e.steps[n];if(!(o instanceof Qt||o instanceof Mt))return;const i=e.mapping.maps[n];let s=0;i.forEach((a,c,l,u)=>{s===0&&(s=u)}),e.setSelection(E.near(e.doc.resolve(s),r))}const xf=(e,t,r)=>({tr:n,dispatch:o,editor:i})=>{if(o){const s=Dr(t,i.schema,{parseOptions:{preserveWhitespace:"full"},...r||{}});if(s.toString()==="<>")return!0;const{from:a,to:c}=typeof e=="number"?{from:e,to:e}:e;n.replaceWith(a,c,s),Mf(n,n.steps.length-1,1)}return!0};var Cf=Object.freeze({__proto__:null,insertContentAt:xf});const Of=()=>({state:e,dispatch:t})=>lu(e,t);var wf=Object.freeze({__proto__:null,joinBackward:Of});const Tf=()=>({state:e,dispatch:t})=>fu(e,t);var Af=Object.freeze({__proto__:null,joinForward:Tf});const _f=typeof navigator<"u"?/Mac/.test(navigator.platform):!1;function Nf(e){const t=e.split(/-(?!$)/);let r=t[t.length-1];r==="Space"&&(r=" ");let n,o,i,s;for(let a=0;a<t.length-1;a+=1){const c=t[a];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))n=!0;else if(/^(c|ctrl|control)$/i.test(c))o=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))_f?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return n&&(r=`Alt-${r}`),o&&(r=`Ctrl-${r}`),s&&(r=`Meta-${r}`),i&&(r=`Shift-${r}`),r}const Ef=e=>({editor:t,view:r,tr:n,dispatch:o})=>{const i=Nf(e).split(/-(?!$)/),s=i.find(l=>!["Alt","Ctrl","Meta","Shift"].includes(l)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=t.captureTransaction(()=>{r.someProp("handleKeyDown",l=>l(r,a))});return c==null||c.steps.forEach(l=>{const u=l.map(n.mapping);u&&o&&n.maybeStep(u)}),!0};var Df=Object.freeze({__proto__:null,keyboardShortcut:Ef});const If=(e,t={})=>({state:r,dispatch:n})=>{const o=tt(e,r.schema);return Pe(r,o,t)?Ys(r,n):!1};var Rf=Object.freeze({__proto__:null,lift:If});const Pf=()=>({state:e,dispatch:t})=>vu(e,t);var zf=Object.freeze({__proto__:null,liftEmptyBlock:Pf});const Bf=e=>({state:t,dispatch:r})=>{const n=tt(e,t.schema);return xu(n)(t,r)};var Lf=Object.freeze({__proto__:null,liftListItem:Bf});const Ff=()=>({state:e,dispatch:t})=>du(e,t);var Vf=Object.freeze({__proto__:null,newlineInCode:Ff});function Si(e,t){const r=typeof t=="string"?[t]:t;return Object.keys(e).reduce((n,o)=>(r.includes(o)||(n[o]=e[o]),n),{})}const Hf=(e,t)=>({tr:r,state:n,dispatch:o})=>{let i=null,s=null;const a=$r(typeof e=="string"?e:e.name,n.schema);return a?(a==="node"&&(i=tt(e,n.schema)),a==="mark"&&(s=fe(e,n.schema)),o&&r.selection.ranges.forEach(c=>{n.doc.nodesBetween(c.$from.pos,c.$to.pos,(l,u)=>{i&&i===l.type&&r.setNodeMarkup(u,void 0,Si(l.attrs,t)),s&&l.marks.length&&l.marks.forEach(f=>{s===f.type&&r.addMark(u,u+l.nodeSize,s.create(Si(f.attrs,t)))})})}),!0):!1};var jf=Object.freeze({__proto__:null,resetAttributes:Hf});const qf=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0);var Jf=Object.freeze({__proto__:null,scrollIntoView:qf});const Wf=()=>({state:e,dispatch:t})=>yu(e,t);var Kf=Object.freeze({__proto__:null,selectAll:Wf});const $f=()=>({state:e,dispatch:t})=>uu(e,t);var Uf=Object.freeze({__proto__:null,selectNodeBackward:$f});const Gf=()=>({state:e,dispatch:t})=>pu(e,t);var Yf=Object.freeze({__proto__:null,selectNodeForward:Gf});const Xf=()=>({state:e,dispatch:t})=>gu(e,t);var Qf=Object.freeze({__proto__:null,selectParentNode:Xf});const Zf=(e,t=!1,r={})=>({tr:n,editor:o,dispatch:i})=>{const{doc:s}=n,a=ea(e,o.schema,r),c=H.create(s,0,s.content.size);return i&&n.setSelection(c).replaceSelectionWith(a,!1).setMeta("preventUpdate",!t),!0};var tp=Object.freeze({__proto__:null,setContent:Zf});const ep=(e,t={})=>({tr:r,state:n,dispatch:o})=>{const{selection:i}=r,{empty:s,ranges:a}=i,c=fe(e,n.schema);if(o)if(s){const l=ta(n,c);r.addStoredMark(c.create({...l,...t}))}else a.forEach(l=>{const u=l.$from.pos,f=l.$to.pos;n.doc.nodesBetween(u,f,(p,d)=>{const h=Math.max(d,u),v=Math.min(d+p.nodeSize,f);p.marks.find(S=>S.type===c)?p.marks.forEach(S=>{c===S.type&&r.addMark(h,v,c.create({...S.attrs,...t}))}):r.addMark(h,v,c.create(t))})});return!0};var rp=Object.freeze({__proto__:null,setMark:ep});const np=(e,t)=>({tr:r})=>(r.setMeta(e,t),!0);var op=Object.freeze({__proto__:null,setMeta:np});const ip=(e,t={})=>({state:r,dispatch:n})=>{const o=tt(e,r.schema);return ku(o,t)(r,n)};var sp=Object.freeze({__proto__:null,setNode:ip});const ap=e=>({tr:t,dispatch:r})=>{if(r){const{doc:n}=t,o=E.atStart(n).from,i=E.atEnd(n).to,s=cr(e,o,i),a=N.create(n,s);t.setSelection(a)}return!0};var cp=Object.freeze({__proto__:null,setNodeSelection:ap});const lp=e=>({tr:t,dispatch:r})=>{if(r){const{doc:n}=t,{from:o,to:i}=typeof e=="number"?{from:e,to:e}:e,s=E.atStart(n).from,a=E.atEnd(n).to,c=cr(o,s,a),l=cr(i,s,a),u=H.create(n,c,l);t.setSelection(u)}return!0};var up=Object.freeze({__proto__:null,setTextSelection:lp});const fp=e=>({state:t,dispatch:r})=>{const n=tt(e,t.schema);return wu(n)(t,r)};var pp=Object.freeze({__proto__:null,sinkListItem:fp});function Mr(e,t,r){return Object.fromEntries(Object.entries(r).filter(([n])=>{const o=e.find(i=>i.type===t&&i.name===n);return o?o.attribute.keepOnSplit:!1}))}function dp(e){for(let t=0;t<e.edgeCount;t+=1){const{type:r}=e.edge(t);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}function Mi(e,t){const r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(r){const n=r.filter(o=>t==null?void 0:t.includes(o.type.name));e.tr.ensureMarks(n)}}const hp=({keepMarks:e=!0}={})=>({tr:t,state:r,dispatch:n,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:c}=i,l=o.extensionManager.attributes,u=Mr(l,a.node().type.name,a.node().attrs);if(i instanceof N&&i.node.isBlock)return!a.parentOffset||!_e(s,a.pos)?!1:(n&&(e&&Mi(r,o.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(n){const f=c.parentOffset===c.parent.content.size;i instanceof H&&t.deleteSelection();const p=a.depth===0?void 0:dp(a.node(-1).contentMatchAt(a.indexAfter(-1)));let d=f&&p?[{type:p,attrs:u}]:void 0,h=_e(t.doc,t.mapping.map(a.pos),1,d);if(!d&&!h&&_e(t.doc,t.mapping.map(a.pos),1,p?[{type:p}]:void 0)&&(h=!0,d=p?[{type:p,attrs:u}]:void 0),h&&(t.split(t.mapping.map(a.pos),1,d),p&&!f&&!a.parentOffset&&a.parent.type!==p)){const v=t.mapping.map(a.before()),g=t.doc.resolve(v);a.node(-1).canReplaceWith(g.index(),g.index()+1,p)&&t.setNodeMarkup(t.mapping.map(a.before()),p)}e&&Mi(r,o.extensionManager.splittableMarks),t.scrollIntoView()}return!0};var mp=Object.freeze({__proto__:null,splitBlock:hp});const vp=e=>({tr:t,state:r,dispatch:n,editor:o})=>{var i;const s=tt(e,r.schema),{$from:a,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||a.depth<2||!a.sameParent(c))return!1;const u=a.node(-1);if(u.type!==s)return!1;const f=o.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(n){let g=k.empty;const S=a.index(-1)?1:a.index(-2)?2:3;for(let L=a.depth-S;L>=a.depth-3;L-=1)g=k.from(a.node(L).copy(g));const y=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,I=Mr(f,a.node().type.name,a.node().attrs),m=((i=s.contentMatch.defaultType)===null||i===void 0?void 0:i.createAndFill(I))||void 0;g=g.append(k.from(s.createAndFill(null,m)||void 0));const D=a.before(a.depth-(S-1));t.replace(D,a.after(-y),new x(g,4-S,0));let C=-1;t.doc.nodesBetween(D,t.doc.content.size,(L,q)=>{if(C>-1)return!1;L.isTextblock&&L.content.size===0&&(C=q+1)}),C>-1&&t.setSelection(H.near(t.doc.resolve(C))),t.scrollIntoView()}return!0}const p=c.pos===a.end()?u.contentMatchAt(0).defaultType:null,d=Mr(f,u.type.name,u.attrs),h=Mr(f,a.node().type.name,a.node().attrs);t.delete(a.pos,c.pos);const v=p?[{type:s,attrs:d},{type:p,attrs:h}]:[{type:s,attrs:d}];return _e(t.doc,a.pos,2)?(n&&t.split(a.pos,2,v).scrollIntoView(),!0):!1};var gp=Object.freeze({__proto__:null,splitListItem:vp});function yp(e,t){for(let r=e.depth;r>0;r-=1){const n=e.node(r);if(t(n))return{pos:r>0?e.before(r):0,start:e.start(r),depth:r,node:n}}}function bp(e){return t=>yp(t.$from,e)}function xi(e,t){const{nodeExtensions:r}=ar(t),n=r.find(s=>s.name===e);if(!n)return!1;const o={name:n.name,options:n.options},i=Z(A(n,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}const kp=(e,t)=>({editor:r,tr:n,state:o,dispatch:i,chain:s,commands:a,can:c})=>{const{extensions:l}=r.extensionManager,u=tt(e,o.schema),f=tt(t,o.schema),{selection:p}=o,{$from:d,$to:h}=p,v=d.blockRange(h);if(!v)return!1;const g=bp(y=>xi(y.type.name,l))(p);if(v.depth>=1&&g&&v.depth-g.depth<=1){if(g.node.type===u)return a.liftListItem(f);if(xi(g.node.type.name,l)&&u.validContent(g.node.content)&&i)return n.setNodeMarkup(g.pos,u),!0}return c().wrapInList(u)?a.wrapInList(u):s().clearNodes().wrapInList(u).run()};var Sp=Object.freeze({__proto__:null,toggleList:kp});const Mp=(e,t={})=>({state:r,commands:n})=>{const o=fe(e,r.schema);return Hn(r,o,t)?n.unsetMark(o):n.setMark(o,t)};var xp=Object.freeze({__proto__:null,toggleMark:Mp});const Cp=(e,t,r={})=>({state:n,commands:o})=>{const i=tt(e,n.schema),s=tt(t,n.schema);return Pe(n,i,r)?o.setNode(s):o.setNode(i,r)};var Op=Object.freeze({__proto__:null,toggleNode:Cp});const wp=(e,t={})=>({state:r,dispatch:n})=>{const o=tt(e,r.schema);return Pe(r,o,t)?Ys(r,n):Zs(o,t)(r,n)};var Tp=Object.freeze({__proto__:null,toggleWrap:wp});const Ap=()=>({state:e,dispatch:t})=>au(e,t);var _p=Object.freeze({__proto__:null,undoInputRule:Ap});const Np=()=>({tr:e,state:t,dispatch:r})=>{const{selection:n}=e,{empty:o,ranges:i}=n;return o||r&&Object.entries(t.schema.marks).forEach(([,s])=>{i.forEach(a=>{e.removeMark(a.$from.pos,a.$to.pos,s)})}),!0};var Ep=Object.freeze({__proto__:null,unsetAllMarks:Np});const Dp=e=>({tr:t,state:r,dispatch:n})=>{const{selection:o}=t,i=fe(e,r.schema),{$from:s,empty:a,ranges:c}=o;if(n){if(a){let{from:l,to:u}=o;const f=na(s,i);f&&(l=f.from,u=f.to),t.removeMark(l,u,i)}else c.forEach(l=>{t.removeMark(l.$from.pos,l.$to.pos,i)});t.removeStoredMark(i)}return!0};var Ip=Object.freeze({__proto__:null,unsetMark:Dp});const Rp=(e,t={})=>({tr:r,state:n,dispatch:o})=>{let i=null,s=null;const a=$r(typeof e=="string"?e:e.name,n.schema);return a?(a==="node"&&(i=tt(e,n.schema)),a==="mark"&&(s=fe(e,n.schema)),o&&r.selection.ranges.forEach(c=>{const l=c.$from.pos,u=c.$to.pos;n.doc.nodesBetween(l,u,(f,p)=>{i&&i===f.type&&r.setNodeMarkup(p,void 0,{...f.attrs,...t}),s&&f.marks.length&&f.marks.forEach(d=>{if(s===d.type){const h=Math.max(p,l),v=Math.min(p+f.nodeSize,u);r.addMark(h,v,s.create({...d.attrs,...t}))}})})}),!0):!1};var Pp=Object.freeze({__proto__:null,updateAttributes:Rp});const zp=(e,t={})=>({state:r,dispatch:n})=>{const o=tt(e,r.schema);return Pe(r,o,t)?!1:Zs(o,t)(r,n)};var Bp=Object.freeze({__proto__:null,wrapIn:zp});const Lp=(e,t={})=>({state:r,dispatch:n})=>{const o=tt(e,r.schema);return Su(o,t)(r,n)};var Fp=Object.freeze({__proto__:null,wrapInList:Lp});const Vp=kt.create({name:"commands",addCommands(){return{...qu,...Wu,...$u,...Gu,...Xu,...Zu,...ef,...nf,...sf,...cf,...ff,...df,...gf,...bf,...Sf,...Cf,...wf,...Af,...Df,...Rf,...zf,...Lf,...Vf,...jf,...Jf,...Kf,...Uf,...Yf,...Qf,...tp,...rp,...op,...sp,...cp,...up,...pp,...mp,...gp,...Sp,...xp,...Op,...Tp,..._p,...Ep,...Ip,...Pp,...Bp,...Fp}}}),Hp=kt.create({name:"editable",addProseMirrorPlugins(){return[new Rt({key:new Kt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),jp=kt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Rt({key:new Kt("focusEvents"),props:{attributes:{tabindex:"0"},handleDOMEvents:{focus:(t,r)=>{e.isFocused=!0;const n=e.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",!1);return t.dispatch(n),!1},blur:(t,r)=>{e.isFocused=!1;const n=e.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",!1);return t.dispatch(n),!1}}}})]}}),qp=kt.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:r})=>[()=>r.undoInputRule(),()=>r.deleteSelection(),()=>r.joinBackward(),()=>r.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:r})=>[()=>r.deleteSelection(),()=>r.joinForward(),()=>r.selectNodeForward()]);return{Enter:()=>this.editor.commands.first(({commands:r})=>[()=>r.newlineInCode(),()=>r.createParagraphNear(),()=>r.liftEmptyBlock(),()=>r.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:()=>e(),"Mod-Backspace":()=>e(),Delete:()=>t(),"Mod-Delete":()=>t()}}});var Jp=Object.freeze({__proto__:null,ClipboardTextSerializer:Hu,Commands:Vp,Editable:Hp,FocusEvents:jp,Keymap:qp});const Wp=`.ProseMirror {
|
||
position: relative;
|
||
}
|
||
|
||
.ProseMirror {
|
||
word-wrap: break-word;
|
||
white-space: pre-wrap;
|
||
-webkit-font-variant-ligatures: none;
|
||
font-variant-ligatures: none;
|
||
}
|
||
|
||
.ProseMirror [contenteditable="false"] {
|
||
white-space: normal;
|
||
}
|
||
|
||
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
||
white-space: pre-wrap;
|
||
}
|
||
|
||
.ProseMirror pre {
|
||
white-space: pre-wrap;
|
||
}
|
||
|
||
.ProseMirror-gapcursor {
|
||
display: none;
|
||
pointer-events: none;
|
||
position: absolute;
|
||
}
|
||
|
||
.ProseMirror-gapcursor:after {
|
||
content: "";
|
||
display: block;
|
||
position: absolute;
|
||
top: -2px;
|
||
width: 20px;
|
||
border-top: 1px solid black;
|
||
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
||
}
|
||
|
||
@keyframes ProseMirror-cursor-blink {
|
||
to {
|
||
visibility: hidden;
|
||
}
|
||
}
|
||
|
||
.ProseMirror-hideselection *::selection {
|
||
background: transparent;
|
||
}
|
||
|
||
.ProseMirror-hideselection *::-moz-selection {
|
||
background: transparent;
|
||
}
|
||
|
||
.ProseMirror-hideselection * {
|
||
caret-color: transparent;
|
||
}
|
||
|
||
.ProseMirror-focused .ProseMirror-gapcursor {
|
||
display: block;
|
||
}
|
||
|
||
.tippy-box[data-animation=fade][data-state=hidden] {
|
||
opacity: 0
|
||
}`;let Kp=class extends Lu{constructor(t={}){super(),this.isFocused=!1,this.options={element:document.createElement("div"),content:"",injectCSS:!0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}get commands(){return this.commandManager.createCommands()}chain(){return this.commandManager.createChain()}can(){return this.commandManager.createCan()}injectCSS(){this.options.injectCSS&&document&&(this.css=Iu(Wp))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t){this.setOptions({editable:t})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,r){const n=typeof r=="function"?r(t,this.state.plugins):[...this.state.plugins,t],o=this.state.reconfigure({plugins:n});this.view.updateState(o)}unregisterPlugin(t){if(this.isDestroyed)return;const r=typeof t=="string"?`${t}$`:t.key,n=this.state.reconfigure({plugins:this.state.plugins.filter(o=>!o.key.startsWith(r))});this.view.updateState(n)}createExtensionManager(){const r=[...Object.entries(Jp).map(([,n])=>n),...this.options.extensions].filter(n=>["extension","node","mark"].includes(n==null?void 0:n.type));this.extensionManager=new Xe(r,this)}createCommandManager(){this.commandManager=new Ru(this,this.extensionManager.commands)}createSchema(){this.schema=this.extensionManager.schema}createView(){this.view=new Q(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:dt.create({doc:ea(this.options.content,this.schema,this.options.parseOptions)})});const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.createNodeViews();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const r=this.capturedTransaction;return this.capturedTransaction=null,r}dispatchTransaction(t){if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(s=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(s)});return}const r=this.state.apply(t),n=!this.state.selection.eq(r.selection);this.view.updateState(r),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=t.getMeta("focus"),i=t.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:t}),i&&this.emit("blur",{editor:this,event:i.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return Au(this.state,t)}isActive(t,r){const n=typeof t=="string"?t:null,o=typeof t=="string"?r:t;return _u(this.state,n,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Eu(this.state.doc,this.schema)}get isEmpty(){return Du(this.state.doc)}getCharacterCount(){return this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners(),Nu(this.css)}get isDestroyed(){var t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}};class Ot{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,this.options=this.config.defaultOptions}static create(t={}){return new Ot(t)}configure(t={}){const r=this.extend();return r.options=Ur(this.options,t),r}extend(t={}){const r=new Ot(t);return r.parent=this,this.child=r,r.name=t.name?t.name:r.parent.name,r.options=t.defaultOptions?t.defaultOptions:r.parent.options,r}}class ke{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,this.options=this.config.defaultOptions}static create(t={}){return new ke(t)}configure(t={}){const r=this.extend();return r.options=Ur(this.options,t),r}extend(t={}){const r=new ke(t);return r.parent=this,this.child=r,r.name=t.name?t.name:r.parent.name,r.options=t.defaultOptions?t.defaultOptions:r.parent.options,r}}function $p(e,t,r){return new Kr(e,(n,o,i,s)=>{const a=r instanceof Function?r(o):r,{tr:c}=n;return o[0]&&c.replaceWith(i-1,s,t.create(a)),c})}function Up(e,t,r){let n=[];return r.doc.nodesBetween(e,t,(o,i)=>{n=[...n,...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s}))]}),n}function ze(e,t,r){return new Kr(e,(n,o,i,s)=>{const a=r instanceof Function?r(o):r,{tr:c}=n,l=o[o.length-1],u=o[0];let f=s;if(l){const p=u.search(/\S/),d=i+u.indexOf(l),h=d+l.length;if(Up(i,s,n).filter(g=>{const{excluded:S}=g.mark.type;return S.find(y=>y.name===t.name)}).filter(g=>g.to>d).length)return null;h<s&&c.delete(h,s),d>i&&c.delete(i+p,d),f=i+p+l.length,c.addMark(i+p,f,t.create(a)),c.removeStoredMark(t)}return c})}function Be(e,t,r){const n=(o,i)=>{const s=[];return o.forEach(a=>{if(a.isText&&a.text){const{text:c}=a;let l=0,u;for(;(u=e.exec(c))!==null;){const f=Math.max(u.length-2,0),p=Math.max(u.length-1,0);if(i!=null&&i.type.allowsMarkType(t)){const h=u.index+u[0].indexOf(u[f]),v=h+u[f].length,g=h+u[f].lastIndexOf(u[p]),S=g+u[p].length,y=r instanceof Function?r(u):r;if(!y&&y!==void 0)continue;h>0&&s.push(a.cut(l,h)),s.push(a.cut(g,S).mark(t.create(y).addToSet(a.marks))),l=v}}l<c.length&&s.push(a.cut(l))}else s.push(a.copy(n(a.content,a)))}),k.fromArray(s)};return new Rt({key:new Kt("markPasteRule"),props:{transformPasted:o=>new x(n(o.content),o.openStart,o.openEnd)}})}function Gp(e){return oa(e)&&e instanceof N}function sa(e,t,r){const n=e.coordsAtPos(t),o=e.coordsAtPos(r,-1),i=Math.min(n.top,o.top),s=Math.max(n.bottom,o.bottom),a=Math.min(n.left,o.left),c=Math.max(n.right,o.right),l=c-a,u=s-i,d={top:i,bottom:s,left:a,right:c,width:l,height:u,x:a,y:i};return{...d,toJSON:()=>d}}var Yp="tippy-box",aa="tippy-content",Xp="tippy-backdrop",ca="tippy-arrow",la="tippy-svg-arrow",de={passive:!0,capture:!0};function kn(e,t,r){if(Array.isArray(e)){var n=e[t];return n??(Array.isArray(r)?r[t]:r)}return e}function Mo(e,t){var r={}.toString.call(e);return r.indexOf("[object")===0&&r.indexOf(t+"]")>-1}function ua(e,t){return typeof e=="function"?e.apply(void 0,t):e}function Ci(e,t){if(t===0)return e;var r;return function(n){clearTimeout(r),r=setTimeout(function(){e(n)},t)}}function Qp(e){return e.split(/\s+/).filter(Boolean)}function We(e){return[].concat(e)}function Oi(e,t){e.indexOf(t)===-1&&e.push(t)}function Zp(e){return e.filter(function(t,r){return e.indexOf(t)===r})}function td(e){return e.split("-")[0]}function Ir(e){return[].slice.call(e)}function ed(e){return Object.keys(e).reduce(function(t,r){return e[r]!==void 0&&(t[r]=e[r]),t},{})}function Qe(){return document.createElement("div")}function Gr(e){return["Element","Fragment"].some(function(t){return Mo(e,t)})}function rd(e){return Mo(e,"NodeList")}function nd(e){return Mo(e,"MouseEvent")}function od(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function id(e){return Gr(e)?[e]:rd(e)?Ir(e):Array.isArray(e)?e:Ir(document.querySelectorAll(e))}function Sn(e,t){e.forEach(function(r){r&&(r.style.transitionDuration=t+"ms")})}function wi(e,t){e.forEach(function(r){r&&r.setAttribute("data-state",t)})}function sd(e){var t,r=We(e),n=r[0];return!(n==null||(t=n.ownerDocument)==null)&&t.body?n.ownerDocument:document}function ad(e,t){var r=t.clientX,n=t.clientY;return e.every(function(o){var i=o.popperRect,s=o.popperState,a=o.props,c=a.interactiveBorder,l=td(s.placement),u=s.modifiersData.offset;if(!u)return!0;var f=l==="bottom"?u.top.y:0,p=l==="top"?u.bottom.y:0,d=l==="right"?u.left.x:0,h=l==="left"?u.right.x:0,v=i.top-n+f>c,g=n-i.bottom-p>c,S=i.left-r+d>c,y=r-i.right-h>c;return v||g||S||y})}function Mn(e,t,r){var n=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(o){e[n](o,r)})}var jt={isTouch:!1},Ti=0;function cd(){jt.isTouch||(jt.isTouch=!0,window.performance&&document.addEventListener("mousemove",fa))}function fa(){var e=performance.now();e-Ti<20&&(jt.isTouch=!1,document.removeEventListener("mousemove",fa)),Ti=e}function ld(){var e=document.activeElement;if(od(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function ud(){document.addEventListener("touchstart",cd,de),window.addEventListener("blur",ld)}var fd=typeof window<"u"&&typeof document<"u",pd=fd?navigator.userAgent:"",dd=/MSIE |Trident\//.test(pd),hd={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},md={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},zt=Object.assign({appendTo:function(){return document.body},aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},hd,{},md),vd=Object.keys(zt),gd=function(t){var r=Object.keys(t);r.forEach(function(n){zt[n]=t[n]})};function pa(e){var t=e.plugins||[],r=t.reduce(function(n,o){var i=o.name,s=o.defaultValue;return i&&(n[i]=e[i]!==void 0?e[i]:s),n},{});return Object.assign({},e,{},r)}function yd(e,t){var r=t?Object.keys(pa(Object.assign({},zt,{plugins:t}))):vd,n=r.reduce(function(o,i){var s=(e.getAttribute("data-tippy-"+i)||"").trim();if(!s)return o;if(i==="content")o[i]=s;else try{o[i]=JSON.parse(s)}catch{o[i]=s}return o},{});return n}function Ai(e,t){var r=Object.assign({},t,{content:ua(t.content,[e])},t.ignoreAttributes?{}:yd(e,t.plugins));return r.aria=Object.assign({},zt.aria,{},r.aria),r.aria={expanded:r.aria.expanded==="auto"?t.interactive:r.aria.expanded,content:r.aria.content==="auto"?t.interactive?null:"describedby":r.aria.content},r}var bd=function(){return"innerHTML"};function Jn(e,t){e[bd()]=t}function _i(e){var t=Qe();return e===!0?t.className=ca:(t.className=la,Gr(e)?t.appendChild(e):Jn(t,e)),t}function Ni(e,t){Gr(t.content)?(Jn(e,""),e.appendChild(t.content)):typeof t.content!="function"&&(t.allowHTML?Jn(e,t.content):e.textContent=t.content)}function Wn(e){var t=e.firstElementChild,r=Ir(t.children);return{box:t,content:r.find(function(n){return n.classList.contains(aa)}),arrow:r.find(function(n){return n.classList.contains(ca)||n.classList.contains(la)}),backdrop:r.find(function(n){return n.classList.contains(Xp)})}}function da(e){var t=Qe(),r=Qe();r.className=Yp,r.setAttribute("data-state","hidden"),r.setAttribute("tabindex","-1");var n=Qe();n.className=aa,n.setAttribute("data-state","hidden"),Ni(n,e.props),t.appendChild(r),r.appendChild(n),o(e.props,e.props);function o(i,s){var a=Wn(t),c=a.box,l=a.content,u=a.arrow;s.theme?c.setAttribute("data-theme",s.theme):c.removeAttribute("data-theme"),typeof s.animation=="string"?c.setAttribute("data-animation",s.animation):c.removeAttribute("data-animation"),s.inertia?c.setAttribute("data-inertia",""):c.removeAttribute("data-inertia"),c.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?c.setAttribute("role",s.role):c.removeAttribute("role"),(i.content!==s.content||i.allowHTML!==s.allowHTML)&&Ni(l,e.props),s.arrow?u?i.arrow!==s.arrow&&(c.removeChild(u),c.appendChild(_i(s.arrow))):c.appendChild(_i(s.arrow)):u&&c.removeChild(u)}return{popper:t,onUpdate:o}}da.$$tippy=!0;var kd=1,kr=[],xn=[];function Sd(e,t){var r=Ai(e,Object.assign({},zt,{},pa(ed(t)))),n,o,i,s=!1,a=!1,c=!1,l=!1,u,f,p,d=[],h=Ci(Eo,r.interactiveDebounce),v,g=kd++,S=null,y=Zp(r.plugins),I={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},m={id:g,reference:e,popper:Qe(),popperInstance:S,props:r,state:I,plugins:y,clearDelayTimeouts:wa,setProps:Ta,setContent:Aa,show:_a,hide:Na,hideWithInteractivity:Ea,enable:Ca,disable:Oa,unmount:Da,destroy:Ia};if(!r.render)return m;var D=r.render(m),C=D.popper,L=D.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+m.id,m.popper=C,e._tippy=m,C._tippy=m;var q=y.map(function(b){return b.fn(m)}),$=e.hasAttribute("aria-expanded");return Ao(),je(),Zt(),_t("onCreate",[m]),r.showOnCreate&&Bo(),C.addEventListener("mouseenter",function(){m.props.interactive&&m.state.isVisible&&m.clearDelayTimeouts()}),C.addEventListener("mouseleave",function(b){m.props.interactive&&m.props.trigger.indexOf("mouseenter")>=0&&(Ht().addEventListener("mousemove",h),h(b))}),m;function w(){var b=m.props.touch;return Array.isArray(b)?b:[b,0]}function Gt(){return w()[0]==="hold"}function et(){var b;return!!((b=m.props.render)!=null&&b.$$tippy)}function lt(){return v||e}function Ht(){var b=lt().parentNode;return b?sd(b):document}function U(){return Wn(C)}function G(b){return m.state.isMounted&&!m.state.isVisible||jt.isTouch||u&&u.type==="focus"?0:kn(m.props.delay,b?0:1,zt.delay)}function Zt(){C.style.pointerEvents=m.props.interactive&&m.state.isVisible?"":"none",C.style.zIndex=""+m.props.zIndex}function _t(b,O,_){if(_===void 0&&(_=!0),q.forEach(function(z){z[b]&&z[b].apply(void 0,O)}),_){var V;(V=m.props)[b].apply(V,O)}}function xo(){var b=m.props.aria;if(b.content){var O="aria-"+b.content,_=C.id,V=We(m.props.triggerTarget||e);V.forEach(function(z){var mt=z.getAttribute(O);if(m.state.isVisible)z.setAttribute(O,mt?mt+" "+_:_);else{var Nt=mt&&mt.replace(_,"").trim();Nt?z.setAttribute(O,Nt):z.removeAttribute(O)}})}}function je(){if(!($||!m.props.aria.expanded)){var b=We(m.props.triggerTarget||e);b.forEach(function(O){m.props.interactive?O.setAttribute("aria-expanded",m.state.isVisible&&O===lt()?"true":"false"):O.removeAttribute("aria-expanded")})}}function Yr(){Ht().removeEventListener("mousemove",h),kr=kr.filter(function(b){return b!==h})}function hr(b){if(!(jt.isTouch&&(c||b.type==="mousedown"))&&!(m.props.interactive&&C.contains(b.target))){if(lt().contains(b.target)){if(jt.isTouch||m.state.isVisible&&m.props.trigger.indexOf("click")>=0)return}else _t("onClickOutside",[m,b]);m.props.hideOnClick===!0&&(m.clearDelayTimeouts(),m.hide(),a=!0,setTimeout(function(){a=!1}),m.state.isMounted||Xr())}}function Co(){c=!0}function Oo(){c=!1}function wo(){var b=Ht();b.addEventListener("mousedown",hr,!0),b.addEventListener("touchend",hr,de),b.addEventListener("touchstart",Oo,de),b.addEventListener("touchmove",Co,de)}function Xr(){var b=Ht();b.removeEventListener("mousedown",hr,!0),b.removeEventListener("touchend",hr,de),b.removeEventListener("touchstart",Oo,de),b.removeEventListener("touchmove",Co,de)}function Sa(b,O){To(b,function(){!m.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&O()})}function Ma(b,O){To(b,O)}function To(b,O){var _=U().box;function V(z){z.target===_&&(Mn(_,"remove",V),O())}if(b===0)return O();Mn(_,"remove",f),Mn(_,"add",V),f=V}function Ce(b,O,_){_===void 0&&(_=!1);var V=We(m.props.triggerTarget||e);V.forEach(function(z){z.addEventListener(b,O,_),d.push({node:z,eventType:b,handler:O,options:_})})}function Ao(){Gt()&&(Ce("touchstart",No,{passive:!0}),Ce("touchend",Do,{passive:!0})),Qp(m.props.trigger).forEach(function(b){if(b!=="manual")switch(Ce(b,No),b){case"mouseenter":Ce("mouseleave",Do);break;case"focus":Ce(dd?"focusout":"blur",Io);break;case"focusin":Ce("focusout",Io);break}})}function _o(){d.forEach(function(b){var O=b.node,_=b.eventType,V=b.handler,z=b.options;O.removeEventListener(_,V,z)}),d=[]}function No(b){var O,_=!1;if(!(!m.state.isEnabled||Ro(b)||a)){var V=((O=u)==null?void 0:O.type)==="focus";u=b,v=b.currentTarget,je(),!m.state.isVisible&&nd(b)&&kr.forEach(function(z){return z(b)}),b.type==="click"&&(m.props.trigger.indexOf("mouseenter")<0||s)&&m.props.hideOnClick!==!1&&m.state.isVisible?_=!0:Bo(b),b.type==="click"&&(s=!_),_&&!V&&mr(b)}}function Eo(b){var O=b.target,_=lt().contains(O)||C.contains(O);if(!(b.type==="mousemove"&&_)){var V=Qr().concat(C).map(function(z){var mt,Nt=z._tippy,Oe=(mt=Nt.popperInstance)==null?void 0:mt.state;return Oe?{popperRect:z.getBoundingClientRect(),popperState:Oe,props:r}:null}).filter(Boolean);ad(V,b)&&(Yr(),mr(b))}}function Do(b){var O=Ro(b)||m.props.trigger.indexOf("click")>=0&&s;if(!O){if(m.props.interactive){m.hideWithInteractivity(b);return}mr(b)}}function Io(b){m.props.trigger.indexOf("focusin")<0&&b.target!==lt()||m.props.interactive&&b.relatedTarget&&C.contains(b.relatedTarget)||mr(b)}function Ro(b){return jt.isTouch?Gt()!==b.type.indexOf("touch")>=0:!1}function Po(){zo();var b=m.props,O=b.popperOptions,_=b.placement,V=b.offset,z=b.getReferenceClientRect,mt=b.moveTransition,Nt=et()?Wn(C).arrow:null,Oe=z?{getBoundingClientRect:z,contextElement:z.contextElement||lt()}:e,Lo={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(vr){var we=vr.state;if(et()){var Ra=U(),tn=Ra.box;["placement","reference-hidden","escaped"].forEach(function(gr){gr==="placement"?tn.setAttribute("data-placement",we.placement):we.attributes.popper["data-popper-"+gr]?tn.setAttribute("data-"+gr,""):tn.removeAttribute("data-"+gr)}),we.attributes.popper={}}}},pe=[{name:"offset",options:{offset:V}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!mt}},Lo];et()&&Nt&&pe.push({name:"arrow",options:{element:Nt,padding:3}}),pe.push.apply(pe,(O==null?void 0:O.modifiers)||[]),m.popperInstance=za(Oe,C,Object.assign({},O,{placement:_,onFirstUpdate:p,modifiers:pe}))}function zo(){m.popperInstance&&(m.popperInstance.destroy(),m.popperInstance=null)}function xa(){var b=m.props.appendTo,O,_=lt();m.props.interactive&&b===zt.appendTo||b==="parent"?O=_.parentNode:O=ua(b,[_]),O.contains(C)||O.appendChild(C),Po()}function Qr(){return Ir(C.querySelectorAll("[data-tippy-root]"))}function Bo(b){m.clearDelayTimeouts(),b&&_t("onTrigger",[m,b]),wo();var O=G(!0),_=w(),V=_[0],z=_[1];jt.isTouch&&V==="hold"&&z&&(O=z),O?n=setTimeout(function(){m.show()},O):m.show()}function mr(b){if(m.clearDelayTimeouts(),_t("onUntrigger",[m,b]),!m.state.isVisible){Xr();return}if(!(m.props.trigger.indexOf("mouseenter")>=0&&m.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(b.type)>=0&&s)){var O=G(!1);O?o=setTimeout(function(){m.state.isVisible&&m.hide()},O):i=requestAnimationFrame(function(){m.hide()})}}function Ca(){m.state.isEnabled=!0}function Oa(){m.hide(),m.state.isEnabled=!1}function wa(){clearTimeout(n),clearTimeout(o),cancelAnimationFrame(i)}function Ta(b){if(!m.state.isDestroyed){_t("onBeforeUpdate",[m,b]),_o();var O=m.props,_=Ai(e,Object.assign({},m.props,{},b,{ignoreAttributes:!0}));m.props=_,Ao(),O.interactiveDebounce!==_.interactiveDebounce&&(Yr(),h=Ci(Eo,_.interactiveDebounce)),O.triggerTarget&&!_.triggerTarget?We(O.triggerTarget).forEach(function(V){V.removeAttribute("aria-expanded")}):_.triggerTarget&&e.removeAttribute("aria-expanded"),je(),Zt(),L&&L(O,_),m.popperInstance&&(Po(),Qr().forEach(function(V){requestAnimationFrame(V._tippy.popperInstance.forceUpdate)})),_t("onAfterUpdate",[m,b])}}function Aa(b){m.setProps({content:b})}function _a(){var b=m.state.isVisible,O=m.state.isDestroyed,_=!m.state.isEnabled,V=jt.isTouch&&!m.props.touch,z=kn(m.props.duration,0,zt.duration);if(!(b||O||_||V)&&!lt().hasAttribute("disabled")&&(_t("onShow",[m],!1),m.props.onShow(m)!==!1)){if(m.state.isVisible=!0,et()&&(C.style.visibility="visible"),Zt(),wo(),m.state.isMounted||(C.style.transition="none"),et()){var mt=U(),Nt=mt.box,Oe=mt.content;Sn([Nt,Oe],0)}p=function(){var pe;if(!(!m.state.isVisible||l)){if(l=!0,C.offsetHeight,C.style.transition=m.props.moveTransition,et()&&m.props.animation){var Zr=U(),vr=Zr.box,we=Zr.content;Sn([vr,we],z),wi([vr,we],"visible")}xo(),je(),Oi(xn,m),(pe=m.popperInstance)==null||pe.forceUpdate(),m.state.isMounted=!0,_t("onMount",[m]),m.props.animation&&et()&&Ma(z,function(){m.state.isShown=!0,_t("onShown",[m])})}},xa()}}function Na(){var b=!m.state.isVisible,O=m.state.isDestroyed,_=!m.state.isEnabled,V=kn(m.props.duration,1,zt.duration);if(!(b||O||_)&&(_t("onHide",[m],!1),m.props.onHide(m)!==!1)){if(m.state.isVisible=!1,m.state.isShown=!1,l=!1,s=!1,et()&&(C.style.visibility="hidden"),Yr(),Xr(),Zt(),et()){var z=U(),mt=z.box,Nt=z.content;m.props.animation&&(Sn([mt,Nt],V),wi([mt,Nt],"hidden"))}xo(),je(),m.props.animation?et()&&Sa(V,m.unmount):m.unmount()}}function Ea(b){Ht().addEventListener("mousemove",h),Oi(kr,h),h(b)}function Da(){m.state.isVisible&&m.hide(),m.state.isMounted&&(zo(),Qr().forEach(function(b){b._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),xn=xn.filter(function(b){return b!==m}),m.state.isMounted=!1,_t("onHidden",[m]))}function Ia(){m.state.isDestroyed||(m.clearDelayTimeouts(),m.unmount(),_o(),delete e._tippy,m.state.isDestroyed=!0,_t("onDestroy",[m]))}}function He(e,t){t===void 0&&(t={});var r=zt.plugins.concat(t.plugins||[]);ud();var n=Object.assign({},t,{plugins:r}),o=id(e),i=o.reduce(function(s,a){var c=a&&Sd(a,n);return c&&s.push(c),s},[]);return Gr(e)?i[0]:i}He.defaultProps=zt;He.setDefaultProps=gd;He.currentInput=jt;Object.assign({},Pa,{effect:function(t){var r=t.state,n={popper:{position:r.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(r.elements.popper.style,n.popper),r.styles=n,r.elements.arrow&&Object.assign(r.elements.arrow.style,n.arrow)}});He.setDefaultProps({render:da});class Md{constructor({editor:t,element:r,view:n,tippyOptions:o,shouldShow:i}){this.preventHide=!1,this.shouldShow=({state:s,from:a,to:c})=>{const{doc:l,selection:u}=s,{empty:f}=u,p=!l.textBetween(a,c).length&&ia(s.selection);return!(f||p)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var a;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&(!((a=this.element.parentNode)===null||a===void 0)&&a.contains(s.relatedTarget))||this.hide()},this.editor=t,this.element=r,this.view=n,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.element.style.visibility="visible",requestAnimationFrame(()=>{this.createTooltip(o)})}createTooltip(t={}){this.tippy=He(this.editor.options.element,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...t})}update(t,r){var n;const{state:o,composing:i}=t,{doc:s,selection:a}=o,c=r&&r.doc.eq(s)&&r.selection.eq(a);if(i||c)return;const{ranges:l}=a,u=Math.min(...l.map(d=>d.$from.pos)),f=Math.max(...l.map(d=>d.$to.pos));if(!this.shouldShow({editor:this.editor,view:t,state:o,oldState:r,from:u,to:f})){this.hide();return}(n=this.tippy)===null||n===void 0||n.setProps({getReferenceClientRect:()=>{if(Gp(o.selection)){const d=t.nodeDOM(u);if(d)return d.getBoundingClientRect()}return sa(t,u,f)}}),this.show()}show(){var t;(t=this.tippy)===null||t===void 0||t.show()}hide(){var t;(t=this.tippy)===null||t===void 0||t.hide()}destroy(){var t;(t=this.tippy)===null||t===void 0||t.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const ha=e=>new Rt({key:typeof e.pluginKey=="string"?new Kt(e.pluginKey):e.pluginKey,view:t=>new Md({view:t,...e})});kt.create({name:"bubbleMenu",defaultOptions:{element:null,tippyOptions:{},pluginKey:"bubbleMenu",shouldShow:null},addProseMirrorPlugins(){return this.options.element?[ha({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});class xd{constructor({editor:t,element:r,view:n,tippyOptions:o,shouldShow:i}){this.preventHide=!1,this.shouldShow=({state:s})=>{const{selection:a}=s,{$anchor:c,empty:l}=a,u=c.depth===1,f=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent;return!(!l||!u||!f)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var a;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&(!((a=this.element.parentNode)===null||a===void 0)&&a.contains(s.relatedTarget))||this.hide()},this.editor=t,this.element=r,this.view=n,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.element.style.visibility="visible",requestAnimationFrame(()=>{this.createTooltip(o)})}createTooltip(t={}){this.tippy=He(this.editor.options.element,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...t})}update(t,r){var n;const{state:o,composing:i}=t,{doc:s,selection:a}=o,{from:c,to:l}=a,u=r&&r.doc.eq(s)&&r.selection.eq(a);if(i||u)return;if(!this.shouldShow({editor:this.editor,view:t,state:o,oldState:r})){this.hide();return}(n=this.tippy)===null||n===void 0||n.setProps({getReferenceClientRect:()=>sa(t,c,l)}),this.show()}show(){var t;(t=this.tippy)===null||t===void 0||t.show()}hide(){var t;(t=this.tippy)===null||t===void 0||t.hide()}destroy(){var t;(t=this.tippy)===null||t===void 0||t.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const ma=e=>new Rt({key:typeof e.pluginKey=="string"?new Kt(e.pluginKey):e.pluginKey,view:t=>new xd({view:t,...e})});kt.create({name:"floatingMenu",defaultOptions:{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null},addProseMirrorPlugins(){return this.options.element?[ma({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});lr({name:"BubbleMenu",props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(e,{slots:t}){const r=zr(null);return Kn(()=>{const{pluginKey:n,editor:o,tippyOptions:i,shouldShow:s}=e;o.registerPlugin(ha({pluginKey:n,editor:o,element:r.value,tippyOptions:i,shouldShow:s}))}),Br(()=>{const{pluginKey:n,editor:o}=e;o.unregisterPlugin(n)}),()=>{var n;return ve("div",{ref:r},(n=t.default)===null||n===void 0?void 0:n.call(t))}}});function Cd(e){return Ja((t,r)=>({get(){return t(),e},set(n){e=n,requestAnimationFrame(()=>{requestAnimationFrame(()=>{r()})})}}))}class Od extends Kp{constructor(t={}){return super(t),this.vueRenderers=ja(new Map),this.contentComponent=null,this.reactiveState=Cd(this.view.state),this.on("transaction",()=>{this.reactiveState.value=this.view.state}),qa(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}registerPlugin(t,r){super.registerPlugin(t,r),this.reactiveState.value=this.view.state}unregisterPlugin(t){super.unregisterPlugin(t),this.reactiveState.value=this.view.state}}const wd=lr({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(e){const t=zr(),r=Ba();return La(()=>{const n=e.editor;n&&n.options.element&&t.value&&Fa(()=>{if(!t.value||!n.options.element.firstChild)return;const o=Va(t.value);t.value.append(...n.options.element.childNodes),n.contentComponent=r.ctx._,n.setOptions({element:o}),n.createNodeViews()})}),Br(()=>{const n=e.editor;if(!n||(n.isDestroyed||n.view.setProps({nodeViews:{}}),n.contentComponent=null,!n.options.element.firstChild))return;const o=document.createElement("div");o.append(...n.options.element.childNodes),n.setOptions({element:o})}),{rootEl:t}},render(){const e=[];return this.editor&&this.editor.vueRenderers.forEach(t=>{const r=ve(Ha,{to:t.teleportElement,key:t.id},ve(t.component,{ref:t.id,...t.props}));e.push(r)}),ve("div",{ref:t=>{this.rootEl=t}},...e)}});lr({name:"FloatingMenu",props:{pluginKey:{type:[String,Object],default:"floatingMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(e,{slots:t}){const r=zr(null);return Kn(()=>{const{pluginKey:n,editor:o,tippyOptions:i,shouldShow:s}=e;o.registerPlugin(ma({pluginKey:n,editor:o,element:r.value,tippyOptions:i,shouldShow:s}))}),Br(()=>{const{pluginKey:n,editor:o}=e;o.unregisterPlugin(n)}),()=>{var n;return ve("div",{ref:r},(n=t.default)===null||n===void 0?void 0:n.call(t))}}});const Td=(e={})=>{const t=zr();return Kn(()=>{t.value=new Od(e)}),Br(()=>{var r;(r=t.value)===null||r===void 0||r.destroy()}),t};lr({props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var e,t;return ve(this.as,{class:this.decorationClasses.value,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragStart:this.onDragStart},(t=(e=this.$slots).default)===null||t===void 0?void 0:t.call(e))}});lr({props:{as:{type:String,default:"div"}},render(){return ve(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}});const Ad=/^\s*>\s$/gm,_d=Ot.create({name:"blockquote",defaultOptions:{HTMLAttributes:{}},content:"block*",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return["blockquote",Ct(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn("blockquote"),toggleBlockquote:()=>({commands:e})=>e.toggleWrap("blockquote"),unsetBlockquote:()=>({commands:e})=>e.lift("blockquote")}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[So(Ad,this.type)]}}),Nd=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/gm,Ed=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/gm,Dd=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/gm,Id=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/gm,Rd=ke.create({name:"bold",defaultOptions:{HTMLAttributes:{}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",Ct(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark("bold"),toggleBold:()=>({commands:e})=>e.toggleMark("bold"),unsetBold:()=>({commands:e})=>e.unsetMark("bold")}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ze(Nd,this.type),ze(Dd,this.type)]},addPasteRules(){return[Be(Ed,this.type),Be(Id,this.type)]}}),Pd=/^\s*([-+*])\s$/,zd=Ot.create({name:"bulletList",defaultOptions:{HTMLAttributes:{}},group:"block list",content:"listItem+",parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",Ct(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e})=>e.toggleList("bulletList","listItem")}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){return[So(Pd,this.type)]}}),Bd=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/gm,Ld=/(?:^|\s)((?:`)((?:[^`]+))(?:`))/gm,Fd=ke.create({name:"code",defaultOptions:{HTMLAttributes:{}},excludes:"_",parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",Ct(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark("code"),toggleCode:()=>({commands:e})=>e.toggleMark("code"),unsetCode:()=>({commands:e})=>e.unsetMark("code")}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ze(Bd,this.type)]},addPasteRules(){return[Be(Ld,this.type)]}}),Vd=/^```(?<language>[a-z]*)? $/,Hd=/^~~~(?<language>[a-z]*)? $/,jd=Ot.create({name:"codeBlock",defaultOptions:{languageClassPrefix:"language-",HTMLAttributes:{}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:e=>{var t;const r=(t=e.firstElementChild)===null||t===void 0?void 0:t.getAttribute("class");if(!r)return null;const n=new RegExp(`^(${this.options.languageClassPrefix})`);return{language:r.replace(n,"")}},renderHTML:e=>e.language?{class:this.options.languageClassPrefix+e.language}:null}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({HTMLAttributes:e}){return["pre",this.options.HTMLAttributes,["code",e,0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode("codeBlock",e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode("codeBlock","paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,r=t.pos===1;return!e||t.parent.type.name!==this.name?!1:r||!t.parent.textContent.length?this.editor.commands.clearNodes():!1}}},addInputRules(){return[Vn(Vd,this.type,({groups:e})=>e),Vn(Hd,this.type,({groups:e})=>e)]}}),qd=Ot.create({name:"doc",topNode:!0,content:"block+"});function Jd(e){return e===void 0&&(e={}),new Rt({view:function(r){return new Ut(r,e)}})}var Ut=function(t,r){var n=this;this.editorView=t,this.width=r.width||1,this.color=r.color||"black",this.class=r.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map(function(o){var i=function(s){return n[o](s)};return t.dom.addEventListener(o,i),{name:o,handler:i}})};Ut.prototype.destroy=function(){var t=this;this.handlers.forEach(function(r){var n=r.name,o=r.handler;return t.editorView.dom.removeEventListener(n,o)})};Ut.prototype.update=function(t,r){this.cursorPos!=null&&r.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())};Ut.prototype.setCursor=function(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())};Ut.prototype.updateOverlay=function(){var t=this.editorView.state.doc.resolve(this.cursorPos),r;if(!t.parent.inlineContent){var n=t.nodeBefore,o=t.nodeAfter;if(n||o){var i=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),s=n?i.bottom:i.top;n&&o&&(s=(s+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:i.left,right:i.right,top:s-this.width/2,bottom:s+this.width/2}}}if(!r){var a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}var c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none; background-color: "+this.color);var l,u;if(!c||c==document.body&&getComputedStyle(c).position=="static")l=-pageXOffset,u=-pageYOffset;else{var f=c.getBoundingClientRect();l=f.left-c.scrollLeft,u=f.top-c.scrollTop}this.element.style.left=r.left-l+"px",this.element.style.top=r.top-u+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"};Ut.prototype.scheduleRemoval=function(t){var r=this;clearTimeout(this.timeout),this.timeout=setTimeout(function(){return r.setCursor(null)},t)};Ut.prototype.dragover=function(t){if(this.editorView.editable){var r=this.editorView.posAtCoords({left:t.clientX,top:t.clientY});if(r){var n=r.pos;if(this.editorView.dragging&&this.editorView.dragging.slice&&(n=rs(this.editorView.state.doc,n,this.editorView.dragging.slice),n==null))return this.setCursor(null);this.setCursor(n),this.scheduleRemoval(5e3)}}};Ut.prototype.dragend=function(){this.scheduleRemoval(20)};Ut.prototype.drop=function(){this.scheduleRemoval(20)};Ut.prototype.dragleave=function(t){(t.target==this.editorView.dom||!this.editorView.dom.contains(t.relatedTarget))&&this.setCursor(null)};const Wd=kt.create({name:"dropCursor",defaultOptions:{color:"currentColor",width:1,class:null},addProseMirrorPlugins(){return[Jd(this.options)]}});var Vt=function(e){function t(r){e.call(this,r,r)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.map=function(n,o){var i=n.resolve(o.map(this.head));return t.valid(i)?new t(i):e.near(i)},t.prototype.content=function(){return x.empty},t.prototype.eq=function(n){return n instanceof t&&n.head==this.head},t.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},t.fromJSON=function(n,o){if(typeof o.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(n.resolve(o.pos))},t.prototype.getBookmark=function(){return new Rr(this.anchor)},t.valid=function(n){var o=n.parent;if(o.isTextblock||!Kd(n)||!$d(n))return!1;var i=o.type.spec.allowGapCursor;if(i!=null)return i;var s=o.contentMatchAt(n.index()).defaultType;return s&&s.isTextblock},t.findFrom=function(n,o,i){t:for(;;){if(!i&&t.valid(n))return n;for(var s=n.pos,a=null,c=n.depth;;c--){var l=n.node(c);if(o>0?n.indexAfter(c)<l.childCount:n.index(c)>0){a=l.child(o>0?n.indexAfter(c):n.index(c)-1);break}else if(c==0)return null;s+=o;var u=n.doc.resolve(s);if(t.valid(u))return u}for(;;){var f=o>0?a.firstChild:a.lastChild;if(!f){if(a.isAtom&&!a.isText&&!N.isSelectable(a)){n=n.doc.resolve(s+a.nodeSize*o),i=!1;continue t}break}a=f,s+=o;var p=n.doc.resolve(s);if(t.valid(p))return p}return null}},t}(E);Vt.prototype.visible=!1;E.jsonID("gapcursor",Vt);var Rr=function(t){this.pos=t};Rr.prototype.map=function(t){return new Rr(t.map(this.pos))};Rr.prototype.resolve=function(t){var r=t.resolve(this.pos);return Vt.valid(r)?new Vt(r):E.near(r)};function Kd(e){for(var t=e.depth;t>=0;t--){var r=e.index(t);if(r!=0)for(var n=e.node(t).child(r-1);;n=n.lastChild){if(n.childCount==0&&!n.inlineContent||n.isAtom||n.type.spec.isolating)return!0;if(n.inlineContent)return!1}}return!0}function $d(e){for(var t=e.depth;t>=0;t--){var r=e.indexAfter(t),n=e.node(t);if(r!=n.childCount)for(var o=n.child(r);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}var Ud=function(){return new Rt({props:{decorations:Xd,createSelectionBetween:function(t,r,n){if(r.pos==n.pos&&Vt.valid(n))return new Vt(n)},handleClick:Yd,handleKeyDown:Gd}})},Gd=$s({ArrowLeft:Sr("horiz",-1),ArrowRight:Sr("horiz",1),ArrowUp:Sr("vert",-1),ArrowDown:Sr("vert",1)});function Sr(e,t){var r=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(n,o,i){var s=n.selection,a=t>0?s.$to:s.$from,c=s.empty;if(s instanceof H){if(!i.endOfTextblock(r)||a.depth==0)return!1;c=!1,a=n.doc.resolve(t>0?a.after():a.before())}var l=Vt.findFrom(a,t,c);return l?(o&&o(n.tr.setSelection(new Vt(l))),!0):!1}}function Yd(e,t,r){if(!e.editable)return!1;var n=e.state.doc.resolve(t);if(!Vt.valid(n))return!1;var o=e.posAtCoords({left:r.clientX,top:r.clientY}),i=o.inside;return i>-1&&N.isSelectable(e.state.doc.nodeAt(i))?!1:(e.dispatch(e.state.tr.setSelection(new Vt(n))),!0)}function Xd(e){if(!(e.selection instanceof Vt))return null;var t=document.createElement("div");return t.className="ProseMirror-gapcursor",j.create(e.doc,[rt.widget(e.selection.head,t,{key:"gapcursor"})])}const Qd=kt.create({name:"gapCursor",addProseMirrorPlugins(){return[Ud()]},extendNodeSchema(e){var t;const r={name:e.name,options:e.options};return{allowGapCursor:(t=Z(A(e,"allowGapCursor",r)))!==null&&t!==void 0?t:null}}}),Zd=Ot.create({name:"hardBreak",defaultOptions:{HTMLAttributes:{}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",Ct(this.options.HTMLAttributes,e)]},addCommands(){return{setHardBreak:()=>({commands:e})=>e.first([()=>e.exitCode(),()=>e.insertContent({type:this.name})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),th=Ot.create({name:"heading",defaultOptions:{levels:[1,2,3,4,5,6],HTMLAttributes:{}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Ct(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode("heading",e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode("heading","paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Vn(new RegExp(`^(#{1,${e}})\\s$`),this.type,{level:e}))}});var Pr=200,it=function(){};it.prototype.append=function(t){return t.length?(t=it.from(t),!this.length&&t||t.length<Pr&&this.leafAppend(t)||this.length<Pr&&t.leafPrepend(this)||this.appendInner(t)):this};it.prototype.prepend=function(t){return t.length?it.from(t).append(this):this};it.prototype.appendInner=function(t){return new eh(this,t)};it.prototype.slice=function(t,r){return t===void 0&&(t=0),r===void 0&&(r=this.length),t>=r?it.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,r))};it.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};it.prototype.forEach=function(t,r,n){r===void 0&&(r=0),n===void 0&&(n=this.length),r<=n?this.forEachInner(t,r,n,0):this.forEachInvertedInner(t,r,n,0)};it.prototype.map=function(t,r,n){r===void 0&&(r=0),n===void 0&&(n=this.length);var o=[];return this.forEach(function(i,s){return o.push(t(i,s))},r,n),o};it.from=function(t){return t instanceof it?t:t&&t.length?new va(t):it.empty};var va=function(e){function t(n){e.call(this),this.values=n}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new t(this.values.slice(o,i))},t.prototype.getInner=function(o){return this.values[o]},t.prototype.forEachInner=function(o,i,s,a){for(var c=i;c<s;c++)if(o(this.values[c],a+c)===!1)return!1},t.prototype.forEachInvertedInner=function(o,i,s,a){for(var c=i-1;c>=s;c--)if(o(this.values[c],a+c)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=Pr)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=Pr)return new t(o.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(t.prototype,r),t}(it);it.empty=new va([]);var eh=function(e){function t(r,n){e.call(this),this.left=r,this.right=n,this.length=r.length+n.length,this.depth=Math.max(r.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},t.prototype.forEachInner=function(n,o,i,s){var a=this.left.length;if(o<a&&this.left.forEachInner(n,o,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(n,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},t.prototype.forEachInvertedInner=function(n,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(n,o-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(n,Math.min(o,a),i,s)===!1)return!1},t.prototype.sliceInner=function(n,o){if(n==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(n,o):n>=i?this.right.slice(n-i,o-i):this.left.slice(n,i).append(this.right.slice(0,o-i))},t.prototype.leafAppend=function(n){var o=this.right.leafAppend(n);if(o)return new t(this.left,o)},t.prototype.leafPrepend=function(n){var o=this.left.leafPrepend(n);if(o)return new t(o,this.right)},t.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new t(this.left,new t(this.right,n)):new t(this,n)},t}(it),ga=it,rh=500,ct=function(t,r){this.items=t,this.eventCount=r};ct.prototype.popEvent=function(t,r){var n=this;if(this.eventCount==0)return null;for(var o=this.items.length;;o--){var i=this.items.get(o-1);if(i.selection){--o;break}}var s,a;r&&(s=this.remapping(o,this.items.length),a=s.maps.length);var c=t.tr,l,u,f=[],p=[];return this.items.forEach(function(d,h){if(!d.step){s||(s=n.remapping(o,h+1),a=s.maps.length),a--,p.push(d);return}if(s){p.push(new Jt(d.map));var v=d.step.map(s.slice(a)),g;v&&c.maybeStep(v).doc&&(g=c.mapping.maps[c.mapping.maps.length-1],f.push(new Jt(g,null,null,f.length+p.length))),a--,g&&s.appendMap(g,a)}else c.maybeStep(d.step);if(d.selection)return l=s?d.selection.map(s.slice(a)):d.selection,u=new ct(n.items.slice(0,o).append(p.reverse().concat(f)),n.eventCount-1),!1},this.items.length,0),{remaining:u,transform:c,selection:l}};ct.prototype.addTransform=function(t,r,n,o){for(var i=[],s=this.eventCount,a=this.items,c=!o&&a.length?a.get(a.length-1):null,l=0;l<t.steps.length;l++){var u=t.steps[l].invert(t.docs[l]),f=new Jt(t.mapping.maps[l],u,r),p=void 0;(p=c&&c.merge(f))&&(f=p,l?i.pop():a=a.slice(0,a.length-1)),i.push(f),r&&(s++,r=null),o||(c=f)}var d=s-n.depth;return d>oh&&(a=nh(a,d),s-=d),new ct(a.append(i),s)};ct.prototype.remapping=function(t,r){var n=new pt;return this.items.forEach(function(o,i){var s=o.mirrorOffset!=null&&i-o.mirrorOffset>=t?n.maps.length-o.mirrorOffset:null;n.appendMap(o.map,s)},t,r),n};ct.prototype.addMaps=function(t){return this.eventCount==0?this:new ct(this.items.append(t.map(function(r){return new Jt(r)})),this.eventCount)};ct.prototype.rebased=function(t,r){if(!this.eventCount)return this;var n=[],o=Math.max(0,this.items.length-r),i=t.mapping,s=t.steps.length,a=this.eventCount;this.items.forEach(function(d){d.selection&&a--},o);var c=r;this.items.forEach(function(d){var h=i.getMirror(--c);if(h!=null){s=Math.min(s,h);var v=i.maps[h];if(d.step){var g=t.steps[h].invert(t.docs[h]),S=d.selection&&d.selection.map(i.slice(c+1,h));S&&a++,n.push(new Jt(v,g,S))}else n.push(new Jt(v))}},o);for(var l=[],u=r;u<s;u++)l.push(new Jt(i.maps[u]));var f=this.items.slice(0,o).append(l).append(n),p=new ct(f,a);return p.emptyItemCount()>rh&&(p=p.compress(this.items.length-n.length)),p};ct.prototype.emptyItemCount=function(){var t=0;return this.items.forEach(function(r){r.step||t++}),t};ct.prototype.compress=function(t){t===void 0&&(t=this.items.length);var r=this.remapping(0,t),n=r.maps.length,o=[],i=0;return this.items.forEach(function(s,a){if(a>=t)o.push(s),s.selection&&i++;else if(s.step){var c=s.step.map(r.slice(n)),l=c&&c.getMap();if(n--,l&&r.appendMap(l,n),c){var u=s.selection&&s.selection.map(r.slice(n));u&&i++;var f=new Jt(l.invert(),c,u),p,d=o.length-1;(p=o.length&&o[d].merge(f))?o[d]=p:o.push(f)}}else s.map&&n--},this.items.length,0),new ct(ga.from(o.reverse()),i)};ct.empty=new ct(ga.empty,0);function nh(e,t){var r;return e.forEach(function(n,o){if(n.selection&&t--==0)return r=o,!1}),e.slice(r)}var Jt=function(t,r,n,o){this.map=t,this.step=r,this.selection=n,this.mirrorOffset=o};Jt.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var r=t.step.merge(this.step);if(r)return new Jt(r.getMap().invert(),r,this.selection)}};var re=function(t,r,n,o){this.done=t,this.undone=r,this.prevRanges=n,this.prevTime=o},oh=20;function ih(e,t,r,n){var o=r.getMeta(ne),i;if(o)return o.historyState;r.getMeta(ah)&&(e=new re(e.done,e.undone,null,0));var s=r.getMeta("appendedTransaction");if(r.steps.length==0)return e;if(s&&s.getMeta(ne))return s.getMeta(ne).redo?new re(e.done.addTransform(r,null,n,xr(t)),e.undone,Ei(r.mapping.maps[r.steps.length-1]),e.prevTime):new re(e.done,e.undone.addTransform(r,null,n,xr(t)),null,e.prevTime);if(r.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){var a=e.prevTime==0||!s&&(e.prevTime<(r.time||0)-n.newGroupDelay||!sh(r,e.prevRanges)),c=s?Cn(e.prevRanges,r.mapping):Ei(r.mapping.maps[r.steps.length-1]);return new re(e.done.addTransform(r,a?t.selection.getBookmark():null,n,xr(t)),ct.empty,c,r.time)}else return(i=r.getMeta("rebased"))?new re(e.done.rebased(r,i),e.undone.rebased(r,i),Cn(e.prevRanges,r.mapping),e.prevTime):new re(e.done.addMaps(r.mapping.maps),e.undone.addMaps(r.mapping.maps),Cn(e.prevRanges,r.mapping),e.prevTime)}function sh(e,t){if(!t)return!1;if(!e.docChanged)return!0;var r=!1;return e.mapping.maps[0].forEach(function(n,o){for(var i=0;i<t.length;i+=2)n<=t[i+1]&&o>=t[i]&&(r=!0)}),r}function Ei(e){var t=[];return e.forEach(function(r,n,o,i){return t.push(o,i)}),t}function Cn(e,t){if(!e)return null;for(var r=[],n=0;n<e.length;n+=2){var o=t.map(e[n],1),i=t.map(e[n+1],-1);o<=i&&r.push(o,i)}return r}function ya(e,t,r,n){var o=xr(t),i=ne.get(t).spec.config,s=(n?e.undone:e.done).popEvent(t,o);if(s){var a=s.selection.resolve(s.transform.doc),c=(n?e.done:e.undone).addTransform(s.transform,t.selection.getBookmark(),i,o),l=new re(n?c:s.remaining,n?s.remaining:c,null,0);r(s.transform.setSelection(a).setMeta(ne,{redo:n,historyState:l}).scrollIntoView())}}var On=!1,Di=null;function xr(e){var t=e.plugins;if(Di!=t){On=!1,Di=t;for(var r=0;r<t.length;r++)if(t[r].spec.historyPreserveItems){On=!0;break}}return On}var ne=new Kt("history"),ah=new Kt("closeHistory");function ch(e){return e={depth:e&&e.depth||100,newGroupDelay:e&&e.newGroupDelay||500},new Rt({key:ne,state:{init:function(){return new re(ct.empty,ct.empty,null,0)},apply:function(r,n,o){return ih(n,o,r,e)}},config:e,props:{handleDOMEvents:{beforeinput:function(r,n){var o=n.inputType=="historyUndo"?ba(r.state,r.dispatch):n.inputType=="historyRedo"?ka(r.state,r.dispatch):!1;return o&&n.preventDefault(),o}}}})}function ba(e,t){var r=ne.getState(e);return!r||r.done.eventCount==0?!1:(t&&ya(r,e,t,!1),!0)}function ka(e,t){var r=ne.getState(e);return!r||r.undone.eventCount==0?!1:(t&&ya(r,e,t,!0),!0)}const lh=kt.create({name:"history",defaultOptions:{depth:100,newGroupDelay:500},addCommands(){return{undo:()=>({state:e,dispatch:t})=>ba(e,t),redo:()=>({state:e,dispatch:t})=>ka(e,t)}},addProseMirrorPlugins(){return[ch(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),uh=Ot.create({name:"horizontalRule",defaultOptions:{HTMLAttributes:{}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",Ct(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e})=>e().command(({tr:t,dispatch:r})=>{const{selection:n}=t,{empty:o,$anchor:i}=n,s=i.parent.isTextblock&&!i.parent.type.spec.code&&!i.parent.textContent;if(!o||!s||!r)return!0;const a=i.before();return t.deleteRange(a,a+1),!0}).insertContent({type:this.name}).command(({tr:t,dispatch:r})=>{var n;if(r){const{parent:o,pos:i}=t.selection.$from,s=i+1;if(!t.doc.nodeAt(s)){const c=(n=o.type.contentMatch.defaultType)===null||n===void 0?void 0:n.create();c&&(t.insert(s,c),t.setSelection(H.create(t.doc,s)))}t.scrollIntoView()}return!0}).run()}},addInputRules(){return[$p(/^(?:---|—-|___\s|\*\*\*\s)$/,this.type)]}}),fh=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/gm,ph=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/gm,dh=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/gm,hh=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/gm,mh=ke.create({name:"italic",defaultOptions:{HTMLAttributes:{}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",Ct(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark("italic"),toggleItalic:()=>({commands:e})=>e.toggleMark("italic"),unsetItalic:()=>({commands:e})=>e.unsetMark("italic")}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ze(fh,this.type),ze(dh,this.type)]},addPasteRules(){return[Be(ph,this.type),Be(hh,this.type)]}}),vh=Ot.create({name:"listItem",defaultOptions:{HTMLAttributes:{}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",Ct(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem("listItem"),Tab:()=>this.editor.commands.sinkListItem("listItem"),"Shift-Tab":()=>this.editor.commands.liftListItem("listItem")}}}),gh=/^(\d+)\.\s$/,yh=Ot.create({name:"orderedList",defaultOptions:{HTMLAttributes:{}},group:"block list",content:"listItem+",addAttributes(){return{start:{default:1,parseHTML:e=>({start:e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1})}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...r}=e;return t===1?["ol",Ct(this.options.HTMLAttributes,r),0]:["ol",Ct(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e})=>e.toggleList("orderedList","listItem")}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){return[So(gh,this.type,e=>({start:+e[1]}),(e,t)=>t.childCount+t.attrs.start===+e[1])]}}),bh=Ot.create({name:"paragraph",priority:1e3,defaultOptions:{HTMLAttributes:{}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",Ct(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode("paragraph")}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),kh=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/gm,Sh=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/gm,Mh=ke.create({name:"strike",defaultOptions:{HTMLAttributes:{}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",Ct(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark("strike"),toggleStrike:()=>({commands:e})=>e.toggleMark("strike"),unsetStrike:()=>({commands:e})=>e.unsetMark("strike")}},addKeyboardShortcuts(){return{"Mod-Shift-x":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ze(kh,this.type)]},addPasteRules(){return[Be(Sh,this.type)]}}),xh=Ot.create({name:"text",group:"inline"}),Ch=kt.create({name:"starterKit",addExtensions(){var e,t,r,n,o,i,s,a,c,l,u,f,p,d,h,v,g,S;const y=[];return this.options.blockquote!==!1&&y.push(_d.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bold!==!1&&y.push(Rd.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.bulletList!==!1&&y.push(zd.configure((r=this.options)===null||r===void 0?void 0:r.bulletList)),this.options.code!==!1&&y.push(Fd.configure((n=this.options)===null||n===void 0?void 0:n.code)),this.options.codeBlock!==!1&&y.push(jd.configure((o=this.options)===null||o===void 0?void 0:o.codeBlock)),this.options.document!==!1&&y.push(qd.configure((i=this.options)===null||i===void 0?void 0:i.document)),this.options.dropcursor!==!1&&y.push(Wd.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&y.push(Qd.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&y.push(Zd.configure((c=this.options)===null||c===void 0?void 0:c.hardBreak)),this.options.heading!==!1&&y.push(th.configure((l=this.options)===null||l===void 0?void 0:l.heading)),this.options.history!==!1&&y.push(lh.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&y.push(uh.configure((f=this.options)===null||f===void 0?void 0:f.horizontalRule)),this.options.italic!==!1&&y.push(mh.configure((p=this.options)===null||p===void 0?void 0:p.italic)),this.options.listItem!==!1&&y.push(vh.configure((d=this.options)===null||d===void 0?void 0:d.listItem)),this.options.orderedList!==!1&&y.push(yh.configure((h=this.options)===null||h===void 0?void 0:h.orderedList)),this.options.paragraph!==!1&&y.push(bh.configure((v=this.options)===null||v===void 0?void 0:v.paragraph)),this.options.strike!==!1&&y.push(Mh.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&y.push(xh.configure((S=this.options)===null||S===void 0?void 0:S.text)),y}}),Oh=kt.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>e.style.textAlign||this.options.defaultAlignment,renderHTML:e=>e.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${e.textAlign}`}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.every(r=>t.updateAttributes(r,{textAlign:e})):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.every(t=>e.resetAttributes(t,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),wh={},Th={viewBox:"0 0 24 24"},Ah=T("path",{d:"M17.194 10.962A6.271 6.271 0 0012.844.248H4.3a1.25 1.25 0 000 2.5h1.013a.25.25 0 01.25.25V21a.25.25 0 01-.25.25H4.3a1.25 1.25 0 100 2.5h9.963a6.742 6.742 0 002.93-12.786zm-4.35-8.214a3.762 3.762 0 010 7.523H8.313a.25.25 0 01-.25-.25V3a.25.25 0 01.25-.25zm1.42 18.5H8.313a.25.25 0 01-.25-.25v-7.977a.25.25 0 01.25-.25h5.951a4.239 4.239 0 010 8.477z"},null,-1),_h=[Ah];function Nh(e,t){return gt(),St("svg",Th,_h)}const Eh=wt(wh,[["render",Nh]]),Dh={},Ih={viewBox:"0 0 24 24"},Rh=T("path",{d:"M9.147 21.552a1.244 1.244 0 01-.895-.378L.84 13.561a2.257 2.257 0 010-3.125l7.412-7.613a1.25 1.25 0 011.791 1.744l-6.9 7.083a.5.5 0 000 .7l6.9 7.082a1.25 1.25 0 01-.9 2.122zm5.707 0a1.25 1.25 0 01-.9-2.122l6.9-7.083a.5.5 0 000-.7l-6.9-7.082a1.25 1.25 0 011.791-1.744l7.411 7.612a2.257 2.257 0 010 3.125l-7.412 7.614a1.244 1.244 0 01-.89.38zm6.514-9.373z"},null,-1),Ph=[Rh];function zh(e,t){return gt(),St("svg",Ih,Ph)}const Bh=wt(Dh,[["render",zh]]),Lh={},Fh={viewBox:"0 0 24 24"},Vh=T("path",{d:"M22.5.248h-7.637a1.25 1.25 0 000 2.5h1.086a.25.25 0 01.211.384L4.78 21.017a.5.5 0 01-.422.231H1.5a1.25 1.25 0 000 2.5h7.637a1.25 1.25 0 000-2.5H8.051a.25.25 0 01-.211-.384L19.22 2.98a.5.5 0 01.422-.232H22.5a1.25 1.25 0 000-2.5z"},null,-1),Hh=[Vh];function jh(e,t){return gt(),St("svg",Fh,Hh)}const qh=wt(Lh,[["render",jh]]),Jh={},Wh={viewBox:"0 0 24 24"},Kh=T("path",{d:"M7.75 4.5h15a1 1 0 000-2h-15a1 1 0 000 2zm15 6.5h-15a1 1 0 100 2h15a1 1 0 000-2zm0 8.5h-15a1 1 0 000 2h15a1 1 0 000-2zM2.212 17.248a2 2 0 00-1.933 1.484.75.75 0 101.45.386.5.5 0 11.483.63.75.75 0 100 1.5.5.5 0 11-.482.635.75.75 0 10-1.445.4 2 2 0 103.589-1.648.251.251 0 010-.278 2 2 0 00-1.662-3.111zm2.038-6.5a2 2 0 00-4 0 .75.75 0 001.5 0 .5.5 0 011 0 1.031 1.031 0 01-.227.645L.414 14.029A.75.75 0 001 15.248h2.5a.75.75 0 000-1.5h-.419a.249.249 0 01-.195-.406L3.7 12.33a2.544 2.544 0 00.55-1.582zM4 5.248h-.25A.25.25 0 013.5 5V1.623A1.377 1.377 0 002.125.248H1.5a.75.75 0 000 1.5h.25A.25.25 0 012 2v3a.25.25 0 01-.25.25H1.5a.75.75 0 000 1.5H4a.75.75 0 000-1.5z"},null,-1),$h=[Kh];function Uh(e,t){return gt(),St("svg",Wh,$h)}const Gh=wt(Jh,[["render",Uh]]),Yh={},Xh={viewBox:"0 0 24 24"},Qh=Wa('<circle cx="2.5" cy="3.998" r="2.5"></circle><path d="M8.5 5H23a1 1 0 000-2H8.5a1 1 0 000 2z"></path><circle cx="2.5" cy="11.998" r="2.5"></circle><path d="M23 11H8.5a1 1 0 000 2H23a1 1 0 000-2z"></path><circle cx="2.5" cy="19.998" r="2.5"></circle><path d="M23 19H8.5a1 1 0 000 2H23a1 1 0 000-2z"></path>',6),Zh=[Qh];function tm(e,t){return gt(),St("svg",Xh,Zh)}const em=wt(Yh,[["render",tm]]),rm={},nm={viewBox:"0 0 24 24"},om=T("path",{d:"M22.5.248H7.228a6.977 6.977 0 100 13.954h2.318a.25.25 0 01.25.25V22.5a1.25 1.25 0 002.5 0V3a.25.25 0 01.25-.25h3.682a.25.25 0 01.25.25v19.5a1.25 1.25 0 002.5 0V3a.249.249 0 01.25-.25H22.5a1.25 1.25 0 000-2.5zM9.8 11.452a.25.25 0 01-.25.25H7.228a4.477 4.477 0 110-8.954h2.318A.25.25 0 019.8 3z"},null,-1),im=[om];function sm(e,t){return gt(),St("svg",nm,im)}const am=wt(rm,[["render",sm]]),cm={},lm={viewBox:"0 0 24 24"},um=T("path",{d:"M18.559 3.932a4.942 4.942 0 100 9.883 4.609 4.609 0 001.115-.141.25.25 0 01.276.368 6.83 6.83 0 01-5.878 3.523 1.25 1.25 0 000 2.5 9.71 9.71 0 009.428-9.95V8.873a4.947 4.947 0 00-4.941-4.941zm-12.323 0a4.942 4.942 0 000 9.883 4.6 4.6 0 001.115-.141.25.25 0 01.277.368 6.83 6.83 0 01-5.878 3.523 1.25 1.25 0 000 2.5 9.711 9.711 0 009.428-9.95V8.873a4.947 4.947 0 00-4.942-4.941z"},null,-1),fm=[um];function pm(e,t){return gt(),St("svg",lm,fm)}const dm=wt(cm,[["render",pm]]),hm={},mm={viewBox:"0 0 24 24"},vm=T("path",{d:"M23.75 12.952A1.25 1.25 0 0022.5 11.7h-8.936a.492.492 0 01-.282-.09c-.722-.513-1.482-.981-2.218-1.432-2.8-1.715-4.5-2.9-4.5-4.863 0-2.235 2.207-2.569 3.523-2.569a4.54 4.54 0 013.081.764 2.662 2.662 0 01.447 1.99v.3a1.25 1.25 0 102.5 0v-.268a4.887 4.887 0 00-1.165-3.777C13.949.741 12.359.248 10.091.248c-3.658 0-6.023 1.989-6.023 5.069 0 2.773 1.892 4.512 4 5.927a.25.25 0 01-.139.458H1.5a1.25 1.25 0 000 2.5h10.977a.251.251 0 01.159.058 4.339 4.339 0 011.932 3.466c0 3.268-3.426 3.522-4.477 3.522-1.814 0-3.139-.405-3.834-1.173a3.394 3.394 0 01-.65-2.7 1.25 1.25 0 00-2.488-.246A5.76 5.76 0 004.4 21.753c1.2 1.324 3.114 2 5.688 2 4.174 0 6.977-2.42 6.977-6.022a6.059 6.059 0 00-.849-3.147.25.25 0 01.216-.377H22.5a1.25 1.25 0 001.25-1.255z"},null,-1),gm=[vm];function ym(e,t){return gt(),St("svg",mm,gm)}const bm=wt(hm,[["render",ym]]),km={},Sm={viewBox:"0 0 24 24"},Mm=T("path",{d:"M17.786 3.77a12.542 12.542 0 00-12.965-.865.249.249 0 01-.292-.045L1.937.269A.507.507 0 001.392.16a.5.5 0 00-.308.462v6.7a.5.5 0 00.5.5h6.7a.5.5 0 00.354-.854L6.783 5.115a.253.253 0 01-.068-.228.249.249 0 01.152-.181 10 10 0 019.466 1.1 9.759 9.759 0 01.094 15.809 1.25 1.25 0 001.473 2.016 12.122 12.122 0 005.013-9.961 12.125 12.125 0 00-5.127-9.9z"},null,-1),xm=[Mm];function Cm(e,t){return gt(),St("svg",Sm,xm)}const Om=wt(km,[["render",Cm]]),wm={},Tm={viewBox:"0 0 24 24"},Am=T("path",{d:"M22.608.161a.5.5 0 00-.545.108L19.472 2.86a.25.25 0 01-.292.045 12.537 12.537 0 00-12.966.865A12.259 12.259 0 006.1 23.632a1.25 1.25 0 001.476-2.018 9.759 9.759 0 01.091-15.809 10 10 0 019.466-1.1.25.25 0 01.084.409l-1.85 1.85a.5.5 0 00.354.853h6.7a.5.5 0 00.5-.5V.623a.5.5 0 00-.313-.462z"},null,-1),_m=[Am];function Nm(e,t){return gt(),St("svg",Tm,_m)}const Em=wt(wm,[["render",Nm]]),Dm={},Im={viewBox:"0 0 24 24"},Rm=T("path",{d:"M9.147 21.552a1.244 1.244 0 01-.895-.378L.84 13.561a2.257 2.257 0 010-3.125l7.412-7.613a1.25 1.25 0 011.791 1.744l-6.9 7.083a.5.5 0 000 .7l6.9 7.082a1.25 1.25 0 01-.9 2.122zm5.707 0a1.25 1.25 0 01-.9-2.122l6.9-7.083a.5.5 0 000-.7l-6.9-7.082a1.25 1.25 0 011.791-1.744l7.411 7.612a2.257 2.257 0 010 3.125l-7.412 7.614a1.244 1.244 0 01-.89.38zm6.514-9.373z"},null,-1),Pm=[Rm];function zm(e,t){return gt(),St("svg",Im,Pm)}const Bm=wt(Dm,[["render",zm]]),Lm={},Fm={viewBox:"0 0 24 24"},Vm=T("path",{fill:"currentColor","fill-rule":"evenodd",d:"M3.75 5.25h16.5a.75.75 0 1 1 0 1.5H3.75a.75.75 0 0 1 0-1.5zm4 4h8.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5zm-4 4h16.5a.75.75 0 1 1 0 1.5H3.75a.75.75 0 1 1 0-1.5zm4 4h8.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5z"},null,-1),Hm=[Vm];function jm(e,t){return gt(),St("svg",Fm,Hm)}const qm=wt(Lm,[["render",jm]]),Jm={components:{EditorContent:wd,BoldIcon:Eh,CodingIcon:Bh,ItalicIcon:qh,ListIcon:Gh,ListUlIcon:em,ParagraphIcon:am,QuoteIcon:dm,StrikethroughIcon:bm,UndoIcon:Om,RedoIcon:Em,CodeBlockIcon:Bm,DotsVerticalIcon:Ka,MenuCenterIcon:qm,MenuAlt2Icon:$a,MenuAlt3Icon:Ua,MenuIcon:Ga},props:{modelValue:{type:String,default:""},contentLoading:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e,{emit:t}){const r=Td({content:e.modelValue,extensions:[Ch,Oh.configure({types:["heading","paragraph"],alignments:["left","right","center","justify"]})],onUpdate:()=>{t("update:modelValue",r.value.getHTML())}});return Ya(()=>e.modelValue,n=>{r.value.getHTML()!==n&&r.value.commands.setContent(e.modelValue,!1)}),Xa(()=>{setTimeout(()=>{r.value.destroy()},500)}),{editor:r}}},Wm={key:1,class:"box-border w-full text-sm leading-8 text-left bg-white border border-gray-200 rounded-md min-h-[200px] overflow-hidden"},Km={key:0,class:"editor-content"},$m={class:"flex justify-end p-2 border-b border-gray-200 md:hidden"},Um={class:"flex items-center justify-center w-6 h-6 ml-2 text-sm text-black bg-white rounded-sm md:h-9 md:w-9"},Gm={class:"flex flex-wrap space-x-1"},Ym={class:"hidden p-2 border-b border-gray-200 md:flex"},Xm={class:"flex flex-wrap space-x-1"};function Qm(e,t,r,n,o,i){const s=X("BaseContentPlaceholdersBox"),a=X("BaseContentPlaceholders"),c=X("dots-vertical-icon"),l=X("bold-icon"),u=X("italic-icon"),f=X("strikethrough-icon"),p=X("coding-icon"),d=X("paragraph-icon"),h=X("list-ul-icon"),v=X("list-icon"),g=X("quote-icon"),S=X("code-block-icon"),y=X("undo-icon"),I=X("redo-icon"),m=X("BaseDropdown"),D=X("menu-alt2-icon"),C=X("menu-alt3-icon"),L=X("menu-icon"),q=X("menu-center-icon"),$=X("editor-content");return r.contentLoading?(gt(),Qa(a,{key:0},{default:en(()=>[F(s,{rounded:!0,class:"w-full",style:{height:"200px"}})]),_:1})):(gt(),St("div",Wm,[n.editor?(gt(),St("div",Km,[T("div",$m,[F(m,{"width-class":"w-48"},{activator:en(()=>[T("div",Um,[F(c,{class:"w-6 h-6 text-gray-600"})])]),default:en(()=>[T("div",Gm,[T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("bold")}]),onClick:t[0]||(t[0]=w=>n.editor.chain().focus().toggleBold().run())},[F(l,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("italic")}]),onClick:t[1]||(t[1]=w=>n.editor.chain().focus().toggleItalic().run())},[F(u,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("strike")}]),onClick:t[2]||(t[2]=w=>n.editor.chain().focus().toggleStrike().run())},[F(f,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("code")}]),onClick:t[3]||(t[3]=w=>n.editor.chain().focus().toggleCode().run())},[F(p,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("paragraph")}]),onClick:t[4]||(t[4]=w=>n.editor.chain().focus().setParagraph().run())},[F(d,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("heading",{level:1})}]),onClick:t[5]||(t[5]=w=>n.editor.chain().focus().toggleHeading({level:1}).run())}," H1 ",2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("heading",{level:2})}]),onClick:t[6]||(t[6]=w=>n.editor.chain().focus().toggleHeading({level:2}).run())}," H2 ",2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("heading",{level:3})}]),onClick:t[7]||(t[7]=w=>n.editor.chain().focus().toggleHeading({level:3}).run())}," H3 ",2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("bulletList")}]),onClick:t[8]||(t[8]=w=>n.editor.chain().focus().toggleBulletList().run())},[F(h,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("orderedList")}]),onClick:t[9]||(t[9]=w=>n.editor.chain().focus().toggleOrderedList().run())},[F(v,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("blockquote")}]),onClick:t[10]||(t[10]=w=>n.editor.chain().focus().toggleBlockquote().run())},[F(g,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("codeBlock")}]),onClick:t[11]||(t[11]=w=>n.editor.chain().focus().toggleCodeBlock().run())},[F(S,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("undo")}]),onClick:t[12]||(t[12]=w=>n.editor.chain().focus().undo().run())},[F(y,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("redo")}]),onClick:t[13]||(t[13]=w=>n.editor.chain().focus().redo().run())},[F(I,{class:"h-3 cursor-pointer fill-current"})],2)])]),_:1})]),T("div",Ym,[T("div",Xm,[T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("bold")}]),onClick:t[14]||(t[14]=w=>n.editor.chain().focus().toggleBold().run())},[F(l,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("italic")}]),onClick:t[15]||(t[15]=w=>n.editor.chain().focus().toggleItalic().run())},[F(u,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("strike")}]),onClick:t[16]||(t[16]=w=>n.editor.chain().focus().toggleStrike().run())},[F(f,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("code")}]),onClick:t[17]||(t[17]=w=>n.editor.chain().focus().toggleCode().run())},[F(p,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("paragraph")}]),onClick:t[18]||(t[18]=w=>n.editor.chain().focus().setParagraph().run())},[F(d,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("heading",{level:1})}]),onClick:t[19]||(t[19]=w=>n.editor.chain().focus().toggleHeading({level:1}).run())}," H1 ",2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("heading",{level:2})}]),onClick:t[20]||(t[20]=w=>n.editor.chain().focus().toggleHeading({level:2}).run())}," H2 ",2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("heading",{level:3})}]),onClick:t[21]||(t[21]=w=>n.editor.chain().focus().toggleHeading({level:3}).run())}," H3 ",2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("bulletList")}]),onClick:t[22]||(t[22]=w=>n.editor.chain().focus().toggleBulletList().run())},[F(h,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("orderedList")}]),onClick:t[23]||(t[23]=w=>n.editor.chain().focus().toggleOrderedList().run())},[F(v,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("blockquote")}]),onClick:t[24]||(t[24]=w=>n.editor.chain().focus().toggleBlockquote().run())},[F(g,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("codeBlock")}]),onClick:t[25]||(t[25]=w=>n.editor.chain().focus().toggleCodeBlock().run())},[F(S,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("undo")}]),onClick:t[26]||(t[26]=w=>n.editor.chain().focus().undo().run())},[F(y,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("redo")}]),onClick:t[27]||(t[27]=w=>n.editor.chain().focus().redo().run())},[F(I,{class:"h-3 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive({textAlign:"left"})}]),onClick:t[28]||(t[28]=w=>n.editor.chain().focus().setTextAlign("left").run())},[F(D,{class:"h-5 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive({textAlign:"right"})}]),onClick:t[29]||(t[29]=w=>n.editor.chain().focus().setTextAlign("right").run())},[F(C,{class:"h-5 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive({textAlign:"justify"})}]),onClick:t[30]||(t[30]=w=>n.editor.chain().focus().setTextAlign("justify").run())},[F(L,{class:"h-5 cursor-pointer fill-current"})],2),T("span",{class:B(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive({textAlign:"center"})}]),onClick:t[31]||(t[31]=w=>n.editor.chain().focus().setTextAlign("center").run())},[F(q,{class:"h-5 cursor-pointer fill-current"})],2)])]),F($,{editor:n.editor,class:"box-border relative w-full text-sm leading-8 text-left editor__content"},null,8,["editor"])])):Za("",!0)]))}const ev=wt(Jm,[["render",Qm]]);export{ev as default};
|