mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
74 lines
292 KiB
JavaScript
74 lines
292 KiB
JavaScript
var nc=Object.defineProperty,oc=Object.defineProperties;var ic=Object.getOwnPropertyDescriptors;var Mr=Object.getOwnPropertySymbols;var Ko=Object.prototype.hasOwnProperty,$o=Object.prototype.propertyIsEnumerable;var Uo=(e,t,r)=>t in e?nc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,S=(e,t)=>{for(var r in t||(t={}))Ko.call(t,r)&&Uo(e,r,t[r]);if(Mr)for(var r of Mr(t))$o.call(t,r)&&Uo(e,r,t[r]);return e},wt=(e,t)=>oc(e,ic(t));var Go=(e,t)=>{var r={};for(var n in e)Ko.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Mr)for(var n of Mr(e))t.indexOf(n)<0&&$o.call(e,n)&&(r[n]=e[n]);return r};import{bf as sc,a8 as ac,bg as $e,B as Cr,D as sn,b1 as xr,E as ye,bh as cc,a7 as lc,be as uc,u as fc,al as pc,a0 as dc,bi as hc,bj as mc,o as kt,e as Tt,h as _,ai as vc,bk as gc,C as yc,aS as bc,r as ut,l as kc,w as an,f as q,m as V,j as Sc}from"./vendor.01d0adc5.js";import{_ as Dt}from"./main.07a42384.js";function ft(e){this.content=e}ft.prototype={constructor:ft,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 ft(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 ft(r)},addToStart:function(e,t){return new ft([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var r=this.remove(e).content.slice();return r.push(e,t),new ft(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 ft(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=ft.from(e),e.size?new ft(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=ft.from(e),e.size?new ft(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=ft.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}};ft.from=function(e){if(e instanceof ft)return e;var t=[];if(e)for(var r in e)t.push(r,e[r]);return new ft(t)};var Yo=ft;function Xo(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=Xo(o.content,i.content,r+1);if(a!=null)return a}r+=o.nodeSize}}function Qo(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=Qo(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},Or={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};Or.firstChild.get=function(){return this.content.length?this.content[0]:null};Or.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null};Or.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),Xo(this,t,r)};k.prototype.findDiffEnd=function(t,r,n){return r===void 0&&(r=this.size),n===void 0&&(n=t.size),Qo(this,t,r,n)};k.prototype.findIndex=function(t,r){if(r===void 0&&(r=-1),t==0)return wr(0,t);if(t==this.size)return wr(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?wr(n+1,s):wr(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,Or);var cn={index:0,offset:0};function wr(e,t){return cn.index=e,cn.offset=t,cn}k.empty=new k([],0);function Tr(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(!Tr(e[n],t[n]))return!1}else{for(var o in e)if(!(o in t)||!Tr(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&&Tr(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 Jt(e){var t=Error.call(this,e);return t.__proto__=Jt.prototype,t}Jt.prototype=Object.create(Error.prototype);Jt.prototype.constructor=Jt;Jt.prototype.name="ReplaceError";var O=function(t,r,n){this.content=t,this.openStart=r,this.openEnd=n},Zo={size:{configurable:!0}};Zo.size.get=function(){return this.content.size-this.openStart-this.openEnd};O.prototype.insertAt=function(t,r){var n=ei(this.content,t+this.openStart,r,null);return n&&new O(n,this.openStart,this.openEnd)};O.prototype.removeBetween=function(t,r){return new O(ti(this.content,t+this.openStart,r+this.openStart),this.openStart,this.openEnd)};O.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd};O.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"};O.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};O.fromJSON=function(t,r){if(!r)return O.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 O(k.fromJSON(t,r.content),n,o)};O.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 O(t,n,o)};Object.defineProperties(O.prototype,Zo);function ti(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(ti(s.content,t-i-1,r-i-1)))}function ei(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=ei(a.content,t-s-1,r);return c&&e.replaceChild(i,a.copy(c))}O.empty=new O(k.empty,0,0);function Mc(e,t,r){if(r.openStart>e.depth)throw new Jt("Inserted content deeper than insertion position");if(e.depth-r.openStart!=t.depth-r.openEnd)throw new Jt("Inconsistent open depths");return ri(e,t,r,0)}function ri(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=ri(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 ke(a,c.cut(0,e.parentOffset).append(r.content).append(c.cut(t.parentOffset)))}else{var l=Cc(r,e),u=l.start,f=l.end;return ke(i,oi(e,u,f,t,n))}else return ke(i,Ar(e,t,n))}function ni(e,t){if(!t.type.compatibleContent(e.type))throw new Jt("Cannot join "+t.type.name+" onto "+e.type.name)}function ln(e,t,r){var n=e.node(r);return ni(n,t.node(r)),n}function be(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 Ue(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&&(be(e.nodeAfter,n),i++));for(var a=i;a<s;a++)be(o.child(a),n);t&&t.depth==r&&t.textOffset&&be(t.nodeBefore,n)}function ke(e,t){if(!e.type.validContent(t))throw new Jt("Invalid content for node "+e.type.name);return e.copy(t)}function oi(e,t,r,n,o){var i=e.depth>o&&ln(e,t,o+1),s=n.depth>o&&ln(r,n,o+1),a=[];return Ue(null,e,o,a),i&&s&&t.index(o)==r.index(o)?(ni(i,s),be(ke(i,oi(e,t,r,n,o+1)),a)):(i&&be(ke(i,Ar(e,t,o+1)),a),Ue(t,r,o,a),s&&be(ke(s,Ar(r,n,o+1)),a)),Ue(n,null,o,a),new k(a)}function Ar(e,t,r){var n=[];if(Ue(null,e,r,n),e.depth>r){var o=ln(e,t,r+1);be(ke(o,Ar(e,t,r+1)),n)}return Ue(t,null,r,n),new k(n)}function Cc(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},De={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};De.parent.get=function(){return this.node(this.depth)};De.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};De.textOffset.get=function(){return this.pos-this.path[this.path.length-1]};De.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};De.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 Ge(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<un.length;n++){var o=un[n];if(o.pos==r&&o.doc==t)return o}var i=un[fn]=K.resolve(t,r);return fn=(fn+1)%xc,i};Object.defineProperties(K.prototype,De);var un=[],fn=0,xc=12,Ge=function(t,r,n){this.$from=t,this.$to=r,this.depth=n},Ie={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};Ie.start.get=function(){return this.$from.before(this.depth+1)};Ie.end.get=function(){return this.$to.after(this.depth+1)};Ie.parent.get=function(){return this.$from.node(this.depth)};Ie.startIndex.get=function(){return this.$from.index(this.depth)};Ie.endIndex.get=function(){return this.$to.indexAfter(this.depth)};Object.defineProperties(Ge.prototype,Ie);var Oc=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},At={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}};At.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size};At.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)};At.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)};At.firstChild.get=function(){return this.content.firstChild};At.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&&Tr(this.attrs,r||t.defaultAttrs||Oc)&&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 O.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 O(l,o.depth-s,i.depth-s)};P.prototype.replace=function(t,r,n){return Mc(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};At.isBlock.get=function(){return this.type.isBlock};At.isTextblock.get=function(){return this.type.isTextblock};At.inlineContent.get=function(){return this.type.inlineContent};At.isInline.get=function(){return this.type.isInline};At.isText.get=function(){return this.type.isText};At.isLeaf.get=function(){return this.type.isLeaf};At.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()+")"),ii(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,At);var wc=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):ii(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 ii(e,t){for(var r=e.length-1;r>=0;r--)t=e[r].type.name+"("+t+")";return t}var pt=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},_r={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};pt.parse=function(t,r){var n=new Nr(t,r);if(n.next==null)return pt.empty;var o=ai(n);n.next&&n.err("Unexpected trailing text");var i=Ic(Dc(o));return Rc(i,n),i};pt.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};pt.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};_r.inlineContent.get=function(){var e=this.next[0];return e?e.isInline:!1};_r.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}};pt.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};pt.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,[])};pt.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};pt.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)}}};_r.edgeCount.get=function(){return this.next.length>>1};pt.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]}};pt.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(pt.prototype,_r);pt.empty=new pt(!0);var Nr=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()},si={next:{configurable:!0}};si.next.get=function(){return this.tokens[this.pos]};Nr.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)};Nr.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")};Object.defineProperties(Nr.prototype,si);function ai(e){var t=[];do t.push(Tc(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function Tc(e){var t=[];do t.push(Ac(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function Ac(e){for(var t=Ec(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=_c(e,t);else break;return t}function ci(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");var t=Number(e.next);return e.pos++,t}function _c(e,t){var r=ci(e),n=r;return e.eat(",")&&(e.next!="}"?n=ci(e):n=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:t}}function Nc(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 Ec(e){if(e.eat("(")){var t=ai(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=Nc(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 Dc(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(M,y){return M.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 li(e,t){return t-e}function ui(e,t){var r=[];return n(t),r.sort(li);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 Ic(e){var t=Object.create(null);return r(ui(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];ui(e,f).forEach(function(h){d||o.push(u,d=[]),d.indexOf(h)==-1&&d.push(h)})}})});for(var i=t[n.join(",")]=new pt(n.indexOf(e.length-1)>-1),s=0;s<o.length;s+=2){var a=o[s+1].sort(li);i.next.push(o[s],t[a.join(",")]||r(a))}return i}}function Rc(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 fi(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 pi(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 di(e){var t=Object.create(null);if(e)for(var r in e)t[r]=new hi(e[r]);return t}var gt=function(t,r,n){this.name=t,this.schema=r,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=di(n.attrs),this.defaultAttrs=fi(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||t=="text"),this.isText=t=="text"},Ye={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};Ye.isInline.get=function(){return!this.isBlock};Ye.isTextblock.get=function(){return this.isBlock&&this.inlineContent};Ye.isLeaf.get=function(){return this.contentMatch==pt.empty};Ye.isAtom.get=function(){return this.isLeaf||this.spec.atom};gt.prototype.hasRequiredAttrs=function(){for(var t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1};gt.prototype.compatibleContent=function(t){return this==t||this.contentMatch.compatible(t.contentMatch)};gt.prototype.computeAttrs=function(t){return!t&&this.defaultAttrs?this.defaultAttrs:pi(this.attrs,t)};gt.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))};gt.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))};gt.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};gt.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};gt.prototype.allowsMarkType=function(t){return this.markSet==null||this.markSet.indexOf(t)>-1};gt.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};gt.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};gt.compile=function(t,r){var n=Object.create(null);t.forEach(function(s,a){return n[s]=new gt(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(gt.prototype,Ye);var hi=function(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default},mi={isRequired:{configurable:!0}};mi.isRequired.get=function(){return!this.hasDefault};Object.defineProperties(hi.prototype,mi);var ie=function(t,r,n,o){this.name=t,this.schema=n,this.spec=o,this.attrs=di(o.attrs),this.rank=r,this.excluded=null;var i=fi(this.attrs);this.instance=i&&new R(this,i)};ie.prototype.create=function(t){return!t&&this.instance?this.instance:new R(this,pi(this.attrs,t))};ie.compile=function(t,r){var n=Object.create(null),o=0;return t.forEach(function(i,s){return n[i]=new ie(i,o++,r,s)}),n};ie.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};ie.prototype.isInSet=function(t){for(var r=0;r<t.length;r++)if(t[r].type==this)return t[r]};ie.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=Yo.from(t.nodes),this.spec.marks=Yo.from(t.marks),this.nodes=gt.compile(this.spec.nodes,this),this.marks=ie.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]=pt.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet=a=="_"?null:a?vi(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==""?[]:vi(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 gt){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 wc(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 vi(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 Lt=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)})};Lt.prototype.parse=function(t,r){r===void 0&&(r={});var n=new J(this,r,!1);return n.addAll(t,null,r.from,r.to),n.finish()};Lt.prototype.parseSlice=function(t,r){r===void 0&&(r={});var n=new J(this,r,!0);return n.addAll(t,null,r.from,r.to),O.maxOpen(n.finish())};Lt.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(zc(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}}};Lt.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}}};Lt.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=bi(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=bi(u)),u.node=a})};for(var a in t.nodes)s();return r};Lt.fromSchema=function(t){return t.cached.domParser||(t.cached.domParser=new Lt(t,Lt.schemaRules(t)))};var pn={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},Pc={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},gi={ol:!0,ul:!0},dn=1,hn=2,Xe=4;function yi(e){return(e?dn:0)|(e==="full"?hn:0)}var Zt=function(t,r,n,o,i,s,a){this.type=t,this.attrs=r,this.solid=i,this.match=s||(a&Xe?null:t.contentMatch),this.options=a,this.content=[],this.marks=n,this.activeMarks=R.none,this.pendingMarks=o,this.stashMarks=[]};Zt.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)};Zt.prototype.finish=function(t){if(!(this.options&dn)){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};Zt.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]};Zt.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):Fc(o.type,t))&&!o.isInSet(this.activeMarks)&&(this.activeMarks=o.addToSet(this.activeMarks),this.pendingMarks=o.removeFromSet(this.pendingMarks))}};Zt.prototype.inlineContext=function(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!pn.hasOwnProperty(t.parentNode.nodeName.toLowerCase())};var J=function(t,r,n){this.parser=t,this.options=r,this.isOpen=n;var o=r.topNode,i,s=yi(r.preserveWhitespace)|(n?Xe:0);o?i=new Zt(o.type,o.attrs,R.none,R.none,!0,r.topMatch||o.type.contentMatch,s):n?i=new Zt(null,null,R.none,R.none,!0,null,s):i=new Zt(t.schema.topNodeType,null,R.none,R.none,!0,null,s),this.nodes=[i],this.open=0,this.find=r.findPositions,this.needsBlock=!1},mn={top:{configurable:!0},currentPos:{configurable:!0}};mn.top.get=function(){return this.nodes[this.open]};J.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(Lc(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)}};J.prototype.addTextNode=function(t){var r=t.nodeValue,n=this.top;if(n.options&hn||n.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(n.options&dn)n.options&hn?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)};J.prototype.addElement=function(t,r){var n=t.nodeName.toLowerCase(),o;gi.hasOwnProperty(n)&&this.parser.normalizeLists&&Bc(t);var i=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(o=this.parser.matchTag(t,this,r));if(i?i.ignore:Pc.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(pn.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)};J.prototype.leafFallback=function(t){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
|
|
`))};J.prototype.ignoreFallback=function(t){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))};J.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};J.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)};J.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&&pn.hasOwnProperty(s.nodeName.toLowerCase())&&this.sync(r);this.findAtPoint(t,i)};J.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};J.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};J.prototype.enter=function(t,r,n){var o=this.findPlace(t.create(r));return o&&this.enterInner(t,r,!0,n),o};J.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&~Xe:yi(o);i.options&Xe&&i.content.length==0&&(s|=Xe),this.nodes.push(new Zt(t,r,i.activeMarks,i.pendingMarks,n,null,s)),this.open++};J.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}};J.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)};J.prototype.sync=function(t){for(var r=this.open;r>=0;r--)if(this.nodes[r]==t){this.open=r;return}};mn.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};J.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)};J.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)};J.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)}}};J.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))};J.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)};J.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}};J.prototype.addPendingMark=function(t){var r=Vc(t,this.top.pendingMarks);r&&this.top.stashMarks.push(r),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)};J.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(J.prototype,mn);function Bc(e){for(var t=e.firstChild,r=null;t;t=t.nextSibling){var n=t.nodeType==1?t.nodeName.toLowerCase():null;n&&gi.hasOwnProperty(n)&&r?(r.appendChild(t),t=r):n=="li"?r=t:n&&(r=null)}}function zc(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Lc(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 bi(e){var t={};for(var r in e)t[r]=e[r];return t}function Fc(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 Vc(e,t){for(var r=0;r<t.length;r++)if(e.eq(t[r]))return t[r]}var nt=function(t,r){this.nodes=t||{},this.marks=r||{}};nt.prototype.serializeFragment=function(t,r,n){var o=this;r===void 0&&(r={}),n||(n=vn(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};nt.prototype.serializeNodeInner=function(t,r){r===void 0&&(r={});var n=nt.renderSpec(vn(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};nt.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};nt.prototype.serializeMark=function(t,r,n){n===void 0&&(n={});var o=this.marks[t.type.name];return o&&nt.renderSpec(vn(n),o(t,r))};nt.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=nt.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}};nt.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new nt(this.nodesFromSchema(t),this.marksFromSchema(t)))};nt.nodesFromSchema=function(t){var r=ki(t.nodes);return r.text||(r.text=function(n){return n.text}),r};nt.marksFromSchema=function(t){return ki(t.marks)};function ki(e){var t={};for(var r in e){var n=e[r].spec.toDOM;n&&(t[r]=n)}return t}function vn(e){return e.document||window.document}var Si=65535,Mi=Math.pow(2,16);function Hc(e,t){return e+t*Mi}function Ci(e){return e&Si}function jc(e){return(e-(e&Si))/Mi}var gn=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=Ci(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+jc(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:Hc(a/3,t-c);return new gn(d,r<0?t!=c:t!=f,h)}o+=u-l}return n?t+o:new gn(t+o)};ot.prototype.touches=function(t,r){for(var n=0,o=Ci(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 dt=function(t,r,n,o){this.maps=t||[],this.from=n||0,this.to=o==null?this.maps.length:o,this.mirror=r};dt.prototype.slice=function(t,r){return t===void 0&&(t=0),r===void 0&&(r=this.maps.length),new dt(this.maps,this.mirror,t,r)};dt.prototype.copy=function(){return new dt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)};dt.prototype.appendMap=function(t,r){this.to=this.maps.push(t),r!=null&&this.setMirror(this.maps.length-1,r)};dt.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)}};dt.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)]}};dt.prototype.setMirror=function(t,r){this.mirror||(this.mirror=[]),this.mirror.push(t,r)};dt.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)}};dt.prototype.invert=function(){var t=new dt;return t.appendMappingInverted(this),t};dt.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};dt.prototype.mapResult=function(t,r){return r===void 0&&(r=1),this._map(t,r,!1)};dt.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 gn(t,o)};function Re(e){var t=Error.call(this,e);return t.__proto__=Re.prototype,t}Re.prototype=Object.create(Error.prototype);Re.prototype.constructor=Re;Re.prototype.name="TransformError";var X=function(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new dt},yn={before:{configurable:!0},docChanged:{configurable:!0}};yn.before.get=function(){return this.docs.length?this.docs[0]:this.doc};X.prototype.step=function(t){var r=this.maybeStep(t);if(r.failed)throw new Re(r.failed);return this};X.prototype.maybeStep=function(t){var r=t.apply(this.doc);return r.failed||this.addStep(t,r.doc),r};yn.docChanged.get=function(){return this.steps.length>0};X.prototype.addStep=function(t,r){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=r};Object.defineProperties(X.prototype,yn);function Er(){throw new Error("Override me")}var bn=Object.create(null),ht=function(){};ht.prototype.apply=function(t){return Er()};ht.prototype.getMap=function(){return ot.empty};ht.prototype.invert=function(t){return Er()};ht.prototype.map=function(t){return Er()};ht.prototype.merge=function(t){return null};ht.prototype.toJSON=function(){return Er()};ht.fromJSON=function(t,r){if(!r||!r.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=bn[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 bn)throw new RangeError("Duplicate use of step JSON ID "+t);return bn[t]=r,r.prototype.jsonID=t,r};var yt=function(t,r){this.doc=t,this.failed=r};yt.ok=function(t){return new yt(t,null)};yt.fail=function(t){return new yt(null,t)};yt.fromReplace=function(t,r,n,o){try{return yt.ok(t.replace(r,n,o))}catch(i){if(i instanceof Jt)return yt.fail(i.message);throw i}};var te=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&&kn(n,this.from,this.to)?yt.fail("Structure replace would overwrite content"):yt.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?O.empty:new O(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?O.empty:new O(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,O.fromJSON(n,o.slice),!!o.structure)},t}(ht);ht.jsonID("replace",te);var St=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&&(kn(n,this.from,this.gapFrom)||kn(n,this.gapTo,this.to)))return yt.fail("Structure gap-replace would overwrite content");var o=n.slice(this.gapFrom,this.gapTo);if(o.openStart||o.openEnd)return yt.fail("Gap is not a flat range");var i=this.slice.insertAt(this.insert,o.content);return i?yt.fromReplace(n,this.from,this.to,i):yt.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,O.fromJSON(n,o.slice),o.insert,!!o.structure)},t}(ht);ht.jsonID("replaceAround",St);function kn(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 qc(e,t,r){return(t==0||e.canReplace(t,e.childCount))&&(r==e.childCount||e.canReplace(0,r))}function Pe(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||!qc(o,i,s))break}}X.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 St(a,c,i,s,new O(l.append(d),u,h),l.size-u,!0))};function Sn(e,t,r,n){n===void 0&&(n=e);var o=Jc(e,t),i=o&&Wc(n,t);return i?o.map(xi).concat({type:t,attrs:r}).concat(i.map(xi)):null}function xi(e){return{type:e,attrs:null}}function Jc(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 Wc(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}X.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 St(o,i,o,i,new O(r,0,0),t.length,!0))};X.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)&&Kc(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 St(l,u,l+1,u-1,new O(k.from(r.create(n,null,s.marks)),0,0),1,!0)),!1}}),this};function Kc(e,t,r){var n=e.resolve(t),o=n.index();return n.parent.canReplaceWith(o,o+1,r)}X.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 St(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new O(k.from(i),0,0),1,!0))};function ee(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)}X.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 te(e,e,new O(o.append(i),t,t),!0))};function Mn(e,t){var r=e.resolve(t),n=r.index();return $c(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function $c(e,t){return e&&t&&!e.isLeaf&&e.canAppend(t)}X.prototype.join=function(e,t){t===void 0&&(t=1);var r=new te(e-t,e+t,O.empty,!0);return this.step(r)};function Uc(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 Oi(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 Cn(e,t,r){for(var n=[],o=0;o<e.childCount;o++){var i=e.child(o);i.content.size&&(i=i.copy(Cn(i.content,t,i))),i.isInline&&(i=t(i,r,o)),n.push(i)}return k.fromArray(n)}var xn=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 O(Cn(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 yt.fromReplace(n,this.from,this.to,c)},t.prototype.invert=function(){return new Qe(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",xn);var Qe=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 O(Cn(i.content,function(a){return a.mark(o.mark.removeFromSet(a.marks))}),i.openStart,i.openEnd);return yt.fromReplace(n,this.from,this.to,s)},t.prototype.invert=function(){return new xn(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",Qe);X.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 Qe(p,d,f[v])));a&&a.to==p?a.to=d:i.push(a=new xn(p,d,r))}}}),o.forEach(function(c){return n.step(c)}),i.forEach(function(c){return n.step(c)}),this};X.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 ie)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 Qe(s.from,s.to,s.style))}),this};X.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 te(i,c,O.empty));else{r=l;for(var u=0;u<a.marks.length;u++)t.allowsMarkType(a.marks[u].type)||this.step(new Qe(i,c,a.marks[u]))}i=c}if(!r.validEnd){var f=r.fillBefore(k.empty,!0);this.replace(i,i,new O(f,0,0))}for(var p=o.length-1;p>=0;p--)this.step(o[p]);return this};function Gc(e,t,r,n){if(r===void 0&&(r=t),n===void 0&&(n=O.empty),t==r&&!n.size)return null;var o=e.resolve(t),i=e.resolve(r);return wi(o,i,n)?new te(t,r,n):new It(o,i,n).fit()}X.prototype.replace=function(e,t,r){t===void 0&&(t=e),r===void 0&&(r=O.empty);var n=Gc(this.doc,e,t,r);return n&&this.step(n),this};X.prototype.replaceWith=function(e,t,r){return this.replace(e,t,new O(k.from(r),0,0))};X.prototype.delete=function(e,t){return this.replace(e,t,O.empty)};X.prototype.insert=function(e,t){return this.replaceWith(e,e,t)};function wi(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))},Ti={depth:{configurable:!0}};Ti.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 O(s,a,c);if(r>-1)return new St(o.pos,r,this.$to.pos,this.$to.end(),l,n);if(l.size||o.pos!=this.$to.pos)return new te(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=On(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=On(r,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new O(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=On(r,n);if(i.childCount<=1&&n>0){var s=r.size-n<=n+i.size;this.unplaced=new O(Ze(r,n-1,1),n-1,s?n-1:o)}else this.unplaced=new O(Ze(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 M=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(Ai(y.mark(v.allowedMarks(y.marks)),f==1?u:0,f==l.childCount?M:-1)))}var m=f==l.childCount;m||(M=-1),this.placed=tr(this.placed,n,k.from(p)),this.frontier[n].match=h,m&&M<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var D=0,x=l;D<M;D++){var F=x.lastChild;this.frontier.push({type:F.type,match:F.contentMatchAt(F.childCount)}),x=F.content}this.unplaced=m?r==0?O.empty:new O(Ze(c.content,r-1,1),r-1,M<0?c.openEnd:r-1):new O(Ze(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||!wn(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=wn(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=wn(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=tr(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=tr(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=tr(this.placed,this.frontier.length,r))};Object.defineProperties(It.prototype,Ti);function Ze(e,t,r){return t==0?e.cutByIndex(r):e.replaceChild(0,e.firstChild.copy(Ze(e.firstChild.content,t-1,r)))}function tr(e,t,r){return t==0?e.append(r):e.replaceChild(e.childCount-1,e.lastChild.copy(tr(e.lastChild.content,t-1,r)))}function On(e,t){for(var r=0;r<t;r++)e=e.firstChild.content;return e}function Ai(e,t,r){if(t<=0)return e;var n=e.content;return t>1&&(n=n.replaceChild(0,Ai(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 wn(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&&!Yc(r,i.content,s)?a:null}function Yc(e,t,r){for(var n=r;n<t.childCount;n++)if(!e.allowsMarks(t.child(n).marks))return!0;return!1}X.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(wi(n,o,r))return this.step(new te(e,t,r));var i=Ni(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 M=(g+p+1)%(r.openStart+1),y=f[M];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 x=n.node(m-1),F=n.index(m-1);if(x.canReplaceWith(F,F,y.type,y.marks))return this.replace(n.before(m),D?o.after(m):t,new O(_i(r.content,0,r.openStart,M),M,r.openEnd))}}for(var W=this.steps.length,$=i.length-1;$>=0&&(this.replace(e,t,r),!(this.steps.length>W));$--){var U=i[$];U<0||(e=n.before(U),t=o.after(U))}return this};function _i(e,t,r,n,o){if(t<r){var i=e.firstChild;e=e.replaceChild(0,i.copy(_i(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}X.prototype.replaceRangeWith=function(e,t,r){if(!r.isInline&&e==t&&this.doc.resolve(e).parent.content.size){var n=Uc(this.doc,e,r.type);n!=null&&(e=t=n)}return this.replaceRange(e,t,new O(k.from(r),0,0))};X.prototype.deleteRange=function(e,t){for(var r=this.doc.resolve(e),n=this.doc.resolve(t),o=Ni(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 Ni(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 Tn=Object.create(null),E=function(t,r,n){this.ranges=n||[new Xc(t.min(r),t.max(r))],this.$anchor=t,this.$head=r},se={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};se.anchor.get=function(){return this.$anchor.pos};se.head.get=function(){return this.$head.pos};se.from.get=function(){return this.$from.pos};se.to.get=function(){return this.$to.pos};se.$from.get=function(){return this.ranges[0].$from};se.$to.get=function(){return this.ranges[0].$to};se.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=O.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?O.empty:r),c==0&&Ei(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),Ei(t,n,r.isInline?-1:1))}};E.findFrom=function(t,r,n){var o=t.parent.inlineContent?new z(t):Be(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?Be(t.node(0),t.node(i),t.before(i+1),t.index(i),r,n):Be(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 re(t.node(0))};E.atStart=function(t){return Be(t,t,0,0,1)||new re(t)};E.atEnd=function(t){return Be(t,t,t.content.size,t.childCount,-1)||new re(t)};E.fromJSON=function(t,r){if(!r||!r.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Tn[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 Tn)throw new RangeError("Duplicate use of selection JSON ID "+t);return Tn[t]=r,r.prototype.jsonID=t,r};E.prototype.getBookmark=function(){return z.between(this.$anchor,this.$head).getBookmark()};Object.defineProperties(E.prototype,se);E.prototype.visible=!0;var Xc=function(t,r){this.$from=t,this.$to=r},z=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=O.empty),e.prototype.replace.call(this,o,i),i==O.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",z);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 z.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 O(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 Dr(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 Dr=function(t){this.anchor=t};Dr.prototype.map=function(t){var r=t.mapResult(this.anchor),n=r.deleted,o=r.pos;return n?new er(o,o):new Dr(o)};Dr.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 re=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=O.empty),o==O.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 Qc},t}(E);E.jsonID("all",re);var Qc={map:function(){return this},resolve:function(t){return new re(t)}};function Be(e,t,r,n,o,i){if(t.inlineContent)return z.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=Be(e,a,r+o,o<0?a.childCount:0,o,i);if(c)return c}r+=a.nodeSize*o}}function Ei(e,t,r){var n=e.steps.length-1;if(!(n<t)){var o=e.steps[n];if(o instanceof te||o instanceof St){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 Di=1,Ir=2,Ii=4,Zc=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|Di)&~Ir,this.storedMarks=null,this},r.selectionSet.get=function(){return(this.updated&Di)>0},t.prototype.setStoredMarks=function(o){return this.storedMarks=o,this.updated|=Ir,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&Ir)>0},t.prototype.addStep=function(o,i){e.prototype.addStep.call(this,o,i),this.updated=this.updated&~Ir,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|=Ii,this},r.scrolledIntoView.get=function(){return(this.updated&Ii)>0},Object.defineProperties(t.prototype,r),t}(X);function Ri(e,t){return!t||!e?e:e.bind(t)}var rr=function(t,r,n){this.name=t,this.init=Ri(r.init,n),this.apply=Ri(r.apply,n)},tl=[new rr("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new rr("selection",{init:function(t,r){return t.selection||E.atStart(r.doc)},apply:function(t){return t.selection}}),new rr("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,r,n,o){return o.selection.$cursor?t.storedMarks:null}}),new rr("scrollToSelection",{init:function(){return 0},apply:function(t,r){return t.scrolledIntoView?r+1:r}})],An=function(t,r){var n=this;this.schema=t,this.fields=tl.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 rr(o.key,o.spec.state,o))})},mt=function(t){this.config=t},Rr={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};Rr.schema.get=function(){return this.config.schema};Rr.plugins.get=function(){return this.config.plugins};mt.prototype.apply=function(t){return this.applyTransaction(t).state};mt.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};mt.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}}};mt.prototype.applyInner=function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var r=new mt(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<nr.length;s++)nr[s](this,t,r);return r};Rr.tr.get=function(){return new Zc(this)};mt.create=function(t){for(var r=new An(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new mt(r),o=0;o<r.fields.length;o++)n[r.fields[o].name]=r.fields[o].init(t,n);return n};mt.prototype.reconfigure=function(t){for(var r=new An(this.schema,t.plugins),n=r.fields,o=new mt(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};mt.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};mt.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 An(t.schema,t.plugins),i=new mt(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};mt.addApplyListener=function(t){nr.push(t)};mt.removeApplyListener=function(t){var r=nr.indexOf(t);r>-1&&nr.splice(r,1)};Object.defineProperties(mt.prototype,Rr);var nr=[];function Pi(e,t,r){for(var n in e){var o=e[n];o instanceof Function?o=o.bind(t):n=="handleDOMEvents"&&(o=Pi(o,t,{})),r[n]=o}return r}var Rt=function(t){this.props={},t.props&&Pi(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:Bi("plugin")};Rt.prototype.getState=function(t){return t[this.key]};var _n=Object.create(null);function Bi(e){return e in _n?e+"$"+ ++_n[e]:(_n[e]=0,e+"$")}var Wt=function(t){t===void 0&&(t="key"),this.key=Bi(t)};Wt.prototype.get=function(t){return t.config.pluginsByKey[this.key]};Wt.prototype.getState=function(t){return t[this.key]};var C={};if(typeof navigator!="undefined"&&typeof document!="undefined"){var Nn=/Edge\/(\d+)/.exec(navigator.userAgent),zi=/MSIE \d/.test(navigator.userAgent),En=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);C.mac=/Mac/.test(navigator.platform);var Dn=C.ie=!!(zi||En||Nn);C.ie_version=zi?document.documentMode||6:En?+En[1]:Nn?+Nn[1]:null,C.gecko=!Dn&&/gecko\/(\d+)/i.test(navigator.userAgent),C.gecko_version=C.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var In=!Dn&&/Chrome\/(\d+)/.exec(navigator.userAgent);C.chrome=!!In,C.chrome_version=In&&+In[1],C.safari=!Dn&&/Apple Computer/.test(navigator.vendor),C.ios=C.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),C.android=/Android \d/.test(navigator.userAgent),C.webkit="webkitFontSmoothing"in document.documentElement.style,C.webkit_version=C.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var Pt=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Rn=function(e){var t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},Li=null,ne=function(e,t,r){var n=Li||(Li=document.createRange());return n.setEnd(e,r==null?e.nodeValue.length:r),n.setStart(e,t||0),n},Pr=function(e,t,r,n){return r&&(Fi(e,t,r,n,-1)||Fi(e,t,r,n,1))},el=/^(img|br|input|textarea|hr)$/i;function Fi(e,t,r,n,o){for(;;){if(e==r&&t==n)return!0;if(t==(o<0?0:Kt(e))){var i=e.parentNode;if(i.nodeType!=1||nl(e)||el.test(e.nodeName)||e.contentEditable=="false")return!1;t=Pt(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?Kt(e):0}else return!1}}function Kt(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function rl(e,t,r){for(var n=t==0,o=t==Kt(e);n||o;){if(e==r)return!0;var i=Pt(e);if(e=e.parentNode,!e)return!1;n=n&&i==0,o=o&&i==Kt(e)}}function nl(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 Pn=function(e){var t=e.isCollapsed;return t&&C.chrome&&e.rangeCount&&!e.getRangeAt(0).collapsed&&(t=!1),t};function ze(e,t){var r=document.createEvent("Event");return r.initEvent("keydown",!0,!0),r.keyCode=e,r.key=r.code=t,r}function ol(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function ae(e,t){return typeof e=="number"?e:e[t]}function il(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 Vi(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=Rn(s))if(s.nodeType==1){var a=s==i.body||s.nodeType!=1,c=a?ol(i):il(s),l=0,u=0;if(t.top<c.top+ae(n,"top")?u=-(c.top-t.top+ae(o,"top")):t.bottom>c.bottom-ae(n,"bottom")&&(u=t.bottom-c.bottom+ae(o,"bottom")),t.left<c.left+ae(n,"left")?l=-(c.left-t.left+ae(o,"left")):t.right>c.right-ae(n,"right")&&(l=t.right-c.right+ae(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 sl(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:Hi(e.dom)}}function Hi(e){for(var t=[],r=e.ownerDocument;e&&(t.push({dom:e,top:e.scrollTop,left:e.scrollLeft}),e!=r);e=Rn(e));return t}function al(e){var t=e.refDOM,r=e.refTop,n=e.stack,o=t?t.getBoundingClientRect().top:0;ji(n,o==0?0:o-r)}function ji(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 Le=null;function cl(e){if(e.setActive)return e.setActive();if(Le)return e.focus(Le);var t=Hi(e);e.focus(Le==null?{get preventScroll(){return Le={preventScroll:!0},!0}}:void 0),Le||(Le=!1,ji(t,0))}function qi(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=ne(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?ll(r,o):!r||n&&r.nodeType==1?{node:e,offset:i}:qi(r,o)}function ll(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=ce(n,1);if(i.top!=i.bottom&&Bn(t,i))return{node:e,offset:o+(t.left>=(i.left+i.right)/2?1:0)}}return{node:e,offset:0}}function Bn(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function ul(e,t){var r=e.parentNode;return r&&/^li$/i.test(r.nodeName)&&t.left<e.getBoundingClientRect().left?r:e}function fl(e,t,r){var n=qi(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 pl(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 Ji(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(Bn(t,l))return Ji(s,t,l)}if((i=(i+1)%n)==o)break}return e}function dl(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(!Bn(t,f)||(l=Ji(e.dom,t,f),!l))return null}if(C.safari)for(var p=l;i&&p;p=Rn(p))p.draggable&&(i=s=null);if(l=ul(l,t),i){if(C.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=pl(e,i,s,t))}u==null&&(u=fl(e,l,t));var v=e.docView.nearestDesc(l,!0);return{pos:u,inside:v?v.posAtStart-v.border:-1}}function ce(e,t){var r=e.getClientRects();return r.length?r[t<0?0:r.length-1]:e.getBoundingClientRect()}var hl=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Wi(e,t,r){var n=e.docView.domFromPos(t,r<0?-1:1),o=n.node,i=n.offset,s=C.webkit||C.gecko;if(o.nodeType==3)if(s&&(hl.test(o.nodeValue)||(r<0?!i:i==o.nodeValue.length))){var a=ce(ne(o,i,i),r);if(C.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){var c=ce(ne(o,i-1,i-1),-1);if(c.top==a.top){var l=ce(ne(o,i,i+1),-1);if(l.top!=a.top)return or(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++,or(ce(ne(o,u,f),p),p<0)}if(!e.state.doc.resolve(t).parent.inlineContent){if(i&&(r<0||i==Kt(o))){var d=o.childNodes[i-1];if(d.nodeType==1)return zn(d.getBoundingClientRect(),!1)}if(i<Kt(o)){var h=o.childNodes[i];if(h.nodeType==1)return zn(h.getBoundingClientRect(),!0)}return zn(o.getBoundingClientRect(),r>=0)}if(i&&(r<0||i==Kt(o))){var v=o.childNodes[i-1],g=v.nodeType==3?ne(v,Kt(v)-(s?0:1)):v.nodeType==1&&(v.nodeName!="BR"||!v.nextSibling)?v:null;if(g)return or(ce(g,1),!1)}if(i<Kt(o)){var M=o.childNodes[i],y=M.nodeType==3?ne(M,0,s?0:1):M.nodeType==1?M:null;if(y)return or(ce(y,-1),!0)}return or(ce(o.nodeType==3?ne(o):o,-r),r>=0)}function or(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 zn(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 Ki(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 ml(e,t,r){var n=t.selection,o=r=="up"?n.$from:n.$to;return Ki(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=Wi(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=ne(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 vl=/[\u0590-\u08ac]/;function gl(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!vl.test(o.parent.textContent)||!c.modify?r=="left"||r=="backward"?s:a:Ki(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 $i=null,Ui=null,Gi=!1;function yl(e,t,r){return $i==t&&Ui==r?Gi:($i=t,Ui=r,Gi=r=="up"||r=="down"?ml(e,t,r):gl(e,t,r))}var Ft=0,Yi=1,ir=2,le=3,j=function(t,r,n,o){this.parent=t,this.children=r,this.dom=n,n.pmViewDesc=this,this.contentDOM=o,this.dirty=Ft},$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>Pt(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==null?n>0:c)?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?Pt(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=Pt(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=Pt(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((C.gecko||C.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 M=v,y=void 0;M;M=M.parentNode){if(y=M.nextSibling){y.nodeName=="BR"&&(f=p={node:y.parentNode,offset:Pt(y)+1});break}var I=M.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(C.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&&C.safari)&&Pr(f.node,f.offset,d.anchorNode,d.anchorOffset)&&Pr(p.node,p.offset,d.focusNode,d.focusOffset))){var x=!1;if((d.extend||t==r)&&!h){d.collapse(f.node,f.offset);try{t!=r&&d.extend(p.node,p.offset),x=!0}catch($){if(!($ instanceof DOMException))throw $}}if(!x){if(t>r){var F=f;f=p,p=F}var W=document.createRange();W.setEnd(p.node,p.offset),W.setStart(f.node,f.offset),d.removeAllRanges(),d.addRange(W)}}};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?ir:Yi,t==a&&r==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=le:i.markDirty(t-a,r-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM?ir:le}n=s}this.dirty=ir};j.prototype.markParentsDirty=function(){for(var t=1,r=this.parent;r;r=r.parent,t++){var n=t==1?ir:Yi;r.dirty<n&&(r.dirty=n)}};$t.domAtom.get=function(){return!1};Object.defineProperties(j.prototype,$t);var ue=[],bl=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,ue,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==Ft&&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),kl=function(e){function t(n,o,i,s){e.call(this,n,ue,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),Ln=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=nt.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!=le&&this.mark.eq(n)},t.prototype.markDirty=function(n,o){if(e.prototype.markDirty.call(this,n,o),this.dirty!=Ft){for(var i=this.parent;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=Ft}},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=Hn(a,o,c,i)),n>0&&(a=Hn(a,0,n,i));for(var l=0;l<a.length;l++)a[l].parent=s;return s.children=a,s},t}(j),sr=function(e){function t(n,o,i,s,a,c,l,u,f){e.call(this,n,o.isLeaf?ue:[],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=nt.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=es(h,s,i),d?p=new Ml(o,i,s,a,h,v,g,d,c,l+1):i.isText?new Qi(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==Ft&&o.eq(this.node)&&Vn(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 Bt(this,u&&u.node);wl(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 M;p.findNodeMatch(d,h,v,g)||f&&o.state.selection.from>c&&o.state.selection.to<c+d.nodeSize&&(M=p.findIndexWithChild(l.node))>-1&&p.updateNodeAt(d,h,v,M,o)||p.updateNextNode(d,h,v,o,g)||p.addNode(d,h,v,o,c),c+=d.nodeSize}),p.syncToMarks(ue,a,o),this.node.isTextblock&&p.addTextblockHacks(),p.destroyRest(),(p.changed||this.dirty==ir)&&(u&&this.protectLocalComposition(o,u),Zi(this.contentDOM,this.children,o),C.ios&&Tl(this.dom))},t.prototype.localCompositionInfo=function(o,i){var s=o.state.selection,a=s.from,c=s.to;if(!(!(o.state.selection instanceof z)||a<i||c>i+this.node.content.size)){var l=o.root.getSelection(),u=Al(l.focusNode,l.focusOffset);if(!(!u||!this.dom.contains(u.parentNode)))if(this.node.inlineContent){var f=u.nodeValue,p=_l(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 kl(this,l,s,c);o.compositionNodes.push(u),this.children=Hn(this.children,a,a+c.length,o,u)}},t.prototype.update=function(o,i,s,a){return this.dirty==le||!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=Ft},t.prototype.updateOuterDeco=function(o){if(!Vn(o,this.outerDeco)){var i=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=ts(this.dom,this.nodeDOM,Fn(this.outerDeco,this.node,i),Fn(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 Xi(e,t,r,n,o){return es(n,t,e),new sr(null,e,t,r,n,n,n,o,0)}var Qi=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==le||this.dirty!=Ft&&!this.inParent()||!o.sameMarkup(this.node)?!1:(this.updateOuterDeco(i),(this.dirty!=Ft||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=Ft,!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=le)},r.domAtom.get=function(){return!1},Object.defineProperties(t.prototype,r),t}(sr),Sl=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==Ft&&this.dom.nodeName==o},r.domAtom.get=function(){return!0},Object.defineProperties(t.prototype,r),t}(j),Ml=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==le)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}(sr);function Zi(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=rs(n),o=!0;n=n.nextSibling}else o=!0,e.insertBefore(a,n);if(s instanceof Ln){var c=n?n.previousSibling:e.lastChild;Zi(s.contentDOM,s.children,r),n=c?c.nextSibling:e.firstChild}}for(;n;)n=rs(n),o=!0;o&&r.trackWrites==e&&(r.trackWrites=null)}function ar(e){e&&(this.nodeName=e)}ar.prototype=Object.create(null);var Me=[new ar];function Fn(e,t,r){if(e.length==0)return Me;for(var n=r?Me[0]:new ar,o=[n],i=0;i<e.length;i++){var s=e[i].type.attrs;if(!!s){s.nodeName&&o.push(n=new ar(s.nodeName));for(var a in s){var c=s[a];c!=null&&(r&&o.length==1&&o.push(n=new ar(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 ts(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}Cl(o,a||Me[0],s)}return o}function Cl(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):ue,s=r.class?r.class.split(" ").filter(Boolean):ue,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 es(e,t,r){return ts(e,e,Me,Fn(t,r,e.nodeType!=1))}function Vn(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 rs(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var Bt=function(t,r){this.top=t,this.lock=r,this.index=0,this.stack=[],this.changed=!1,this.preMatch=xl(t.node.content,t.children)};Bt.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}};Bt.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)};Bt.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=Ft,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=Ln.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++}};Bt.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)};Bt.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};Bt.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}};Bt.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 sr){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!=le&&Vn(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};Bt.prototype.addNode=function(t,r,n,o,i){this.top.children.splice(this.index++,0,sr.create(this.top,t,r,n,o,i)),this.changed=!0};Bt.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 bl(this.top,t,r,n);this.top.children.splice(this.index++,0,i),this.changed=!0}};Bt.prototype.addTextblockHacks=function(){for(var t=this.top.children[this.index-1];t instanceof Ln;)t=t.children[t.children.length-1];(!t||!(t instanceof Qi)||/\n$/.test(t.node.text))&&((C.safari||C.chrome)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG"),this.addHackNode("BR"))};Bt.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 Sl(this.top,ue,r,null)),this.changed=!0}};function xl(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 Ol(e,t){return e.type.side-t.type.side}function wl(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(Ol);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 M=0;M<l.length;M++)l[M].to<=i&&l.splice(M--,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(x){return!x.inline}):l.slice():ue;n(v,D,t.forChild(i,v),g),i=y}}function Tl(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 Al(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=Kt(e)}else if(e.nodeType==1&&t<e.childNodes.length)e=e.childNodes[t],t=0;else return null}}function _l(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 Hn(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 ns(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(Pn(r)){for(c=a;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&N.isSelectable(o.node)&&o.parent&&!(o.node.isInline&&rl(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=qn(e,c,a,p)}return l}function is(e){return e.editable?e.hasFocus():Jn(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function fe(e,t){var r=e.state.selection;if(ls(e,r),!!is(e)){if(!t&&e.mouseDown&&e.mouseDown.allowDefault){e.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}if(e.domObserver.disconnectSelection(),e.cursorWrapper)El(e);else{var n=r.anchor,o=r.head,i,s;ss&&!(r instanceof z)&&(r.$from.parent.inlineContent||(i=as(e,r.from)),!r.empty&&!r.$from.parent.inlineContent&&(s=as(e,r.to))),e.docView.setSelection(n,o,e.root,t),ss&&(i&&cs(i),s&&cs(s)),r.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Nl(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var ss=C.safari||C.chrome&&C.chrome_version<63;function as(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(C.safari&&i&&i.contentEditable=="false")return jn(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return jn(i);if(s)return jn(s)}}function jn(e){return e.contentEditable="true",C.safari&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function cs(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Nl(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(){(!is(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function El(e){var t=e.root.getSelection(),r=document.createRange(),n=e.cursorWrapper.dom,o=n.nodeName=="IMG";o?r.setEnd(n.parentNode,Pt(n)+1):r.setEnd(n,0),r.collapse(!1),t.removeAllRanges(),t.addRange(r),!o&&!e.state.selection.visible&&C.ie&&C.ie_version<=11&&(n.disabled=!0,n.disabled=!1)}function ls(e,t){if(t instanceof N){var r=e.docView.descAt(t.from);r!=e.lastSelectedViewDesc&&(us(e),r&&r.selectNode(),e.lastSelectedViewDesc=r)}else us(e)}function us(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=null)}function qn(e,t,r,n){return e.someProp("createSelectionBetween",function(o){return o(e,t,r)})||z.between(t,r,n)}function Dl(e){return e.editable&&e.root.activeElement!=e.dom?!1:Jn(e)}function Jn(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 Il(e){var t=e.docView.domFromPos(e.state.selection.anchor,0),r=e.root.getSelection();return Pr(t.node,t.offset,r.anchorNode,r.anchorOffset)}function Wn(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 Ce(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function fs(e,t,r){var n=e.state.selection;if(n instanceof z){if(!n.empty||r.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"right":"left")){var o=Wn(e.state,t);return o&&o instanceof N?Ce(e,o):!1}else if(!(C.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)?Ce(e,new N(t<0?e.state.doc.resolve(i.pos-s.nodeSize):i)):C.webkit?Ce(e,new z(e.state.doc.resolve(t<0?c:c+s.nodeSize))):!1:!1}}else{if(n instanceof N&&n.node.isInline)return Ce(e,new z(t>0?n.$to:n.$from));var l=Wn(e.state,t);return l?Ce(e,l):!1}}function Br(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function cr(e){var t=e.pmViewDesc;return t&&t.size==0&&(e.nextSibling||e.nodeName!="BR")}function Kn(e){var t=e.root.getSelection(),r=t.focusNode,n=t.focusOffset;if(!!r){var o,i,s=!1;for(C.gecko&&r.nodeType==1&&n<Br(r)&&cr(r.childNodes[n])&&(s=!0);;)if(n>0){if(r.nodeType!=1)break;var a=r.childNodes[n-1];if(cr(a))o=r,i=--n;else if(a.nodeType==3)r=a,n=r.nodeValue.length;else break}else{if(ps(r))break;for(var c=r.previousSibling;c&&cr(c);)o=r.parentNode,i=Pt(c),c=c.previousSibling;if(c)r=c,n=Br(r);else{if(r=r.parentNode,r==e.dom)break;n=0}}s?Un(e,t,r,n):o&&Un(e,t,o,i)}}function $n(e){var t=e.root.getSelection(),r=t.focusNode,n=t.focusOffset;if(!!r){for(var o=Br(r),i,s;;)if(n<o){if(r.nodeType!=1)break;var a=r.childNodes[n];if(cr(a))i=r,s=++n;else break}else{if(ps(r))break;for(var c=r.nextSibling;c&&cr(c);)i=c.parentNode,s=Pt(c)+1,c=c.nextSibling;if(c)r=c,n=0,o=Br(r);else{if(r=r.parentNode,r==e.dom)break;n=o=0}}i&&Un(e,t,i,s)}}function ps(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Un(e,t,r,n){if(Pn(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&&fe(e)},50)}function ds(e,t,r){var n=e.state.selection;if(n instanceof z&&!n.empty||r.indexOf("s")>-1||C.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=Wn(e.state,t);if(s&&s instanceof N)return Ce(e,s)}if(!o.parent.inlineContent){var a=t<0?o:i,c=n instanceof re?E.near(a,t):E.findFrom(a,t);return c?Ce(e,c):!1}return!1}function hs(e,t){if(!(e.state.selection instanceof z))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 ms(e,t,r){e.domObserver.stop(),t.contentEditable=r,e.domObserver.start()}function Rl(e){if(!(!C.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;ms(e,o,!0),setTimeout(function(){return ms(e,o,!1)},20)}}}function Pl(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function Bl(e,t){var r=t.keyCode,n=Pl(t);return r==8||C.mac&&r==72&&n=="c"?hs(e,-1)||Kn(e):r==46||C.mac&&r==68&&n=="c"?hs(e,1)||$n(e):r==13||r==27?!0:r==37?fs(e,-1,n)||Kn(e):r==39?fs(e,1,n)||$n(e):r==38?ds(e,-1,n)||Kn(e):r==40?Rl(e)||ds(e,1,n)||$n(e):n==(C.mac?"m":"c")&&(r==66||r==73||r==89||r==90)}function zl(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}],Pn(l)||u.push({node:l.focusNode,offset:l.focusOffset})),C.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")||Lt.fromSchema(e.state.schema),M=v.resolve(a),y=null,I=g.parse(o,{topNode:M.parent,topMatch:M.parent.contentMatchAt(M.index()),topOpen:!0,from:i,to:s,preserveWhitespace:M.parent.type.spec.code?"full":!0,editableContent:!0,findPositions:u,ruleFromNode:Ll,context:M});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 Ll(e){var t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(C.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||C.safari&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0}}function Fl(e,t,r,n,o){if(t<0){var i=e.lastSelectionTime>Date.now()-50?e.lastSelectionOrigin:null,s=ns(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=zl(e,t,r);if(C.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,M;e.lastKeyCode===8&&Date.now()-100<e.lastKeyCodeTime?(g=e.state.selection.to,M="end"):(g=e.state.selection.from,M="start"),e.lastKeyCode=null;var y=jl(v.content,f.doc.content,f.from,g,M);if(!y)if(n&&u instanceof z&&!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((C.ios&&e.lastIOSEnter>Date.now()-225||C.android)&&o.some(function(Y){return Y.nodeName=="DIV"||Y.nodeName=="P"})&&e.someProp("handleKeyDown",function(Y){return Y(e,ze(13,"Enter"))})){e.lastIOSEnter=0;return}else{if(f.sel){var I=vs(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 z&&(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)),C.ie&&C.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)==" \xA0"&&(y.start--,y.endA--,y.endB--);var m=f.doc.resolveNoCache(y.start-f.from),D=f.doc.resolveNoCache(y.endB-f.from),x=m.sameParent(D)&&m.parent.inlineContent,F;if((C.ios&&e.lastIOSEnter>Date.now()-225&&(!x||o.some(function(Y){return Y.nodeName=="DIV"||Y.nodeName=="P"}))||!x&&m.pos<f.doc.content.size&&(F=E.findFrom(f.doc.resolve(m.pos+1),1,!0))&&F.head==D.pos)&&e.someProp("handleKeyDown",function(Y){return Y(e,ze(13,"Enter"))})){e.lastIOSEnter=0;return}if(e.state.selection.anchor>y.start&&Hl(h,y.start,y.endA,m,D)&&e.someProp("handleKeyDown",function(Y){return Y(e,ze(8,"Backspace"))})){C.android&&C.chrome&&e.domObserver.suppressSelectionUpdates();return}C.chrome&&C.android&&y.toB==y.from&&(e.lastAndroidDelete=Date.now()),C.android&&!x&&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(Y){return Y(e,ze(13,"Enter"))})},20));var W=y.start,$=y.endA,U,Qt,et,lt;if(x){if(m.pos==D.pos)C.ie&&C.ie_version<=11&&m.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(function(){return fe(e)},20)),U=e.state.tr.delete(W,$),Qt=h.resolve(y.start).marksAcross(h.resolve(y.endA));else if(y.endA==y.endB&&(lt=h.resolve(y.start))&&(et=Vl(m.parent.content.cut(m.parentOffset,D.parentOffset),lt.parent.content.cut(lt.parentOffset,y.endA-lt.start()))))U=e.state.tr,et.type=="add"?U.addMark(W,$,et.mark):U.removeMark(W,$,et.mark);else if(m.parent.child(m.index()).isText&&m.index()==D.index()-(D.textOffset?0:1)){var qt=m.parent.textBetween(m.parentOffset,D.parentOffset);if(e.someProp("handleTextInput",function(Y){return Y(e,W,$,qt)}))return;U=e.state.tr.insertText(qt,W,$)}}if(U||(U=e.state.tr.replace(W,$,f.doc.slice(y.start-f.from,y.endB-f.from))),f.sel){var G=vs(e,U.doc,f.sel);G&&!(C.chrome&&C.android&&e.composing&&G.empty&&(y.start!=y.endB||e.lastAndroidDelete<Date.now()-100)&&(G.head==W||G.head==U.mapping.map($)-1)||C.ie&&G.empty&&G.head==W)&&U.setSelection(G)}Qt&&U.ensureMarks(Qt),e.dispatch(U.scrollIntoView())}function vs(e,t,r){return Math.max(r.anchor,r.head)>t.content.size?null:qn(e,t.resolve(r.anchor),t.resolve(r.head))}function Vl(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 Hl(e,t,r,n,o){if(!n.parent.isTextblock||r-t<=o.pos-n.pos||Gn(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(Gn(i,!0,!0));return!s.parent.isTextblock||s.pos>r||Gn(s,!0,!1)<r?!1:n.parent.content.cut(n.parentOffset).eq(s.parent.content)}function Gn(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 jl(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 gs(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")||nt.fromSchema(e.state.schema),c=xs(),l=c.createElement("div");l.appendChild(a.serializeFragment(n,{document:c}));for(var u=l.firstChild,f;u&&u.nodeType==1&&(f=Ms[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 ys(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(M){t=M(t,s||n)}),s)return new O(k.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
`))),0,0);var l=e.someProp("clipboardTextParser",function(M){return M(t,o,n)});if(l)a=l;else{var u=o.marks(),f=e.state,p=f.schema,d=nt.fromSchema(p);i=document.createElement("div"),t.trim().split(/(?:\r\n?|\n)+/).forEach(function(M){i.appendChild(document.createElement("p")).appendChild(d.serializeNode(p.text(M,u)))})}}else e.someProp("transformPastedHTML",function(M){r=M(r)}),i=Wl(r),C.webkit&&Kl(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")||Lt.fromSchema(e.state.schema);a=g.parseSlice(i,{preserveWhitespace:!!(c||v),context:o})}return v?a=$l(Jl(a,+v[1],+v[2]),v[3]):a=O.maxOpen(ql(a.content,o),!1),e.someProp("transformPasted",function(M){a=M(a)}),a}function ql(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&&ks(f,c,u,l[l.length-1],0))l[l.length-1]=p;else{l.length&&(l[l.length-1]=Ss(l[l.length-1],c.length));var d=bs(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 bs(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 ks(e,t,r,n,o){if(o<e.length&&o<t.length&&e[o]==t[o]){var i=ks(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(bs(r,e,o+1))))}}function Ss(e,t){if(t==0)return e;var r=e.content.replaceChild(e.childCount-1,Ss(e.lastChild,t-1)),n=e.contentMatchAt(e.childCount).fillBefore(k.empty,!0);return e.copy(r.append(n))}function Yn(e,t,r,n,o,i){var s=t<0?e.firstChild:e.lastChild,a=s.content;return o<n-1&&(a=Yn(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 Jl(e,t,r){return t<e.openStart&&(e=new O(Yn(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),r<e.openEnd&&(e=new O(Yn(e.content,1,r,e.openEnd,0,0),e.openStart,r)),e}var Ms={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},Cs=null;function xs(){return Cs||(Cs=document.implementation.createHTMLDocument("title"))}function Wl(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var r=xs().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(e),o;if((o=n&&Ms[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 Kl(e){for(var t=e.querySelectorAll(C.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=="\xA0"&&n.parentNode&&n.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),n)}}function $l(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 O(o,i,s)}var Ul={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Xn=C.ie&&C.ie_version<=11,Qn=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};Qn.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset};Qn.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var _t=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]);C.ie&&C.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 Qn,Xn&&(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};_t.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(function(){t.flushingSoon=-1,t.flush()},20))};_t.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())};_t.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,Ul),Xn&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()};_t.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()}Xn&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()};_t.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)};_t.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)};_t.prototype.suppressSelectionUpdates=function(){var t=this;this.suppressingSelectionUpdates=!0,setTimeout(function(){return t.suppressingSelectionUpdates=!1},50)};_t.prototype.onSelectionChange=function(){if(!!Dl(this.view)){if(this.suppressingSelectionUpdates)return fe(this.view);if(C.ie&&C.ie_version<=11&&!this.view.state.selection.empty){var t=this.view.root.getSelection();if(t.focusNode&&Pr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}};_t.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())};_t.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};_t.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)&&Jn(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(C.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),Gl(this.view)),this.handleDOMChange(o,i,s,a),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(r)||fe(this.view),this.currentSelection.set(r))}};_t.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(C.ie&&C.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?Pt(i)+1:0,p=n.localPosFromDOM(t.target,f,-1),d=s&&s.parentNode==t.target?Pt(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 Os=!1;function Gl(e){Os||(Os=!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 Mt={},bt={};function Yl(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 _t(e,function(n,o,i,s){return Fl(e,n,o,i,s)}),e.domObserver.start(),e.domChangeCount=0,e.eventHandlers=Object.create(null);var t=function(n){var o=Mt[n];e.dom.addEventListener(n,e.eventHandlers[n]=function(i){Ql(e,i)&&!to(e,i)&&(e.editable||!(i.type in bt))&&o(e,i)})};for(var r in Mt)t(r);C.safari&&e.dom.addEventListener("input",function(){return null}),Zn(e)}function xe(e,t){e.lastSelectionOrigin=t,e.lastSelectionTime=Date.now()}function Xl(e){e.domObserver.stop();for(var t in e.eventHandlers)e.dom.removeEventListener(t,e.eventHandlers[t]);clearTimeout(e.composingTimeout),clearTimeout(e.lastIOSEnterFallbackTimeout)}function Zn(e){e.someProp("handleDOMEvents",function(t){for(var r in t)e.eventHandlers[r]||e.dom.addEventListener(r,e.eventHandlers[r]=function(n){return to(e,n)})})}function to(e,t){return e.someProp("handleDOMEvents",function(r){var n=r[t.type];return n?n(e,t)||t.defaultPrevented:!1})}function Ql(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 Zl(e,t){!to(e,t)&&Mt[t.type]&&(e.editable||!(t.type in bt))&&Mt[t.type](e,t)}bt.keydown=function(e,t){if(e.shiftKey=t.keyCode==16||t.shiftKey,!Ts(e,t))if(t.keyCode!=229&&e.domObserver.forceFlush(),e.lastKeyCode=t.keyCode,e.lastKeyCodeTime=Date.now(),C.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,ze(13,"Enter"))}),e.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",function(n){return n(e,t)})||Bl(e,t)?t.preventDefault():xe(e,"key")};bt.keyup=function(e,t){t.keyCode==16&&(e.shiftKey=!1)};bt.keypress=function(e,t){if(!(Ts(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||C.mac&&t.metaKey)){if(e.someProp("handleKeyPress",function(o){return o(e,t)})){t.preventDefault();return}var r=e.state.selection;if(!(r instanceof z)||!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 zr(e){return{left:e.clientX,top:e.clientY}}function tu(e,t){var r=t.x-e.clientX,n=t.y-e.clientY;return r*r+n*n<100}function eo(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 Fe(e,t,r){e.focused||e.focus();var n=e.state.tr.setSelection(t);r=="pointer"&&n.setMeta("pointer",!0),e.dispatch(n)}function eu(e,t){if(t==-1)return!1;var r=e.state.doc.resolve(t),n=r.nodeAfter;return n&&n.isAtom&&N.isSelectable(n)?(Fe(e,new N(r),"pointer"),!0):!1}function ru(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?(Fe(e,N.create(e.state.doc,o),"pointer"),!0):!1}function nu(e,t,r,n,o){return eo(e,"handleClickOn",t,r,n)||e.someProp("handleClick",function(i){return i(e,t,n)})||(o?ru(e,r):eu(e,r))}function ou(e,t,r,n){return eo(e,"handleDoubleClickOn",t,r,n)||e.someProp("handleDoubleClick",function(o){return o(e,t,n)})}function iu(e,t,r,n){return eo(e,"handleTripleClickOn",t,r,n)||e.someProp("handleTripleClick",function(o){return o(e,t,n)})||su(e,r,n)}function su(e,t,r){if(r.button!=0)return!1;var n=e.state.doc;if(t==-1)return n.inlineContent?(Fe(e,z.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)Fe(e,z.create(n,a+1,a+1+s.content.size),"pointer");else if(N.isSelectable(s))Fe(e,N.create(n,a),"pointer");else continue;return!0}}function ro(e){return Fr(e)}var ws=C.mac?"metaKey":"ctrlKey";Mt.mousedown=function(e,t){e.shiftKey=t.shiftKey;var r=ro(e),n=Date.now(),o="singleClick";n-e.lastClick.time<500&&tu(t,e.lastClick)&&!t[ws]&&(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(zr(t));!i||(o=="singleClick"?(e.mouseDown&&e.mouseDown.done(),e.mouseDown=new Lr(e,i,t,r)):(o=="doubleClick"?ou:iu)(e,i.pos,i.inside,t)?t.preventDefault():xe(e,"pointer"))};var Lr=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[ws],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&&C.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)),xe(t,"pointer")};Lr.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 fe(t.view)}),this.view.mouseDown=null};Lr.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(zr(t))),this.allowDefault||!r?xe(this.view,"pointer"):nu(this.view,r.pos,r.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||C.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||C.chrome&&!(this.view.state.selection instanceof z)&&Math.min(Math.abs(r.pos-this.view.state.selection.from),Math.abs(r.pos-this.view.state.selection.to))<=2)?(Fe(this.view,E.near(this.view.state.doc.resolve(r.pos)),"pointer"),t.preventDefault()):xe(this.view,"pointer")}};Lr.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),xe(this.view,"pointer"),t.buttons==0&&this.done()};Mt.touchdown=function(e){ro(e),xe(e,"pointer")};Mt.contextmenu=function(e){return ro(e)};function Ts(e,t){return e.composing?!0:C.safari&&Math.abs(t.timeStamp-e.compositionEndedAt)<500?(e.compositionEndedAt=-2e8,!0):!1}var au=C.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(),Fr(e,!0),e.markCursor=null;else if(Fr(e),C.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}As(e,au)};bt.compositionend=function(e,t){e.composing&&(e.composing=!1,e.compositionEndedAt=t.timeStamp,As(e,20))};function As(e,t){clearTimeout(e.composingTimeout),t>-1&&(e.composingTimeout=setTimeout(function(){return Fr(e)},t))}function _s(e){for(e.composing&&(e.composing=!1,e.compositionEndedAt=cu());e.compositionNodes.length>0;)e.compositionNodes.pop().markParentsDirty()}function cu(){var e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function Fr(e,t){if(e.domObserver.forceFlush(),_s(e),t||e.docView.dirty){var r=ns(e);return r&&!r.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(r)):e.updateState(e.state),!0}return!1}function lu(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 Ve=C.ie&&C.ie_version<15||C.ios&&C.webkit_version<604;Mt.copy=bt.cut=function(e,t){var r=e.state.selection,n=t.type=="cut";if(!r.empty){var o=Ve?null:t.clipboardData,i=r.content(),s=gs(e,i),a=s.dom,c=s.text;o?(t.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",c)):lu(e,a),n&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}};function uu(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function fu(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?no(e,n.value,null,t):no(e,n.textContent,n.innerHTML,t)},50)}}function no(e,t,r,n){var o=ys(e,t,r,e.shiftKey,e.state.selection.$from);if(e.someProp("handlePaste",function(a){return a(e,n,o||O.empty)}))return!0;if(!o)return!1;var i=uu(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=Ve?null:t.clipboardData;r&&no(e,r.getData("text/plain"),r.getData("text/html"),t)?t.preventDefault():fu(e,t)};var pu=function(t,r){this.slice=t,this.move=r},Ns=C.mac?"altKey":"ctrlKey";Mt.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(zr(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=gs(e,s),c=a.dom,l=a.text;t.dataTransfer.clearData(),t.dataTransfer.setData(Ve?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",Ve||t.dataTransfer.setData("text/plain",l),e.dragging=new pu(s,!t[Ns])}};Mt.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(zr(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=ys(e,t.dataTransfer.getData(Ve?"Text":"text/plain"),Ve?null:t.dataTransfer.getData("text/html"),!1,o);var s=r&&!t[Ns];if(e.someProp("handleDrop",function(h){return h(e,t,i||O.empty,s)})){t.preventDefault();return}if(!!i){t.preventDefault();var a=i?Oi(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,M){return d=M}),c.setSelection(qn(e,p,c.doc.resolve(d)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))}}}}}};Mt.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())&&fe(e)},20))};Mt.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)};Mt.beforeinput=function(e,t){if(C.chrome&&C.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,ze(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 Es in bt)Mt[Es]=bt[Es];function lr(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 ur=function(t,r){this.spec=r||Oe,this.side=this.spec.side||0,this.toDOM=t};ur.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)};ur.prototype.valid=function(){return!0};ur.prototype.eq=function(t){return this==t||t instanceof ur&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&lr(this.spec,t.spec))};var Vt=function(t,r){this.spec=r||Oe,this.attrs=t};Vt.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)};Vt.prototype.valid=function(t,r){return r.from<r.to};Vt.prototype.eq=function(t){return this==t||t instanceof Vt&&lr(this.attrs,t.attrs)&&lr(this.spec,t.spec)};Vt.is=function(t){return t.type instanceof Vt};var fr=function(t,r){this.spec=r||Oe,this.attrs=t};fr.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)};fr.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};fr.prototype.eq=function(t){return this==t||t instanceof fr&&lr(this.attrs,t.attrs)&&lr(this.spec,t.spec)};var rt=function(t,r,n){this.from=t,this.to=r,this.type=n},oo={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 ur(r,n))};rt.inline=function(t,r,n,o){return new rt(t,r,new Vt(n,o))};rt.node=function(t,r,n,o){return new rt(t,r,new fr(n,o))};oo.spec.get=function(){return this.type.spec};oo.inline.get=function(){return this.type instanceof Vt};Object.defineProperties(rt.prototype,oo);var Vr=[],Oe={},H=function(t,r){this.local=t&&t.length?t:Vr,this.children=r&&r.length?r:Vr};H.create=function(t,r){return r.length?Hr(r,t,0,Oe):it};H.prototype.find=function(t,r,n){var o=[];return this.findInner(t==null?0:t,r==null?1e9:r,o,0,n),o};H.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)}};H.prototype.map=function(t,r,n){return this==it||t.maps.length==0?this:this.mapInner(t,r,0,0,n||Oe)};H.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?du(this.children,s,t,r,n,o,i):s?new H(s.sort(we)):it};H.prototype.add=function(t,r){return r.length?this==it?H.create(t,r):this.addInner(t,r,0):this};H.prototype.addInner=function(t,r,n){var o=this,i,s=0;t.forEach(function(l,u){var f=u+n,p;if(!!(p=Is(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,Hr(p,l,f+1,Oe)),s+=3}});for(var a=Ds(s?Rs(r):r,-n),c=0;c<a.length;c++)a[c].type.valid(t,a[c])||a.splice(c--,1);return new H(a.length?this.local.concat(a).sort(we):this.local,i||this.children)};H.prototype.remove=function(t){return t.length==0||this==it?this:this.removeInner(t,0)};H.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!=it?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 H(o,n):it};H.prototype.forChild=function(t,r){if(this==it)return this;if(r.isLeaf)return H.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 Vt){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 H(o.sort(we));return n?new zt([p,n]):p}return n||it};H.prototype.eq=function(t){if(this==t)return!0;if(!(t instanceof H)||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};H.prototype.locals=function(t){return io(this.localsInner(t))};H.prototype.localsInner=function(t){if(this==it)return Vr;if(t.inlineContent||!this.local.some(Vt.is))return this.local;for(var r=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Vt||r.push(this.local[n]);return r};var it=new H;H.empty=it;H.removeOverlap=io;var zt=function(t){this.members=t};zt.prototype.map=function(t,r){var n=this.members.map(function(o){return o.map(t,r,Oe)});return zt.from(n)};zt.prototype.forChild=function(t,r){if(r.isLeaf)return H.empty;for(var n=[],o=0;o<this.members.length;o++){var i=this.members[o].forChild(t,r);i!=it&&(i instanceof zt?n=n.concat(i.members):n.push(i))}return zt.from(n)};zt.prototype.eq=function(t){if(!(t instanceof zt)||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};zt.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?io(n?r:r.sort(we)):Vr};zt.from=function(t){switch(t.length){case 0:return it;case 1:return t[0];default:return new zt(t)}};function du(e,t,r,n,o,i,s){for(var a=e.slice(),c=function(Qt,et,lt,qt){for(var G=0;G<a.length;G+=3){var Y=a[G+1],oe=void 0;Y==-1||Qt>Y+i||(et>=a[G]+i?a[G+1]=-1:lt>=o&&(oe=qt-lt-(et-Qt))&&(a[G]+=oe,a[G+1]+=oe))}},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),M=g.index,y=g.offset,I=n.maybeChild(M);if(I&&y==d&&y+I.nodeSize==v){var m=a[f+2].mapInner(r,I,p+1,e[f]+i+1,s);m!=it?(a[f]=d,a[f+1]=v,a[f+2]=m):(a[f+1]=-2,u=!0)}else u=!0}if(u){var D=hu(a,e,t||[],r,o,i,s),x=Hr(D,n,0,s);t=x.local;for(var F=0;F<a.length;F+=3)a[F+1]<0&&(a.splice(F,3),F-=3);for(var W=0,$=0;W<x.children.length;W+=3){for(var U=x.children[W];$<a.length&&a[$]<U;)$+=3;a.splice($,0,x.children[W],x.children[W+1],x.children[W+2])}}return new H(t&&t.sort(we),a)}function Ds(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 hu(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 Is(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 Rs(e){for(var t=[],r=0;r<e.length;r++)e[r]!=null&&t.push(e[r]);return t}function Hr(e,t,r,n){var o=[],i=!1;t.forEach(function(c,l){var u=Is(e,c,l+r);if(u){i=!0;var f=Hr(u,c,r+l+1,n);f!=it&&o.push(l,l+c.nodeSize,f)}});for(var s=Ds(i?Rs(e):e,-r).sort(we),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 H(s,o):it}function we(e,t){return e.from-t.from||e.to-t.to}function io(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),Ps(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),Ps(t,o,n.copy(i.from,n.to)));break}}}return t}function Ps(e,t,r){for(;t<e.length&&we(r,e[t])>0;)t++;e.splice(t,0,r)}function so(e){var t=[];return e.someProp("decorations",function(r){var n=r(e.state);n&&n!=it&&t.push(n)}),e.cursorWrapper&&t.push(H.create(e.state.doc,[e.cursorWrapper.deco])),zt.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=Ls(this),this.markCursor=null,this.cursorWrapper=null,zs(this),this.nodeViews=Fs(this),this.docView=Xi(this.state.doc,Bs(this),so(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,Yl(this),this.pluginViews=[],this.updatePluginViews()},ao={props:{configurable:!0},root:{configurable:!0}};ao.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&&Zn(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&&(_s(this),s=!0),this.state=t,r){var a=Fs(this);vu(a,this.nodeViews)&&(this.nodeViews=a,i=!0),Zn(this)}this.editable=Ls(this),zs(this);var c=so(this),l=Bs(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&&sl(this);if(s){this.domObserver.stop();var d=f&&(C.ie||C.chrome)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&mu(o.selection,t.selection);if(f){var h=C.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=Xi(t.doc,l,c,this.dom,this)),h&&!this.trackWrites&&(d=!0)}d||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&Il(this))?fe(this,d):(ls(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?Vi(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),v):Vi(this,this.coordsAtPos(t.selection.head,1),v))}else p&&al(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&&cl(this.dom),fe(this),this.domObserver.start()};ao.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 dl(this,t)};Q.prototype.coordsAtPos=function(t,r){return r===void 0&&(r=1),Wi(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 yl(this,r||this.state,t)};Q.prototype.destroy=function(){!this.docView||(Xl(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],so(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 Zl(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,ao);function Bs(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 zs(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 Ls(e){return!e.someProp("editable",function(t){return t(e.state)===!1})}function mu(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 Fs(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 vu(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 pe={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"},jr={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"},Vs=typeof navigator!="undefined"&&/Chrome\/(\d+)/.exec(navigator.userAgent),gu=typeof navigator!="undefined"&&/Apple Computer/.test(navigator.vendor),yu=typeof navigator!="undefined"&&/Gecko\/\d+/.test(navigator.userAgent),Hs=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),bu=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ku=Vs&&(Hs||+Vs[1]<57)||yu&&Hs;for(var st=0;st<10;st++)pe[48+st]=pe[96+st]=String(st);for(var st=1;st<=24;st++)pe[st+111]="F"+st;for(var st=65;st<=90;st++)pe[st]=String.fromCharCode(st+32),jr[st]=String.fromCharCode(st);for(var co in pe)jr.hasOwnProperty(co)||(jr[co]=pe[co]);function Su(e){var t=ku&&(e.ctrlKey||e.altKey||e.metaKey)||(gu||bu)&&e.shiftKey&&e.key&&e.key.length==1,r=!t&&e.key||(e.shiftKey?jr:pe)[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 Mu=typeof navigator!="undefined"?/Mac/.test(navigator.platform):!1;function Cu(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))Mu?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 xu(e){var t=Object.create(null);for(var r in e)t[Cu(r)]=e[r];return t}function lo(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 Ou(e){return new Rt({props:{handleKeyDown:js(e)}})}function js(e){var t=xu(e);return function(r,n){var o=Su(n),i=o.length==1&&o!=" ",s,a=t[lo(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=pe[n.keyCode])&&s!=o){var c=t[lo(s,n,!0)];if(c&&c(r.state,r.dispatch,r))return!0}else if(i&&n.shiftKey){var l=t[lo(o,n,!0)];if(l&&l(r.state,r.dispatch,r))return!0}return!1}}var Ut=function(t,r){this.match=t,this.handler=typeof r=="string"?wu(r):r};function wu(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 Tu=500;function Au(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 qs(o,i,s,a,t,r)},handleDOMEvents:{compositionend:function(n){setTimeout(function(){var o=n.state.selection,i=o.$cursor;i&&qs(n,i.pos,i.pos,"",t,r)})}}},isInputRules:!0});return r}function qs(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-Tu),a.parentOffset,null,"\uFFFC")+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 _u(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}new Ut(/--$/,"\u2014");new Ut(/\.\.\.$/,"\u2026");new Ut(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"\u201C");new Ut(/"$/,"\u201D");new Ut(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"\u2018");new Ut(/'$/,"\u2019");function uo(e,t,r,n){return new Ut(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&&Sn(f,t,c);if(!p)return null;l.wrap(f,p);var d=l.doc.resolve(s-1).nodeBefore;return d&&d.type==t&&Mn(l.doc,s-1)&&(!n||n(i,d))&&l.join(s-1),l})}function fo(e,t,r){return new Ut(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 po(e,t){return e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0)}function Js(e,t,r){var n=e.selection,o=n.$cursor;if(!o||(r?!r.endOfTextblock("backward",e):o.parentOffset>0))return!1;var i=Ks(o);if(!i){var s=o.blockRange(),a=s&&Pe(s);return a==null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)}var c=i.nodeBefore;if(!c.type.spec.isolating&&ra(e,i,t))return!0;if(o.parent.content.size==0&&(He(c,"end")||N.isSelectable(c))){if(t){var l=e.tr.deleteRange(o.before(),o.after());l.setSelection(He(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 He(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 Ws(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=Ks(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 Ks(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 $s(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(ra(e,i,t))return!0;if(o.parent.content.size==0&&(He(s,"start")||N.isSelectable(s))){if(t){var a=e.tr.deleteRange(o.before(),o.after());a.setSelection(He(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 Us(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&&Pe(i);return s==null?!1:(t&&t(e.tr.lift(i,s).scrollIntoView()),!0)}function Xs(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 ho(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 Qs(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=ho(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 Zs(e,t){var r=e.selection,n=r.$from,o=r.$to;if(r instanceof re||n.parent.inlineContent||o.parent.inlineContent)return!1;var i=ho(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(z.create(a.doc,s+1)),t(a.scrollIntoView())}return!0}function ta(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(ee(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}var i=n.blockRange(),s=i&&Pe(i);return s==null?!1:(t&&t(e.tr.lift(i,s).scrollIntoView()),!0)}function Nu(e,t){var r=e.selection,n=r.$from,o=r.$to;if(e.selection instanceof N&&e.selection.node.isBlock)return!n.parentOffset||!ee(e.doc,n.pos)?!1:(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.parent.isBlock)return!1;if(t){var i=o.parentOffset==o.parent.content.size,s=e.tr;(e.selection instanceof z||e.selection instanceof re)&&s.deleteSelection();var a=n.depth==0?null:ho(n.node(-1).contentMatchAt(n.indexAfter(-1))),c=i&&a?[{type:a}]:null,l=ee(s.doc,s.mapping.map(n.pos),1,c);if(!c&&!l&&ee(s.doc,s.mapping.map(n.pos),1,a&&[{type:a}])&&(c=[{type:a}],l=!0),l&&(s.split(s.mapping.map(n.pos),1,c),!i&&!n.parentOffset&&n.parent.type!=a)){var u=s.mapping.map(n.before()),f=s.doc.resolve(u);n.node(-1).canReplaceWith(f.index(),f.index()+1,a)&&s.setNodeMarkup(s.mapping.map(n.before()),a)}t(s.scrollIntoView())}return!0}function Eu(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 ea(e,t){return t&&t(e.tr.setSelection(new re(e.doc))),!0}function Du(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||Mn(e.doc,t.pos))?!1:(r&&r(e.tr.clearIncompatible(t.pos,n.type,n.contentMatchAt(n.childCount)).join(t.pos).scrollIntoView()),!0)}function ra(e,t,r){var n=t.nodeBefore,o=t.nodeAfter,i,s;if(n.type.spec.isolating||o.type.spec.isolating)return!1;if(Du(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 St(t.pos-1,c,t.pos,c,new O(l,1,0),i.length,!0)),p=c+2*i.length;Mn(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&&Pe(h);if(v!=null&&v>=t.depth)return r&&r(e.tr.lift(h,v).scrollIntoView()),!0;if(a&&He(o,"start",!0)&&He(n,"end")){for(var g=n,M=[];M.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=M.length-1;D>=0;D--)m=k.from(M[D].copy(m));var x=e.tr.step(new St(t.pos-M.length,t.pos+o.nodeSize,t.pos+I,t.pos+o.nodeSize-I,new O(m,M.length,0),0,!0));r(x.scrollIntoView())}return!0}}return!1}function na(e,t){return function(r,n){var o=r.selection,i=o.$from,s=o.$to,a=i.blockRange(s),c=a&&Sn(a,e,t);return c?(n&&n(r.tr.wrap(a,c).scrollIntoView()),!0):!1}}function Iu(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}}function mo(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return function(r,n,o){for(var i=0;i<e.length;i++)if(e[i](r,n,o))return!0;return!1}}var oa=mo(po,Js,Ws),ia=mo(po,$s,Us),de={Enter:mo(Xs,Zs,ta,Nu),"Mod-Enter":Qs,Backspace:oa,"Mod-Backspace":oa,Delete:ia,"Mod-Delete":ia,"Mod-a":ea},Ru={"Ctrl-h":de.Backspace,"Alt-Backspace":de["Mod-Backspace"],"Ctrl-d":de.Delete,"Ctrl-Alt-Backspace":de["Mod-Delete"],"Alt-Delete":de["Mod-Delete"],"Alt-d":de["Mod-Delete"]};for(var sa in de)Ru[sa]=de[sa];typeof navigator!="undefined"?/Mac/.test(navigator.platform):typeof os!="undefined"&&os.platform()=="darwin";function Pu(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 Ge(u,u,a.depth),a.endIndex<a.parent.childCount&&(a=new Ge(i,r.doc.resolve(s.end(a.depth)),a.depth)),c=!0}var f=Sn(l,e,t,a);return f?(n&&n(Bu(r.tr,a,f,c,e).scrollIntoView()),!0):!1}}function Bu(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 St(t.start-(n?2:0),t.end,t.start,t.end,new O(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&&ee(e.doc,u,l)&&(e.split(u,l),u+=2*l),u+=f.child(p).nodeSize;return e}function zu(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?Lu(t,r,e,s):Fu(t,r,s):!0:!1}}function Lu(e,t,r,n){var o=e.tr,i=n.end,s=n.$to.end(n.depth);return i<s&&(o.step(new St(i-1,s,i,s,new O(k.from(r.create(null,n.parent.copy())),1,0),1,!0)),n=new Ge(o.doc.resolve(n.$from.pos),o.doc.resolve(s),n.depth)),t(o.lift(n,Pe(n)).scrollIntoView()),!0}function Fu(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 St(h-(u?1:0),v+(f?1:0),h+1,v-1,new O((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 Vu(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 O(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 St(d-(u?3:1),h,d,h,p,1,!0)).scrollIntoView())}return!0}}function qr(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function Z(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 Hu(e,t){const r=Z(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({},s.attrs):{}}function he(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 aa(e,t){const r=he(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?S({},a.attrs):{}}function ju(e,t){const r=qr(typeof t=="string"?t:t.name,e.schema);return r==="node"?Hu(e,t):r==="mark"?aa(e,t):{}}function pr(e,t){const r=Object.keys(t);return r.length?!!r.filter(n=>t[n]===e[n]).length:!0}function je(e,t,r={}){const{from:n,to:o,empty:i}=e.selection,s=t?Z(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=>pr(u.node.attrs,r));const c=o-n;return a.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>pr(u.node.attrs,r)).reduce((u,f)=>{const p=f.to-f.from;return u+p},0)>=c}function vo(e,t,r={}){const{from:n,to:o,empty:i}=e.selection,s=t?he(t,e.schema):null;if(i)return!!(e.storedMarks||e.selection.$from.marks()).filter(p=>s?s.name===p.type.name:!0).find(p=>pr(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);a+=v-h,c=[...c,...p.marks.map(M=>({mark:M,from:h,to:v}))]}}),a===0)return!1;const l=c.filter(p=>s?s.name===p.mark.type.name:!0).filter(p=>pr(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 qu(e,t,r={}){if(!t)return je(e,null,r)||vo(e,null,r);const n=qr(t,e.schema);return n==="node"?je(e,t,r):n==="mark"?vo(e,t,r):!1}function Ju(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ca(e){const t=`<body>${e}</body>`;return new window.DOMParser().parseFromString(t,"text/html").body}function Jr(e,t,r){if(r=S({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),Jr("",t,r)}if(typeof e=="string"){const n=Lt.fromSchema(t);return r.slice?n.parseSlice(ca(e),r.parseOptions).content:n.parse(ca(e),r.parseOptions)}return Jr("",t,r)}function la(e,t,r={}){return Jr(e,t,{slice:!1,parseOptions:r})}function Wu(e,t){const r=nt.fromSchema(t).serializeFragment(e.content),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(r),o.innerHTML}function Ku(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 $u(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 Uu{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=wt(S({},Object.fromEntries(Object.entries(n).map(([p,d])=>[p,(...v)=>{const g=this.buildProps(l,r),M=d(...v)(g);return a.push(M),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),c=Object.fromEntries(Object.entries(r).map(([l,u])=>[l,(...f)=>u(...f)(wt(S({},a),{dispatch:i}))]));return wt(S({},c),{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 wt(S({},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 T(e,t,r={}){return e.config[t]===void 0&&e.parent?T(e.parent,t,r):typeof e.config[t]=="function"?e.config[t].bind(wt(S({},r),{parent:e.parent?T(e.parent,t,r):null})):e.config[t]}function dr(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 ua(e){const t=[],{nodeExtensions:r,markExtensions:n}=dr(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=T(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:S(S({},i),d)})})})})}),o.forEach(s=>{const a={name:s.name,options:s.options},c=T(s,"addAttributes",a);if(!c)return;const l=c();Object.entries(l).forEach(([u,f])=>{t.push({type:s.name,name:u,attribute:S(S({},i),f)})})}),t}function Ct(...e){return e.filter(t=>!!t).reduce((t,r)=>{const n=S({},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 go(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 Gu(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Yu(e){return typeof e!="string"?e:e.match(/^\d*(\.\d+)?$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function fa(e,t){return e.style?e:wt(S({},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]:Yu(r.getAttribute(s.name))},c=Object.fromEntries(Object.entries(a).filter(([,l])=>l!=null));return S(S({},i),c)},{});return S(S({},n),o)}})}function tt(e,t=void 0,...r){return typeof e=="function"?t?e.bind(t)(...r):e(...r):e}function pa(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>t==="attrs"&&Gu(r)?!1:r!=null))}function Xu(e){var t;const r=ua(e),{nodeExtensions:n,markExtensions:o}=dr(e),i=(t=n.find(c=>T(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 M=T(g,"extendNodeSchema",u);return S(S({},v),M?M(c):{})},{}),p=pa(wt(S({},f),{content:tt(T(c,"content",u)),marks:tt(T(c,"marks",u)),group:tt(T(c,"group",u)),inline:tt(T(c,"inline",u)),atom:tt(T(c,"atom",u)),selectable:tt(T(c,"selectable",u)),draggable:tt(T(c,"draggable",u)),code:tt(T(c,"code",u)),defining:tt(T(c,"defining",u)),isolating:tt(T(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=tt(T(c,"parseHTML",u));d&&(p.parseDOM=d.map(v=>fa(v,l)));const h=T(c,"renderHTML",u);return h&&(p.toDOM=v=>h({node:v,HTMLAttributes:go(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 M=T(g,"extendMarkSchema",u);return S(S({},v),M?M(c):{})},{}),p=pa(wt(S({},f),{inclusive:tt(T(c,"inclusive",u)),excludes:tt(T(c,"excludes",u)),group:tt(T(c,"group",u)),spanning:tt(T(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=tt(T(c,"parseHTML",u));d&&(p.parseDOM=d.map(v=>fa(v,l)));const h=T(c,"renderHTML",u);return h&&(p.toDOM=v=>h({mark:v,HTMLAttributes:go(v,l)})),[c.name,p]}));return new Se({topNode:i,nodes:s,marks:a})}function yo(e,t){return t.nodes[e]?t.nodes[e]:t.marks[e]?t.marks[e]:null}class hr{constructor(t,r){this.splittableMarks=[],this.editor=r,this.extensions=hr.resolve(t),this.schema=Xu(this.extensions),this.extensions.forEach(n=>{var o;const i={name:n.name,options:n.options,editor:this.editor,type:yo(n.name,this.schema)};n.type==="mark"&&((o=tt(T(n,"keepOnSplit",i)))!==null&&o!==void 0?o:!0)&&this.splittableMarks.push(n.name);const s=T(n,"onBeforeCreate",i);s&&this.editor.on("beforeCreate",s);const a=T(n,"onCreate",i);a&&this.editor.on("create",a);const c=T(n,"onUpdate",i);c&&this.editor.on("update",c);const l=T(n,"onSelectionUpdate",i);l&&this.editor.on("selectionUpdate",l);const u=T(n,"onTransaction",i);u&&this.editor.on("transaction",u);const f=T(n,"onFocus",i);f&&this.editor.on("focus",f);const p=T(n,"onBlur",i);p&&this.editor.on("blur",p);const d=T(n,"onDestroy",i);d&&this.editor.on("destroy",d)})}static resolve(t){return hr.sort(hr.flatten(t))}static flatten(t){return t.map(r=>{const n={name:r.name,options:r.options},o=T(r,"addExtensions",n);return o?[r,...this.flatten(o())]:r}).flat(10)}static sort(t){const r=100;return t.sort((n,o)=>{const i=T(n,"priority")||r,s=T(o,"priority")||r;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:yo(r.name,this.schema)},o=T(r,"addCommands",n);return o?S(S({},t),o()):t},{})}get plugins(){return[...this.extensions].reverse().map(t=>{const r={name:t.name,options:t.options,editor:this.editor,type:yo(t.name,this.schema)},n=[],o=T(t,"addKeyboardShortcuts",r);if(o){const c=Object.fromEntries(Object.entries(o()).map(([u,f])=>[u,()=>f({editor:this.editor})])),l=Ou(c);n.push(l)}const i=T(t,"addInputRules",r);if(this.editor.options.enableInputRules&&i){const c=i(),l=c.length?[Au({rules:c})]:[];n.push(...l)}const s=T(t,"addPasteRules",r);if(this.editor.options.enablePasteRules&&s){const c=s();n.push(...c)}const a=T(t,"addProseMirrorPlugins",r);if(a){const c=a();n.push(...c)}return n}).flat()}get attributes(){return ua(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:r}=dr(this.extensions);return Object.fromEntries(r.filter(n=>!!T(n,"addNodeView")).map(n=>{const o=this.attributes.filter(c=>c.type===n.name),i={name:n.name,options:n.options,editor:t,type:Z(n.name,this.schema)},s=T(n,"addNodeView",i);if(!s)return[];const a=(c,l,u,f)=>{const p=go(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}=dr(this.extensions);return Object.fromEntries(r.filter(n=>!!T(n,"renderText")).map(n=>{const o={name:n.name,options:n.options,editor:t,type:Z(n.name,this.schema)},i=T(n,"renderText",o);if(!i)return[];const s=a=>i(a);return[n.name,s]}))}}class Qu{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 Zu(e){return Object.prototype.toString.call(e).slice(8,-1)}function bo(e){return Zu(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Wr(e,t){const r=S({},e);return bo(e)&&bo(t)&&Object.keys(t).forEach(n=>{bo(t[n])?n in e?r[n]=Wr(e[n],t[n]):Object.assign(r,{[n]:t[n]}):Object.assign(r,{[n]:t[n]})}),r}class xt{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=S(S({},this.config),t),this.name=this.config.name,this.options=this.config.defaultOptions}static create(t={}){return new xt(t)}configure(t={}){const r=this.extend();return r.options=Wr(this.options,t),r}extend(t={}){const r=new xt(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 tf=(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},ef=xt.create({name:"editable",addProseMirrorPlugins(){return[new Rt({key:new Wt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{from:t,to:r}=e.state.selection;return tf(e,t,r,`
|
|
`)}}})]}}),rf=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{e.isDestroyed||t.dom.blur()}),!0);var nf=Object.freeze({__proto__:null,blur:rf});const of=(e=!1)=>({commands:t})=>t.setContent("",e);var sf=Object.freeze({__proto__:null,clearContent:of});const af=()=>({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=Pe(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 cf=Object.freeze({__proto__:null,clearNodes:af});const lf=e=>t=>e(t);var uf=Object.freeze({__proto__:null,command:lf});const ff=()=>({state:e,dispatch:t})=>Zs(e,t);var pf=Object.freeze({__proto__:null,createParagraphNear:ff});const df=e=>({tr:t,state:r,dispatch:n})=>{const o=Z(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 hf=Object.freeze({__proto__:null,deleteNode:df});const mf=e=>({tr:t,dispatch:r})=>{const{from:n,to:o}=e;return r&&t.delete(n,o),!0};var vf=Object.freeze({__proto__:null,deleteRange:mf});const gf=()=>({state:e,dispatch:t})=>po(e,t);var yf=Object.freeze({__proto__:null,deleteSelection:gf});const bf=()=>({commands:e})=>e.keyboardShortcut("Enter");var kf=Object.freeze({__proto__:null,enter:bf});const Sf=()=>({state:e,dispatch:t})=>Qs(e,t);var Mf=Object.freeze({__proto__:null,exitCode:Sf});function ko(e,t,r={}){return e.find(n=>n.type===t&&pr(n.attrs,r))}function Cf(e,t,r={}){return!!ko(e,t,r)}function da(e,t,r={}){if(!e||!t)return;const n=e.parent.childAfter(e.parentOffset);if(!n.node)return;const o=ko(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(ko(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&&Cf(e.parent.child(a).marks,t,r);)c+=e.parent.child(a).nodeSize,a+=1;return{from:s,to:c}}const xf=(e,t={})=>({tr:r,state:n,dispatch:o})=>{const i=he(e,n.schema),{doc:s,selection:a}=r,{$from:c,from:l,to:u}=a;if(o){const f=da(c,i,t);if(f&&f.from<=l&&f.to>=u){const p=z.create(s,f.from,f.to);r.setSelection(p)}}return!0};var Of=Object.freeze({__proto__:null,extendMarkRange:xf});const wf=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 Tf=Object.freeze({__proto__:null,first:wf});function mr(e=0,t=0,r=0){return Math.min(Math.max(e,t),r)}function Af(e){var t;return((t=e.constructor)===null||t===void 0?void 0:t.toString().substring(0,5))==="class"}function ha(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!Af(e)}function ma(e){return ha(e)&&e instanceof z}function _f(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 Nf=(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&&!ma(t.state.selection))return i(),!0;const{from:s,to:a}=_f(t.state,e)||t.state.selection,{doc:c,storedMarks:l}=n,u=E.atStart(c).from,f=E.atEnd(c).to,p=mr(s,u,f),d=mr(a,u,f),h=z.create(c,p,d),v=t.state.selection.eq(h);return o&&(v||n.setSelection(h),v&&l&&n.setStoredMarks(l),i()),!0};var Ef=Object.freeze({__proto__:null,focus:Nf});const Df=(e,t)=>r=>e.every((n,o)=>t(n,wt(S({},r),{index:o})));var If=Object.freeze({__proto__:null,forEach:Df});const Rf=(e,t)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},e,t);var Pf=Object.freeze({__proto__:null,insertContent:Rf});function Bf(e,t,r){const n=e.steps.length-1;if(n<t)return;const o=e.steps[n];if(!(o instanceof te||o instanceof St))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 zf=(e,t,r)=>({tr:n,dispatch:o,editor:i})=>{if(o){const s=Jr(t,i.schema,S({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),Bf(n,n.steps.length-1,1)}return!0};var Lf=Object.freeze({__proto__:null,insertContentAt:zf});const Ff=()=>({state:e,dispatch:t})=>Js(e,t);var Vf=Object.freeze({__proto__:null,joinBackward:Ff});const Hf=()=>({state:e,dispatch:t})=>$s(e,t);var jf=Object.freeze({__proto__:null,joinForward:Hf});const qf=typeof navigator!="undefined"?/Mac/.test(navigator.platform):!1;function Jf(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))qf?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 Wf=e=>({editor:t,view:r,tr:n,dispatch:o})=>{const i=Jf(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 Kf=Object.freeze({__proto__:null,keyboardShortcut:Wf});const $f=(e,t={})=>({state:r,dispatch:n})=>{const o=Z(e,r.schema);return je(r,o,t)?Ys(r,n):!1};var Uf=Object.freeze({__proto__:null,lift:$f});const Gf=()=>({state:e,dispatch:t})=>ta(e,t);var Yf=Object.freeze({__proto__:null,liftEmptyBlock:Gf});const Xf=e=>({state:t,dispatch:r})=>{const n=Z(e,t.schema);return zu(n)(t,r)};var Qf=Object.freeze({__proto__:null,liftListItem:Xf});const Zf=()=>({state:e,dispatch:t})=>Xs(e,t);var tp=Object.freeze({__proto__:null,newlineInCode:Zf});function va(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 ep=(e,t)=>({tr:r,state:n,dispatch:o})=>{let i=null,s=null;const a=qr(typeof e=="string"?e:e.name,n.schema);return a?(a==="node"&&(i=Z(e,n.schema)),a==="mark"&&(s=he(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,va(l.attrs,t)),s&&l.marks.length&&l.marks.forEach(f=>{s===f.type&&r.addMark(u,u+l.nodeSize,s.create(va(f.attrs,t)))})})}),!0):!1};var rp=Object.freeze({__proto__:null,resetAttributes:ep});const np=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0);var op=Object.freeze({__proto__:null,scrollIntoView:np});const ip=()=>({state:e,dispatch:t})=>ea(e,t);var sp=Object.freeze({__proto__:null,selectAll:ip});const ap=()=>({state:e,dispatch:t})=>Ws(e,t);var cp=Object.freeze({__proto__:null,selectNodeBackward:ap});const lp=()=>({state:e,dispatch:t})=>Us(e,t);var up=Object.freeze({__proto__:null,selectNodeForward:lp});const fp=()=>({state:e,dispatch:t})=>Eu(e,t);var pp=Object.freeze({__proto__:null,selectParentNode:fp});const dp=(e,t=!1,r={})=>({tr:n,editor:o,dispatch:i})=>{const{doc:s}=n,a=la(e,o.schema,r),c=z.create(s,0,s.content.size);return i&&n.setSelection(c).replaceSelectionWith(a,!1).setMeta("preventUpdate",!t),!0};var hp=Object.freeze({__proto__:null,setContent:dp});const mp=(e,t={})=>({tr:r,state:n,dispatch:o})=>{const{selection:i}=r,{empty:s,ranges:a}=i,c=he(e,n.schema);if(o)if(s){const l=aa(n,c);r.addStoredMark(c.create(S(S({},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(M=>M.type===c)?p.marks.forEach(M=>{c===M.type&&r.addMark(h,v,c.create(S(S({},M.attrs),t)))}):r.addMark(h,v,c.create(t))})});return!0};var vp=Object.freeze({__proto__:null,setMark:mp});const gp=(e,t)=>({tr:r})=>(r.setMeta(e,t),!0);var yp=Object.freeze({__proto__:null,setMeta:gp});const bp=(e,t={})=>({state:r,dispatch:n})=>{const o=Z(e,r.schema);return Iu(o,t)(r,n)};var kp=Object.freeze({__proto__:null,setNode:bp});const Sp=e=>({tr:t,dispatch:r})=>{if(r){const{doc:n}=t,o=E.atStart(n).from,i=E.atEnd(n).to,s=mr(e,o,i),a=N.create(n,s);t.setSelection(a)}return!0};var Mp=Object.freeze({__proto__:null,setNodeSelection:Sp});const Cp=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=mr(o,s,a),l=mr(i,s,a),u=z.create(n,c,l);t.setSelection(u)}return!0};var xp=Object.freeze({__proto__:null,setTextSelection:Cp});const Op=e=>({state:t,dispatch:r})=>{const n=Z(e,t.schema);return Vu(n)(t,r)};var wp=Object.freeze({__proto__:null,sinkListItem:Op});function Kr(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 Tp(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 ga(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 Ap=({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=Kr(l,a.node().type.name,a.node().attrs);if(i instanceof N&&i.node.isBlock)return!a.parentOffset||!ee(s,a.pos)?!1:(n&&(e&&ga(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 z&&t.deleteSelection();const p=a.depth===0?void 0:Tp(a.node(-1).contentMatchAt(a.indexAfter(-1)));let d=f&&p?[{type:p,attrs:u}]:void 0,h=ee(t.doc,t.mapping.map(a.pos),1,d);if(!d&&!h&&ee(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&&ga(r,o.extensionManager.splittableMarks),t.scrollIntoView()}return!0};var _p=Object.freeze({__proto__:null,splitBlock:Ap});const Np=e=>({tr:t,state:r,dispatch:n,editor:o})=>{var i;const s=Z(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 M=a.index(-1)?1:a.index(-2)?2:3;for(let F=a.depth-M;F>=a.depth-3;F-=1)g=k.from(a.node(F).copy(g));const y=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,I=Kr(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-(M-1));t.replace(D,a.after(-y),new O(g,4-M,0));let x=-1;t.doc.nodesBetween(D,t.doc.content.size,(F,W)=>{if(x>-1)return!1;F.isTextblock&&F.content.size===0&&(x=W+1)}),x>-1&&t.setSelection(z.near(t.doc.resolve(x))),t.scrollIntoView()}return!0}const p=c.pos===a.end()?u.contentMatchAt(0).defaultType:null,d=Kr(f,u.type.name,u.attrs),h=Kr(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 ee(t.doc,a.pos,2)?(n&&t.split(a.pos,2,v).scrollIntoView(),!0):!1};var Ep=Object.freeze({__proto__:null,splitListItem:Np});function Dp(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 Ip(e){return t=>Dp(t.$from,e)}function ya(e,t){const{nodeExtensions:r}=dr(t),n=r.find(s=>s.name===e);if(!n)return!1;const o={name:n.name,options:n.options},i=tt(T(n,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}const Rp=(e,t)=>({editor:r,tr:n,state:o,dispatch:i,chain:s,commands:a,can:c})=>{const{extensions:l}=r.extensionManager,u=Z(e,o.schema),f=Z(t,o.schema),{selection:p}=o,{$from:d,$to:h}=p,v=d.blockRange(h);if(!v)return!1;const g=Ip(y=>ya(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(ya(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 Pp=Object.freeze({__proto__:null,toggleList:Rp});const Bp=(e,t={})=>({state:r,commands:n})=>{const o=he(e,r.schema);return vo(r,o,t)?n.unsetMark(o):n.setMark(o,t)};var zp=Object.freeze({__proto__:null,toggleMark:Bp});const Lp=(e,t,r={})=>({state:n,commands:o})=>{const i=Z(e,n.schema),s=Z(t,n.schema);return je(n,i,r)?o.setNode(s):o.setNode(i,r)};var Fp=Object.freeze({__proto__:null,toggleNode:Lp});const Vp=(e,t={})=>({state:r,dispatch:n})=>{const o=Z(e,r.schema);return je(r,o,t)?Ys(r,n):na(o,t)(r,n)};var Hp=Object.freeze({__proto__:null,toggleWrap:Vp});const jp=()=>({state:e,dispatch:t})=>_u(e,t);var qp=Object.freeze({__proto__:null,undoInputRule:jp});const Jp=()=>({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 Wp=Object.freeze({__proto__:null,unsetAllMarks:Jp});const Kp=e=>({tr:t,state:r,dispatch:n})=>{const{selection:o}=t,i=he(e,r.schema),{$from:s,empty:a,ranges:c}=o;if(n){if(a){let{from:l,to:u}=o;const f=da(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 $p=Object.freeze({__proto__:null,unsetMark:Kp});const Up=(e,t={})=>({tr:r,state:n,dispatch:o})=>{let i=null,s=null;const a=qr(typeof e=="string"?e:e.name,n.schema);return a?(a==="node"&&(i=Z(e,n.schema)),a==="mark"&&(s=he(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,S(S({},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(S(S({},d.attrs),t)))}})})}),!0):!1};var Gp=Object.freeze({__proto__:null,updateAttributes:Up});const Yp=(e,t={})=>({state:r,dispatch:n})=>{const o=Z(e,r.schema);return je(r,o,t)?!1:na(o,t)(r,n)};var Xp=Object.freeze({__proto__:null,wrapIn:Yp});const Qp=(e,t={})=>({state:r,dispatch:n})=>{const o=Z(e,r.schema);return Pu(o,t)(r,n)};var Zp=Object.freeze({__proto__:null,wrapInList:Qp});const td=xt.create({name:"commands",addCommands(){return S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S({},nf),sf),cf),uf),pf),hf),vf),yf),kf),Mf),Of),Tf),Ef),If),Pf),Lf),Vf),jf),Kf),Uf),Yf),Qf),tp),rp),op),sp),cp),up),pp),hp),vp),yp),kp),Mp),xp),wp),_p),Ep),Pp),zp),Fp),Hp),qp),Wp),$p),Gp),Xp),Zp)}}),ed=xt.create({name:"editable",addProseMirrorPlugins(){return[new Rt({key:new Wt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),rd=xt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Rt({key:new Wt("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}}}})]}}),nd=xt.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 od=Object.freeze({__proto__:null,ClipboardTextSerializer:ef,Commands:td,Editable:ed,FocusEvents:rd,Keymap:nd});const id=`.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
|
|
}`;class sd extends Qu{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=$u(id))}setOptions(t={}){this.options=S(S({},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(od).map(([,n])=>n),...this.options.extensions].filter(n=>["extension","node","mark"].includes(n==null?void 0:n.type));this.extensionManager=new hr(r,this)}createCommandManager(){this.commandManager=new Uu(this,this.extensionManager.commands)}createSchema(){this.schema=this.extensionManager.schema}createView(){this.view=new Q(this.options.element,wt(S({},this.options.editorProps),{dispatchTransaction:this.dispatchTransaction.bind(this),state:mt.create({doc:la(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 ju(this.state,t)}isActive(t,r){const n=typeof t=="string"?t:null,o=typeof t=="string"?r:t;return qu(this.state,n,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Wu(this.state.doc,this.schema)}get isEmpty(){return Ku(this.state.doc)}getCharacterCount(){return this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners(),Ju(this.css)}get isDestroyed(){var t;return!((t=this.view)===null||t===void 0?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=S(S({},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=Wr(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 Te{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=S(S({},this.config),t),this.name=this.config.name,this.options=this.config.defaultOptions}static create(t={}){return new Te(t)}configure(t={}){const r=this.extend();return r.options=Wr(this.options,t),r}extend(t={}){const r=new Te(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 ad(e,t,r){return new Ut(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 cd(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 qe(e,t,r){return new Ut(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(cd(i,s,n).filter(g=>{const{excluded:M}=g.mark.type;return M.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 Je(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?void 0: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]),M=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,M).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 Wt("markPasteRule"),props:{transformPasted:o=>new O(n(o.content),o.openStart,o.openEnd)}})}function ld(e){return ha(e)&&e instanceof N}function ba(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 wt(S({},d),{toJSON:()=>d})}var ud="tippy-box",ka="tippy-content",fd="tippy-backdrop",Sa="tippy-arrow",Ma="tippy-svg-arrow",Ae={passive:!0,capture:!0};function So(e,t,r){if(Array.isArray(e)){var n=e[t];return n==null?Array.isArray(r)?r[t]:r:n}return e}function Mo(e,t){var r={}.toString.call(e);return r.indexOf("[object")===0&&r.indexOf(t+"]")>-1}function Ca(e,t){return typeof e=="function"?e.apply(void 0,t):e}function xa(e,t){if(t===0)return e;var r;return function(n){clearTimeout(r),r=setTimeout(function(){e(n)},t)}}function pd(e){return e.split(/\s+/).filter(Boolean)}function vr(e){return[].concat(e)}function Oa(e,t){e.indexOf(t)===-1&&e.push(t)}function dd(e){return e.filter(function(t,r){return e.indexOf(t)===r})}function hd(e){return e.split("-")[0]}function $r(e){return[].slice.call(e)}function md(e){return Object.keys(e).reduce(function(t,r){return e[r]!==void 0&&(t[r]=e[r]),t},{})}function gr(){return document.createElement("div")}function Ur(e){return["Element","Fragment"].some(function(t){return Mo(e,t)})}function vd(e){return Mo(e,"NodeList")}function gd(e){return Mo(e,"MouseEvent")}function yd(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function bd(e){return Ur(e)?[e]:vd(e)?$r(e):Array.isArray(e)?e:$r(document.querySelectorAll(e))}function Co(e,t){e.forEach(function(r){r&&(r.style.transitionDuration=t+"ms")})}function wa(e,t){e.forEach(function(r){r&&r.setAttribute("data-state",t)})}function kd(e){var t,r=vr(e),n=r[0];return(n==null||(t=n.ownerDocument)==null?void 0:t.body)?n.ownerDocument:document}function Sd(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=hd(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,M=i.left-r+d>c,y=r-i.right-h>c;return v||g||M||y})}function xo(e,t,r){var n=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(o){e[n](o,r)})}var Gt={isTouch:!1},Ta=0;function Md(){Gt.isTouch||(Gt.isTouch=!0,window.performance&&document.addEventListener("mousemove",Aa))}function Aa(){var e=performance.now();e-Ta<20&&(Gt.isTouch=!1,document.removeEventListener("mousemove",Aa)),Ta=e}function Cd(){var e=document.activeElement;if(yd(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function xd(){document.addEventListener("touchstart",Md,Ae),window.addEventListener("blur",Cd)}var Od=typeof window!="undefined"&&typeof document!="undefined",wd=Od?navigator.userAgent:"",Td=/MSIE |Trident\//.test(wd),Ad={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},_d={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Ht=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},Ad,{},_d),Nd=Object.keys(Ht),Ed=function(t){var r=Object.keys(t);r.forEach(function(n){Ht[n]=t[n]})};function _a(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 Dd(e,t){var r=t?Object.keys(_a(Object.assign({},Ht,{plugins:t}))):Nd,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 Na(e,t){var r=Object.assign({},t,{content:Ca(t.content,[e])},t.ignoreAttributes?{}:Dd(e,t.plugins));return r.aria=Object.assign({},Ht.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 Id=function(){return"innerHTML"};function Oo(e,t){e[Id()]=t}function Ea(e){var t=gr();return e===!0?t.className=Sa:(t.className=Ma,Ur(e)?t.appendChild(e):Oo(t,e)),t}function Da(e,t){Ur(t.content)?(Oo(e,""),e.appendChild(t.content)):typeof t.content!="function"&&(t.allowHTML?Oo(e,t.content):e.textContent=t.content)}function wo(e){var t=e.firstElementChild,r=$r(t.children);return{box:t,content:r.find(function(n){return n.classList.contains(ka)}),arrow:r.find(function(n){return n.classList.contains(Sa)||n.classList.contains(Ma)}),backdrop:r.find(function(n){return n.classList.contains(fd)})}}function Ia(e){var t=gr(),r=gr();r.className=ud,r.setAttribute("data-state","hidden"),r.setAttribute("tabindex","-1");var n=gr();n.className=ka,n.setAttribute("data-state","hidden"),Da(n,e.props),t.appendChild(r),r.appendChild(n),o(e.props,e.props);function o(i,s){var a=wo(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)&&Da(l,e.props),s.arrow?u?i.arrow!==s.arrow&&(c.removeChild(u),c.appendChild(Ea(s.arrow))):c.appendChild(Ea(s.arrow)):u&&c.removeChild(u)}return{popper:t,onUpdate:o}}Ia.$$tippy=!0;var Rd=1,Gr=[],To=[];function Pd(e,t){var r=Na(e,Object.assign({},Ht,{},_a(md(t)))),n,o,i,s=!1,a=!1,c=!1,l=!1,u,f,p,d=[],h=xa(Lo,r.interactiveDebounce),v,g=Rd++,M=null,y=dd(r.plugins),I={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},m={id:g,reference:e,popper:gr(),popperInstance:M,props:r,state:I,plugins:y,clearDelayTimeouts:Ua,setProps:Ga,setContent:Ya,show:Xa,hide:Qa,hideWithInteractivity:Za,enable:Ka,disable:$a,unmount:tc,destroy:ec};if(!r.render)return m;var D=r.render(m),x=D.popper,F=D.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+m.id,m.popper=x,e._tippy=m,x._tippy=m;var W=y.map(function(b){return b.fn(m)}),$=e.hasAttribute("aria-expanded");return Po(),Ke(),oe(),Nt("onCreate",[m]),r.showOnCreate&&Jo(),x.addEventListener("mouseenter",function(){m.props.interactive&&m.state.isVisible&&m.clearDelayTimeouts()}),x.addEventListener("mouseleave",function(b){m.props.interactive&&m.props.trigger.indexOf("mouseenter")>=0&&(qt().addEventListener("mousemove",h),h(b))}),m;function U(){var b=m.props.touch;return Array.isArray(b)?b:[b,0]}function Qt(){return U()[0]==="hold"}function et(){var b;return!!((b=m.props.render)==null?void 0:b.$$tippy)}function lt(){return v||e}function qt(){var b=lt().parentNode;return b?kd(b):document}function G(){return wo(x)}function Y(b){return m.state.isMounted&&!m.state.isVisible||Gt.isTouch||u&&u.type==="focus"?0:So(m.props.delay,b?0:1,Ht.delay)}function oe(){x.style.pointerEvents=m.props.interactive&&m.state.isVisible?"":"none",x.style.zIndex=""+m.props.zIndex}function Nt(b,w,A){if(A===void 0&&(A=!0),W.forEach(function(B){B[b]&&B[b].apply(void 0,w)}),A){var L;(L=m.props)[b].apply(L,w)}}function No(){var b=m.props.aria;if(!!b.content){var w="aria-"+b.content,A=x.id,L=vr(m.props.triggerTarget||e);L.forEach(function(B){var vt=B.getAttribute(w);if(m.state.isVisible)B.setAttribute(w,vt?vt+" "+A:A);else{var Et=vt&&vt.replace(A,"").trim();Et?B.setAttribute(w,Et):B.removeAttribute(w)}})}}function Ke(){if(!($||!m.props.aria.expanded)){var b=vr(m.props.triggerTarget||e);b.forEach(function(w){m.props.interactive?w.setAttribute("aria-expanded",m.state.isVisible&&w===lt()?"true":"false"):w.removeAttribute("aria-expanded")})}}function tn(){qt().removeEventListener("mousemove",h),Gr=Gr.filter(function(b){return b!==h})}function yr(b){if(!(Gt.isTouch&&(c||b.type==="mousedown"))&&!(m.props.interactive&&x.contains(b.target))){if(lt().contains(b.target)){if(Gt.isTouch||m.state.isVisible&&m.props.trigger.indexOf("click")>=0)return}else Nt("onClickOutside",[m,b]);m.props.hideOnClick===!0&&(m.clearDelayTimeouts(),m.hide(),a=!0,setTimeout(function(){a=!1}),m.state.isMounted||en())}}function Eo(){c=!0}function Do(){c=!1}function Io(){var b=qt();b.addEventListener("mousedown",yr,!0),b.addEventListener("touchend",yr,Ae),b.addEventListener("touchstart",Do,Ae),b.addEventListener("touchmove",Eo,Ae)}function en(){var b=qt();b.removeEventListener("mousedown",yr,!0),b.removeEventListener("touchend",yr,Ae),b.removeEventListener("touchstart",Do,Ae),b.removeEventListener("touchmove",Eo,Ae)}function qa(b,w){Ro(b,function(){!m.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&w()})}function Ja(b,w){Ro(b,w)}function Ro(b,w){var A=G().box;function L(B){B.target===A&&(xo(A,"remove",L),w())}if(b===0)return w();xo(A,"remove",f),xo(A,"add",L),f=L}function _e(b,w,A){A===void 0&&(A=!1);var L=vr(m.props.triggerTarget||e);L.forEach(function(B){B.addEventListener(b,w,A),d.push({node:B,eventType:b,handler:w,options:A})})}function Po(){Qt()&&(_e("touchstart",zo,{passive:!0}),_e("touchend",Fo,{passive:!0})),pd(m.props.trigger).forEach(function(b){if(b!=="manual")switch(_e(b,zo),b){case"mouseenter":_e("mouseleave",Fo);break;case"focus":_e(Td?"focusout":"blur",Vo);break;case"focusin":_e("focusout",Vo);break}})}function Bo(){d.forEach(function(b){var w=b.node,A=b.eventType,L=b.handler,B=b.options;w.removeEventListener(A,L,B)}),d=[]}function zo(b){var w,A=!1;if(!(!m.state.isEnabled||Ho(b)||a)){var L=((w=u)==null?void 0:w.type)==="focus";u=b,v=b.currentTarget,Ke(),!m.state.isVisible&&gd(b)&&Gr.forEach(function(B){return B(b)}),b.type==="click"&&(m.props.trigger.indexOf("mouseenter")<0||s)&&m.props.hideOnClick!==!1&&m.state.isVisible?A=!0:Jo(b),b.type==="click"&&(s=!A),A&&!L&&br(b)}}function Lo(b){var w=b.target,A=lt().contains(w)||x.contains(w);if(!(b.type==="mousemove"&&A)){var L=rn().concat(x).map(function(B){var vt,Et=B._tippy,Ne=(vt=Et.popperInstance)==null?void 0:vt.state;return Ne?{popperRect:B.getBoundingClientRect(),popperState:Ne,props:r}:null}).filter(Boolean);Sd(L,b)&&(tn(),br(b))}}function Fo(b){var w=Ho(b)||m.props.trigger.indexOf("click")>=0&&s;if(!w){if(m.props.interactive){m.hideWithInteractivity(b);return}br(b)}}function Vo(b){m.props.trigger.indexOf("focusin")<0&&b.target!==lt()||m.props.interactive&&b.relatedTarget&&x.contains(b.relatedTarget)||br(b)}function Ho(b){return Gt.isTouch?Qt()!==b.type.indexOf("touch")>=0:!1}function jo(){qo();var b=m.props,w=b.popperOptions,A=b.placement,L=b.offset,B=b.getReferenceClientRect,vt=b.moveTransition,Et=et()?wo(x).arrow:null,Ne=B?{getBoundingClientRect:B,contextElement:B.contextElement||lt()}:e,Wo={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(kr){var Ee=kr.state;if(et()){var rc=G(),on=rc.box;["placement","reference-hidden","escaped"].forEach(function(Sr){Sr==="placement"?on.setAttribute("data-placement",Ee.placement):Ee.attributes.popper["data-popper-"+Sr]?on.setAttribute("data-"+Sr,""):on.removeAttribute("data-"+Sr)}),Ee.attributes.popper={}}}},ge=[{name:"offset",options:{offset:L}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!vt}},Wo];et()&&Et&&ge.push({name:"arrow",options:{element:Et,padding:3}}),ge.push.apply(ge,(w==null?void 0:w.modifiers)||[]),m.popperInstance=ac(Ne,x,Object.assign({},w,{placement:A,onFirstUpdate:p,modifiers:ge}))}function qo(){m.popperInstance&&(m.popperInstance.destroy(),m.popperInstance=null)}function Wa(){var b=m.props.appendTo,w,A=lt();m.props.interactive&&b===Ht.appendTo||b==="parent"?w=A.parentNode:w=Ca(b,[A]),w.contains(x)||w.appendChild(x),jo()}function rn(){return $r(x.querySelectorAll("[data-tippy-root]"))}function Jo(b){m.clearDelayTimeouts(),b&&Nt("onTrigger",[m,b]),Io();var w=Y(!0),A=U(),L=A[0],B=A[1];Gt.isTouch&&L==="hold"&&B&&(w=B),w?n=setTimeout(function(){m.show()},w):m.show()}function br(b){if(m.clearDelayTimeouts(),Nt("onUntrigger",[m,b]),!m.state.isVisible){en();return}if(!(m.props.trigger.indexOf("mouseenter")>=0&&m.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(b.type)>=0&&s)){var w=Y(!1);w?o=setTimeout(function(){m.state.isVisible&&m.hide()},w):i=requestAnimationFrame(function(){m.hide()})}}function Ka(){m.state.isEnabled=!0}function $a(){m.hide(),m.state.isEnabled=!1}function Ua(){clearTimeout(n),clearTimeout(o),cancelAnimationFrame(i)}function Ga(b){if(!m.state.isDestroyed){Nt("onBeforeUpdate",[m,b]),Bo();var w=m.props,A=Na(e,Object.assign({},m.props,{},b,{ignoreAttributes:!0}));m.props=A,Po(),w.interactiveDebounce!==A.interactiveDebounce&&(tn(),h=xa(Lo,A.interactiveDebounce)),w.triggerTarget&&!A.triggerTarget?vr(w.triggerTarget).forEach(function(L){L.removeAttribute("aria-expanded")}):A.triggerTarget&&e.removeAttribute("aria-expanded"),Ke(),oe(),F&&F(w,A),m.popperInstance&&(jo(),rn().forEach(function(L){requestAnimationFrame(L._tippy.popperInstance.forceUpdate)})),Nt("onAfterUpdate",[m,b])}}function Ya(b){m.setProps({content:b})}function Xa(){var b=m.state.isVisible,w=m.state.isDestroyed,A=!m.state.isEnabled,L=Gt.isTouch&&!m.props.touch,B=So(m.props.duration,0,Ht.duration);if(!(b||w||A||L)&&!lt().hasAttribute("disabled")&&(Nt("onShow",[m],!1),m.props.onShow(m)!==!1)){if(m.state.isVisible=!0,et()&&(x.style.visibility="visible"),oe(),Io(),m.state.isMounted||(x.style.transition="none"),et()){var vt=G(),Et=vt.box,Ne=vt.content;Co([Et,Ne],0)}p=function(){var ge;if(!(!m.state.isVisible||l)){if(l=!0,x.offsetHeight,x.style.transition=m.props.moveTransition,et()&&m.props.animation){var nn=G(),kr=nn.box,Ee=nn.content;Co([kr,Ee],B),wa([kr,Ee],"visible")}No(),Ke(),Oa(To,m),(ge=m.popperInstance)==null||ge.forceUpdate(),m.state.isMounted=!0,Nt("onMount",[m]),m.props.animation&&et()&&Ja(B,function(){m.state.isShown=!0,Nt("onShown",[m])})}},Wa()}}function Qa(){var b=!m.state.isVisible,w=m.state.isDestroyed,A=!m.state.isEnabled,L=So(m.props.duration,1,Ht.duration);if(!(b||w||A)&&(Nt("onHide",[m],!1),m.props.onHide(m)!==!1)){if(m.state.isVisible=!1,m.state.isShown=!1,l=!1,s=!1,et()&&(x.style.visibility="hidden"),tn(),en(),oe(),et()){var B=G(),vt=B.box,Et=B.content;m.props.animation&&(Co([vt,Et],L),wa([vt,Et],"hidden"))}No(),Ke(),m.props.animation?et()&&qa(L,m.unmount):m.unmount()}}function Za(b){qt().addEventListener("mousemove",h),Oa(Gr,h),h(b)}function tc(){m.state.isVisible&&m.hide(),!!m.state.isMounted&&(qo(),rn().forEach(function(b){b._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x),To=To.filter(function(b){return b!==m}),m.state.isMounted=!1,Nt("onHidden",[m]))}function ec(){m.state.isDestroyed||(m.clearDelayTimeouts(),m.unmount(),Bo(),delete e._tippy,m.state.isDestroyed=!0,Nt("onDestroy",[m]))}}function We(e,t){t===void 0&&(t={});var r=Ht.plugins.concat(t.plugins||[]);xd();var n=Object.assign({},t,{plugins:r}),o=bd(e),i=o.reduce(function(s,a){var c=a&&Pd(a,n);return c&&s.push(c),s},[]);return Ur(e)?i[0]:i}We.defaultProps=Ht;We.setDefaultProps=Ed;We.currentInput=Gt;Object.assign({},sc,{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)}});We.setDefaultProps({render:Ia});class Bd{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&&ma(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?void 0:s.relatedTarget)&&((a=this.element.parentNode)===null||a===void 0?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=We(this.editor.options.element,S({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(ld(o.selection)){const d=t.nodeDOM(u);if(d)return d.getBoundingClientRect()}return ba(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 Ra=e=>new Rt({key:typeof e.pluginKey=="string"?new Wt(e.pluginKey):e.pluginKey,view:t=>new Bd(S({view:t},e))});xt.create({name:"bubbleMenu",defaultOptions:{element:null,tippyOptions:{},pluginKey:"bubbleMenu",shouldShow:null},addProseMirrorPlugins(){return this.options.element?[Ra({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});class zd{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?void 0:s.relatedTarget)&&((a=this.element.parentNode)===null||a===void 0?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=We(this.editor.options.element,S({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:()=>ba(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 Pa=e=>new Rt({key:typeof e.pluginKey=="string"?new Wt(e.pluginKey):e.pluginKey,view:t=>new zd(S({view:t},e))});xt.create({name:"floatingMenu",defaultOptions:{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null},addProseMirrorPlugins(){return this.options.element?[Pa({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});$e({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=Cr(null);return sn(()=>{const{pluginKey:n,editor:o,tippyOptions:i,shouldShow:s}=e;o.registerPlugin(Ra({pluginKey:n,editor:o,element:r.value,tippyOptions:i,shouldShow:s}))}),xr(()=>{const{pluginKey:n,editor:o}=e;o.unregisterPlugin(n)}),()=>{var n;return ye("div",{ref:r},(n=t.default)===null||n===void 0?void 0:n.call(t))}}});function Ld(e){return hc((t,r)=>({get(){return t(),e},set(n){e=n,requestAnimationFrame(()=>{requestAnimationFrame(()=>{r()})})}}))}class Fd extends sd{constructor(t={}){super(t);return this.vueRenderers=dc(new Map),this.contentComponent=null,this.reactiveState=Ld(this.view.state),this.on("transaction",()=>{this.reactiveState.value=this.view.state}),mc(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 Vd=$e({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(e){const t=Cr(),r=cc();return lc(()=>{const n=e.editor;n&&n.options.element&&t.value&&uc(()=>{if(!t.value||!n.options.element.firstChild)return;const o=fc(t.value);t.value.append(...n.options.element.childNodes),n.contentComponent=r.ctx._,n.setOptions({element:o}),n.createNodeViews()})}),xr(()=>{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=ye(pc,{to:t.teleportElement,key:t.id},ye(t.component,S({ref:t.id},t.props)));e.push(r)}),ye("div",{ref:t=>{this.rootEl=t}},...e)}});$e({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=Cr(null);return sn(()=>{const{pluginKey:n,editor:o,tippyOptions:i,shouldShow:s}=e;o.registerPlugin(Pa({pluginKey:n,editor:o,element:r.value,tippyOptions:i,shouldShow:s}))}),xr(()=>{const{pluginKey:n,editor:o}=e;o.unregisterPlugin(n)}),()=>{var n;return ye("div",{ref:r},(n=t.default)===null||n===void 0?void 0:n.call(t))}}});const Hd=(e={})=>{const t=Cr();return sn(()=>{t.value=new Fd(e)}),xr(()=>{var r;(r=t.value)===null||r===void 0||r.destroy()}),t};$e({props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var e,t;return ye(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))}});$e({props:{as:{type:String,default:"div"}},render(){return ye(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}});const jd=/^\s*>\s$/gm,qd=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[uo(jd,this.type)]}}),Jd=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/gm,Wd=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/gm,Kd=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/gm,$d=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/gm,Ud=Te.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[qe(Jd,this.type),qe(Kd,this.type)]},addPasteRules(){return[Je(Wd,this.type),Je($d,this.type)]}}),Gd=/^\s*([-+*])\s$/,Yd=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[uo(Gd,this.type)]}}),Xd=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/gm,Qd=/(?:^|\s)((?:`)((?:[^`]+))(?:`))/gm,Zd=Te.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[qe(Xd,this.type)]},addPasteRules(){return[Je(Qd,this.type)]}}),th=/^```(?<language>[a-z]*)? $/,eh=/^~~~(?<language>[a-z]*)? $/,rh=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[fo(th,this.type,({groups:e})=>e),fo(eh,this.type,({groups:e})=>e)]}}),nh=Ot.create({name:"doc",topNode:!0,content:"block+"});function oh(e){return e===void 0&&(e={}),new Rt({view:function(r){return new Yt(r,e)}})}var Yt=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}})};Yt.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)})};Yt.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())};Yt.prototype.setCursor=function(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())};Yt.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"};Yt.prototype.scheduleRemoval=function(t){var r=this;clearTimeout(this.timeout),this.timeout=setTimeout(function(){return r.setCursor(null)},t)};Yt.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=Oi(this.editorView.state.doc,n,this.editorView.dragging.slice),n==null))return this.setCursor(null);this.setCursor(n),this.scheduleRemoval(5e3)}}};Yt.prototype.dragend=function(){this.scheduleRemoval(20)};Yt.prototype.drop=function(){this.scheduleRemoval(20)};Yt.prototype.dragleave=function(t){(t.target==this.editorView.dom||!this.editorView.dom.contains(t.relatedTarget))&&this.setCursor(null)};const ih=xt.create({name:"dropCursor",defaultOptions:{color:"currentColor",width:1,class:null},addProseMirrorPlugins(){return[oh(this.options)]}});var jt=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 O.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 Yr(this.anchor)},t.valid=function(n){var o=n.parent;if(o.isTextblock||!sh(n)||!ah(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);jt.prototype.visible=!1;E.jsonID("gapcursor",jt);var Yr=function(t){this.pos=t};Yr.prototype.map=function(t){return new Yr(t.map(this.pos))};Yr.prototype.resolve=function(t){var r=t.resolve(this.pos);return jt.valid(r)?new jt(r):E.near(r)};function sh(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 ah(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 ch=function(){return new Rt({props:{decorations:fh,createSelectionBetween:function(t,r,n){if(r.pos==n.pos&&jt.valid(n))return new jt(n)},handleClick:uh,handleKeyDown:lh}})},lh=js({ArrowLeft:Xr("horiz",-1),ArrowRight:Xr("horiz",1),ArrowUp:Xr("vert",-1),ArrowDown:Xr("vert",1)});function Xr(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 z){if(!i.endOfTextblock(r)||a.depth==0)return!1;c=!1,a=n.doc.resolve(t>0?a.after():a.before())}var l=jt.findFrom(a,t,c);return l?(o&&o(n.tr.setSelection(new jt(l))),!0):!1}}function uh(e,t,r){if(!e.editable)return!1;var n=e.state.doc.resolve(t);if(!jt.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 jt(n))),!0)}function fh(e){if(!(e.selection instanceof jt))return null;var t=document.createElement("div");return t.className="ProseMirror-gapcursor",H.create(e.doc,[rt.widget(e.selection.head,t,{key:"gapcursor"})])}const ph=xt.create({name:"gapCursor",addProseMirrorPlugins(){return[ch()]},extendNodeSchema(e){var t;const r={name:e.name,options:e.options};return{allowGapCursor:(t=tt(T(e,"allowGapCursor",r)))!==null&&t!==void 0?t:null}}}),dh=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()}}}),hh=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)=>wt(S({},e),{[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>fo(new RegExp(`^(#{1,${e}})\\s$`),this.type,{level:e}))}});var Qr=200,at=function(){};at.prototype.append=function(t){return t.length?(t=at.from(t),!this.length&&t||t.length<Qr&&this.leafAppend(t)||this.length<Qr&&t.leafPrepend(this)||this.appendInner(t)):this};at.prototype.prepend=function(t){return t.length?at.from(t).append(this):this};at.prototype.appendInner=function(t){return new mh(this,t)};at.prototype.slice=function(t,r){return t===void 0&&(t=0),r===void 0&&(r=this.length),t>=r?at.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,r))};at.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};at.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)};at.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};at.from=function(t){return t instanceof at?t:t&&t.length?new Ba(t):at.empty};var Ba=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<=Qr)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=Qr)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}(at);at.empty=new Ba([]);var mh=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}(at),za=at,vh=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 Xt(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 Xt(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 Xt(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>yh&&(a=gh(a,d),s-=d),new ct(a.append(i),s)};ct.prototype.remapping=function(t,r){var n=new dt;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 Xt(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]),M=d.selection&&d.selection.map(i.slice(c+1,h));M&&a++,n.push(new Xt(v,g,M))}else n.push(new Xt(v))}},o);for(var l=[],u=r;u<s;u++)l.push(new Xt(i.maps[u]));var f=this.items.slice(0,o).append(l).append(n),p=new ct(f,a);return p.emptyItemCount()>vh&&(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 Xt(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(za.from(o.reverse()),i)};ct.empty=new ct(za.empty,0);function gh(e,t){var r;return e.forEach(function(n,o){if(n.selection&&t--==0)return r=o,!1}),e.slice(r)}var Xt=function(t,r,n,o){this.map=t,this.step=r,this.selection=n,this.mirrorOffset=o};Xt.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var r=t.step.merge(this.step);if(r)return new Xt(r.getMap().invert(),r,this.selection)}};var me=function(t,r,n,o){this.done=t,this.undone=r,this.prevRanges=n,this.prevTime=o},yh=20;function bh(e,t,r,n){var o=r.getMeta(ve),i;if(o)return o.historyState;r.getMeta(Sh)&&(e=new me(e.done,e.undone,null,0));var s=r.getMeta("appendedTransaction");if(r.steps.length==0)return e;if(s&&s.getMeta(ve))return s.getMeta(ve).redo?new me(e.done.addTransform(r,null,n,Zr(t)),e.undone,La(r.mapping.maps[r.steps.length-1]),e.prevTime):new me(e.done,e.undone.addTransform(r,null,n,Zr(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||!kh(r,e.prevRanges)),c=s?Ao(e.prevRanges,r.mapping):La(r.mapping.maps[r.steps.length-1]);return new me(e.done.addTransform(r,a?t.selection.getBookmark():null,n,Zr(t)),ct.empty,c,r.time)}else return(i=r.getMeta("rebased"))?new me(e.done.rebased(r,i),e.undone.rebased(r,i),Ao(e.prevRanges,r.mapping),e.prevTime):new me(e.done.addMaps(r.mapping.maps),e.undone.addMaps(r.mapping.maps),Ao(e.prevRanges,r.mapping),e.prevTime)}function kh(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 La(e){var t=[];return e.forEach(function(r,n,o,i){return t.push(o,i)}),t}function Ao(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 Fa(e,t,r,n){var o=Zr(t),i=ve.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 me(n?c:s.remaining,n?s.remaining:c,null,0);r(s.transform.setSelection(a).setMeta(ve,{redo:n,historyState:l}).scrollIntoView())}}var _o=!1,Va=null;function Zr(e){var t=e.plugins;if(Va!=t){_o=!1,Va=t;for(var r=0;r<t.length;r++)if(t[r].spec.historyPreserveItems){_o=!0;break}}return _o}var ve=new Wt("history"),Sh=new Wt("closeHistory");function Mh(e){return e={depth:e&&e.depth||100,newGroupDelay:e&&e.newGroupDelay||500},new Rt({key:ve,state:{init:function(){return new me(ct.empty,ct.empty,null,0)},apply:function(r,n,o){return bh(n,o,r,e)}},config:e,props:{handleDOMEvents:{beforeinput:function(r,n){var o=n.inputType=="historyUndo"?Ha(r.state,r.dispatch):n.inputType=="historyRedo"?ja(r.state,r.dispatch):!1;return o&&n.preventDefault(),o}}}})}function Ha(e,t){var r=ve.getState(e);return!r||r.done.eventCount==0?!1:(t&&Fa(r,e,t,!1),!0)}function ja(e,t){var r=ve.getState(e);return!r||r.undone.eventCount==0?!1:(t&&Fa(r,e,t,!0),!0)}const Ch=xt.create({name:"history",defaultOptions:{depth:100,newGroupDelay:500},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Ha(e,t),redo:()=>({state:e,dispatch:t})=>ja(e,t)}},addProseMirrorPlugins(){return[Mh(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}}),xh=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(z.create(t.doc,s)))}t.scrollIntoView()}return!0}).run()}},addInputRules(){return[ad(/^(?:---|—-|___\s|\*\*\*\s)$/,this.type)]}}),Oh=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/gm,wh=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/gm,Th=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/gm,Ah=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/gm,_h=Te.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[qe(Oh,this.type),qe(Th,this.type)]},addPasteRules(){return[Je(wh,this.type),Je(Ah,this.type)]}}),Nh=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")}}}),Eh=/^(\d+)\.\s$/,Dh=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 n=e,{start:t}=n,r=Go(n,["start"]);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[uo(Eh,this.type,e=>({start:+e[1]}),(e,t)=>t.childCount+t.attrs.start===+e[1])]}}),Ih=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()}}}),Rh=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/gm,Ph=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/gm,Bh=Te.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[qe(Rh,this.type)]},addPasteRules(){return[Je(Ph,this.type)]}}),zh=Ot.create({name:"text",group:"inline"}),Lh=xt.create({name:"starterKit",addExtensions(){var e,t,r,n,o,i,s,a,c,l,u,f,p,d,h,v,g,M;const y=[];return this.options.blockquote!==!1&&y.push(qd.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bold!==!1&&y.push(Ud.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.bulletList!==!1&&y.push(Yd.configure((r=this.options)===null||r===void 0?void 0:r.bulletList)),this.options.code!==!1&&y.push(Zd.configure((n=this.options)===null||n===void 0?void 0:n.code)),this.options.codeBlock!==!1&&y.push(rh.configure((o=this.options)===null||o===void 0?void 0:o.codeBlock)),this.options.document!==!1&&y.push(nh.configure((i=this.options)===null||i===void 0?void 0:i.document)),this.options.dropcursor!==!1&&y.push(ih.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&y.push(ph.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&y.push(dh.configure((c=this.options)===null||c===void 0?void 0:c.hardBreak)),this.options.heading!==!1&&y.push(hh.configure((l=this.options)===null||l===void 0?void 0:l.heading)),this.options.history!==!1&&y.push(Ch.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&y.push(xh.configure((f=this.options)===null||f===void 0?void 0:f.horizontalRule)),this.options.italic!==!1&&y.push(_h.configure((p=this.options)===null||p===void 0?void 0:p.italic)),this.options.listItem!==!1&&y.push(Nh.configure((d=this.options)===null||d===void 0?void 0:d.listItem)),this.options.orderedList!==!1&&y.push(Dh.configure((h=this.options)===null||h===void 0?void 0:h.orderedList)),this.options.paragraph!==!1&&y.push(Ih.configure((v=this.options)===null||v===void 0?void 0:v.paragraph)),this.options.strike!==!1&&y.push(Bh.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&y.push(zh.configure((M=this.options)===null||M===void 0?void 0:M.text)),y}}),Fh={},Vh={viewBox:"0 0 24 24"},Hh=_("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),jh=[Hh];function qh(e,t){return kt(),Tt("svg",Vh,jh)}var Jh=Dt(Fh,[["render",qh]]);const Wh={},Kh={viewBox:"0 0 24 24"},$h=_("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),Uh=[$h];function Gh(e,t){return kt(),Tt("svg",Kh,Uh)}var Yh=Dt(Wh,[["render",Gh]]);const Xh={},Qh={viewBox:"0 0 24 24"},Zh=_("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),tm=[Zh];function em(e,t){return kt(),Tt("svg",Qh,tm)}var rm=Dt(Xh,[["render",em]]);const nm={},om={viewBox:"0 0 24 24"},im=_("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),sm=[im];function am(e,t){return kt(),Tt("svg",om,sm)}var cm=Dt(nm,[["render",am]]);const lm={},um={viewBox:"0 0 24 24"},fm=vc('<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),pm=[fm];function dm(e,t){return kt(),Tt("svg",um,pm)}var hm=Dt(lm,[["render",dm]]);const mm={},vm={viewBox:"0 0 24 24"},gm=_("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),ym=[gm];function bm(e,t){return kt(),Tt("svg",vm,ym)}var km=Dt(mm,[["render",bm]]);const Sm={},Mm={viewBox:"0 0 24 24"},Cm=_("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),xm=[Cm];function Om(e,t){return kt(),Tt("svg",Mm,xm)}var wm=Dt(Sm,[["render",Om]]);const Tm={},Am={viewBox:"0 0 24 24"},_m=_("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),Nm=[_m];function Em(e,t){return kt(),Tt("svg",Am,Nm)}var Dm=Dt(Tm,[["render",Em]]);const Im={},Rm={viewBox:"0 0 24 24"},Pm=_("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),Bm=[Pm];function zm(e,t){return kt(),Tt("svg",Rm,Bm)}var Lm=Dt(Im,[["render",zm]]);const Fm={},Vm={viewBox:"0 0 24 24"},Hm=_("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),jm=[Hm];function qm(e,t){return kt(),Tt("svg",Vm,jm)}var Jm=Dt(Fm,[["render",qm]]);const Wm={},Km={viewBox:"0 0 24 24"},$m=_("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),Um=[$m];function Gm(e,t){return kt(),Tt("svg",Km,Um)}var Ym=Dt(Wm,[["render",Gm]]);const Xm={components:{EditorContent:Vd,BoldIcon:Jh,CodingIcon:Yh,ItalicIcon:rm,ListIcon:cm,ListUlIcon:hm,ParagraphIcon:km,QuoteIcon:wm,StrikethroughIcon:Dm,UndoIcon:Lm,RedoIcon:Jm,CodeBlockIcon:Ym,DotsVerticalIcon:gc},props:{modelValue:{type:String,default:""},contentLoading:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e,{emit:t}){const r=Hd({content:e.modelValue,extensions:[Lh],onUpdate:()=>{t("update:modelValue",r.value.getHTML())}});return yc(()=>e.modelValue,n=>{r.value.getHTML()!==n&&r.value.commands.setContent(e.modelValue,!1)}),bc(()=>{setTimeout(()=>{r.value.destroy()},500)}),{editor:r}}},Qm={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"},Zm={key:0,class:"editor-content"},tv={class:"flex justify-end p-2 border-b border-gray-200 md:hidden"},ev={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"},rv={class:"flex flex-wrap space-x-1"},nv={class:"hidden p-2 border-b border-gray-200 md:flex"},ov={class:"flex flex-wrap space-x-1"};function iv(e,t,r,n,o,i){const s=ut("BaseContentPlaceholdersBox"),a=ut("BaseContentPlaceholders"),c=ut("dots-vertical-icon"),l=ut("bold-icon"),u=ut("italic-icon"),f=ut("strikethrough-icon"),p=ut("coding-icon"),d=ut("paragraph-icon"),h=ut("list-ul-icon"),v=ut("list-icon"),g=ut("quote-icon"),M=ut("code-block-icon"),y=ut("undo-icon"),I=ut("redo-icon"),m=ut("BaseDropdown"),D=ut("editor-content");return r.contentLoading?(kt(),kc(a,{key:0},{default:an(()=>[q(s,{rounded:!0,class:"w-full",style:{height:"200px"}})]),_:1})):(kt(),Tt("div",Qm,[n.editor?(kt(),Tt("div",Zm,[_("div",tv,[q(m,{"width-class":"w-48"},{activator:an(()=>[_("div",ev,[q(c,{class:"w-6 h-6 text-gray-600"})])]),default:an(()=>[_("div",rv,[_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleBold().run())},[q(l,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleItalic().run())},[q(u,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleStrike().run())},[q(f,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleCode().run())},[q(p,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().setParagraph().run())},[q(d,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleHeading({level:1}).run())}," H1 ",2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleHeading({level:2}).run())}," H2 ",2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleHeading({level:3}).run())}," H3 ",2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleBulletList().run())},[q(h,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleOrderedList().run())},[q(v,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleBlockquote().run())},[q(g,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleCodeBlock().run())},[q(M,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().undo().run())},[q(y,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().redo().run())},[q(I,{class:"h-3 cursor-pointer fill-current"})],2)])]),_:1})]),_("div",nv,[_("div",ov,[_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleBold().run())},[q(l,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleItalic().run())},[q(u,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleStrike().run())},[q(f,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleCode().run())},[q(p,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().setParagraph().run())},[q(d,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleHeading({level:1}).run())}," H1 ",2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleHeading({level:2}).run())}," H2 ",2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleHeading({level:3}).run())}," H3 ",2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleBulletList().run())},[q(h,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleOrderedList().run())},[q(v,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleBlockquote().run())},[q(g,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().toggleCodeBlock().run())},[q(M,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().undo().run())},[q(y,{class:"h-3 cursor-pointer fill-current"})],2),_("span",{class:V(["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]=x=>n.editor.chain().focus().redo().run())},[q(I,{class:"h-3 cursor-pointer fill-current"})],2)])]),q(D,{editor:n.editor,class:"box-border relative w-full text-sm leading-8 text-left editor__content"},null,8,["editor"])])):Sc("",!0)]))}var lv=Dt(Xm,[["render",iv]]);export{lv as default};
|