diff --git a/dist/tiptap.umd.js b/dist/tiptap.umd.js index 79edfce..5af239d 100644 --- a/dist/tiptap.umd.js +++ b/dist/tiptap.umd.js @@ -1,16 +1,16 @@ -var u1=Object.defineProperty,f1=Object.defineProperties;var p1=Object.getOwnPropertyDescriptors;var Po=Object.getOwnPropertySymbols;var Wu=Object.prototype.hasOwnProperty,Ku=Object.prototype.propertyIsEnumerable;var Uu=(f,H,dt)=>H in f?u1(f,H,{enumerable:!0,configurable:!0,writable:!0,value:dt}):f[H]=dt,x=(f,H)=>{for(var dt in H||(H={}))Wu.call(H,dt)&&Uu(f,dt,H[dt]);if(Po)for(var dt of Po(H))Ku.call(H,dt)&&Uu(f,dt,H[dt]);return f},Lt=(f,H)=>f1(f,p1(H));var Gu=(f,H)=>{var dt={};for(var Xt in f)Wu.call(f,Xt)&&H.indexOf(Xt)<0&&(dt[Xt]=f[Xt]);if(f!=null&&Po)for(var Xt of Po(f))H.indexOf(Xt)<0&&Ku.call(f,Xt)&&(dt[Xt]=f[Xt]);return dt};var __vite_style__=document.createElement("style");__vite_style__.innerHTML=`.ProseMirror li>p:first-child,.ProseMirror div{display:inline}ul[data-type=taskList]{list-style:none;padding:0}ul[data-type=taskList] li{display:flex;align-items:center}ul[data-type=taskList] li>label{flex:0 0 auto;margin-right:.5rem} -`;document.head.appendChild(__vite_style__);(function(f,H){typeof exports=="object"&&typeof module!="undefined"?H(require("vue")):typeof define=="function"&&define.amd?define(["vue"],H):(f=typeof globalThis!="undefined"?globalThis:f||self,H(f.Vue))})(this,function(f){"use strict";function H(n){this.content=n}H.prototype={constructor:H,find:function(n){for(var t=0;t>1}},H.from=function(n){if(n instanceof H)return n;var t=[];if(n)for(var e in n)t.push(e,n[e]);return new H(t)};var dt=H;function Xt(n,t,e){for(var r=0;;r++){if(r==n.childCount||r==t.childCount)return n.childCount==t.childCount?null:e;var o=n.child(r),i=t.child(r);if(o==i){e+=o.nodeSize;continue}if(!o.sameMarkup(i))return e;if(o.isText&&o.text!=i.text){for(var s=0;o.text[s]==i.text[s];s++)e++;return e}if(o.content.size||i.content.size){var a=Xt(o.content,i.content,e+1);if(a!=null)return a}e+=o.nodeSize}}function Hs(n,t,e,r){for(var o=n.childCount,i=t.childCount;;){if(o==0||i==0)return o==i?null:{a:e,b:r};var s=n.child(--o),a=t.child(--i),l=s.nodeSize;if(s==a){e-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:e,b:r};if(s.isText&&s.text!=a.text){for(var c=0,u=Math.min(s.text.length,a.text.length);ct&&r(l,o+a,i,s)!==!1&&l.content.size){var u=a+1;l.nodesBetween(Math.max(0,t-u),Math.min(l.content.size,e-u),r,o+u)}a=c}},S.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},S.prototype.textBetween=function(t,e,r,o){var i="",s=!0;return this.nodesBetween(t,e,function(a,l){a.isText?(i+=a.text.slice(Math.max(t,l)-l,e-l),s=!r):a.isLeaf&&o?(i+=typeof o=="function"?o(a):o,s=!r):!s&&a.isBlock&&(i+=r,s=!0)},0),i},S.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(e.isText&&e.sameMarkup(r)&&(o[o.length-1]=e.withText(e.text+r.text),i=1);it)for(var i=0,s=0;st&&((se)&&(a.isText?a=a.cut(Math.max(0,t-s),Math.min(a.text.length,e-s)):a=a.cut(Math.max(0,t-s-1),Math.min(a.content.size,e-s-1))),r.push(a),o+=a.nodeSize),s=l}return new S(r,o)},S.prototype.cutByIndex=function(t,e){return t==e?S.empty:t==0&&e==this.content.length?this:new S(this.content.slice(t,e))},S.prototype.replaceChild=function(t,e){var r=this.content[t];if(r==e)return this;var o=this.content.slice(),i=this.size+e.nodeSize-r.nodeSize;return o[t]=e,new S(o,i)},S.prototype.addToStart=function(t){return new S([t].concat(this.content),this.size+t.nodeSize)},S.prototype.addToEnd=function(t){return new S(this.content.concat(t),this.size+t.nodeSize)},S.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;ethis.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var r=0,o=0;;r++){var i=this.child(r),s=o+i.nodeSize;if(s>=t)return s==t||e>0?Pr(r+1,s):Pr(r,o);o=s}},S.prototype.toString=function(){return"<"+this.toStringInner()+">"},S.prototype.toStringInner=function(){return this.content.join(", ")},S.prototype.toJSON=function(){return this.content.length?this.content.map(function(t){return t.toJSON()}):null},S.fromJSON=function(t,e){if(!e)return S.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new S(e.map(t.nodeFromJSON))},S.fromArray=function(t){if(!t.length)return S.empty;for(var e,r=0,o=0;othis.type.rank&&(e||(e=t.slice(0,o)),e.push(this),r=!0),e&&e.push(i)}}return e||(e=t.slice()),r||e.push(this),e},J.prototype.removeFromSet=function(t){for(var e=0;e0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},T.fromJSON=function(t,e){if(!e)return T.empty;var r=e.openStart||0,o=e.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new T(S.fromJSON(t,e.content),r,o)},T.maxOpen=function(t,e){e===void 0&&(e=!0);for(var r=0,o=0,i=t.firstChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.firstChild)r++;for(var s=t.lastChild;s&&!s.isLeaf&&(e||!s.type.spec.isolating);s=s.lastChild)o++;return new T(t,r,o)},Object.defineProperties(T.prototype,Js);function $s(n,t,e){var r=n.findIndex(t),o=r.index,i=r.offset,s=n.maybeChild(o),a=n.findIndex(e),l=a.index,c=a.offset;if(i==t||s.isText){if(c!=e&&!n.child(l).isText)throw new RangeError("Removing non-flat range");return n.cut(0,t).append(n.cut(e))}if(o!=l)throw new RangeError("Removing non-flat range");return n.replaceChild(o,s.copy($s(s.content,t-i-1,e-i-1)))}function qs(n,t,e,r){var o=n.findIndex(t),i=o.index,s=o.offset,a=n.maybeChild(i);if(s==t||a.isText)return r&&!r.canReplace(i,i,e)?null:n.cut(0,t).append(e).append(n.cut(t));var l=qs(a.content,t-s-1,e);return l&&n.replaceChild(i,a.copy(l))}T.empty=new T(S.empty,0,0);function Yu(n,t,e){if(e.openStart>n.depth)throw new he("Inserted content deeper than insertion position");if(n.depth-e.openStart!=t.depth-e.openEnd)throw new he("Inconsistent open depths");return js(n,t,e,0)}function js(n,t,e,r){var o=n.index(r),i=n.node(r);if(o==t.index(r)&&r=0&&n.isText&&n.sameMarkup(t[e])?t[e]=n.withText(t[e].text+n.text):t.push(n)}function Wn(n,t,e,r){var o=(t||n).node(e),i=0,s=t?t.index(e):o.childCount;n&&(i=n.index(e),n.depth>e?i++:n.textOffset&&(Ze(n.nodeAfter,r),i++));for(var a=i;ao&&Lo(n,t,o+1),s=r.depth>o&&Lo(e,r,o+1),a=[];return Wn(null,n,o,a),i&&s&&t.index(o)==e.index(o)?(Ws(i,s),Ze(tn(i,Ks(n,t,e,r,o+1)),a)):(i&&Ze(tn(i,Lr(n,t,o+1)),a),Wn(t,e,o,a),s&&Ze(tn(s,Lr(e,r,o+1)),a)),Wn(r,null,o,a),new S(a)}function Lr(n,t,e){var r=[];if(Wn(null,n,e,r),n.depth>e){var o=Lo(n,t,e+1);Ze(tn(o,Lr(n,t,e+1)),r)}return Wn(t,null,e,r),new S(r)}function Xu(n,t){for(var e=t.depth-n.openStart,r=t.node(e),o=r.copy(n.content),i=e-1;i>=0;i--)o=t.node(i).copy(S.from(o));return{start:o.resolveNoCache(n.openStart+e),end:o.resolveNoCache(o.content.size-n.openEnd-e)}}var nt=function(t,e,r){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=r},yn={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};nt.prototype.resolveDepth=function(t){return t==null?this.depth:t<0?this.depth+t:t},yn.parent.get=function(){return this.node(this.depth)},yn.doc.get=function(){return this.node(0)},nt.prototype.node=function(t){return this.path[this.resolveDepth(t)*3]},nt.prototype.index=function(t){return this.path[this.resolveDepth(t)*3+1]},nt.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)},nt.prototype.start=function(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1},nt.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},nt.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]},nt.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},yn.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},yn.nodeAfter.get=function(){var n=this.parent,t=this.index(this.depth);if(t==n.childCount)return null;var e=this.pos-this.path[this.path.length-1],r=n.child(t);return e?n.child(t).cut(e):r},yn.nodeBefore.get=function(){var n=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(n).cut(0,t):n==0?null:this.parent.child(n-1)},nt.prototype.posAtIndex=function(t,e){e=this.resolveDepth(e);for(var r=this.path[e*3],o=e==0?0:this.path[e*3-1]+1,i=0;i0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},nt.prototype.blockRange=function(t,e){if(t===void 0&&(t=this),t.pos=0;r--)if(t.pos<=this.end(r)&&(!e||e(this.node(r))))return new Kn(this,t,r)},nt.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},nt.prototype.max=function(t){return t.pos>this.pos?t:this},nt.prototype.min=function(t){return t.pos=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var r=[],o=0,i=e,s=t;;){var a=s.content.findIndex(i),l=a.index,c=a.offset,u=i-c;if(r.push(s,l,o+c),!u||(s=s.child(l),s.isText))break;i=u-1,o+=c+1}return new nt(e,r,i)},nt.resolveCached=function(t,e){for(var r=0;rt&&this.nodesBetween(t,e,function(i){return r.isInSet(i.marks)&&(o=!0),!o}),o},$t.isBlock.get=function(){return this.type.isBlock},$t.isTextblock.get=function(){return this.type.isTextblock},$t.inlineContent.get=function(){return this.type.inlineContent},$t.isInline.get=function(){return this.type.isInline},$t.isText.get=function(){return this.type.isText},$t.isLeaf.get=function(){return this.type.isLeaf},$t.isAtom.get=function(){return this.type.isAtom},$.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()+")"),Us(this.marks,t)},$.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},$.prototype.canReplace=function(t,e,r,o,i){r===void 0&&(r=S.empty),o===void 0&&(o=0),i===void 0&&(i=r.childCount);var s=this.contentMatchAt(t).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(var l=o;l=0;e--)t=n[e].type.name+"("+t+")";return t}var xt=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},Fr={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};xt.parse=function(t,e){var r=new Hr(t,e);if(r.next==null)return xt.empty;var o=Ys(r);r.next&&r.err("Unexpected trailing text");var i=lf(af(o));return cf(i,r),i},xt.prototype.matchType=function(t){for(var e=0;e>1},xt.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},xt.prototype.toString=function(){var t=[];function e(r){t.push(r);for(var o=1;o"+t.indexOf(r.next[s+1]);return i}).join(` -`)},Object.defineProperties(xt.prototype,Fr),xt.empty=new xt(!0);var Hr=function(t,e){this.string=t,this.nodeTypes=e,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()},Gs={next:{configurable:!0}};Gs.next.get=function(){return this.tokens[this.pos]},Hr.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},Hr.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties(Hr.prototype,Gs);function Ys(n){var t=[];do t.push(ef(n));while(n.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function ef(n){var t=[];do t.push(nf(n));while(n.next&&n.next!=")"&&n.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function nf(n){for(var t=sf(n);;)if(n.eat("+"))t={type:"plus",expr:t};else if(n.eat("*"))t={type:"star",expr:t};else if(n.eat("?"))t={type:"opt",expr:t};else if(n.eat("{"))t=rf(n,t);else break;return t}function Xs(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");var t=Number(n.next);return n.pos++,t}function rf(n,t){var e=Xs(n),r=e;return n.eat(",")&&(n.next!="}"?r=Xs(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:e,max:r,expr:t}}function of(n,t){var e=n.nodeTypes,r=e[t];if(r)return[r];var o=[];for(var i in e){var s=e[i];s.groups.indexOf(t)>-1&&o.push(s)}return o.length==0&&n.err("No node type or group '"+t+"' found"),o}function sf(n){if(n.eat("(")){var t=Ys(n);return n.eat(")")||n.err("Missing closing paren"),t}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{var e=of(n,n.next).map(function(r){return n.inline==null?n.inline=r.isInline:n.inline!=r.isInline&&n.err("Mixing inline and block content"),{type:"name",value:r}});return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function af(n){var t=[[]];return o(i(n,0),e()),t;function e(){return t.push([])-1}function r(s,a,l){var c={term:l,to:a};return t[s].push(c),c}function o(s,a){s.forEach(function(l){return l.to=a})}function i(s,a){if(s.type=="choice")return s.exprs.reduce(function(k,b){return k.concat(i(b,a))},[]);if(s.type=="seq")for(var l=0;;l++){var c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=e())}else if(s.type=="star"){var u=e();return r(a,u),o(i(s.expr,u),u),[r(u)]}else if(s.type=="plus"){var p=e();return o(i(s.expr,a),p),o(i(s.expr,p),p),[r(p)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){for(var d=a,h=0;h-1&&o[d+1];Zs(n,p).forEach(function(m){h||o.push(u,h=[]),h.indexOf(m)==-1&&h.push(m)})}})});for(var i=t[r.join(",")]=new xt(r.indexOf(n.length-1)>-1),s=0;s-1},At.prototype.allowsMarks=function(t){if(this.markSet==null)return!0;for(var e=0;e-1};var en=function(t){this.spec={};for(var e in t)this.spec[e]=t[e];this.spec.nodes=dt.from(t.nodes),this.spec.marks=dt.from(t.marks),this.nodes=At.compile(this.spec.nodes,this),this.marks=Ve.compile(this.spec.marks,this);var r=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=r[s]||(r[s]=xt.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet=a=="_"?null:a?ia(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(var l in this.marks){var c=this.marks[l],u=c.spec.excludes;c.excluded=u==null?[c]:u==""?[]:ia(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)};en.prototype.node=function(t,e,r,o){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof At){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(e,r,o)},en.prototype.text=function(t,e){var r=this.nodes.text;return new tf(r,r.defaultAttrs,t,J.setFrom(e))},en.prototype.mark=function(t,e){return typeof t=="string"&&(t=this.marks[t]),t.create(e)},en.prototype.nodeFromJSON=function(t){return $.fromJSON(this,t)},en.prototype.markFromJSON=function(t){return J.fromJSON(this,t)},en.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};function ia(n,t){for(var e=[],r=0;r-1)&&e.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return e}var se=function(t,e){var r=this;this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach(function(o){o.tag?r.tags.push(o):o.style&&r.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)})};se.prototype.parse=function(t,e){e===void 0&&(e={});var r=new tt(this,e,!1);return r.addAll(t,null,e.from,e.to),r.finish()},se.prototype.parseSlice=function(t,e){e===void 0&&(e={});var r=new tt(this,e,!0);return r.addAll(t,null,e.from,e.to),T.maxOpen(r.finish())},se.prototype.matchTag=function(t,e,r){for(var o=r?this.tags.indexOf(r)+1:0;ot.length&&(s.style.charCodeAt(t.length)!=61||s.style.slice(t.length+1)!=e))){if(s.getAttrs){var a=s.getAttrs(e);if(a===!1)continue;s.attrs=a}return s}}},se.schemaRules=function(t){var e=[];function r(l){for(var c=l.priority==null?50:l.priority,u=0;u=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},Ce.prototype.applyPending=function(t){for(var e=0,r=this.pendingMarks;e=0;o--){var i=this.nodes[o],s=i.findWrapping(t);if(s&&(!e||e.length>s.length)&&(e=s,r=i,!s.length)||i.solid)break}if(!e)return!1;this.sync(r);for(var a=0;athis.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},tt.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},tt.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t){this.open=e;return}},jo.currentPos.get=function(){this.closeExtra();for(var n=0,t=this.open;t>=0;t--){for(var e=this.nodes[t].content,r=e.length-1;r>=0;r--)n+=e[r].nodeSize;t&&n++}return n},tt.prototype.findAtPoint=function(t,e){if(this.find)for(var r=0;r-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var r=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(l,c){for(;l>=0;l--){var u=r[l];if(u==""){if(l==r.length-1||l==0)continue;for(;c>=s;c--)if(a(l-1,c))return!0;return!1}else{var p=c>0||c==0&&i?e.nodes[c].type:o&&c>=s?o.node(c-s).type:null;if(!p||p.name!=u&&p.groups.indexOf(u)==-1)return!1;c--}}return!0};return a(r.length-1,this.open)},tt.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var r=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(var o in this.parser.schema.nodes){var i=this.parser.schema.nodes[o];if(i.isTextblock&&i.defaultAttrs)return i}},tt.prototype.addPendingMark=function(t){var e=mf(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},tt.prototype.removePendingMark=function(t,e){for(var r=this.open;r>=0;r--){var o=this.nodes[r],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==e)break}},Object.defineProperties(tt.prototype,jo);function ff(n){for(var t=n.firstChild,e=null;t;t=t.nextSibling){var r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&sa.hasOwnProperty(r)&&e?(e.appendChild(t),t=e):r=="li"?e=t:r&&(e=null)}}function pf(n,t){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,t)}function df(n){for(var t=/\s*([\w-]+)\s*:\s*([^;]+)/g,e,r=[];e=t.exec(n);)r.push(e[1],e[2].trim());return r}function la(n){var t={};for(var e in n)t[e]=n[e];return t}function hf(n,t){var e=t.schema.nodes,r=function(s){var a=e[s];if(!!a.allowsMarkType(n)){var l=[],c=function(u){l.push(u);for(var p=0;p=0;o--){var i=this.serializeMark(t.marks[o],t.isInline,e);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r},ht.prototype.serializeMark=function(t,e,r){r===void 0&&(r={});var o=this.marks[t.type.name];return o&&ht.renderSpec(Wo(r),o(t,e))},ht.renderSpec=function(t,e,r){if(r===void 0&&(r=null),typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;var o=e[0],i=o.indexOf(" ");i>0&&(r=o.slice(0,i),o=o.slice(i+1));var s=null,a=r?t.createElementNS(r,o):t.createElement(o),l=e[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(var u in l)if(l[u]!=null){var p=u.indexOf(" ");p>0?a.setAttributeNS(u.slice(0,p),u.slice(p+1),l[u]):a.setAttribute(u,l[u])}}for(var d=c;dc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{var m=ht.renderSpec(t,h,r),g=m.dom,y=m.contentDOM;if(a.appendChild(g),y){if(s)throw new RangeError("Multiple content holes");s=y}}}return{dom:a,contentDOM:s}},ht.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new ht(this.nodesFromSchema(t),this.marksFromSchema(t)))},ht.nodesFromSchema=function(t){var e=ca(t.nodes);return e.text||(e.text=function(r){return r.text}),e},ht.marksFromSchema=function(t){return ca(t.marks)};function ca(n){var t={};for(var e in n){var r=n[e].spec.toDOM;r&&(t[e]=r)}return t}function Wo(n){return n.document||window.document}var ua=65535,fa=Math.pow(2,16);function vf(n,t){return n+t*fa}function pa(n){return n&ua}function gf(n){return(n-(n&ua))/fa}var Ko=function(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=null),this.pos=t,this.deleted=e,this.recover=r},mt=function(t,e){e===void 0&&(e=!1),this.ranges=t,this.inverted=e};mt.prototype.recover=function(t){var e=0,r=pa(t);if(!this.inverted)for(var o=0;ot)break;var c=this.ranges[a+i],u=this.ranges[a+s],p=l+c;if(t<=p){var d=c?t==l?-1:t==p?1:e:e,h=l+o+(d<0?0:u);if(r)return h;var m=t==(e<0?l:p)?null:vf(a/3,t-l);return new Ko(h,e<0?t!=l:t!=p,m)}o+=u-c}return r?t+o:new Ko(t+o)},mt.prototype.touches=function(t,e){for(var r=0,o=pa(e),i=this.inverted?2:1,s=this.inverted?1:2,a=0;at)break;var c=this.ranges[a+i],u=l+c;if(t<=u&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1},mt.prototype.forEach=function(t){for(var e=this.inverted?2:1,r=this.inverted?1:2,o=0,i=0;o=0;e--){var o=t.getMirror(e);this.appendMap(t.maps[e].invert(),o!=null&&o>e?r-o-1:null)}},Mt.prototype.invert=function(){var t=new Mt;return t.appendMappingInverted(this),t},Mt.prototype.map=function(t,e){if(e===void 0&&(e=1),this.mirror)return this._map(t,e,!0);for(var r=this.from;ri&&l0},at.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(at.prototype,Uo);function Jr(){throw new Error("Override me")}var Go=Object.create(null),Ct=function(){};Ct.prototype.apply=function(t){return Jr()},Ct.prototype.getMap=function(){return mt.empty},Ct.prototype.invert=function(t){return Jr()},Ct.prototype.map=function(t){return Jr()},Ct.prototype.merge=function(t){return null},Ct.prototype.toJSON=function(){return Jr()},Ct.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var r=Go[e.stepType];if(!r)throw new RangeError("No step type "+e.stepType+" defined");return r.fromJSON(t,e)},Ct.jsonID=function(t,e){if(t in Go)throw new RangeError("Duplicate use of step JSON ID "+t);return Go[t]=e,e.prototype.jsonID=t,e};var Dt=function(t,e){this.doc=t,this.failed=e};Dt.ok=function(t){return new Dt(t,null)},Dt.fail=function(t){return new Dt(null,t)},Dt.fromReplace=function(t,e,r,o){try{return Dt.ok(t.replace(e,r,o))}catch(i){if(i instanceof he)return Dt.fail(i.message);throw i}};var Ee=function(n){function t(e,r,o,i){n.call(this),this.from=e,this.to=r,this.slice=o,this.structure=!!i}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.apply=function(r){return this.structure&&Yo(r,this.from,this.to)?Dt.fail("Structure replace would overwrite content"):Dt.fromReplace(r,this.from,this.to,this.slice)},t.prototype.getMap=function(){return new mt([this.from,this.to-this.from,this.slice.size])},t.prototype.invert=function(r){return new t(this.from,this.from+this.slice.size,r.slice(this.from,this.to))},t.prototype.map=function(r){var o=r.mapResult(this.from,1),i=r.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(r){if(!(r instanceof t)||r.structure||this.structure)return null;if(this.from+this.slice.size==r.from&&!this.slice.openEnd&&!r.slice.openStart){var o=this.slice.size+r.slice.size==0?T.empty:new T(this.slice.content.append(r.slice.content),this.slice.openStart,r.slice.openEnd);return new t(this.from,this.to+(r.to-r.from),o,this.structure)}else if(r.to==this.from&&!this.slice.openStart&&!r.slice.openEnd){var i=this.slice.size+r.slice.size==0?T.empty:new T(r.slice.content.append(this.slice.content),r.slice.openStart,this.slice.openEnd);return new t(r.from,this.to,i,this.structure)}else return null},t.prototype.toJSON=function(){var r={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(r.slice=this.slice.toJSON()),this.structure&&(r.structure=!0),r},t.fromJSON=function(r,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,T.fromJSON(r,o.slice),!!o.structure)},t}(Ct);Ct.jsonID("replace",Ee);var Ft=function(n){function t(e,r,o,i,s,a,l){n.call(this),this.from=e,this.to=r,this.gapFrom=o,this.gapTo=i,this.slice=s,this.insert=a,this.structure=!!l}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.apply=function(r){if(this.structure&&(Yo(r,this.from,this.gapFrom)||Yo(r,this.gapTo,this.to)))return Dt.fail("Structure gap-replace would overwrite content");var o=r.slice(this.gapFrom,this.gapTo);if(o.openStart||o.openEnd)return Dt.fail("Gap is not a flat range");var i=this.slice.insertAt(this.insert,o.content);return i?Dt.fromReplace(r,this.from,this.to,i):Dt.fail("Content does not fit in gap")},t.prototype.getMap=function(){return new mt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},t.prototype.invert=function(r){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,r.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},t.prototype.map=function(r){var o=r.mapResult(this.from,1),i=r.mapResult(this.to,-1),s=r.map(this.gapFrom,-1),a=r.map(this.gapTo,1);return o.deleted&&i.deleted||si.pos?null:new t(o.pos,i.pos,s,a,this.slice,this.insert,this.structure)},t.prototype.toJSON=function(){var r={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(r.slice=this.slice.toJSON()),this.structure&&(r.structure=!0),r},t.fromJSON=function(r,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,T.fromJSON(r,o.slice),o.insert,!!o.structure)},t}(Ct);Ct.jsonID("replaceAround",Ft);function Yo(n,t,e){for(var r=n.resolve(t),o=e-t,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function yf(n,t,e){return(t==0||n.canReplace(t,n.childCount))&&(e==n.childCount||n.canReplace(0,e))}function wn(n){for(var t=n.parent,e=t.content.cutByIndex(n.startIndex,n.endIndex),r=n.depth;;--r){var o=n.$from.node(r),i=n.$from.index(r),s=n.$to.indexAfter(r);if(rt;p--)d||e.index(p)>0?(d=!0,c=S.from(e.node(p).copy(c)),u++):a--;for(var h=S.empty,m=0,g=o,y=!1;g>t;g--)y||r.after(g+1)=0;r--)e=S.from(t[r].type.create(t[r].attrs,e));var o=n.start,i=n.end;return this.step(new Ft(o,i,o,i,new T(e,0,0),t.length,!0))},at.prototype.setBlockType=function(n,t,e,r){var o=this;if(t===void 0&&(t=n),!e.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=this.steps.length;return this.doc.nodesBetween(n,t,function(s,a){if(s.isTextblock&&!s.hasMarkup(e,r)&&wf(o.doc,o.mapping.slice(i).map(a),e)){o.clearIncompatible(o.mapping.slice(i).map(a,1),e);var l=o.mapping.slice(i),c=l.map(a,1),u=l.map(a+s.nodeSize,1);return o.step(new Ft(c,u,c+1,u-1,new T(S.from(e.create(r,null,s.marks)),0,0),1,!0)),!1}}),this};function wf(n,t,e){var r=n.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,e)}at.prototype.setNodeMarkup=function(n,t,e,r){var o=this.doc.nodeAt(n);if(!o)throw new RangeError("No node at given position");t||(t=o.type);var i=t.create(e,null,r||o.marks);if(o.isLeaf)return this.replaceWith(n,n+o.nodeSize,i);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);return this.step(new Ft(n,n+o.nodeSize,n+1,n+o.nodeSize-1,new T(S.from(i),0,0),1,!0))};function Oe(n,t,e,r){e===void 0&&(e=1);var o=n.resolve(t),i=o.depth-e,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var a=o.depth-1,l=e-2;a>i;a--,l--){var c=o.node(a),u=o.index(a);if(c.type.spec.isolating)return!1;var p=c.content.cutByIndex(u,c.childCount),d=r&&r[l]||c;if(d!=c&&(p=p.replaceChild(0,d.type.create(d.attrs))),!c.canReplace(u+1,c.childCount)||!d.type.validContent(p))return!1}var h=o.indexAfter(i),m=r&&r[0];return o.node(i).canReplaceWith(h,h,m?m.type:o.node(i+1).type)}at.prototype.split=function(n,t,e){t===void 0&&(t=1);for(var r=this.doc.resolve(n),o=S.empty,i=S.empty,s=r.depth,a=r.depth-t,l=t-1;s>a;s--,l--){o=S.from(r.node(s).copy(o));var c=e&&e[l];i=S.from(c?c.type.create(c.attrs,i):r.node(s).copy(i))}return this.step(new Ee(n,n,new T(o.append(i),t,t),!0))};function Qo(n,t){var e=n.resolve(t),r=e.index();return Sf(e.nodeBefore,e.nodeAfter)&&e.parent.canReplace(r,r+1)}function Sf(n,t){return n&&t&&!n.isLeaf&&n.canAppend(t)}at.prototype.join=function(n,t){t===void 0&&(t=1);var e=new Ee(n-t,n+t,T.empty,!0);return this.step(e)};function xf(n,t,e){var r=n.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),e))return t;if(r.parentOffset==0)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,e))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,e))return r.after(s+1);if(a=0;a--){var l=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,c=r.index(a)+(l>0?1:0),u=r.node(a),p=!1;if(s==1)p=u.canReplace(c,c,o);else{var d=u.contentMatchAt(c).findWrapping(o.firstChild.type);p=d&&u.canReplaceWith(c,c,d[0])}if(p)return l==0?r.pos:l<0?r.before(a+1):r.after(a+1)}return null}function Zo(n,t,e){for(var r=[],o=0;o=i.pos?null:new t(o.pos,i.pos,this.mark)},t.prototype.merge=function(r){if(r instanceof t&&r.mark.eq(this.mark)&&this.from<=r.to&&this.to>=r.from)return new t(Math.min(this.from,r.from),Math.max(this.to,r.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(r,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,r.markFromJSON(o.mark))},t}(Ct);Ct.jsonID("addMark",ti);var Yn=function(n){function t(e,r,o){n.call(this),this.from=e,this.to=r,this.mark=o}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.apply=function(r){var o=this,i=r.slice(this.from,this.to),s=new T(Zo(i.content,function(a){return a.mark(o.mark.removeFromSet(a.marks))}),i.openStart,i.openEnd);return Dt.fromReplace(r,this.from,this.to,s)},t.prototype.invert=function(){return new ti(this.from,this.to,this.mark)},t.prototype.map=function(r){var o=r.mapResult(this.from,1),i=r.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(r){if(r instanceof t&&r.mark.eq(this.mark)&&this.from<=r.to&&this.to>=r.from)return new t(Math.min(this.from,r.from),Math.max(this.to,r.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(r,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,r.markFromJSON(o.mark))},t}(Ct);Ct.jsonID("removeMark",Yn),at.prototype.addMark=function(n,t,e){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(n,t,function(l,c,u){if(!!l.isInline){var p=l.marks;if(!e.isInSet(p)&&u.type.allowsMarkType(e.type)){for(var d=Math.max(c,n),h=Math.min(c+l.nodeSize,t),m=e.addToSet(p),g=0;g=0;d--)this.step(o[d]);return this};function Mf(n,t,e,r){if(e===void 0&&(e=t),r===void 0&&(r=T.empty),t==e&&!r.size)return null;var o=n.resolve(t),i=n.resolve(e);return ma(o,i,r)?new Ee(t,e,r):new Qt(o,i,r).fit()}at.prototype.replace=function(n,t,e){t===void 0&&(t=n),e===void 0&&(e=T.empty);var r=Mf(this.doc,n,t,e);return r&&this.step(r),this},at.prototype.replaceWith=function(n,t,e){return this.replace(n,t,new T(S.from(e),0,0))},at.prototype.delete=function(n,t){return this.replace(n,t,T.empty)},at.prototype.insert=function(n,t){return this.replaceWith(n,n,t)};function ma(n,t,e){return!e.openStart&&!e.openEnd&&n.start()==t.start()&&n.parent.canReplace(n.index(),t.index(),e.content)}var Qt=function(t,e,r){this.$to=e,this.$from=t,this.unplaced=r,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=S.empty;for(var s=t.depth;s>0;s--)this.placed=S.from(t.node(s).copy(this.placed))},va={depth:{configurable:!0}};va.depth.get=function(){return this.frontier.length-1},Qt.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var e=this.mustMoveInline(),r=this.placed.size-this.depth-this.$from.depth,o=this.$from,i=this.close(e<0?this.$to:o.doc.resolve(e));if(!i)return null;for(var s=this.placed,a=o.depth,l=i.depth;a&&l&&s.childCount==1;)s=s.firstChild.content,a--,l--;var c=new T(s,a,l);if(e>-1)return new Ft(o.pos,e,this.$to.pos,this.$to.end(),c,r);if(c.size||o.pos!=this.$to.pos)return new Ee(o.pos,i.pos,c)},Qt.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var e=this.unplaced.openStart;e>=0;e--){var r=void 0,o=void 0;e?(o=ei(this.unplaced.content,e-1).firstChild,r=o.content):r=this.unplaced.content;for(var i=r.firstChild,s=this.depth;s>=0;s--){var a=this.frontier[s],l=a.type,c=a.match,u=void 0,p=void 0;if(t==1&&(i?c.matchType(i.type)||(p=c.fillBefore(S.from(i),!1)):l.compatibleContent(o.type)))return{sliceDepth:e,frontierDepth:s,parent:o,inject:p};if(t==2&&i&&(u=c.findWrapping(i.type)))return{sliceDepth:e,frontierDepth:s,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}},Qt.prototype.openMore=function(){var t=this.unplaced,e=t.content,r=t.openStart,o=t.openEnd,i=ei(e,r);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new T(e,r+1,Math.max(o,i.size+r>=e.size-o?r+1:0)),!0)},Qt.prototype.dropNode=function(){var t=this.unplaced,e=t.content,r=t.openStart,o=t.openEnd,i=ei(e,r);if(i.childCount<=1&&r>0){var s=e.size-r<=r+i.size;this.unplaced=new T(Xn(e,r-1,1),r-1,s?r-1:o)}else this.unplaced=new T(Xn(e,r,1),r,o)},Qt.prototype.placeNodes=function(t){for(var e=t.sliceDepth,r=t.frontierDepth,o=t.parent,i=t.inject,s=t.wrap;this.depth>r;)this.closeFrontierNode();if(s)for(var a=0;a1||u==0||b.content.size)&&(m=N,d.push(ga(b.mark(g.allowedMarks(b.marks)),p==1?u:0,p==c.childCount?k:-1)))}var v=p==c.childCount;v||(k=-1),this.placed=Qn(this.placed,r,S.from(d)),this.frontier[r].match=m,v&&k<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var O=0,C=c;O1&&i==this.$to.end(--o);)++i;return i},Qt.prototype.findCloseLevel=function(t){t:for(var e=Math.min(this.depth,t.depth);e>=0;e--){var r=this.frontier[e],o=r.match,i=r.type,s=e=0;l--){var c=this.frontier[l],u=c.match,p=c.type,d=ni(t,l,p,u,!0);if(!d||d.childCount)continue t}return{depth:e,fit:a,move:s?t.doc.resolve(t.after(e+1)):t}}}},Qt.prototype.close=function(t){var e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=Qn(this.placed,e.depth,e.fit)),t=e.move;for(var r=e.depth+1;r<=t.depth;r++){var o=t.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,t.index(r));this.openFrontierNode(o.type,o.attrs,i)}return t},Qt.prototype.openFrontierNode=function(t,e,r){var o=this.frontier[this.depth];o.match=o.match.matchType(t),this.placed=Qn(this.placed,this.depth,S.from(t.create(e,r))),this.frontier.push({type:t,match:t.contentMatch})},Qt.prototype.closeFrontierNode=function(){var t=this.frontier.pop(),e=t.match.fillBefore(S.empty,!0);e.childCount&&(this.placed=Qn(this.placed,this.frontier.length,e))},Object.defineProperties(Qt.prototype,va);function Xn(n,t,e){return t==0?n.cutByIndex(e):n.replaceChild(0,n.firstChild.copy(Xn(n.firstChild.content,t-1,e)))}function Qn(n,t,e){return t==0?n.append(e):n.replaceChild(n.childCount-1,n.lastChild.copy(Qn(n.lastChild.content,t-1,e)))}function ei(n,t){for(var e=0;e1&&(r=r.replaceChild(0,ga(r.firstChild,t-1,r.childCount==1?e-1:0))),t>0&&(r=n.type.contentMatch.fillBefore(r).append(r),e<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(S.empty,!0)))),n.copy(r)}function ni(n,t,e,r,o){var i=n.node(t),s=o?n.indexAfter(t):n.index(t);if(s==i.childCount&&!e.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!Cf(e,i.content,s)?a:null}function Cf(n,t,e){for(var r=e;r0;a--,l--){var c=r.node(a).type.spec;if(c.defining||c.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==l&&i.splice(1,0,-a)}for(var u=i.indexOf(s),p=[],d=e.openStart,h=e.content,m=0;;m++){var g=h.firstChild;if(p.push(g),m==e.openStart)break;h=g.content}d>0&&p[d-1].type.spec.defining&&r.node(u).type!=p[d-1].type?d-=1:d>=2&&p[d-1].isTextblock&&p[d-2].type.spec.defining&&r.node(u).type!=p[d-2].type&&(d-=2);for(var y=e.openStart;y>=0;y--){var k=(y+d+1)%(e.openStart+1),b=p[k];if(!!b)for(var N=0;N=0&&(this.replace(n,t,e),!(this.steps.length>I));V--){var F=i[V];F<0||(n=r.before(F),t=o.after(F))}return this};function ya(n,t,e,r,o){if(tr){var s=o.contentMatchAt(0),a=s.fillBefore(n).append(n);n=a.append(s.matchFragment(a).fillBefore(S.empty,!0))}return n}at.prototype.replaceRangeWith=function(n,t,e){if(!e.isInline&&n==t&&this.doc.resolve(n).parent.content.size){var r=xf(this.doc,n,e.type);r!=null&&(n=t=r)}return this.replaceRange(n,t,new T(S.from(e),0,0))},at.prototype.deleteRange=function(n,t){for(var e=this.doc.resolve(n),r=this.doc.resolve(t),o=ba(e,r),i=0;i0&&(a||e.node(s-1).canReplace(e.index(s-1),r.indexAfter(s-1))))return this.delete(e.before(s),r.after(s))}for(var l=1;l<=e.depth&&l<=r.depth;l++)if(n-e.start(l)==e.depth-l&&t>e.end(l)&&r.end(l)-t!=r.depth-l)return this.delete(e.before(l),t);return this.delete(n,t)};function ba(n,t){for(var e=[],r=Math.min(n.depth,t.depth),o=r;o>=0;o--){var i=n.start(o);if(it.pos+(t.depth-o)||n.node(o).type.spec.isolating||t.node(o).type.spec.isolating)break;(i==t.start(o)||o==n.depth&&o==t.depth&&n.parent.inlineContent&&t.parent.inlineContent&&o&&t.start(o-1)==i-1)&&e.push(o)}return e}var ri=Object.create(null),z=function(t,e,r){this.ranges=r||[new Ef(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},Ie={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};Ie.anchor.get=function(){return this.$anchor.pos},Ie.head.get=function(){return this.$head.pos},Ie.from.get=function(){return this.$from.pos},Ie.to.get=function(){return this.$to.pos},Ie.$from.get=function(){return this.ranges[0].$from},Ie.$to.get=function(){return this.ranges[0].$to},Ie.empty.get=function(){for(var n=this.ranges,t=0;t=0;i--){var s=e<0?Sn(t.node(0),t.node(i),t.before(i+1),t.index(i),e,r):Sn(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,e,r);if(s)return s}},z.near=function(t,e){return e===void 0&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new Ne(t.node(0))},z.atStart=function(t){return Sn(t,t,0,0,1)||new Ne(t)},z.atEnd=function(t){return Sn(t,t,t.content.size,t.childCount,-1)||new Ne(t)},z.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var r=ri[e.type];if(!r)throw new RangeError("No selection type "+e.type+" defined");return r.fromJSON(t,e)},z.jsonID=function(t,e){if(t in ri)throw new RangeError("Duplicate use of selection JSON ID "+t);return ri[t]=e,e.prototype.jsonID=t,e},z.prototype.getBookmark=function(){return K.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(z.prototype,Ie),z.prototype.visible=!0;var Ef=function(t,e){this.$from=t,this.$to=e},K=function(n){function t(r,o){o===void 0&&(o=r),n.call(this,r,o)}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={$cursor:{configurable:!0}};return e.$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 n.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=T.empty),n.prototype.replace.call(this,o,i),i==T.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 Zn(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 l=n.findFrom(i,s,!0)||n.findFrom(i,-s,!0);if(l)i=l.$head;else return n.near(i,s)}return o.parent.inlineContent||(a==0?o=i:(o=(n.findFrom(o,-s,!0)||n.findFrom(o,s,!0)).$anchor,o.pos0?0:1);o>0?s=0;s+=o){var a=t.child(s);if(a.isAtom){if(!i&&P.isSelectable(a))return P.create(n,e-(o<0?a.nodeSize:0))}else{var l=Sn(n,a,e+o,o<0?a.childCount:0,o,i);if(l)return l}e+=a.nodeSize*o}}function ka(n,t,e){var r=n.steps.length-1;if(!(r0},t.prototype.setStoredMarks=function(o){return this.storedMarks=o,this.updated|=qr,this},t.prototype.ensureMarks=function(o){return J.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()))},e.storedMarksSet.get=function(){return(this.updated&qr)>0},t.prototype.addStep=function(o,i){n.prototype.addStep.call(this,o,i),this.updated=this.updated&~qr,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)||J.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 l=this.storedMarks;if(!l){var c=this.doc.resolve(i);l=s==i?c.marks():c.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(i,s,a.text(o,l)),this.selection.empty||this.setSelection(z.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]},e.isGeneric.get=function(){for(var r in this.meta)return!1;return!0},t.prototype.scrollIntoView=function(){return this.updated|=Sa,this},e.scrolledIntoView.get=function(){return(this.updated&Sa)>0},Object.defineProperties(t.prototype,e),t}(at);function xa(n,t){return!t||!n?n:n.bind(t)}var tr=function(t,e,r){this.name=t,this.init=xa(e.init,r),this.apply=xa(e.apply,r)},Tf=[new tr("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new tr("selection",{init:function(t,e){return t.selection||z.atStart(e.doc)},apply:function(t){return t.selection}}),new tr("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,r,o){return o.selection.$cursor?t.storedMarks:null}}),new tr("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],oi=function(t,e){var r=this;this.schema=t,this.fields=Tf.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach(function(o){if(r.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");r.plugins.push(o),r.pluginsByKey[o.key]=o,o.spec.state&&r.fields.push(new tr(o.key,o.spec.state,o))})},Et=function(t){this.config=t},jr={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};jr.schema.get=function(){return this.config.schema},jr.plugins.get=function(){return this.config.plugins},Et.prototype.apply=function(t){return this.applyTransaction(t).state},Et.prototype.filterTransaction=function(t,e){e===void 0&&(e=-1);for(var r=0;r-1&&er.splice(e,1)},Object.defineProperties(Et.prototype,jr);var er=[];function Ma(n,t,e){for(var r in n){var o=n[r];o instanceof Function?o=o.bind(t):r=="handleDOMEvents"&&(o=Ma(o,t,{})),e[r]=o}return e}var Ht=function(t){this.props={},t.props&&Ma(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:Ca("plugin")};Ht.prototype.getState=function(t){return t[this.key]};var ii=Object.create(null);function Ca(n){return n in ii?n+"$"+ ++ii[n]:(ii[n]=0,n+"$")}var ae=function(t){t===void 0&&(t="key"),this.key=Ca(t)};ae.prototype.get=function(t){return t.config.pluginsByKey[this.key]},ae.prototype.getState=function(t){return t[this.key]};function si(n,t){return n.selection.empty?!1:(t&&t(n.tr.deleteSelection().scrollIntoView()),!0)}function Ea(n,t,e){var r=n.selection,o=r.$cursor;if(!o||(e?!e.endOfTextblock("backward",n):o.parentOffset>0))return!1;var i=Na(o);if(!i){var s=o.blockRange(),a=s&&wn(s);return a==null?!1:(t&&t(n.tr.lift(s,a).scrollIntoView()),!0)}var l=i.nodeBefore;if(!l.type.spec.isolating&&Pa(n,i,t))return!0;if(o.parent.content.size==0&&(xn(l,"end")||P.isSelectable(l))){if(t){var c=n.tr.deleteRange(o.before(),o.after());c.setSelection(xn(l,"end")?z.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):P.create(c.doc,i.pos-l.nodeSize)),t(c.scrollIntoView())}return!0}return l.isAtom&&i.depth==o.depth-1?(t&&t(n.tr.delete(i.pos-l.nodeSize,i.pos).scrollIntoView()),!0):!1}function xn(n,t,e){for(;n;n=t=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(e&&n.childCount!=1)return!1}return!1}function Oa(n,t,e){var r=n.selection,o=r.$head,i=r.empty,s=o;if(!i)return!1;if(o.parent.isTextblock){if(e?!e.endOfTextblock("backward",n):o.parentOffset>0)return!1;s=Na(o)}var a=s&&s.nodeBefore;return!a||!P.isSelectable(a)?!1:(t&&t(n.tr.setSelection(P.create(n.doc,s.pos-a.nodeSize)).scrollIntoView()),!0)}function Na(n){if(!n.parent.type.spec.isolating)for(var t=n.depth-1;t>=0;t--){if(n.index(t)>0)return n.doc.resolve(n.before(t+1));if(n.node(t).type.spec.isolating)break}return null}function Ta(n,t,e){var r=n.selection,o=r.$cursor;if(!o||(e?!e.endOfTextblock("forward",n):o.parentOffset=0;t--){var e=n.node(t);if(n.index(t)+11&&r.after()!=r.end(-1)){var o=r.before();if(Oe(n.doc,o))return t&&t(n.tr.split(o).scrollIntoView()),!0}var i=r.blockRange(),s=i&&wn(i);return s==null?!1:(t&&t(n.tr.lift(i,s).scrollIntoView()),!0)}function _f(n,t){var e=n.selection,r=e.$from,o=e.$to;if(n.selection instanceof P&&n.selection.node.isBlock)return!r.parentOffset||!Oe(n.doc,r.pos)?!1:(t&&t(n.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(t){var i=o.parentOffset==o.parent.content.size,s=n.tr;(n.selection instanceof K||n.selection instanceof Ne)&&s.deleteSelection();var a=r.depth==0?null:ai(r.node(-1).contentMatchAt(r.indexAfter(-1))),l=i&&a?[{type:a}]:null,c=Oe(s.doc,s.mapping.map(r.pos),1,l);if(!l&&!c&&Oe(s.doc,s.mapping.map(r.pos),1,a&&[{type:a}])&&(l=[{type:a}],c=!0),c&&(s.split(s.mapping.map(r.pos),1,l),!i&&!r.parentOffset&&r.parent.type!=a)){var u=s.mapping.map(r.before()),p=s.doc.resolve(u);r.node(-1).canReplaceWith(p.index(),p.index()+1,a)&&s.setNodeMarkup(s.mapping.map(r.before()),a)}t(s.scrollIntoView())}return!0}function Af(n,t){var e=n.selection,r=e.$from,o=e.to,i,s=r.sharedDepth(o);return s==0?!1:(i=r.before(s),t&&t(n.tr.setSelection(P.create(n.doc,i))),!0)}function Df(n,t){return t&&t(n.tr.setSelection(new Ne(n.doc))),!0}function Rf(n,t,e){var r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&t.parent.canReplace(i-1,i)?(e&&e(n.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(o.isTextblock||Qo(n.doc,t.pos))?!1:(e&&e(n.tr.clearIncompatible(t.pos,r.type,r.contentMatchAt(r.childCount)).join(t.pos).scrollIntoView()),!0)}function Pa(n,t,e){var r=t.nodeBefore,o=t.nodeAfter,i,s;if(r.type.spec.isolating||o.type.spec.isolating)return!1;if(Rf(n,t,e))return!0;var a=t.parent.canReplace(t.index(),t.index()+1);if(a&&(i=(s=r.contentMatchAt(r.childCount)).findWrapping(o.type))&&s.matchType(i[0]||o.type).validEnd){if(e){for(var l=t.pos+o.nodeSize,c=S.empty,u=i.length-1;u>=0;u--)c=S.from(i[u].create(null,c));c=S.from(r.copy(c));var p=n.tr.step(new Ft(t.pos-1,l,t.pos,l,new T(c,1,0),i.length,!0)),d=l+2*i.length;Qo(p.doc,d)&&p.join(d),e(p.scrollIntoView())}return!0}var h=z.findFrom(t,1),m=h&&h.$from.blockRange(h.$to),g=m&&wn(m);if(g!=null&&g>=t.depth)return e&&e(n.tr.lift(m,g).scrollIntoView()),!0;if(a&&xn(o,"start",!0)&&xn(r,"end")){for(var y=r,k=[];k.push(y),!y.isTextblock;)y=y.lastChild;for(var b=o,N=1;!b.isTextblock;b=b.firstChild)N++;if(y.canReplace(y.childCount,y.childCount,b.content)){if(e){for(var v=S.empty,O=k.length-1;O>=0;O--)v=S.from(k[O].copy(v));var C=n.tr.step(new Ft(t.pos-k.length,t.pos+o.nodeSize,t.pos+N,t.pos+o.nodeSize-N,new T(v,k.length,0),0,!0));e(C.scrollIntoView())}return!0}}return!1}function za(n,t){return function(e,r){var o=e.selection,i=o.$from,s=o.$to,a=i.blockRange(s),l=a&&Xo(a,n,t);return l?(r&&r(e.tr.wrap(a,l).scrollIntoView()),!0):!1}}function Vf(n,t){return function(e,r){var o=e.selection,i=o.from,s=o.to,a=!1;return e.doc.nodesBetween(i,s,function(l,c){if(a)return!1;if(!(!l.isTextblock||l.hasMarkup(n,t)))if(l.type==n)a=!0;else{var u=e.doc.resolve(c),p=u.index();a=u.parent.canReplaceWith(p,p+1,n)}}),a?(r&&r(e.tr.setBlockType(i,s,n,t).scrollIntoView()),!0):!1}}function li(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];return function(e,r,o){for(var i=0;i=2&&i.node(a.depth-1).type.compatibleContent(n)&&a.startIndex==0){if(i.index(a.depth-1)==0)return!1;var u=e.doc.resolve(a.start-2);c=new Kn(u,u,a.depth),a.endIndex=0;s--)i=S.from(e[s].type.create(e[s].attrs,i));n.step(new Ft(t.start-(r?2:0),t.end,t.start,t.end,new T(i,0,0),e.length,!0));for(var a=0,l=0;la;s--)i-=o.child(s).nodeSize,r.delete(i-1,i+1);var l=r.doc.resolve(e.start),c=l.nodeAfter;if(r.mapping.map(e.end)!=e.start+l.nodeAfter.nodeSize)return!1;var u=e.startIndex==0,p=e.endIndex==o.childCount,d=l.node(-1),h=l.index(-1);if(!d.canReplace(h+(u?0:1),h+1,c.content.append(p?S.empty:S.from(o))))return!1;var m=l.pos,g=m+c.nodeSize;return r.step(new Ft(m-(u?1:0),g+(p?1:0),m+1,g-1,new T((u?S.empty:S.from(o.copy(S.empty))).append(p?S.empty:S.from(o.copy(S.empty))),u?0:1,p?0:1),u?0:1)),t(r.scrollIntoView()),!0}function Hf(n){return function(t,e){var r=t.selection,o=r.$from,i=r.$to,s=o.blockRange(i,function(g){return g.childCount&&g.firstChild.type==n});if(!s)return!1;var a=s.startIndex;if(a==0)return!1;var l=s.parent,c=l.child(a-1);if(c.type!=n)return!1;if(e){var u=c.lastChild&&c.lastChild.type==l.type,p=S.from(u?n.create():null),d=new T(S.from(n.create(null,S.from(l.type.create(null,p)))),u?3:1,0),h=s.start,m=s.end;e(t.tr.step(new Ft(h-(u?3:1),m,h,m,d,1,!0)).scrollIntoView())}return!0}}var M={};if(typeof navigator!="undefined"&&typeof document!="undefined"){var ui=/Edge\/(\d+)/.exec(navigator.userAgent),Ha=/MSIE \d/.test(navigator.userAgent),fi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),pi=M.ie=!!(Ha||fi||ui);M.ie_version=Ha?document.documentMode||6:fi?+fi[1]:ui?+ui[1]:null,M.gecko=!pi&&/gecko\/(\d+)/i.test(navigator.userAgent),M.gecko_version=M.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var di=!pi&&/Chrome\/(\d+)/.exec(navigator.userAgent);M.chrome=!!di,M.chrome_version=di&&+di[1],M.safari=!pi&&/Apple Computer/.test(navigator.vendor),M.ios=M.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),M.mac=M.ios||/Mac/.test(navigator.platform),M.android=/Android \d/.test(navigator.userAgent),M.webkit="webkitFontSmoothing"in document.documentElement.style,M.webkit_version=M.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var qt=function(n){for(var t=0;;t++)if(n=n.previousSibling,!n)return t},hi=function(n){var t=n.assignedSlot||n.parentNode;return t&&t.nodeType==11?t.host:t},Ja=null,Te=function(n,t,e){var r=Ja||(Ja=document.createRange());return r.setEnd(n,e==null?n.nodeValue.length:e),r.setStart(n,t||0),r},Wr=function(n,t,e,r){return e&&($a(n,t,e,r,-1)||$a(n,t,e,r,1))},Jf=/^(img|br|input|textarea|hr)$/i;function $a(n,t,e,r,o){for(;;){if(n==e&&t==r)return!0;if(t==(o<0?0:me(n))){var i=n.parentNode;if(i.nodeType!=1||qf(n)||Jf.test(n.nodeName)||n.contentEditable=="false")return!1;t=qt(n)+(o<0?0:1),n=i}else if(n.nodeType==1){if(n=n.childNodes[t+(o<0?-1:0)],n.contentEditable=="false")return!1;t=o<0?me(n):0}else return!1}}function me(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function $f(n,t,e){for(var r=t==0,o=t==me(n);r||o;){if(n==e)return!0;var i=qt(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,o=o&&i==me(n)}}function qf(n){for(var t,e=n;e&&!(t=e.pmViewDesc);e=e.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==n||t.contentDOM==n)}var mi=function(n){var t=n.isCollapsed;return t&&M.chrome&&n.rangeCount&&!n.getRangeAt(0).collapsed&&(t=!1),t};function Mn(n,t){var e=document.createEvent("Event");return e.initEvent("keydown",!0,!0),e.keyCode=n,e.key=e.code=t,e}function jf(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Pe(n,t){return typeof n=="number"?n:n[t]}function Wf(n){var t=n.getBoundingClientRect(),e=t.width/n.offsetWidth||1,r=t.height/n.offsetHeight||1;return{left:t.left,right:t.left+n.clientWidth*e,top:t.top,bottom:t.top+n.clientHeight*r}}function qa(n,t,e){for(var r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument,s=e||n.dom;s;s=hi(s))if(s.nodeType==1){var a=s==i.body||s.nodeType!=1,l=a?jf(i):Wf(s),c=0,u=0;if(t.topl.bottom-Pe(r,"bottom")&&(u=t.bottom-l.bottom+Pe(o,"bottom")),t.leftl.right-Pe(r,"right")&&(c=t.right-l.right+Pe(o,"right")),c||u)if(a)i.defaultView.scrollBy(c,u);else{var p=s.scrollLeft,d=s.scrollTop;u&&(s.scrollTop+=u),c&&(s.scrollLeft+=c);var h=s.scrollLeft-p,m=s.scrollTop-d;t={left:t.left-h,top:t.top-m,right:t.right-h,bottom:t.bottom-m}}if(a)break}}function Kf(n){for(var t=n.dom.getBoundingClientRect(),e=Math.max(0,t.top),r,o,i=(t.left+t.right)/2,s=e+1;s=e-20){r=a,o=l.top;break}}}return{refDOM:r,refTop:o,stack:ja(n.dom)}}function ja(n){for(var t=[],e=n.ownerDocument;n&&(t.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),n!=e);n=hi(n));return t}function Uf(n){var t=n.refDOM,e=n.refTop,r=n.stack,o=t?t.getBoundingClientRect().top:0;Wa(r,o==0?0:o-e)}function Wa(n,t){for(var e=0;e=a){s=Math.max(d.bottom,s),a=Math.min(d.top,a);var h=d.left>t.left?d.left-t.left:d.right=(d.left+d.right)/2?1:0));continue}}!e&&(t.left>=d.right&&t.top>=d.top||t.left>=d.left&&t.top>=d.bottom)&&(i=c+1)}}return e&&e.nodeType==3?Yf(e,o):!e||r&&e.nodeType==1?{node:n,offset:i}:Ka(e,o)}function Yf(n,t){for(var e=n.nodeValue.length,r=document.createRange(),o=0;o=(i.left+i.right)/2?1:0)}}return{node:n,offset:0}}function vi(n,t){return n.left>=t.left-1&&n.left<=t.right+1&&n.top>=t.top-1&&n.top<=t.bottom+1}function Xf(n,t){var e=n.parentNode;return e&&/^li$/i.test(e.nodeName)&&t.left(a.left+a.right)/2?1:-1}return n.docView.posFromDOM(o,i,s)}function Zf(n,t,e,r){for(var o=-1,i=t;i!=n.dom;){var s=n.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else if(a.right-1?o:n.docView.posFromDOM(t,e)}function Ua(n,t,e){var r=n.childNodes.length;if(r&&e.topt.top&&s++}i==n.dom&&s==i.childNodes.length-1&&i.lastChild.nodeType==1&&t.top>i.lastChild.getBoundingClientRect().bottom?u=n.state.doc.content.size:(s==0||i.nodeType!=1||i.childNodes[s-1].nodeName!="BR")&&(u=Zf(n,i,s,t))}u==null&&(u=Qf(n,c,t));var g=n.docView.nearestDesc(c,!0);return{pos:u,inside:g?g.posAtStart-g.border:-1}}function ze(n,t){var e=n.getClientRects();return e.length?e[t<0?0:e.length-1]:n.getBoundingClientRect()}var ep=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ga(n,t,e){var r=n.docView.domFromPos(t,e<0?-1:1),o=r.node,i=r.offset,s=M.webkit||M.gecko;if(o.nodeType==3)if(s&&(ep.test(o.nodeValue)||(e<0?!i:i==o.nodeValue.length))){var a=ze(Te(o,i,i),e);if(M.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i=0&&i==o.nodeValue.length?(u--,d=1):e<0?u--:p++,nr(ze(Te(o,u,p),d),d<0)}if(!n.state.doc.resolve(t).parent.inlineContent){if(i&&(e<0||i==me(o))){var h=o.childNodes[i-1];if(h.nodeType==1)return gi(h.getBoundingClientRect(),!1)}if(i=0)}if(i&&(e<0||i==me(o))){var g=o.childNodes[i-1],y=g.nodeType==3?Te(g,me(g)-(s?0:1)):g.nodeType==1&&(g.nodeName!="BR"||!g.nextSibling)?g:null;if(y)return nr(ze(y,1),!1)}if(i=0)}function nr(n,t){if(n.width==0)return n;var e=t?n.left:n.right;return{top:n.top,bottom:n.bottom,left:e,right:e}}function gi(n,t){if(n.height==0)return n;var e=t?n.top:n.bottom;return{top:e,bottom:e,left:n.left,right:n.right}}function Ya(n,t,e){var r=n.state,o=n.root.activeElement;r!=t&&n.updateState(t),o!=n.dom&&n.focus();try{return e()}finally{r!=t&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function np(n,t,e){var r=t.selection,o=e=="up"?r.$from:r.$to;return Ya(n,t,function(){for(var i=n.docView.domFromPos(o.pos,e=="up"?-1:1),s=i.node;;){var a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.dom;break}s=a.dom.parentNode}for(var l=Ga(n,o.pos,1),c=s.firstChild;c;c=c.nextSibling){var u=void 0;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=Te(c,0,c.nodeValue.length).getClientRects();else continue;for(var p=0;pd.top+1&&(e=="up"?l.top-d.top>(d.bottom-l.top)*2:d.bottom-l.bottom>(l.bottom-d.top)*2))return!1}}return!0})}var rp=/[\u0590-\u08ac]/;function op(n,t,e){var r=t.selection,o=r.$head;if(!o.parent.isTextblock)return!1;var i=o.parentOffset,s=!i,a=i==o.parent.content.size,l=n.root.getSelection();return!rp.test(o.parent.textContent)||!l.modify?e=="left"||e=="backward"?s:a:Ya(n,t,function(){var c=l.getRangeAt(0),u=l.focusNode,p=l.focusOffset,d=l.caretBidiLevel;l.modify("move",e,"character");var h=o.depth?n.docView.domAfterPos(o.before()):n.dom,m=!h.contains(l.focusNode.nodeType==1?l.focusNode:l.focusNode.parentNode)||u==l.focusNode&&p==l.focusOffset;return l.removeAllRanges(),l.addRange(c),d!=null&&(l.caretBidiLevel=d),m})}var Xa=null,Qa=null,Za=!1;function ip(n,t,e){return Xa==t&&Qa==e?Za:(Xa=t,Qa=e,Za=e=="up"||e=="down"?np(n,t,e):op(n,t,e))}var le=0,tl=1,rr=2,Le=3,Q=function(t,e,r,o){this.parent=t,this.children=e,this.dom=r,r.pmViewDesc=this,this.contentDOM=o,this.dirty=le},ve={size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0},ignoreForCoords:{configurable:!0}};Q.prototype.matchesWidget=function(){return!1},Q.prototype.matchesMark=function(){return!1},Q.prototype.matchesNode=function(){return!1},Q.prototype.matchesHack=function(t){return!1},Q.prototype.parseRule=function(){return null},Q.prototype.stopEvent=function(){return!1},ve.size.get=function(){for(var n=0,t=0;tqt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))l=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(e==0)for(var c=t;;c=c.parentNode){if(c==this.dom){l=!1;break}if(c.parentNode.firstChild!=c)break}if(l==null&&e==t.childNodes.length)for(var u=t;;u=u.parentNode){if(u==this.dom){l=!0;break}if(u.parentNode.lastChild!=u)break}}return(l==null?r>0:l)?this.posAtEnd:this.posAtStart},Q.prototype.nearestDesc=function(t,e){for(var r=!0,o=t;o;o=o.parentNode){var i=this.getDesc(o);if(i&&(!e||i.node))if(r&&i.nodeDOM&&!(i.nodeDOM.nodeType==1?i.nodeDOM.contains(t.nodeType==1?t:t.parentNode):i.nodeDOM==t))r=!1;else return i}},Q.prototype.getDesc=function(t){for(var e=t.pmViewDesc,r=e;r;r=r.parent)if(r==this)return e},Q.prototype.posFromDOM=function(t,e,r){for(var o=t;o;o=o.parentNode){var i=this.getDesc(o);if(i)return i.localPosFromDOM(t,e,r)}return-1},Q.prototype.descAt=function(t){for(var e=0,r=0;et||s instanceof ol){o=t-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,e);for(var l=void 0;r&&!(l=this.children[r-1]).size&&l instanceof el&&l.widget.type.side>=0;r--);if(e<=0){for(var c,u=!0;c=r?this.children[r-1]:null,!(!c||c.dom.parentNode==this.contentDOM);r--,u=!1);return c&&e&&u&&!c.border&&!c.domAtom?c.domFromPos(c.size,e):{node:this.contentDOM,offset:c?qt(c.dom)+1:0}}else{for(var p,d=!0;p=r=u&&e<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,e,u);t=s;for(var p=a;p>0;p--){var d=this.children[p-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){o=qt(d.dom)+1;break}t-=d.size}o==-1&&(o=0)}if(o>-1&&(c>e||a==this.children.length-1)){e=c;for(var h=a+1;hl&&se){var A=p;p=d,d=A}var I=document.createRange();I.setEnd(d.node,d.offset),I.setStart(p.node,p.offset),h.removeAllRanges(),h.addRange(I)}}},Q.prototype.ignoreMutation=function(t){return!this.contentDOM&&t.type!="selection"},ve.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},Q.prototype.markDirty=function(t,e){for(var r=0,o=0;o=r:tr){var a=r+i.border,l=s-i.border;if(t>=a&&e<=l){this.dirty=t==r||e==s?rr:tl,t==a&&e==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Le:i.markDirty(t-a,e-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM?rr:Le}r=s}this.dirty=rr},Q.prototype.markParentsDirty=function(){for(var t=1,e=this.parent;e;e=e.parent,t++){var r=t==1?rr:tl;e.dirty0&&(a=wi(a,0,r,i));for(var c=0;c-1?c:null,p=c&&c.pos<0,d=new Zt(this,u&&u.node);fp(this.node,this.innerDeco,function(h,m,g){h.spec.marks?d.syncToMarks(h.spec.marks,a,o):h.type.side>=0&&!g&&d.syncToMarks(m==s.node.childCount?J.none:s.node.child(m).marks,a,o),d.placeWidget(h,o,l)},function(h,m,g,y){d.syncToMarks(h.marks,a,o);var k;d.findNodeMatch(h,m,g,y)||p&&o.state.selection.from>l&&o.state.selection.to-1&&d.updateNodeAt(h,m,g,k,o)||d.updateNextNode(h,m,g,o,y)||d.addNode(h,m,g,o,l),l+=h.nodeSize}),d.syncToMarks(Fe,a,o),this.node.isTextblock&&d.addTextblockHacks(),d.destroyRest(),(d.changed||this.dirty==rr)&&(u&&this.protectLocalComposition(o,u),il(this.contentDOM,this.children,o),M.ios&&pp(this.dom))},t.prototype.localCompositionInfo=function(o,i){var s=o.state.selection,a=s.from,l=s.to;if(!(!(o.state.selection instanceof K)||ai+this.node.content.size)){var c=o.root.getSelection(),u=dp(c.focusNode,c.focusOffset);if(!(!u||!this.dom.contains(u.parentNode)))if(this.node.inlineContent){var p=u.nodeValue,d=hp(this.node.content,p,a-i,l-i);return d<0?null:{node:u,pos:d,text:p}}else return{node:u,pos:-1}}},t.prototype.protectLocalComposition=function(o,i){var s=i.node,a=i.pos,l=i.text;if(!this.getDesc(s)){for(var c=s;c.parentNode!=this.contentDOM;c=c.parentNode){for(;c.previousSibling;)c.parentNode.removeChild(c.previousSibling);for(;c.nextSibling;)c.parentNode.removeChild(c.nextSibling);c.pmViewDesc&&(c.pmViewDesc=null)}var u=new sp(this,c,s,l);o.compositionNodes.push(u),this.children=wi(this.children,a,a+l.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=le},t.prototype.updateOuterDeco=function(o){if(!ki(o,this.outerDeco)){var i=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=sl(this.dom,this.nodeDOM,bi(this.outerDeco,this.node,i),bi(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")},e.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(t.prototype,e),t}(Q);function nl(n,t,e,r,o){return al(r,t,n),new or(null,n,t,e,r,r,r,o,0)}var rl=function(n){function t(r,o,i,s,a,l,c){n.call(this,r,o,i,s,a,null,l,c)}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={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!=le&&!this.inParent()||!o.sameMarkup(this.node)?!1:(this.updateOuterDeco(i),(this.dirty!=le||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=le,!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):n.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),l=document.createTextNode(a.text);return new t(this.parent,a,this.outerDeco,this.innerDeco,l,l,s)},t.prototype.markDirty=function(o,i){n.prototype.markDirty.call(this,o,i),this.dom!=this.nodeDOM&&(o==0||i==this.nodeDOM.nodeValue.length)&&(this.dirty=Le)},e.domAtom.get=function(){return!1},Object.defineProperties(t.prototype,e),t}(or),ol=function(n){function t(){n.apply(this,arguments)}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={domAtom:{configurable:!0},ignoreForCoords:{configurable:!0}};return t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.matchesHack=function(o){return this.dirty==le&&this.dom.nodeName==o},e.domAtom.get=function(){return!0},e.ignoreForCoords.get=function(){return this.dom.nodeName=="IMG"},Object.defineProperties(t.prototype,e),t}(Q),ap=function(n){function t(e,r,o,i,s,a,l,c,u,p){n.call(this,e,r,o,i,s,a,l,u,p),this.spec=c}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.update=function(r,o,i,s){if(this.dirty==Le)return!1;if(this.spec.update){var a=this.spec.update(r,o,i);return a&&this.updateInner(r,o,i,s),a}else return!this.contentDOM&&!r.isLeaf?!1:n.prototype.update.call(this,r,o,i,s)},t.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():n.prototype.selectNode.call(this)},t.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():n.prototype.deselectNode.call(this)},t.prototype.setSelection=function(r,o,i,s){this.spec.setSelection?this.spec.setSelection(r,o,i):n.prototype.setSelection.call(this,r,o,i,s)},t.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),n.prototype.destroy.call(this)},t.prototype.stopEvent=function(r){return this.spec.stopEvent?this.spec.stopEvent(r):!1},t.prototype.ignoreMutation=function(r){return this.spec.ignoreMutation?this.spec.ignoreMutation(r):n.prototype.ignoreMutation.call(this,r)},t}(or);function il(n,t,e){for(var r=n.firstChild,o=!1,i=0;i>1,s=Math.min(i,t.length);o-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var c=yi.create(this.top,t[i],e,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,i++}},Zt.prototype.findNodeMatch=function(t,e,r,o){var i=this.top.children,s=-1;if(o>=this.preMatch.index){for(var a=this.index;a0&&r>0;r--){var i=t[r-1],s=i.node;if(!!s){if(s!=n.child(e-1))break;--e,o.set(i,e)}}return{index:e,matched:o}}function up(n,t){return n.type.side-t.type.side}function fp(n,t,e,r){var o=t.locals(n),i=0;if(o.length==0){for(var s=0;si;)c.push(o[l++]);var b=i+g.nodeSize;if(g.isText){var N=b;l0){if(n.childNodes.length>t&&n.childNodes[t].nodeType==3)return n.childNodes[t];n=n.childNodes[t-1],t=me(n)}else if(n.nodeType==1&&t=e){var u=l.lastIndexOf(t,r-a);if(u>=0&&u+t.length+a>=e)return a+u}}}return-1}function wi(n,t,e,r,o){for(var i=[],s=0,a=0;s=e||u<=t?i.push(l):(ce&&i.push(l.slice(e-c,l.size,r)))}return i}function cl(n,t){var e=n.root.getSelection(),r=n.state.doc;if(!e.focusNode)return null;var o=n.docView.nearestDesc(e.focusNode),i=o&&o.size==0,s=n.docView.posFromDOM(e.focusNode,e.focusOffset);if(s<0)return null;var a=r.resolve(s),l,c;if(mi(e)){for(l=a;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&P.isSelectable(o.node)&&o.parent&&!(o.node.isInline&&$f(e.focusNode,e.focusOffset,o.dom))){var u=o.posBefore;c=new P(s==u?a:r.resolve(u))}}else{var p=n.docView.posFromDOM(e.anchorNode,e.anchorOffset);if(p<0)return null;l=r.resolve(p)}if(!c){var d=t=="pointer"||n.state.selection.head0?r.max(o):r.min(o),s=i.parent.inlineContent?i.depth?n.doc.resolve(t>0?i.after():i.before()):null:i;return s&&z.findFrom(s,t)}function rn(n,t){return n.dispatch(n.state.tr.setSelection(t).scrollIntoView()),!0}function vl(n,t,e){var r=n.state.selection;if(r instanceof K){if(!r.empty||e.indexOf("s")>-1)return!1;if(n.endOfTextblock(t>0?"right":"left")){var o=Ci(n.state,t);return o&&o instanceof P?rn(n,o):!1}else if(!(M.mac&&e.indexOf("m")>-1)){var i=r.$head,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,a;if(!s||s.isText)return!1;var l=t<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(a=n.docView.descAt(l))&&!a.contentDOM?P.isSelectable(s)?rn(n,new P(t<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):M.webkit?rn(n,new K(n.state.doc.resolve(t<0?l:l+s.nodeSize))):!1:!1}}else{if(r instanceof P&&r.node.isInline)return rn(n,new K(t>0?r.$to:r.$from));var c=Ci(n.state,t);return c?rn(n,c):!1}}function Kr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function sr(n){var t=n.pmViewDesc;return t&&t.size==0&&(n.nextSibling||n.nodeName!="BR")}function Ei(n){var t=n.root.getSelection(),e=t.focusNode,r=t.focusOffset;if(!!e){var o,i,s=!1;for(M.gecko&&e.nodeType==1&&r0){if(e.nodeType!=1)break;var a=e.childNodes[r-1];if(sr(a))o=e,i=--r;else if(a.nodeType==3)e=a,r=e.nodeValue.length;else break}else{if(gl(e))break;for(var l=e.previousSibling;l&&sr(l);)o=e.parentNode,i=qt(l),l=l.previousSibling;if(l)e=l,r=Kr(e);else{if(e=e.parentNode,e==n.dom)break;r=0}}s?Ni(n,t,e,r):o&&Ni(n,t,o,i)}}function Oi(n){var t=n.root.getSelection(),e=t.focusNode,r=t.focusOffset;if(!!e){for(var o=Kr(e),i,s;;)if(r-1||M.mac&&e.indexOf("m")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||n.endOfTextblock(t<0?"up":"down")){var s=Ci(n.state,t);if(s&&s instanceof P)return rn(n,s)}if(!o.parent.inlineContent){var a=t<0?o:i,l=r instanceof Ne?z.near(a,t):z.findFrom(a,t);return l?rn(n,l):!1}return!1}function bl(n,t){if(!(n.state.selection instanceof K))return!0;var e=n.state.selection,r=e.$head,o=e.$anchor,i=e.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(n.endOfTextblock(t>0?"forward":"backward"))return!0;var s=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){var a=n.state.tr;return t<0?a.delete(r.pos-s.nodeSize,r.pos):a.delete(r.pos,r.pos+s.nodeSize),n.dispatch(a),!0}return!1}function kl(n,t,e){n.domObserver.stop(),t.contentEditable=e,n.domObserver.start()}function bp(n){if(!(!M.safari||n.state.selection.$head.parentOffset>0)){var t=n.root.getSelection(),e=t.focusNode,r=t.focusOffset;if(e&&e.nodeType==1&&r==0&&e.firstChild&&e.firstChild.contentEditable=="false"){var o=e.firstChild;kl(n,o,!0),setTimeout(function(){return kl(n,o,!1)},20)}}}function kp(n){var t="";return n.ctrlKey&&(t+="c"),n.metaKey&&(t+="m"),n.altKey&&(t+="a"),n.shiftKey&&(t+="s"),t}function wp(n,t){var e=t.keyCode,r=kp(t);return e==8||M.mac&&e==72&&r=="c"?bl(n,-1)||Ei(n):e==46||M.mac&&e==68&&r=="c"?bl(n,1)||Oi(n):e==13||e==27?!0:e==37?vl(n,-1,r)||Ei(n):e==39?vl(n,1,r)||Oi(n):e==38?yl(n,-1,r)||Ei(n):e==40?bp(n)||yl(n,1,r)||Oi(n):r==(M.mac?"m":"c")&&(e==66||e==73||e==89||e==90)}function Sp(n,t,e){var r=n.docView.parseRange(t,e),o=r.node,i=r.fromOffset,s=r.toOffset,a=r.from,l=r.to,c=n.root.getSelection(),u=null,p=c.anchorNode;if(p&&n.dom.contains(p.nodeType==1?p:p.parentNode)&&(u=[{node:p,offset:c.anchorOffset}],mi(c)||u.push({node:c.focusNode,offset:c.focusOffset})),M.chrome&&n.lastKeyCode===8)for(var d=s;d>i;d--){var h=o.childNodes[d-1],m=h.pmViewDesc;if(h.nodeName=="BR"&&!m){s=d;break}if(!m||m.size)break}var g=n.state.doc,y=n.someProp("domParser")||se.fromSchema(n.state.schema),k=g.resolve(a),b=null,N=y.parse(o,{topNode:k.parent,topMatch:k.parent.contentMatchAt(k.index()),topOpen:!0,from:i,to:s,preserveWhitespace:k.parent.type.spec.code?"full":!0,editableContent:!0,findPositions:u,ruleFromNode:xp,context:k});if(u&&u[0].pos!=null){var v=u[0].pos,O=u[1]&&u[1].pos;O==null&&(O=v),b={anchor:v+a,head:O+a}}return{doc:N,sel:b,from:a,to:l}}function xp(n){var t=n.pmViewDesc;if(t)return t.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(M.safari&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){var e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(n.parentNode.lastChild==n||M.safari&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0}}function Mp(n,t,e,r,o){if(t<0){var i=n.lastSelectionTime>Date.now()-50?n.lastSelectionOrigin:null,s=cl(n,i);if(s&&!n.state.selection.eq(s)){var a=n.state.tr.setSelection(s);i=="pointer"?a.setMeta("pointer",!0):i=="key"&&a.scrollIntoView(),n.dispatch(a)}return}var l=n.state.doc.resolve(t),c=l.sharedDepth(e);t=l.before(c+1),e=n.state.doc.resolve(e).after(c+1);var u=n.state.selection,p=Sp(n,t,e);if(M.chrome&&n.cursorWrapper&&p.sel&&p.sel.anchor==n.cursorWrapper.deco.from){var d=n.cursorWrapper.deco.type.toDOM.nextSibling,h=d&&d.nodeValue?d.nodeValue.length:1;p.sel={anchor:p.sel.anchor+h,head:p.sel.anchor+h}}var m=n.state.doc,g=m.slice(p.from,p.to),y,k;n.lastKeyCode===8&&Date.now()-100Date.now()-225||M.android)&&o.some(function(X){return X.nodeName=="DIV"||X.nodeName=="P"})&&n.someProp("handleKeyDown",function(X){return X(n,Mn(13,"Enter"))})){n.lastIOSEnter=0;return}else{if(p.sel){var N=wl(n,n.state.doc,p.sel);N&&!N.eq(n.state.selection)&&n.dispatch(n.state.tr.setSelection(N))}return}n.domChangeCount++,n.state.selection.fromn.state.selection.from&&b.start<=n.state.selection.from+2?b.start=n.state.selection.from:b.endA=n.state.selection.to-2&&(b.endB+=n.state.selection.to-b.endA,b.endA=n.state.selection.to)),M.ie&&M.ie_version<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>p.from&&p.doc.textBetween(b.start-p.from-1,b.start-p.from+1)==" \xA0"&&(b.start--,b.endA--,b.endB--);var v=p.doc.resolveNoCache(b.start-p.from),O=p.doc.resolveNoCache(b.endB-p.from),C=v.sameParent(O)&&v.parent.inlineContent,A;if((M.ios&&n.lastIOSEnter>Date.now()-225&&(!C||o.some(function(X){return X.nodeName=="DIV"||X.nodeName=="P"}))||!C&&v.posb.start&&Ep(m,b.start,b.endA,v,O)&&n.someProp("handleKeyDown",function(X){return X(n,Mn(8,"Backspace"))})){M.android&&M.chrome&&n.domObserver.suppressSelectionUpdates();return}M.chrome&&M.android&&b.toB==b.from&&(n.lastAndroidDelete=Date.now()),M.android&&!C&&v.start()!=O.start()&&O.parentOffset==0&&v.depth==O.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==b.endA&&(b.endB-=2,O=p.doc.resolveNoCache(b.endB-p.from),setTimeout(function(){n.someProp("handleKeyDown",function(X){return X(n,Mn(13,"Enter"))})},20));var I=b.start,V=b.endA,F,st,et,U;if(C){if(v.pos==O.pos)M.ie&&M.ie_version<=11&&v.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(function(){return He(n)},20)),F=n.state.tr.delete(I,V),st=m.resolve(b.start).marksAcross(m.resolve(b.endA));else if(b.endA==b.endB&&(U=m.resolve(b.start))&&(et=Cp(v.parent.content.cut(v.parentOffset,O.parentOffset),U.parent.content.cut(U.parentOffset,b.endA-U.start()))))F=n.state.tr,et.type=="add"?F.addMark(I,V,et.mark):F.removeMark(I,V,et.mark);else if(v.parent.child(v.index()).isText&&v.index()==O.index()-(O.textOffset?0:1)){var Nt=v.parent.textBetween(v.parentOffset,O.parentOffset);if(n.someProp("handleTextInput",function(X){return X(n,I,V,Nt)}))return;F=n.state.tr.insertText(Nt,I,V)}}if(F||(F=n.state.tr.replace(I,V,p.doc.slice(b.start-p.from,b.endB-p.from))),p.sel){var Z=wl(n,F.doc,p.sel);Z&&!(M.chrome&&M.android&&n.composing&&Z.empty&&(b.start!=b.endB||n.lastAndroidDeletet.content.size?null:xi(n,t.resolve(e.anchor),t.resolve(e.head))}function Cp(n,t){for(var e=n.firstChild.marks,r=t.firstChild.marks,o=e,i=r,s,a,l,c=0;ce||Ti(s,!0,!1)0&&(t||n.indexAfter(r)==n.node(r).childCount);)r--,o++,t=!1;if(e)for(var i=n.node(r).maybeChild(n.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function Op(n,t,e,r,o){var i=n.findDiffStart(t,e);if(i==null)return null;var s=n.findDiffEnd(t,e+n.size,e+t.size),a=s.a,l=s.b;if(o=="end"){var c=Math.max(0,i-Math.min(a,l));r-=a+c-i}if(a=a?i-r:0;i-=u,l=i+(l-a),a=i}else if(l=l?i-r:0;i-=p,a=i+(a-l),l=i}return{start:i,endA:a,endB:l}}function Sl(n,t){for(var e=[],r=t.content,o=t.openStart,i=t.openEnd;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;var s=r.firstChild;e.push(s.type.name,s.attrs!=s.type.defaultAttrs?s.attrs:null),r=s.content}var a=n.someProp("clipboardSerializer")||ht.fromSchema(n.state.schema),l=_l(),c=l.createElement("div");c.appendChild(a.serializeFragment(r,{document:l}));for(var u=c.firstChild,p;u&&u.nodeType==1&&(p=Nl[u.nodeName.toLowerCase()]);){for(var d=p.length-1;d>=0;d--){for(var h=l.createElement(p[d]);c.firstChild;)h.appendChild(c.firstChild);c.appendChild(h),p[d]!="tbody"&&(o++,i++)}u=c.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(e));var m=n.someProp("clipboardTextSerializer",function(g){return g(t)})||t.content.textBetween(0,t.content.size,` +var u1=Object.defineProperty,f1=Object.defineProperties;var p1=Object.getOwnPropertyDescriptors;var Po=Object.getOwnPropertySymbols;var ju=Object.prototype.hasOwnProperty,Wu=Object.prototype.propertyIsEnumerable;var Ku=(f,H,dt)=>H in f?u1(f,H,{enumerable:!0,configurable:!0,writable:!0,value:dt}):f[H]=dt,x=(f,H)=>{for(var dt in H||(H={}))ju.call(H,dt)&&Ku(f,dt,H[dt]);if(Po)for(var dt of Po(H))Wu.call(H,dt)&&Ku(f,dt,H[dt]);return f},Lt=(f,H)=>f1(f,p1(H));var Uu=(f,H)=>{var dt={};for(var Xt in f)ju.call(f,Xt)&&H.indexOf(Xt)<0&&(dt[Xt]=f[Xt]);if(f!=null&&Po)for(var Xt of Po(f))H.indexOf(Xt)<0&&Wu.call(f,Xt)&&(dt[Xt]=f[Xt]);return dt};var __vite_style__=document.createElement("style");__vite_style__.innerHTML=`.ProseMirror li>p:first-child,.ProseMirror div{display:inline}ul[data-type=taskList]{list-style:none;padding:0}ul[data-type=taskList] li{display:flex;align-items:center}ul[data-type=taskList] li>label{flex:0 0 auto;margin-right:.5rem} +`;document.head.appendChild(__vite_style__);(function(f,H){typeof exports=="object"&&typeof module!="undefined"?H(require("vue")):typeof define=="function"&&define.amd?define(["vue"],H):(f=typeof globalThis!="undefined"?globalThis:f||self,H(f.Vue))})(this,function(f){"use strict";function H(n){this.content=n}H.prototype={constructor:H,find:function(n){for(var t=0;t>1}},H.from=function(n){if(n instanceof H)return n;var t=[];if(n)for(var e in n)t.push(e,n[e]);return new H(t)};var dt=H;function Xt(n,t,e){for(var r=0;;r++){if(r==n.childCount||r==t.childCount)return n.childCount==t.childCount?null:e;var o=n.child(r),i=t.child(r);if(o==i){e+=o.nodeSize;continue}if(!o.sameMarkup(i))return e;if(o.isText&&o.text!=i.text){for(var s=0;o.text[s]==i.text[s];s++)e++;return e}if(o.content.size||i.content.size){var a=Xt(o.content,i.content,e+1);if(a!=null)return a}e+=o.nodeSize}}function Hs(n,t,e,r){for(var o=n.childCount,i=t.childCount;;){if(o==0||i==0)return o==i?null:{a:e,b:r};var s=n.child(--o),a=t.child(--i),l=s.nodeSize;if(s==a){e-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:e,b:r};if(s.isText&&s.text!=a.text){for(var c=0,u=Math.min(s.text.length,a.text.length);ct&&r(l,o+a,i,s)!==!1&&l.content.size){var u=a+1;l.nodesBetween(Math.max(0,t-u),Math.min(l.content.size,e-u),r,o+u)}a=c}},S.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},S.prototype.textBetween=function(t,e,r,o){var i="",s=!0;return this.nodesBetween(t,e,function(a,l){a.isText?(i+=a.text.slice(Math.max(t,l)-l,e-l),s=!r):a.isLeaf&&o?(i+=typeof o=="function"?o(a):o,s=!r):!s&&a.isBlock&&(i+=r,s=!0)},0),i},S.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(e.isText&&e.sameMarkup(r)&&(o[o.length-1]=e.withText(e.text+r.text),i=1);it)for(var i=0,s=0;st&&((se)&&(a.isText?a=a.cut(Math.max(0,t-s),Math.min(a.text.length,e-s)):a=a.cut(Math.max(0,t-s-1),Math.min(a.content.size,e-s-1))),r.push(a),o+=a.nodeSize),s=l}return new S(r,o)},S.prototype.cutByIndex=function(t,e){return t==e?S.empty:t==0&&e==this.content.length?this:new S(this.content.slice(t,e))},S.prototype.replaceChild=function(t,e){var r=this.content[t];if(r==e)return this;var o=this.content.slice(),i=this.size+e.nodeSize-r.nodeSize;return o[t]=e,new S(o,i)},S.prototype.addToStart=function(t){return new S([t].concat(this.content),this.size+t.nodeSize)},S.prototype.addToEnd=function(t){return new S(this.content.concat(t),this.size+t.nodeSize)},S.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;ethis.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var r=0,o=0;;r++){var i=this.child(r),s=o+i.nodeSize;if(s>=t)return s==t||e>0?Pr(r+1,s):Pr(r,o);o=s}},S.prototype.toString=function(){return"<"+this.toStringInner()+">"},S.prototype.toStringInner=function(){return this.content.join(", ")},S.prototype.toJSON=function(){return this.content.length?this.content.map(function(t){return t.toJSON()}):null},S.fromJSON=function(t,e){if(!e)return S.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new S(e.map(t.nodeFromJSON))},S.fromArray=function(t){if(!t.length)return S.empty;for(var e,r=0,o=0;othis.type.rank&&(e||(e=t.slice(0,o)),e.push(this),r=!0),e&&e.push(i)}}return e||(e=t.slice()),r||e.push(this),e},J.prototype.removeFromSet=function(t){for(var e=0;e0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},T.fromJSON=function(t,e){if(!e)return T.empty;var r=e.openStart||0,o=e.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new T(S.fromJSON(t,e.content),r,o)},T.maxOpen=function(t,e){e===void 0&&(e=!0);for(var r=0,o=0,i=t.firstChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.firstChild)r++;for(var s=t.lastChild;s&&!s.isLeaf&&(e||!s.type.spec.isolating);s=s.lastChild)o++;return new T(t,r,o)},Object.defineProperties(T.prototype,Js);function $s(n,t,e){var r=n.findIndex(t),o=r.index,i=r.offset,s=n.maybeChild(o),a=n.findIndex(e),l=a.index,c=a.offset;if(i==t||s.isText){if(c!=e&&!n.child(l).isText)throw new RangeError("Removing non-flat range");return n.cut(0,t).append(n.cut(e))}if(o!=l)throw new RangeError("Removing non-flat range");return n.replaceChild(o,s.copy($s(s.content,t-i-1,e-i-1)))}function qs(n,t,e,r){var o=n.findIndex(t),i=o.index,s=o.offset,a=n.maybeChild(i);if(s==t||a.isText)return r&&!r.canReplace(i,i,e)?null:n.cut(0,t).append(e).append(n.cut(t));var l=qs(a.content,t-s-1,e);return l&&n.replaceChild(i,a.copy(l))}T.empty=new T(S.empty,0,0);function Gu(n,t,e){if(e.openStart>n.depth)throw new he("Inserted content deeper than insertion position");if(n.depth-e.openStart!=t.depth-e.openEnd)throw new he("Inconsistent open depths");return js(n,t,e,0)}function js(n,t,e,r){var o=n.index(r),i=n.node(r);if(o==t.index(r)&&r=0&&n.isText&&n.sameMarkup(t[e])?t[e]=n.withText(t[e].text+n.text):t.push(n)}function Wn(n,t,e,r){var o=(t||n).node(e),i=0,s=t?t.index(e):o.childCount;n&&(i=n.index(e),n.depth>e?i++:n.textOffset&&(Ze(n.nodeAfter,r),i++));for(var a=i;ao&&Lo(n,t,o+1),s=r.depth>o&&Lo(e,r,o+1),a=[];return Wn(null,n,o,a),i&&s&&t.index(o)==e.index(o)?(Ws(i,s),Ze(tn(i,Ks(n,t,e,r,o+1)),a)):(i&&Ze(tn(i,Lr(n,t,o+1)),a),Wn(t,e,o,a),s&&Ze(tn(s,Lr(e,r,o+1)),a)),Wn(r,null,o,a),new S(a)}function Lr(n,t,e){var r=[];if(Wn(null,n,e,r),n.depth>e){var o=Lo(n,t,e+1);Ze(tn(o,Lr(n,t,e+1)),r)}return Wn(t,null,e,r),new S(r)}function Yu(n,t){for(var e=t.depth-n.openStart,r=t.node(e),o=r.copy(n.content),i=e-1;i>=0;i--)o=t.node(i).copy(S.from(o));return{start:o.resolveNoCache(n.openStart+e),end:o.resolveNoCache(o.content.size-n.openEnd-e)}}var nt=function(t,e,r){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=r},yn={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};nt.prototype.resolveDepth=function(t){return t==null?this.depth:t<0?this.depth+t:t},yn.parent.get=function(){return this.node(this.depth)},yn.doc.get=function(){return this.node(0)},nt.prototype.node=function(t){return this.path[this.resolveDepth(t)*3]},nt.prototype.index=function(t){return this.path[this.resolveDepth(t)*3+1]},nt.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)},nt.prototype.start=function(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1},nt.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},nt.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]},nt.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},yn.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},yn.nodeAfter.get=function(){var n=this.parent,t=this.index(this.depth);if(t==n.childCount)return null;var e=this.pos-this.path[this.path.length-1],r=n.child(t);return e?n.child(t).cut(e):r},yn.nodeBefore.get=function(){var n=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(n).cut(0,t):n==0?null:this.parent.child(n-1)},nt.prototype.posAtIndex=function(t,e){e=this.resolveDepth(e);for(var r=this.path[e*3],o=e==0?0:this.path[e*3-1]+1,i=0;i0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},nt.prototype.blockRange=function(t,e){if(t===void 0&&(t=this),t.pos=0;r--)if(t.pos<=this.end(r)&&(!e||e(this.node(r))))return new Kn(this,t,r)},nt.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},nt.prototype.max=function(t){return t.pos>this.pos?t:this},nt.prototype.min=function(t){return t.pos=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var r=[],o=0,i=e,s=t;;){var a=s.content.findIndex(i),l=a.index,c=a.offset,u=i-c;if(r.push(s,l,o+c),!u||(s=s.child(l),s.isText))break;i=u-1,o+=c+1}return new nt(e,r,i)},nt.resolveCached=function(t,e){for(var r=0;rt&&this.nodesBetween(t,e,function(i){return r.isInSet(i.marks)&&(o=!0),!o}),o},$t.isBlock.get=function(){return this.type.isBlock},$t.isTextblock.get=function(){return this.type.isTextblock},$t.inlineContent.get=function(){return this.type.inlineContent},$t.isInline.get=function(){return this.type.isInline},$t.isText.get=function(){return this.type.isText},$t.isLeaf.get=function(){return this.type.isLeaf},$t.isAtom.get=function(){return this.type.isAtom},$.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()+")"),Us(this.marks,t)},$.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},$.prototype.canReplace=function(t,e,r,o,i){r===void 0&&(r=S.empty),o===void 0&&(o=0),i===void 0&&(i=r.childCount);var s=this.contentMatchAt(t).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(var l=o;l=0;e--)t=n[e].type.name+"("+t+")";return t}var xt=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},Fr={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};xt.parse=function(t,e){var r=new Hr(t,e);if(r.next==null)return xt.empty;var o=Ys(r);r.next&&r.err("Unexpected trailing text");var i=af(sf(o));return lf(i,r),i},xt.prototype.matchType=function(t){for(var e=0;e>1},xt.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},xt.prototype.toString=function(){var t=[];function e(r){t.push(r);for(var o=1;o"+t.indexOf(r.next[s+1]);return i}).join(` +`)},Object.defineProperties(xt.prototype,Fr),xt.empty=new xt(!0);var Hr=function(t,e){this.string=t,this.nodeTypes=e,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()},Gs={next:{configurable:!0}};Gs.next.get=function(){return this.tokens[this.pos]},Hr.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},Hr.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties(Hr.prototype,Gs);function Ys(n){var t=[];do t.push(tf(n));while(n.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function tf(n){var t=[];do t.push(ef(n));while(n.next&&n.next!=")"&&n.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function ef(n){for(var t=of(n);;)if(n.eat("+"))t={type:"plus",expr:t};else if(n.eat("*"))t={type:"star",expr:t};else if(n.eat("?"))t={type:"opt",expr:t};else if(n.eat("{"))t=nf(n,t);else break;return t}function Xs(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");var t=Number(n.next);return n.pos++,t}function nf(n,t){var e=Xs(n),r=e;return n.eat(",")&&(n.next!="}"?r=Xs(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:e,max:r,expr:t}}function rf(n,t){var e=n.nodeTypes,r=e[t];if(r)return[r];var o=[];for(var i in e){var s=e[i];s.groups.indexOf(t)>-1&&o.push(s)}return o.length==0&&n.err("No node type or group '"+t+"' found"),o}function of(n){if(n.eat("(")){var t=Ys(n);return n.eat(")")||n.err("Missing closing paren"),t}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{var e=rf(n,n.next).map(function(r){return n.inline==null?n.inline=r.isInline:n.inline!=r.isInline&&n.err("Mixing inline and block content"),{type:"name",value:r}});return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function sf(n){var t=[[]];return o(i(n,0),e()),t;function e(){return t.push([])-1}function r(s,a,l){var c={term:l,to:a};return t[s].push(c),c}function o(s,a){s.forEach(function(l){return l.to=a})}function i(s,a){if(s.type=="choice")return s.exprs.reduce(function(k,b){return k.concat(i(b,a))},[]);if(s.type=="seq")for(var l=0;;l++){var c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=e())}else if(s.type=="star"){var u=e();return r(a,u),o(i(s.expr,u),u),[r(u)]}else if(s.type=="plus"){var p=e();return o(i(s.expr,a),p),o(i(s.expr,p),p),[r(p)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){for(var d=a,h=0;h-1&&o[d+1];Zs(n,p).forEach(function(m){h||o.push(u,h=[]),h.indexOf(m)==-1&&h.push(m)})}})});for(var i=t[r.join(",")]=new xt(r.indexOf(n.length-1)>-1),s=0;s-1},At.prototype.allowsMarks=function(t){if(this.markSet==null)return!0;for(var e=0;e-1};var en=function(t){this.spec={};for(var e in t)this.spec[e]=t[e];this.spec.nodes=dt.from(t.nodes),this.spec.marks=dt.from(t.marks),this.nodes=At.compile(this.spec.nodes,this),this.marks=Ve.compile(this.spec.marks,this);var r=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=r[s]||(r[s]=xt.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet=a=="_"?null:a?ia(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(var l in this.marks){var c=this.marks[l],u=c.spec.excludes;c.excluded=u==null?[c]:u==""?[]:ia(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)};en.prototype.node=function(t,e,r,o){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof At){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(e,r,o)},en.prototype.text=function(t,e){var r=this.nodes.text;return new Zu(r,r.defaultAttrs,t,J.setFrom(e))},en.prototype.mark=function(t,e){return typeof t=="string"&&(t=this.marks[t]),t.create(e)},en.prototype.nodeFromJSON=function(t){return $.fromJSON(this,t)},en.prototype.markFromJSON=function(t){return J.fromJSON(this,t)},en.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};function ia(n,t){for(var e=[],r=0;r-1)&&e.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return e}var se=function(t,e){var r=this;this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach(function(o){o.tag?r.tags.push(o):o.style&&r.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)})};se.prototype.parse=function(t,e){e===void 0&&(e={});var r=new tt(this,e,!1);return r.addAll(t,null,e.from,e.to),r.finish()},se.prototype.parseSlice=function(t,e){e===void 0&&(e={});var r=new tt(this,e,!0);return r.addAll(t,null,e.from,e.to),T.maxOpen(r.finish())},se.prototype.matchTag=function(t,e,r){for(var o=r?this.tags.indexOf(r)+1:0;ot.length&&(s.style.charCodeAt(t.length)!=61||s.style.slice(t.length+1)!=e))){if(s.getAttrs){var a=s.getAttrs(e);if(a===!1)continue;s.attrs=a}return s}}},se.schemaRules=function(t){var e=[];function r(l){for(var c=l.priority==null?50:l.priority,u=0;u=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},Ce.prototype.applyPending=function(t){for(var e=0,r=this.pendingMarks;e=0;o--){var i=this.nodes[o],s=i.findWrapping(t);if(s&&(!e||e.length>s.length)&&(e=s,r=i,!s.length)||i.solid)break}if(!e)return!1;this.sync(r);for(var a=0;athis.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},tt.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},tt.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t){this.open=e;return}},jo.currentPos.get=function(){this.closeExtra();for(var n=0,t=this.open;t>=0;t--){for(var e=this.nodes[t].content,r=e.length-1;r>=0;r--)n+=e[r].nodeSize;t&&n++}return n},tt.prototype.findAtPoint=function(t,e){if(this.find)for(var r=0;r-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var r=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(l,c){for(;l>=0;l--){var u=r[l];if(u==""){if(l==r.length-1||l==0)continue;for(;c>=s;c--)if(a(l-1,c))return!0;return!1}else{var p=c>0||c==0&&i?e.nodes[c].type:o&&c>=s?o.node(c-s).type:null;if(!p||p.name!=u&&p.groups.indexOf(u)==-1)return!1;c--}}return!0};return a(r.length-1,this.open)},tt.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var r=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(var o in this.parser.schema.nodes){var i=this.parser.schema.nodes[o];if(i.isTextblock&&i.defaultAttrs)return i}},tt.prototype.addPendingMark=function(t){var e=hf(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},tt.prototype.removePendingMark=function(t,e){for(var r=this.open;r>=0;r--){var o=this.nodes[r],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==e)break}},Object.defineProperties(tt.prototype,jo);function uf(n){for(var t=n.firstChild,e=null;t;t=t.nextSibling){var r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&sa.hasOwnProperty(r)&&e?(e.appendChild(t),t=e):r=="li"?e=t:r&&(e=null)}}function ff(n,t){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,t)}function pf(n){for(var t=/\s*([\w-]+)\s*:\s*([^;]+)/g,e,r=[];e=t.exec(n);)r.push(e[1],e[2].trim());return r}function la(n){var t={};for(var e in n)t[e]=n[e];return t}function df(n,t){var e=t.schema.nodes,r=function(s){var a=e[s];if(!!a.allowsMarkType(n)){var l=[],c=function(u){l.push(u);for(var p=0;p=0;o--){var i=this.serializeMark(t.marks[o],t.isInline,e);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r},ht.prototype.serializeMark=function(t,e,r){r===void 0&&(r={});var o=this.marks[t.type.name];return o&&ht.renderSpec(Wo(r),o(t,e))},ht.renderSpec=function(t,e,r){if(r===void 0&&(r=null),typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;var o=e[0],i=o.indexOf(" ");i>0&&(r=o.slice(0,i),o=o.slice(i+1));var s=null,a=r?t.createElementNS(r,o):t.createElement(o),l=e[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(var u in l)if(l[u]!=null){var p=u.indexOf(" ");p>0?a.setAttributeNS(u.slice(0,p),u.slice(p+1),l[u]):a.setAttribute(u,l[u])}}for(var d=c;dc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{var m=ht.renderSpec(t,h,r),g=m.dom,y=m.contentDOM;if(a.appendChild(g),y){if(s)throw new RangeError("Multiple content holes");s=y}}}return{dom:a,contentDOM:s}},ht.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new ht(this.nodesFromSchema(t),this.marksFromSchema(t)))},ht.nodesFromSchema=function(t){var e=ca(t.nodes);return e.text||(e.text=function(r){return r.text}),e},ht.marksFromSchema=function(t){return ca(t.marks)};function ca(n){var t={};for(var e in n){var r=n[e].spec.toDOM;r&&(t[e]=r)}return t}function Wo(n){return n.document||window.document}var ua=65535,fa=Math.pow(2,16);function mf(n,t){return n+t*fa}function pa(n){return n&ua}function vf(n){return(n-(n&ua))/fa}var Ko=function(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=null),this.pos=t,this.deleted=e,this.recover=r},mt=function(t,e){e===void 0&&(e=!1),this.ranges=t,this.inverted=e};mt.prototype.recover=function(t){var e=0,r=pa(t);if(!this.inverted)for(var o=0;ot)break;var c=this.ranges[a+i],u=this.ranges[a+s],p=l+c;if(t<=p){var d=c?t==l?-1:t==p?1:e:e,h=l+o+(d<0?0:u);if(r)return h;var m=t==(e<0?l:p)?null:mf(a/3,t-l);return new Ko(h,e<0?t!=l:t!=p,m)}o+=u-c}return r?t+o:new Ko(t+o)},mt.prototype.touches=function(t,e){for(var r=0,o=pa(e),i=this.inverted?2:1,s=this.inverted?1:2,a=0;at)break;var c=this.ranges[a+i],u=l+c;if(t<=u&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1},mt.prototype.forEach=function(t){for(var e=this.inverted?2:1,r=this.inverted?1:2,o=0,i=0;o=0;e--){var o=t.getMirror(e);this.appendMap(t.maps[e].invert(),o!=null&&o>e?r-o-1:null)}},Mt.prototype.invert=function(){var t=new Mt;return t.appendMappingInverted(this),t},Mt.prototype.map=function(t,e){if(e===void 0&&(e=1),this.mirror)return this._map(t,e,!0);for(var r=this.from;ri&&l0},at.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(at.prototype,Uo);function Jr(){throw new Error("Override me")}var Go=Object.create(null),Ct=function(){};Ct.prototype.apply=function(t){return Jr()},Ct.prototype.getMap=function(){return mt.empty},Ct.prototype.invert=function(t){return Jr()},Ct.prototype.map=function(t){return Jr()},Ct.prototype.merge=function(t){return null},Ct.prototype.toJSON=function(){return Jr()},Ct.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var r=Go[e.stepType];if(!r)throw new RangeError("No step type "+e.stepType+" defined");return r.fromJSON(t,e)},Ct.jsonID=function(t,e){if(t in Go)throw new RangeError("Duplicate use of step JSON ID "+t);return Go[t]=e,e.prototype.jsonID=t,e};var Dt=function(t,e){this.doc=t,this.failed=e};Dt.ok=function(t){return new Dt(t,null)},Dt.fail=function(t){return new Dt(null,t)},Dt.fromReplace=function(t,e,r,o){try{return Dt.ok(t.replace(e,r,o))}catch(i){if(i instanceof he)return Dt.fail(i.message);throw i}};var Ee=function(n){function t(e,r,o,i){n.call(this),this.from=e,this.to=r,this.slice=o,this.structure=!!i}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.apply=function(r){return this.structure&&Yo(r,this.from,this.to)?Dt.fail("Structure replace would overwrite content"):Dt.fromReplace(r,this.from,this.to,this.slice)},t.prototype.getMap=function(){return new mt([this.from,this.to-this.from,this.slice.size])},t.prototype.invert=function(r){return new t(this.from,this.from+this.slice.size,r.slice(this.from,this.to))},t.prototype.map=function(r){var o=r.mapResult(this.from,1),i=r.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(r){if(!(r instanceof t)||r.structure||this.structure)return null;if(this.from+this.slice.size==r.from&&!this.slice.openEnd&&!r.slice.openStart){var o=this.slice.size+r.slice.size==0?T.empty:new T(this.slice.content.append(r.slice.content),this.slice.openStart,r.slice.openEnd);return new t(this.from,this.to+(r.to-r.from),o,this.structure)}else if(r.to==this.from&&!this.slice.openStart&&!r.slice.openEnd){var i=this.slice.size+r.slice.size==0?T.empty:new T(r.slice.content.append(this.slice.content),r.slice.openStart,this.slice.openEnd);return new t(r.from,this.to,i,this.structure)}else return null},t.prototype.toJSON=function(){var r={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(r.slice=this.slice.toJSON()),this.structure&&(r.structure=!0),r},t.fromJSON=function(r,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,T.fromJSON(r,o.slice),!!o.structure)},t}(Ct);Ct.jsonID("replace",Ee);var Ft=function(n){function t(e,r,o,i,s,a,l){n.call(this),this.from=e,this.to=r,this.gapFrom=o,this.gapTo=i,this.slice=s,this.insert=a,this.structure=!!l}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.apply=function(r){if(this.structure&&(Yo(r,this.from,this.gapFrom)||Yo(r,this.gapTo,this.to)))return Dt.fail("Structure gap-replace would overwrite content");var o=r.slice(this.gapFrom,this.gapTo);if(o.openStart||o.openEnd)return Dt.fail("Gap is not a flat range");var i=this.slice.insertAt(this.insert,o.content);return i?Dt.fromReplace(r,this.from,this.to,i):Dt.fail("Content does not fit in gap")},t.prototype.getMap=function(){return new mt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},t.prototype.invert=function(r){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,r.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},t.prototype.map=function(r){var o=r.mapResult(this.from,1),i=r.mapResult(this.to,-1),s=r.map(this.gapFrom,-1),a=r.map(this.gapTo,1);return o.deleted&&i.deleted||si.pos?null:new t(o.pos,i.pos,s,a,this.slice,this.insert,this.structure)},t.prototype.toJSON=function(){var r={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(r.slice=this.slice.toJSON()),this.structure&&(r.structure=!0),r},t.fromJSON=function(r,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,T.fromJSON(r,o.slice),o.insert,!!o.structure)},t}(Ct);Ct.jsonID("replaceAround",Ft);function Yo(n,t,e){for(var r=n.resolve(t),o=e-t,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function gf(n,t,e){return(t==0||n.canReplace(t,n.childCount))&&(e==n.childCount||n.canReplace(0,e))}function wn(n){for(var t=n.parent,e=t.content.cutByIndex(n.startIndex,n.endIndex),r=n.depth;;--r){var o=n.$from.node(r),i=n.$from.index(r),s=n.$to.indexAfter(r);if(rt;p--)d||e.index(p)>0?(d=!0,c=S.from(e.node(p).copy(c)),u++):a--;for(var h=S.empty,m=0,g=o,y=!1;g>t;g--)y||r.after(g+1)=0;r--)e=S.from(t[r].type.create(t[r].attrs,e));var o=n.start,i=n.end;return this.step(new Ft(o,i,o,i,new T(e,0,0),t.length,!0))},at.prototype.setBlockType=function(n,t,e,r){var o=this;if(t===void 0&&(t=n),!e.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=this.steps.length;return this.doc.nodesBetween(n,t,function(s,a){if(s.isTextblock&&!s.hasMarkup(e,r)&&kf(o.doc,o.mapping.slice(i).map(a),e)){o.clearIncompatible(o.mapping.slice(i).map(a,1),e);var l=o.mapping.slice(i),c=l.map(a,1),u=l.map(a+s.nodeSize,1);return o.step(new Ft(c,u,c+1,u-1,new T(S.from(e.create(r,null,s.marks)),0,0),1,!0)),!1}}),this};function kf(n,t,e){var r=n.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,e)}at.prototype.setNodeMarkup=function(n,t,e,r){var o=this.doc.nodeAt(n);if(!o)throw new RangeError("No node at given position");t||(t=o.type);var i=t.create(e,null,r||o.marks);if(o.isLeaf)return this.replaceWith(n,n+o.nodeSize,i);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);return this.step(new Ft(n,n+o.nodeSize,n+1,n+o.nodeSize-1,new T(S.from(i),0,0),1,!0))};function Oe(n,t,e,r){e===void 0&&(e=1);var o=n.resolve(t),i=o.depth-e,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var a=o.depth-1,l=e-2;a>i;a--,l--){var c=o.node(a),u=o.index(a);if(c.type.spec.isolating)return!1;var p=c.content.cutByIndex(u,c.childCount),d=r&&r[l]||c;if(d!=c&&(p=p.replaceChild(0,d.type.create(d.attrs))),!c.canReplace(u+1,c.childCount)||!d.type.validContent(p))return!1}var h=o.indexAfter(i),m=r&&r[0];return o.node(i).canReplaceWith(h,h,m?m.type:o.node(i+1).type)}at.prototype.split=function(n,t,e){t===void 0&&(t=1);for(var r=this.doc.resolve(n),o=S.empty,i=S.empty,s=r.depth,a=r.depth-t,l=t-1;s>a;s--,l--){o=S.from(r.node(s).copy(o));var c=e&&e[l];i=S.from(c?c.type.create(c.attrs,i):r.node(s).copy(i))}return this.step(new Ee(n,n,new T(o.append(i),t,t),!0))};function Qo(n,t){var e=n.resolve(t),r=e.index();return wf(e.nodeBefore,e.nodeAfter)&&e.parent.canReplace(r,r+1)}function wf(n,t){return n&&t&&!n.isLeaf&&n.canAppend(t)}at.prototype.join=function(n,t){t===void 0&&(t=1);var e=new Ee(n-t,n+t,T.empty,!0);return this.step(e)};function Sf(n,t,e){var r=n.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),e))return t;if(r.parentOffset==0)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,e))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,e))return r.after(s+1);if(a=0;a--){var l=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,c=r.index(a)+(l>0?1:0),u=r.node(a),p=!1;if(s==1)p=u.canReplace(c,c,o);else{var d=u.contentMatchAt(c).findWrapping(o.firstChild.type);p=d&&u.canReplaceWith(c,c,d[0])}if(p)return l==0?r.pos:l<0?r.before(a+1):r.after(a+1)}return null}function Zo(n,t,e){for(var r=[],o=0;o=i.pos?null:new t(o.pos,i.pos,this.mark)},t.prototype.merge=function(r){if(r instanceof t&&r.mark.eq(this.mark)&&this.from<=r.to&&this.to>=r.from)return new t(Math.min(this.from,r.from),Math.max(this.to,r.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(r,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,r.markFromJSON(o.mark))},t}(Ct);Ct.jsonID("addMark",ti);var Yn=function(n){function t(e,r,o){n.call(this),this.from=e,this.to=r,this.mark=o}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.apply=function(r){var o=this,i=r.slice(this.from,this.to),s=new T(Zo(i.content,function(a){return a.mark(o.mark.removeFromSet(a.marks))}),i.openStart,i.openEnd);return Dt.fromReplace(r,this.from,this.to,s)},t.prototype.invert=function(){return new ti(this.from,this.to,this.mark)},t.prototype.map=function(r){var o=r.mapResult(this.from,1),i=r.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(r){if(r instanceof t&&r.mark.eq(this.mark)&&this.from<=r.to&&this.to>=r.from)return new t(Math.min(this.from,r.from),Math.max(this.to,r.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(r,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,r.markFromJSON(o.mark))},t}(Ct);Ct.jsonID("removeMark",Yn),at.prototype.addMark=function(n,t,e){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(n,t,function(l,c,u){if(!!l.isInline){var p=l.marks;if(!e.isInSet(p)&&u.type.allowsMarkType(e.type)){for(var d=Math.max(c,n),h=Math.min(c+l.nodeSize,t),m=e.addToSet(p),g=0;g=0;d--)this.step(o[d]);return this};function xf(n,t,e,r){if(e===void 0&&(e=t),r===void 0&&(r=T.empty),t==e&&!r.size)return null;var o=n.resolve(t),i=n.resolve(e);return ma(o,i,r)?new Ee(t,e,r):new Qt(o,i,r).fit()}at.prototype.replace=function(n,t,e){t===void 0&&(t=n),e===void 0&&(e=T.empty);var r=xf(this.doc,n,t,e);return r&&this.step(r),this},at.prototype.replaceWith=function(n,t,e){return this.replace(n,t,new T(S.from(e),0,0))},at.prototype.delete=function(n,t){return this.replace(n,t,T.empty)},at.prototype.insert=function(n,t){return this.replaceWith(n,n,t)};function ma(n,t,e){return!e.openStart&&!e.openEnd&&n.start()==t.start()&&n.parent.canReplace(n.index(),t.index(),e.content)}var Qt=function(t,e,r){this.$to=e,this.$from=t,this.unplaced=r,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=S.empty;for(var s=t.depth;s>0;s--)this.placed=S.from(t.node(s).copy(this.placed))},va={depth:{configurable:!0}};va.depth.get=function(){return this.frontier.length-1},Qt.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var e=this.mustMoveInline(),r=this.placed.size-this.depth-this.$from.depth,o=this.$from,i=this.close(e<0?this.$to:o.doc.resolve(e));if(!i)return null;for(var s=this.placed,a=o.depth,l=i.depth;a&&l&&s.childCount==1;)s=s.firstChild.content,a--,l--;var c=new T(s,a,l);if(e>-1)return new Ft(o.pos,e,this.$to.pos,this.$to.end(),c,r);if(c.size||o.pos!=this.$to.pos)return new Ee(o.pos,i.pos,c)},Qt.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var e=this.unplaced.openStart;e>=0;e--){var r=void 0,o=void 0;e?(o=ei(this.unplaced.content,e-1).firstChild,r=o.content):r=this.unplaced.content;for(var i=r.firstChild,s=this.depth;s>=0;s--){var a=this.frontier[s],l=a.type,c=a.match,u=void 0,p=void 0;if(t==1&&(i?c.matchType(i.type)||(p=c.fillBefore(S.from(i),!1)):l.compatibleContent(o.type)))return{sliceDepth:e,frontierDepth:s,parent:o,inject:p};if(t==2&&i&&(u=c.findWrapping(i.type)))return{sliceDepth:e,frontierDepth:s,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}},Qt.prototype.openMore=function(){var t=this.unplaced,e=t.content,r=t.openStart,o=t.openEnd,i=ei(e,r);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new T(e,r+1,Math.max(o,i.size+r>=e.size-o?r+1:0)),!0)},Qt.prototype.dropNode=function(){var t=this.unplaced,e=t.content,r=t.openStart,o=t.openEnd,i=ei(e,r);if(i.childCount<=1&&r>0){var s=e.size-r<=r+i.size;this.unplaced=new T(Xn(e,r-1,1),r-1,s?r-1:o)}else this.unplaced=new T(Xn(e,r,1),r,o)},Qt.prototype.placeNodes=function(t){for(var e=t.sliceDepth,r=t.frontierDepth,o=t.parent,i=t.inject,s=t.wrap;this.depth>r;)this.closeFrontierNode();if(s)for(var a=0;a1||u==0||b.content.size)&&(m=N,d.push(ga(b.mark(g.allowedMarks(b.marks)),p==1?u:0,p==c.childCount?k:-1)))}var v=p==c.childCount;v||(k=-1),this.placed=Qn(this.placed,r,S.from(d)),this.frontier[r].match=m,v&&k<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var O=0,C=c;O1&&i==this.$to.end(--o);)++i;return i},Qt.prototype.findCloseLevel=function(t){t:for(var e=Math.min(this.depth,t.depth);e>=0;e--){var r=this.frontier[e],o=r.match,i=r.type,s=e=0;l--){var c=this.frontier[l],u=c.match,p=c.type,d=ni(t,l,p,u,!0);if(!d||d.childCount)continue t}return{depth:e,fit:a,move:s?t.doc.resolve(t.after(e+1)):t}}}},Qt.prototype.close=function(t){var e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=Qn(this.placed,e.depth,e.fit)),t=e.move;for(var r=e.depth+1;r<=t.depth;r++){var o=t.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,t.index(r));this.openFrontierNode(o.type,o.attrs,i)}return t},Qt.prototype.openFrontierNode=function(t,e,r){var o=this.frontier[this.depth];o.match=o.match.matchType(t),this.placed=Qn(this.placed,this.depth,S.from(t.create(e,r))),this.frontier.push({type:t,match:t.contentMatch})},Qt.prototype.closeFrontierNode=function(){var t=this.frontier.pop(),e=t.match.fillBefore(S.empty,!0);e.childCount&&(this.placed=Qn(this.placed,this.frontier.length,e))},Object.defineProperties(Qt.prototype,va);function Xn(n,t,e){return t==0?n.cutByIndex(e):n.replaceChild(0,n.firstChild.copy(Xn(n.firstChild.content,t-1,e)))}function Qn(n,t,e){return t==0?n.append(e):n.replaceChild(n.childCount-1,n.lastChild.copy(Qn(n.lastChild.content,t-1,e)))}function ei(n,t){for(var e=0;e1&&(r=r.replaceChild(0,ga(r.firstChild,t-1,r.childCount==1?e-1:0))),t>0&&(r=n.type.contentMatch.fillBefore(r).append(r),e<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(S.empty,!0)))),n.copy(r)}function ni(n,t,e,r,o){var i=n.node(t),s=o?n.indexAfter(t):n.index(t);if(s==i.childCount&&!e.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!Mf(e,i.content,s)?a:null}function Mf(n,t,e){for(var r=e;r0;a--,l--){var c=r.node(a).type.spec;if(c.defining||c.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==l&&i.splice(1,0,-a)}for(var u=i.indexOf(s),p=[],d=e.openStart,h=e.content,m=0;;m++){var g=h.firstChild;if(p.push(g),m==e.openStart)break;h=g.content}d>0&&p[d-1].type.spec.defining&&r.node(u).type!=p[d-1].type?d-=1:d>=2&&p[d-1].isTextblock&&p[d-2].type.spec.defining&&r.node(u).type!=p[d-2].type&&(d-=2);for(var y=e.openStart;y>=0;y--){var k=(y+d+1)%(e.openStart+1),b=p[k];if(!!b)for(var N=0;N=0&&(this.replace(n,t,e),!(this.steps.length>I));V--){var F=i[V];F<0||(n=r.before(F),t=o.after(F))}return this};function ya(n,t,e,r,o){if(tr){var s=o.contentMatchAt(0),a=s.fillBefore(n).append(n);n=a.append(s.matchFragment(a).fillBefore(S.empty,!0))}return n}at.prototype.replaceRangeWith=function(n,t,e){if(!e.isInline&&n==t&&this.doc.resolve(n).parent.content.size){var r=Sf(this.doc,n,e.type);r!=null&&(n=t=r)}return this.replaceRange(n,t,new T(S.from(e),0,0))},at.prototype.deleteRange=function(n,t){for(var e=this.doc.resolve(n),r=this.doc.resolve(t),o=ba(e,r),i=0;i0&&(a||e.node(s-1).canReplace(e.index(s-1),r.indexAfter(s-1))))return this.delete(e.before(s),r.after(s))}for(var l=1;l<=e.depth&&l<=r.depth;l++)if(n-e.start(l)==e.depth-l&&t>e.end(l)&&r.end(l)-t!=r.depth-l)return this.delete(e.before(l),t);return this.delete(n,t)};function ba(n,t){for(var e=[],r=Math.min(n.depth,t.depth),o=r;o>=0;o--){var i=n.start(o);if(it.pos+(t.depth-o)||n.node(o).type.spec.isolating||t.node(o).type.spec.isolating)break;(i==t.start(o)||o==n.depth&&o==t.depth&&n.parent.inlineContent&&t.parent.inlineContent&&o&&t.start(o-1)==i-1)&&e.push(o)}return e}var ri=Object.create(null),z=function(t,e,r){this.ranges=r||[new Cf(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},Ie={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};Ie.anchor.get=function(){return this.$anchor.pos},Ie.head.get=function(){return this.$head.pos},Ie.from.get=function(){return this.$from.pos},Ie.to.get=function(){return this.$to.pos},Ie.$from.get=function(){return this.ranges[0].$from},Ie.$to.get=function(){return this.ranges[0].$to},Ie.empty.get=function(){for(var n=this.ranges,t=0;t=0;i--){var s=e<0?Sn(t.node(0),t.node(i),t.before(i+1),t.index(i),e,r):Sn(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,e,r);if(s)return s}},z.near=function(t,e){return e===void 0&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new Ne(t.node(0))},z.atStart=function(t){return Sn(t,t,0,0,1)||new Ne(t)},z.atEnd=function(t){return Sn(t,t,t.content.size,t.childCount,-1)||new Ne(t)},z.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var r=ri[e.type];if(!r)throw new RangeError("No selection type "+e.type+" defined");return r.fromJSON(t,e)},z.jsonID=function(t,e){if(t in ri)throw new RangeError("Duplicate use of selection JSON ID "+t);return ri[t]=e,e.prototype.jsonID=t,e},z.prototype.getBookmark=function(){return K.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(z.prototype,Ie),z.prototype.visible=!0;var Cf=function(t,e){this.$from=t,this.$to=e},K=function(n){function t(r,o){o===void 0&&(o=r),n.call(this,r,o)}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={$cursor:{configurable:!0}};return e.$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 n.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=T.empty),n.prototype.replace.call(this,o,i),i==T.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 Zn(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 l=n.findFrom(i,s,!0)||n.findFrom(i,-s,!0);if(l)i=l.$head;else return n.near(i,s)}return o.parent.inlineContent||(a==0?o=i:(o=(n.findFrom(o,-s,!0)||n.findFrom(o,s,!0)).$anchor,o.pos0?0:1);o>0?s=0;s+=o){var a=t.child(s);if(a.isAtom){if(!i&&P.isSelectable(a))return P.create(n,e-(o<0?a.nodeSize:0))}else{var l=Sn(n,a,e+o,o<0?a.childCount:0,o,i);if(l)return l}e+=a.nodeSize*o}}function ka(n,t,e){var r=n.steps.length-1;if(!(r0},t.prototype.setStoredMarks=function(o){return this.storedMarks=o,this.updated|=qr,this},t.prototype.ensureMarks=function(o){return J.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()))},e.storedMarksSet.get=function(){return(this.updated&qr)>0},t.prototype.addStep=function(o,i){n.prototype.addStep.call(this,o,i),this.updated=this.updated&~qr,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)||J.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 l=this.storedMarks;if(!l){var c=this.doc.resolve(i);l=s==i?c.marks():c.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(i,s,a.text(o,l)),this.selection.empty||this.setSelection(z.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]},e.isGeneric.get=function(){for(var r in this.meta)return!1;return!0},t.prototype.scrollIntoView=function(){return this.updated|=Sa,this},e.scrolledIntoView.get=function(){return(this.updated&Sa)>0},Object.defineProperties(t.prototype,e),t}(at);function xa(n,t){return!t||!n?n:n.bind(t)}var tr=function(t,e,r){this.name=t,this.init=xa(e.init,r),this.apply=xa(e.apply,r)},Nf=[new tr("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new tr("selection",{init:function(t,e){return t.selection||z.atStart(e.doc)},apply:function(t){return t.selection}}),new tr("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,r,o){return o.selection.$cursor?t.storedMarks:null}}),new tr("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],oi=function(t,e){var r=this;this.schema=t,this.fields=Nf.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach(function(o){if(r.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");r.plugins.push(o),r.pluginsByKey[o.key]=o,o.spec.state&&r.fields.push(new tr(o.key,o.spec.state,o))})},Et=function(t){this.config=t},jr={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};jr.schema.get=function(){return this.config.schema},jr.plugins.get=function(){return this.config.plugins},Et.prototype.apply=function(t){return this.applyTransaction(t).state},Et.prototype.filterTransaction=function(t,e){e===void 0&&(e=-1);for(var r=0;r-1&&er.splice(e,1)},Object.defineProperties(Et.prototype,jr);var er=[];function Ma(n,t,e){for(var r in n){var o=n[r];o instanceof Function?o=o.bind(t):r=="handleDOMEvents"&&(o=Ma(o,t,{})),e[r]=o}return e}var Ht=function(t){this.props={},t.props&&Ma(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:Ca("plugin")};Ht.prototype.getState=function(t){return t[this.key]};var ii=Object.create(null);function Ca(n){return n in ii?n+"$"+ ++ii[n]:(ii[n]=0,n+"$")}var ae=function(t){t===void 0&&(t="key"),this.key=Ca(t)};ae.prototype.get=function(t){return t.config.pluginsByKey[this.key]},ae.prototype.getState=function(t){return t[this.key]};function si(n,t){return n.selection.empty?!1:(t&&t(n.tr.deleteSelection().scrollIntoView()),!0)}function Ea(n,t,e){var r=n.selection,o=r.$cursor;if(!o||(e?!e.endOfTextblock("backward",n):o.parentOffset>0))return!1;var i=Na(o);if(!i){var s=o.blockRange(),a=s&&wn(s);return a==null?!1:(t&&t(n.tr.lift(s,a).scrollIntoView()),!0)}var l=i.nodeBefore;if(!l.type.spec.isolating&&Pa(n,i,t))return!0;if(o.parent.content.size==0&&(xn(l,"end")||P.isSelectable(l))){if(t){var c=n.tr.deleteRange(o.before(),o.after());c.setSelection(xn(l,"end")?z.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):P.create(c.doc,i.pos-l.nodeSize)),t(c.scrollIntoView())}return!0}return l.isAtom&&i.depth==o.depth-1?(t&&t(n.tr.delete(i.pos-l.nodeSize,i.pos).scrollIntoView()),!0):!1}function xn(n,t,e){for(;n;n=t=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(e&&n.childCount!=1)return!1}return!1}function Oa(n,t,e){var r=n.selection,o=r.$head,i=r.empty,s=o;if(!i)return!1;if(o.parent.isTextblock){if(e?!e.endOfTextblock("backward",n):o.parentOffset>0)return!1;s=Na(o)}var a=s&&s.nodeBefore;return!a||!P.isSelectable(a)?!1:(t&&t(n.tr.setSelection(P.create(n.doc,s.pos-a.nodeSize)).scrollIntoView()),!0)}function Na(n){if(!n.parent.type.spec.isolating)for(var t=n.depth-1;t>=0;t--){if(n.index(t)>0)return n.doc.resolve(n.before(t+1));if(n.node(t).type.spec.isolating)break}return null}function Ta(n,t,e){var r=n.selection,o=r.$cursor;if(!o||(e?!e.endOfTextblock("forward",n):o.parentOffset=0;t--){var e=n.node(t);if(n.index(t)+11&&r.after()!=r.end(-1)){var o=r.before();if(Oe(n.doc,o))return t&&t(n.tr.split(o).scrollIntoView()),!0}var i=r.blockRange(),s=i&&wn(i);return s==null?!1:(t&&t(n.tr.lift(i,s).scrollIntoView()),!0)}function Tf(n,t){var e=n.selection,r=e.$from,o=e.$to;if(n.selection instanceof P&&n.selection.node.isBlock)return!r.parentOffset||!Oe(n.doc,r.pos)?!1:(t&&t(n.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(t){var i=o.parentOffset==o.parent.content.size,s=n.tr;(n.selection instanceof K||n.selection instanceof Ne)&&s.deleteSelection();var a=r.depth==0?null:ai(r.node(-1).contentMatchAt(r.indexAfter(-1))),l=i&&a?[{type:a}]:null,c=Oe(s.doc,s.mapping.map(r.pos),1,l);if(!l&&!c&&Oe(s.doc,s.mapping.map(r.pos),1,a&&[{type:a}])&&(l=[{type:a}],c=!0),c&&(s.split(s.mapping.map(r.pos),1,l),!i&&!r.parentOffset&&r.parent.type!=a)){var u=s.mapping.map(r.before()),p=s.doc.resolve(u);r.node(-1).canReplaceWith(p.index(),p.index()+1,a)&&s.setNodeMarkup(s.mapping.map(r.before()),a)}t(s.scrollIntoView())}return!0}function _f(n,t){var e=n.selection,r=e.$from,o=e.to,i,s=r.sharedDepth(o);return s==0?!1:(i=r.before(s),t&&t(n.tr.setSelection(P.create(n.doc,i))),!0)}function Af(n,t){return t&&t(n.tr.setSelection(new Ne(n.doc))),!0}function Df(n,t,e){var r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&t.parent.canReplace(i-1,i)?(e&&e(n.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(o.isTextblock||Qo(n.doc,t.pos))?!1:(e&&e(n.tr.clearIncompatible(t.pos,r.type,r.contentMatchAt(r.childCount)).join(t.pos).scrollIntoView()),!0)}function Pa(n,t,e){var r=t.nodeBefore,o=t.nodeAfter,i,s;if(r.type.spec.isolating||o.type.spec.isolating)return!1;if(Df(n,t,e))return!0;var a=t.parent.canReplace(t.index(),t.index()+1);if(a&&(i=(s=r.contentMatchAt(r.childCount)).findWrapping(o.type))&&s.matchType(i[0]||o.type).validEnd){if(e){for(var l=t.pos+o.nodeSize,c=S.empty,u=i.length-1;u>=0;u--)c=S.from(i[u].create(null,c));c=S.from(r.copy(c));var p=n.tr.step(new Ft(t.pos-1,l,t.pos,l,new T(c,1,0),i.length,!0)),d=l+2*i.length;Qo(p.doc,d)&&p.join(d),e(p.scrollIntoView())}return!0}var h=z.findFrom(t,1),m=h&&h.$from.blockRange(h.$to),g=m&&wn(m);if(g!=null&&g>=t.depth)return e&&e(n.tr.lift(m,g).scrollIntoView()),!0;if(a&&xn(o,"start",!0)&&xn(r,"end")){for(var y=r,k=[];k.push(y),!y.isTextblock;)y=y.lastChild;for(var b=o,N=1;!b.isTextblock;b=b.firstChild)N++;if(y.canReplace(y.childCount,y.childCount,b.content)){if(e){for(var v=S.empty,O=k.length-1;O>=0;O--)v=S.from(k[O].copy(v));var C=n.tr.step(new Ft(t.pos-k.length,t.pos+o.nodeSize,t.pos+N,t.pos+o.nodeSize-N,new T(v,k.length,0),0,!0));e(C.scrollIntoView())}return!0}}return!1}function za(n,t){return function(e,r){var o=e.selection,i=o.$from,s=o.$to,a=i.blockRange(s),l=a&&Xo(a,n,t);return l?(r&&r(e.tr.wrap(a,l).scrollIntoView()),!0):!1}}function Rf(n,t){return function(e,r){var o=e.selection,i=o.from,s=o.to,a=!1;return e.doc.nodesBetween(i,s,function(l,c){if(a)return!1;if(!(!l.isTextblock||l.hasMarkup(n,t)))if(l.type==n)a=!0;else{var u=e.doc.resolve(c),p=u.index();a=u.parent.canReplaceWith(p,p+1,n)}}),a?(r&&r(e.tr.setBlockType(i,s,n,t).scrollIntoView()),!0):!1}}function li(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];return function(e,r,o){for(var i=0;i=2&&i.node(a.depth-1).type.compatibleContent(n)&&a.startIndex==0){if(i.index(a.depth-1)==0)return!1;var u=e.doc.resolve(a.start-2);c=new Kn(u,u,a.depth),a.endIndex=0;s--)i=S.from(e[s].type.create(e[s].attrs,i));n.step(new Ft(t.start-(r?2:0),t.end,t.start,t.end,new T(i,0,0),e.length,!0));for(var a=0,l=0;la;s--)i-=o.child(s).nodeSize,r.delete(i-1,i+1);var l=r.doc.resolve(e.start),c=l.nodeAfter;if(r.mapping.map(e.end)!=e.start+l.nodeAfter.nodeSize)return!1;var u=e.startIndex==0,p=e.endIndex==o.childCount,d=l.node(-1),h=l.index(-1);if(!d.canReplace(h+(u?0:1),h+1,c.content.append(p?S.empty:S.from(o))))return!1;var m=l.pos,g=m+c.nodeSize;return r.step(new Ft(m-(u?1:0),g+(p?1:0),m+1,g-1,new T((u?S.empty:S.from(o.copy(S.empty))).append(p?S.empty:S.from(o.copy(S.empty))),u?0:1,p?0:1),u?0:1)),t(r.scrollIntoView()),!0}function Ff(n){return function(t,e){var r=t.selection,o=r.$from,i=r.$to,s=o.blockRange(i,function(g){return g.childCount&&g.firstChild.type==n});if(!s)return!1;var a=s.startIndex;if(a==0)return!1;var l=s.parent,c=l.child(a-1);if(c.type!=n)return!1;if(e){var u=c.lastChild&&c.lastChild.type==l.type,p=S.from(u?n.create():null),d=new T(S.from(n.create(null,S.from(l.type.create(null,p)))),u?3:1,0),h=s.start,m=s.end;e(t.tr.step(new Ft(h-(u?3:1),m,h,m,d,1,!0)).scrollIntoView())}return!0}}var M={};if(typeof navigator!="undefined"&&typeof document!="undefined"){var ui=/Edge\/(\d+)/.exec(navigator.userAgent),Ha=/MSIE \d/.test(navigator.userAgent),fi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),pi=M.ie=!!(Ha||fi||ui);M.ie_version=Ha?document.documentMode||6:fi?+fi[1]:ui?+ui[1]:null,M.gecko=!pi&&/gecko\/(\d+)/i.test(navigator.userAgent),M.gecko_version=M.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var di=!pi&&/Chrome\/(\d+)/.exec(navigator.userAgent);M.chrome=!!di,M.chrome_version=di&&+di[1],M.safari=!pi&&/Apple Computer/.test(navigator.vendor),M.ios=M.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),M.mac=M.ios||/Mac/.test(navigator.platform),M.android=/Android \d/.test(navigator.userAgent),M.webkit="webkitFontSmoothing"in document.documentElement.style,M.webkit_version=M.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var qt=function(n){for(var t=0;;t++)if(n=n.previousSibling,!n)return t},hi=function(n){var t=n.assignedSlot||n.parentNode;return t&&t.nodeType==11?t.host:t},Ja=null,Te=function(n,t,e){var r=Ja||(Ja=document.createRange());return r.setEnd(n,e==null?n.nodeValue.length:e),r.setStart(n,t||0),r},Wr=function(n,t,e,r){return e&&($a(n,t,e,r,-1)||$a(n,t,e,r,1))},Hf=/^(img|br|input|textarea|hr)$/i;function $a(n,t,e,r,o){for(;;){if(n==e&&t==r)return!0;if(t==(o<0?0:me(n))){var i=n.parentNode;if(i.nodeType!=1||$f(n)||Hf.test(n.nodeName)||n.contentEditable=="false")return!1;t=qt(n)+(o<0?0:1),n=i}else if(n.nodeType==1){if(n=n.childNodes[t+(o<0?-1:0)],n.contentEditable=="false")return!1;t=o<0?me(n):0}else return!1}}function me(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Jf(n,t,e){for(var r=t==0,o=t==me(n);r||o;){if(n==e)return!0;var i=qt(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,o=o&&i==me(n)}}function $f(n){for(var t,e=n;e&&!(t=e.pmViewDesc);e=e.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==n||t.contentDOM==n)}var mi=function(n){var t=n.isCollapsed;return t&&M.chrome&&n.rangeCount&&!n.getRangeAt(0).collapsed&&(t=!1),t};function Mn(n,t){var e=document.createEvent("Event");return e.initEvent("keydown",!0,!0),e.keyCode=n,e.key=e.code=t,e}function qf(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Pe(n,t){return typeof n=="number"?n:n[t]}function jf(n){var t=n.getBoundingClientRect(),e=t.width/n.offsetWidth||1,r=t.height/n.offsetHeight||1;return{left:t.left,right:t.left+n.clientWidth*e,top:t.top,bottom:t.top+n.clientHeight*r}}function qa(n,t,e){for(var r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument,s=e||n.dom;s;s=hi(s))if(s.nodeType==1){var a=s==i.body||s.nodeType!=1,l=a?qf(i):jf(s),c=0,u=0;if(t.topl.bottom-Pe(r,"bottom")&&(u=t.bottom-l.bottom+Pe(o,"bottom")),t.leftl.right-Pe(r,"right")&&(c=t.right-l.right+Pe(o,"right")),c||u)if(a)i.defaultView.scrollBy(c,u);else{var p=s.scrollLeft,d=s.scrollTop;u&&(s.scrollTop+=u),c&&(s.scrollLeft+=c);var h=s.scrollLeft-p,m=s.scrollTop-d;t={left:t.left-h,top:t.top-m,right:t.right-h,bottom:t.bottom-m}}if(a)break}}function Wf(n){for(var t=n.dom.getBoundingClientRect(),e=Math.max(0,t.top),r,o,i=(t.left+t.right)/2,s=e+1;s=e-20){r=a,o=l.top;break}}}return{refDOM:r,refTop:o,stack:ja(n.dom)}}function ja(n){for(var t=[],e=n.ownerDocument;n&&(t.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),n!=e);n=hi(n));return t}function Kf(n){var t=n.refDOM,e=n.refTop,r=n.stack,o=t?t.getBoundingClientRect().top:0;Wa(r,o==0?0:o-e)}function Wa(n,t){for(var e=0;e=a){s=Math.max(d.bottom,s),a=Math.min(d.top,a);var h=d.left>t.left?d.left-t.left:d.right=(d.left+d.right)/2?1:0));continue}}!e&&(t.left>=d.right&&t.top>=d.top||t.left>=d.left&&t.top>=d.bottom)&&(i=c+1)}}return e&&e.nodeType==3?Gf(e,o):!e||r&&e.nodeType==1?{node:n,offset:i}:Ka(e,o)}function Gf(n,t){for(var e=n.nodeValue.length,r=document.createRange(),o=0;o=(i.left+i.right)/2?1:0)}}return{node:n,offset:0}}function vi(n,t){return n.left>=t.left-1&&n.left<=t.right+1&&n.top>=t.top-1&&n.top<=t.bottom+1}function Yf(n,t){var e=n.parentNode;return e&&/^li$/i.test(e.nodeName)&&t.left(a.left+a.right)/2?1:-1}return n.docView.posFromDOM(o,i,s)}function Qf(n,t,e,r){for(var o=-1,i=t;i!=n.dom;){var s=n.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else if(a.right-1?o:n.docView.posFromDOM(t,e)}function Ua(n,t,e){var r=n.childNodes.length;if(r&&e.topt.top&&s++}i==n.dom&&s==i.childNodes.length-1&&i.lastChild.nodeType==1&&t.top>i.lastChild.getBoundingClientRect().bottom?u=n.state.doc.content.size:(s==0||i.nodeType!=1||i.childNodes[s-1].nodeName!="BR")&&(u=Qf(n,i,s,t))}u==null&&(u=Xf(n,c,t));var g=n.docView.nearestDesc(c,!0);return{pos:u,inside:g?g.posAtStart-g.border:-1}}function ze(n,t){var e=n.getClientRects();return e.length?e[t<0?0:e.length-1]:n.getBoundingClientRect()}var tp=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ga(n,t,e){var r=n.docView.domFromPos(t,e<0?-1:1),o=r.node,i=r.offset,s=M.webkit||M.gecko;if(o.nodeType==3)if(s&&(tp.test(o.nodeValue)||(e<0?!i:i==o.nodeValue.length))){var a=ze(Te(o,i,i),e);if(M.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i=0&&i==o.nodeValue.length?(u--,d=1):e<0?u--:p++,nr(ze(Te(o,u,p),d),d<0)}if(!n.state.doc.resolve(t).parent.inlineContent){if(i&&(e<0||i==me(o))){var h=o.childNodes[i-1];if(h.nodeType==1)return gi(h.getBoundingClientRect(),!1)}if(i=0)}if(i&&(e<0||i==me(o))){var g=o.childNodes[i-1],y=g.nodeType==3?Te(g,me(g)-(s?0:1)):g.nodeType==1&&(g.nodeName!="BR"||!g.nextSibling)?g:null;if(y)return nr(ze(y,1),!1)}if(i=0)}function nr(n,t){if(n.width==0)return n;var e=t?n.left:n.right;return{top:n.top,bottom:n.bottom,left:e,right:e}}function gi(n,t){if(n.height==0)return n;var e=t?n.top:n.bottom;return{top:e,bottom:e,left:n.left,right:n.right}}function Ya(n,t,e){var r=n.state,o=n.root.activeElement;r!=t&&n.updateState(t),o!=n.dom&&n.focus();try{return e()}finally{r!=t&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function ep(n,t,e){var r=t.selection,o=e=="up"?r.$from:r.$to;return Ya(n,t,function(){for(var i=n.docView.domFromPos(o.pos,e=="up"?-1:1),s=i.node;;){var a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.dom;break}s=a.dom.parentNode}for(var l=Ga(n,o.pos,1),c=s.firstChild;c;c=c.nextSibling){var u=void 0;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=Te(c,0,c.nodeValue.length).getClientRects();else continue;for(var p=0;pd.top+1&&(e=="up"?l.top-d.top>(d.bottom-l.top)*2:d.bottom-l.bottom>(l.bottom-d.top)*2))return!1}}return!0})}var np=/[\u0590-\u08ac]/;function rp(n,t,e){var r=t.selection,o=r.$head;if(!o.parent.isTextblock)return!1;var i=o.parentOffset,s=!i,a=i==o.parent.content.size,l=n.root.getSelection();return!np.test(o.parent.textContent)||!l.modify?e=="left"||e=="backward"?s:a:Ya(n,t,function(){var c=l.getRangeAt(0),u=l.focusNode,p=l.focusOffset,d=l.caretBidiLevel;l.modify("move",e,"character");var h=o.depth?n.docView.domAfterPos(o.before()):n.dom,m=!h.contains(l.focusNode.nodeType==1?l.focusNode:l.focusNode.parentNode)||u==l.focusNode&&p==l.focusOffset;return l.removeAllRanges(),l.addRange(c),d!=null&&(l.caretBidiLevel=d),m})}var Xa=null,Qa=null,Za=!1;function op(n,t,e){return Xa==t&&Qa==e?Za:(Xa=t,Qa=e,Za=e=="up"||e=="down"?ep(n,t,e):rp(n,t,e))}var le=0,tl=1,rr=2,Le=3,Q=function(t,e,r,o){this.parent=t,this.children=e,this.dom=r,r.pmViewDesc=this,this.contentDOM=o,this.dirty=le},ve={size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0},ignoreForCoords:{configurable:!0}};Q.prototype.matchesWidget=function(){return!1},Q.prototype.matchesMark=function(){return!1},Q.prototype.matchesNode=function(){return!1},Q.prototype.matchesHack=function(t){return!1},Q.prototype.parseRule=function(){return null},Q.prototype.stopEvent=function(){return!1},ve.size.get=function(){for(var n=0,t=0;tqt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))l=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(e==0)for(var c=t;;c=c.parentNode){if(c==this.dom){l=!1;break}if(c.parentNode.firstChild!=c)break}if(l==null&&e==t.childNodes.length)for(var u=t;;u=u.parentNode){if(u==this.dom){l=!0;break}if(u.parentNode.lastChild!=u)break}}return(l==null?r>0:l)?this.posAtEnd:this.posAtStart},Q.prototype.nearestDesc=function(t,e){for(var r=!0,o=t;o;o=o.parentNode){var i=this.getDesc(o);if(i&&(!e||i.node))if(r&&i.nodeDOM&&!(i.nodeDOM.nodeType==1?i.nodeDOM.contains(t.nodeType==1?t:t.parentNode):i.nodeDOM==t))r=!1;else return i}},Q.prototype.getDesc=function(t){for(var e=t.pmViewDesc,r=e;r;r=r.parent)if(r==this)return e},Q.prototype.posFromDOM=function(t,e,r){for(var o=t;o;o=o.parentNode){var i=this.getDesc(o);if(i)return i.localPosFromDOM(t,e,r)}return-1},Q.prototype.descAt=function(t){for(var e=0,r=0;et||s instanceof ol){o=t-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,e);for(var l=void 0;r&&!(l=this.children[r-1]).size&&l instanceof el&&l.widget.type.side>=0;r--);if(e<=0){for(var c,u=!0;c=r?this.children[r-1]:null,!(!c||c.dom.parentNode==this.contentDOM);r--,u=!1);return c&&e&&u&&!c.border&&!c.domAtom?c.domFromPos(c.size,e):{node:this.contentDOM,offset:c?qt(c.dom)+1:0}}else{for(var p,d=!0;p=r=u&&e<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,e,u);t=s;for(var p=a;p>0;p--){var d=this.children[p-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){o=qt(d.dom)+1;break}t-=d.size}o==-1&&(o=0)}if(o>-1&&(c>e||a==this.children.length-1)){e=c;for(var h=a+1;hl&&se){var A=p;p=d,d=A}var I=document.createRange();I.setEnd(d.node,d.offset),I.setStart(p.node,p.offset),h.removeAllRanges(),h.addRange(I)}}},Q.prototype.ignoreMutation=function(t){return!this.contentDOM&&t.type!="selection"},ve.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},Q.prototype.markDirty=function(t,e){for(var r=0,o=0;o=r:tr){var a=r+i.border,l=s-i.border;if(t>=a&&e<=l){this.dirty=t==r||e==s?rr:tl,t==a&&e==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Le:i.markDirty(t-a,e-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM?rr:Le}r=s}this.dirty=rr},Q.prototype.markParentsDirty=function(){for(var t=1,e=this.parent;e;e=e.parent,t++){var r=t==1?rr:tl;e.dirty0&&(a=wi(a,0,r,i));for(var c=0;c-1?c:null,p=c&&c.pos<0,d=new Zt(this,u&&u.node);up(this.node,this.innerDeco,function(h,m,g){h.spec.marks?d.syncToMarks(h.spec.marks,a,o):h.type.side>=0&&!g&&d.syncToMarks(m==s.node.childCount?J.none:s.node.child(m).marks,a,o),d.placeWidget(h,o,l)},function(h,m,g,y){d.syncToMarks(h.marks,a,o);var k;d.findNodeMatch(h,m,g,y)||p&&o.state.selection.from>l&&o.state.selection.to-1&&d.updateNodeAt(h,m,g,k,o)||d.updateNextNode(h,m,g,o,y)||d.addNode(h,m,g,o,l),l+=h.nodeSize}),d.syncToMarks(Fe,a,o),this.node.isTextblock&&d.addTextblockHacks(),d.destroyRest(),(d.changed||this.dirty==rr)&&(u&&this.protectLocalComposition(o,u),il(this.contentDOM,this.children,o),M.ios&&fp(this.dom))},t.prototype.localCompositionInfo=function(o,i){var s=o.state.selection,a=s.from,l=s.to;if(!(!(o.state.selection instanceof K)||ai+this.node.content.size)){var c=o.root.getSelection(),u=pp(c.focusNode,c.focusOffset);if(!(!u||!this.dom.contains(u.parentNode)))if(this.node.inlineContent){var p=u.nodeValue,d=dp(this.node.content,p,a-i,l-i);return d<0?null:{node:u,pos:d,text:p}}else return{node:u,pos:-1}}},t.prototype.protectLocalComposition=function(o,i){var s=i.node,a=i.pos,l=i.text;if(!this.getDesc(s)){for(var c=s;c.parentNode!=this.contentDOM;c=c.parentNode){for(;c.previousSibling;)c.parentNode.removeChild(c.previousSibling);for(;c.nextSibling;)c.parentNode.removeChild(c.nextSibling);c.pmViewDesc&&(c.pmViewDesc=null)}var u=new ip(this,c,s,l);o.compositionNodes.push(u),this.children=wi(this.children,a,a+l.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=le},t.prototype.updateOuterDeco=function(o){if(!ki(o,this.outerDeco)){var i=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=sl(this.dom,this.nodeDOM,bi(this.outerDeco,this.node,i),bi(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")},e.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(t.prototype,e),t}(Q);function nl(n,t,e,r,o){return al(r,t,n),new or(null,n,t,e,r,r,r,o,0)}var rl=function(n){function t(r,o,i,s,a,l,c){n.call(this,r,o,i,s,a,null,l,c)}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={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!=le&&!this.inParent()||!o.sameMarkup(this.node)?!1:(this.updateOuterDeco(i),(this.dirty!=le||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=le,!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):n.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),l=document.createTextNode(a.text);return new t(this.parent,a,this.outerDeco,this.innerDeco,l,l,s)},t.prototype.markDirty=function(o,i){n.prototype.markDirty.call(this,o,i),this.dom!=this.nodeDOM&&(o==0||i==this.nodeDOM.nodeValue.length)&&(this.dirty=Le)},e.domAtom.get=function(){return!1},Object.defineProperties(t.prototype,e),t}(or),ol=function(n){function t(){n.apply(this,arguments)}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={domAtom:{configurable:!0},ignoreForCoords:{configurable:!0}};return t.prototype.parseRule=function(){return{ignore:!0}},t.prototype.matchesHack=function(o){return this.dirty==le&&this.dom.nodeName==o},e.domAtom.get=function(){return!0},e.ignoreForCoords.get=function(){return this.dom.nodeName=="IMG"},Object.defineProperties(t.prototype,e),t}(Q),sp=function(n){function t(e,r,o,i,s,a,l,c,u,p){n.call(this,e,r,o,i,s,a,l,u,p),this.spec=c}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.update=function(r,o,i,s){if(this.dirty==Le)return!1;if(this.spec.update){var a=this.spec.update(r,o,i);return a&&this.updateInner(r,o,i,s),a}else return!this.contentDOM&&!r.isLeaf?!1:n.prototype.update.call(this,r,o,i,s)},t.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():n.prototype.selectNode.call(this)},t.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():n.prototype.deselectNode.call(this)},t.prototype.setSelection=function(r,o,i,s){this.spec.setSelection?this.spec.setSelection(r,o,i):n.prototype.setSelection.call(this,r,o,i,s)},t.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),n.prototype.destroy.call(this)},t.prototype.stopEvent=function(r){return this.spec.stopEvent?this.spec.stopEvent(r):!1},t.prototype.ignoreMutation=function(r){return this.spec.ignoreMutation?this.spec.ignoreMutation(r):n.prototype.ignoreMutation.call(this,r)},t}(or);function il(n,t,e){for(var r=n.firstChild,o=!1,i=0;i>1,s=Math.min(i,t.length);o-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var c=yi.create(this.top,t[i],e,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,i++}},Zt.prototype.findNodeMatch=function(t,e,r,o){var i=this.top.children,s=-1;if(o>=this.preMatch.index){for(var a=this.index;a0&&r>0;r--){var i=t[r-1],s=i.node;if(!!s){if(s!=n.child(e-1))break;--e,o.set(i,e)}}return{index:e,matched:o}}function cp(n,t){return n.type.side-t.type.side}function up(n,t,e,r){var o=t.locals(n),i=0;if(o.length==0){for(var s=0;si;)c.push(o[l++]);var b=i+g.nodeSize;if(g.isText){var N=b;l0){if(n.childNodes.length>t&&n.childNodes[t].nodeType==3)return n.childNodes[t];n=n.childNodes[t-1],t=me(n)}else if(n.nodeType==1&&t=e){var u=l.lastIndexOf(t,r-a);if(u>=0&&u+t.length+a>=e)return a+u}}}return-1}function wi(n,t,e,r,o){for(var i=[],s=0,a=0;s=e||u<=t?i.push(l):(ce&&i.push(l.slice(e-c,l.size,r)))}return i}function cl(n,t){var e=n.root.getSelection(),r=n.state.doc;if(!e.focusNode)return null;var o=n.docView.nearestDesc(e.focusNode),i=o&&o.size==0,s=n.docView.posFromDOM(e.focusNode,e.focusOffset);if(s<0)return null;var a=r.resolve(s),l,c;if(mi(e)){for(l=a;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&P.isSelectable(o.node)&&o.parent&&!(o.node.isInline&&Jf(e.focusNode,e.focusOffset,o.dom))){var u=o.posBefore;c=new P(s==u?a:r.resolve(u))}}else{var p=n.docView.posFromDOM(e.anchorNode,e.anchorOffset);if(p<0)return null;l=r.resolve(p)}if(!c){var d=t=="pointer"||n.state.selection.head0?r.max(o):r.min(o),s=i.parent.inlineContent?i.depth?n.doc.resolve(t>0?i.after():i.before()):null:i;return s&&z.findFrom(s,t)}function rn(n,t){return n.dispatch(n.state.tr.setSelection(t).scrollIntoView()),!0}function vl(n,t,e){var r=n.state.selection;if(r instanceof K){if(!r.empty||e.indexOf("s")>-1)return!1;if(n.endOfTextblock(t>0?"right":"left")){var o=Ci(n.state,t);return o&&o instanceof P?rn(n,o):!1}else if(!(M.mac&&e.indexOf("m")>-1)){var i=r.$head,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,a;if(!s||s.isText)return!1;var l=t<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(a=n.docView.descAt(l))&&!a.contentDOM?P.isSelectable(s)?rn(n,new P(t<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):M.webkit?rn(n,new K(n.state.doc.resolve(t<0?l:l+s.nodeSize))):!1:!1}}else{if(r instanceof P&&r.node.isInline)return rn(n,new K(t>0?r.$to:r.$from));var c=Ci(n.state,t);return c?rn(n,c):!1}}function Kr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function sr(n){var t=n.pmViewDesc;return t&&t.size==0&&(n.nextSibling||n.nodeName!="BR")}function Ei(n){var t=n.root.getSelection(),e=t.focusNode,r=t.focusOffset;if(!!e){var o,i,s=!1;for(M.gecko&&e.nodeType==1&&r0){if(e.nodeType!=1)break;var a=e.childNodes[r-1];if(sr(a))o=e,i=--r;else if(a.nodeType==3)e=a,r=e.nodeValue.length;else break}else{if(gl(e))break;for(var l=e.previousSibling;l&&sr(l);)o=e.parentNode,i=qt(l),l=l.previousSibling;if(l)e=l,r=Kr(e);else{if(e=e.parentNode,e==n.dom)break;r=0}}s?Ni(n,t,e,r):o&&Ni(n,t,o,i)}}function Oi(n){var t=n.root.getSelection(),e=t.focusNode,r=t.focusOffset;if(!!e){for(var o=Kr(e),i,s;;)if(r-1||M.mac&&e.indexOf("m")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||n.endOfTextblock(t<0?"up":"down")){var s=Ci(n.state,t);if(s&&s instanceof P)return rn(n,s)}if(!o.parent.inlineContent){var a=t<0?o:i,l=r instanceof Ne?z.near(a,t):z.findFrom(a,t);return l?rn(n,l):!1}return!1}function bl(n,t){if(!(n.state.selection instanceof K))return!0;var e=n.state.selection,r=e.$head,o=e.$anchor,i=e.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(n.endOfTextblock(t>0?"forward":"backward"))return!0;var s=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){var a=n.state.tr;return t<0?a.delete(r.pos-s.nodeSize,r.pos):a.delete(r.pos,r.pos+s.nodeSize),n.dispatch(a),!0}return!1}function kl(n,t,e){n.domObserver.stop(),t.contentEditable=e,n.domObserver.start()}function yp(n){if(!(!M.safari||n.state.selection.$head.parentOffset>0)){var t=n.root.getSelection(),e=t.focusNode,r=t.focusOffset;if(e&&e.nodeType==1&&r==0&&e.firstChild&&e.firstChild.contentEditable=="false"){var o=e.firstChild;kl(n,o,!0),setTimeout(function(){return kl(n,o,!1)},20)}}}function bp(n){var t="";return n.ctrlKey&&(t+="c"),n.metaKey&&(t+="m"),n.altKey&&(t+="a"),n.shiftKey&&(t+="s"),t}function kp(n,t){var e=t.keyCode,r=bp(t);return e==8||M.mac&&e==72&&r=="c"?bl(n,-1)||Ei(n):e==46||M.mac&&e==68&&r=="c"?bl(n,1)||Oi(n):e==13||e==27?!0:e==37?vl(n,-1,r)||Ei(n):e==39?vl(n,1,r)||Oi(n):e==38?yl(n,-1,r)||Ei(n):e==40?yp(n)||yl(n,1,r)||Oi(n):r==(M.mac?"m":"c")&&(e==66||e==73||e==89||e==90)}function wp(n,t,e){var r=n.docView.parseRange(t,e),o=r.node,i=r.fromOffset,s=r.toOffset,a=r.from,l=r.to,c=n.root.getSelection(),u=null,p=c.anchorNode;if(p&&n.dom.contains(p.nodeType==1?p:p.parentNode)&&(u=[{node:p,offset:c.anchorOffset}],mi(c)||u.push({node:c.focusNode,offset:c.focusOffset})),M.chrome&&n.lastKeyCode===8)for(var d=s;d>i;d--){var h=o.childNodes[d-1],m=h.pmViewDesc;if(h.nodeName=="BR"&&!m){s=d;break}if(!m||m.size)break}var g=n.state.doc,y=n.someProp("domParser")||se.fromSchema(n.state.schema),k=g.resolve(a),b=null,N=y.parse(o,{topNode:k.parent,topMatch:k.parent.contentMatchAt(k.index()),topOpen:!0,from:i,to:s,preserveWhitespace:k.parent.type.spec.code?"full":!0,editableContent:!0,findPositions:u,ruleFromNode:Sp,context:k});if(u&&u[0].pos!=null){var v=u[0].pos,O=u[1]&&u[1].pos;O==null&&(O=v),b={anchor:v+a,head:O+a}}return{doc:N,sel:b,from:a,to:l}}function Sp(n){var t=n.pmViewDesc;if(t)return t.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(M.safari&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){var e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(n.parentNode.lastChild==n||M.safari&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0}}function xp(n,t,e,r,o){if(t<0){var i=n.lastSelectionTime>Date.now()-50?n.lastSelectionOrigin:null,s=cl(n,i);if(s&&!n.state.selection.eq(s)){var a=n.state.tr.setSelection(s);i=="pointer"?a.setMeta("pointer",!0):i=="key"&&a.scrollIntoView(),n.dispatch(a)}return}var l=n.state.doc.resolve(t),c=l.sharedDepth(e);t=l.before(c+1),e=n.state.doc.resolve(e).after(c+1);var u=n.state.selection,p=wp(n,t,e);if(M.chrome&&n.cursorWrapper&&p.sel&&p.sel.anchor==n.cursorWrapper.deco.from){var d=n.cursorWrapper.deco.type.toDOM.nextSibling,h=d&&d.nodeValue?d.nodeValue.length:1;p.sel={anchor:p.sel.anchor+h,head:p.sel.anchor+h}}var m=n.state.doc,g=m.slice(p.from,p.to),y,k;n.lastKeyCode===8&&Date.now()-100Date.now()-225||M.android)&&o.some(function(X){return X.nodeName=="DIV"||X.nodeName=="P"})&&n.someProp("handleKeyDown",function(X){return X(n,Mn(13,"Enter"))})){n.lastIOSEnter=0;return}else{if(p.sel){var N=wl(n,n.state.doc,p.sel);N&&!N.eq(n.state.selection)&&n.dispatch(n.state.tr.setSelection(N))}return}n.domChangeCount++,n.state.selection.fromn.state.selection.from&&b.start<=n.state.selection.from+2?b.start=n.state.selection.from:b.endA=n.state.selection.to-2&&(b.endB+=n.state.selection.to-b.endA,b.endA=n.state.selection.to)),M.ie&&M.ie_version<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>p.from&&p.doc.textBetween(b.start-p.from-1,b.start-p.from+1)==" \xA0"&&(b.start--,b.endA--,b.endB--);var v=p.doc.resolveNoCache(b.start-p.from),O=p.doc.resolveNoCache(b.endB-p.from),C=v.sameParent(O)&&v.parent.inlineContent,A;if((M.ios&&n.lastIOSEnter>Date.now()-225&&(!C||o.some(function(X){return X.nodeName=="DIV"||X.nodeName=="P"}))||!C&&v.posb.start&&Cp(m,b.start,b.endA,v,O)&&n.someProp("handleKeyDown",function(X){return X(n,Mn(8,"Backspace"))})){M.android&&M.chrome&&n.domObserver.suppressSelectionUpdates();return}M.chrome&&M.android&&b.toB==b.from&&(n.lastAndroidDelete=Date.now()),M.android&&!C&&v.start()!=O.start()&&O.parentOffset==0&&v.depth==O.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==b.endA&&(b.endB-=2,O=p.doc.resolveNoCache(b.endB-p.from),setTimeout(function(){n.someProp("handleKeyDown",function(X){return X(n,Mn(13,"Enter"))})},20));var I=b.start,V=b.endA,F,st,et,U;if(C){if(v.pos==O.pos)M.ie&&M.ie_version<=11&&v.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(function(){return He(n)},20)),F=n.state.tr.delete(I,V),st=m.resolve(b.start).marksAcross(m.resolve(b.endA));else if(b.endA==b.endB&&(U=m.resolve(b.start))&&(et=Mp(v.parent.content.cut(v.parentOffset,O.parentOffset),U.parent.content.cut(U.parentOffset,b.endA-U.start()))))F=n.state.tr,et.type=="add"?F.addMark(I,V,et.mark):F.removeMark(I,V,et.mark);else if(v.parent.child(v.index()).isText&&v.index()==O.index()-(O.textOffset?0:1)){var Nt=v.parent.textBetween(v.parentOffset,O.parentOffset);if(n.someProp("handleTextInput",function(X){return X(n,I,V,Nt)}))return;F=n.state.tr.insertText(Nt,I,V)}}if(F||(F=n.state.tr.replace(I,V,p.doc.slice(b.start-p.from,b.endB-p.from))),p.sel){var Z=wl(n,F.doc,p.sel);Z&&!(M.chrome&&M.android&&n.composing&&Z.empty&&(b.start!=b.endB||n.lastAndroidDeletet.content.size?null:xi(n,t.resolve(e.anchor),t.resolve(e.head))}function Mp(n,t){for(var e=n.firstChild.marks,r=t.firstChild.marks,o=e,i=r,s,a,l,c=0;ce||Ti(s,!0,!1)0&&(t||n.indexAfter(r)==n.node(r).childCount);)r--,o++,t=!1;if(e)for(var i=n.node(r).maybeChild(n.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function Ep(n,t,e,r,o){var i=n.findDiffStart(t,e);if(i==null)return null;var s=n.findDiffEnd(t,e+n.size,e+t.size),a=s.a,l=s.b;if(o=="end"){var c=Math.max(0,i-Math.min(a,l));r-=a+c-i}if(a=a?i-r:0;i-=u,l=i+(l-a),a=i}else if(l=l?i-r:0;i-=p,a=i+(a-l),l=i}return{start:i,endA:a,endB:l}}function Sl(n,t){for(var e=[],r=t.content,o=t.openStart,i=t.openEnd;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;var s=r.firstChild;e.push(s.type.name,s.attrs!=s.type.defaultAttrs?s.attrs:null),r=s.content}var a=n.someProp("clipboardSerializer")||ht.fromSchema(n.state.schema),l=_l(),c=l.createElement("div");c.appendChild(a.serializeFragment(r,{document:l}));for(var u=c.firstChild,p;u&&u.nodeType==1&&(p=Nl[u.nodeName.toLowerCase()]);){for(var d=p.length-1;d>=0;d--){for(var h=l.createElement(p[d]);c.firstChild;)h.appendChild(c.firstChild);c.appendChild(h),p[d]!="tbody"&&(o++,i++)}u=c.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(e));var m=n.someProp("clipboardTextSerializer",function(g){return g(t)})||t.content.textBetween(0,t.content.size,` `);return{dom:c,text:m}}function xl(n,t,e,r,o){var i,s=o.parent.type.spec.code,a;if(!e&&!t)return null;var l=t&&(r||s||!e);if(l){if(n.someProp("transformPastedText",function(O){t=O(t,s||r)}),s)return t?new T(S.from(n.state.schema.text(t.replace(/\r\n?/g,` -`))),0,0):T.empty;var c=n.someProp("clipboardTextParser",function(O){return O(t,o,r)});if(c)a=c;else{var u=o.marks(),p=n.state,d=p.schema,h=ht.fromSchema(d);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(function(O){var C=i.appendChild(document.createElement("p"));O&&C.appendChild(h.serializeNode(d.text(O,u)))})}}else n.someProp("transformPastedHTML",function(O){e=O(e)}),i=Tp(e),M.webkit&&_p(i);var m=i&&i.querySelector("[data-pm-slice]"),g=m&&/^(\d+) (\d+) (.*)/.exec(m.getAttribute("data-pm-slice"));if(!a){var y=n.someProp("clipboardParser")||n.someProp("domParser")||se.fromSchema(n.state.schema);a=y.parseSlice(i,{preserveWhitespace:!!(l||g),context:o})}if(g)a=Ap(Ol(a,+g[1],+g[2]),g[3]);else if(a=T.maxOpen(Np(a.content,o),!0),a.openStart||a.openEnd){for(var k=0,b=0,N=a.content.firstChild;k=0;r--){var o=e(r);if(o)return o.v}return n}function Ml(n,t,e){e===void 0&&(e=0);for(var r=t.length-1;r>=e;r--)n=t[r].create(null,S.from(n));return n}function Cl(n,t,e,r,o){if(o=e&&(a=t<0?s.contentMatchAt(0).fillBefore(a,n.childCount>1||i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(S.empty,!0))),n.replaceChild(t<0?0:n.childCount-1,s.copy(a))}function Ol(n,t,e){return t]*>)*/.exec(n);t&&(n=n.slice(t[0].length));var e=_l().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),o;if((o=r&&Nl[r[1].toLowerCase()])&&(n=o.map(function(s){return"<"+s+">"}).join("")+n+o.map(function(s){return""}).reverse().join("")),e.innerHTML=n,o)for(var i=0;i=0;a-=2){var l=e.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=S.from(l.create(r[a+1],o)),i++,s++}return new T(o,i,s)}var Dp={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ai=M.ie&&M.ie_version<=11,Di=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};Di.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},Di.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var jt=function(t,e){var r=this;this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver(function(o){for(var i=0;is.target.nodeValue.length})?r.flushSoon():r.flush()}),this.currentSelection=new Di,Ai&&(this.onCharData=function(o){r.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),r.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};jt.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(function(){t.flushingSoon=-1,t.flush()},20))},jt.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},jt.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,Dp),Ai&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},jt.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var r=0;r-1)){var t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);var e=this.view.root.getSelection(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Mi(this.view)&&!this.ignoreSelectionChange(e),o=-1,i=-1,s=!1,a=[];if(this.view.editable)for(var l=0;l1){var u=a.filter(function(h){return h.nodeName=="BR"});if(u.length==2){var p=u[0],d=u[1];p.parentNode&&p.parentNode.parentNode==d.parentNode?d.remove():p.remove()}}(o>-1||r)&&(o>-1&&(this.view.docView.markDirty(o,i),Rp(this.view)),this.handleDOMChange(o,i,s,a),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||He(this.view),this.currentSelection.set(e))}},jt.prototype.registerMutation=function(t,e){if(e.indexOf(t.target)>-1)return null;var r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(var o=0;oi.depth?u(n,e,i.nodeAfter,i.before(c),o,!0):u(n,e,i.node(c),i.before(c),o,!1)}))return{v:!0}},a=i.depth+1;a>0;a--){var l=s(a);if(l)return l.v}return!1}function En(n,t,e){n.focused||n.focus();var r=n.state.tr.setSelection(t);e=="pointer"&&r.setMeta("pointer",!0),n.dispatch(r)}function Lp(n,t){if(t==-1)return!1;var e=n.state.doc.resolve(t),r=e.nodeAfter;return r&&r.isAtom&&P.isSelectable(r)?(En(n,new P(e),"pointer"),!0):!1}function Fp(n,t){if(t==-1)return!1;var e=n.state.selection,r,o;e instanceof P&&(r=e.node);for(var i=n.state.doc.resolve(t),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(P.isSelectable(a)){r&&e.$from.depth>0&&s>=e.$from.depth&&i.before(e.$from.depth+1)==e.$from.pos?o=i.before(e.$from.depth):o=i.before(s);break}}return o!=null?(En(n,P.create(n.state.doc,o),"pointer"),!0):!1}function Hp(n,t,e,r,o){return Ii(n,"handleClickOn",t,e,r)||n.someProp("handleClick",function(i){return i(n,t,r)})||(o?Fp(n,e):Lp(n,e))}function Jp(n,t,e,r){return Ii(n,"handleDoubleClickOn",t,e,r)||n.someProp("handleDoubleClick",function(o){return o(n,t,r)})}function $p(n,t,e,r){return Ii(n,"handleTripleClickOn",t,e,r)||n.someProp("handleTripleClick",function(o){return o(n,t,r)})||qp(n,e,r)}function qp(n,t,e){if(e.button!=0)return!1;var r=n.state.doc;if(t==-1)return r.inlineContent?(En(n,K.create(r,0,r.content.size),"pointer"),!0):!1;for(var o=r.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)En(n,K.create(r,a+1,a+1+s.content.size),"pointer");else if(P.isSelectable(s))En(n,P.create(r,a),"pointer");else continue;return!0}}function Bi(n){return Yr(n)}var Dl=M.mac?"metaKey":"ctrlKey";Jt.mousedown=function(n,t){n.shiftKey=t.shiftKey;var e=Bi(n),r=Date.now(),o="singleClick";r-n.lastClick.time<500&&zp(t,n.lastClick)&&!t[Dl]&&(n.lastClick.type=="singleClick"?o="doubleClick":n.lastClick.type=="doubleClick"&&(o="tripleClick")),n.lastClick={time:r,x:t.clientX,y:t.clientY,type:o};var i=n.posAtCoords(Ur(t));!i||(o=="singleClick"?(n.mouseDown&&n.mouseDown.done(),n.mouseDown=new Gr(n,i,t,e)):(o=="doubleClick"?Jp:$p)(n,i.pos,i.inside,t)?t.preventDefault():on(n,"pointer"))};var Gr=function(t,e,r,o){var i=this;this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=r,this.flushed=o,this.selectNode=r[Dl],this.allowDefault=r.shiftKey,this.delayedSelectionSync=!1;var s,a;if(e.inside>-1)s=t.state.doc.nodeAt(e.inside),a=e.inside;else{var l=t.state.doc.resolve(e.pos);s=l.parent,a=l.depth?l.before():0}this.mightDrag=null;var c=o?null:r.target,u=c?t.docView.nearestDesc(c,!0):null;this.target=u?u.dom:null;var p=t.state,d=p.selection;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||d instanceof P&&d.from<=a&&d.to>a)&&(this.mightDrag={node:s,pos:a,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&M.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(function(){i.view.mouseDown==i&&i.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),on(t,"pointer")};Gr.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 He(t.view)}),this.view.mouseDown=null},Gr.prototype.up=function(t){if(this.done(),!!this.view.dom.contains(t.target.nodeType==3?t.target.parentNode:t.target)){var e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(Ur(t))),this.allowDefault||!e?on(this.view,"pointer"):Hp(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||M.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||M.chrome&&!(this.view.state.selection instanceof K)&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(En(this.view,z.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):on(this.view,"pointer")}},Gr.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),on(this.view,"pointer"),t.buttons==0&&this.done()},Jt.touchdown=function(n){Bi(n),on(n,"pointer")},Jt.contextmenu=function(n){return Bi(n)};function Rl(n,t){return n.composing?!0:M.safari&&Math.abs(t.timeStamp-n.compositionEndedAt)<500?(n.compositionEndedAt=-2e8,!0):!1}var jp=M.android?5e3:-1;Rt.compositionstart=Rt.compositionupdate=function(n){if(!n.composing){n.domObserver.flush();var t=n.state,e=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!e.textOffset&&e.parentOffset&&e.nodeBefore.marks.some(function(a){return a.type.spec.inclusive===!1})))n.markCursor=n.state.storedMarks||e.marks(),Yr(n,!0),n.markCursor=null;else if(Yr(n),M.gecko&&t.selection.empty&&e.parentOffset&&!e.textOffset&&e.nodeBefore.marks.length)for(var r=n.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){r.collapse(s,s.nodeValue.length);break}else o=s,i=-1}n.composing=!0}Vl(n,jp)},Rt.compositionend=function(n,t){n.composing&&(n.composing=!1,n.compositionEndedAt=t.timeStamp,Vl(n,20))};function Vl(n,t){clearTimeout(n.composingTimeout),t>-1&&(n.composingTimeout=setTimeout(function(){return Yr(n)},t))}function Il(n){for(n.composing&&(n.composing=!1,n.compositionEndedAt=Wp());n.compositionNodes.length>0;)n.compositionNodes.pop().markParentsDirty()}function Wp(){var n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Yr(n,t){if(n.domObserver.forceFlush(),Il(n),t||n.docView.dirty){var e=cl(n);return e&&!e.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(e)):n.updateState(n.state),!0}return!1}function Kp(n,t){if(!!n.dom.parentNode){var e=n.dom.parentNode.appendChild(document.createElement("div"));e.appendChild(t),e.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),o=document.createRange();o.selectNodeContents(t),n.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(function(){e.parentNode&&e.parentNode.removeChild(e),n.focus()},50)}}var On=M.ie&&M.ie_version<15||M.ios&&M.webkit_version<604;Jt.copy=Rt.cut=function(n,t){var e=n.state.selection,r=t.type=="cut";if(!e.empty){var o=On?null:t.clipboardData,i=e.content(),s=Sl(n,i),a=s.dom,l=s.text;o?(t.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):Kp(n,a),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}};function Up(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Gp(n,t){if(!!n.dom.parentNode){var e=n.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(e?"textarea":"div"));e||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(function(){n.focus(),r.parentNode&&r.parentNode.removeChild(r),e?Pi(n,r.value,null,t):Pi(n,r.textContent,r.innerHTML,t)},50)}}function Pi(n,t,e,r){var o=xl(n,t,e,n.shiftKey,n.state.selection.$from);if(n.someProp("handlePaste",function(a){return a(n,r,o||T.empty)}))return!0;if(!o)return!1;var i=Up(o),s=i?n.state.tr.replaceSelectionWith(i,n.shiftKey):n.state.tr.replaceSelection(o);return n.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}Rt.paste=function(n,t){var e=On?null:t.clipboardData;e&&Pi(n,e.getData("text/plain"),e.getData("text/html"),t)?t.preventDefault():Gp(n,t)};var Yp=function(t,e){this.slice=t,this.move=e},Bl=M.mac?"altKey":"ctrlKey";Jt.dragstart=function(n,t){var e=n.mouseDown;if(e&&e.done(),!!t.dataTransfer){var r=n.state.selection,o=r.empty?null:n.posAtCoords(Ur(t));if(!(o&&o.pos>=r.from&&o.pos<=(r instanceof P?r.to-1:r.to))){if(e&&e.mightDrag)n.dispatch(n.state.tr.setSelection(P.create(n.state.doc,e.mightDrag.pos)));else if(t.target&&t.target.nodeType==1){var i=n.docView.nearestDesc(t.target,!0);i&&i.node.type.spec.draggable&&i!=n.docView&&n.dispatch(n.state.tr.setSelection(P.create(n.state.doc,i.posBefore)))}}var s=n.state.selection.content(),a=Sl(n,s),l=a.dom,c=a.text;t.dataTransfer.clearData(),t.dataTransfer.setData(On?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",On||t.dataTransfer.setData("text/plain",c),n.dragging=new Yp(s,!t[Bl])}},Jt.dragend=function(n){var t=n.dragging;window.setTimeout(function(){n.dragging==t&&(n.dragging=null)},50)},Rt.dragover=Rt.dragenter=function(n,t){return t.preventDefault()},Rt.drop=function(n,t){var e=n.dragging;if(n.dragging=null,!!t.dataTransfer){var r=n.posAtCoords(Ur(t));if(!!r){var o=n.state.doc.resolve(r.pos);if(!!o){var i=e&&e.slice;i?n.someProp("transformPasted",function(m){i=m(i)}):i=xl(n,t.dataTransfer.getData(On?"Text":"text/plain"),On?null:t.dataTransfer.getData("text/html"),!1,o);var s=e&&!t[Bl];if(n.someProp("handleDrop",function(m){return m(n,t,i||T.empty,s)})){t.preventDefault();return}if(!!i){t.preventDefault();var a=i?ha(n.state.doc,o.pos,i):o.pos;a==null&&(a=o.pos);var l=n.state.tr;s&&l.deleteSelection();var c=l.mapping.map(a),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,p=l.doc;if(u?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),!l.doc.eq(p)){var d=l.doc.resolve(c);if(u&&P.isSelectable(i.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new P(d));else{var h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach(function(m,g,y,k){return h=k}),l.setSelection(xi(n,d,l.doc.resolve(h)))}n.focus(),n.dispatch(l.setMeta("uiEvent","drop"))}}}}}},Jt.focus=function(n){n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(function(){n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.root.getSelection())&&He(n)},20))},Jt.blur=function(n,t){n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.set({}),n.focused=!1)},Jt.beforeinput=function(n,t){if(M.chrome&&M.android&&t.inputType=="deleteContentBackward"){var e=n.domChangeCount;setTimeout(function(){if(n.domChangeCount==e&&(n.dom.blur(),n.focus(),!n.someProp("handleKeyDown",function(i){return i(n,Mn(8,"Backspace"))}))){var r=n.state.selection,o=r.$cursor;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())}},50)}};for(var Pl in Rt)Jt[Pl]=Rt[Pl];function ar(n,t){if(n==t)return!0;for(var e in n)if(n[e]!==t[e])return!1;for(var r in t)if(!(r in n))return!1;return!0}var Nn=function(t,e){this.spec=e||sn,this.side=this.spec.side||0,this.toDOM=t};Nn.prototype.map=function(t,e,r,o){var i=t.mapResult(e.from+o,this.side<0?-1:1),s=i.pos,a=i.deleted;return a?null:new ut(s-r,s-r,this)},Nn.prototype.valid=function(){return!0},Nn.prototype.eq=function(t){return this==t||t instanceof Nn&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&ar(this.spec,t.spec))},Nn.prototype.destroy=function(t){this.spec.destroy&&this.spec.destroy(t)};var ce=function(t,e){this.spec=e||sn,this.attrs=t};ce.prototype.map=function(t,e,r,o){var i=t.map(e.from+o,this.spec.inclusiveStart?-1:1)-r,s=t.map(e.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new ut(i,s,this)},ce.prototype.valid=function(t,e){return e.from=t&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(var l=0;lt){var c=this.children[l]+1;this.children[l+2].findInner(t-c,e-c,r,o+c,i)}},Y.prototype.map=function(t,e,r){return this==vt||t.maps.length==0?this:this.mapInner(t,e,0,0,r||sn)},Y.prototype.mapInner=function(t,e,r,o,i){for(var s,a=0;aa&&u.to=t){this.children[i]==t&&(r=this.children[i+2]);break}for(var s=t+1,a=s+e.content.size,l=0;ls&&c.type instanceof ce){var u=Math.max(s,c.from)-s,p=Math.min(a,c.to)-s;uX+i||(et>=a[Z]+i?a[Z+1]=-1:U>=o&&(Tt=Nt-U-(et-st))&&(a[Z]+=Tt,a[Z+1]+=Tt))}},c=0;c=r.content.size){u=!0;continue}var m=e.map(n[p+1]+i,-1),g=m-o,y=r.content.findIndex(h),k=y.index,b=y.offset,N=r.maybeChild(k);if(N&&b==h&&b+N.nodeSize==g){var v=a[p+2].mapInner(e,N,d+1,n[p]+i+1,s);v!=vt?(a[p]=h,a[p+1]=g,a[p+2]=v):(a[p+1]=-2,u=!0)}else u=!0}if(u){var O=Qp(a,n,t||[],e,o,i,s),C=Qr(O,r,0,s);t=C.local;for(var A=0;Ae&&s.to0;)t++;n.splice(t,0,e)}function Fi(n){var t=[];return n.someProp("decorations",function(e){var r=e(n.state);r&&r!=vt&&t.push(r)}),n.cursorWrapper&&t.push(Y.create(n.state.doc,[n.cursorWrapper.deco])),te.from(t)}var ct=function(t,e){this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(Wl),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=ql(this),this.markCursor=null,this.cursorWrapper=null,$l(this),this.nodeViews=jl(this),this.docView=nl(this.state.doc,Jl(this),Fi(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,Vp(this),this.prevDirectPlugins=[],this.pluginViews=[],this.updatePluginViews()},Hi={props:{configurable:!0},root:{configurable:!0}};Hi.props.get=function(){if(this._props.state!=this.state){var n=this._props;this._props={};for(var t in n)this._props[t]=n[t];this._props.state=this.state}return this._props},ct.prototype.update=function(t){t.handleDOMEvents!=this._props.handleDOMEvents&&Ri(this),this._props=t,t.plugins&&(t.plugins.forEach(Wl),this.directPlugins=t.plugins),this.updateStateInner(t.state,!0)},ct.prototype.setProps=function(t){var e={};for(var r in this._props)e[r]=this._props[r];e.state=this.state;for(var o in t)e[o]=t[o];this.update(e)},ct.prototype.updateState=function(t){this.updateStateInner(t,this.state.plugins!=t.plugins)},ct.prototype.updateStateInner=function(t,e){var r=this,o=this.state,i=!1,s=!1;if(t.storedMarks&&this.composing&&(Il(this),s=!0),this.state=t,e){var a=jl(this);td(a,this.nodeViews)&&(this.nodeViews=a,i=!0),Ri(this)}this.editable=ql(this),$l(this);var l=Fi(this),c=Jl(this),u=e?"reset":t.scrollToSelection>o.scrollToSelection?"to selection":"preserve",p=i||!this.docView.matchesNode(t.doc,c,l);(p||!t.selection.eq(o.selection))&&(s=!0);var d=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Kf(this);if(s){this.domObserver.stop();var h=p&&(M.ie||M.chrome)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&Zp(o.selection,t.selection);if(p){var m=M.chrome?this.trackWrites=this.root.getSelection().focusNode:null;(i||!this.docView.update(t.doc,c,l,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=nl(t.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(h=!0)}h||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&yp(this))?He(this,h):(hl(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 g=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",function(y){return y(r)})||(t.selection instanceof P?qa(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),g):qa(this,this.coordsAtPos(t.selection.head,1),g))}else d&&Uf(d)},ct.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},ct.prototype.updatePluginViews=function(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var e=0;e",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},Kl=typeof navigator!="undefined"&&/Chrome\/(\d+)/.exec(navigator.userAgent),ed=typeof navigator!="undefined"&&/Apple Computer/.test(navigator.vendor),nd=typeof navigator!="undefined"&&/Gecko\/\d+/.test(navigator.userAgent),Ul=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),rd=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),od=Kl&&(Ul||+Kl[1]<57)||nd&&Ul,gt=0;gt<10;gt++)Je[48+gt]=Je[96+gt]=String(gt);for(var gt=1;gt<=24;gt++)Je[gt+111]="F"+gt;for(var gt=65;gt<=90;gt++)Je[gt]=String.fromCharCode(gt+32),Zr[gt]=String.fromCharCode(gt);for(var Ji in Je)Zr.hasOwnProperty(Ji)||(Zr[Ji]=Je[Ji]);function id(n){var t=od&&(n.ctrlKey||n.altKey||n.metaKey)||(ed||rd)&&n.shiftKey&&n.key&&n.key.length==1,e=!t&&n.key||(n.shiftKey?Zr:Je)[n.keyCode]||n.key||"Unidentified";return e=="Esc"&&(e="Escape"),e=="Del"&&(e="Delete"),e=="Left"&&(e="ArrowLeft"),e=="Up"&&(e="ArrowUp"),e=="Right"&&(e="ArrowRight"),e=="Down"&&(e="ArrowDown"),e}var sd=typeof navigator!="undefined"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function ad(n){var t=n.split(/-(?!$)/),e=t[t.length-1];e=="Space"&&(e=" ");for(var r,o,i,s,a=0;a127)&&(s=Je[r.keyCode])&&s!=o){var l=t[$i(s,r,!0)];if(l&&l(e.state,e.dispatch,e))return!0}else if(i&&r.shiftKey){var c=t[$i(o,r,!0)];if(c&&c(e.state,e.dispatch,e))return!0}return!1}}function ud(n){return Object.prototype.toString.call(n).slice(8,-1)}function qi(n){return ud(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function to(n,t){const e=x({},n);return qi(n)&&qi(t)&&Object.keys(t).forEach(r=>{qi(t[r])?r in n?e[r]=to(n[r],t[r]):Object.assign(e,{[r]:t[r]}):Object.assign(e,{[r]:t[r]})}),e}function Yl(n){return typeof n=="function"}function L(n,t=void 0,...e){return Yl(n)?t?n.bind(t)(...e):n(...e):n}function _(n,t,e){return n.config[t]===void 0&&n.parent?_(n.parent,t,e):typeof n.config[t]=="function"?n.config[t].bind(Lt(x({},e),{parent:n.parent?_(n.parent,t,e):null})):n.config[t]}class yt{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=x(x({},this.config),t),this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=L(_(this,"addOptions",{name:this.name}))),this.storage=L(_(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new yt(t)}configure(t={}){const e=this.extend();return e.options=to(this.options,t),e.storage=L(_(e,"addStorage",{name:e.name,options:e.options})),e}extend(t={}){const e=new yt(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=t.defaultOptions?t.defaultOptions:e.parent.options,t.addOptions&&(e.options=L(_(e,"addOptions",{name:e.name}))),e.storage=L(_(e,"addStorage",{name:e.name,options:e.options})),e}}function Xl(n,t,e){const{from:r,to:o}=t,{blockSeparator:i=` +`))),0,0):T.empty;var c=n.someProp("clipboardTextParser",function(O){return O(t,o,r)});if(c)a=c;else{var u=o.marks(),p=n.state,d=p.schema,h=ht.fromSchema(d);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(function(O){var C=i.appendChild(document.createElement("p"));O&&C.appendChild(h.serializeNode(d.text(O,u)))})}}else n.someProp("transformPastedHTML",function(O){e=O(e)}),i=Np(e),M.webkit&&Tp(i);var m=i&&i.querySelector("[data-pm-slice]"),g=m&&/^(\d+) (\d+) (.*)/.exec(m.getAttribute("data-pm-slice"));if(!a){var y=n.someProp("clipboardParser")||n.someProp("domParser")||se.fromSchema(n.state.schema);a=y.parseSlice(i,{preserveWhitespace:!!(l||g),context:o})}if(g)a=_p(Ol(a,+g[1],+g[2]),g[3]);else if(a=T.maxOpen(Op(a.content,o),!0),a.openStart||a.openEnd){for(var k=0,b=0,N=a.content.firstChild;k=0;r--){var o=e(r);if(o)return o.v}return n}function Ml(n,t,e){e===void 0&&(e=0);for(var r=t.length-1;r>=e;r--)n=t[r].create(null,S.from(n));return n}function Cl(n,t,e,r,o){if(o=e&&(a=t<0?s.contentMatchAt(0).fillBefore(a,n.childCount>1||i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(S.empty,!0))),n.replaceChild(t<0?0:n.childCount-1,s.copy(a))}function Ol(n,t,e){return t]*>)*/.exec(n);t&&(n=n.slice(t[0].length));var e=_l().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),o;if((o=r&&Nl[r[1].toLowerCase()])&&(n=o.map(function(s){return"<"+s+">"}).join("")+n+o.map(function(s){return""}).reverse().join("")),e.innerHTML=n,o)for(var i=0;i=0;a-=2){var l=e.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=S.from(l.create(r[a+1],o)),i++,s++}return new T(o,i,s)}var Ap={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ai=M.ie&&M.ie_version<=11,Di=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};Di.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},Di.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var jt=function(t,e){var r=this;this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver(function(o){for(var i=0;is.target.nodeValue.length})?r.flushSoon():r.flush()}),this.currentSelection=new Di,Ai&&(this.onCharData=function(o){r.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),r.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};jt.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(function(){t.flushingSoon=-1,t.flush()},20))},jt.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},jt.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,Ap),Ai&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},jt.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var r=0;r-1)){var t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);var e=this.view.root.getSelection(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Mi(this.view)&&!this.ignoreSelectionChange(e),o=-1,i=-1,s=!1,a=[];if(this.view.editable)for(var l=0;l1){var u=a.filter(function(h){return h.nodeName=="BR"});if(u.length==2){var p=u[0],d=u[1];p.parentNode&&p.parentNode.parentNode==d.parentNode?d.remove():p.remove()}}(o>-1||r)&&(o>-1&&(this.view.docView.markDirty(o,i),Dp(this.view)),this.handleDOMChange(o,i,s,a),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||He(this.view),this.currentSelection.set(e))}},jt.prototype.registerMutation=function(t,e){if(e.indexOf(t.target)>-1)return null;var r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(var o=0;oi.depth?u(n,e,i.nodeAfter,i.before(c),o,!0):u(n,e,i.node(c),i.before(c),o,!1)}))return{v:!0}},a=i.depth+1;a>0;a--){var l=s(a);if(l)return l.v}return!1}function En(n,t,e){n.focused||n.focus();var r=n.state.tr.setSelection(t);e=="pointer"&&r.setMeta("pointer",!0),n.dispatch(r)}function zp(n,t){if(t==-1)return!1;var e=n.state.doc.resolve(t),r=e.nodeAfter;return r&&r.isAtom&&P.isSelectable(r)?(En(n,new P(e),"pointer"),!0):!1}function Lp(n,t){if(t==-1)return!1;var e=n.state.selection,r,o;e instanceof P&&(r=e.node);for(var i=n.state.doc.resolve(t),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(P.isSelectable(a)){r&&e.$from.depth>0&&s>=e.$from.depth&&i.before(e.$from.depth+1)==e.$from.pos?o=i.before(e.$from.depth):o=i.before(s);break}}return o!=null?(En(n,P.create(n.state.doc,o),"pointer"),!0):!1}function Fp(n,t,e,r,o){return Ii(n,"handleClickOn",t,e,r)||n.someProp("handleClick",function(i){return i(n,t,r)})||(o?Lp(n,e):zp(n,e))}function Hp(n,t,e,r){return Ii(n,"handleDoubleClickOn",t,e,r)||n.someProp("handleDoubleClick",function(o){return o(n,t,r)})}function Jp(n,t,e,r){return Ii(n,"handleTripleClickOn",t,e,r)||n.someProp("handleTripleClick",function(o){return o(n,t,r)})||$p(n,e,r)}function $p(n,t,e){if(e.button!=0)return!1;var r=n.state.doc;if(t==-1)return r.inlineContent?(En(n,K.create(r,0,r.content.size),"pointer"),!0):!1;for(var o=r.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)En(n,K.create(r,a+1,a+1+s.content.size),"pointer");else if(P.isSelectable(s))En(n,P.create(r,a),"pointer");else continue;return!0}}function Bi(n){return Yr(n)}var Dl=M.mac?"metaKey":"ctrlKey";Jt.mousedown=function(n,t){n.shiftKey=t.shiftKey;var e=Bi(n),r=Date.now(),o="singleClick";r-n.lastClick.time<500&&Pp(t,n.lastClick)&&!t[Dl]&&(n.lastClick.type=="singleClick"?o="doubleClick":n.lastClick.type=="doubleClick"&&(o="tripleClick")),n.lastClick={time:r,x:t.clientX,y:t.clientY,type:o};var i=n.posAtCoords(Ur(t));!i||(o=="singleClick"?(n.mouseDown&&n.mouseDown.done(),n.mouseDown=new Gr(n,i,t,e)):(o=="doubleClick"?Hp:Jp)(n,i.pos,i.inside,t)?t.preventDefault():on(n,"pointer"))};var Gr=function(t,e,r,o){var i=this;this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=r,this.flushed=o,this.selectNode=r[Dl],this.allowDefault=r.shiftKey,this.delayedSelectionSync=!1;var s,a;if(e.inside>-1)s=t.state.doc.nodeAt(e.inside),a=e.inside;else{var l=t.state.doc.resolve(e.pos);s=l.parent,a=l.depth?l.before():0}this.mightDrag=null;var c=o?null:r.target,u=c?t.docView.nearestDesc(c,!0):null;this.target=u?u.dom:null;var p=t.state,d=p.selection;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||d instanceof P&&d.from<=a&&d.to>a)&&(this.mightDrag={node:s,pos:a,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&M.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(function(){i.view.mouseDown==i&&i.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),on(t,"pointer")};Gr.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 He(t.view)}),this.view.mouseDown=null},Gr.prototype.up=function(t){if(this.done(),!!this.view.dom.contains(t.target.nodeType==3?t.target.parentNode:t.target)){var e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(Ur(t))),this.allowDefault||!e?on(this.view,"pointer"):Fp(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||M.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||M.chrome&&!(this.view.state.selection instanceof K)&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(En(this.view,z.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):on(this.view,"pointer")}},Gr.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),on(this.view,"pointer"),t.buttons==0&&this.done()},Jt.touchdown=function(n){Bi(n),on(n,"pointer")},Jt.contextmenu=function(n){return Bi(n)};function Rl(n,t){return n.composing?!0:M.safari&&Math.abs(t.timeStamp-n.compositionEndedAt)<500?(n.compositionEndedAt=-2e8,!0):!1}var qp=M.android?5e3:-1;Rt.compositionstart=Rt.compositionupdate=function(n){if(!n.composing){n.domObserver.flush();var t=n.state,e=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!e.textOffset&&e.parentOffset&&e.nodeBefore.marks.some(function(a){return a.type.spec.inclusive===!1})))n.markCursor=n.state.storedMarks||e.marks(),Yr(n,!0),n.markCursor=null;else if(Yr(n),M.gecko&&t.selection.empty&&e.parentOffset&&!e.textOffset&&e.nodeBefore.marks.length)for(var r=n.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){r.collapse(s,s.nodeValue.length);break}else o=s,i=-1}n.composing=!0}Vl(n,qp)},Rt.compositionend=function(n,t){n.composing&&(n.composing=!1,n.compositionEndedAt=t.timeStamp,Vl(n,20))};function Vl(n,t){clearTimeout(n.composingTimeout),t>-1&&(n.composingTimeout=setTimeout(function(){return Yr(n)},t))}function Il(n){for(n.composing&&(n.composing=!1,n.compositionEndedAt=jp());n.compositionNodes.length>0;)n.compositionNodes.pop().markParentsDirty()}function jp(){var n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Yr(n,t){if(n.domObserver.forceFlush(),Il(n),t||n.docView.dirty){var e=cl(n);return e&&!e.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(e)):n.updateState(n.state),!0}return!1}function Wp(n,t){if(!!n.dom.parentNode){var e=n.dom.parentNode.appendChild(document.createElement("div"));e.appendChild(t),e.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),o=document.createRange();o.selectNodeContents(t),n.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(function(){e.parentNode&&e.parentNode.removeChild(e),n.focus()},50)}}var On=M.ie&&M.ie_version<15||M.ios&&M.webkit_version<604;Jt.copy=Rt.cut=function(n,t){var e=n.state.selection,r=t.type=="cut";if(!e.empty){var o=On?null:t.clipboardData,i=e.content(),s=Sl(n,i),a=s.dom,l=s.text;o?(t.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):Wp(n,a),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}};function Kp(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Up(n,t){if(!!n.dom.parentNode){var e=n.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(e?"textarea":"div"));e||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(function(){n.focus(),r.parentNode&&r.parentNode.removeChild(r),e?Pi(n,r.value,null,t):Pi(n,r.textContent,r.innerHTML,t)},50)}}function Pi(n,t,e,r){var o=xl(n,t,e,n.shiftKey,n.state.selection.$from);if(n.someProp("handlePaste",function(a){return a(n,r,o||T.empty)}))return!0;if(!o)return!1;var i=Kp(o),s=i?n.state.tr.replaceSelectionWith(i,n.shiftKey):n.state.tr.replaceSelection(o);return n.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}Rt.paste=function(n,t){var e=On?null:t.clipboardData;e&&Pi(n,e.getData("text/plain"),e.getData("text/html"),t)?t.preventDefault():Up(n,t)};var Gp=function(t,e){this.slice=t,this.move=e},Bl=M.mac?"altKey":"ctrlKey";Jt.dragstart=function(n,t){var e=n.mouseDown;if(e&&e.done(),!!t.dataTransfer){var r=n.state.selection,o=r.empty?null:n.posAtCoords(Ur(t));if(!(o&&o.pos>=r.from&&o.pos<=(r instanceof P?r.to-1:r.to))){if(e&&e.mightDrag)n.dispatch(n.state.tr.setSelection(P.create(n.state.doc,e.mightDrag.pos)));else if(t.target&&t.target.nodeType==1){var i=n.docView.nearestDesc(t.target,!0);i&&i.node.type.spec.draggable&&i!=n.docView&&n.dispatch(n.state.tr.setSelection(P.create(n.state.doc,i.posBefore)))}}var s=n.state.selection.content(),a=Sl(n,s),l=a.dom,c=a.text;t.dataTransfer.clearData(),t.dataTransfer.setData(On?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",On||t.dataTransfer.setData("text/plain",c),n.dragging=new Gp(s,!t[Bl])}},Jt.dragend=function(n){var t=n.dragging;window.setTimeout(function(){n.dragging==t&&(n.dragging=null)},50)},Rt.dragover=Rt.dragenter=function(n,t){return t.preventDefault()},Rt.drop=function(n,t){var e=n.dragging;if(n.dragging=null,!!t.dataTransfer){var r=n.posAtCoords(Ur(t));if(!!r){var o=n.state.doc.resolve(r.pos);if(!!o){var i=e&&e.slice;i?n.someProp("transformPasted",function(m){i=m(i)}):i=xl(n,t.dataTransfer.getData(On?"Text":"text/plain"),On?null:t.dataTransfer.getData("text/html"),!1,o);var s=e&&!t[Bl];if(n.someProp("handleDrop",function(m){return m(n,t,i||T.empty,s)})){t.preventDefault();return}if(!!i){t.preventDefault();var a=i?ha(n.state.doc,o.pos,i):o.pos;a==null&&(a=o.pos);var l=n.state.tr;s&&l.deleteSelection();var c=l.mapping.map(a),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,p=l.doc;if(u?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),!l.doc.eq(p)){var d=l.doc.resolve(c);if(u&&P.isSelectable(i.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new P(d));else{var h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach(function(m,g,y,k){return h=k}),l.setSelection(xi(n,d,l.doc.resolve(h)))}n.focus(),n.dispatch(l.setMeta("uiEvent","drop"))}}}}}},Jt.focus=function(n){n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(function(){n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.root.getSelection())&&He(n)},20))},Jt.blur=function(n,t){n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.set({}),n.focused=!1)},Jt.beforeinput=function(n,t){if(M.chrome&&M.android&&t.inputType=="deleteContentBackward"){var e=n.domChangeCount;setTimeout(function(){if(n.domChangeCount==e&&(n.dom.blur(),n.focus(),!n.someProp("handleKeyDown",function(i){return i(n,Mn(8,"Backspace"))}))){var r=n.state.selection,o=r.$cursor;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())}},50)}};for(var Pl in Rt)Jt[Pl]=Rt[Pl];function ar(n,t){if(n==t)return!0;for(var e in n)if(n[e]!==t[e])return!1;for(var r in t)if(!(r in n))return!1;return!0}var Nn=function(t,e){this.spec=e||sn,this.side=this.spec.side||0,this.toDOM=t};Nn.prototype.map=function(t,e,r,o){var i=t.mapResult(e.from+o,this.side<0?-1:1),s=i.pos,a=i.deleted;return a?null:new ut(s-r,s-r,this)},Nn.prototype.valid=function(){return!0},Nn.prototype.eq=function(t){return this==t||t instanceof Nn&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&ar(this.spec,t.spec))},Nn.prototype.destroy=function(t){this.spec.destroy&&this.spec.destroy(t)};var ce=function(t,e){this.spec=e||sn,this.attrs=t};ce.prototype.map=function(t,e,r,o){var i=t.map(e.from+o,this.spec.inclusiveStart?-1:1)-r,s=t.map(e.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new ut(i,s,this)},ce.prototype.valid=function(t,e){return e.from=t&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(var l=0;lt){var c=this.children[l]+1;this.children[l+2].findInner(t-c,e-c,r,o+c,i)}},Y.prototype.map=function(t,e,r){return this==vt||t.maps.length==0?this:this.mapInner(t,e,0,0,r||sn)},Y.prototype.mapInner=function(t,e,r,o,i){for(var s,a=0;aa&&u.to=t){this.children[i]==t&&(r=this.children[i+2]);break}for(var s=t+1,a=s+e.content.size,l=0;ls&&c.type instanceof ce){var u=Math.max(s,c.from)-s,p=Math.min(a,c.to)-s;uX+i||(et>=a[Z]+i?a[Z+1]=-1:U>=o&&(Tt=Nt-U-(et-st))&&(a[Z]+=Tt,a[Z+1]+=Tt))}},c=0;c=r.content.size){u=!0;continue}var m=e.map(n[p+1]+i,-1),g=m-o,y=r.content.findIndex(h),k=y.index,b=y.offset,N=r.maybeChild(k);if(N&&b==h&&b+N.nodeSize==g){var v=a[p+2].mapInner(e,N,d+1,n[p]+i+1,s);v!=vt?(a[p]=h,a[p+1]=g,a[p+2]=v):(a[p+1]=-2,u=!0)}else u=!0}if(u){var O=Xp(a,n,t||[],e,o,i,s),C=Qr(O,r,0,s);t=C.local;for(var A=0;Ae&&s.to0;)t++;n.splice(t,0,e)}function Fi(n){var t=[];return n.someProp("decorations",function(e){var r=e(n.state);r&&r!=vt&&t.push(r)}),n.cursorWrapper&&t.push(Y.create(n.state.doc,[n.cursorWrapper.deco])),te.from(t)}var ct=function(t,e){this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(Wl),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=ql(this),this.markCursor=null,this.cursorWrapper=null,$l(this),this.nodeViews=jl(this),this.docView=nl(this.state.doc,Jl(this),Fi(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,Rp(this),this.prevDirectPlugins=[],this.pluginViews=[],this.updatePluginViews()},Hi={props:{configurable:!0},root:{configurable:!0}};Hi.props.get=function(){if(this._props.state!=this.state){var n=this._props;this._props={};for(var t in n)this._props[t]=n[t];this._props.state=this.state}return this._props},ct.prototype.update=function(t){t.handleDOMEvents!=this._props.handleDOMEvents&&Ri(this),this._props=t,t.plugins&&(t.plugins.forEach(Wl),this.directPlugins=t.plugins),this.updateStateInner(t.state,!0)},ct.prototype.setProps=function(t){var e={};for(var r in this._props)e[r]=this._props[r];e.state=this.state;for(var o in t)e[o]=t[o];this.update(e)},ct.prototype.updateState=function(t){this.updateStateInner(t,this.state.plugins!=t.plugins)},ct.prototype.updateStateInner=function(t,e){var r=this,o=this.state,i=!1,s=!1;if(t.storedMarks&&this.composing&&(Il(this),s=!0),this.state=t,e){var a=jl(this);Zp(a,this.nodeViews)&&(this.nodeViews=a,i=!0),Ri(this)}this.editable=ql(this),$l(this);var l=Fi(this),c=Jl(this),u=e?"reset":t.scrollToSelection>o.scrollToSelection?"to selection":"preserve",p=i||!this.docView.matchesNode(t.doc,c,l);(p||!t.selection.eq(o.selection))&&(s=!0);var d=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Wf(this);if(s){this.domObserver.stop();var h=p&&(M.ie||M.chrome)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&Qp(o.selection,t.selection);if(p){var m=M.chrome?this.trackWrites=this.root.getSelection().focusNode:null;(i||!this.docView.update(t.doc,c,l,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=nl(t.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(h=!0)}h||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&gp(this))?He(this,h):(hl(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 g=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",function(y){return y(r)})||(t.selection instanceof P?qa(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),g):qa(this,this.coordsAtPos(t.selection.head,1),g))}else d&&Kf(d)},ct.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},ct.prototype.updatePluginViews=function(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var e=0;e",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},Kl=typeof navigator!="undefined"&&/Chrome\/(\d+)/.exec(navigator.userAgent),td=typeof navigator!="undefined"&&/Apple Computer/.test(navigator.vendor),ed=typeof navigator!="undefined"&&/Gecko\/\d+/.test(navigator.userAgent),Ul=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),nd=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),rd=Kl&&(Ul||+Kl[1]<57)||ed&&Ul,gt=0;gt<10;gt++)Je[48+gt]=Je[96+gt]=String(gt);for(var gt=1;gt<=24;gt++)Je[gt+111]="F"+gt;for(var gt=65;gt<=90;gt++)Je[gt]=String.fromCharCode(gt+32),Zr[gt]=String.fromCharCode(gt);for(var Ji in Je)Zr.hasOwnProperty(Ji)||(Zr[Ji]=Je[Ji]);function od(n){var t=rd&&(n.ctrlKey||n.altKey||n.metaKey)||(td||nd)&&n.shiftKey&&n.key&&n.key.length==1,e=!t&&n.key||(n.shiftKey?Zr:Je)[n.keyCode]||n.key||"Unidentified";return e=="Esc"&&(e="Escape"),e=="Del"&&(e="Delete"),e=="Left"&&(e="ArrowLeft"),e=="Up"&&(e="ArrowUp"),e=="Right"&&(e="ArrowRight"),e=="Down"&&(e="ArrowDown"),e}var id=typeof navigator!="undefined"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function sd(n){var t=n.split(/-(?!$)/),e=t[t.length-1];e=="Space"&&(e=" ");for(var r,o,i,s,a=0;a127)&&(s=Je[r.keyCode])&&s!=o){var l=t[$i(s,r,!0)];if(l&&l(e.state,e.dispatch,e))return!0}else if(i&&r.shiftKey){var c=t[$i(o,r,!0)];if(c&&c(e.state,e.dispatch,e))return!0}return!1}}function cd(n){return Object.prototype.toString.call(n).slice(8,-1)}function qi(n){return cd(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function to(n,t){const e=x({},n);return qi(n)&&qi(t)&&Object.keys(t).forEach(r=>{qi(t[r])?r in n?e[r]=to(n[r],t[r]):Object.assign(e,{[r]:t[r]}):Object.assign(e,{[r]:t[r]})}),e}function Yl(n){return typeof n=="function"}function L(n,t=void 0,...e){return Yl(n)?t?n.bind(t)(...e):n(...e):n}function _(n,t,e){return n.config[t]===void 0&&n.parent?_(n.parent,t,e):typeof n.config[t]=="function"?n.config[t].bind(Lt(x({},e),{parent:n.parent?_(n.parent,t,e):null})):n.config[t]}class yt{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=x(x({},this.config),t),this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=L(_(this,"addOptions",{name:this.name}))),this.storage=L(_(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new yt(t)}configure(t={}){const e=this.extend();return e.options=to(this.options,t),e.storage=L(_(e,"addStorage",{name:e.name,options:e.options})),e}extend(t={}){const e=new yt(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=t.defaultOptions?t.defaultOptions:e.parent.options,t.addOptions&&(e.options=L(_(e,"addOptions",{name:e.name}))),e.storage=L(_(e,"addStorage",{name:e.name,options:e.options})),e}}function Xl(n,t,e){const{from:r,to:o}=t,{blockSeparator:i=` -`,textSerializers:s={}}=e||{};let a="",l=!0;return n.nodesBetween(r,o,(c,u,p,d)=>{var h;const m=s==null?void 0:s[c.type.name];m?(c.isBlock&&!l&&(a+=i,l=!0),a+=m({node:c,pos:u,parent:p,index:d})):c.isText?(a+=(h=c==null?void 0:c.text)===null||h===void 0?void 0:h.slice(Math.max(r,u)-u,o-u),l=!1):c.isBlock&&!l&&(a+=i,l=!0)}),a}function Ql(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,t])=>t.spec.toText).map(([t,e])=>[t,e.spec.toText]))}const fd=yt.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new Ht({key:new ae("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:t,schema:e}=n,{doc:r,selection:o}=t,{from:i,to:s}=o,a=Ql(e);return Xl(r,{from:i,to:s},{textSerializers:a})}}})]}});var pd=Object.freeze({__proto__:null,blur:()=>({editor:n,view:t})=>(requestAnimationFrame(()=>{n.isDestroyed||t.dom.blur()}),!0)}),dd=Object.freeze({__proto__:null,clearContent:(n=!1)=>({commands:t})=>t.setContent("",n)}),hd=Object.freeze({__proto__:null,clearNodes:()=>({state:n,tr:t,dispatch:e})=>{const{selection:r}=t,{ranges:o}=r;return o.forEach(i=>{n.doc.nodesBetween(i.$from.pos,i.$to.pos,(s,a)=>{if(s.type.isText)return;const l=t.doc.resolve(t.mapping.map(a)),c=t.doc.resolve(t.mapping.map(a+s.nodeSize)),u=l.blockRange(c);if(!u)return;const p=wn(u);if(s.type.isTextblock&&e){const{defaultType:d}=l.parent.contentMatchAt(l.index());t.setNodeMarkup(u.start,d)}(p||p===0)&&e&&t.lift(u,p)})}),!0}}),md=Object.freeze({__proto__:null,command:n=>t=>n(t)}),vd=Object.freeze({__proto__:null,createParagraphNear:()=>({state:n,dispatch:t})=>Ia(n,t)});function ft(n,t){if(typeof n=="string"){if(!t.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return t.nodes[n]}return n}var gd=Object.freeze({__proto__:null,deleteNode:n=>({tr:t,state:e,dispatch:r})=>{const o=ft(n,e.schema),i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const l=i.before(s),c=i.after(s);t.delete(l,c).scrollIntoView()}return!0}return!1}}),yd=Object.freeze({__proto__:null,deleteRange:n=>({tr:t,dispatch:e})=>{const{from:r,to:o}=n;return e&&t.delete(r,o),!0}}),bd=Object.freeze({__proto__:null,deleteSelection:()=>({state:n,dispatch:t})=>si(n,t)}),kd=Object.freeze({__proto__:null,enter:()=>({commands:n})=>n.keyboardShortcut("Enter")}),wd=Object.freeze({__proto__:null,exitCode:()=>({state:n,dispatch:t})=>Va(n,t)});function $e(n,t){if(typeof n=="string"){if(!t.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return t.marks[n]}return n}function ji(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function eo(n,t,e={strict:!0}){const r=Object.keys(t);return r.length?r.every(o=>e.strict?t[o]===n[o]:ji(t[o])?t[o].test(n[o]):t[o]===n[o]):!0}function Wi(n,t,e={}){return n.find(r=>r.type===t&&eo(r.attrs,e))}function Sd(n,t,e={}){return!!Wi(n,t,e)}function Zl(n,t,e={}){if(!n||!t)return;const r=n.parent.childAfter(n.parentOffset);if(!r.node)return;const o=Wi(r.node.marks,t,e);if(!o)return;let i=n.index(),s=n.start()+r.offset,a=i+1,l=s+r.node.nodeSize;for(Wi(r.node.marks,t,e);i>0&&o.isInSet(n.parent.child(i-1).marks);)i-=1,s-=n.parent.child(i).nodeSize;for(;a({tr:e,state:r,dispatch:o})=>{const i=$e(n,r.schema),{doc:s,selection:a}=e,{$from:l,from:c,to:u}=a;if(o){const p=Zl(l,i,t);if(p&&p.from<=c&&p.to>=u){const d=K.create(s,p.from,p.to);e.setSelection(d)}}return!0}}),Md=Object.freeze({__proto__:null,first:n=>t=>{const e=typeof n=="function"?n(t):n;for(let r=0;r({editor:t,view:e,tr:r,dispatch:o})=>{const i=()=>{Ed()&&e.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(e.focus(),t.commands.scrollIntoView())})};if(e.hasFocus()&&n===null||n===!1)return!0;if(o&&n===null&&!tc(t.state.selection))return i(),!0;const{from:s,to:a}=Od(t.state,n)||t.state.selection,{doc:l,storedMarks:c}=r,u=z.atStart(l).from,p=z.atEnd(l).to,d=ln(s,u,p),h=ln(a,u,p),m=K.create(l,d,h),g=t.state.selection.eq(m);return o&&(g||r.setSelection(m),g&&c&&r.setStoredMarks(c),i()),!0}}),Td=Object.freeze({__proto__:null,forEach:(n,t)=>e=>n.every((r,o)=>t(r,Lt(x({},e),{index:o})))}),_d=Object.freeze({__proto__:null,insertContent:(n,t)=>({tr:e,commands:r})=>r.insertContentAt({from:e.selection.from,to:e.selection.to},n,t)});function ec(n){const t=`${n}`;return new window.DOMParser().parseFromString(t,"text/html").body}function no(n,t,e){if(e=x({slice:!0,parseOptions:{}},e),typeof n=="object"&&n!==null)try{return Array.isArray(n)?S.fromArray(n.map(r=>t.nodeFromJSON(r))):t.nodeFromJSON(n)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",r),no("",t,e)}if(typeof n=="string"){const r=se.fromSchema(t);return e.slice?r.parseSlice(ec(n),e.parseOptions).content:r.parse(ec(n),e.parseOptions)}return no("",t,e)}function Ad(n,t,e){const r=n.steps.length-1;if(r{s===0&&(s=u)}),n.setSelection(z.near(n.doc.resolve(s),e))}var Dd=Object.freeze({__proto__:null,insertContentAt:(n,t,e)=>({tr:r,dispatch:o,editor:i})=>{if(o){e=x({parseOptions:{},updateSelection:!0},e);const s=no(t,i.schema,{parseOptions:x({preserveWhitespace:"full"},e.parseOptions)});if(s.toString()==="<>")return!0;let{from:a,to:l}=typeof n=="number"?{from:n,to:n}:n,c=!0;if(s.forEach(u=>{c=c?u.isBlock:!1}),a===l&&c){const u=r.doc.resolve(a);u.parent.isTextblock&&!u.parent.type.spec.code&&!u.parent.textContent&&(a-=1,l+=1)}r.replaceWith(a,l,s),e.updateSelection&&Ad(r,r.steps.length-1,-1)}return!0}}),Rd=Object.freeze({__proto__:null,joinBackward:()=>({state:n,dispatch:t})=>Ea(n,t)}),Vd=Object.freeze({__proto__:null,joinForward:()=>({state:n,dispatch:t})=>Ta(n,t)});const Id=typeof navigator!="undefined"?/Mac/.test(navigator.platform):!1;function Bd(n){const t=n.split(/-(?!$)/);let e=t[t.length-1];e==="Space"&&(e=" ");let r,o,i,s;for(let a=0;a({editor:t,view:e,tr:r,dispatch:o})=>{const i=Bd(n).split(/-(?!$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),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}),l=t.captureTransaction(()=>{e.someProp("handleKeyDown",c=>c(e,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&o&&r.maybeStep(u)}),!0}});function Tn(n,t,e={}){const{from:r,to:o,empty:i}=n.selection,s=t?ft(t,n.schema):null,a=[];n.doc.nodesBetween(r,o,(p,d)=>{if(p.isText)return;const h=Math.max(r,d),m=Math.min(o,d+p.nodeSize);a.push({node:p,from:h,to:m})});const l=o-r,c=a.filter(p=>s?s.name===p.node.type.name:!0).filter(p=>eo(p.node.attrs,e,{strict:!1}));return i?!!c.length:c.reduce((p,d)=>p+d.to-d.from,0)>=l}var zd=Object.freeze({__proto__:null,lift:(n,t={})=>({state:e,dispatch:r})=>{const o=ft(n,e.schema);return Tn(e,o,t)?Da(e,r):!1}}),Ld=Object.freeze({__proto__:null,liftEmptyBlock:()=>({state:n,dispatch:t})=>Ba(n,t)}),Fd=Object.freeze({__proto__:null,liftListItem:n=>({state:t,dispatch:e})=>{const r=ft(n,t.schema);return zf(r)(t,e)}}),Hd=Object.freeze({__proto__:null,newlineInCode:()=>({state:n,dispatch:t})=>Ra(n,t)});function ro(n,t){return t.nodes[n]?"node":t.marks[n]?"mark":null}function nc(n,t){const e=typeof t=="string"?[t]:t;return Object.keys(n).reduce((r,o)=>(e.includes(o)||(r[o]=n[o]),r),{})}var Jd=Object.freeze({__proto__:null,resetAttributes:(n,t)=>({tr:e,state:r,dispatch:o})=>{let i=null,s=null;const a=ro(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(i=ft(n,r.schema)),a==="mark"&&(s=$e(n,r.schema)),o&&e.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{i&&i===c.type&&e.setNodeMarkup(u,void 0,nc(c.attrs,t)),s&&c.marks.length&&c.marks.forEach(p=>{s===p.type&&e.addMark(u,u+c.nodeSize,s.create(nc(p.attrs,t)))})})}),!0):!1}}),$d=Object.freeze({__proto__:null,scrollIntoView:()=>({tr:n,dispatch:t})=>(t&&n.scrollIntoView(),!0)}),qd=Object.freeze({__proto__:null,selectAll:()=>({tr:n,commands:t})=>t.setTextSelection({from:0,to:n.doc.content.size})}),jd=Object.freeze({__proto__:null,selectNodeBackward:()=>({state:n,dispatch:t})=>Oa(n,t)}),Wd=Object.freeze({__proto__:null,selectNodeForward:()=>({state:n,dispatch:t})=>_a(n,t)}),Kd=Object.freeze({__proto__:null,selectParentNode:()=>({state:n,dispatch:t})=>Af(n,t)});function rc(n,t,e={}){return no(n,t,{slice:!1,parseOptions:e})}var Ud=Object.freeze({__proto__:null,setContent:(n,t=!1,e={})=>({tr:r,editor:o,dispatch:i})=>{const{doc:s}=r,a=rc(n,o.schema,e),l=K.create(s,0,s.content.size);return i&&r.setSelection(l).replaceSelectionWith(a,!1).setMeta("preventUpdate",!t),!0}});function oc(n,t){const e=$e(t,n.schema),{from:r,to:o,empty:i}=n.selection,s=[];i?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,o,l=>{s.push(...l.marks)});const a=s.find(l=>l.type.name===e.name);return a?x({},a.attrs):{}}var Gd=Object.freeze({__proto__:null,setMark:(n,t={})=>({tr:e,state:r,dispatch:o})=>{const{selection:i}=e,{empty:s,ranges:a}=i,l=$e(n,r.schema);if(o)if(s){const c=oc(r,l);e.addStoredMark(l.create(x(x({},c),t)))}else a.forEach(c=>{const u=c.$from.pos,p=c.$to.pos;r.doc.nodesBetween(u,p,(d,h)=>{const m=Math.max(h,u),g=Math.min(h+d.nodeSize,p);d.marks.find(k=>k.type===l)?d.marks.forEach(k=>{l===k.type&&e.addMark(m,g,l.create(x(x({},k.attrs),t)))}):e.addMark(m,g,l.create(t))})});return!0}}),Yd=Object.freeze({__proto__:null,setMeta:(n,t)=>({tr:e})=>(e.setMeta(n,t),!0)}),Xd=Object.freeze({__proto__:null,setNode:(n,t={})=>({state:e,dispatch:r})=>{const o=ft(n,e.schema);return Vf(o,t)(e,r)}}),Qd=Object.freeze({__proto__:null,setNodeSelection:n=>({tr:t,dispatch:e})=>{if(e){const{doc:r}=t,o=z.atStart(r).from,i=z.atEnd(r).to,s=ln(n,o,i),a=P.create(r,s);t.setSelection(a)}return!0}}),Zd=Object.freeze({__proto__:null,setTextSelection:n=>({tr:t,dispatch:e})=>{if(e){const{doc:r}=t,{from:o,to:i}=typeof n=="number"?{from:n,to:n}:n,s=z.atStart(r).from,a=z.atEnd(r).to,l=ln(o,s,a),c=ln(i,s,a),u=K.create(r,l,c);t.setSelection(u)}return!0}}),th=Object.freeze({__proto__:null,sinkListItem:n=>({state:t,dispatch:e})=>{const r=ft(n,t.schema);return Hf(r)(t,e)}});function oo(n,t,e){return Object.fromEntries(Object.entries(e).filter(([r])=>{const o=n.find(i=>i.type===t&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}function eh(n){for(let t=0;tt==null?void 0:t.includes(o.type.name));n.tr.ensureMarks(r)}}var nh=Object.freeze({__proto__:null,splitBlock:({keepMarks:n=!0}={})=>({tr:t,state:e,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:l}=i,c=o.extensionManager.attributes,u=oo(c,a.node().type.name,a.node().attrs);if(i instanceof P&&i.node.isBlock)return!a.parentOffset||!Oe(s,a.pos)?!1:(r&&(n&&ic(e,o.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(r){const p=l.parentOffset===l.parent.content.size;i instanceof K&&t.deleteSelection();const d=a.depth===0?void 0:eh(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=p&&d?[{type:d,attrs:u}]:void 0,m=Oe(t.doc,t.mapping.map(a.pos),1,h);if(!h&&!m&&Oe(t.doc,t.mapping.map(a.pos),1,d?[{type:d}]:void 0)&&(m=!0,h=d?[{type:d,attrs:u}]:void 0),m&&(t.split(t.mapping.map(a.pos),1,h),d&&!p&&!a.parentOffset&&a.parent.type!==d)){const g=t.mapping.map(a.before()),y=t.doc.resolve(g);a.node(-1).canReplaceWith(y.index(),y.index()+1,d)&&t.setNodeMarkup(t.mapping.map(a.before()),d)}n&&ic(e,o.extensionManager.splittableMarks),t.scrollIntoView()}return!0}}),rh=Object.freeze({__proto__:null,splitListItem:n=>({tr:t,state:e,dispatch:r,editor:o})=>{var i;const s=ft(n,e.schema),{$from:a,$to:l}=e.selection,c=e.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const u=a.node(-1);if(u.type!==s)return!1;const p=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(r){let y=S.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let A=a.depth-k;A>=a.depth-3;A-=1)y=S.from(a.node(A).copy(y));const b=a.indexAfter(-1){if(C>-1)return!1;A.isTextblock&&A.content.size===0&&(C=I+1)}),C>-1&&t.setSelection(K.near(t.doc.resolve(C))),t.scrollIntoView()}return!0}const d=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,h=oo(p,u.type.name,u.attrs),m=oo(p,a.node().type.name,a.node().attrs);t.delete(a.pos,l.pos);const g=d?[{type:s,attrs:h},{type:d,attrs:m}]:[{type:s,attrs:h}];return Oe(t.doc,a.pos,2)?(r&&t.split(a.pos,2,g).scrollIntoView(),!0):!1}});function oh(n,t){for(let e=n.depth;e>0;e-=1){const r=n.node(e);if(t(r))return{pos:e>0?n.before(e):0,start:n.start(e),depth:e,node:r}}}function ih(n){return t=>oh(t.$from,n)}function io(n){const t=n.filter(o=>o.type==="extension"),e=n.filter(o=>o.type==="node"),r=n.filter(o=>o.type==="mark");return{baseExtensions:t,nodeExtensions:e,markExtensions:r}}function sc(n,t){const{nodeExtensions:e}=io(t),r=e.find(s=>s.name===n);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=L(_(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}var sh=Object.freeze({__proto__:null,toggleList:(n,t)=>({editor:e,tr:r,state:o,dispatch:i,chain:s,commands:a,can:l})=>{const{extensions:c}=e.extensionManager,u=ft(n,o.schema),p=ft(t,o.schema),{selection:d}=o,{$from:h,$to:m}=d,g=h.blockRange(m);if(!g)return!1;const y=ih(b=>sc(b.type.name,c))(d);if(g.depth>=1&&y&&g.depth-y.depth<=1){if(y.node.type===u)return a.liftListItem(p);if(sc(y.node.type.name,c)&&u.validContent(y.node.content)&&i)return r.setNodeMarkup(y.pos,u),!0}return l().wrapInList(u)?a.wrapInList(u):s().clearNodes().wrapInList(u).run()}});function Ui(n,t,e={}){const{empty:r,ranges:o}=n.selection,i=t?$e(t,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(p=>i?i.name===p.type.name:!0).find(p=>eo(p.attrs,e,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:p,$to:d})=>{const h=p.pos,m=d.pos;n.doc.nodesBetween(h,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const k=Math.max(h,y),b=Math.min(m,y+g.nodeSize);s+=b-k,a.push(...g.marks.map(v=>({mark:v,from:k,to:b})))})}),s===0)return!1;const l=a.filter(p=>i?i.name===p.mark.type.name:!0).filter(p=>eo(p.mark.attrs,e,{strict:!1})).reduce((p,d)=>p+d.to-d.from,0),c=a.filter(p=>i?p.mark.type!==i&&p.mark.type.excludes(i):!0).reduce((p,d)=>p+d.to-d.from,0);return(l>0?l+c:l)>=s}var ah=Object.freeze({__proto__:null,toggleMark:(n,t={},e={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=e,s=$e(n,r.schema);return Ui(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)}}),lh=Object.freeze({__proto__:null,toggleNode:(n,t,e={})=>({state:r,commands:o})=>{const i=ft(n,r.schema),s=ft(t,r.schema);return Tn(r,i,e)?o.setNode(s):o.setNode(i,e)}}),ch=Object.freeze({__proto__:null,toggleWrap:(n,t={})=>({state:e,dispatch:r})=>{const o=ft(n,e.schema);return Tn(e,o,t)?Da(e,r):za(o,t)(e,r)}}),uh=Object.freeze({__proto__:null,undoInputRule:()=>({state:n,dispatch:t})=>{const e=n.plugins;for(let r=0;r=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,n.schema.text(i.text,l))}else s.delete(i.from,i.to)}return!0}}return!1}}),fh=Object.freeze({__proto__:null,unsetAllMarks:()=>({tr:n,state:t,dispatch:e})=>{const{selection:r}=n,{empty:o,ranges:i}=r;return o||e&&Object.entries(t.schema.marks).forEach(([,s])=>{i.forEach(a=>{n.removeMark(a.$from.pos,a.$to.pos,s)})}),!0}}),ph=Object.freeze({__proto__:null,unsetMark:(n,t={})=>({tr:e,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:a}=e,l=$e(n,r.schema),{$from:c,empty:u,ranges:p}=a;if(!o)return!0;if(u&&s){let{from:d,to:h}=a;const m=(i=c.marks().find(y=>y.type===l))===null||i===void 0?void 0:i.attrs,g=Zl(c,l,m);g&&(d=g.from,h=g.to),e.removeMark(d,h,l)}else p.forEach(d=>{e.removeMark(d.$from.pos,d.$to.pos,l)});return e.removeStoredMark(l),!0}}),dh=Object.freeze({__proto__:null,updateAttributes:(n,t={})=>({tr:e,state:r,dispatch:o})=>{let i=null,s=null;const a=ro(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(i=ft(n,r.schema)),a==="mark"&&(s=$e(n,r.schema)),o&&e.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;r.doc.nodesBetween(c,u,(p,d)=>{i&&i===p.type&&e.setNodeMarkup(d,void 0,x(x({},p.attrs),t)),s&&p.marks.length&&p.marks.forEach(h=>{if(s===h.type){const m=Math.max(d,c),g=Math.min(d+p.nodeSize,u);e.addMark(m,g,s.create(x(x({},h.attrs),t)))}})})}),!0):!1}}),hh=Object.freeze({__proto__:null,wrapIn:(n,t={})=>({state:e,dispatch:r})=>{const o=ft(n,e.schema);return Tn(e,o,t)?!1:za(o,t)(e,r)}}),mh=Object.freeze({__proto__:null,wrapInList:(n,t={})=>({state:e,dispatch:r})=>{const o=ft(n,e.schema);return Bf(o,t)(e,r)}});const vh=yt.create({name:"commands",addCommands(){return x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x({},pd),dd),hd),md),vd),gd),yd),bd),kd),wd),xd),Md),Nd),Td),_d),Dd),Rd),Vd),Pd),zd),Ld),Fd),Hd),Jd),$d),qd),jd),Wd),Kd),Ud),Gd),Yd),Xd),Qd),Zd),th),nh),rh),sh),ah),lh),ch),uh),fh),ph),dh),hh),mh)}}),gh=yt.create({name:"editable",addProseMirrorPlugins(){return[new Ht({key:new ae("editable"),props:{editable:()=>this.editor.options.editable}})]}}),yh=yt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Ht({key:new ae("focusEvents"),props:{handleDOMEvents:{focus:(t,e)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:e}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,e)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:e}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),bh=yt.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.joinForward(),()=>e.selectNodeForward()]);return{Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()}}}),kh=yt.create({name:"tabindex",addProseMirrorPlugins(){return[new Ht({key:new ae("tabindex"),props:{attributes:{tabindex:"0"}}})]}});var wh=Object.freeze({__proto__:null,ClipboardTextSerializer:fd,Commands:vh,Editable:gh,FocusEvents:yh,Keymap:bh,Tabindex:kh});function Sh(n,t){const e=ft(t,n.schema),{from:r,to:o}=n.selection,i=[];n.doc.nodesBetween(r,o,a=>{i.push(a)});const s=i.reverse().find(a=>a.type.name===e.name);return s?x({},s.attrs):{}}function xh(n,t){const e=ro(typeof t=="string"?t:t.name,n.schema);return e==="node"?Sh(n,t):e==="mark"?oc(n,t):{}}function Mh(n,t,e={}){if(!t)return Tn(n,null,e)||Ui(n,null,e);const r=ro(t,n.schema);return r==="node"?Tn(n,t,e):r==="mark"?Ui(n,t,e):!1}function Ch(n){(n==null?void 0:n.parentNode)&&n.parentNode.removeChild(n)}function Eh(n,t){const e=ht.fromSchema(t).serializeFragment(n),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(e),o.innerHTML}function Oh(n,t){const e={from:0,to:n.content.size};return Xl(n,e,t)}function Nh(n){var t;const e=(t=n.type.createAndFill())===null||t===void 0?void 0:t.toJSON(),r=n.toJSON();return JSON.stringify(e)===JSON.stringify(r)}function Th(n){const t=document.querySelector("style[data-tiptap-style]");if(t!==null)return t;const e=document.createElement("style");return e.setAttribute("data-tiptap-style",""),e.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(e),e}function Gi(n){const{state:t,transaction:e}=n;let{selection:r}=e,{doc:o}=e,{storedMarks:i}=e;return Lt(x({},t),{schema:t.schema,plugins:t.plugins,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=e.selection,o=e.doc,i=e.storedMarks,e}})}class Yi{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:r}=this,{view:o}=e,{tr:i}=r,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...u)=>{const p=l(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(i),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:r,editor:o,state:i}=this,{view:s}=o,a=[],l=!!t,c=t||i.tr,u=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),a.every(d=>d===!0)),p=Lt(x({},Object.fromEntries(Object.entries(r).map(([d,h])=>[d,(...g)=>{const y=this.buildProps(c,e),k=h(...g)(y);return a.push(k),p}]))),{run:u});return p}createCan(t){const{rawCommands:e,state:r}=this,o=void 0,i=t||r.tr,s=this.buildProps(i,o),a=Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...u)=>c(...u)(Lt(x({},s),{dispatch:o}))]));return Lt(x({},a),{chain:()=>this.createChain(i,o)})}buildProps(t,e=!0){const{rawCommands:r,editor:o,state:i}=this,{view:s}=o;i.storedMarks&&t.setStoredMarks(i.storedMarks);const a={tr:t,editor:o,view:s,state:Gi({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}}class so{constructor(t){this.find=t.find,this.handler=t.handler}}const _h=(n,t)=>{if(ji(t))return t.exec(n);const e=t(n);if(!e)return null;const r=[];return r.push(e.text),r.index=e.index,r.input=n,r.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(e.replaceWith)),r};function Xi(n){var t;const{editor:e,from:r,to:o,text:i,rules:s,plugin:a}=n,{view:l}=e;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||!!((t=c.nodeBefore||c.nodeAfter)===null||t===void 0?void 0:t.marks.find(h=>h.type.spec.code)))return!1;let u=!1;const p=500,d=c.parent.textBetween(Math.max(0,c.parentOffset-p),c.parentOffset,void 0,"\uFFFC")+i;return s.forEach(h=>{if(u)return;const m=_h(d,h.find);if(!m)return;const g=l.state.tr,y=Gi({state:l.state,transaction:g}),k={from:r-(m[0].length-i.length),to:o},{commands:b,chain:N,can:v}=new Yi({editor:e,state:y});h.handler({state:y,range:k,match:m,commands:b,chain:N,can:v}),!!g.steps.length&&(g.setMeta(a,{transform:g,from:r,to:o,text:i}),l.dispatch(g),u=!0)}),u}function Ah(n){const{editor:t,rules:e}=n,r=new Ht({state:{init(){return null},apply(o,i){const s=o.getMeta(this);return s||(o.selectionSet||o.docChanged?null:i)}},props:{handleTextInput(o,i,s,a){return Xi({editor:t,from:i,to:s,text:a,rules:e,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:i}=o.state.selection;i&&Xi({editor:t,from:i.pos,to:i.pos,text:"",rules:e,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;const{$cursor:s}=o.state.selection;return s?Xi({editor:t,from:s.pos,to:s.pos,text:` -`,rules:e,plugin:r}):!1}},isInputRules:!0});return r}function Dh(n){return typeof n=="number"}class Rh{constructor(t){this.find=t.find,this.handler=t.handler}}const Vh=(n,t)=>{if(ji(t))return[...n.matchAll(t)];const e=t(n);return e?e.map(r=>{const o=[];return o.push(r.text),o.index=r.index,o.input=n,o.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(r.replaceWith)),o}):[]};function Ih(n){const{editor:t,state:e,from:r,to:o,rules:i}=n,{commands:s,chain:a,can:l}=new Yi({editor:t,state:e});e.doc.nodesBetween(r,o,(c,u)=>{if(!c.isTextblock||c.type.spec.code)return;const p=Math.max(r,u),d=Math.min(o,u+c.content.size),h=c.textBetween(p-u,d-u,void 0,"\uFFFC");i.forEach(m=>{Vh(h,m.find).forEach(y=>{if(y.index===void 0)return;const k=p+y.index+1,b=k+y[0].length,N={from:e.tr.mapping.map(k),to:e.tr.mapping.map(b)};m.handler({state:e,range:N,match:y,commands:s,chain:a,can:l})})})})}function Bh(n){const{editor:t,rules:e}=n;let r=!1;const o=new Ht({props:{handlePaste:(i,s)=>{var a;const l=(a=s.clipboardData)===null||a===void 0?void 0:a.getData("text/html");return r=!!(l==null?void 0:l.includes("data-pm-slice")),!1}},appendTransaction:(i,s,a)=>{const l=i[0];if(!l.getMeta("paste")||r)return;const{doc:c,before:u}=l,p=u.content.findDiffStart(c.content),d=u.content.findDiffEnd(c.content);if(!Dh(p)||!d||p===d.b)return;const h=a.tr,m=Gi({state:a,transaction:h});if(Ih({editor:t,state:m,from:Math.max(p-1,0),to:d.b,rules:e,plugin:o}),!!h.steps.length)return h},isPasteRules:!0});return o}function ac(n){const t=[],{nodeExtensions:e,markExtensions:r}=io(n),o=[...e,...r],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0};return n.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},l=_(s,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(p=>{Object.entries(u.attributes).forEach(([d,h])=>{t.push({type:p,name:d,attribute:x(x({},i),h)})})})})}),o.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},l=_(s,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,p])=>{t.push({type:s.name,name:u,attribute:x(x({},i),p)})})}),t}function pt(...n){return n.filter(t=>!!t).reduce((t,e)=>{const r=x({},t);return Object.entries(e).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}o==="class"?r[o]=[r[o],i].join(" "):o==="style"?r[o]=[r[o],i].join("; "):r[o]=i}),r},{})}function Qi(n,t){return t.filter(e=>e.attribute.rendered).map(e=>e.attribute.renderHTML?e.attribute.renderHTML(n.attrs)||{}:{[e.name]:n.attrs[e.name]}).reduce((e,r)=>pt(e,r),{})}function Ph(n={}){return Object.keys(n).length===0&&n.constructor===Object}function zh(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function lc(n,t){return n.style?n:Lt(x({},n),{getAttrs:e=>{const r=n.getAttrs?n.getAttrs(e):n.attrs;if(r===!1)return!1;const o=t.filter(i=>i.attribute.rendered).reduce((i,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(e):zh(e.getAttribute(s.name));return Ki(a)&&console.warn(`[tiptap warn]: BREAKING CHANGE: "parseHTML" for your attribute "${s.name}" returns an object but should return the value itself. If this is expected you can ignore this message. This warning will be removed in one of the next releases. Further information: https://github.com/ueberdosis/tiptap/issues/1863`),a==null?i:Lt(x({},i),{[s.name]:a})},{});return x(x({},r),o)}})}function cc(n){return Object.fromEntries(Object.entries(n).filter(([t,e])=>t==="attrs"&&Ph(e)?!1:e!=null))}function Lh(n){var t;const e=ac(n),{nodeExtensions:r,markExtensions:o}=io(n),i=(t=r.find(l=>_(l,"topNode")))===null||t===void 0?void 0:t.name,s=Object.fromEntries(r.map(l=>{const c=e.filter(y=>y.type===l.name),u={name:l.name,options:l.options,storage:l.storage},p=n.reduce((y,k)=>{const b=_(k,"extendNodeSchema",u);return x(x({},y),b?b(l):{})},{}),d=cc(Lt(x({},p),{content:L(_(l,"content",u)),marks:L(_(l,"marks",u)),group:L(_(l,"group",u)),inline:L(_(l,"inline",u)),atom:L(_(l,"atom",u)),selectable:L(_(l,"selectable",u)),draggable:L(_(l,"draggable",u)),code:L(_(l,"code",u)),defining:L(_(l,"defining",u)),isolating:L(_(l,"isolating",u)),attrs:Object.fromEntries(c.map(y=>{var k;return[y.name,{default:(k=y==null?void 0:y.attribute)===null||k===void 0?void 0:k.default}]}))})),h=L(_(l,"parseHTML",u));h&&(d.parseDOM=h.map(y=>lc(y,c)));const m=_(l,"renderHTML",u);m&&(d.toDOM=y=>m({node:y,HTMLAttributes:Qi(y,c)}));const g=_(l,"renderText",u);return g&&(d.toText=g),[l.name,d]})),a=Object.fromEntries(o.map(l=>{const c=e.filter(g=>g.type===l.name),u={name:l.name,options:l.options,storage:l.storage},p=n.reduce((g,y)=>{const k=_(y,"extendMarkSchema",u);return x(x({},g),k?k(l):{})},{}),d=cc(Lt(x({},p),{inclusive:L(_(l,"inclusive",u)),excludes:L(_(l,"excludes",u)),group:L(_(l,"group",u)),spanning:L(_(l,"spanning",u)),code:L(_(l,"code",u)),attrs:Object.fromEntries(c.map(g=>{var y;return[g.name,{default:(y=g==null?void 0:g.attribute)===null||y===void 0?void 0:y.default}]}))})),h=L(_(l,"parseHTML",u));h&&(d.parseDOM=h.map(g=>lc(g,c)));const m=_(l,"renderHTML",u);return m&&(d.toDOM=g=>m({mark:g,HTMLAttributes:Qi(g,c)})),[l.name,d]}));return new en({topNode:i,nodes:s,marks:a})}function Zi(n,t){return t.nodes[n]||t.marks[n]||null}function Fh(n){const t=n.filter((e,r)=>n.indexOf(e)!==r);return[...new Set(t)]}class _n{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=_n.resolve(t),this.schema=Lh(this.extensions),this.extensions.forEach(r=>{var o;this.editor.extensionStorage[r.name]=r.storage;const i={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:Zi(r.name,this.schema)};r.type==="mark"&&((o=L(_(r,"keepOnSplit",i)))!==null&&o!==void 0?o:!0)&&this.splittableMarks.push(r.name);const s=_(r,"onBeforeCreate",i);s&&this.editor.on("beforeCreate",s);const a=_(r,"onCreate",i);a&&this.editor.on("create",a);const l=_(r,"onUpdate",i);l&&this.editor.on("update",l);const c=_(r,"onSelectionUpdate",i);c&&this.editor.on("selectionUpdate",c);const u=_(r,"onTransaction",i);u&&this.editor.on("transaction",u);const p=_(r,"onFocus",i);p&&this.editor.on("focus",p);const d=_(r,"onBlur",i);d&&this.editor.on("blur",d);const h=_(r,"onDestroy",i);h&&this.editor.on("destroy",h)})}static resolve(t){const e=_n.sort(_n.flatten(t)),r=Fh(e.map(o=>o.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),e}static flatten(t){return t.map(e=>{const r={name:e.name,options:e.options,storage:e.storage},o=_(e,"addExtensions",r);return o?[e,...this.flatten(o())]:e}).flat(10)}static sort(t){const e=100;return t.sort((r,o)=>{const i=_(r,"priority")||e,s=_(o,"priority")||e;return i>s?-1:i{const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Zi(e.name,this.schema)},o=_(e,"addCommands",r);return o?x(x({},t),o()):t},{})}get plugins(){const{editor:t}=this,e=_n.sort([...this.extensions].reverse()),r=[],o=[],i=e.map(s=>{const a={name:s.name,options:s.options,storage:s.storage,editor:t,type:Zi(s.name,this.schema)},l=[],c=_(s,"addKeyboardShortcuts",a);if(c){const h=Object.fromEntries(Object.entries(c()).map(([g,y])=>[g,()=>y({editor:t})])),m=cd(h);l.push(m)}const u=_(s,"addInputRules",a);t.options.enableInputRules&&u&&r.push(...u());const p=_(s,"addPasteRules",a);t.options.enablePasteRules&&p&&o.push(...p());const d=_(s,"addProseMirrorPlugins",a);if(d){const h=d();l.push(...h)}return l}).flat();return[Ah({editor:t,rules:r}),Bh({editor:t,rules:o}),...i]}get attributes(){return ac(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=io(this.extensions);return Object.fromEntries(e.filter(r=>!!_(r,"addNodeView")).map(r=>{const o=this.attributes.filter(l=>l.type===r.name),i={name:r.name,options:r.options,storage:r.storage,editor:t,type:ft(r.name,this.schema)},s=_(r,"addNodeView",i);if(!s)return[];const a=(l,c,u,p)=>{const d=Qi(l,o);return s()({editor:t,node:l,getPos:u,decorations:p,HTMLAttributes:d,extension:r})};return[r.name,a]}))}}class Hh{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const r=this.callbacks[t];return r&&r.forEach(o=>o.apply(this,e)),this}off(t,e){const r=this.callbacks[t];return r&&(e?this.callbacks[t]=r.filter(o=>o!==e):delete this.callbacks[t]),this}removeAllListeners(){this.callbacks={}}}const Jh=`.ProseMirror { +`,textSerializers:s={}}=e||{};let a="",l=!0;return n.nodesBetween(r,o,(c,u,p,d)=>{var h;const m=s==null?void 0:s[c.type.name];m?(c.isBlock&&!l&&(a+=i,l=!0),a+=m({node:c,pos:u,parent:p,index:d})):c.isText?(a+=(h=c==null?void 0:c.text)===null||h===void 0?void 0:h.slice(Math.max(r,u)-u,o-u),l=!1):c.isBlock&&!l&&(a+=i,l=!0)}),a}function Ql(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,t])=>t.spec.toText).map(([t,e])=>[t,e.spec.toText]))}const ud=yt.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new Ht({key:new ae("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:t,schema:e}=n,{doc:r,selection:o}=t,{from:i,to:s}=o,a=Ql(e);return Xl(r,{from:i,to:s},{textSerializers:a})}}})]}});var fd=Object.freeze({__proto__:null,blur:()=>({editor:n,view:t})=>(requestAnimationFrame(()=>{n.isDestroyed||t.dom.blur()}),!0)}),pd=Object.freeze({__proto__:null,clearContent:(n=!1)=>({commands:t})=>t.setContent("",n)}),dd=Object.freeze({__proto__:null,clearNodes:()=>({state:n,tr:t,dispatch:e})=>{const{selection:r}=t,{ranges:o}=r;return o.forEach(i=>{n.doc.nodesBetween(i.$from.pos,i.$to.pos,(s,a)=>{if(s.type.isText)return;const l=t.doc.resolve(t.mapping.map(a)),c=t.doc.resolve(t.mapping.map(a+s.nodeSize)),u=l.blockRange(c);if(!u)return;const p=wn(u);if(s.type.isTextblock&&e){const{defaultType:d}=l.parent.contentMatchAt(l.index());t.setNodeMarkup(u.start,d)}(p||p===0)&&e&&t.lift(u,p)})}),!0}}),hd=Object.freeze({__proto__:null,command:n=>t=>n(t)}),md=Object.freeze({__proto__:null,createParagraphNear:()=>({state:n,dispatch:t})=>Ia(n,t)});function ft(n,t){if(typeof n=="string"){if(!t.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return t.nodes[n]}return n}var vd=Object.freeze({__proto__:null,deleteNode:n=>({tr:t,state:e,dispatch:r})=>{const o=ft(n,e.schema),i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const l=i.before(s),c=i.after(s);t.delete(l,c).scrollIntoView()}return!0}return!1}}),gd=Object.freeze({__proto__:null,deleteRange:n=>({tr:t,dispatch:e})=>{const{from:r,to:o}=n;return e&&t.delete(r,o),!0}}),yd=Object.freeze({__proto__:null,deleteSelection:()=>({state:n,dispatch:t})=>si(n,t)}),bd=Object.freeze({__proto__:null,enter:()=>({commands:n})=>n.keyboardShortcut("Enter")}),kd=Object.freeze({__proto__:null,exitCode:()=>({state:n,dispatch:t})=>Va(n,t)});function $e(n,t){if(typeof n=="string"){if(!t.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return t.marks[n]}return n}function ji(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function eo(n,t,e={strict:!0}){const r=Object.keys(t);return r.length?r.every(o=>e.strict?t[o]===n[o]:ji(t[o])?t[o].test(n[o]):t[o]===n[o]):!0}function Wi(n,t,e={}){return n.find(r=>r.type===t&&eo(r.attrs,e))}function wd(n,t,e={}){return!!Wi(n,t,e)}function Zl(n,t,e={}){if(!n||!t)return;const r=n.parent.childAfter(n.parentOffset);if(!r.node)return;const o=Wi(r.node.marks,t,e);if(!o)return;let i=n.index(),s=n.start()+r.offset,a=i+1,l=s+r.node.nodeSize;for(Wi(r.node.marks,t,e);i>0&&o.isInSet(n.parent.child(i-1).marks);)i-=1,s-=n.parent.child(i).nodeSize;for(;a({tr:e,state:r,dispatch:o})=>{const i=$e(n,r.schema),{doc:s,selection:a}=e,{$from:l,from:c,to:u}=a;if(o){const p=Zl(l,i,t);if(p&&p.from<=c&&p.to>=u){const d=K.create(s,p.from,p.to);e.setSelection(d)}}return!0}}),xd=Object.freeze({__proto__:null,first:n=>t=>{const e=typeof n=="function"?n(t):n;for(let r=0;r({editor:t,view:e,tr:r,dispatch:o})=>{const i=()=>{Cd()&&e.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(e.focus(),t.commands.scrollIntoView())})};if(e.hasFocus()&&n===null||n===!1)return!0;if(o&&n===null&&!tc(t.state.selection))return i(),!0;const{from:s,to:a}=Ed(t.state,n)||t.state.selection,{doc:l,storedMarks:c}=r,u=z.atStart(l).from,p=z.atEnd(l).to,d=ln(s,u,p),h=ln(a,u,p),m=K.create(l,d,h),g=t.state.selection.eq(m);return o&&(g||r.setSelection(m),g&&c&&r.setStoredMarks(c),i()),!0}}),Nd=Object.freeze({__proto__:null,forEach:(n,t)=>e=>n.every((r,o)=>t(r,Lt(x({},e),{index:o})))}),Td=Object.freeze({__proto__:null,insertContent:(n,t)=>({tr:e,commands:r})=>r.insertContentAt({from:e.selection.from,to:e.selection.to},n,t)});function ec(n){const t=`${n}`;return new window.DOMParser().parseFromString(t,"text/html").body}function no(n,t,e){if(e=x({slice:!0,parseOptions:{}},e),typeof n=="object"&&n!==null)try{return Array.isArray(n)?S.fromArray(n.map(r=>t.nodeFromJSON(r))):t.nodeFromJSON(n)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",r),no("",t,e)}if(typeof n=="string"){const r=se.fromSchema(t);return e.slice?r.parseSlice(ec(n),e.parseOptions).content:r.parse(ec(n),e.parseOptions)}return no("",t,e)}function _d(n,t,e){const r=n.steps.length-1;if(r{s===0&&(s=u)}),n.setSelection(z.near(n.doc.resolve(s),e))}var Ad=Object.freeze({__proto__:null,insertContentAt:(n,t,e)=>({tr:r,dispatch:o,editor:i})=>{if(o){e=x({parseOptions:{},updateSelection:!0},e);const s=no(t,i.schema,{parseOptions:x({preserveWhitespace:"full"},e.parseOptions)});if(s.toString()==="<>")return!0;let{from:a,to:l}=typeof n=="number"?{from:n,to:n}:n,c=!0;if(s.forEach(u=>{c=c?u.isBlock:!1}),a===l&&c){const u=r.doc.resolve(a);u.parent.isTextblock&&!u.parent.type.spec.code&&!u.parent.textContent&&(a-=1,l+=1)}r.replaceWith(a,l,s),e.updateSelection&&_d(r,r.steps.length-1,-1)}return!0}}),Dd=Object.freeze({__proto__:null,joinBackward:()=>({state:n,dispatch:t})=>Ea(n,t)}),Rd=Object.freeze({__proto__:null,joinForward:()=>({state:n,dispatch:t})=>Ta(n,t)});const Vd=typeof navigator!="undefined"?/Mac/.test(navigator.platform):!1;function Id(n){const t=n.split(/-(?!$)/);let e=t[t.length-1];e==="Space"&&(e=" ");let r,o,i,s;for(let a=0;a({editor:t,view:e,tr:r,dispatch:o})=>{const i=Id(n).split(/-(?!$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),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}),l=t.captureTransaction(()=>{e.someProp("handleKeyDown",c=>c(e,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&o&&r.maybeStep(u)}),!0}});function Tn(n,t,e={}){const{from:r,to:o,empty:i}=n.selection,s=t?ft(t,n.schema):null,a=[];n.doc.nodesBetween(r,o,(p,d)=>{if(p.isText)return;const h=Math.max(r,d),m=Math.min(o,d+p.nodeSize);a.push({node:p,from:h,to:m})});const l=o-r,c=a.filter(p=>s?s.name===p.node.type.name:!0).filter(p=>eo(p.node.attrs,e,{strict:!1}));return i?!!c.length:c.reduce((p,d)=>p+d.to-d.from,0)>=l}var Pd=Object.freeze({__proto__:null,lift:(n,t={})=>({state:e,dispatch:r})=>{const o=ft(n,e.schema);return Tn(e,o,t)?Da(e,r):!1}}),zd=Object.freeze({__proto__:null,liftEmptyBlock:()=>({state:n,dispatch:t})=>Ba(n,t)}),Ld=Object.freeze({__proto__:null,liftListItem:n=>({state:t,dispatch:e})=>{const r=ft(n,t.schema);return Pf(r)(t,e)}}),Fd=Object.freeze({__proto__:null,newlineInCode:()=>({state:n,dispatch:t})=>Ra(n,t)});function ro(n,t){return t.nodes[n]?"node":t.marks[n]?"mark":null}function nc(n,t){const e=typeof t=="string"?[t]:t;return Object.keys(n).reduce((r,o)=>(e.includes(o)||(r[o]=n[o]),r),{})}var Hd=Object.freeze({__proto__:null,resetAttributes:(n,t)=>({tr:e,state:r,dispatch:o})=>{let i=null,s=null;const a=ro(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(i=ft(n,r.schema)),a==="mark"&&(s=$e(n,r.schema)),o&&e.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{i&&i===c.type&&e.setNodeMarkup(u,void 0,nc(c.attrs,t)),s&&c.marks.length&&c.marks.forEach(p=>{s===p.type&&e.addMark(u,u+c.nodeSize,s.create(nc(p.attrs,t)))})})}),!0):!1}}),Jd=Object.freeze({__proto__:null,scrollIntoView:()=>({tr:n,dispatch:t})=>(t&&n.scrollIntoView(),!0)}),$d=Object.freeze({__proto__:null,selectAll:()=>({tr:n,commands:t})=>t.setTextSelection({from:0,to:n.doc.content.size})}),qd=Object.freeze({__proto__:null,selectNodeBackward:()=>({state:n,dispatch:t})=>Oa(n,t)}),jd=Object.freeze({__proto__:null,selectNodeForward:()=>({state:n,dispatch:t})=>_a(n,t)}),Wd=Object.freeze({__proto__:null,selectParentNode:()=>({state:n,dispatch:t})=>_f(n,t)});function rc(n,t,e={}){return no(n,t,{slice:!1,parseOptions:e})}var Kd=Object.freeze({__proto__:null,setContent:(n,t=!1,e={})=>({tr:r,editor:o,dispatch:i})=>{const{doc:s}=r,a=rc(n,o.schema,e),l=K.create(s,0,s.content.size);return i&&r.setSelection(l).replaceSelectionWith(a,!1).setMeta("preventUpdate",!t),!0}});function oc(n,t){const e=$e(t,n.schema),{from:r,to:o,empty:i}=n.selection,s=[];i?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,o,l=>{s.push(...l.marks)});const a=s.find(l=>l.type.name===e.name);return a?x({},a.attrs):{}}var Ud=Object.freeze({__proto__:null,setMark:(n,t={})=>({tr:e,state:r,dispatch:o})=>{const{selection:i}=e,{empty:s,ranges:a}=i,l=$e(n,r.schema);if(o)if(s){const c=oc(r,l);e.addStoredMark(l.create(x(x({},c),t)))}else a.forEach(c=>{const u=c.$from.pos,p=c.$to.pos;r.doc.nodesBetween(u,p,(d,h)=>{const m=Math.max(h,u),g=Math.min(h+d.nodeSize,p);d.marks.find(k=>k.type===l)?d.marks.forEach(k=>{l===k.type&&e.addMark(m,g,l.create(x(x({},k.attrs),t)))}):e.addMark(m,g,l.create(t))})});return!0}}),Gd=Object.freeze({__proto__:null,setMeta:(n,t)=>({tr:e})=>(e.setMeta(n,t),!0)}),Yd=Object.freeze({__proto__:null,setNode:(n,t={})=>({state:e,dispatch:r})=>{const o=ft(n,e.schema);return Rf(o,t)(e,r)}}),Xd=Object.freeze({__proto__:null,setNodeSelection:n=>({tr:t,dispatch:e})=>{if(e){const{doc:r}=t,o=z.atStart(r).from,i=z.atEnd(r).to,s=ln(n,o,i),a=P.create(r,s);t.setSelection(a)}return!0}}),Qd=Object.freeze({__proto__:null,setTextSelection:n=>({tr:t,dispatch:e})=>{if(e){const{doc:r}=t,{from:o,to:i}=typeof n=="number"?{from:n,to:n}:n,s=z.atStart(r).from,a=z.atEnd(r).to,l=ln(o,s,a),c=ln(i,s,a),u=K.create(r,l,c);t.setSelection(u)}return!0}}),Zd=Object.freeze({__proto__:null,sinkListItem:n=>({state:t,dispatch:e})=>{const r=ft(n,t.schema);return Ff(r)(t,e)}});function oo(n,t,e){return Object.fromEntries(Object.entries(e).filter(([r])=>{const o=n.find(i=>i.type===t&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}function th(n){for(let t=0;tt==null?void 0:t.includes(o.type.name));n.tr.ensureMarks(r)}}var eh=Object.freeze({__proto__:null,splitBlock:({keepMarks:n=!0}={})=>({tr:t,state:e,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:l}=i,c=o.extensionManager.attributes,u=oo(c,a.node().type.name,a.node().attrs);if(i instanceof P&&i.node.isBlock)return!a.parentOffset||!Oe(s,a.pos)?!1:(r&&(n&&ic(e,o.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(r){const p=l.parentOffset===l.parent.content.size;i instanceof K&&t.deleteSelection();const d=a.depth===0?void 0:th(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=p&&d?[{type:d,attrs:u}]:void 0,m=Oe(t.doc,t.mapping.map(a.pos),1,h);if(!h&&!m&&Oe(t.doc,t.mapping.map(a.pos),1,d?[{type:d}]:void 0)&&(m=!0,h=d?[{type:d,attrs:u}]:void 0),m&&(t.split(t.mapping.map(a.pos),1,h),d&&!p&&!a.parentOffset&&a.parent.type!==d)){const g=t.mapping.map(a.before()),y=t.doc.resolve(g);a.node(-1).canReplaceWith(y.index(),y.index()+1,d)&&t.setNodeMarkup(t.mapping.map(a.before()),d)}n&&ic(e,o.extensionManager.splittableMarks),t.scrollIntoView()}return!0}}),nh=Object.freeze({__proto__:null,splitListItem:n=>({tr:t,state:e,dispatch:r,editor:o})=>{var i;const s=ft(n,e.schema),{$from:a,$to:l}=e.selection,c=e.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const u=a.node(-1);if(u.type!==s)return!1;const p=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(r){let y=S.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let A=a.depth-k;A>=a.depth-3;A-=1)y=S.from(a.node(A).copy(y));const b=a.indexAfter(-1){if(C>-1)return!1;A.isTextblock&&A.content.size===0&&(C=I+1)}),C>-1&&t.setSelection(K.near(t.doc.resolve(C))),t.scrollIntoView()}return!0}const d=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,h=oo(p,u.type.name,u.attrs),m=oo(p,a.node().type.name,a.node().attrs);t.delete(a.pos,l.pos);const g=d?[{type:s,attrs:h},{type:d,attrs:m}]:[{type:s,attrs:h}];return Oe(t.doc,a.pos,2)?(r&&t.split(a.pos,2,g).scrollIntoView(),!0):!1}});function rh(n,t){for(let e=n.depth;e>0;e-=1){const r=n.node(e);if(t(r))return{pos:e>0?n.before(e):0,start:n.start(e),depth:e,node:r}}}function oh(n){return t=>rh(t.$from,n)}function io(n){const t=n.filter(o=>o.type==="extension"),e=n.filter(o=>o.type==="node"),r=n.filter(o=>o.type==="mark");return{baseExtensions:t,nodeExtensions:e,markExtensions:r}}function sc(n,t){const{nodeExtensions:e}=io(t),r=e.find(s=>s.name===n);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=L(_(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}var ih=Object.freeze({__proto__:null,toggleList:(n,t)=>({editor:e,tr:r,state:o,dispatch:i,chain:s,commands:a,can:l})=>{const{extensions:c}=e.extensionManager,u=ft(n,o.schema),p=ft(t,o.schema),{selection:d}=o,{$from:h,$to:m}=d,g=h.blockRange(m);if(!g)return!1;const y=oh(b=>sc(b.type.name,c))(d);if(g.depth>=1&&y&&g.depth-y.depth<=1){if(y.node.type===u)return a.liftListItem(p);if(sc(y.node.type.name,c)&&u.validContent(y.node.content)&&i)return r.setNodeMarkup(y.pos,u),!0}return l().wrapInList(u)?a.wrapInList(u):s().clearNodes().wrapInList(u).run()}});function Ui(n,t,e={}){const{empty:r,ranges:o}=n.selection,i=t?$e(t,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(p=>i?i.name===p.type.name:!0).find(p=>eo(p.attrs,e,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:p,$to:d})=>{const h=p.pos,m=d.pos;n.doc.nodesBetween(h,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const k=Math.max(h,y),b=Math.min(m,y+g.nodeSize);s+=b-k,a.push(...g.marks.map(v=>({mark:v,from:k,to:b})))})}),s===0)return!1;const l=a.filter(p=>i?i.name===p.mark.type.name:!0).filter(p=>eo(p.mark.attrs,e,{strict:!1})).reduce((p,d)=>p+d.to-d.from,0),c=a.filter(p=>i?p.mark.type!==i&&p.mark.type.excludes(i):!0).reduce((p,d)=>p+d.to-d.from,0);return(l>0?l+c:l)>=s}var sh=Object.freeze({__proto__:null,toggleMark:(n,t={},e={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=e,s=$e(n,r.schema);return Ui(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)}}),ah=Object.freeze({__proto__:null,toggleNode:(n,t,e={})=>({state:r,commands:o})=>{const i=ft(n,r.schema),s=ft(t,r.schema);return Tn(r,i,e)?o.setNode(s):o.setNode(i,e)}}),lh=Object.freeze({__proto__:null,toggleWrap:(n,t={})=>({state:e,dispatch:r})=>{const o=ft(n,e.schema);return Tn(e,o,t)?Da(e,r):za(o,t)(e,r)}}),ch=Object.freeze({__proto__:null,undoInputRule:()=>({state:n,dispatch:t})=>{const e=n.plugins;for(let r=0;r=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,n.schema.text(i.text,l))}else s.delete(i.from,i.to)}return!0}}return!1}}),uh=Object.freeze({__proto__:null,unsetAllMarks:()=>({tr:n,state:t,dispatch:e})=>{const{selection:r}=n,{empty:o,ranges:i}=r;return o||e&&Object.entries(t.schema.marks).forEach(([,s])=>{i.forEach(a=>{n.removeMark(a.$from.pos,a.$to.pos,s)})}),!0}}),fh=Object.freeze({__proto__:null,unsetMark:(n,t={})=>({tr:e,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:a}=e,l=$e(n,r.schema),{$from:c,empty:u,ranges:p}=a;if(!o)return!0;if(u&&s){let{from:d,to:h}=a;const m=(i=c.marks().find(y=>y.type===l))===null||i===void 0?void 0:i.attrs,g=Zl(c,l,m);g&&(d=g.from,h=g.to),e.removeMark(d,h,l)}else p.forEach(d=>{e.removeMark(d.$from.pos,d.$to.pos,l)});return e.removeStoredMark(l),!0}}),ph=Object.freeze({__proto__:null,updateAttributes:(n,t={})=>({tr:e,state:r,dispatch:o})=>{let i=null,s=null;const a=ro(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(i=ft(n,r.schema)),a==="mark"&&(s=$e(n,r.schema)),o&&e.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;r.doc.nodesBetween(c,u,(p,d)=>{i&&i===p.type&&e.setNodeMarkup(d,void 0,x(x({},p.attrs),t)),s&&p.marks.length&&p.marks.forEach(h=>{if(s===h.type){const m=Math.max(d,c),g=Math.min(d+p.nodeSize,u);e.addMark(m,g,s.create(x(x({},h.attrs),t)))}})})}),!0):!1}}),dh=Object.freeze({__proto__:null,wrapIn:(n,t={})=>({state:e,dispatch:r})=>{const o=ft(n,e.schema);return Tn(e,o,t)?!1:za(o,t)(e,r)}}),hh=Object.freeze({__proto__:null,wrapInList:(n,t={})=>({state:e,dispatch:r})=>{const o=ft(n,e.schema);return If(o,t)(e,r)}});const mh=yt.create({name:"commands",addCommands(){return x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x({},fd),pd),dd),hd),md),vd),gd),yd),bd),kd),Sd),xd),Od),Nd),Td),Ad),Dd),Rd),Bd),Pd),zd),Ld),Fd),Hd),Jd),$d),qd),jd),Wd),Kd),Ud),Gd),Yd),Xd),Qd),Zd),eh),nh),ih),sh),ah),lh),ch),uh),fh),ph),dh),hh)}}),vh=yt.create({name:"editable",addProseMirrorPlugins(){return[new Ht({key:new ae("editable"),props:{editable:()=>this.editor.options.editable}})]}}),gh=yt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Ht({key:new ae("focusEvents"),props:{handleDOMEvents:{focus:(t,e)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:e}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,e)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:e}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),yh=yt.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.joinForward(),()=>e.selectNodeForward()]);return{Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()}}}),bh=yt.create({name:"tabindex",addProseMirrorPlugins(){return[new Ht({key:new ae("tabindex"),props:{attributes:{tabindex:"0"}}})]}});var kh=Object.freeze({__proto__:null,ClipboardTextSerializer:ud,Commands:mh,Editable:vh,FocusEvents:gh,Keymap:yh,Tabindex:bh});function wh(n,t){const e=ft(t,n.schema),{from:r,to:o}=n.selection,i=[];n.doc.nodesBetween(r,o,a=>{i.push(a)});const s=i.reverse().find(a=>a.type.name===e.name);return s?x({},s.attrs):{}}function Sh(n,t){const e=ro(typeof t=="string"?t:t.name,n.schema);return e==="node"?wh(n,t):e==="mark"?oc(n,t):{}}function xh(n,t,e={}){if(!t)return Tn(n,null,e)||Ui(n,null,e);const r=ro(t,n.schema);return r==="node"?Tn(n,t,e):r==="mark"?Ui(n,t,e):!1}function Mh(n){(n==null?void 0:n.parentNode)&&n.parentNode.removeChild(n)}function Ch(n,t){const e=ht.fromSchema(t).serializeFragment(n),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(e),o.innerHTML}function Eh(n,t){const e={from:0,to:n.content.size};return Xl(n,e,t)}function Oh(n){var t;const e=(t=n.type.createAndFill())===null||t===void 0?void 0:t.toJSON(),r=n.toJSON();return JSON.stringify(e)===JSON.stringify(r)}function Nh(n){const t=document.querySelector("style[data-tiptap-style]");if(t!==null)return t;const e=document.createElement("style");return e.setAttribute("data-tiptap-style",""),e.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(e),e}function Gi(n){const{state:t,transaction:e}=n;let{selection:r}=e,{doc:o}=e,{storedMarks:i}=e;return Lt(x({},t),{schema:t.schema,plugins:t.plugins,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=e.selection,o=e.doc,i=e.storedMarks,e}})}class Yi{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:r}=this,{view:o}=e,{tr:i}=r,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...u)=>{const p=l(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(i),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:r,editor:o,state:i}=this,{view:s}=o,a=[],l=!!t,c=t||i.tr,u=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),a.every(d=>d===!0)),p=Lt(x({},Object.fromEntries(Object.entries(r).map(([d,h])=>[d,(...g)=>{const y=this.buildProps(c,e),k=h(...g)(y);return a.push(k),p}]))),{run:u});return p}createCan(t){const{rawCommands:e,state:r}=this,o=void 0,i=t||r.tr,s=this.buildProps(i,o),a=Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...u)=>c(...u)(Lt(x({},s),{dispatch:o}))]));return Lt(x({},a),{chain:()=>this.createChain(i,o)})}buildProps(t,e=!0){const{rawCommands:r,editor:o,state:i}=this,{view:s}=o;i.storedMarks&&t.setStoredMarks(i.storedMarks);const a={tr:t,editor:o,view:s,state:Gi({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}}class so{constructor(t){this.find=t.find,this.handler=t.handler}}const Th=(n,t)=>{if(ji(t))return t.exec(n);const e=t(n);if(!e)return null;const r=[];return r.push(e.text),r.index=e.index,r.input=n,r.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(e.replaceWith)),r};function Xi(n){var t;const{editor:e,from:r,to:o,text:i,rules:s,plugin:a}=n,{view:l}=e;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||!!((t=c.nodeBefore||c.nodeAfter)===null||t===void 0?void 0:t.marks.find(h=>h.type.spec.code)))return!1;let u=!1;const p=500,d=c.parent.textBetween(Math.max(0,c.parentOffset-p),c.parentOffset,void 0,"\uFFFC")+i;return s.forEach(h=>{if(u)return;const m=Th(d,h.find);if(!m)return;const g=l.state.tr,y=Gi({state:l.state,transaction:g}),k={from:r-(m[0].length-i.length),to:o},{commands:b,chain:N,can:v}=new Yi({editor:e,state:y});h.handler({state:y,range:k,match:m,commands:b,chain:N,can:v}),!!g.steps.length&&(g.setMeta(a,{transform:g,from:r,to:o,text:i}),l.dispatch(g),u=!0)}),u}function _h(n){const{editor:t,rules:e}=n,r=new Ht({state:{init(){return null},apply(o,i){const s=o.getMeta(this);return s||(o.selectionSet||o.docChanged?null:i)}},props:{handleTextInput(o,i,s,a){return Xi({editor:t,from:i,to:s,text:a,rules:e,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:i}=o.state.selection;i&&Xi({editor:t,from:i.pos,to:i.pos,text:"",rules:e,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;const{$cursor:s}=o.state.selection;return s?Xi({editor:t,from:s.pos,to:s.pos,text:` +`,rules:e,plugin:r}):!1}},isInputRules:!0});return r}function Ah(n){return typeof n=="number"}class Dh{constructor(t){this.find=t.find,this.handler=t.handler}}const Rh=(n,t)=>{if(ji(t))return[...n.matchAll(t)];const e=t(n);return e?e.map(r=>{const o=[];return o.push(r.text),o.index=r.index,o.input=n,o.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(r.replaceWith)),o}):[]};function Vh(n){const{editor:t,state:e,from:r,to:o,rules:i}=n,{commands:s,chain:a,can:l}=new Yi({editor:t,state:e});e.doc.nodesBetween(r,o,(c,u)=>{if(!c.isTextblock||c.type.spec.code)return;const p=Math.max(r,u),d=Math.min(o,u+c.content.size),h=c.textBetween(p-u,d-u,void 0,"\uFFFC");i.forEach(m=>{Rh(h,m.find).forEach(y=>{if(y.index===void 0)return;const k=p+y.index+1,b=k+y[0].length,N={from:e.tr.mapping.map(k),to:e.tr.mapping.map(b)};m.handler({state:e,range:N,match:y,commands:s,chain:a,can:l})})})})}function Ih(n){const{editor:t,rules:e}=n;let r=!1;const o=new Ht({props:{handlePaste:(i,s)=>{var a;const l=(a=s.clipboardData)===null||a===void 0?void 0:a.getData("text/html");return r=!!(l==null?void 0:l.includes("data-pm-slice")),!1}},appendTransaction:(i,s,a)=>{const l=i[0];if(!l.getMeta("paste")||r)return;const{doc:c,before:u}=l,p=u.content.findDiffStart(c.content),d=u.content.findDiffEnd(c.content);if(!Ah(p)||!d||p===d.b)return;const h=a.tr,m=Gi({state:a,transaction:h});if(Vh({editor:t,state:m,from:Math.max(p-1,0),to:d.b,rules:e,plugin:o}),!!h.steps.length)return h},isPasteRules:!0});return o}function ac(n){const t=[],{nodeExtensions:e,markExtensions:r}=io(n),o=[...e,...r],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0};return n.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},l=_(s,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(p=>{Object.entries(u.attributes).forEach(([d,h])=>{t.push({type:p,name:d,attribute:x(x({},i),h)})})})})}),o.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},l=_(s,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,p])=>{t.push({type:s.name,name:u,attribute:x(x({},i),p)})})}),t}function pt(...n){return n.filter(t=>!!t).reduce((t,e)=>{const r=x({},t);return Object.entries(e).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}o==="class"?r[o]=[r[o],i].join(" "):o==="style"?r[o]=[r[o],i].join("; "):r[o]=i}),r},{})}function Qi(n,t){return t.filter(e=>e.attribute.rendered).map(e=>e.attribute.renderHTML?e.attribute.renderHTML(n.attrs)||{}:{[e.name]:n.attrs[e.name]}).reduce((e,r)=>pt(e,r),{})}function Bh(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Ph(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function lc(n,t){return n.style?n:Lt(x({},n),{getAttrs:e=>{const r=n.getAttrs?n.getAttrs(e):n.attrs;if(r===!1)return!1;const o=t.filter(i=>i.attribute.rendered).reduce((i,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(e):Ph(e.getAttribute(s.name));return Ki(a)&&console.warn(`[tiptap warn]: BREAKING CHANGE: "parseHTML" for your attribute "${s.name}" returns an object but should return the value itself. If this is expected you can ignore this message. This warning will be removed in one of the next releases. Further information: https://github.com/ueberdosis/tiptap/issues/1863`),a==null?i:Lt(x({},i),{[s.name]:a})},{});return x(x({},r),o)}})}function cc(n){return Object.fromEntries(Object.entries(n).filter(([t,e])=>t==="attrs"&&Bh(e)?!1:e!=null))}function zh(n){var t;const e=ac(n),{nodeExtensions:r,markExtensions:o}=io(n),i=(t=r.find(l=>_(l,"topNode")))===null||t===void 0?void 0:t.name,s=Object.fromEntries(r.map(l=>{const c=e.filter(y=>y.type===l.name),u={name:l.name,options:l.options,storage:l.storage},p=n.reduce((y,k)=>{const b=_(k,"extendNodeSchema",u);return x(x({},y),b?b(l):{})},{}),d=cc(Lt(x({},p),{content:L(_(l,"content",u)),marks:L(_(l,"marks",u)),group:L(_(l,"group",u)),inline:L(_(l,"inline",u)),atom:L(_(l,"atom",u)),selectable:L(_(l,"selectable",u)),draggable:L(_(l,"draggable",u)),code:L(_(l,"code",u)),defining:L(_(l,"defining",u)),isolating:L(_(l,"isolating",u)),attrs:Object.fromEntries(c.map(y=>{var k;return[y.name,{default:(k=y==null?void 0:y.attribute)===null||k===void 0?void 0:k.default}]}))})),h=L(_(l,"parseHTML",u));h&&(d.parseDOM=h.map(y=>lc(y,c)));const m=_(l,"renderHTML",u);m&&(d.toDOM=y=>m({node:y,HTMLAttributes:Qi(y,c)}));const g=_(l,"renderText",u);return g&&(d.toText=g),[l.name,d]})),a=Object.fromEntries(o.map(l=>{const c=e.filter(g=>g.type===l.name),u={name:l.name,options:l.options,storage:l.storage},p=n.reduce((g,y)=>{const k=_(y,"extendMarkSchema",u);return x(x({},g),k?k(l):{})},{}),d=cc(Lt(x({},p),{inclusive:L(_(l,"inclusive",u)),excludes:L(_(l,"excludes",u)),group:L(_(l,"group",u)),spanning:L(_(l,"spanning",u)),code:L(_(l,"code",u)),attrs:Object.fromEntries(c.map(g=>{var y;return[g.name,{default:(y=g==null?void 0:g.attribute)===null||y===void 0?void 0:y.default}]}))})),h=L(_(l,"parseHTML",u));h&&(d.parseDOM=h.map(g=>lc(g,c)));const m=_(l,"renderHTML",u);return m&&(d.toDOM=g=>m({mark:g,HTMLAttributes:Qi(g,c)})),[l.name,d]}));return new en({topNode:i,nodes:s,marks:a})}function Zi(n,t){return t.nodes[n]||t.marks[n]||null}function Lh(n){const t=n.filter((e,r)=>n.indexOf(e)!==r);return[...new Set(t)]}class _n{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=_n.resolve(t),this.schema=zh(this.extensions),this.extensions.forEach(r=>{var o;this.editor.extensionStorage[r.name]=r.storage;const i={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:Zi(r.name,this.schema)};r.type==="mark"&&((o=L(_(r,"keepOnSplit",i)))!==null&&o!==void 0?o:!0)&&this.splittableMarks.push(r.name);const s=_(r,"onBeforeCreate",i);s&&this.editor.on("beforeCreate",s);const a=_(r,"onCreate",i);a&&this.editor.on("create",a);const l=_(r,"onUpdate",i);l&&this.editor.on("update",l);const c=_(r,"onSelectionUpdate",i);c&&this.editor.on("selectionUpdate",c);const u=_(r,"onTransaction",i);u&&this.editor.on("transaction",u);const p=_(r,"onFocus",i);p&&this.editor.on("focus",p);const d=_(r,"onBlur",i);d&&this.editor.on("blur",d);const h=_(r,"onDestroy",i);h&&this.editor.on("destroy",h)})}static resolve(t){const e=_n.sort(_n.flatten(t)),r=Lh(e.map(o=>o.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),e}static flatten(t){return t.map(e=>{const r={name:e.name,options:e.options,storage:e.storage},o=_(e,"addExtensions",r);return o?[e,...this.flatten(o())]:e}).flat(10)}static sort(t){const e=100;return t.sort((r,o)=>{const i=_(r,"priority")||e,s=_(o,"priority")||e;return i>s?-1:i{const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Zi(e.name,this.schema)},o=_(e,"addCommands",r);return o?x(x({},t),o()):t},{})}get plugins(){const{editor:t}=this,e=_n.sort([...this.extensions].reverse()),r=[],o=[],i=e.map(s=>{const a={name:s.name,options:s.options,storage:s.storage,editor:t,type:Zi(s.name,this.schema)},l=[],c=_(s,"addKeyboardShortcuts",a);if(c){const h=Object.fromEntries(Object.entries(c()).map(([g,y])=>[g,()=>y({editor:t})])),m=ld(h);l.push(m)}const u=_(s,"addInputRules",a);t.options.enableInputRules&&u&&r.push(...u());const p=_(s,"addPasteRules",a);t.options.enablePasteRules&&p&&o.push(...p());const d=_(s,"addProseMirrorPlugins",a);if(d){const h=d();l.push(...h)}return l}).flat();return[_h({editor:t,rules:r}),Ih({editor:t,rules:o}),...i]}get attributes(){return ac(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=io(this.extensions);return Object.fromEntries(e.filter(r=>!!_(r,"addNodeView")).map(r=>{const o=this.attributes.filter(l=>l.type===r.name),i={name:r.name,options:r.options,storage:r.storage,editor:t,type:ft(r.name,this.schema)},s=_(r,"addNodeView",i);if(!s)return[];const a=(l,c,u,p)=>{const d=Qi(l,o);return s()({editor:t,node:l,getPos:u,decorations:p,HTMLAttributes:d,extension:r})};return[r.name,a]}))}}class Fh{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const r=this.callbacks[t];return r&&r.forEach(o=>o.apply(this,e)),this}off(t,e){const r=this.callbacks[t];return r&&(e?this.callbacks[t]=r.filter(o=>o!==e):delete this.callbacks[t]),this}removeAllListeners(){this.callbacks={}}}const Hh=`.ProseMirror { position: relative; } @@ -83,11 +83,11 @@ img.ProseMirror-separator { .tippy-box[data-animation=fade][data-state=hidden] { opacity: 0 -}`;class $h extends Hh{constructor(t={}){super();this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(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 storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=Th(Jh))}setOptions(t={}){this.options=x(x({},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,e){const r=Yl(e)?e(t,this.state.plugins):[...this.state.plugins,t],o=this.state.reconfigure({plugins:r});this.view.updateState(o)}unregisterPlugin(t){if(this.isDestroyed)return;const e=typeof t=="string"?`${t}$`:t.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(o=>!o.key.startsWith(e))});this.view.updateState(r)}createExtensionManager(){const e=[...this.options.enableCoreExtensions?Object.values(wh):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r==null?void 0:r.type));this.extensionManager=new _n(e,this)}createCommandManager(){this.commandManager=new Yi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){this.view=new ct(this.options.element,Lt(x({},this.options.editorProps),{dispatchTransaction:this.dispatchTransaction.bind(this),state:Et.create({doc:rc(this.options.content,this.schema,this.options.parseOptions)})}));const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.createNodeViews();const e=this.view.dom;e.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}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 e=this.state.apply(t),r=!this.state.selection.eq(e.selection);this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),r&&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 xh(this.state,t)}isActive(t,e){const r=typeof t=="string"?t:null,o=typeof t=="string"?e:t;return Mh(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Eh(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` - -`,textSerializers:r={}}=t||{};return Oh(this.state.doc,{blockSeparator:e,textSerializers:x(x({},r),Ql(this.schema))})}get isEmpty(){return Nh(this.state.doc)}getCharacterCount(){return this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners(),Ch(this.css)}get isDestroyed(){var t;return!((t=this.view)===null||t===void 0?void 0:t.docView)}}class bt{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=x(x({},this.config),t),this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=L(_(this,"addOptions",{name:this.name}))),this.storage=L(_(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new bt(t)}configure(t={}){const e=this.extend();return e.options=to(this.options,t),e.storage=L(_(e,"addStorage",{name:e.name,options:e.options})),e}extend(t={}){const e=new bt(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=t.defaultOptions?t.defaultOptions:e.parent.options,t.addOptions&&(e.options=L(_(e,"addOptions",{name:e.name}))),e.storage=L(_(e,"addStorage",{name:e.name,options:e.options})),e}}class qe{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=x(x({},this.config),t),this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=L(_(this,"addOptions",{name:this.name}))),this.storage=L(_(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new qe(t)}configure(t={}){const e=this.extend();return e.options=to(this.options,t),e.storage=L(_(e,"addStorage",{name:e.name,options:e.options})),e}extend(t={}){const e=new qe(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=t.defaultOptions?t.defaultOptions:e.parent.options,t.addOptions&&(e.options=L(_(e,"addOptions",{name:e.name}))),e.storage=L(_(e,"addStorage",{name:e.name,options:e.options})),e}}function uc(n){return new so({find:n.find,handler:({state:t,range:e,match:r})=>{const o=L(n.getAttributes,void 0,r)||{},{tr:i}=t,s=e.from;let a=e.to;if(r[1]){const l=r[0].lastIndexOf(r[1]);let c=s+l;c>a?c=a:a=c+r[1].length;const u=r[0][r[0].length-1];i.insertText(u,s+r[0].length-1),i.replaceWith(c,a,n.type.create(o))}else r[0]&&i.replaceWith(s,a,n.type.create(o))}})}function fc(n,t,e){const r=[];return e.doc.nodesBetween(n,t,(o,i)=>{r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}function An(n){return new so({find:n.find,handler:({state:t,range:e,match:r})=>{const o=L(n.getAttributes,void 0,r);if(o===!1||o===null)return;const{tr:i}=t,s=r[r.length-1],a=r[0];let l=e.to;if(s){const c=a.search(/\S/),u=e.from+a.indexOf(s),p=u+s.length;if(fc(e.from,e.to,t).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>u).length)return null;pe.from&&i.delete(e.from+c,u),l=e.from+c+s.length,i.addMark(e.from+c,l,n.type.create(o||{})),i.removeStoredMark(n.type)}}})}function ts(n){return new so({find:n.find,handler:({state:t,range:e,match:r})=>{const o=t.doc.resolve(e.from),i=L(n.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),n.type))return null;t.tr.delete(e.from,e.to).setBlockType(e.from,e.from,n.type,i)}})}function ao(n){return new so({find:n.find,handler:({state:t,range:e,match:r})=>{const o=L(n.getAttributes,void 0,r)||{},i=t.tr.delete(e.from,e.to),a=i.doc.resolve(e.from).blockRange(),l=a&&Xo(a,n.type,o);if(!l)return null;i.wrap(a,l);const c=i.doc.resolve(e.from-1).nodeBefore;c&&c.type===n.type&&Qo(i.doc,e.from-1)&&(!n.joinPredicate||n.joinPredicate(r,c))&&i.join(e.from-1)}})}function Dn(n){return new Rh({find:n.find,handler:({state:t,range:e,match:r})=>{const o=L(n.getAttributes,void 0,r);if(o===!1||o===null)return;const{tr:i}=t,s=r[r.length-1],a=r[0];let l=e.to;if(s){const c=a.search(/\S/),u=e.from+a.indexOf(s),p=u+s.length;if(fc(e.from,e.to,t).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>u).length)return null;pe.from&&i.delete(e.from+c,u),l=e.from+c+s.length,i.addMark(e.from+c,l,n.type.create(o||{})),i.removeStoredMark(n.type)}}})}function qh(n){return Ki(n)&&n instanceof P}function pc(n,t,e){const r=0,o=n.state.doc.content.size,i=ln(t,r,o),s=ln(e,r,o),a=n.coordsAtPos(i),l=n.coordsAtPos(s,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),p=Math.min(a.left,l.left),d=Math.max(a.right,l.right),h=d-p,m=u-c,k={top:c,bottom:u,left:p,right:d,width:h,height:m,x:p,y:c};return Lt(x({},k),{toJSON:()=>k})}var Wt="top",ee="bottom",ne="right",Kt="left",es="auto",cr=[Wt,ee,ne,Kt],Rn="start",ur="end",jh="clippingParents",dc="viewport",fr="popper",Wh="reference",hc=cr.reduce(function(n,t){return n.concat([t+"-"+Rn,t+"-"+ur])},[]),mc=[].concat(cr,[es]).reduce(function(n,t){return n.concat([t,t+"-"+Rn,t+"-"+ur])},[]),Kh="beforeRead",Uh="read",Gh="afterRead",Yh="beforeMain",Xh="main",Qh="afterMain",Zh="beforeWrite",tm="write",em="afterWrite",nm=[Kh,Uh,Gh,Yh,Xh,Qh,Zh,tm,em];function ge(n){return n?(n.nodeName||"").toLowerCase():null}function ue(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var t=n.ownerDocument;return t&&t.defaultView||window}return n}function pr(n){var t=ue(n).Element;return n instanceof t||n instanceof Element}function re(n){var t=ue(n).HTMLElement;return n instanceof t||n instanceof HTMLElement}function vc(n){if(typeof ShadowRoot=="undefined")return!1;var t=ue(n).ShadowRoot;return n instanceof t||n instanceof ShadowRoot}function rm(n){var t=n.state;Object.keys(t.elements).forEach(function(e){var r=t.styles[e]||{},o=t.attributes[e]||{},i=t.elements[e];!re(i)||!ge(i)||(Object.assign(i.style,r),Object.keys(o).forEach(function(s){var a=o[s];a===!1?i.removeAttribute(s):i.setAttribute(s,a===!0?"":a)}))})}function om(n){var t=n.state,e={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,e.popper),t.styles=e,t.elements.arrow&&Object.assign(t.elements.arrow.style,e.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],i=t.attributes[r]||{},s=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:e[r]),a=s.reduce(function(l,c){return l[c]="",l},{});!re(o)||!ge(o)||(Object.assign(o.style,a),Object.keys(i).forEach(function(l){o.removeAttribute(l)}))})}}var gc={name:"applyStyles",enabled:!0,phase:"write",fn:rm,effect:om,requires:["computeStyles"]};function ye(n){return n.split("-")[0]}function Vn(n,t){var e=n.getBoundingClientRect(),r=1,o=1;return{width:e.width/r,height:e.height/o,top:e.top/o,right:e.right/r,bottom:e.bottom/o,left:e.left/r,x:e.left/r,y:e.top/o}}function ns(n){var t=Vn(n),e=n.offsetWidth,r=n.offsetHeight;return Math.abs(t.width-e)<=1&&(e=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:n.offsetLeft,y:n.offsetTop,width:e,height:r}}function yc(n,t){var e=t.getRootNode&&t.getRootNode();if(n.contains(t))return!0;if(e&&vc(e)){var r=t;do{if(r&&n.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function _e(n){return ue(n).getComputedStyle(n)}function im(n){return["table","td","th"].indexOf(ge(n))>=0}function je(n){return((pr(n)?n.ownerDocument:n.document)||window.document).documentElement}function lo(n){return ge(n)==="html"?n:n.assignedSlot||n.parentNode||(vc(n)?n.host:null)||je(n)}function bc(n){return!re(n)||_e(n).position==="fixed"?null:n.offsetParent}function sm(n){var t=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,e=navigator.userAgent.indexOf("Trident")!==-1;if(e&&re(n)){var r=_e(n);if(r.position==="fixed")return null}for(var o=lo(n);re(o)&&["html","body"].indexOf(ge(o))<0;){var i=_e(o);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||t&&i.willChange==="filter"||t&&i.filter&&i.filter!=="none")return o;o=o.parentNode}return null}function dr(n){for(var t=ue(n),e=bc(n);e&&im(e)&&_e(e).position==="static";)e=bc(e);return e&&(ge(e)==="html"||ge(e)==="body"&&_e(e).position==="static")?t:e||sm(n)||t}function rs(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}var We=Math.max,hr=Math.min,co=Math.round;function uo(n,t,e){return We(n,hr(t,e))}function kc(){return{top:0,right:0,bottom:0,left:0}}function wc(n){return Object.assign({},kc(),n)}function Sc(n,t){return t.reduce(function(e,r){return e[r]=n,e},{})}var am=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,wc(typeof t!="number"?t:Sc(t,cr))};function lm(n){var t,e=n.state,r=n.name,o=n.options,i=e.elements.arrow,s=e.modifiersData.popperOffsets,a=ye(e.placement),l=rs(a),c=[Kt,ne].indexOf(a)>=0,u=c?"height":"width";if(!(!i||!s)){var p=am(o.padding,e),d=ns(i),h=l==="y"?Wt:Kt,m=l==="y"?ee:ne,g=e.rects.reference[u]+e.rects.reference[l]-s[l]-e.rects.popper[u],y=s[l]-e.rects.reference[l],k=dr(i),b=k?l==="y"?k.clientHeight||0:k.clientWidth||0:0,N=g/2-y/2,v=p[h],O=b-d[u]-p[m],C=b/2-d[u]/2+N,A=uo(v,C,O),I=l;e.modifiersData[r]=(t={},t[I]=A,t.centerOffset=A-C,t)}}function cm(n){var t=n.state,e=n.options,r=e.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||!yc(t.elements.popper,o)||(t.elements.arrow=o))}var um={name:"arrow",enabled:!0,phase:"main",fn:lm,effect:cm,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function In(n){return n.split("-")[1]}var fm={top:"auto",right:"auto",bottom:"auto",left:"auto"};function pm(n){var t=n.x,e=n.y,r=window,o=r.devicePixelRatio||1;return{x:co(co(t*o)/o)||0,y:co(co(e*o)/o)||0}}function xc(n){var t,e=n.popper,r=n.popperRect,o=n.placement,i=n.variation,s=n.offsets,a=n.position,l=n.gpuAcceleration,c=n.adaptive,u=n.roundOffsets,p=u===!0?pm(s):typeof u=="function"?u(s):s,d=p.x,h=d===void 0?0:d,m=p.y,g=m===void 0?0:m,y=s.hasOwnProperty("x"),k=s.hasOwnProperty("y"),b=Kt,N=Wt,v=window;if(c){var O=dr(e),C="clientHeight",A="clientWidth";O===ue(e)&&(O=je(e),_e(O).position!=="static"&&a==="absolute"&&(C="scrollHeight",A="scrollWidth")),O=O,(o===Wt||(o===Kt||o===ne)&&i===ur)&&(N=ee,g-=O[C]-r.height,g*=l?1:-1),(o===Kt||(o===Wt||o===ee)&&i===ur)&&(b=ne,h-=O[A]-r.width,h*=l?1:-1)}var I=Object.assign({position:a},c&&fm);if(l){var V;return Object.assign({},I,(V={},V[N]=k?"0":"",V[b]=y?"0":"",V.transform=(v.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",V))}return Object.assign({},I,(t={},t[N]=k?g+"px":"",t[b]=y?h+"px":"",t.transform="",t))}function dm(n){var t=n.state,e=n.options,r=e.gpuAcceleration,o=r===void 0?!0:r,i=e.adaptive,s=i===void 0?!0:i,a=e.roundOffsets,l=a===void 0?!0:a,c={placement:ye(t.placement),variation:In(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,xc(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,xc(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var hm={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:dm,data:{}},fo={passive:!0};function mm(n){var t=n.state,e=n.instance,r=n.options,o=r.scroll,i=o===void 0?!0:o,s=r.resize,a=s===void 0?!0:s,l=ue(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&c.forEach(function(u){u.addEventListener("scroll",e.update,fo)}),a&&l.addEventListener("resize",e.update,fo),function(){i&&c.forEach(function(u){u.removeEventListener("scroll",e.update,fo)}),a&&l.removeEventListener("resize",e.update,fo)}}var vm={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:mm,data:{}},gm={left:"right",right:"left",bottom:"top",top:"bottom"};function po(n){return n.replace(/left|right|bottom|top/g,function(t){return gm[t]})}var ym={start:"end",end:"start"};function Mc(n){return n.replace(/start|end/g,function(t){return ym[t]})}function is(n){var t=ue(n),e=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:e,scrollTop:r}}function ss(n){return Vn(je(n)).left+is(n).scrollLeft}function bm(n){var t=ue(n),e=je(n),r=t.visualViewport,o=e.clientWidth,i=e.clientHeight,s=0,a=0;return r&&(o=r.width,i=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(s=r.offsetLeft,a=r.offsetTop)),{width:o,height:i,x:s+ss(n),y:a}}function km(n){var t,e=je(n),r=is(n),o=(t=n.ownerDocument)==null?void 0:t.body,i=We(e.scrollWidth,e.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=We(e.scrollHeight,e.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+ss(n),l=-r.scrollTop;return _e(o||e).direction==="rtl"&&(a+=We(e.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:a,y:l}}function as(n){var t=_e(n),e=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(e+o+r)}function Cc(n){return["html","body","#document"].indexOf(ge(n))>=0?n.ownerDocument.body:re(n)&&as(n)?n:Cc(lo(n))}function mr(n,t){var e;t===void 0&&(t=[]);var r=Cc(n),o=r===((e=n.ownerDocument)==null?void 0:e.body),i=ue(r),s=o?[i].concat(i.visualViewport||[],as(r)?r:[]):r,a=t.concat(s);return o?a:a.concat(mr(lo(s)))}function ls(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function wm(n){var t=Vn(n);return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function Ec(n,t){return t===dc?ls(bm(n)):re(t)?wm(t):ls(km(je(n)))}function Sm(n){var t=mr(lo(n)),e=["absolute","fixed"].indexOf(_e(n).position)>=0,r=e&&re(n)?dr(n):n;return pr(r)?t.filter(function(o){return pr(o)&&yc(o,r)&&ge(o)!=="body"}):[]}function xm(n,t,e){var r=t==="clippingParents"?Sm(n):[].concat(t),o=[].concat(r,[e]),i=o[0],s=o.reduce(function(a,l){var c=Ec(n,l);return a.top=We(c.top,a.top),a.right=hr(c.right,a.right),a.bottom=hr(c.bottom,a.bottom),a.left=We(c.left,a.left),a},Ec(n,i));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function Oc(n){var t=n.reference,e=n.element,r=n.placement,o=r?ye(r):null,i=r?In(r):null,s=t.x+t.width/2-e.width/2,a=t.y+t.height/2-e.height/2,l;switch(o){case Wt:l={x:s,y:t.y-e.height};break;case ee:l={x:s,y:t.y+t.height};break;case ne:l={x:t.x+t.width,y:a};break;case Kt:l={x:t.x-e.width,y:a};break;default:l={x:t.x,y:t.y}}var c=o?rs(o):null;if(c!=null){var u=c==="y"?"height":"width";switch(i){case Rn:l[c]=l[c]-(t[u]/2-e[u]/2);break;case ur:l[c]=l[c]+(t[u]/2-e[u]/2);break}}return l}function vr(n,t){t===void 0&&(t={});var e=t,r=e.placement,o=r===void 0?n.placement:r,i=e.boundary,s=i===void 0?jh:i,a=e.rootBoundary,l=a===void 0?dc:a,c=e.elementContext,u=c===void 0?fr:c,p=e.altBoundary,d=p===void 0?!1:p,h=e.padding,m=h===void 0?0:h,g=wc(typeof m!="number"?m:Sc(m,cr)),y=u===fr?Wh:fr,k=n.rects.popper,b=n.elements[d?y:u],N=xm(pr(b)?b:b.contextElement||je(n.elements.popper),s,l),v=Vn(n.elements.reference),O=Oc({reference:v,element:k,strategy:"absolute",placement:o}),C=ls(Object.assign({},k,O)),A=u===fr?C:v,I={top:N.top-A.top+g.top,bottom:A.bottom-N.bottom+g.bottom,left:N.left-A.left+g.left,right:A.right-N.right+g.right},V=n.modifiersData.offset;if(u===fr&&V){var F=V[o];Object.keys(I).forEach(function(st){var et=[ne,ee].indexOf(st)>=0?1:-1,U=[Wt,ee].indexOf(st)>=0?"y":"x";I[st]+=F[U]*et})}return I}function Mm(n,t){t===void 0&&(t={});var e=t,r=e.placement,o=e.boundary,i=e.rootBoundary,s=e.padding,a=e.flipVariations,l=e.allowedAutoPlacements,c=l===void 0?mc:l,u=In(r),p=u?a?hc:hc.filter(function(m){return In(m)===u}):cr,d=p.filter(function(m){return c.indexOf(m)>=0});d.length===0&&(d=p);var h=d.reduce(function(m,g){return m[g]=vr(n,{placement:g,boundary:o,rootBoundary:i,padding:s})[ye(g)],m},{});return Object.keys(h).sort(function(m,g){return h[m]-h[g]})}function Cm(n){if(ye(n)===es)return[];var t=po(n);return[Mc(n),t,Mc(t)]}function Em(n){var t=n.state,e=n.options,r=n.name;if(!t.modifiersData[r]._skip){for(var o=e.mainAxis,i=o===void 0?!0:o,s=e.altAxis,a=s===void 0?!0:s,l=e.fallbackPlacements,c=e.padding,u=e.boundary,p=e.rootBoundary,d=e.altBoundary,h=e.flipVariations,m=h===void 0?!0:h,g=e.allowedAutoPlacements,y=t.options.placement,k=ye(y),b=k===y,N=l||(b||!m?[po(y)]:Cm(y)),v=[y].concat(N).reduce(function(Me,Yt){return Me.concat(ye(Yt)===es?Mm(t,{placement:Yt,boundary:u,rootBoundary:p,padding:c,flipVariations:m,allowedAutoPlacements:g}):Yt)},[]),O=t.rects.reference,C=t.rects.popper,A=new Map,I=!0,V=v[0],F=0;F=0,Z=Nt?"width":"height",X=vr(t,{placement:st,boundary:u,rootBoundary:p,altBoundary:d,padding:c}),Tt=Nt?U?ne:Kt:U?ee:Wt;O[Z]>C[Z]&&(Tt=po(Tt));var _t=po(Tt),De=[];if(i&&De.push(X[et]<=0),a&&De.push(X[Tt]<=0,X[_t]<=0),De.every(function(Me){return Me})){V=st,I=!1;break}A.set(st,De)}if(I)for(var xe=m?3:1,hn=function(Yt){var Xe=v.find(function(Tr){var Qe=A.get(Tr);if(Qe)return Qe.slice(0,Yt).every(function($n){return $n})});if(Xe)return V=Xe,"break"},de=xe;de>0;de--){var mn=hn(de);if(mn==="break")break}t.placement!==V&&(t.modifiersData[r]._skip=!0,t.placement=V,t.reset=!0)}}var Om={name:"flip",enabled:!0,phase:"main",fn:Em,requiresIfExists:["offset"],data:{_skip:!1}};function Nc(n,t,e){return e===void 0&&(e={x:0,y:0}),{top:n.top-t.height-e.y,right:n.right-t.width+e.x,bottom:n.bottom-t.height+e.y,left:n.left-t.width-e.x}}function Tc(n){return[Wt,ne,ee,Kt].some(function(t){return n[t]>=0})}function Nm(n){var t=n.state,e=n.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,s=vr(t,{elementContext:"reference"}),a=vr(t,{altBoundary:!0}),l=Nc(s,r),c=Nc(a,o,i),u=Tc(l),p=Tc(c);t.modifiersData[e]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:p},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":p})}var Tm={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Nm};function _m(n,t,e){var r=ye(n),o=[Kt,Wt].indexOf(r)>=0?-1:1,i=typeof e=="function"?e(Object.assign({},t,{placement:n})):e,s=i[0],a=i[1];return s=s||0,a=(a||0)*o,[Kt,ne].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function Am(n){var t=n.state,e=n.options,r=n.name,o=e.offset,i=o===void 0?[0,0]:o,s=mc.reduce(function(u,p){return u[p]=_m(p,t.rects,i),u},{}),a=s[t.placement],l=a.x,c=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=s}var Dm={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Am};function Rm(n){var t=n.state,e=n.name;t.modifiersData[e]=Oc({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}var Vm={name:"popperOffsets",enabled:!0,phase:"read",fn:Rm,data:{}};function Im(n){return n==="x"?"y":"x"}function Bm(n){var t=n.state,e=n.options,r=n.name,o=e.mainAxis,i=o===void 0?!0:o,s=e.altAxis,a=s===void 0?!1:s,l=e.boundary,c=e.rootBoundary,u=e.altBoundary,p=e.padding,d=e.tether,h=d===void 0?!0:d,m=e.tetherOffset,g=m===void 0?0:m,y=vr(t,{boundary:l,rootBoundary:c,padding:p,altBoundary:u}),k=ye(t.placement),b=In(t.placement),N=!b,v=rs(k),O=Im(v),C=t.modifiersData.popperOffsets,A=t.rects.reference,I=t.rects.popper,V=typeof g=="function"?g(Object.assign({},t.rects,{placement:t.placement})):g,F={x:0,y:0};if(!!C){if(i||a){var st=v==="y"?Wt:Kt,et=v==="y"?ee:ne,U=v==="y"?"height":"width",Nt=C[v],Z=C[v]+y[st],X=C[v]-y[et],Tt=h?-I[U]/2:0,_t=b===Rn?A[U]:I[U],De=b===Rn?-I[U]:-A[U],xe=t.elements.arrow,hn=h&&xe?ns(xe):{width:0,height:0},de=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:kc(),mn=de[st],Me=de[et],Yt=uo(0,A[U],hn[U]),Xe=N?A[U]/2-Tt-Yt-mn-V:_t-Yt-mn-V,Tr=N?-A[U]/2+Tt+Yt+Me+V:De+Yt+Me+V,Qe=t.elements.arrow&&dr(t.elements.arrow),$n=Qe?v==="y"?Qe.clientTop||0:Qe.clientLeft||0:0,Re=t.modifiersData.offset?t.modifiersData.offset[t.placement][v]:0,_r=C[v]+Xe-Re-$n,Ar=C[v]+Tr-Re;if(i){var Dr=uo(h?hr(Z,_r):Z,Nt,h?We(X,Ar):X);C[v]=Dr,F[v]=Dr-Nt}if(a){var Do=v==="x"?Wt:Kt,Ro=v==="x"?ee:ne,vn=C[O],Rr=vn+y[Do],Vr=vn-y[Ro],Ir=uo(h?hr(Rr,_r):Rr,vn,h?We(Vr,Ar):Vr);C[O]=Ir,F[O]=Ir-vn}}t.modifiersData[r]=F}}var Pm={name:"preventOverflow",enabled:!0,phase:"main",fn:Bm,requiresIfExists:["offset"]};function zm(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function Lm(n){return n===ue(n)||!re(n)?is(n):zm(n)}function Fm(n){var t=n.getBoundingClientRect(),e=t.width/n.offsetWidth||1,r=t.height/n.offsetHeight||1;return e!==1||r!==1}function Hm(n,t,e){e===void 0&&(e=!1);var r=re(t);re(t)&&Fm(t);var o=je(t),i=Vn(n),s={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(r||!r&&!e)&&((ge(t)!=="body"||as(o))&&(s=Lm(t)),re(t)?(a=Vn(t),a.x+=t.clientLeft,a.y+=t.clientTop):o&&(a.x=ss(o))),{x:i.left+s.scrollLeft-a.x,y:i.top+s.scrollTop-a.y,width:i.width,height:i.height}}function Jm(n){var t=new Map,e=new Set,r=[];n.forEach(function(i){t.set(i.name,i)});function o(i){e.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(a){if(!e.has(a)){var l=t.get(a);l&&o(l)}}),r.push(i)}return n.forEach(function(i){e.has(i.name)||o(i)}),r}function $m(n){var t=Jm(n);return nm.reduce(function(e,r){return e.concat(t.filter(function(o){return o.phase===r}))},[])}function qm(n){var t;return function(){return t||(t=new Promise(function(e){Promise.resolve().then(function(){t=void 0,e(n())})})),t}}function jm(n){var t=n.reduce(function(e,r){var o=e[r.name];return e[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,e},{});return Object.keys(t).map(function(e){return t[e]})}var _c={placement:"bottom",modifiers:[],strategy:"absolute"};function Ac(){for(var n=arguments.length,t=new Array(n),e=0;e-1}function Bc(n,t){return typeof n=="function"?n.apply(void 0,t):n}function Pc(n,t){if(t===0)return n;var e;return function(r){clearTimeout(e),e=setTimeout(function(){n(r)},t)}}function Xm(n){return n.split(/\s+/).filter(Boolean)}function Bn(n){return[].concat(n)}function zc(n,t){n.indexOf(t)===-1&&n.push(t)}function Qm(n){return n.filter(function(t,e){return n.indexOf(t)===e})}function Zm(n){return n.split("-")[0]}function ho(n){return[].slice.call(n)}function Lc(n){return Object.keys(n).reduce(function(t,e){return n[e]!==void 0&&(t[e]=n[e]),t},{})}function gr(){return document.createElement("div")}function mo(n){return["Element","Fragment"].some(function(t){return us(n,t)})}function tv(n){return us(n,"NodeList")}function ev(n){return us(n,"MouseEvent")}function nv(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function rv(n){return mo(n)?[n]:tv(n)?ho(n):Array.isArray(n)?n:ho(document.querySelectorAll(n))}function fs(n,t){n.forEach(function(e){e&&(e.style.transitionDuration=t+"ms")})}function Fc(n,t){n.forEach(function(e){e&&e.setAttribute("data-state",t)})}function ov(n){var t,e=Bn(n),r=e[0];return r!=null&&(t=r.ownerDocument)!=null&&t.body?r.ownerDocument:document}function iv(n,t){var e=t.clientX,r=t.clientY;return n.every(function(o){var i=o.popperRect,s=o.popperState,a=o.props,l=a.interactiveBorder,c=Zm(s.placement),u=s.modifiersData.offset;if(!u)return!0;var p=c==="bottom"?u.top.y:0,d=c==="top"?u.bottom.y:0,h=c==="right"?u.left.x:0,m=c==="left"?u.right.x:0,g=i.top-r+p>l,y=r-i.bottom-d>l,k=i.left-e+h>l,b=e-i.right-m>l;return g||y||k||b})}function ps(n,t,e){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(o){n[r](o,e)})}function sv(n,t){for(var e=t;e;){var r;if(n.contains(e))return!0;e=e.getRootNode==null||(r=e.getRootNode())==null?void 0:r.host}return!1}var be={isTouch:!1},Hc=0;function av(){be.isTouch||(be.isTouch=!0,window.performance&&document.addEventListener("mousemove",Jc))}function Jc(){var n=performance.now();n-Hc<20&&(be.isTouch=!1,document.removeEventListener("mousemove",Jc)),Hc=n}function lv(){var n=document.activeElement;if(nv(n)){var t=n._tippy;n.blur&&!t.state.isVisible&&n.blur()}}function cv(){document.addEventListener("touchstart",av,cn),window.addEventListener("blur",lv)}var uv=typeof window!="undefined"&&typeof document!="undefined",fv=uv?!!window.msCrypto:!1,pv={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},dv={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},fe=Object.assign({appendTo:Ic,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},pv,dv),hv=Object.keys(fe),mv=function(t){var e=Object.keys(t);e.forEach(function(r){fe[r]=t[r]})};function $c(n){var t=n.plugins||[],e=t.reduce(function(r,o){var i=o.name,s=o.defaultValue;if(i){var a;r[i]=n[i]!==void 0?n[i]:(a=fe[i])!=null?a:s}return r},{});return Object.assign({},n,e)}function vv(n,t){var e=t?Object.keys($c(Object.assign({},fe,{plugins:t}))):hv,r=e.reduce(function(o,i){var s=(n.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 r}function qc(n,t){var e=Object.assign({},t,{content:Bc(t.content,[n])},t.ignoreAttributes?{}:vv(n,t.plugins));return e.aria=Object.assign({},fe.aria,e.aria),e.aria={expanded:e.aria.expanded==="auto"?t.interactive:e.aria.expanded,content:e.aria.content==="auto"?t.interactive?null:"describedby":e.aria.content},e}var gv=function(){return"innerHTML"};function ds(n,t){n[gv()]=t}function jc(n){var t=gr();return n===!0?t.className=Rc:(t.className=Vc,mo(n)?t.appendChild(n):ds(t,n)),t}function Wc(n,t){mo(t.content)?(ds(n,""),n.appendChild(t.content)):typeof t.content!="function"&&(t.allowHTML?ds(n,t.content):n.textContent=t.content)}function hs(n){var t=n.firstElementChild,e=ho(t.children);return{box:t,content:e.find(function(r){return r.classList.contains(Dc)}),arrow:e.find(function(r){return r.classList.contains(Rc)||r.classList.contains(Vc)}),backdrop:e.find(function(r){return r.classList.contains(Ym)})}}function Kc(n){var t=gr(),e=gr();e.className=Gm,e.setAttribute("data-state","hidden"),e.setAttribute("tabindex","-1");var r=gr();r.className=Dc,r.setAttribute("data-state","hidden"),Wc(r,n.props),t.appendChild(e),e.appendChild(r),o(n.props,n.props);function o(i,s){var a=hs(t),l=a.box,c=a.content,u=a.arrow;s.theme?l.setAttribute("data-theme",s.theme):l.removeAttribute("data-theme"),typeof s.animation=="string"?l.setAttribute("data-animation",s.animation):l.removeAttribute("data-animation"),s.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?l.setAttribute("role",s.role):l.removeAttribute("role"),(i.content!==s.content||i.allowHTML!==s.allowHTML)&&Wc(c,n.props),s.arrow?u?i.arrow!==s.arrow&&(l.removeChild(u),l.appendChild(jc(s.arrow))):l.appendChild(jc(s.arrow)):u&&l.removeChild(u)}return{popper:t,onUpdate:o}}Kc.$$tippy=!0;var yv=1,vo=[],ms=[];function bv(n,t){var e=qc(n,Object.assign({},fe,$c(Lc(t)))),r,o,i,s=!1,a=!1,l=!1,c=!1,u,p,d,h=[],m=Pc(Do,e.interactiveDebounce),g,y=yv++,k=null,b=Qm(e.plugins),N={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:y,reference:n,popper:gr(),popperInstance:k,props:e,state:N,plugins:b,clearDelayTimeouts:e1,setProps:n1,setContent:r1,show:o1,hide:i1,hideWithInteractivity:s1,enable:Zb,disable:t1,unmount:a1,destroy:l1};if(!e.render)return v;var O=e.render(v),C=O.popper,A=O.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+v.id,v.popper=C,n._tippy=v,C._tippy=v;var I=b.map(function(w){return w.fn(v)}),V=n.hasAttribute("aria-expanded");return _r(),xe(),Tt(),_t("onCreate",[v]),e.showOnCreate&&qu(),C.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),C.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&Nt().addEventListener("mousemove",m)}),v;function F(){var w=v.props.touch;return Array.isArray(w)?w:[w,0]}function st(){return F()[0]==="hold"}function et(){var w;return!!((w=v.props.render)!=null&&w.$$tippy)}function U(){return g||n}function Nt(){var w=U().parentNode;return w?ov(w):document}function Z(){return hs(C)}function X(w){return v.state.isMounted&&!v.state.isVisible||be.isTouch||u&&u.type==="focus"?0:cs(v.props.delay,w?0:1,fe.delay)}function Tt(){C.style.pointerEvents=v.props.interactive&&v.state.isVisible?"":"none",C.style.zIndex=""+v.props.zIndex}function _t(w,D,B){if(B===void 0&&(B=!0),I.forEach(function(W){W[w]&&W[w].apply(W,D)}),B){var G;(G=v.props)[w].apply(G,D)}}function De(){var w=v.props.aria;if(!!w.content){var D="aria-"+w.content,B=C.id,G=Bn(v.props.triggerTarget||n);G.forEach(function(W){var zt=W.getAttribute(D);if(v.state.isVisible)W.setAttribute(D,zt?zt+" "+B:B);else{var ie=zt&&zt.replace(B,"").trim();ie?W.setAttribute(D,ie):W.removeAttribute(D)}})}}function xe(){if(!(V||!v.props.aria.expanded)){var w=Bn(v.props.triggerTarget||n);w.forEach(function(D){v.props.interactive?D.setAttribute("aria-expanded",v.state.isVisible&&D===U()?"true":"false"):D.removeAttribute("aria-expanded")})}}function hn(){Nt().removeEventListener("mousemove",m),vo=vo.filter(function(w){return w!==m})}function de(w){if(!(be.isTouch&&(l||w.type==="mousedown"))){var D=w.composedPath&&w.composedPath()[0]||w.target;if(!(v.props.interactive&&sv(C,D))){if(Bn(v.props.triggerTarget||n).indexOf(D)!==-1){if(be.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else _t("onClickOutside",[v,w]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),a=!0,setTimeout(function(){a=!1}),v.state.isMounted||Xe())}}}function mn(){l=!0}function Me(){l=!1}function Yt(){var w=Nt();w.addEventListener("mousedown",de,!0),w.addEventListener("touchend",de,cn),w.addEventListener("touchstart",Me,cn),w.addEventListener("touchmove",mn,cn)}function Xe(){var w=Nt();w.removeEventListener("mousedown",de,!0),w.removeEventListener("touchend",de,cn),w.removeEventListener("touchstart",Me,cn),w.removeEventListener("touchmove",mn,cn)}function Tr(w,D){$n(w,function(){!v.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&D()})}function Qe(w,D){$n(w,D)}function $n(w,D){var B=Z().box;function G(W){W.target===B&&(ps(B,"remove",G),D())}if(w===0)return D();ps(B,"remove",p),ps(B,"add",G),p=G}function Re(w,D,B){B===void 0&&(B=!1);var G=Bn(v.props.triggerTarget||n);G.forEach(function(W){W.addEventListener(w,D,B),h.push({node:W,eventType:w,handler:D,options:B})})}function _r(){st()&&(Re("touchstart",Dr,{passive:!0}),Re("touchend",Ro,{passive:!0})),Xm(v.props.trigger).forEach(function(w){if(w!=="manual")switch(Re(w,Dr),w){case"mouseenter":Re("mouseleave",Ro);break;case"focus":Re(fv?"focusout":"blur",vn);break;case"focusin":Re("focusout",vn);break}})}function Ar(){h.forEach(function(w){var D=w.node,B=w.eventType,G=w.handler,W=w.options;D.removeEventListener(B,G,W)}),h=[]}function Dr(w){var D,B=!1;if(!(!v.state.isEnabled||Rr(w)||a)){var G=((D=u)==null?void 0:D.type)==="focus";u=w,g=w.currentTarget,xe(),!v.state.isVisible&&ev(w)&&vo.forEach(function(W){return W(w)}),w.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||s)&&v.props.hideOnClick!==!1&&v.state.isVisible?B=!0:qu(w),w.type==="click"&&(s=!B),B&&!G&&Vo(w)}}function Do(w){var D=w.target,B=U().contains(D)||C.contains(D);if(!(w.type==="mousemove"&&B)){var G=zs().concat(C).map(function(W){var zt,ie=W._tippy,qn=(zt=ie.popperInstance)==null?void 0:zt.state;return qn?{popperRect:W.getBoundingClientRect(),popperState:qn,props:e}:null}).filter(Boolean);iv(G,w)&&(hn(),Vo(w))}}function Ro(w){var D=Rr(w)||v.props.trigger.indexOf("click")>=0&&s;if(!D){if(v.props.interactive){v.hideWithInteractivity(w);return}Vo(w)}}function vn(w){v.props.trigger.indexOf("focusin")<0&&w.target!==U()||v.props.interactive&&w.relatedTarget&&C.contains(w.relatedTarget)||Vo(w)}function Rr(w){return be.isTouch?st()!==w.type.indexOf("touch")>=0:!1}function Vr(){Ir();var w=v.props,D=w.popperOptions,B=w.placement,G=w.offset,W=w.getReferenceClientRect,zt=w.moveTransition,ie=et()?hs(C).arrow:null,qn=W?{getBoundingClientRect:W,contextElement:W.contextElement||U()}:n,ju={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Io){var jn=Io.state;if(et()){var c1=Z(),Fs=c1.box;["placement","reference-hidden","escaped"].forEach(function(Bo){Bo==="placement"?Fs.setAttribute("data-placement",jn.placement):jn.attributes.popper["data-popper-"+Bo]?Fs.setAttribute("data-"+Bo,""):Fs.removeAttribute("data-"+Bo)}),jn.attributes.popper={}}}},gn=[{name:"offset",options:{offset:G}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!zt}},ju];et()&&ie&&gn.push({name:"arrow",options:{element:ie,padding:3}}),gn.push.apply(gn,(D==null?void 0:D.modifiers)||[]),v.popperInstance=Um(qn,C,Object.assign({},D,{placement:B,onFirstUpdate:d,modifiers:gn}))}function Ir(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function Qb(){var w=v.props.appendTo,D,B=U();v.props.interactive&&w===Ic||w==="parent"?D=B.parentNode:D=Bc(w,[B]),D.contains(C)||D.appendChild(C),Vr()}function zs(){return ho(C.querySelectorAll("[data-tippy-root]"))}function qu(w){v.clearDelayTimeouts(),w&&_t("onTrigger",[v,w]),Yt();var D=X(!0),B=F(),G=B[0],W=B[1];be.isTouch&&G==="hold"&&W&&(D=W),D?r=setTimeout(function(){v.show()},D):v.show()}function Vo(w){if(v.clearDelayTimeouts(),_t("onUntrigger",[v,w]),!v.state.isVisible){Xe();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(w.type)>=0&&s)){var D=X(!1);D?o=setTimeout(function(){v.state.isVisible&&v.hide()},D):i=requestAnimationFrame(function(){v.hide()})}}function Zb(){v.state.isEnabled=!0}function t1(){v.hide(),v.state.isEnabled=!1}function e1(){clearTimeout(r),clearTimeout(o),cancelAnimationFrame(i)}function n1(w){if(!v.state.isDestroyed){_t("onBeforeUpdate",[v,w]),Ar();var D=v.props,B=qc(n,Object.assign({},D,Lc(w),{ignoreAttributes:!0}));v.props=B,_r(),D.interactiveDebounce!==B.interactiveDebounce&&(hn(),m=Pc(Do,B.interactiveDebounce)),D.triggerTarget&&!B.triggerTarget?Bn(D.triggerTarget).forEach(function(G){G.removeAttribute("aria-expanded")}):B.triggerTarget&&n.removeAttribute("aria-expanded"),xe(),Tt(),A&&A(D,B),v.popperInstance&&(Vr(),zs().forEach(function(G){requestAnimationFrame(G._tippy.popperInstance.forceUpdate)})),_t("onAfterUpdate",[v,w])}}function r1(w){v.setProps({content:w})}function o1(){var w=v.state.isVisible,D=v.state.isDestroyed,B=!v.state.isEnabled,G=be.isTouch&&!v.props.touch,W=cs(v.props.duration,0,fe.duration);if(!(w||D||B||G)&&!U().hasAttribute("disabled")&&(_t("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,et()&&(C.style.visibility="visible"),Tt(),Yt(),v.state.isMounted||(C.style.transition="none"),et()){var zt=Z(),ie=zt.box,qn=zt.content;fs([ie,qn],0)}d=function(){var gn;if(!(!v.state.isVisible||c)){if(c=!0,C.offsetHeight,C.style.transition=v.props.moveTransition,et()&&v.props.animation){var Ls=Z(),Io=Ls.box,jn=Ls.content;fs([Io,jn],W),Fc([Io,jn],"visible")}De(),xe(),zc(ms,v),(gn=v.popperInstance)==null||gn.forceUpdate(),v.state.isMounted=!0,_t("onMount",[v]),v.props.animation&&et()&&Qe(W,function(){v.state.isShown=!0,_t("onShown",[v])})}},Qb()}}function i1(){var w=!v.state.isVisible,D=v.state.isDestroyed,B=!v.state.isEnabled,G=cs(v.props.duration,1,fe.duration);if(!(w||D||B)&&(_t("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,c=!1,s=!1,et()&&(C.style.visibility="hidden"),hn(),Xe(),Tt(),et()){var W=Z(),zt=W.box,ie=W.content;v.props.animation&&(fs([zt,ie],G),Fc([zt,ie],"hidden"))}De(),xe(),v.props.animation?et()&&Tr(G,v.unmount):v.unmount()}}function s1(w){Nt().addEventListener("mousemove",m),zc(vo,m),m(w)}function a1(){v.state.isVisible&&v.hide(),!!v.state.isMounted&&(Ir(),zs().forEach(function(w){w._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),ms=ms.filter(function(w){return w!==v}),v.state.isMounted=!1,_t("onHidden",[v]))}function l1(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),Ar(),delete n._tippy,v.state.isDestroyed=!0,_t("onDestroy",[v]))}}function Pn(n,t){t===void 0&&(t={});var e=fe.plugins.concat(t.plugins||[]);cv();var r=Object.assign({},t,{plugins:e}),o=rv(n),i=o.reduce(function(s,a){var l=a&&bv(a,r);return l&&s.push(l),s},[]);return mo(n)?i[0]:i}Pn.defaultProps=fe,Pn.setDefaultProps=mv,Pn.currentInput=be,Object.assign({},gc,{effect:function(t){var e=t.state,r={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,r.popper),e.styles=r,e.elements.arrow&&Object.assign(e.elements.arrow.style,r.arrow)}}),Pn.setDefaultProps({render:Kc});class kv{constructor({editor:t,element:e,view:r,tippyOptions:o={},shouldShow:i}){this.preventHide=!1,this.shouldShow=({state:s,from:a,to:l})=>{const{doc:c,selection:u}=s,{empty:p}=u,d=!c.textBetween(a,l).length&&tc(s.selection);return!(p||d)},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=e,this.view=r,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.tippyOptions=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:t}=this.editor.options,e=!!t.parentElement;this.tippy||!e||(this.tippy=Pn(t,x({duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle"},this.tippyOptions)))}update(t,e){var r,o;const{state:i,composing:s}=t,{doc:a,selection:l}=i,c=e&&e.doc.eq(a)&&e.selection.eq(l);if(s||c)return;this.createTooltip();const{ranges:u}=l,p=Math.min(...u.map(m=>m.$from.pos)),d=Math.max(...u.map(m=>m.$to.pos));if(!((r=this.shouldShow)===null||r===void 0?void 0:r.call(this,{editor:this.editor,view:t,state:i,oldState:e,from:p,to:d}))){this.hide();return}(o=this.tippy)===null||o===void 0||o.setProps({getReferenceClientRect:()=>{if(qh(i.selection)){const m=t.nodeDOM(p);if(m)return m.getBoundingClientRect()}return pc(t,p,d)}}),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,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Uc=n=>new Ht({key:typeof n.pluginKey=="string"?new ae(n.pluginKey):n.pluginKey,view:t=>new kv(x({view:t},n))});yt.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Uc({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});class wv{constructor({editor:t,element:e,view:r,tippyOptions:o={},shouldShow:i}){this.preventHide=!1,this.shouldShow=({state:s})=>{const{selection:a}=s,{$anchor:l,empty:c}=a,u=l.depth===1,p=l.parent.isTextblock&&!l.parent.type.spec.code&&!l.parent.textContent;return!(!c||!u||!p)},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=e,this.view=r,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.tippyOptions=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:t}=this.editor.options,e=!!t.parentElement;this.tippy||!e||(this.tippy=Pn(t,x({duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle"},this.tippyOptions)))}update(t,e){var r,o;const{state:i,composing:s}=t,{doc:a,selection:l}=i,{from:c,to:u}=l,p=e&&e.doc.eq(a)&&e.selection.eq(l);if(s||p)return;if(this.createTooltip(),!((r=this.shouldShow)===null||r===void 0?void 0:r.call(this,{editor:this.editor,view:t,state:i,oldState:e}))){this.hide();return}(o=this.tippy)===null||o===void 0||o.setProps({getReferenceClientRect:()=>pc(t,c,u)}),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,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Gc=n=>new Ht({key:typeof n.pluginKey=="string"?new ae(n.pluginKey):n.pluginKey,view:t=>new wv(x({view:t},n))});yt.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Gc({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});const Sv=f.defineComponent({name:"BubbleMenu",props:{pluginKey:{type:null,default:"bubbleMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(n,{slots:t}){const e=f.ref(null);return f.onMounted(()=>{const{pluginKey:r,editor:o,tippyOptions:i,shouldShow:s}=n;o.registerPlugin(Uc({pluginKey:r,editor:o,element:e.value,tippyOptions:i,shouldShow:s}))}),f.onBeforeUnmount(()=>{const{pluginKey:r,editor:o}=n;o.unregisterPlugin(r)}),()=>{var r;return f.h("div",{ref:e},(r=t.default)===null||r===void 0?void 0:r.call(t))}}});function Yc(n){return f.customRef((t,e)=>({get(){return t(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e()})})}}))}class xv extends $h{constructor(t={}){super(t);return this.vueRenderers=f.reactive(new Map),this.contentComponent=null,this.reactiveState=Yc(this.view.state),this.reactiveExtensionStorage=Yc(this.extensionStorage),this.on("transaction",()=>{this.reactiveState.value=this.view.state,this.reactiveExtensionStorage.value=this.extensionStorage}),f.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(t,e){super.registerPlugin(t,e),this.reactiveState.value=this.view.state}unregisterPlugin(t){super.unregisterPlugin(t),this.reactiveState.value=this.view.state}}const Mv=f.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const t=f.ref(),e=f.getCurrentInstance();return f.watchEffect(()=>{const r=n.editor;r&&r.options.element&&t.value&&f.nextTick(()=>{if(!t.value||!r.options.element.firstChild)return;const o=f.unref(t.value);t.value.append(...r.options.element.childNodes),r.contentComponent=e.ctx._,r.setOptions({element:o}),r.createNodeViews()})}),f.onBeforeUnmount(()=>{const r=n.editor;if(!r||(r.isDestroyed||r.view.setProps({nodeViews:{}}),r.contentComponent=null,!r.options.element.firstChild))return;const o=document.createElement("div");o.append(...r.options.element.childNodes),r.setOptions({element:o})}),{rootEl:t}},render(){const n=[];return this.editor&&this.editor.vueRenderers.forEach(t=>{const e=f.h(f.Teleport,{to:t.teleportElement,key:t.id},f.h(t.component,x({ref:t.id},t.props)));n.push(e)}),f.h("div",{ref:t=>{this.rootEl=t}},...n)}});f.defineComponent({name:"FloatingMenu",props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(n,{slots:t}){const e=f.ref(null);return f.onMounted(()=>{const{pluginKey:r,editor:o,tippyOptions:i,shouldShow:s}=n;o.registerPlugin(Gc({pluginKey:r,editor:o,element:e.value,tippyOptions:i,shouldShow:s}))}),f.onBeforeUnmount(()=>{const{pluginKey:r,editor:o}=n;o.unregisterPlugin(r)}),()=>{var r;return f.h("div",{ref:e},(r=t.default)===null||r===void 0?void 0:r.call(t))}}}),f.defineComponent({props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,t;return f.h(this.as,{class:this.decorationClasses.value,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(t=(n=this.$slots).default)===null||t===void 0?void 0:t.call(n))}}),f.defineComponent({props:{as:{type:String,default:"div"}},render(){return f.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}});const Cv=/^```(?[a-z]*)?[\s\n]$/,Ev=/^~~~(?[a-z]*)?[\s\n]$/,Xc=bt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:n=>{var t;const{languageClassPrefix:e}=this.options,i=[...((t=n.firstElementChild)===null||t===void 0?void 0:t.classList)||[]].filter(s=>s.startsWith(e)).map(s=>s.replace(e,""))[0];return i||null},renderHTML:n=>n.language?{class:this.options.languageClassPrefix+n.language}:null}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({HTMLAttributes:n}){return["pre",this.options.HTMLAttributes,["code",n,0]]},addCommands(){return{setCodeBlock:n=>({commands:t})=>t.setNode("codeBlock",n),toggleCodeBlock:n=>({commands:t})=>t.toggleNode("codeBlock","paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:t}=this.editor.state.selection,e=t.pos===1;return!n||t.parent.type.name!==this.name?!1:e||!t.parent.textContent.length?this.editor.commands.clearNodes():!1}}},addInputRules(){return[ts({find:Cv,type:this.type,getAttributes:({groups:n})=>n}),ts({find:Ev,type:this.type,getAttributes:({groups:n})=>n})]},addProseMirrorPlugins(){return[new Ht({key:new ae("codeBlockVSCodeHandler"),props:{handlePaste:(n,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const e=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=o==null?void 0:o.mode;if(!e||!i)return!1;const{tr:s}=n.state;return s.replaceSelectionWith(this.type.create({language:i})),s.setSelection(K.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.insertText(e.replace(/\r\n?/g,` -`)),s.setMeta("paste",!0),n.dispatch(s),!0}}})]}}),Ov=qe.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark("underline"),toggleUnderline:()=>({commands:n})=>n.toggleMark("underline"),unsetUnderline:()=>({commands:n})=>n.unsetMark("underline")}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline()}}});function Qc(n,t,e){for(var r=0;;r++){if(r==n.childCount||r==t.childCount)return n.childCount==t.childCount?null:e;var o=n.child(r),i=t.child(r);if(o==i){e+=o.nodeSize;continue}if(!o.sameMarkup(i))return e;if(o.isText&&o.text!=i.text){for(var s=0;o.text[s]==i.text[s];s++)e++;return e}if(o.content.size||i.content.size){var a=Qc(o.content,i.content,e+1);if(a!=null)return a}e+=o.nodeSize}}function Zc(n,t,e,r){for(var o=n.childCount,i=t.childCount;;){if(o==0||i==0)return o==i?null:{a:e,b:r};var s=n.child(--o),a=t.child(--i),l=s.nodeSize;if(s==a){e-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:e,b:r};if(s.isText&&s.text!=a.text){for(var c=0,u=Math.min(s.text.length,a.text.length);ct&&r(l,o+a,i,s)!==!1&&l.content.size){var u=a+1;l.nodesBetween(Math.max(0,t-u),Math.min(l.content.size,e-u),r,o+u)}a=c}},E.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},E.prototype.textBetween=function(t,e,r,o){var i="",s=!0;return this.nodesBetween(t,e,function(a,l){a.isText?(i+=a.text.slice(Math.max(t,l)-l,e-l),s=!r):a.isLeaf&&o?(i+=typeof o=="function"?o(a):o,s=!r):!s&&a.isBlock&&(i+=r,s=!0)},0),i},E.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(e.isText&&e.sameMarkup(r)&&(o[o.length-1]=e.withText(e.text+r.text),i=1);it)for(var i=0,s=0;st&&((se)&&(a.isText?a=a.cut(Math.max(0,t-s),Math.min(a.text.length,e-s)):a=a.cut(Math.max(0,t-s-1),Math.min(a.content.size,e-s-1))),r.push(a),o+=a.nodeSize),s=l}return new E(r,o)},E.prototype.cutByIndex=function(t,e){return t==e?E.empty:t==0&&e==this.content.length?this:new E(this.content.slice(t,e))},E.prototype.replaceChild=function(t,e){var r=this.content[t];if(r==e)return this;var o=this.content.slice(),i=this.size+e.nodeSize-r.nodeSize;return o[t]=e,new E(o,i)},E.prototype.addToStart=function(t){return new E([t].concat(this.content),this.size+t.nodeSize)},E.prototype.addToEnd=function(t){return new E(this.content.concat(t),this.size+t.nodeSize)},E.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;ethis.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var r=0,o=0;;r++){var i=this.child(r),s=o+i.nodeSize;if(s>=t)return s==t||e>0?yo(r+1,s):yo(r,o);o=s}},E.prototype.toString=function(){return"<"+this.toStringInner()+">"},E.prototype.toStringInner=function(){return this.content.join(", ")},E.prototype.toJSON=function(){return this.content.length?this.content.map(function(t){return t.toJSON()}):null},E.fromJSON=function(t,e){if(!e)return E.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new E(e.map(t.nodeFromJSON))},E.fromArray=function(t){if(!t.length)return E.empty;for(var e,r=0,o=0;othis.type.rank&&(e||(e=t.slice(0,o)),e.push(this),r=!0),e&&e.push(i)}}return e||(e=t.slice()),r||e.push(this),e},q.prototype.removeFromSet=function(t){for(var e=0;e0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},R.fromJSON=function(t,e){if(!e)return R.empty;var r=e.openStart||0,o=e.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new R(E.fromJSON(t,e.content),r,o)},R.maxOpen=function(t,e){e===void 0&&(e=!0);for(var r=0,o=0,i=t.firstChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.firstChild)r++;for(var s=t.lastChild;s&&!s.isLeaf&&(e||!s.type.spec.isolating);s=s.lastChild)o++;return new R(t,r,o)},Object.defineProperties(R.prototype,tu);function eu(n,t,e){var r=n.findIndex(t),o=r.index,i=r.offset,s=n.maybeChild(o),a=n.findIndex(e),l=a.index,c=a.offset;if(i==t||s.isText){if(c!=e&&!n.child(l).isText)throw new RangeError("Removing non-flat range");return n.cut(0,t).append(n.cut(e))}if(o!=l)throw new RangeError("Removing non-flat range");return n.replaceChild(o,s.copy(eu(s.content,t-i-1,e-i-1)))}function nu(n,t,e,r){var o=n.findIndex(t),i=o.index,s=o.offset,a=n.maybeChild(i);if(s==t||a.isText)return r&&!r.canReplace(i,i,e)?null:n.cut(0,t).append(e).append(n.cut(t));var l=nu(a.content,t-s-1,e);return l&&n.replaceChild(i,a.copy(l))}R.empty=new R(E.empty,0,0);function Nv(n,t,e){if(e.openStart>n.depth)throw new ke("Inserted content deeper than insertion position");if(n.depth-e.openStart!=t.depth-e.openEnd)throw new ke("Inconsistent open depths");return ru(n,t,e,0)}function ru(n,t,e,r){var o=n.index(r),i=n.node(r);if(o==t.index(r)&&r=0&&n.isText&&n.sameMarkup(t[e])?t[e]=n.withText(t[e].text+n.text):t.push(n)}function yr(n,t,e,r){var o=(t||n).node(e),i=0,s=t?t.index(e):o.childCount;n&&(i=n.index(e),n.depth>e?i++:n.textOffset&&(un(n.nodeAfter,r),i++));for(var a=i;ao&&gs(n,t,o+1),s=r.depth>o&&gs(e,r,o+1),a=[];return yr(null,n,o,a),i&&s&&t.index(o)==e.index(o)?(ou(i,s),un(fn(i,iu(n,t,e,r,o+1)),a)):(i&&un(fn(i,ko(n,t,o+1)),a),yr(t,e,o,a),s&&un(fn(s,ko(e,r,o+1)),a)),yr(r,null,o,a),new E(a)}function ko(n,t,e){var r=[];if(yr(null,n,e,r),n.depth>e){var o=gs(n,t,e+1);un(fn(o,ko(n,t,e+1)),r)}return yr(t,null,e,r),new E(r)}function Tv(n,t){for(var e=t.depth-n.openStart,r=t.node(e),o=r.copy(n.content),i=e-1;i>=0;i--)o=t.node(i).copy(E.from(o));return{start:o.resolveNoCache(n.openStart+e),end:o.resolveNoCache(o.content.size-n.openEnd-e)}}var rt=function(t,e,r){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=r},zn={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};rt.prototype.resolveDepth=function(t){return t==null?this.depth:t<0?this.depth+t:t},zn.parent.get=function(){return this.node(this.depth)},zn.doc.get=function(){return this.node(0)},rt.prototype.node=function(t){return this.path[this.resolveDepth(t)*3]},rt.prototype.index=function(t){return this.path[this.resolveDepth(t)*3+1]},rt.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)},rt.prototype.start=function(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1},rt.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},rt.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]},rt.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},zn.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},zn.nodeAfter.get=function(){var n=this.parent,t=this.index(this.depth);if(t==n.childCount)return null;var e=this.pos-this.path[this.path.length-1],r=n.child(t);return e?n.child(t).cut(e):r},zn.nodeBefore.get=function(){var n=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(n).cut(0,t):n==0?null:this.parent.child(n-1)},rt.prototype.posAtIndex=function(t,e){e=this.resolveDepth(e);for(var r=this.path[e*3],o=e==0?0:this.path[e*3-1]+1,i=0;i0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},rt.prototype.blockRange=function(t,e){if(t===void 0&&(t=this),t.pos=0;r--)if(t.pos<=this.end(r)&&(!e||e(this.node(r))))return new su(this,t,r)},rt.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},rt.prototype.max=function(t){return t.pos>this.pos?t:this},rt.prototype.min=function(t){return t.pos=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var r=[],o=0,i=e,s=t;;){var a=s.content.findIndex(i),l=a.index,c=a.offset,u=i-c;if(r.push(s,l,o+c),!u||(s=s.child(l),s.isText))break;i=u-1,o+=c+1}return new rt(e,r,i)},rt.resolveCached=function(t,e){for(var r=0;rt&&this.nodesBetween(t,e,function(i){return r.isInSet(i.marks)&&(o=!0),!o}),o},Ut.isBlock.get=function(){return this.type.isBlock},Ut.isTextblock.get=function(){return this.type.isTextblock},Ut.inlineContent.get=function(){return this.type.inlineContent},Ut.isInline.get=function(){return this.type.isInline},Ut.isText.get=function(){return this.type.isText},Ut.isLeaf.get=function(){return this.type.isLeaf},Ut.isAtom.get=function(){return this.type.isAtom},j.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()+")"),Dv(this.marks,t)},j.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},j.prototype.canReplace=function(t,e,r,o,i){r===void 0&&(r=E.empty),o===void 0&&(o=0),i===void 0&&(i=r.childCount);var s=this.contentMatchAt(t).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(var l=o;l=0;e--)t=n[e].type.name+"("+t+")";return t}var Vt=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},wo={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};Vt.parse=function(t,e){var r=new So(t,e);if(r.next==null)return Vt.empty;var o=lu(r);r.next&&r.err("Unexpected trailing text");var i=Lv(zv(o));return Fv(i,r),i},Vt.prototype.matchType=function(t){for(var e=0;e>1},Vt.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},Vt.prototype.toString=function(){var t=[];function e(r){t.push(r);for(var o=1;o"+t.indexOf(r.next[s+1]);return i}).join(` -`)},Object.defineProperties(Vt.prototype,wo),Vt.empty=new Vt(!0);var So=function(t,e){this.string=t,this.nodeTypes=e,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()},au={next:{configurable:!0}};au.next.get=function(){return this.tokens[this.pos]},So.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},So.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties(So.prototype,au);function lu(n){var t=[];do t.push(Rv(n));while(n.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function Rv(n){var t=[];do t.push(Vv(n));while(n.next&&n.next!=")"&&n.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function Vv(n){for(var t=Pv(n);;)if(n.eat("+"))t={type:"plus",expr:t};else if(n.eat("*"))t={type:"star",expr:t};else if(n.eat("?"))t={type:"opt",expr:t};else if(n.eat("{"))t=Iv(n,t);else break;return t}function cu(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");var t=Number(n.next);return n.pos++,t}function Iv(n,t){var e=cu(n),r=e;return n.eat(",")&&(n.next!="}"?r=cu(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:e,max:r,expr:t}}function Bv(n,t){var e=n.nodeTypes,r=e[t];if(r)return[r];var o=[];for(var i in e){var s=e[i];s.groups.indexOf(t)>-1&&o.push(s)}return o.length==0&&n.err("No node type or group '"+t+"' found"),o}function Pv(n){if(n.eat("(")){var t=lu(n);return n.eat(")")||n.err("Missing closing paren"),t}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{var e=Bv(n,n.next).map(function(r){return n.inline==null?n.inline=r.isInline:n.inline!=r.isInline&&n.err("Mixing inline and block content"),{type:"name",value:r}});return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function zv(n){var t=[[]];return o(i(n,0),e()),t;function e(){return t.push([])-1}function r(s,a,l){var c={term:l,to:a};return t[s].push(c),c}function o(s,a){s.forEach(function(l){return l.to=a})}function i(s,a){if(s.type=="choice")return s.exprs.reduce(function(k,b){return k.concat(i(b,a))},[]);if(s.type=="seq")for(var l=0;;l++){var c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=e())}else if(s.type=="star"){var u=e();return r(a,u),o(i(s.expr,u),u),[r(u)]}else if(s.type=="plus"){var p=e();return o(i(s.expr,a),p),o(i(s.expr,p),p),[r(p)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){for(var d=a,h=0;h-1&&o[d+1];fu(n,p).forEach(function(m){h||o.push(u,h=[]),h.indexOf(m)==-1&&h.push(m)})}})});for(var i=t[r.join(",")]=new Vt(r.indexOf(n.length-1)>-1),s=0;s-1},Gt.prototype.allowsMarks=function(t){if(this.markSet==null)return!0;for(var e=0;e-1};var ks={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},Hv={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},gu={ol:!0,ul:!0},ws=1,Ss=2,kr=4;function yu(n){return(n?ws:0)|(n==="full"?Ss:0)}var Ae=function(t,e,r,o,i,s,a){this.type=t,this.attrs=e,this.solid=i,this.match=s||(a&kr?null:t.contentMatch),this.options=a,this.content=[],this.marks=r,this.activeMarks=q.none,this.pendingMarks=o,this.stashMarks=[]};Ae.prototype.findWrapping=function(t){if(!this.match){if(!this.type)return[];var e=this.type.contentMatch.fillBefore(E.from(t));if(e)this.match=this.type.contentMatch.matchFragment(e);else{var r=this.type.contentMatch,o;return(o=r.findWrapping(t.type))?(this.match=r,o):null}}return this.match.findWrapping(t.type)},Ae.prototype.finish=function(t){if(!(this.options&ws)){var e=this.content[this.content.length-1],r;e&&e.isText&&(r=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-r[0].length)))}var o=E.from(this.content);return!t&&this.match&&(o=o.append(this.match.fillBefore(E.empty,!0))),this.type?this.type.create(this.attrs,o,this.marks):o},Ae.prototype.popFromStashMark=function(t){for(var e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},Ae.prototype.applyPending=function(t){for(var e=0,r=this.pendingMarks;e=0;o--){var i=this.nodes[o],s=i.findWrapping(t);if(s&&(!e||e.length>s.length)&&(e=s,r=i,!s.length)||i.solid)break}if(!e)return!1;this.sync(r);for(var a=0;athis.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},ot.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},ot.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t){this.open=e;return}},xs.currentPos.get=function(){this.closeExtra();for(var n=0,t=this.open;t>=0;t--){for(var e=this.nodes[t].content,r=e.length-1;r>=0;r--)n+=e[r].nodeSize;t&&n++}return n},ot.prototype.findAtPoint=function(t,e){if(this.find)for(var r=0;r-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var r=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(l,c){for(;l>=0;l--){var u=r[l];if(u==""){if(l==r.length-1||l==0)continue;for(;c>=s;c--)if(a(l-1,c))return!0;return!1}else{var p=c>0||c==0&&i?e.nodes[c].type:o&&c>=s?o.node(c-s).type:null;if(!p||p.name!=u&&p.groups.indexOf(u)==-1)return!1;c--}}return!0};return a(r.length-1,this.open)},ot.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var r=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(var o in this.parser.schema.nodes){var i=this.parser.schema.nodes[o];if(i.isTextblock&&i.defaultAttrs)return i}},ot.prototype.addPendingMark=function(t){var e=jv(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},ot.prototype.removePendingMark=function(t,e){for(var r=this.open;r>=0;r--){var o=this.nodes[r],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==e)break}},Object.defineProperties(ot.prototype,xs);function Jv(n){for(var t=n.firstChild,e=null;t;t=t.nextSibling){var r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&gu.hasOwnProperty(r)&&e?(e.appendChild(t),t=e):r=="li"?e=t:r&&(e=null)}}function $v(n){for(var t=/\s*([\w-]+)\s*:\s*([^;]+)/g,e,r=[];e=t.exec(n);)r.push(e[1],e[2].trim());return r}function qv(n,t){var e=t.schema.nodes,r=function(s){var a=e[s];if(!!a.allowsMarkType(n)){var l=[],c=function(u){l.push(u);for(var p=0;pt)break;var c=this.ranges[a+i],u=this.ranges[a+s],p=l+c;if(t<=p){var d=c?t==l?-1:t==p?1:e:e,h=l+o+(d<0?0:u);if(r)return h;var m=t==(e<0?l:p)?null:Wv(a/3,t-l);return new Ms(h,e<0?t!=l:t!=p,m)}o+=u-c}return r?t+o:new Ms(t+o)},kt.prototype.touches=function(t,e){for(var r=0,o=wu(e),i=this.inverted?2:1,s=this.inverted?1:2,a=0;at)break;var c=this.ranges[a+i],u=l+c;if(t<=u&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1},kt.prototype.forEach=function(t){for(var e=this.inverted?2:1,r=this.inverted?1:2,o=0,i=0;o=0;e--){var o=t.getMirror(e);this.appendMap(t.maps[e].invert(),o!=null&&o>e?r-o-1:null)}},It.prototype.invert=function(){var t=new It;return t.appendMappingInverted(this),t},It.prototype.map=function(t,e){if(e===void 0&&(e=1),this.mirror)return this._map(t,e,!0);for(var r=this.from;ri&&l0},lt.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(lt.prototype,Cs);function xo(){throw new Error("Override me")}var Es=Object.create(null),Ot=function(){};Ot.prototype.apply=function(t){return xo()},Ot.prototype.getMap=function(){return kt.empty},Ot.prototype.invert=function(t){return xo()},Ot.prototype.map=function(t){return xo()},Ot.prototype.merge=function(t){return null},Ot.prototype.toJSON=function(){return xo()},Ot.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var r=Es[e.stepType];if(!r)throw new RangeError("No step type "+e.stepType+" defined");return r.fromJSON(t,e)},Ot.jsonID=function(t,e){if(t in Es)throw new RangeError("Duplicate use of step JSON ID "+t);return Es[t]=e,e.prototype.jsonID=t,e};var Bt=function(t,e){this.doc=t,this.failed=e};Bt.ok=function(t){return new Bt(t,null)},Bt.fail=function(t){return new Bt(null,t)},Bt.fromReplace=function(t,e,r,o){try{return Bt.ok(t.replace(e,r,o))}catch(i){if(i instanceof ke)return Bt.fail(i.message);throw i}};var Ke=function(n){function t(e,r,o,i){n.call(this),this.from=e,this.to=r,this.slice=o,this.structure=!!i}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.apply=function(r){return this.structure&&Os(r,this.from,this.to)?Bt.fail("Structure replace would overwrite content"):Bt.fromReplace(r,this.from,this.to,this.slice)},t.prototype.getMap=function(){return new kt([this.from,this.to-this.from,this.slice.size])},t.prototype.invert=function(r){return new t(this.from,this.from+this.slice.size,r.slice(this.from,this.to))},t.prototype.map=function(r){var o=r.mapResult(this.from,1),i=r.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(r){if(!(r instanceof t)||r.structure||this.structure)return null;if(this.from+this.slice.size==r.from&&!this.slice.openEnd&&!r.slice.openStart){var o=this.slice.size+r.slice.size==0?R.empty:new R(this.slice.content.append(r.slice.content),this.slice.openStart,r.slice.openEnd);return new t(this.from,this.to+(r.to-r.from),o,this.structure)}else if(r.to==this.from&&!this.slice.openStart&&!r.slice.openEnd){var i=this.slice.size+r.slice.size==0?R.empty:new R(r.slice.content.append(this.slice.content),r.slice.openStart,this.slice.openEnd);return new t(r.from,this.to,i,this.structure)}else return null},t.prototype.toJSON=function(){var r={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(r.slice=this.slice.toJSON()),this.structure&&(r.structure=!0),r},t.fromJSON=function(r,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,R.fromJSON(r,o.slice),!!o.structure)},t}(Ot);Ot.jsonID("replace",Ke);var dn=function(n){function t(e,r,o,i,s,a,l){n.call(this),this.from=e,this.to=r,this.gapFrom=o,this.gapTo=i,this.slice=s,this.insert=a,this.structure=!!l}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.apply=function(r){if(this.structure&&(Os(r,this.from,this.gapFrom)||Os(r,this.gapTo,this.to)))return Bt.fail("Structure gap-replace would overwrite content");var o=r.slice(this.gapFrom,this.gapTo);if(o.openStart||o.openEnd)return Bt.fail("Gap is not a flat range");var i=this.slice.insertAt(this.insert,o.content);return i?Bt.fromReplace(r,this.from,this.to,i):Bt.fail("Content does not fit in gap")},t.prototype.getMap=function(){return new kt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},t.prototype.invert=function(r){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,r.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},t.prototype.map=function(r){var o=r.mapResult(this.from,1),i=r.mapResult(this.to,-1),s=r.map(this.gapFrom,-1),a=r.map(this.gapTo,1);return o.deleted&&i.deleted||si.pos?null:new t(o.pos,i.pos,s,a,this.slice,this.insert,this.structure)},t.prototype.toJSON=function(){var r={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(r.slice=this.slice.toJSON()),this.structure&&(r.structure=!0),r},t.fromJSON=function(r,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,R.fromJSON(r,o.slice),o.insert,!!o.structure)},t}(Ot);Ot.jsonID("replaceAround",dn);function Os(n,t,e){for(var r=n.resolve(t),o=e-t,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}lt.prototype.lift=function(n,t){for(var e=n.$from,r=n.$to,o=n.depth,i=e.before(o+1),s=r.after(o+1),a=i,l=s,c=E.empty,u=0,p=o,d=!1;p>t;p--)d||e.index(p)>0?(d=!0,c=E.from(e.node(p).copy(c)),u++):a--;for(var h=E.empty,m=0,g=o,y=!1;g>t;g--)y||r.after(g+1)=0;r--)e=E.from(t[r].type.create(t[r].attrs,e));var o=n.start,i=n.end;return this.step(new dn(o,i,o,i,new R(e,0,0),t.length,!0))},lt.prototype.setBlockType=function(n,t,e,r){var o=this;if(t===void 0&&(t=n),!e.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=this.steps.length;return this.doc.nodesBetween(n,t,function(s,a){if(s.isTextblock&&!s.hasMarkup(e,r)&&Uv(o.doc,o.mapping.slice(i).map(a),e)){o.clearIncompatible(o.mapping.slice(i).map(a,1),e);var l=o.mapping.slice(i),c=l.map(a,1),u=l.map(a+s.nodeSize,1);return o.step(new dn(c,u,c+1,u-1,new R(E.from(e.create(r,null,s.marks)),0,0),1,!0)),!1}}),this};function Uv(n,t,e){var r=n.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,e)}lt.prototype.setNodeMarkup=function(n,t,e,r){var o=this.doc.nodeAt(n);if(!o)throw new RangeError("No node at given position");t||(t=o.type);var i=t.create(e,null,r||o.marks);if(o.isLeaf)return this.replaceWith(n,n+o.nodeSize,i);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);return this.step(new dn(n,n+o.nodeSize,n+1,n+o.nodeSize-1,new R(E.from(i),0,0),1,!0))},lt.prototype.split=function(n,t,e){t===void 0&&(t=1);for(var r=this.doc.resolve(n),o=E.empty,i=E.empty,s=r.depth,a=r.depth-t,l=t-1;s>a;s--,l--){o=E.from(r.node(s).copy(o));var c=e&&e[l];i=E.from(c?c.type.create(c.attrs,i):r.node(s).copy(i))}return this.step(new Ke(n,n,new R(o.append(i),t,t),!0))},lt.prototype.join=function(n,t){t===void 0&&(t=1);var e=new Ke(n-t,n+t,R.empty,!0);return this.step(e)};function Gv(n,t,e){var r=n.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),e))return t;if(r.parentOffset==0)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,e))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,e))return r.after(s+1);if(a=i.pos?null:new t(o.pos,i.pos,this.mark)},t.prototype.merge=function(r){if(r instanceof t&&r.mark.eq(this.mark)&&this.from<=r.to&&this.to>=r.from)return new t(Math.min(this.from,r.from),Math.max(this.to,r.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(r,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,r.markFromJSON(o.mark))},t}(Ot);Ot.jsonID("addMark",Ts);var wr=function(n){function t(e,r,o){n.call(this),this.from=e,this.to=r,this.mark=o}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.apply=function(r){var o=this,i=r.slice(this.from,this.to),s=new R(Ns(i.content,function(a){return a.mark(o.mark.removeFromSet(a.marks))}),i.openStart,i.openEnd);return Bt.fromReplace(r,this.from,this.to,s)},t.prototype.invert=function(){return new Ts(this.from,this.to,this.mark)},t.prototype.map=function(r){var o=r.mapResult(this.from,1),i=r.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(r){if(r instanceof t&&r.mark.eq(this.mark)&&this.from<=r.to&&this.to>=r.from)return new t(Math.min(this.from,r.from),Math.max(this.to,r.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(r,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,r.markFromJSON(o.mark))},t}(Ot);Ot.jsonID("removeMark",wr),lt.prototype.addMark=function(n,t,e){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(n,t,function(l,c,u){if(!!l.isInline){var p=l.marks;if(!e.isInSet(p)&&u.type.allowsMarkType(e.type)){for(var d=Math.max(c,n),h=Math.min(c+l.nodeSize,t),m=e.addToSet(p),g=0;g=0;d--)this.step(o[d]);return this};function Yv(n,t,e,r){if(e===void 0&&(e=t),r===void 0&&(r=R.empty),t==e&&!r.size)return null;var o=n.resolve(t),i=n.resolve(e);return Su(o,i,r)?new Ke(t,e,r):new oe(o,i,r).fit()}lt.prototype.replace=function(n,t,e){t===void 0&&(t=n),e===void 0&&(e=R.empty);var r=Yv(this.doc,n,t,e);return r&&this.step(r),this},lt.prototype.replaceWith=function(n,t,e){return this.replace(n,t,new R(E.from(e),0,0))},lt.prototype.delete=function(n,t){return this.replace(n,t,R.empty)},lt.prototype.insert=function(n,t){return this.replaceWith(n,n,t)};function Su(n,t,e){return!e.openStart&&!e.openEnd&&n.start()==t.start()&&n.parent.canReplace(n.index(),t.index(),e.content)}var oe=function(t,e,r){this.$to=e,this.$from=t,this.unplaced=r,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=E.empty;for(var s=t.depth;s>0;s--)this.placed=E.from(t.node(s).copy(this.placed))},xu={depth:{configurable:!0}};xu.depth.get=function(){return this.frontier.length-1},oe.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var e=this.mustMoveInline(),r=this.placed.size-this.depth-this.$from.depth,o=this.$from,i=this.close(e<0?this.$to:o.doc.resolve(e));if(!i)return null;for(var s=this.placed,a=o.depth,l=i.depth;a&&l&&s.childCount==1;)s=s.firstChild.content,a--,l--;var c=new R(s,a,l);if(e>-1)return new dn(o.pos,e,this.$to.pos,this.$to.end(),c,r);if(c.size||o.pos!=this.$to.pos)return new Ke(o.pos,i.pos,c)},oe.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var e=this.unplaced.openStart;e>=0;e--){var r=void 0,o=void 0;e?(o=_s(this.unplaced.content,e-1).firstChild,r=o.content):r=this.unplaced.content;for(var i=r.firstChild,s=this.depth;s>=0;s--){var a=this.frontier[s],l=a.type,c=a.match,u=void 0,p=void 0;if(t==1&&(i?c.matchType(i.type)||(p=c.fillBefore(E.from(i),!1)):l.compatibleContent(o.type)))return{sliceDepth:e,frontierDepth:s,parent:o,inject:p};if(t==2&&i&&(u=c.findWrapping(i.type)))return{sliceDepth:e,frontierDepth:s,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}},oe.prototype.openMore=function(){var t=this.unplaced,e=t.content,r=t.openStart,o=t.openEnd,i=_s(e,r);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new R(e,r+1,Math.max(o,i.size+r>=e.size-o?r+1:0)),!0)},oe.prototype.dropNode=function(){var t=this.unplaced,e=t.content,r=t.openStart,o=t.openEnd,i=_s(e,r);if(i.childCount<=1&&r>0){var s=e.size-r<=r+i.size;this.unplaced=new R(Sr(e,r-1,1),r-1,s?r-1:o)}else this.unplaced=new R(Sr(e,r,1),r,o)},oe.prototype.placeNodes=function(t){for(var e=t.sliceDepth,r=t.frontierDepth,o=t.parent,i=t.inject,s=t.wrap;this.depth>r;)this.closeFrontierNode();if(s)for(var a=0;a1||u==0||b.content.size)&&(m=N,d.push(Mu(b.mark(g.allowedMarks(b.marks)),p==1?u:0,p==c.childCount?k:-1)))}var v=p==c.childCount;v||(k=-1),this.placed=xr(this.placed,r,E.from(d)),this.frontier[r].match=m,v&&k<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var O=0,C=c;O1&&i==this.$to.end(--o);)++i;return i},oe.prototype.findCloseLevel=function(t){t:for(var e=Math.min(this.depth,t.depth);e>=0;e--){var r=this.frontier[e],o=r.match,i=r.type,s=e=0;l--){var c=this.frontier[l],u=c.match,p=c.type,d=As(t,l,p,u,!0);if(!d||d.childCount)continue t}return{depth:e,fit:a,move:s?t.doc.resolve(t.after(e+1)):t}}}},oe.prototype.close=function(t){var e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=xr(this.placed,e.depth,e.fit)),t=e.move;for(var r=e.depth+1;r<=t.depth;r++){var o=t.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,t.index(r));this.openFrontierNode(o.type,o.attrs,i)}return t},oe.prototype.openFrontierNode=function(t,e,r){var o=this.frontier[this.depth];o.match=o.match.matchType(t),this.placed=xr(this.placed,this.depth,E.from(t.create(e,r))),this.frontier.push({type:t,match:t.contentMatch})},oe.prototype.closeFrontierNode=function(){var t=this.frontier.pop(),e=t.match.fillBefore(E.empty,!0);e.childCount&&(this.placed=xr(this.placed,this.frontier.length,e))},Object.defineProperties(oe.prototype,xu);function Sr(n,t,e){return t==0?n.cutByIndex(e):n.replaceChild(0,n.firstChild.copy(Sr(n.firstChild.content,t-1,e)))}function xr(n,t,e){return t==0?n.append(e):n.replaceChild(n.childCount-1,n.lastChild.copy(xr(n.lastChild.content,t-1,e)))}function _s(n,t){for(var e=0;e1&&(r=r.replaceChild(0,Mu(r.firstChild,t-1,r.childCount==1?e-1:0))),t>0&&(r=n.type.contentMatch.fillBefore(r).append(r),e<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(E.empty,!0)))),n.copy(r)}function As(n,t,e,r,o){var i=n.node(t),s=o?n.indexAfter(t):n.index(t);if(s==i.childCount&&!e.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!Xv(e,i.content,s)?a:null}function Xv(n,t,e){for(var r=e;r0;a--,l--){var c=r.node(a).type.spec;if(c.defining||c.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==l&&i.splice(1,0,-a)}for(var u=i.indexOf(s),p=[],d=e.openStart,h=e.content,m=0;;m++){var g=h.firstChild;if(p.push(g),m==e.openStart)break;h=g.content}d>0&&p[d-1].type.spec.defining&&r.node(u).type!=p[d-1].type?d-=1:d>=2&&p[d-1].isTextblock&&p[d-2].type.spec.defining&&r.node(u).type!=p[d-2].type&&(d-=2);for(var y=e.openStart;y>=0;y--){var k=(y+d+1)%(e.openStart+1),b=p[k];if(!!b)for(var N=0;N=0&&(this.replace(n,t,e),!(this.steps.length>I));V--){var F=i[V];F<0||(n=r.before(F),t=o.after(F))}return this};function Cu(n,t,e,r,o){if(tr){var s=o.contentMatchAt(0),a=s.fillBefore(n).append(n);n=a.append(s.matchFragment(a).fillBefore(E.empty,!0))}return n}lt.prototype.replaceRangeWith=function(n,t,e){if(!e.isInline&&n==t&&this.doc.resolve(n).parent.content.size){var r=Gv(this.doc,n,e.type);r!=null&&(n=t=r)}return this.replaceRange(n,t,new R(E.from(e),0,0))},lt.prototype.deleteRange=function(n,t){for(var e=this.doc.resolve(n),r=this.doc.resolve(t),o=Eu(e,r),i=0;i0&&(a||e.node(s-1).canReplace(e.index(s-1),r.indexAfter(s-1))))return this.delete(e.before(s),r.after(s))}for(var l=1;l<=e.depth&&l<=r.depth;l++)if(n-e.start(l)==e.depth-l&&t>e.end(l)&&r.end(l)-t!=r.depth-l)return this.delete(e.before(l),t);return this.delete(n,t)};function Eu(n,t){for(var e=[],r=Math.min(n.depth,t.depth),o=r;o>=0;o--){var i=n.start(o);if(it.pos+(t.depth-o)||n.node(o).type.spec.isolating||t.node(o).type.spec.isolating)break;(i==t.start(o)||o==n.depth&&o==t.depth&&n.parent.inlineContent&&t.parent.inlineContent&&o&&t.start(o-1)==i-1)&&e.push(o)}return e}var Ds=Object.create(null),it=function(t,e,r){this.ranges=r||[new Qv(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},Ue={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};Ue.anchor.get=function(){return this.$anchor.pos},Ue.head.get=function(){return this.$head.pos},Ue.from.get=function(){return this.$from.pos},Ue.to.get=function(){return this.$to.pos},Ue.$from.get=function(){return this.ranges[0].$from},Ue.$to.get=function(){return this.ranges[0].$to},Ue.empty.get=function(){for(var n=this.ranges,t=0;t=0;i--){var s=e<0?Jn(t.node(0),t.node(i),t.before(i+1),t.index(i),e,r):Jn(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,e,r);if(s)return s}},it.near=function(t,e){return e===void 0&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new Er(t.node(0))},it.atStart=function(t){return Jn(t,t,0,0,1)||new Er(t)},it.atEnd=function(t){return Jn(t,t,t.content.size,t.childCount,-1)||new Er(t)},it.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var r=Ds[e.type];if(!r)throw new RangeError("No selection type "+e.type+" defined");return r.fromJSON(t,e)},it.jsonID=function(t,e){if(t in Ds)throw new RangeError("Duplicate use of selection JSON ID "+t);return Ds[t]=e,e.prototype.jsonID=t,e},it.prototype.getBookmark=function(){return Mr.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(it.prototype,Ue),it.prototype.visible=!0;var Qv=function(t,e){this.$from=t,this.$to=e},Mr=function(n){function t(r,o){o===void 0&&(o=r),n.call(this,r,o)}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={$cursor:{configurable:!0}};return e.$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 n.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=R.empty),n.prototype.replace.call(this,o,i),i==R.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 Cr(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 l=n.findFrom(i,s,!0)||n.findFrom(i,-s,!0);if(l)i=l.$head;else return n.near(i,s)}return o.parent.inlineContent||(a==0?o=i:(o=(n.findFrom(o,-s,!0)||n.findFrom(o,s,!0)).$anchor,o.pos0?0:1);o>0?s=0;s+=o){var a=t.child(s);if(a.isAtom){if(!i&&Hn.isSelectable(a))return Hn.create(n,e-(o<0?a.nodeSize:0))}else{var l=Jn(n,a,e+o,o<0?a.childCount:0,o,i);if(l)return l}e+=a.nodeSize*o}}function Ou(n,t,e){var r=n.steps.length-1;if(!(r0},t.prototype.setStoredMarks=function(o){return this.storedMarks=o,this.updated|=Co,this},t.prototype.ensureMarks=function(o){return q.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()))},e.storedMarksSet.get=function(){return(this.updated&Co)>0},t.prototype.addStep=function(o,i){n.prototype.addStep.call(this,o,i),this.updated=this.updated&~Co,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)||q.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 l=this.storedMarks;if(!l){var c=this.doc.resolve(i);l=s==i?c.marks():c.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(i,s,a.text(o,l)),this.selection.empty||this.setSelection(it.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]},e.isGeneric.get=function(){for(var r in this.meta)return!1;return!0},t.prototype.scrollIntoView=function(){return this.updated|=Tu,this},e.scrolledIntoView.get=function(){return(this.updated&Tu)>0},Object.defineProperties(t.prototype,e),t}(lt);function _u(n,t){return!t||!n?n:n.bind(t)}var Or=function(t,e,r){this.name=t,this.init=_u(e.init,r),this.apply=_u(e.apply,r)},eg=[new Or("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new Or("selection",{init:function(t,e){return t.selection||it.atStart(e.doc)},apply:function(t){return t.selection}}),new Or("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,r,o){return o.selection.$cursor?t.storedMarks:null}}),new Or("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],Rs=function(t,e){var r=this;this.schema=t,this.fields=eg.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach(function(o){if(r.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");r.plugins.push(o),r.pluginsByKey[o.key]=o,o.spec.state&&r.fields.push(new Or(o.key,o.spec.state,o))})},Pt=function(t){this.config=t},Eo={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};Eo.schema.get=function(){return this.config.schema},Eo.plugins.get=function(){return this.config.plugins},Pt.prototype.apply=function(t){return this.applyTransaction(t).state},Pt.prototype.filterTransaction=function(t,e){e===void 0&&(e=-1);for(var r=0;r-1&&Nr.splice(e,1)},Object.defineProperties(Pt.prototype,Eo);var Nr=[];function Au(n,t,e){for(var r in n){var o=n[r];o instanceof Function?o=o.bind(t):r=="handleDOMEvents"&&(o=Au(o,t,{})),e[r]=o}return e}var Du=function(t){this.props={},t.props&&Au(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:Ru("plugin")};Du.prototype.getState=function(t){return t[this.key]};var Vs=Object.create(null);function Ru(n){return n in Vs?n+"$"+ ++Vs[n]:(Vs[n]=0,n+"$")}var Is=function(t){t===void 0&&(t="key"),this.key=Ru(t)};Is.prototype.get=function(t){return t.config.pluginsByKey[this.key]},Is.prototype.getState=function(t){return t[this.key]};const ng=new Is("characterLimit"),rg=yt.create({name:"characterCount",addOptions(){return{limit:0}},addProseMirrorPlugins(){const{options:n}=this;return[new Du({key:ng,appendTransaction:(t,e,r)=>{const o=r.doc.content.size;if(n.limit&&o>n.limit)return r.tr.insertText("",n.limit+1,o)}})]}}),og=yt.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>n.style.textAlign||this.options.defaultAlignment,renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:t})=>this.options.alignments.includes(n)?this.options.types.every(e=>t.updateAttributes(e,{textAlign:n})):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.every(t=>n.resetAttributes(t,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),ig=bt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",pt(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n})=>n().insertContent({type:this.name}).command(({tr:t,dispatch:e})=>{var r;if(e){const{parent:o,pos:i}=t.selection.$from,s=i+1;if(t.doc.nodeAt(s))t.setSelection(K.create(t.doc,s));else{const l=(r=o.type.contentMatch.defaultType)===null||r===void 0?void 0:r.create();l&&(t.insert(s,l),t.setSelection(K.create(t.doc,s)))}t.scrollIntoView()}return!0}).run()}},addInputRules(){return[uc({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),sg=/(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))/;bt.create({name:"image",addOptions(){return{inline:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:"img[src]"}]},renderHTML({HTMLAttributes:n}){return["img",pt(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:t})=>t.insertContent({type:this.name,attrs:n})}},addInputRules(){return[uc({find:sg,type:this.type,getAttributes:n=>{const[,,t,e,r]=n;return{src:e,alt:t,title:r}}})]}});const ag=/^\s*([-+*])\s$/,Vu=bt.create({name:"bulletList",addOptions(){return{HTMLAttributes:{}}},group:"block list",content:"listItem+",parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n})=>n.toggleList("bulletList","listItem")}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){return[ao({find:ag,type:this.type})]}}),lg=/^(\d+)\.\s$/,Iu=bt.create({name:"orderedList",addOptions(){return{HTMLAttributes:{}}},group:"block list",content:"listItem+",addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const r=n,{start:t}=r,e=Gu(r,["start"]);return t===1?["ol",pt(this.options.HTMLAttributes,e),0]:["ol",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n})=>n.toggleList("orderedList","listItem")}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){return[ao({find:lg,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:(n,t)=>t.childCount+t.attrs.start===+n[1]})]}}),cg=bt.create({name:"taskList",addOptions(){return{HTMLAttributes:{}}},group:"block list",content:"taskItem+",parseHTML(){return[{tag:'ul[data-type="taskList"]',priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",pt(this.options.HTMLAttributes,n,{"data-type":"taskList"}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList("taskList","taskItem")}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),ug=/^\s*(\[([ |x])\])\s$/,fg=bt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{}}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>n.getAttribute("data-checked")==="true",renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:'li[data-type="taskItem"]',priority:51}]},renderHTML({node:n,HTMLAttributes:t}){return["li",pt(this.options.HTMLAttributes,t,{"data-type":"taskItem"}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem("taskItem"),"Shift-Tab":()=>this.editor.commands.liftListItem("taskItem")};return this.options.nested?Lt(x({},n),{Tab:()=>this.editor.commands.sinkListItem("taskItem")}):n},addNodeView(){return({node:n,HTMLAttributes:t,getPos:e,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");return i.contentEditable="false",a.type="checkbox",a.addEventListener("change",c=>{if(!r.isEditable){a.checked=!a.checked;return}const{checked:u}=c.target;r.isEditable&&typeof e=="function"&&r.chain().focus().command(({tr:p})=>(p.setNodeMarkup(e(),void 0,{checked:u}),!0)).run()}),Object.entries(this.options.HTMLAttributes).forEach(([c,u])=>{o.setAttribute(c,u)}),o.dataset.checked=n.attrs.checked,n.attrs.checked&&a.setAttribute("checked","checked"),i.append(a,s),o.append(i,l),Object.entries(t).forEach(([c,u])=>{o.setAttribute(c,u)}),{dom:o,contentDOM:l,update:c=>c.type!==this.type?!1:(o.dataset.checked=c.attrs.checked,c.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[ao({find:ug,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),pg=/^\s*>\s$/,dg=bt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block*",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn("blockquote"),toggleBlockquote:()=>({commands:n})=>n.toggleWrap("blockquote"),unsetBlockquote:()=>({commands:n})=>n.lift("blockquote")}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[ao({find:pg,type:this.type})]}}),hg=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,mg=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,vg=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,gg=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,yg=qe.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark("bold"),toggleBold:()=>({commands:n})=>n.toggleMark("bold"),unsetBold:()=>({commands:n})=>n.unsetMark("bold")}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold()}},addInputRules(){return[An({find:hg,type:this.type}),An({find:vg,type:this.type})]},addPasteRules(){return[Dn({find:mg,type:this.type}),Dn({find:gg,type:this.type})]}}),bg=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/,kg=/(?:^|\s)((?:`)((?:[^`]+))(?:`))/g,wg=qe.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark("code"),toggleCode:()=>({commands:n})=>n.toggleMark("code"),unsetCode:()=>({commands:n})=>n.unsetMark("code")}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[An({find:bg,type:this.type})]},addPasteRules(){return[Dn({find:kg,type:this.type})]}}),Sg=bt.create({name:"doc",topNode:!0,content:"block+"});function xg(n){return n===void 0&&(n={}),new Ht({view:function(e){return new we(e,n)}})}var we=function(t,e){var r=this;this.editorView=t,this.width=e.width||1,this.color=e.color||"black",this.class=e.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map(function(o){var i=function(s){return r[o](s)};return t.dom.addEventListener(o,i),{name:o,handler:i}})};we.prototype.destroy=function(){var t=this;this.handlers.forEach(function(e){var r=e.name,o=e.handler;return t.editorView.dom.removeEventListener(r,o)})},we.prototype.update=function(t,e){this.cursorPos!=null&&e.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())},we.prototype.setCursor=function(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},we.prototype.updateOverlay=function(){var t=this.editorView.state.doc.resolve(this.cursorPos),e;if(!t.parent.inlineContent){var r=t.nodeBefore,o=t.nodeAfter;if(r||o){var i=this.editorView.nodeDOM(this.cursorPos-(r?r.nodeSize:0)).getBoundingClientRect(),s=r?i.bottom:i.top;r&&o&&(s=(s+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),e={left:i.left,right:i.right,top:s-this.width/2,bottom:s+this.width/2}}}if(!e){var a=this.editorView.coordsAtPos(this.cursorPos);e={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}var l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{var p=l.getBoundingClientRect();c=p.left-l.scrollLeft,u=p.top-l.scrollTop}this.element.style.left=e.left-c+"px",this.element.style.top=e.top-u+"px",this.element.style.width=e.right-e.left+"px",this.element.style.height=e.bottom-e.top+"px"},we.prototype.scheduleRemoval=function(t){var e=this;clearTimeout(this.timeout),this.timeout=setTimeout(function(){return e.setCursor(null)},t)},we.prototype.dragover=function(t){if(!!this.editorView.editable){var e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY});if(e){var r=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice&&(r=ha(this.editorView.state.doc,r,this.editorView.dragging.slice),r==null))return this.setCursor(null);this.setCursor(r),this.scheduleRemoval(5e3)}}},we.prototype.dragend=function(){this.scheduleRemoval(20)},we.prototype.drop=function(){this.scheduleRemoval(20)},we.prototype.dragleave=function(t){(t.target==this.editorView.dom||!this.editorView.dom.contains(t.relatedTarget))&&this.setCursor(null)};const Mg=yt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:null}},addProseMirrorPlugins(){return[xg(this.options)]}});var pe=function(n){function t(e){n.call(this,e,e)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.map=function(r,o){var i=r.resolve(o.map(this.head));return t.valid(i)?new t(i):n.near(i)},t.prototype.content=function(){return T.empty},t.prototype.eq=function(r){return r instanceof t&&r.head==this.head},t.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},t.fromJSON=function(r,o){if(typeof o.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(r.resolve(o.pos))},t.prototype.getBookmark=function(){return new Oo(this.anchor)},t.valid=function(r){var o=r.parent;if(o.isTextblock||!Cg(r)||!Eg(r))return!1;var i=o.type.spec.allowGapCursor;if(i!=null)return i;var s=o.contentMatchAt(r.index()).defaultType;return s&&s.isTextblock},t.findFrom=function(r,o,i){t:for(;;){if(!i&&t.valid(r))return r;for(var s=r.pos,a=null,l=r.depth;;l--){var c=r.node(l);if(o>0?r.indexAfter(l)0){a=c.child(o>0?r.indexAfter(l):r.index(l)-1);break}else if(l==0)return null;s+=o;var u=r.doc.resolve(s);if(t.valid(u))return u}for(;;){var p=o>0?a.firstChild:a.lastChild;if(!p){if(a.isAtom&&!a.isText&&!P.isSelectable(a)){r=r.doc.resolve(s+a.nodeSize*o),i=!1;continue t}break}a=p,s+=o;var d=r.doc.resolve(s);if(t.valid(d))return d}return null}},t}(z);pe.prototype.visible=!1,z.jsonID("gapcursor",pe);var Oo=function(t){this.pos=t};Oo.prototype.map=function(t){return new Oo(t.map(this.pos))},Oo.prototype.resolve=function(t){var e=t.resolve(this.pos);return pe.valid(e)?new pe(e):z.near(e)};function Cg(n){for(var t=n.depth;t>=0;t--){var e=n.index(t);if(e!=0)for(var r=n.node(t).child(e-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function Eg(n){for(var t=n.depth;t>=0;t--){var e=n.indexAfter(t),r=n.node(t);if(e!=r.childCount)for(var o=r.child(e);;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 Og=function(){return new Ht({props:{decorations:_g,createSelectionBetween:function(t,e,r){if(e.pos==r.pos&&pe.valid(r))return new pe(r)},handleClick:Tg,handleKeyDown:Ng}})},Ng=Gl({ArrowLeft:No("horiz",-1),ArrowRight:No("horiz",1),ArrowUp:No("vert",-1),ArrowDown:No("vert",1)});function No(n,t){var e=n=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,o,i){var s=r.selection,a=t>0?s.$to:s.$from,l=s.empty;if(s instanceof K){if(!i.endOfTextblock(e)||a.depth==0)return!1;l=!1,a=r.doc.resolve(t>0?a.after():a.before())}var c=pe.findFrom(a,t,l);return c?(o&&o(r.tr.setSelection(new pe(c))),!0):!1}}function Tg(n,t,e){if(!n.editable)return!1;var r=n.state.doc.resolve(t);if(!pe.valid(r))return!1;var o=n.posAtCoords({left:e.clientX,top:e.clientY}),i=o.inside;return i>-1&&P.isSelectable(n.state.doc.nodeAt(i))?!1:(n.dispatch(n.state.tr.setSelection(new pe(r))),!0)}function _g(n){if(!(n.selection instanceof pe))return null;var t=document.createElement("div");return t.className="ProseMirror-gapcursor",Y.create(n.doc,[ut.widget(n.selection.head,t,{key:"gapcursor"})])}const Ag=yt.create({name:"gapCursor",addProseMirrorPlugins(){return[Og()]},extendNodeSchema(n){var t;const e={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(t=L(_(n,"allowGapCursor",e)))!==null&&t!==void 0?t:null}}}),Dg=bt.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",pt(this.options.HTMLAttributes,n)]},renderText(){return` -`},addCommands(){return{setHardBreak:()=>({commands:n,chain:t,state:e,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:o,storedMarks:i}=e;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,l=i||o.$to.parentOffset&&o.$from.marks();return t().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&s){const p=l.filter(d=>a.includes(d.type.name));c.ensureMarks(p)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Rg=bt.create({name:"heading",addOptions(){return{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(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:t}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:n=>({commands:t})=>this.options.levels.includes(n.level)?t.setNode("heading",n):!1,toggleHeading:n=>({commands:t})=>this.options.levels.includes(n.level)?t.toggleNode("heading","paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,t)=>Lt(x({},n),{[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(n=>ts({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var To=200,wt=function(){};wt.prototype.append=function(t){return t.length?(t=wt.from(t),!this.length&&t||t.length=e?wt.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},wt.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},wt.prototype.forEach=function(t,e,r){e===void 0&&(e=0),r===void 0&&(r=this.length),e<=r?this.forEachInner(t,e,r,0):this.forEachInvertedInner(t,e,r,0)},wt.prototype.map=function(t,e,r){e===void 0&&(e=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(t(i,s))},e,r),o},wt.from=function(t){return t instanceof wt?t:t&&t.length?new Bu(t):wt.empty};var Bu=function(n){function t(r){n.call(this),this.values=r}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={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 l=i;l=s;l--)if(o(this.values[l],a+l)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=To)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=To)return new t(o.flatten().concat(this.values))},e.length.get=function(){return this.values.length},e.depth.get=function(){return 0},Object.defineProperties(t.prototype,e),t}(wt);wt.empty=new Bu([]);var Vg=function(n){function t(e,r){n.call(this),this.left=e,this.right=r,this.length=e.length+r.length,this.depth=Math.max(e.depth,r.depth)+1}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return ra&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},t.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},t.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new t(this.left,o)},t.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new t(o,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(wt),Pu=wt,Ig=500,St=function(t,e){this.items=t,this.eventCount=e};St.prototype.popEvent=function(t,e){var r=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;e&&(s=this.remapping(o,this.items.length),a=s.maps.length);var l=t.tr,c,u,p=[],d=[];return this.items.forEach(function(h,m){if(!h.step){s||(s=r.remapping(o,m+1),a=s.maps.length),a--,d.push(h);return}if(s){d.push(new Se(h.map));var g=h.step.map(s.slice(a)),y;g&&l.maybeStep(g).doc&&(y=l.mapping.maps[l.mapping.maps.length-1],p.push(new Se(y,null,null,p.length+d.length))),a--,y&&s.appendMap(y,a)}else l.maybeStep(h.step);if(h.selection)return c=s?h.selection.map(s.slice(a)):h.selection,u=new St(r.items.slice(0,o).append(d.reverse().concat(p)),r.eventCount-1),!1},this.items.length,0),{remaining:u,transform:l,selection:c}},St.prototype.addTransform=function(t,e,r,o){for(var i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null,c=0;cPg&&(a=Bg(a,h),s-=h),new St(a.append(i),s)},St.prototype.remapping=function(t,e){var r=new Mt;return this.items.forEach(function(o,i){var s=o.mirrorOffset!=null&&i-o.mirrorOffset>=t?r.maps.length-o.mirrorOffset:null;r.appendMap(o.map,s)},t,e),r},St.prototype.addMaps=function(t){return this.eventCount==0?this:new St(this.items.append(t.map(function(e){return new Se(e)})),this.eventCount)},St.prototype.rebased=function(t,e){if(!this.eventCount)return this;var r=[],o=Math.max(0,this.items.length-e),i=t.mapping,s=t.steps.length,a=this.eventCount;this.items.forEach(function(h){h.selection&&a--},o);var l=e;this.items.forEach(function(h){var m=i.getMirror(--l);if(m!=null){s=Math.min(s,m);var g=i.maps[m];if(h.step){var y=t.steps[m].invert(t.docs[m]),k=h.selection&&h.selection.map(i.slice(l+1,m));k&&a++,r.push(new Se(g,y,k))}else r.push(new Se(g))}},o);for(var c=[],u=e;uIg&&(d=d.compress(this.items.length-r.length)),d},St.prototype.emptyItemCount=function(){var t=0;return this.items.forEach(function(e){e.step||t++}),t},St.prototype.compress=function(t){t===void 0&&(t=this.items.length);var e=this.remapping(0,t),r=e.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 l=s.step.map(e.slice(r)),c=l&&l.getMap();if(r--,c&&e.appendMap(c,r),l){var u=s.selection&&s.selection.map(e.slice(r));u&&i++;var p=new Se(c.invert(),l,u),d,h=o.length-1;(d=o.length&&o[h].merge(p))?o[h]=d:o.push(p)}}else s.map&&r--},this.items.length,0),new St(Pu.from(o.reverse()),i)},St.empty=new St(Pu.empty,0);function Bg(n,t){var e;return n.forEach(function(r,o){if(r.selection&&t--==0)return e=o,!1}),n.slice(e)}var Se=function(t,e,r,o){this.map=t,this.step=e,this.selection=r,this.mirrorOffset=o};Se.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new Se(e.getMap().invert(),e,this.selection)}};var Ge=function(t,e,r,o){this.done=t,this.undone=e,this.prevRanges=r,this.prevTime=o},Pg=20;function zg(n,t,e,r){var o=e.getMeta(Ye),i;if(o)return o.historyState;e.getMeta(Fg)&&(n=new Ge(n.done,n.undone,null,0));var s=e.getMeta("appendedTransaction");if(e.steps.length==0)return n;if(s&&s.getMeta(Ye))return s.getMeta(Ye).redo?new Ge(n.done.addTransform(e,null,r,_o(t)),n.undone,zu(e.mapping.maps[e.steps.length-1]),n.prevTime):new Ge(n.done,n.undone.addTransform(e,null,r,_o(t)),null,n.prevTime);if(e.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){var a=n.prevTime==0||!s&&(n.prevTime<(e.time||0)-r.newGroupDelay||!Lg(e,n.prevRanges)),l=s?Bs(n.prevRanges,e.mapping):zu(e.mapping.maps[e.steps.length-1]);return new Ge(n.done.addTransform(e,a?t.selection.getBookmark():null,r,_o(t)),St.empty,l,e.time)}else return(i=e.getMeta("rebased"))?new Ge(n.done.rebased(e,i),n.undone.rebased(e,i),Bs(n.prevRanges,e.mapping),n.prevTime):new Ge(n.done.addMaps(e.mapping.maps),n.undone.addMaps(e.mapping.maps),Bs(n.prevRanges,e.mapping),n.prevTime)}function Lg(n,t){if(!t)return!1;if(!n.docChanged)return!0;var e=!1;return n.mapping.maps[0].forEach(function(r,o){for(var i=0;i=t[i]&&(e=!0)}),e}function zu(n){var t=[];return n.forEach(function(e,r,o,i){return t.push(o,i)}),t}function Bs(n,t){if(!n)return null;for(var e=[],r=0;r({state:n,dispatch:t})=>Hu(n,t),redo:()=>({state:n,dispatch:t})=>Ju(n,t)}},addProseMirrorPlugins(){return[Hg(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()}}}),$g=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,qg=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,jg=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,Wg=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,Kg=qe.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark("italic"),toggleItalic:()=>({commands:n})=>n.toggleMark("italic"),unsetItalic:()=>({commands:n})=>n.unsetMark("italic")}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[An({find:$g,type:this.type}),An({find:jg,type:this.type})]},addPasteRules(){return[Dn({find:qg,type:this.type}),Dn({find:Wg,type:this.type})]}}),Ug=bt.create({name:"listItem",addOptions(){return{HTMLAttributes:{}}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",pt(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem("listItem"),Tab:()=>this.editor.commands.sinkListItem("listItem"),"Shift-Tab":()=>this.editor.commands.liftListItem("listItem")}}}),Gg=bt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode("paragraph")}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Yg=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,Xg=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,Qg=qe.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark("strike"),toggleStrike:()=>({commands:n})=>n.toggleMark("strike"),unsetStrike:()=>({commands:n})=>n.unsetMark("strike")}},addKeyboardShortcuts(){return{"Mod-Shift-x":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[An({find:Yg,type:this.type})]},addPasteRules(){return[Dn({find:Xg,type:this.type})]}}),Zg=bt.create({name:"text",group:"inline"}),ty=yt.create({name:"starterKit",addExtensions(){var n,t,e,r,o,i,s,a,l,c,u,p,d,h,m,g,y,k;const b=[];return this.options.blockquote!==!1&&b.push(dg.configure((n=this.options)===null||n===void 0?void 0:n.blockquote)),this.options.bold!==!1&&b.push(yg.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.bulletList!==!1&&b.push(Vu.configure((e=this.options)===null||e===void 0?void 0:e.bulletList)),this.options.code!==!1&&b.push(wg.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&b.push(Xc.configure((o=this.options)===null||o===void 0?void 0:o.codeBlock)),this.options.document!==!1&&b.push(Sg.configure((i=this.options)===null||i===void 0?void 0:i.document)),this.options.dropcursor!==!1&&b.push(Mg.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&b.push(Ag.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&b.push(Dg.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&b.push(Rg.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&b.push(Jg.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&b.push(ig.configure((p=this.options)===null||p===void 0?void 0:p.horizontalRule)),this.options.italic!==!1&&b.push(Kg.configure((d=this.options)===null||d===void 0?void 0:d.italic)),this.options.listItem!==!1&&b.push(Ug.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&b.push(Iu.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&b.push(Gg.configure((g=this.options)===null||g===void 0?void 0:g.paragraph)),this.options.strike!==!1&&b.push(Qg.configure((y=this.options)===null||y===void 0?void 0:y.strike)),this.options.text!==!1&&b.push(Zg.configure((k=this.options)===null||k===void 0?void 0:k.text)),b}});var ak="",Ao=(n,t)=>{for(const[e,r]of t)n[e]=r;return n};const ey={components:{EditorContent:Mv,BubbleMenu:Sv},props:{modelValue:{type:String,default:""},maxChars:{type:Number,default:0},bubbleMenu:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},bold:{type:Boolean,default:!0},italic:{type:Boolean,default:!0},strike:{type:Boolean,default:!0},underline:{type:Boolean,default:!0},code:{type:Boolean,default:!0},codeBlock:{type:Boolean,default:!0},blockquote:{type:Boolean,default:!0},bulletList:{type:Boolean,default:!0},orderedList:{type:Boolean,default:!0},taskList:{type:Boolean,default:!0},heading:{type:Boolean,default:!0},textAlign:{type:Boolean,default:!0},horizontalRule:{type:Boolean,default:!0},undoRedo:{type:Boolean,default:!0}},data(){return{editor:null,headingOpen:!1,alignOpen:!1}},watch:{modelValue(n){this.editor.getHTML()!==n&&this.editor.commands.setContent(this.modelValue,!1)},disabled(n){this.editor&&this.editor.setEditable(!n)}},methods:{insertImageFromURL(n){this.editor.chain().focus().setImage({src:n},!1).run()}},computed:{extensions(){return[ty,Ov,og,Xc,Iu.configure({class:"inline-flex"}),Vu.configure({class:"inline-flex"}),rg.configure({limit:this.maxChars}),cg,fg]},hasTextAlign(){return this.editor.isActive({textAlign:"left"})||this.editor.isActive({textAlign:"right"})||this.editor.isActive({textAlign:"center"})||this.editor.isActive({textAlign:"justify"})},charPercentage(){return Math.round(100/this.maxChars*this.editor.getCharacterCount())}},mounted(){this.editor=new xv({content:this.modelValue,extensions:this.extensions,editorProps:{attributes:{class:"h-full overflow-y-auto input"}},editable:!this.disabled}).on("update",({editor:n})=>{this.$emit("update:modelValue",n.getHTML())}),this.$watch(()=>this.maxChars,()=>{})},beforeUnmount(){this.editor.destroy()}},ny=["aria-label"],ry=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7h-6z"}),f.createElementVNode("path",{d:"M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7"})],-1)],oy=["aria-label"],iy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"11",y1:"5",x2:"17",y2:"5"}),f.createElementVNode("line",{x1:"7",y1:"19",x2:"13",y2:"19"}),f.createElementVNode("line",{x1:"14",y1:"5",x2:"10",y2:"19"})],-1)],sy=["aria-label"],ay=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M7 5v9a5 5 0 0 0 10 0v-9"}),f.createElementVNode("path",{d:"M4 12h16"})],-1)],ly=["aria-label"],cy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M7 5v5a5 5 0 0 0 10 0v-5"}),f.createElementVNode("path",{d:"M5 19h14"})],-1)],uy=["aria-label"],fy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("polyline",{points:"7 8 3 12 7 16"}),f.createElementVNode("polyline",{points:"17 8 21 12 17 16"}),f.createElementVNode("line",{x1:"14",y1:"4",x2:"10",y2:"20"})],-1)],py=["aria-label"],dy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),f.createElementVNode("path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"}),f.createElementVNode("path",{d:"M10 13l-1 2l1 2"}),f.createElementVNode("path",{d:"M14 13l1 2l-1 2"})],-1)],hy=["aria-label"],my=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M6 15h15"}),f.createElementVNode("path",{d:"M21 19h-15"}),f.createElementVNode("path",{d:"M15 11h6"}),f.createElementVNode("path",{d:"M21 7h-6"}),f.createElementVNode("path",{d:"M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"}),f.createElementVNode("path",{d:"M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"})],-1)],vy=["aria-label"],gy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"9",y1:"6",x2:"20",y2:"6"}),f.createElementVNode("line",{x1:"9",y1:"12",x2:"20",y2:"12"}),f.createElementVNode("line",{x1:"9",y1:"18",x2:"20",y2:"18"}),f.createElementVNode("line",{x1:"5",y1:"6",x2:"5",y2:"6.01"}),f.createElementVNode("line",{x1:"5",y1:"12",x2:"5",y2:"12.01"}),f.createElementVNode("line",{x1:"5",y1:"18",x2:"5",y2:"18.01"})],-1)],yy=["aria-label"],by=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M11 6h9"}),f.createElementVNode("path",{d:"M11 12h9"}),f.createElementVNode("path",{d:"M12 18h8"}),f.createElementVNode("path",{d:"M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4"}),f.createElementVNode("path",{d:"M6 10v-6l-2 2"})],-1)],ky=["aria-label"],wy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M3.5 5.5l1.5 1.5l2.5 -2.5"}),f.createElementVNode("path",{d:"M3.5 11.5l1.5 1.5l2.5 -2.5"}),f.createElementVNode("path",{d:"M3.5 17.5l1.5 1.5l2.5 -2.5"}),f.createElementVNode("line",{x1:"11",y1:"6",x2:"20",y2:"6"}),f.createElementVNode("line",{x1:"11",y1:"12",x2:"20",y2:"12"}),f.createElementVNode("line",{x1:"11",y1:"18",x2:"20",y2:"18"})],-1)],Sy={key:10},xy=["aria-label"],My=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M7 12h10"}),f.createElementVNode("path",{d:"M7 4v16"}),f.createElementVNode("path",{d:"M17 4v16"}),f.createElementVNode("path",{d:"M15 20h4"}),f.createElementVNode("path",{d:"M15 4h4"}),f.createElementVNode("path",{d:"M5 20h4"}),f.createElementVNode("path",{d:"M5 4h4"})],-1)],Cy={key:0,class:"mx-1 inline-flex space-x-1"},Ey=["aria-label"],Oy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M19 18v-8l-2 2"}),f.createElementVNode("path",{d:"M4 6v12"}),f.createElementVNode("path",{d:"M12 6v12"}),f.createElementVNode("path",{d:"M11 18h2"}),f.createElementVNode("path",{d:"M3 18h2"}),f.createElementVNode("path",{d:"M4 12h8"}),f.createElementVNode("path",{d:"M3 6h2"}),f.createElementVNode("path",{d:"M11 6h2"})],-1)],Ny=["aria-label"],Ty=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 -.001"}),f.createElementVNode("path",{d:"M4 6v12"}),f.createElementVNode("path",{d:"M12 6v12"}),f.createElementVNode("path",{d:"M11 18h2"}),f.createElementVNode("path",{d:"M3 18h2"}),f.createElementVNode("path",{d:"M4 12h8"}),f.createElementVNode("path",{d:"M3 6h2"}),f.createElementVNode("path",{d:"M11 6h2"})],-1)],_y=["aria-label"],Ay=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M19 14a2 2 0 1 0 -2 -2"}),f.createElementVNode("path",{d:"M17 16a2 2 0 1 0 2 -2"}),f.createElementVNode("path",{d:"M4 6v12"}),f.createElementVNode("path",{d:"M12 6v12"}),f.createElementVNode("path",{d:"M11 18h2"}),f.createElementVNode("path",{d:"M3 18h2"}),f.createElementVNode("path",{d:"M4 12h8"}),f.createElementVNode("path",{d:"M3 6h2"}),f.createElementVNode("path",{d:"M11 6h2"})],-1)],Dy=["aria-label"],Ry=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M20 18v-8l-4 6h5"}),f.createElementVNode("path",{d:"M4 6v12"}),f.createElementVNode("path",{d:"M12 6v12"}),f.createElementVNode("path",{d:"M11 18h2"}),f.createElementVNode("path",{d:"M3 18h2"}),f.createElementVNode("path",{d:"M4 12h8"}),f.createElementVNode("path",{d:"M3 6h2"}),f.createElementVNode("path",{d:"M11 6h2"})],-1)],Vy=["aria-label"],Iy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M17 18h2a2 2 0 1 0 0 -4h-2v-4h4"}),f.createElementVNode("path",{d:"M4 6v12"}),f.createElementVNode("path",{d:"M12 6v12"}),f.createElementVNode("path",{d:"M11 18h2"}),f.createElementVNode("path",{d:"M3 18h2"}),f.createElementVNode("path",{d:"M4 12h8"}),f.createElementVNode("path",{d:"M3 6h2"}),f.createElementVNode("path",{d:"M11 6h2"})],-1)],By=["aria-label"],Py=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("circle",{transform:"rotate(180 19 16)",cx:"19",cy:"16",r:"2"}),f.createElementVNode("path",{d:"M21 12a2 2 0 1 0 -4 0v4"}),f.createElementVNode("path",{d:"M4 6v12"}),f.createElementVNode("path",{d:"M12 6v12"}),f.createElementVNode("path",{d:"M11 18h2"}),f.createElementVNode("path",{d:"M3 18h2"}),f.createElementVNode("path",{d:"M4 12h8"}),f.createElementVNode("path",{d:"M3 6h2"}),f.createElementVNode("path",{d:"M11 6h2"})],-1)],zy={key:11},Ly=["aria-label"],Fy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),f.createElementVNode("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),f.createElementVNode("line",{x1:"6",y1:"18",x2:"18",y2:"18"})],-1)],Hy={key:0,class:"inline-flex mx-1 space-x-1"},Jy=["aria-label"],$y=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),f.createElementVNode("line",{x1:"4",y1:"12",x2:"14",y2:"12"}),f.createElementVNode("line",{x1:"4",y1:"18",x2:"18",y2:"18"})],-1)],qy=["aria-label"],jy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),f.createElementVNode("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),f.createElementVNode("line",{x1:"6",y1:"18",x2:"18",y2:"18"})],-1)],Wy=["aria-label"],Ky=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),f.createElementVNode("line",{x1:"10",y1:"12",x2:"20",y2:"12"}),f.createElementVNode("line",{x1:"6",y1:"18",x2:"20",y2:"18"})],-1)],Uy=["aria-label"],Gy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),f.createElementVNode("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),f.createElementVNode("line",{x1:"4",y1:"18",x2:"16",y2:"18"})],-1)],Yy=["aria-label"],Xy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"4",y1:"7",x2:"20",y2:"7"}),f.createElementVNode("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),f.createElementVNode("line",{x1:"14",y1:"11",x2:"14",y2:"17"}),f.createElementVNode("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),f.createElementVNode("path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"})],-1)],Qy=["aria-label"],Zy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),f.createElementVNode("line",{x1:"4",y1:"4",x2:"4",y2:"4.01"}),f.createElementVNode("line",{x1:"8",y1:"4",x2:"8",y2:"4.01"}),f.createElementVNode("line",{x1:"12",y1:"4",x2:"12",y2:"4.01"}),f.createElementVNode("line",{x1:"16",y1:"4",x2:"16",y2:"4.01"}),f.createElementVNode("line",{x1:"20",y1:"4",x2:"20",y2:"4.01"}),f.createElementVNode("line",{x1:"4",y1:"8",x2:"4",y2:"8.01"}),f.createElementVNode("line",{x1:"12",y1:"8",x2:"12",y2:"8.01"}),f.createElementVNode("line",{x1:"20",y1:"8",x2:"20",y2:"8.01"}),f.createElementVNode("line",{x1:"4",y1:"16",x2:"4",y2:"16.01"}),f.createElementVNode("line",{x1:"12",y1:"16",x2:"12",y2:"16.01"}),f.createElementVNode("line",{x1:"20",y1:"16",x2:"20",y2:"16.01"}),f.createElementVNode("line",{x1:"4",y1:"20",x2:"4",y2:"20.01"}),f.createElementVNode("line",{x1:"8",y1:"20",x2:"8",y2:"20.01"}),f.createElementVNode("line",{x1:"12",y1:"20",x2:"12",y2:"20.01"}),f.createElementVNode("line",{x1:"16",y1:"20",x2:"16",y2:"20.01"}),f.createElementVNode("line",{x1:"20",y1:"20",x2:"20",y2:"20.01"})],-1)],t0=["aria-label"],e0=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M9 13l-4 -4l4 -4m-4 4h11a4 4 0 0 1 0 8h-1"})],-1)],n0=["aria-label"],r0=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M15 13l4 -4l-4 -4m4 4h-11a4 4 0 0 0 0 8h1"})],-1)];function o0(n,t,e,r,o,i){const s=f.resolveComponent("CollapseXTransition"),a=f.resolveComponent("editor-content"),l=f.resolveDirective("tooltip");return f.openBlock(),f.createElementBlock("div",null,[f.createElementVNode("div",null,[o.editor?(f.openBlock(),f.createBlock(f.resolveDynamicComponent(e.bubbleMenu?"bubble-menu":"div"),{key:0,editor:o.editor,class:f.normalizeClass(["flex-wrap space-x-1",e.bubbleMenu?"bg-gray-600 rounded dark p-1":"mb-2"])},{default:f.withCtx(()=>[e.bold?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:0,"aria-label":n.__("tiptap::tiptap.bold"),onClick:t[0]||(t[0]=c=>o.editor.chain().focus().toggleBold().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("bold")}])},ry,10,ny)),[[l,n.__("tiptap::tiptap.bold")]]):f.createCommentVNode("",!0),e.italic?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:1,"aria-label":n.__("tiptap::tiptap.italic"),onClick:t[1]||(t[1]=c=>o.editor.chain().focus().toggleItalic().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("italic")}])},iy,10,oy)),[[l,n.__("tiptap::tiptap.italic")]]):f.createCommentVNode("",!0),e.strike?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:2,"aria-label":n.__("tiptap::tiptap.strike"),onClick:t[2]||(t[2]=c=>o.editor.chain().focus().toggleStrike().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("strike")}])},ay,10,sy)),[[l,n.__("tiptap::tiptap.strike")]]):f.createCommentVNode("",!0),e.underline?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:3,"aria-label":n.__("tiptap::tiptap.underline"),onClick:t[3]||(t[3]=c=>o.editor.chain().focus().toggleUnderline().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("underline")}])},cy,10,ly)),[[l,n.__("tiptap::tiptap.underline")]]):f.createCommentVNode("",!0),e.code?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:4,"aria-label":n.__("tiptap::tiptap.code"),onClick:t[4]||(t[4]=c=>o.editor.chain().focus().toggleCode().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("code")}])},fy,10,uy)),[[l,n.__("tiptap::tiptap.code")]]):f.createCommentVNode("",!0),e.codeBlock?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:5,"aria-label":n.__("tiptap::tiptap.code_block"),onClick:t[5]||(t[5]=c=>o.editor.chain().focus().toggleCodeBlock().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("codeBlock")}])},dy,10,py)),[[l,n.__("tiptap::tiptap.code_block")]]):f.createCommentVNode("",!0),e.blockquote?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:6,"aria-label":n.__("tiptap::tiptap.blockquote"),onClick:t[6]||(t[6]=c=>o.editor.chain().focus().toggleBlockquote().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("blockquote")}])},my,10,hy)),[[l,n.__("tiptap::tiptap.blockquote")]]):f.createCommentVNode("",!0),e.bulletList?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:7,"aria-label":n.__("tiptap::tiptap.bullet_list"),onClick:t[7]||(t[7]=c=>o.editor.chain().focus().toggleBulletList().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("bulletList")}])},gy,10,vy)),[[l,n.__("tiptap::tiptap.bullet_list")]]):f.createCommentVNode("",!0),e.orderedList?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:8,"aria-label":n.__("tiptap::tiptap.ordered_list"),onClick:t[8]||(t[8]=c=>o.editor.chain().focus().toggleOrderedList().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("orderedList")}])},by,10,yy)),[[l,n.__("tiptap::tiptap.ordered_list")]]):f.createCommentVNode("",!0),e.taskList?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:9,"aria-label":n.__("tiptap::tiptap.task_list"),onClick:t[9]||(t[9]=c=>o.editor.chain().focus().toggleTaskList().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("taskList")}])},wy,10,ky)),[[l,n.__("tiptap::tiptap.task_list")]]):f.createCommentVNode("",!0),e.heading?(f.openBlock(),f.createElementBlock("span",Sy,[f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive("heading")}]),onClick:t[10]||(t[10]=c=>{o.headingOpen=!o.headingOpen,o.alignOpen=!1}),"aria-label":n.__("tiptap::tiptap.heading")},My,10,xy),[[l,n.__("tiptap::tiptap.heading")]]),f.createVNode(s,null,{default:f.withCtx(()=>[o.headingOpen?(f.openBlock(),f.createElementBlock("div",Cy,[f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive("heading",{level:1})}]),"aria-label":`${n.__("tiptap::tiptap.heading")} 1`,onClick:t[11]||(t[11]=c=>o.editor.chain().focus().toggleHeading({level:1}).run())},Oy,10,Ey),[[l,`${n.__("tiptap::tiptap.heading")} 1`]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive("heading",{level:2})}]),"aria-label":`${n.__("tiptap::tiptap.heading")} 2`,onClick:t[12]||(t[12]=c=>o.editor.chain().focus().toggleHeading({level:2}).run())},Ty,10,Ny),[[l,`${n.__("tiptap::tiptap.heading")} 2`]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive("heading",{level:3})}]),"aria-label":`${n.__("tiptap::tiptap.heading")} 3`,onClick:t[13]||(t[13]=c=>o.editor.chain().focus().toggleHeading({level:3}).run())},Ay,10,_y),[[l,`${n.__("tiptap::tiptap.heading")} 3`]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive("heading",{level:4})}]),"aria-label":`${n.__("tiptap::tiptap.heading")} 4`,onClick:t[14]||(t[14]=c=>o.editor.chain().focus().toggleHeading({level:4}).run())},Ry,10,Dy),[[l,`${n.__("tiptap::tiptap.heading")} 4`]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive("heading",{level:5})}]),"aria-label":`${n.__("tiptap::tiptap.heading")} 5`,onClick:t[15]||(t[15]=c=>o.editor.chain().focus().toggleHeading({level:5}).run())},Iy,10,Vy),[[l,`${n.__("tiptap::tiptap.heading")} 5`]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive("heading",{level:6})}]),"aria-label":`${n.__("tiptap::tiptap.heading")} 6`,onClick:t[16]||(t[16]=c=>o.editor.chain().focus().toggleHeading({level:6}).run())},Py,10,By),[[l,`${n.__("tiptap::tiptap.heading")} 6`]])])):f.createCommentVNode("",!0)]),_:1})])):f.createCommentVNode("",!0),e.textAlign?(f.openBlock(),f.createElementBlock("span",zy,[f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:i.hasTextAlign}]),onClick:t[17]||(t[17]=c=>{o.alignOpen=!o.alignOpen,o.headingOpen=!1}),"aria-label":n.__("tiptap::tiptap.text_align")},Fy,10,Ly),[[l,n.__("tiptap::tiptap.text_align")]]),f.createVNode(s,null,{default:f.withCtx(()=>[o.alignOpen?(f.openBlock(),f.createElementBlock("div",Hy,[f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive({textAlign:"left"})}]),"aria-label":n.__("tiptap::tiptap.left"),onClick:t[18]||(t[18]=c=>o.editor.chain().focus().setTextAlign("left").run())},$y,10,Jy),[[l,n.__("tiptap::tiptap.left")]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive({textAlign:"center"})}]),"aria-label":n.__("tiptap::tiptap.center"),onClick:t[19]||(t[19]=c=>o.editor.chain().focus().setTextAlign("center").run())},jy,10,qy),[[l,n.__("tiptap::tiptap.center")]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive({textAlign:"right"})}]),"aria-label":n.__("tiptap::tiptap.right"),onClick:t[20]||(t[20]=c=>o.editor.chain().focus().setTextAlign("right").run())},Ky,10,Wy),[[l,n.__("tiptap::tiptap.right")]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive({textAlign:"justify"})}]),"aria-label":n.__("tiptap::tiptap.justify"),onClick:t[21]||(t[21]=c=>o.editor.chain().focus().setTextAlign("justify").run())},Gy,10,Uy),[[l,n.__("tiptap::tiptap.justify")]]),f.withDirectives(f.createElementVNode("button",{class:"button","aria-label":n.__("tiptap::tiptap.clear"),onClick:t[22]||(t[22]=c=>o.editor.chain().focus().unsetTextAlign().run())},Xy,8,Yy),[[l,n.__("tiptap::tiptap.clear")]])])):f.createCommentVNode("",!0)]),_:1})])):f.createCommentVNode("",!0),e.horizontalRule?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:12,"aria-label":n.__("tiptap::tiptap.horizontal_rule"),onClick:t[23]||(t[23]=c=>o.editor.chain().focus().setHorizontalRule().run()),class:"button"},Zy,8,Qy)),[[l,n.__("tiptap::tiptap.horizontal_rule")]]):f.createCommentVNode("",!0),e.undoRedo?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:13,"aria-label":n.__("tiptap::tiptap.undo"),onClick:t[24]||(t[24]=c=>o.editor.chain().focus().undo().run()),class:"button"},e0,8,t0)),[[l,n.__("tiptap::tiptap.undo")]]):f.createCommentVNode("",!0),e.undoRedo?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:14,"aria-label":n.__("tiptap::tiptap.redo"),onClick:t[25]||(t[25]=c=>o.editor.chain().focus().redo().run()),class:"button"},r0,8,n0)),[[l,n.__("tiptap::tiptap.redo")]]):f.createCommentVNode("",!0)]),_:1},8,["editor","class"])):f.createCommentVNode("",!0)]),f.createVNode(a,{editor:o.editor,class:"min-h-64 h-64",onClick:t[26]||(t[26]=c=>{o.headingOpen=!1,o.alignOpen=!1})},null,8,["editor"]),o.editor&&e.maxChars>0?(f.openBlock(),f.createElementBlock("div",{key:0,class:f.normalizeClass(["w-full",i.charPercentage>90?"text-red-500":i.charPercentage>75?"text-yellow-500":null])},f.toDisplayString(n.__("tiptap::tiptap.character_count",{chars:o.editor.getCharacterCount(),max:e.maxChars})),3)):f.createCommentVNode("",!0)])}var $u=Ao(ey,[["render",o0]]);const i0={components:{Tiptap:$u},data(){return{bubbleMenu:!1,maxChars:280,content:"

This is tiptap 2 in Voyager II using Vue 3 \u{1F389}

",disabled:!1,bold:!0,italic:!0,strike:!0,underline:!0,code:!0,codeBlock:!0,blockquote:!0,bulletList:!0,orderedList:!0,taskList:!0,heading:!0,textAlign:!0,horizontalRule:!0,undoRedo:!0}}},s0={class:"flex space-x-2"},a0={class:"input-group"},l0=f.createElementVNode("label",{for:"bubble",class:"label"},"Bubble menu",-1),c0={class:"mt-1"},u0={class:"input-group"},f0=f.createElementVNode("label",{for:"maxChars",class:"label"},"Max characters (0 = infinite)",-1),p0={class:"mt-1"},d0={class:"input-group"},h0=f.createElementVNode("label",{for:"disabled",class:"label"},"Disabled",-1),m0={class:"mt-1"},v0={class:"flex flex-wrap space-x-2 mt-4"},g0={class:"input-group"},y0={for:"bold",class:"label"},b0={class:"mt-1"},k0={class:"input-group"},w0={for:"italic",class:"label"},S0={class:"mt-1"},x0={class:"input-group"},M0={for:"strike",class:"label"},C0={class:"mt-1"},E0={class:"input-group"},O0={for:"underline",class:"label"},N0={class:"mt-1"},T0={class:"input-group"},_0={for:"code",class:"label"},A0={class:"mt-1"},D0={class:"input-group"},R0={for:"codeBlock",class:"label"},V0={class:"mt-1"},I0={class:"input-group"},B0={for:"blockquote",class:"label"},P0={class:"mt-1"},z0={class:"input-group"},L0={for:"bulletList",class:"label"},F0={class:"mt-1"},H0={class:"input-group"},J0={for:"orderedList",class:"label"},$0={class:"mt-1"},q0={class:"input-group"},j0={for:"taskList",class:"label"},W0={class:"mt-1"},K0={class:"input-group"},U0={for:"heading",class:"label"},G0={class:"mt-1"},Y0={class:"input-group"},X0={for:"textAlign",class:"label"},Q0={class:"mt-1"},Z0={class:"input-group"},tb={for:"horizontalRule",class:"label"},eb={class:"mt-1"},nb={class:"input-group"},rb={for:"undoRedo",class:"label"},ob={class:"mt-1"};function ib(n,t,e,r,o,i){const s=f.resolveComponent("tiptap"),a=f.resolveComponent("collapsible");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createVNode(s,{bubbleMenu:o.bubbleMenu,maxChars:o.maxChars,modelValue:o.content,"onUpdate:modelValue":t[0]||(t[0]=l=>o.content=l),disabled:o.disabled,bold:o.bold,italic:o.italic,strike:o.strike,underline:o.underline,code:o.code,codeBlock:o.codeBlock,blockquote:o.blockquote,bulletList:o.bulletList,orderedList:o.orderedList,taskList:o.taskList,heading:o.heading,textAlign:o.textAlign,horizontalRule:o.horizontalRule,undoRedo:o.undoRedo,class:"mb-2"},null,8,["bubbleMenu","maxChars","modelValue","disabled","bold","italic","strike","underline","code","codeBlock","blockquote","bulletList","orderedList","taskList","heading","textAlign","horizontalRule","undoRedo"]),f.createVNode(a,{title:"Options"},{default:f.withCtx(()=>[f.createElementVNode("div",s0,[f.createElementVNode("div",a0,[l0,f.createElementVNode("div",c0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[1]||(t[1]=l=>o.bubbleMenu=l),id:"bubble"},null,512),[[f.vModelCheckbox,o.bubbleMenu]])])]),f.createElementVNode("div",u0,[f0,f.createElementVNode("div",p0,[f.withDirectives(f.createElementVNode("input",{type:"number",class:"input","onUpdate:modelValue":t[2]||(t[2]=l=>o.maxChars=l),min:"0",id:"maxChars"},null,512),[[f.vModelText,o.maxChars,void 0,{number:!0}]])])]),f.createElementVNode("div",d0,[h0,f.createElementVNode("div",m0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[3]||(t[3]=l=>o.disabled=l),id:"disabled"},null,512),[[f.vModelCheckbox,o.disabled]])])])]),f.createElementVNode("div",v0,[f.createElementVNode("div",g0,[f.createElementVNode("label",y0,f.toDisplayString(n.__("tiptap::tiptap.bold")),1),f.createElementVNode("div",b0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[4]||(t[4]=l=>o.bold=l),id:"bold"},null,512),[[f.vModelCheckbox,o.bold]])])]),f.createElementVNode("div",k0,[f.createElementVNode("label",w0,f.toDisplayString(n.__("tiptap::tiptap.italic")),1),f.createElementVNode("div",S0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[5]||(t[5]=l=>o.italic=l),id:"italic"},null,512),[[f.vModelCheckbox,o.italic]])])]),f.createElementVNode("div",x0,[f.createElementVNode("label",M0,f.toDisplayString(n.__("tiptap::tiptap.strike")),1),f.createElementVNode("div",C0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[6]||(t[6]=l=>o.strike=l),id:"strike"},null,512),[[f.vModelCheckbox,o.strike]])])]),f.createElementVNode("div",E0,[f.createElementVNode("label",O0,f.toDisplayString(n.__("tiptap::tiptap.underline")),1),f.createElementVNode("div",N0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[7]||(t[7]=l=>o.underline=l),id:"underline"},null,512),[[f.vModelCheckbox,o.underline]])])]),f.createElementVNode("div",T0,[f.createElementVNode("label",_0,f.toDisplayString(n.__("tiptap::tiptap.code")),1),f.createElementVNode("div",A0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[8]||(t[8]=l=>o.code=l),id:"code"},null,512),[[f.vModelCheckbox,o.code]])])]),f.createElementVNode("div",D0,[f.createElementVNode("label",R0,f.toDisplayString(n.__("tiptap::tiptap.code_block")),1),f.createElementVNode("div",V0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[9]||(t[9]=l=>o.codeBlock=l),id:"codeBlock"},null,512),[[f.vModelCheckbox,o.codeBlock]])])]),f.createElementVNode("div",I0,[f.createElementVNode("label",B0,f.toDisplayString(n.__("tiptap::tiptap.blockquote")),1),f.createElementVNode("div",P0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[10]||(t[10]=l=>o.blockquote=l),id:"blockquote"},null,512),[[f.vModelCheckbox,o.blockquote]])])]),f.createElementVNode("div",z0,[f.createElementVNode("label",L0,f.toDisplayString(n.__("tiptap::tiptap.bullet_list")),1),f.createElementVNode("div",F0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[11]||(t[11]=l=>o.bulletList=l),id:"bulletList"},null,512),[[f.vModelCheckbox,o.bulletList]])])]),f.createElementVNode("div",H0,[f.createElementVNode("label",J0,f.toDisplayString(n.__("tiptap::tiptap.ordered_list")),1),f.createElementVNode("div",$0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[12]||(t[12]=l=>o.orderedList=l),id:"orderedList"},null,512),[[f.vModelCheckbox,o.orderedList]])])]),f.createElementVNode("div",q0,[f.createElementVNode("label",j0,f.toDisplayString(n.__("tiptap::tiptap.task_list")),1),f.createElementVNode("div",W0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[13]||(t[13]=l=>o.taskList=l),id:"taskList"},null,512),[[f.vModelCheckbox,o.taskList]])])]),f.createElementVNode("div",K0,[f.createElementVNode("label",U0,f.toDisplayString(n.__("tiptap::tiptap.heading")),1),f.createElementVNode("div",G0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[14]||(t[14]=l=>o.heading=l),id:"heading"},null,512),[[f.vModelCheckbox,o.heading]])])]),f.createElementVNode("div",Y0,[f.createElementVNode("label",X0,f.toDisplayString(n.__("tiptap::tiptap.text_align")),1),f.createElementVNode("div",Q0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[15]||(t[15]=l=>o.textAlign=l),id:"textAlign"},null,512),[[f.vModelCheckbox,o.textAlign]])])]),f.createElementVNode("div",Z0,[f.createElementVNode("label",tb,f.toDisplayString(n.__("tiptap::tiptap.horizontal_rule")),1),f.createElementVNode("div",eb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[16]||(t[16]=l=>o.horizontalRule=l),id:"horizontalRule"},null,512),[[f.vModelCheckbox,o.horizontalRule]])])]),f.createElementVNode("div",nb,[f.createElementVNode("label",rb,f.toDisplayString(n.__("tiptap::tiptap.undo"))+"/"+f.toDisplayString(n.__("tiptap::tiptap.redo")),1),f.createElementVNode("div",ob,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[17]||(t[17]=l=>o.undoRedo=l),id:"undoRedo"},null,512),[[f.vModelCheckbox,o.undoRedo]])])])])]),_:1}),f.createVNode(a,{title:"HTML Output"},{default:f.withCtx(()=>[f.withDirectives(f.createElementVNode("textarea",{class:"input w-full min-h-64","onUpdate:modelValue":t[18]||(t[18]=l=>o.content=l)},null,512),[[f.vModelText,o.content]])]),_:1})],64)}var sb=Ao(i0,[["render",ib]]);const ab={mixins:[voyager.formfieldMixin]},lb={key:1},cb={key:2};function ub(n,t,e,r,o,i){const s=f.resolveComponent("tiptap");return n.action=="query"?f.renderSlot(n.$slots,"default",{key:0}):n.action=="add"||n.action=="edit"?(f.openBlock(),f.createElementBlock("div",lb,[f.createVNode(s,{bubbleMenu:n.options.bubbleMenu,maxChars:n.options.maxChars,modelValue:n.modelValue,"onUpdate:modelValue":t[0]||(t[0]=a=>n.$emit("update:modelValue",a)),bold:n.options.bold,italic:n.options.italic,strike:n.options.strike,underline:n.options.underline,code:n.options.code,codeBlock:n.options.codeBlock,blockquote:n.options.blockquote,bulletList:n.options.bulletList,orderedList:n.options.orderedList,taskList:n.options.taskList,heading:n.options.heading,textAlign:n.options.textAlign,horizontalRule:n.options.horizontalRule,undoRedo:n.options.undoRedo},null,8,["bubbleMenu","maxChars","modelValue","bold","italic","strike","underline","code","codeBlock","blockquote","bulletList","orderedList","taskList","heading","textAlign","horizontalRule","undoRedo"])])):n.action=="browse"?(f.openBlock(),f.createElementBlock("div",cb,f.toDisplayString(n.modelValue),1)):f.createCommentVNode("",!0)}var fb=Ao(ab,[["render",ub]]);const pb={mixins:[voyager.formfieldBuilderMixin],computed:{defaultListOptions(){return{display_length:150}},defaultViewOptions(){return{bubbleMenu:!1,maxChars:0,bold:!0,italic:!0,strike:!0,underline:!0,code:!0,codeBlock:!0,blockquote:!0,bulletList:!0,orderedList:!0,taskList:!0,heading:!0,textAlign:!0,horizontalRule:!0,undoRedo:!0}}}},db={key:0},hb={for:"length",class:"label"},mb={key:1},vb={class:"mt-2"},gb={for:"maxChars",class:"label"},yb={class:"grid grid-cols-3 lg:grid-cols-2 xl:grid-cols-3 gap-2 mt-2"},bb={class:"flex items-center space-x-1"},kb={for:"bubble",class:"label"},wb={class:"flex items-center space-x-1"},Sb={for:"bold",class:"label"},xb={class:"flex items-center space-x-1"},Mb={for:"italic",class:"label"},Cb={class:"flex items-center space-x-1"},Eb={for:"strike",class:"label"},Ob={class:"flex items-center space-x-1"},Nb={for:"underline",class:"label"},Tb={class:"flex items-center space-x-1"},_b={for:"code",class:"label"},Ab={class:"flex items-center space-x-1"},Db={for:"codeBlock",class:"label"},Rb={class:"flex items-center space-x-1"},Vb={for:"blockquote",class:"label"},Ib={class:"flex items-center space-x-1"},Bb={for:"bulletList",class:"label"},Pb={class:"flex items-center space-x-1"},zb={for:"orderedList",class:"label"},Lb={class:"flex items-center space-x-1"},Fb={for:"taskList",class:"label"},Hb={class:"flex items-center space-x-1"},Jb={for:"heading",class:"label"},$b={class:"flex items-center space-x-1"},qb={for:"textAlign",class:"label"},jb={class:"flex items-center space-x-1"},Wb={for:"horizontalRule",class:"label"},Kb={class:"flex items-center space-x-1"},Ub={for:"undoRedo",class:"label"},Gb={key:2};function Yb(n,t,e,r,o,i){const s=f.resolveComponent("tiptap");return n.action=="list-options"?(f.openBlock(),f.createElementBlock("div",db,[f.createElementVNode("label",hb,f.toDisplayString(n.__("voyager::generic.display_length")),1),f.withDirectives(f.createElementVNode("input",{type:"number",id:"length",class:"input w-full","onUpdate:modelValue":t[0]||(t[0]=a=>n.options.display_length=a)},null,512),[[f.vModelText,n.options.display_length,void 0,{number:!0}]])])):n.action=="view-options"?(f.openBlock(),f.createElementBlock("div",mb,[f.createElementVNode("div",vb,[f.createElementVNode("label",gb,f.toDisplayString(n.__("tiptap::tiptap.max_characters")),1),f.withDirectives(f.createElementVNode("input",{type:"number",class:"input w-full","onUpdate:modelValue":t[1]||(t[1]=a=>n.options.maxChars=a),min:"0",id:"maxChars"},null,512),[[f.vModelText,n.options.maxChars,void 0,{number:!0}]])]),f.createElementVNode("div",yb,[f.createElementVNode("div",bb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[2]||(t[2]=a=>n.options.bubbleMenu=a),id:"bubble"},null,512),[[f.vModelCheckbox,n.options.bubbleMenu]]),f.createElementVNode("label",kb,f.toDisplayString(n.__("tiptap::tiptap.bubble_menu")),1)]),f.createElementVNode("div",wb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[3]||(t[3]=a=>n.options.bold=a),id:"bold"},null,512),[[f.vModelCheckbox,n.options.bold]]),f.createElementVNode("label",Sb,f.toDisplayString(n.__("tiptap::tiptap.bold")),1)]),f.createElementVNode("div",xb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[4]||(t[4]=a=>n.options.italic=a),id:"italic"},null,512),[[f.vModelCheckbox,n.options.italic]]),f.createElementVNode("label",Mb,f.toDisplayString(n.__("tiptap::tiptap.italic")),1)]),f.createElementVNode("div",Cb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[5]||(t[5]=a=>n.options.strike=a),id:"strike"},null,512),[[f.vModelCheckbox,n.options.strike]]),f.createElementVNode("label",Eb,f.toDisplayString(n.__("tiptap::tiptap.strike")),1)]),f.createElementVNode("div",Ob,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[6]||(t[6]=a=>n.options.underline=a),id:"underline"},null,512),[[f.vModelCheckbox,n.options.underline]]),f.createElementVNode("label",Nb,f.toDisplayString(n.__("tiptap::tiptap.underline")),1)]),f.createElementVNode("div",Tb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[7]||(t[7]=a=>n.options.code=a),id:"code"},null,512),[[f.vModelCheckbox,n.options.code]]),f.createElementVNode("label",_b,f.toDisplayString(n.__("tiptap::tiptap.code")),1)]),f.createElementVNode("div",Ab,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[8]||(t[8]=a=>n.options.codeBlock=a),id:"codeBlock"},null,512),[[f.vModelCheckbox,n.options.codeBlock]]),f.createElementVNode("label",Db,f.toDisplayString(n.__("tiptap::tiptap.code_block")),1)]),f.createElementVNode("div",Rb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[9]||(t[9]=a=>n.options.blockquote=a),id:"blockquote"},null,512),[[f.vModelCheckbox,n.options.blockquote]]),f.createElementVNode("label",Vb,f.toDisplayString(n.__("tiptap::tiptap.blockquote")),1)]),f.createElementVNode("div",Ib,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[10]||(t[10]=a=>n.options.bulletList=a),id:"bulletList"},null,512),[[f.vModelCheckbox,n.options.bulletList]]),f.createElementVNode("label",Bb,f.toDisplayString(n.__("tiptap::tiptap.bullet_list")),1)]),f.createElementVNode("div",Pb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[11]||(t[11]=a=>n.options.orderedList=a),id:"orderedList"},null,512),[[f.vModelCheckbox,n.options.orderedList]]),f.createElementVNode("label",zb,f.toDisplayString(n.__("tiptap::tiptap.ordered_list")),1)]),f.createElementVNode("div",Lb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[12]||(t[12]=a=>n.options.taskList=a),id:"taskList"},null,512),[[f.vModelCheckbox,n.options.taskList]]),f.createElementVNode("label",Fb,f.toDisplayString(n.__("tiptap::tiptap.task_list")),1)]),f.createElementVNode("div",Hb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[13]||(t[13]=a=>n.options.heading=a),id:"heading"},null,512),[[f.vModelCheckbox,n.options.heading]]),f.createElementVNode("label",Jb,f.toDisplayString(n.__("tiptap::tiptap.heading")),1)]),f.createElementVNode("div",$b,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[14]||(t[14]=a=>n.options.textAlign=a),id:"textAlign"},null,512),[[f.vModelCheckbox,n.options.textAlign]]),f.createElementVNode("label",qb,f.toDisplayString(n.__("tiptap::tiptap.text_align")),1)]),f.createElementVNode("div",jb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[15]||(t[15]=a=>n.options.horizontalRule=a),id:"horizontalRule"},null,512),[[f.vModelCheckbox,n.options.horizontalRule]]),f.createElementVNode("label",Wb,f.toDisplayString(n.__("tiptap::tiptap.horizontal_rule")),1)]),f.createElementVNode("div",Kb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[16]||(t[16]=a=>n.options.undoRedo=a),id:"undoRedo"},null,512),[[f.vModelCheckbox,n.options.undoRedo]]),f.createElementVNode("label",Ub,f.toDisplayString(n.__("tiptap::tiptap.undo"))+"/"+f.toDisplayString(n.__("tiptap::tiptap.redo")),1)])])])):n.action=="view"?(f.openBlock(),f.createElementBlock("div",Gb,[f.createVNode(s,{bubbleMenu:n.options.bubbleMenu,maxChars:n.options.maxChars,value:"''",bold:n.options.bold,italic:n.options.italic,strike:n.options.strike,underline:n.options.underline,code:n.options.code,codeBlock:n.options.codeBlock,blockquote:n.options.blockquote,bulletList:n.options.bulletList,orderedList:n.options.orderedList,taskList:n.options.taskList,heading:n.options.heading,textAlign:n.options.textAlign,horizontalRule:n.options.horizontalRule,undoRedo:n.options.undoRedo},null,8,["bubbleMenu","maxChars","bold","italic","strike","underline","code","codeBlock","blockquote","bulletList","orderedList","taskList","heading","textAlign","horizontalRule","undoRedo"])])):f.createCommentVNode("",!0)}var Xb=Ao(pb,[["render",Yb]]);voyager.component("tiptap",$u),voyager.component("tiptap-demo",sb),voyager.component("tiptap-formfield",fb),voyager.component("tiptap-builder",Xb),voyager.addToUI("Tiptap","tiptap-demo")}); +}`;class Jh extends Fh{constructor(t={}){super();this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(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 storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=Nh(Hh))}setOptions(t={}){this.options=x(x({},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,e){const r=Yl(e)?e(t,this.state.plugins):[...this.state.plugins,t],o=this.state.reconfigure({plugins:r});this.view.updateState(o)}unregisterPlugin(t){if(this.isDestroyed)return;const e=typeof t=="string"?`${t}$`:t.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(o=>!o.key.startsWith(e))});this.view.updateState(r)}createExtensionManager(){const e=[...this.options.enableCoreExtensions?Object.values(kh):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r==null?void 0:r.type));this.extensionManager=new _n(e,this)}createCommandManager(){this.commandManager=new Yi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){this.view=new ct(this.options.element,Lt(x({},this.options.editorProps),{dispatchTransaction:this.dispatchTransaction.bind(this),state:Et.create({doc:rc(this.options.content,this.schema,this.options.parseOptions)})}));const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.createNodeViews();const e=this.view.dom;e.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}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 e=this.state.apply(t),r=!this.state.selection.eq(e.selection);this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),r&&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 Sh(this.state,t)}isActive(t,e){const r=typeof t=="string"?t:null,o=typeof t=="string"?e:t;return xh(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ch(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` + +`,textSerializers:r={}}=t||{};return Eh(this.state.doc,{blockSeparator:e,textSerializers:x(x({},r),Ql(this.schema))})}get isEmpty(){return Oh(this.state.doc)}getCharacterCount(){return this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners(),Mh(this.css)}get isDestroyed(){var t;return!((t=this.view)===null||t===void 0?void 0:t.docView)}}class bt{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=x(x({},this.config),t),this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=L(_(this,"addOptions",{name:this.name}))),this.storage=L(_(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new bt(t)}configure(t={}){const e=this.extend();return e.options=to(this.options,t),e.storage=L(_(e,"addStorage",{name:e.name,options:e.options})),e}extend(t={}){const e=new bt(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=t.defaultOptions?t.defaultOptions:e.parent.options,t.addOptions&&(e.options=L(_(e,"addOptions",{name:e.name}))),e.storage=L(_(e,"addStorage",{name:e.name,options:e.options})),e}}class qe{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=x(x({},this.config),t),this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=L(_(this,"addOptions",{name:this.name}))),this.storage=L(_(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new qe(t)}configure(t={}){const e=this.extend();return e.options=to(this.options,t),e.storage=L(_(e,"addStorage",{name:e.name,options:e.options})),e}extend(t={}){const e=new qe(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=t.defaultOptions?t.defaultOptions:e.parent.options,t.addOptions&&(e.options=L(_(e,"addOptions",{name:e.name}))),e.storage=L(_(e,"addStorage",{name:e.name,options:e.options})),e}}function uc(n){return new so({find:n.find,handler:({state:t,range:e,match:r})=>{const o=L(n.getAttributes,void 0,r)||{},{tr:i}=t,s=e.from;let a=e.to;if(r[1]){const l=r[0].lastIndexOf(r[1]);let c=s+l;c>a?c=a:a=c+r[1].length;const u=r[0][r[0].length-1];i.insertText(u,s+r[0].length-1),i.replaceWith(c,a,n.type.create(o))}else r[0]&&i.replaceWith(s,a,n.type.create(o))}})}function fc(n,t,e){const r=[];return e.doc.nodesBetween(n,t,(o,i)=>{r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}function An(n){return new so({find:n.find,handler:({state:t,range:e,match:r})=>{const o=L(n.getAttributes,void 0,r);if(o===!1||o===null)return;const{tr:i}=t,s=r[r.length-1],a=r[0];let l=e.to;if(s){const c=a.search(/\S/),u=e.from+a.indexOf(s),p=u+s.length;if(fc(e.from,e.to,t).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>u).length)return null;pe.from&&i.delete(e.from+c,u),l=e.from+c+s.length,i.addMark(e.from+c,l,n.type.create(o||{})),i.removeStoredMark(n.type)}}})}function ts(n){return new so({find:n.find,handler:({state:t,range:e,match:r})=>{const o=t.doc.resolve(e.from),i=L(n.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),n.type))return null;t.tr.delete(e.from,e.to).setBlockType(e.from,e.from,n.type,i)}})}function ao(n){return new so({find:n.find,handler:({state:t,range:e,match:r})=>{const o=L(n.getAttributes,void 0,r)||{},i=t.tr.delete(e.from,e.to),a=i.doc.resolve(e.from).blockRange(),l=a&&Xo(a,n.type,o);if(!l)return null;i.wrap(a,l);const c=i.doc.resolve(e.from-1).nodeBefore;c&&c.type===n.type&&Qo(i.doc,e.from-1)&&(!n.joinPredicate||n.joinPredicate(r,c))&&i.join(e.from-1)}})}function Dn(n){return new Dh({find:n.find,handler:({state:t,range:e,match:r})=>{const o=L(n.getAttributes,void 0,r);if(o===!1||o===null)return;const{tr:i}=t,s=r[r.length-1],a=r[0];let l=e.to;if(s){const c=a.search(/\S/),u=e.from+a.indexOf(s),p=u+s.length;if(fc(e.from,e.to,t).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>u).length)return null;pe.from&&i.delete(e.from+c,u),l=e.from+c+s.length,i.addMark(e.from+c,l,n.type.create(o||{})),i.removeStoredMark(n.type)}}})}function $h(n){return Ki(n)&&n instanceof P}function pc(n,t,e){const r=0,o=n.state.doc.content.size,i=ln(t,r,o),s=ln(e,r,o),a=n.coordsAtPos(i),l=n.coordsAtPos(s,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),p=Math.min(a.left,l.left),d=Math.max(a.right,l.right),h=d-p,m=u-c,k={top:c,bottom:u,left:p,right:d,width:h,height:m,x:p,y:c};return Lt(x({},k),{toJSON:()=>k})}var Wt="top",ee="bottom",ne="right",Kt="left",es="auto",cr=[Wt,ee,ne,Kt],Rn="start",ur="end",qh="clippingParents",dc="viewport",fr="popper",jh="reference",hc=cr.reduce(function(n,t){return n.concat([t+"-"+Rn,t+"-"+ur])},[]),mc=[].concat(cr,[es]).reduce(function(n,t){return n.concat([t,t+"-"+Rn,t+"-"+ur])},[]),Wh="beforeRead",Kh="read",Uh="afterRead",Gh="beforeMain",Yh="main",Xh="afterMain",Qh="beforeWrite",Zh="write",tm="afterWrite",em=[Wh,Kh,Uh,Gh,Yh,Xh,Qh,Zh,tm];function ge(n){return n?(n.nodeName||"").toLowerCase():null}function ue(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var t=n.ownerDocument;return t&&t.defaultView||window}return n}function pr(n){var t=ue(n).Element;return n instanceof t||n instanceof Element}function re(n){var t=ue(n).HTMLElement;return n instanceof t||n instanceof HTMLElement}function vc(n){if(typeof ShadowRoot=="undefined")return!1;var t=ue(n).ShadowRoot;return n instanceof t||n instanceof ShadowRoot}function nm(n){var t=n.state;Object.keys(t.elements).forEach(function(e){var r=t.styles[e]||{},o=t.attributes[e]||{},i=t.elements[e];!re(i)||!ge(i)||(Object.assign(i.style,r),Object.keys(o).forEach(function(s){var a=o[s];a===!1?i.removeAttribute(s):i.setAttribute(s,a===!0?"":a)}))})}function rm(n){var t=n.state,e={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,e.popper),t.styles=e,t.elements.arrow&&Object.assign(t.elements.arrow.style,e.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],i=t.attributes[r]||{},s=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:e[r]),a=s.reduce(function(l,c){return l[c]="",l},{});!re(o)||!ge(o)||(Object.assign(o.style,a),Object.keys(i).forEach(function(l){o.removeAttribute(l)}))})}}var gc={name:"applyStyles",enabled:!0,phase:"write",fn:nm,effect:rm,requires:["computeStyles"]};function ye(n){return n.split("-")[0]}function Vn(n,t){var e=n.getBoundingClientRect(),r=1,o=1;return{width:e.width/r,height:e.height/o,top:e.top/o,right:e.right/r,bottom:e.bottom/o,left:e.left/r,x:e.left/r,y:e.top/o}}function ns(n){var t=Vn(n),e=n.offsetWidth,r=n.offsetHeight;return Math.abs(t.width-e)<=1&&(e=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:n.offsetLeft,y:n.offsetTop,width:e,height:r}}function yc(n,t){var e=t.getRootNode&&t.getRootNode();if(n.contains(t))return!0;if(e&&vc(e)){var r=t;do{if(r&&n.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function _e(n){return ue(n).getComputedStyle(n)}function om(n){return["table","td","th"].indexOf(ge(n))>=0}function je(n){return((pr(n)?n.ownerDocument:n.document)||window.document).documentElement}function lo(n){return ge(n)==="html"?n:n.assignedSlot||n.parentNode||(vc(n)?n.host:null)||je(n)}function bc(n){return!re(n)||_e(n).position==="fixed"?null:n.offsetParent}function im(n){var t=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,e=navigator.userAgent.indexOf("Trident")!==-1;if(e&&re(n)){var r=_e(n);if(r.position==="fixed")return null}for(var o=lo(n);re(o)&&["html","body"].indexOf(ge(o))<0;){var i=_e(o);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||t&&i.willChange==="filter"||t&&i.filter&&i.filter!=="none")return o;o=o.parentNode}return null}function dr(n){for(var t=ue(n),e=bc(n);e&&om(e)&&_e(e).position==="static";)e=bc(e);return e&&(ge(e)==="html"||ge(e)==="body"&&_e(e).position==="static")?t:e||im(n)||t}function rs(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}var We=Math.max,hr=Math.min,co=Math.round;function uo(n,t,e){return We(n,hr(t,e))}function kc(){return{top:0,right:0,bottom:0,left:0}}function wc(n){return Object.assign({},kc(),n)}function Sc(n,t){return t.reduce(function(e,r){return e[r]=n,e},{})}var sm=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,wc(typeof t!="number"?t:Sc(t,cr))};function am(n){var t,e=n.state,r=n.name,o=n.options,i=e.elements.arrow,s=e.modifiersData.popperOffsets,a=ye(e.placement),l=rs(a),c=[Kt,ne].indexOf(a)>=0,u=c?"height":"width";if(!(!i||!s)){var p=sm(o.padding,e),d=ns(i),h=l==="y"?Wt:Kt,m=l==="y"?ee:ne,g=e.rects.reference[u]+e.rects.reference[l]-s[l]-e.rects.popper[u],y=s[l]-e.rects.reference[l],k=dr(i),b=k?l==="y"?k.clientHeight||0:k.clientWidth||0:0,N=g/2-y/2,v=p[h],O=b-d[u]-p[m],C=b/2-d[u]/2+N,A=uo(v,C,O),I=l;e.modifiersData[r]=(t={},t[I]=A,t.centerOffset=A-C,t)}}function lm(n){var t=n.state,e=n.options,r=e.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||!yc(t.elements.popper,o)||(t.elements.arrow=o))}var cm={name:"arrow",enabled:!0,phase:"main",fn:am,effect:lm,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function In(n){return n.split("-")[1]}var um={top:"auto",right:"auto",bottom:"auto",left:"auto"};function fm(n){var t=n.x,e=n.y,r=window,o=r.devicePixelRatio||1;return{x:co(co(t*o)/o)||0,y:co(co(e*o)/o)||0}}function xc(n){var t,e=n.popper,r=n.popperRect,o=n.placement,i=n.variation,s=n.offsets,a=n.position,l=n.gpuAcceleration,c=n.adaptive,u=n.roundOffsets,p=u===!0?fm(s):typeof u=="function"?u(s):s,d=p.x,h=d===void 0?0:d,m=p.y,g=m===void 0?0:m,y=s.hasOwnProperty("x"),k=s.hasOwnProperty("y"),b=Kt,N=Wt,v=window;if(c){var O=dr(e),C="clientHeight",A="clientWidth";O===ue(e)&&(O=je(e),_e(O).position!=="static"&&a==="absolute"&&(C="scrollHeight",A="scrollWidth")),O=O,(o===Wt||(o===Kt||o===ne)&&i===ur)&&(N=ee,g-=O[C]-r.height,g*=l?1:-1),(o===Kt||(o===Wt||o===ee)&&i===ur)&&(b=ne,h-=O[A]-r.width,h*=l?1:-1)}var I=Object.assign({position:a},c&&um);if(l){var V;return Object.assign({},I,(V={},V[N]=k?"0":"",V[b]=y?"0":"",V.transform=(v.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",V))}return Object.assign({},I,(t={},t[N]=k?g+"px":"",t[b]=y?h+"px":"",t.transform="",t))}function pm(n){var t=n.state,e=n.options,r=e.gpuAcceleration,o=r===void 0?!0:r,i=e.adaptive,s=i===void 0?!0:i,a=e.roundOffsets,l=a===void 0?!0:a,c={placement:ye(t.placement),variation:In(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,xc(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,xc(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var dm={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:pm,data:{}},fo={passive:!0};function hm(n){var t=n.state,e=n.instance,r=n.options,o=r.scroll,i=o===void 0?!0:o,s=r.resize,a=s===void 0?!0:s,l=ue(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&c.forEach(function(u){u.addEventListener("scroll",e.update,fo)}),a&&l.addEventListener("resize",e.update,fo),function(){i&&c.forEach(function(u){u.removeEventListener("scroll",e.update,fo)}),a&&l.removeEventListener("resize",e.update,fo)}}var mm={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:hm,data:{}},vm={left:"right",right:"left",bottom:"top",top:"bottom"};function po(n){return n.replace(/left|right|bottom|top/g,function(t){return vm[t]})}var gm={start:"end",end:"start"};function Mc(n){return n.replace(/start|end/g,function(t){return gm[t]})}function is(n){var t=ue(n),e=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:e,scrollTop:r}}function ss(n){return Vn(je(n)).left+is(n).scrollLeft}function ym(n){var t=ue(n),e=je(n),r=t.visualViewport,o=e.clientWidth,i=e.clientHeight,s=0,a=0;return r&&(o=r.width,i=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(s=r.offsetLeft,a=r.offsetTop)),{width:o,height:i,x:s+ss(n),y:a}}function bm(n){var t,e=je(n),r=is(n),o=(t=n.ownerDocument)==null?void 0:t.body,i=We(e.scrollWidth,e.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=We(e.scrollHeight,e.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+ss(n),l=-r.scrollTop;return _e(o||e).direction==="rtl"&&(a+=We(e.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:a,y:l}}function as(n){var t=_e(n),e=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(e+o+r)}function Cc(n){return["html","body","#document"].indexOf(ge(n))>=0?n.ownerDocument.body:re(n)&&as(n)?n:Cc(lo(n))}function mr(n,t){var e;t===void 0&&(t=[]);var r=Cc(n),o=r===((e=n.ownerDocument)==null?void 0:e.body),i=ue(r),s=o?[i].concat(i.visualViewport||[],as(r)?r:[]):r,a=t.concat(s);return o?a:a.concat(mr(lo(s)))}function ls(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function km(n){var t=Vn(n);return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function Ec(n,t){return t===dc?ls(ym(n)):re(t)?km(t):ls(bm(je(n)))}function wm(n){var t=mr(lo(n)),e=["absolute","fixed"].indexOf(_e(n).position)>=0,r=e&&re(n)?dr(n):n;return pr(r)?t.filter(function(o){return pr(o)&&yc(o,r)&&ge(o)!=="body"}):[]}function Sm(n,t,e){var r=t==="clippingParents"?wm(n):[].concat(t),o=[].concat(r,[e]),i=o[0],s=o.reduce(function(a,l){var c=Ec(n,l);return a.top=We(c.top,a.top),a.right=hr(c.right,a.right),a.bottom=hr(c.bottom,a.bottom),a.left=We(c.left,a.left),a},Ec(n,i));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function Oc(n){var t=n.reference,e=n.element,r=n.placement,o=r?ye(r):null,i=r?In(r):null,s=t.x+t.width/2-e.width/2,a=t.y+t.height/2-e.height/2,l;switch(o){case Wt:l={x:s,y:t.y-e.height};break;case ee:l={x:s,y:t.y+t.height};break;case ne:l={x:t.x+t.width,y:a};break;case Kt:l={x:t.x-e.width,y:a};break;default:l={x:t.x,y:t.y}}var c=o?rs(o):null;if(c!=null){var u=c==="y"?"height":"width";switch(i){case Rn:l[c]=l[c]-(t[u]/2-e[u]/2);break;case ur:l[c]=l[c]+(t[u]/2-e[u]/2);break}}return l}function vr(n,t){t===void 0&&(t={});var e=t,r=e.placement,o=r===void 0?n.placement:r,i=e.boundary,s=i===void 0?qh:i,a=e.rootBoundary,l=a===void 0?dc:a,c=e.elementContext,u=c===void 0?fr:c,p=e.altBoundary,d=p===void 0?!1:p,h=e.padding,m=h===void 0?0:h,g=wc(typeof m!="number"?m:Sc(m,cr)),y=u===fr?jh:fr,k=n.rects.popper,b=n.elements[d?y:u],N=Sm(pr(b)?b:b.contextElement||je(n.elements.popper),s,l),v=Vn(n.elements.reference),O=Oc({reference:v,element:k,strategy:"absolute",placement:o}),C=ls(Object.assign({},k,O)),A=u===fr?C:v,I={top:N.top-A.top+g.top,bottom:A.bottom-N.bottom+g.bottom,left:N.left-A.left+g.left,right:A.right-N.right+g.right},V=n.modifiersData.offset;if(u===fr&&V){var F=V[o];Object.keys(I).forEach(function(st){var et=[ne,ee].indexOf(st)>=0?1:-1,U=[Wt,ee].indexOf(st)>=0?"y":"x";I[st]+=F[U]*et})}return I}function xm(n,t){t===void 0&&(t={});var e=t,r=e.placement,o=e.boundary,i=e.rootBoundary,s=e.padding,a=e.flipVariations,l=e.allowedAutoPlacements,c=l===void 0?mc:l,u=In(r),p=u?a?hc:hc.filter(function(m){return In(m)===u}):cr,d=p.filter(function(m){return c.indexOf(m)>=0});d.length===0&&(d=p);var h=d.reduce(function(m,g){return m[g]=vr(n,{placement:g,boundary:o,rootBoundary:i,padding:s})[ye(g)],m},{});return Object.keys(h).sort(function(m,g){return h[m]-h[g]})}function Mm(n){if(ye(n)===es)return[];var t=po(n);return[Mc(n),t,Mc(t)]}function Cm(n){var t=n.state,e=n.options,r=n.name;if(!t.modifiersData[r]._skip){for(var o=e.mainAxis,i=o===void 0?!0:o,s=e.altAxis,a=s===void 0?!0:s,l=e.fallbackPlacements,c=e.padding,u=e.boundary,p=e.rootBoundary,d=e.altBoundary,h=e.flipVariations,m=h===void 0?!0:h,g=e.allowedAutoPlacements,y=t.options.placement,k=ye(y),b=k===y,N=l||(b||!m?[po(y)]:Mm(y)),v=[y].concat(N).reduce(function(Me,Yt){return Me.concat(ye(Yt)===es?xm(t,{placement:Yt,boundary:u,rootBoundary:p,padding:c,flipVariations:m,allowedAutoPlacements:g}):Yt)},[]),O=t.rects.reference,C=t.rects.popper,A=new Map,I=!0,V=v[0],F=0;F=0,Z=Nt?"width":"height",X=vr(t,{placement:st,boundary:u,rootBoundary:p,altBoundary:d,padding:c}),Tt=Nt?U?ne:Kt:U?ee:Wt;O[Z]>C[Z]&&(Tt=po(Tt));var _t=po(Tt),De=[];if(i&&De.push(X[et]<=0),a&&De.push(X[Tt]<=0,X[_t]<=0),De.every(function(Me){return Me})){V=st,I=!1;break}A.set(st,De)}if(I)for(var xe=m?3:1,hn=function(Yt){var Xe=v.find(function(Tr){var Qe=A.get(Tr);if(Qe)return Qe.slice(0,Yt).every(function($n){return $n})});if(Xe)return V=Xe,"break"},de=xe;de>0;de--){var mn=hn(de);if(mn==="break")break}t.placement!==V&&(t.modifiersData[r]._skip=!0,t.placement=V,t.reset=!0)}}var Em={name:"flip",enabled:!0,phase:"main",fn:Cm,requiresIfExists:["offset"],data:{_skip:!1}};function Nc(n,t,e){return e===void 0&&(e={x:0,y:0}),{top:n.top-t.height-e.y,right:n.right-t.width+e.x,bottom:n.bottom-t.height+e.y,left:n.left-t.width-e.x}}function Tc(n){return[Wt,ne,ee,Kt].some(function(t){return n[t]>=0})}function Om(n){var t=n.state,e=n.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,s=vr(t,{elementContext:"reference"}),a=vr(t,{altBoundary:!0}),l=Nc(s,r),c=Nc(a,o,i),u=Tc(l),p=Tc(c);t.modifiersData[e]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:p},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":p})}var Nm={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Om};function Tm(n,t,e){var r=ye(n),o=[Kt,Wt].indexOf(r)>=0?-1:1,i=typeof e=="function"?e(Object.assign({},t,{placement:n})):e,s=i[0],a=i[1];return s=s||0,a=(a||0)*o,[Kt,ne].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function _m(n){var t=n.state,e=n.options,r=n.name,o=e.offset,i=o===void 0?[0,0]:o,s=mc.reduce(function(u,p){return u[p]=Tm(p,t.rects,i),u},{}),a=s[t.placement],l=a.x,c=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=s}var Am={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:_m};function Dm(n){var t=n.state,e=n.name;t.modifiersData[e]=Oc({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}var Rm={name:"popperOffsets",enabled:!0,phase:"read",fn:Dm,data:{}};function Vm(n){return n==="x"?"y":"x"}function Im(n){var t=n.state,e=n.options,r=n.name,o=e.mainAxis,i=o===void 0?!0:o,s=e.altAxis,a=s===void 0?!1:s,l=e.boundary,c=e.rootBoundary,u=e.altBoundary,p=e.padding,d=e.tether,h=d===void 0?!0:d,m=e.tetherOffset,g=m===void 0?0:m,y=vr(t,{boundary:l,rootBoundary:c,padding:p,altBoundary:u}),k=ye(t.placement),b=In(t.placement),N=!b,v=rs(k),O=Vm(v),C=t.modifiersData.popperOffsets,A=t.rects.reference,I=t.rects.popper,V=typeof g=="function"?g(Object.assign({},t.rects,{placement:t.placement})):g,F={x:0,y:0};if(!!C){if(i||a){var st=v==="y"?Wt:Kt,et=v==="y"?ee:ne,U=v==="y"?"height":"width",Nt=C[v],Z=C[v]+y[st],X=C[v]-y[et],Tt=h?-I[U]/2:0,_t=b===Rn?A[U]:I[U],De=b===Rn?-I[U]:-A[U],xe=t.elements.arrow,hn=h&&xe?ns(xe):{width:0,height:0},de=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:kc(),mn=de[st],Me=de[et],Yt=uo(0,A[U],hn[U]),Xe=N?A[U]/2-Tt-Yt-mn-V:_t-Yt-mn-V,Tr=N?-A[U]/2+Tt+Yt+Me+V:De+Yt+Me+V,Qe=t.elements.arrow&&dr(t.elements.arrow),$n=Qe?v==="y"?Qe.clientTop||0:Qe.clientLeft||0:0,Re=t.modifiersData.offset?t.modifiersData.offset[t.placement][v]:0,_r=C[v]+Xe-Re-$n,Ar=C[v]+Tr-Re;if(i){var Dr=uo(h?hr(Z,_r):Z,Nt,h?We(X,Ar):X);C[v]=Dr,F[v]=Dr-Nt}if(a){var Do=v==="x"?Wt:Kt,Ro=v==="x"?ee:ne,vn=C[O],Rr=vn+y[Do],Vr=vn-y[Ro],Ir=uo(h?hr(Rr,_r):Rr,vn,h?We(Vr,Ar):Vr);C[O]=Ir,F[O]=Ir-vn}}t.modifiersData[r]=F}}var Bm={name:"preventOverflow",enabled:!0,phase:"main",fn:Im,requiresIfExists:["offset"]};function Pm(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function zm(n){return n===ue(n)||!re(n)?is(n):Pm(n)}function Lm(n){var t=n.getBoundingClientRect(),e=t.width/n.offsetWidth||1,r=t.height/n.offsetHeight||1;return e!==1||r!==1}function Fm(n,t,e){e===void 0&&(e=!1);var r=re(t);re(t)&&Lm(t);var o=je(t),i=Vn(n),s={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(r||!r&&!e)&&((ge(t)!=="body"||as(o))&&(s=zm(t)),re(t)?(a=Vn(t),a.x+=t.clientLeft,a.y+=t.clientTop):o&&(a.x=ss(o))),{x:i.left+s.scrollLeft-a.x,y:i.top+s.scrollTop-a.y,width:i.width,height:i.height}}function Hm(n){var t=new Map,e=new Set,r=[];n.forEach(function(i){t.set(i.name,i)});function o(i){e.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(a){if(!e.has(a)){var l=t.get(a);l&&o(l)}}),r.push(i)}return n.forEach(function(i){e.has(i.name)||o(i)}),r}function Jm(n){var t=Hm(n);return em.reduce(function(e,r){return e.concat(t.filter(function(o){return o.phase===r}))},[])}function $m(n){var t;return function(){return t||(t=new Promise(function(e){Promise.resolve().then(function(){t=void 0,e(n())})})),t}}function qm(n){var t=n.reduce(function(e,r){var o=e[r.name];return e[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,e},{});return Object.keys(t).map(function(e){return t[e]})}var _c={placement:"bottom",modifiers:[],strategy:"absolute"};function Ac(){for(var n=arguments.length,t=new Array(n),e=0;e-1}function Bc(n,t){return typeof n=="function"?n.apply(void 0,t):n}function Pc(n,t){if(t===0)return n;var e;return function(r){clearTimeout(e),e=setTimeout(function(){n(r)},t)}}function Ym(n){return n.split(/\s+/).filter(Boolean)}function Bn(n){return[].concat(n)}function zc(n,t){n.indexOf(t)===-1&&n.push(t)}function Xm(n){return n.filter(function(t,e){return n.indexOf(t)===e})}function Qm(n){return n.split("-")[0]}function ho(n){return[].slice.call(n)}function Lc(n){return Object.keys(n).reduce(function(t,e){return n[e]!==void 0&&(t[e]=n[e]),t},{})}function gr(){return document.createElement("div")}function mo(n){return["Element","Fragment"].some(function(t){return us(n,t)})}function Zm(n){return us(n,"NodeList")}function tv(n){return us(n,"MouseEvent")}function ev(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function nv(n){return mo(n)?[n]:Zm(n)?ho(n):Array.isArray(n)?n:ho(document.querySelectorAll(n))}function fs(n,t){n.forEach(function(e){e&&(e.style.transitionDuration=t+"ms")})}function Fc(n,t){n.forEach(function(e){e&&e.setAttribute("data-state",t)})}function rv(n){var t,e=Bn(n),r=e[0];return r!=null&&(t=r.ownerDocument)!=null&&t.body?r.ownerDocument:document}function ov(n,t){var e=t.clientX,r=t.clientY;return n.every(function(o){var i=o.popperRect,s=o.popperState,a=o.props,l=a.interactiveBorder,c=Qm(s.placement),u=s.modifiersData.offset;if(!u)return!0;var p=c==="bottom"?u.top.y:0,d=c==="top"?u.bottom.y:0,h=c==="right"?u.left.x:0,m=c==="left"?u.right.x:0,g=i.top-r+p>l,y=r-i.bottom-d>l,k=i.left-e+h>l,b=e-i.right-m>l;return g||y||k||b})}function ps(n,t,e){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(o){n[r](o,e)})}function iv(n,t){for(var e=t;e;){var r;if(n.contains(e))return!0;e=e.getRootNode==null||(r=e.getRootNode())==null?void 0:r.host}return!1}var be={isTouch:!1},Hc=0;function sv(){be.isTouch||(be.isTouch=!0,window.performance&&document.addEventListener("mousemove",Jc))}function Jc(){var n=performance.now();n-Hc<20&&(be.isTouch=!1,document.removeEventListener("mousemove",Jc)),Hc=n}function av(){var n=document.activeElement;if(ev(n)){var t=n._tippy;n.blur&&!t.state.isVisible&&n.blur()}}function lv(){document.addEventListener("touchstart",sv,cn),window.addEventListener("blur",av)}var cv=typeof window!="undefined"&&typeof document!="undefined",uv=cv?!!window.msCrypto:!1,fv={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},pv={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},fe=Object.assign({appendTo:Ic,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},fv,pv),dv=Object.keys(fe),hv=function(t){var e=Object.keys(t);e.forEach(function(r){fe[r]=t[r]})};function $c(n){var t=n.plugins||[],e=t.reduce(function(r,o){var i=o.name,s=o.defaultValue;if(i){var a;r[i]=n[i]!==void 0?n[i]:(a=fe[i])!=null?a:s}return r},{});return Object.assign({},n,e)}function mv(n,t){var e=t?Object.keys($c(Object.assign({},fe,{plugins:t}))):dv,r=e.reduce(function(o,i){var s=(n.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 r}function qc(n,t){var e=Object.assign({},t,{content:Bc(t.content,[n])},t.ignoreAttributes?{}:mv(n,t.plugins));return e.aria=Object.assign({},fe.aria,e.aria),e.aria={expanded:e.aria.expanded==="auto"?t.interactive:e.aria.expanded,content:e.aria.content==="auto"?t.interactive?null:"describedby":e.aria.content},e}var vv=function(){return"innerHTML"};function ds(n,t){n[vv()]=t}function jc(n){var t=gr();return n===!0?t.className=Rc:(t.className=Vc,mo(n)?t.appendChild(n):ds(t,n)),t}function Wc(n,t){mo(t.content)?(ds(n,""),n.appendChild(t.content)):typeof t.content!="function"&&(t.allowHTML?ds(n,t.content):n.textContent=t.content)}function hs(n){var t=n.firstElementChild,e=ho(t.children);return{box:t,content:e.find(function(r){return r.classList.contains(Dc)}),arrow:e.find(function(r){return r.classList.contains(Rc)||r.classList.contains(Vc)}),backdrop:e.find(function(r){return r.classList.contains(Gm)})}}function Kc(n){var t=gr(),e=gr();e.className=Um,e.setAttribute("data-state","hidden"),e.setAttribute("tabindex","-1");var r=gr();r.className=Dc,r.setAttribute("data-state","hidden"),Wc(r,n.props),t.appendChild(e),e.appendChild(r),o(n.props,n.props);function o(i,s){var a=hs(t),l=a.box,c=a.content,u=a.arrow;s.theme?l.setAttribute("data-theme",s.theme):l.removeAttribute("data-theme"),typeof s.animation=="string"?l.setAttribute("data-animation",s.animation):l.removeAttribute("data-animation"),s.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?l.setAttribute("role",s.role):l.removeAttribute("role"),(i.content!==s.content||i.allowHTML!==s.allowHTML)&&Wc(c,n.props),s.arrow?u?i.arrow!==s.arrow&&(l.removeChild(u),l.appendChild(jc(s.arrow))):l.appendChild(jc(s.arrow)):u&&l.removeChild(u)}return{popper:t,onUpdate:o}}Kc.$$tippy=!0;var gv=1,vo=[],ms=[];function yv(n,t){var e=qc(n,Object.assign({},fe,$c(Lc(t)))),r,o,i,s=!1,a=!1,l=!1,c=!1,u,p,d,h=[],m=Pc(Do,e.interactiveDebounce),g,y=gv++,k=null,b=Xm(e.plugins),N={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:y,reference:n,popper:gr(),popperInstance:k,props:e,state:N,plugins:b,clearDelayTimeouts:e1,setProps:n1,setContent:r1,show:o1,hide:i1,hideWithInteractivity:s1,enable:Zb,disable:t1,unmount:a1,destroy:l1};if(!e.render)return v;var O=e.render(v),C=O.popper,A=O.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+v.id,v.popper=C,n._tippy=v,C._tippy=v;var I=b.map(function(w){return w.fn(v)}),V=n.hasAttribute("aria-expanded");return _r(),xe(),Tt(),_t("onCreate",[v]),e.showOnCreate&&$u(),C.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),C.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&Nt().addEventListener("mousemove",m)}),v;function F(){var w=v.props.touch;return Array.isArray(w)?w:[w,0]}function st(){return F()[0]==="hold"}function et(){var w;return!!((w=v.props.render)!=null&&w.$$tippy)}function U(){return g||n}function Nt(){var w=U().parentNode;return w?rv(w):document}function Z(){return hs(C)}function X(w){return v.state.isMounted&&!v.state.isVisible||be.isTouch||u&&u.type==="focus"?0:cs(v.props.delay,w?0:1,fe.delay)}function Tt(){C.style.pointerEvents=v.props.interactive&&v.state.isVisible?"":"none",C.style.zIndex=""+v.props.zIndex}function _t(w,D,B){if(B===void 0&&(B=!0),I.forEach(function(W){W[w]&&W[w].apply(W,D)}),B){var G;(G=v.props)[w].apply(G,D)}}function De(){var w=v.props.aria;if(!!w.content){var D="aria-"+w.content,B=C.id,G=Bn(v.props.triggerTarget||n);G.forEach(function(W){var zt=W.getAttribute(D);if(v.state.isVisible)W.setAttribute(D,zt?zt+" "+B:B);else{var ie=zt&&zt.replace(B,"").trim();ie?W.setAttribute(D,ie):W.removeAttribute(D)}})}}function xe(){if(!(V||!v.props.aria.expanded)){var w=Bn(v.props.triggerTarget||n);w.forEach(function(D){v.props.interactive?D.setAttribute("aria-expanded",v.state.isVisible&&D===U()?"true":"false"):D.removeAttribute("aria-expanded")})}}function hn(){Nt().removeEventListener("mousemove",m),vo=vo.filter(function(w){return w!==m})}function de(w){if(!(be.isTouch&&(l||w.type==="mousedown"))){var D=w.composedPath&&w.composedPath()[0]||w.target;if(!(v.props.interactive&&iv(C,D))){if(Bn(v.props.triggerTarget||n).indexOf(D)!==-1){if(be.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else _t("onClickOutside",[v,w]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),a=!0,setTimeout(function(){a=!1}),v.state.isMounted||Xe())}}}function mn(){l=!0}function Me(){l=!1}function Yt(){var w=Nt();w.addEventListener("mousedown",de,!0),w.addEventListener("touchend",de,cn),w.addEventListener("touchstart",Me,cn),w.addEventListener("touchmove",mn,cn)}function Xe(){var w=Nt();w.removeEventListener("mousedown",de,!0),w.removeEventListener("touchend",de,cn),w.removeEventListener("touchstart",Me,cn),w.removeEventListener("touchmove",mn,cn)}function Tr(w,D){$n(w,function(){!v.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&D()})}function Qe(w,D){$n(w,D)}function $n(w,D){var B=Z().box;function G(W){W.target===B&&(ps(B,"remove",G),D())}if(w===0)return D();ps(B,"remove",p),ps(B,"add",G),p=G}function Re(w,D,B){B===void 0&&(B=!1);var G=Bn(v.props.triggerTarget||n);G.forEach(function(W){W.addEventListener(w,D,B),h.push({node:W,eventType:w,handler:D,options:B})})}function _r(){st()&&(Re("touchstart",Dr,{passive:!0}),Re("touchend",Ro,{passive:!0})),Ym(v.props.trigger).forEach(function(w){if(w!=="manual")switch(Re(w,Dr),w){case"mouseenter":Re("mouseleave",Ro);break;case"focus":Re(uv?"focusout":"blur",vn);break;case"focusin":Re("focusout",vn);break}})}function Ar(){h.forEach(function(w){var D=w.node,B=w.eventType,G=w.handler,W=w.options;D.removeEventListener(B,G,W)}),h=[]}function Dr(w){var D,B=!1;if(!(!v.state.isEnabled||Rr(w)||a)){var G=((D=u)==null?void 0:D.type)==="focus";u=w,g=w.currentTarget,xe(),!v.state.isVisible&&tv(w)&&vo.forEach(function(W){return W(w)}),w.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||s)&&v.props.hideOnClick!==!1&&v.state.isVisible?B=!0:$u(w),w.type==="click"&&(s=!B),B&&!G&&Vo(w)}}function Do(w){var D=w.target,B=U().contains(D)||C.contains(D);if(!(w.type==="mousemove"&&B)){var G=zs().concat(C).map(function(W){var zt,ie=W._tippy,qn=(zt=ie.popperInstance)==null?void 0:zt.state;return qn?{popperRect:W.getBoundingClientRect(),popperState:qn,props:e}:null}).filter(Boolean);ov(G,w)&&(hn(),Vo(w))}}function Ro(w){var D=Rr(w)||v.props.trigger.indexOf("click")>=0&&s;if(!D){if(v.props.interactive){v.hideWithInteractivity(w);return}Vo(w)}}function vn(w){v.props.trigger.indexOf("focusin")<0&&w.target!==U()||v.props.interactive&&w.relatedTarget&&C.contains(w.relatedTarget)||Vo(w)}function Rr(w){return be.isTouch?st()!==w.type.indexOf("touch")>=0:!1}function Vr(){Ir();var w=v.props,D=w.popperOptions,B=w.placement,G=w.offset,W=w.getReferenceClientRect,zt=w.moveTransition,ie=et()?hs(C).arrow:null,qn=W?{getBoundingClientRect:W,contextElement:W.contextElement||U()}:n,qu={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Io){var jn=Io.state;if(et()){var c1=Z(),Fs=c1.box;["placement","reference-hidden","escaped"].forEach(function(Bo){Bo==="placement"?Fs.setAttribute("data-placement",jn.placement):jn.attributes.popper["data-popper-"+Bo]?Fs.setAttribute("data-"+Bo,""):Fs.removeAttribute("data-"+Bo)}),jn.attributes.popper={}}}},gn=[{name:"offset",options:{offset:G}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!zt}},qu];et()&&ie&&gn.push({name:"arrow",options:{element:ie,padding:3}}),gn.push.apply(gn,(D==null?void 0:D.modifiers)||[]),v.popperInstance=Km(qn,C,Object.assign({},D,{placement:B,onFirstUpdate:d,modifiers:gn}))}function Ir(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function Qb(){var w=v.props.appendTo,D,B=U();v.props.interactive&&w===Ic||w==="parent"?D=B.parentNode:D=Bc(w,[B]),D.contains(C)||D.appendChild(C),Vr()}function zs(){return ho(C.querySelectorAll("[data-tippy-root]"))}function $u(w){v.clearDelayTimeouts(),w&&_t("onTrigger",[v,w]),Yt();var D=X(!0),B=F(),G=B[0],W=B[1];be.isTouch&&G==="hold"&&W&&(D=W),D?r=setTimeout(function(){v.show()},D):v.show()}function Vo(w){if(v.clearDelayTimeouts(),_t("onUntrigger",[v,w]),!v.state.isVisible){Xe();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(w.type)>=0&&s)){var D=X(!1);D?o=setTimeout(function(){v.state.isVisible&&v.hide()},D):i=requestAnimationFrame(function(){v.hide()})}}function Zb(){v.state.isEnabled=!0}function t1(){v.hide(),v.state.isEnabled=!1}function e1(){clearTimeout(r),clearTimeout(o),cancelAnimationFrame(i)}function n1(w){if(!v.state.isDestroyed){_t("onBeforeUpdate",[v,w]),Ar();var D=v.props,B=qc(n,Object.assign({},D,Lc(w),{ignoreAttributes:!0}));v.props=B,_r(),D.interactiveDebounce!==B.interactiveDebounce&&(hn(),m=Pc(Do,B.interactiveDebounce)),D.triggerTarget&&!B.triggerTarget?Bn(D.triggerTarget).forEach(function(G){G.removeAttribute("aria-expanded")}):B.triggerTarget&&n.removeAttribute("aria-expanded"),xe(),Tt(),A&&A(D,B),v.popperInstance&&(Vr(),zs().forEach(function(G){requestAnimationFrame(G._tippy.popperInstance.forceUpdate)})),_t("onAfterUpdate",[v,w])}}function r1(w){v.setProps({content:w})}function o1(){var w=v.state.isVisible,D=v.state.isDestroyed,B=!v.state.isEnabled,G=be.isTouch&&!v.props.touch,W=cs(v.props.duration,0,fe.duration);if(!(w||D||B||G)&&!U().hasAttribute("disabled")&&(_t("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,et()&&(C.style.visibility="visible"),Tt(),Yt(),v.state.isMounted||(C.style.transition="none"),et()){var zt=Z(),ie=zt.box,qn=zt.content;fs([ie,qn],0)}d=function(){var gn;if(!(!v.state.isVisible||c)){if(c=!0,C.offsetHeight,C.style.transition=v.props.moveTransition,et()&&v.props.animation){var Ls=Z(),Io=Ls.box,jn=Ls.content;fs([Io,jn],W),Fc([Io,jn],"visible")}De(),xe(),zc(ms,v),(gn=v.popperInstance)==null||gn.forceUpdate(),v.state.isMounted=!0,_t("onMount",[v]),v.props.animation&&et()&&Qe(W,function(){v.state.isShown=!0,_t("onShown",[v])})}},Qb()}}function i1(){var w=!v.state.isVisible,D=v.state.isDestroyed,B=!v.state.isEnabled,G=cs(v.props.duration,1,fe.duration);if(!(w||D||B)&&(_t("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,c=!1,s=!1,et()&&(C.style.visibility="hidden"),hn(),Xe(),Tt(),et()){var W=Z(),zt=W.box,ie=W.content;v.props.animation&&(fs([zt,ie],G),Fc([zt,ie],"hidden"))}De(),xe(),v.props.animation?et()&&Tr(G,v.unmount):v.unmount()}}function s1(w){Nt().addEventListener("mousemove",m),zc(vo,m),m(w)}function a1(){v.state.isVisible&&v.hide(),!!v.state.isMounted&&(Ir(),zs().forEach(function(w){w._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),ms=ms.filter(function(w){return w!==v}),v.state.isMounted=!1,_t("onHidden",[v]))}function l1(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),Ar(),delete n._tippy,v.state.isDestroyed=!0,_t("onDestroy",[v]))}}function Pn(n,t){t===void 0&&(t={});var e=fe.plugins.concat(t.plugins||[]);lv();var r=Object.assign({},t,{plugins:e}),o=nv(n),i=o.reduce(function(s,a){var l=a&&yv(a,r);return l&&s.push(l),s},[]);return mo(n)?i[0]:i}Pn.defaultProps=fe,Pn.setDefaultProps=hv,Pn.currentInput=be,Object.assign({},gc,{effect:function(t){var e=t.state,r={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,r.popper),e.styles=r,e.elements.arrow&&Object.assign(e.elements.arrow.style,r.arrow)}}),Pn.setDefaultProps({render:Kc});class bv{constructor({editor:t,element:e,view:r,tippyOptions:o={},shouldShow:i}){this.preventHide=!1,this.shouldShow=({state:s,from:a,to:l})=>{const{doc:c,selection:u}=s,{empty:p}=u,d=!c.textBetween(a,l).length&&tc(s.selection);return!(p||d)},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=e,this.view=r,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.tippyOptions=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:t}=this.editor.options,e=!!t.parentElement;this.tippy||!e||(this.tippy=Pn(t,x({duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle"},this.tippyOptions)))}update(t,e){var r,o;const{state:i,composing:s}=t,{doc:a,selection:l}=i,c=e&&e.doc.eq(a)&&e.selection.eq(l);if(s||c)return;this.createTooltip();const{ranges:u}=l,p=Math.min(...u.map(m=>m.$from.pos)),d=Math.max(...u.map(m=>m.$to.pos));if(!((r=this.shouldShow)===null||r===void 0?void 0:r.call(this,{editor:this.editor,view:t,state:i,oldState:e,from:p,to:d}))){this.hide();return}(o=this.tippy)===null||o===void 0||o.setProps({getReferenceClientRect:()=>{if($h(i.selection)){const m=t.nodeDOM(p);if(m)return m.getBoundingClientRect()}return pc(t,p,d)}}),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,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Uc=n=>new Ht({key:typeof n.pluginKey=="string"?new ae(n.pluginKey):n.pluginKey,view:t=>new bv(x({view:t},n))});yt.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Uc({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});class kv{constructor({editor:t,element:e,view:r,tippyOptions:o={},shouldShow:i}){this.preventHide=!1,this.shouldShow=({state:s})=>{const{selection:a}=s,{$anchor:l,empty:c}=a,u=l.depth===1,p=l.parent.isTextblock&&!l.parent.type.spec.code&&!l.parent.textContent;return!(!c||!u||!p)},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=e,this.view=r,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.tippyOptions=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:t}=this.editor.options,e=!!t.parentElement;this.tippy||!e||(this.tippy=Pn(t,x({duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle"},this.tippyOptions)))}update(t,e){var r,o;const{state:i,composing:s}=t,{doc:a,selection:l}=i,{from:c,to:u}=l,p=e&&e.doc.eq(a)&&e.selection.eq(l);if(s||p)return;if(this.createTooltip(),!((r=this.shouldShow)===null||r===void 0?void 0:r.call(this,{editor:this.editor,view:t,state:i,oldState:e}))){this.hide();return}(o=this.tippy)===null||o===void 0||o.setProps({getReferenceClientRect:()=>pc(t,c,u)}),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,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Gc=n=>new Ht({key:typeof n.pluginKey=="string"?new ae(n.pluginKey):n.pluginKey,view:t=>new kv(x({view:t},n))});yt.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Gc({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});const wv=f.defineComponent({name:"BubbleMenu",props:{pluginKey:{type:null,default:"bubbleMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(n,{slots:t}){const e=f.ref(null);return f.onMounted(()=>{const{pluginKey:r,editor:o,tippyOptions:i,shouldShow:s}=n;o.registerPlugin(Uc({pluginKey:r,editor:o,element:e.value,tippyOptions:i,shouldShow:s}))}),f.onBeforeUnmount(()=>{const{pluginKey:r,editor:o}=n;o.unregisterPlugin(r)}),()=>{var r;return f.h("div",{ref:e},(r=t.default)===null||r===void 0?void 0:r.call(t))}}});function Yc(n){return f.customRef((t,e)=>({get(){return t(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e()})})}}))}class Sv extends Jh{constructor(t={}){super(t);return this.vueRenderers=f.reactive(new Map),this.contentComponent=null,this.reactiveState=Yc(this.view.state),this.reactiveExtensionStorage=Yc(this.extensionStorage),this.on("transaction",()=>{this.reactiveState.value=this.view.state,this.reactiveExtensionStorage.value=this.extensionStorage}),f.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(t,e){super.registerPlugin(t,e),this.reactiveState.value=this.view.state}unregisterPlugin(t){super.unregisterPlugin(t),this.reactiveState.value=this.view.state}}const xv=f.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const t=f.ref(),e=f.getCurrentInstance();return f.watchEffect(()=>{const r=n.editor;r&&r.options.element&&t.value&&f.nextTick(()=>{if(!t.value||!r.options.element.firstChild)return;const o=f.unref(t.value);t.value.append(...r.options.element.childNodes),r.contentComponent=e.ctx._,r.setOptions({element:o}),r.createNodeViews()})}),f.onBeforeUnmount(()=>{const r=n.editor;if(!r||(r.isDestroyed||r.view.setProps({nodeViews:{}}),r.contentComponent=null,!r.options.element.firstChild))return;const o=document.createElement("div");o.append(...r.options.element.childNodes),r.setOptions({element:o})}),{rootEl:t}},render(){const n=[];return this.editor&&this.editor.vueRenderers.forEach(t=>{const e=f.h(f.Teleport,{to:t.teleportElement,key:t.id},f.h(t.component,x({ref:t.id},t.props)));n.push(e)}),f.h("div",{ref:t=>{this.rootEl=t}},...n)}});f.defineComponent({name:"FloatingMenu",props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(n,{slots:t}){const e=f.ref(null);return f.onMounted(()=>{const{pluginKey:r,editor:o,tippyOptions:i,shouldShow:s}=n;o.registerPlugin(Gc({pluginKey:r,editor:o,element:e.value,tippyOptions:i,shouldShow:s}))}),f.onBeforeUnmount(()=>{const{pluginKey:r,editor:o}=n;o.unregisterPlugin(r)}),()=>{var r;return f.h("div",{ref:e},(r=t.default)===null||r===void 0?void 0:r.call(t))}}}),f.defineComponent({props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,t;return f.h(this.as,{class:this.decorationClasses.value,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(t=(n=this.$slots).default)===null||t===void 0?void 0:t.call(n))}}),f.defineComponent({props:{as:{type:String,default:"div"}},render(){return f.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}});const Mv=/^```(?[a-z]*)?[\s\n]$/,Cv=/^~~~(?[a-z]*)?[\s\n]$/,Ev=bt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:n=>{var t;const{languageClassPrefix:e}=this.options,i=[...((t=n.firstElementChild)===null||t===void 0?void 0:t.classList)||[]].filter(s=>s.startsWith(e)).map(s=>s.replace(e,""))[0];return i||null},renderHTML:n=>n.language?{class:this.options.languageClassPrefix+n.language}:null}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({HTMLAttributes:n}){return["pre",this.options.HTMLAttributes,["code",n,0]]},addCommands(){return{setCodeBlock:n=>({commands:t})=>t.setNode("codeBlock",n),toggleCodeBlock:n=>({commands:t})=>t.toggleNode("codeBlock","paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:t}=this.editor.state.selection,e=t.pos===1;return!n||t.parent.type.name!==this.name?!1:e||!t.parent.textContent.length?this.editor.commands.clearNodes():!1}}},addInputRules(){return[ts({find:Mv,type:this.type,getAttributes:({groups:n})=>n}),ts({find:Cv,type:this.type,getAttributes:({groups:n})=>n})]},addProseMirrorPlugins(){return[new Ht({key:new ae("codeBlockVSCodeHandler"),props:{handlePaste:(n,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const e=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=o==null?void 0:o.mode;if(!e||!i)return!1;const{tr:s}=n.state;return s.replaceSelectionWith(this.type.create({language:i})),s.setSelection(K.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.insertText(e.replace(/\r\n?/g,` +`)),s.setMeta("paste",!0),n.dispatch(s),!0}}})]}}),Ov=qe.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark("underline"),toggleUnderline:()=>({commands:n})=>n.toggleMark("underline"),unsetUnderline:()=>({commands:n})=>n.unsetMark("underline")}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline()}}});function Xc(n,t,e){for(var r=0;;r++){if(r==n.childCount||r==t.childCount)return n.childCount==t.childCount?null:e;var o=n.child(r),i=t.child(r);if(o==i){e+=o.nodeSize;continue}if(!o.sameMarkup(i))return e;if(o.isText&&o.text!=i.text){for(var s=0;o.text[s]==i.text[s];s++)e++;return e}if(o.content.size||i.content.size){var a=Xc(o.content,i.content,e+1);if(a!=null)return a}e+=o.nodeSize}}function Qc(n,t,e,r){for(var o=n.childCount,i=t.childCount;;){if(o==0||i==0)return o==i?null:{a:e,b:r};var s=n.child(--o),a=t.child(--i),l=s.nodeSize;if(s==a){e-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:e,b:r};if(s.isText&&s.text!=a.text){for(var c=0,u=Math.min(s.text.length,a.text.length);ct&&r(l,o+a,i,s)!==!1&&l.content.size){var u=a+1;l.nodesBetween(Math.max(0,t-u),Math.min(l.content.size,e-u),r,o+u)}a=c}},E.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},E.prototype.textBetween=function(t,e,r,o){var i="",s=!0;return this.nodesBetween(t,e,function(a,l){a.isText?(i+=a.text.slice(Math.max(t,l)-l,e-l),s=!r):a.isLeaf&&o?(i+=typeof o=="function"?o(a):o,s=!r):!s&&a.isBlock&&(i+=r,s=!0)},0),i},E.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(e.isText&&e.sameMarkup(r)&&(o[o.length-1]=e.withText(e.text+r.text),i=1);it)for(var i=0,s=0;st&&((se)&&(a.isText?a=a.cut(Math.max(0,t-s),Math.min(a.text.length,e-s)):a=a.cut(Math.max(0,t-s-1),Math.min(a.content.size,e-s-1))),r.push(a),o+=a.nodeSize),s=l}return new E(r,o)},E.prototype.cutByIndex=function(t,e){return t==e?E.empty:t==0&&e==this.content.length?this:new E(this.content.slice(t,e))},E.prototype.replaceChild=function(t,e){var r=this.content[t];if(r==e)return this;var o=this.content.slice(),i=this.size+e.nodeSize-r.nodeSize;return o[t]=e,new E(o,i)},E.prototype.addToStart=function(t){return new E([t].concat(this.content),this.size+t.nodeSize)},E.prototype.addToEnd=function(t){return new E(this.content.concat(t),this.size+t.nodeSize)},E.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;ethis.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var r=0,o=0;;r++){var i=this.child(r),s=o+i.nodeSize;if(s>=t)return s==t||e>0?yo(r+1,s):yo(r,o);o=s}},E.prototype.toString=function(){return"<"+this.toStringInner()+">"},E.prototype.toStringInner=function(){return this.content.join(", ")},E.prototype.toJSON=function(){return this.content.length?this.content.map(function(t){return t.toJSON()}):null},E.fromJSON=function(t,e){if(!e)return E.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new E(e.map(t.nodeFromJSON))},E.fromArray=function(t){if(!t.length)return E.empty;for(var e,r=0,o=0;othis.type.rank&&(e||(e=t.slice(0,o)),e.push(this),r=!0),e&&e.push(i)}}return e||(e=t.slice()),r||e.push(this),e},q.prototype.removeFromSet=function(t){for(var e=0;e0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},R.fromJSON=function(t,e){if(!e)return R.empty;var r=e.openStart||0,o=e.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new R(E.fromJSON(t,e.content),r,o)},R.maxOpen=function(t,e){e===void 0&&(e=!0);for(var r=0,o=0,i=t.firstChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.firstChild)r++;for(var s=t.lastChild;s&&!s.isLeaf&&(e||!s.type.spec.isolating);s=s.lastChild)o++;return new R(t,r,o)},Object.defineProperties(R.prototype,Zc);function tu(n,t,e){var r=n.findIndex(t),o=r.index,i=r.offset,s=n.maybeChild(o),a=n.findIndex(e),l=a.index,c=a.offset;if(i==t||s.isText){if(c!=e&&!n.child(l).isText)throw new RangeError("Removing non-flat range");return n.cut(0,t).append(n.cut(e))}if(o!=l)throw new RangeError("Removing non-flat range");return n.replaceChild(o,s.copy(tu(s.content,t-i-1,e-i-1)))}function eu(n,t,e,r){var o=n.findIndex(t),i=o.index,s=o.offset,a=n.maybeChild(i);if(s==t||a.isText)return r&&!r.canReplace(i,i,e)?null:n.cut(0,t).append(e).append(n.cut(t));var l=eu(a.content,t-s-1,e);return l&&n.replaceChild(i,a.copy(l))}R.empty=new R(E.empty,0,0);function Nv(n,t,e){if(e.openStart>n.depth)throw new ke("Inserted content deeper than insertion position");if(n.depth-e.openStart!=t.depth-e.openEnd)throw new ke("Inconsistent open depths");return nu(n,t,e,0)}function nu(n,t,e,r){var o=n.index(r),i=n.node(r);if(o==t.index(r)&&r=0&&n.isText&&n.sameMarkup(t[e])?t[e]=n.withText(t[e].text+n.text):t.push(n)}function yr(n,t,e,r){var o=(t||n).node(e),i=0,s=t?t.index(e):o.childCount;n&&(i=n.index(e),n.depth>e?i++:n.textOffset&&(un(n.nodeAfter,r),i++));for(var a=i;ao&&gs(n,t,o+1),s=r.depth>o&&gs(e,r,o+1),a=[];return yr(null,n,o,a),i&&s&&t.index(o)==e.index(o)?(ru(i,s),un(fn(i,ou(n,t,e,r,o+1)),a)):(i&&un(fn(i,ko(n,t,o+1)),a),yr(t,e,o,a),s&&un(fn(s,ko(e,r,o+1)),a)),yr(r,null,o,a),new E(a)}function ko(n,t,e){var r=[];if(yr(null,n,e,r),n.depth>e){var o=gs(n,t,e+1);un(fn(o,ko(n,t,e+1)),r)}return yr(t,null,e,r),new E(r)}function Tv(n,t){for(var e=t.depth-n.openStart,r=t.node(e),o=r.copy(n.content),i=e-1;i>=0;i--)o=t.node(i).copy(E.from(o));return{start:o.resolveNoCache(n.openStart+e),end:o.resolveNoCache(o.content.size-n.openEnd-e)}}var rt=function(t,e,r){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=r},zn={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};rt.prototype.resolveDepth=function(t){return t==null?this.depth:t<0?this.depth+t:t},zn.parent.get=function(){return this.node(this.depth)},zn.doc.get=function(){return this.node(0)},rt.prototype.node=function(t){return this.path[this.resolveDepth(t)*3]},rt.prototype.index=function(t){return this.path[this.resolveDepth(t)*3+1]},rt.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)},rt.prototype.start=function(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1},rt.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},rt.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]},rt.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},zn.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},zn.nodeAfter.get=function(){var n=this.parent,t=this.index(this.depth);if(t==n.childCount)return null;var e=this.pos-this.path[this.path.length-1],r=n.child(t);return e?n.child(t).cut(e):r},zn.nodeBefore.get=function(){var n=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(n).cut(0,t):n==0?null:this.parent.child(n-1)},rt.prototype.posAtIndex=function(t,e){e=this.resolveDepth(e);for(var r=this.path[e*3],o=e==0?0:this.path[e*3-1]+1,i=0;i0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},rt.prototype.blockRange=function(t,e){if(t===void 0&&(t=this),t.pos=0;r--)if(t.pos<=this.end(r)&&(!e||e(this.node(r))))return new iu(this,t,r)},rt.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},rt.prototype.max=function(t){return t.pos>this.pos?t:this},rt.prototype.min=function(t){return t.pos=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var r=[],o=0,i=e,s=t;;){var a=s.content.findIndex(i),l=a.index,c=a.offset,u=i-c;if(r.push(s,l,o+c),!u||(s=s.child(l),s.isText))break;i=u-1,o+=c+1}return new rt(e,r,i)},rt.resolveCached=function(t,e){for(var r=0;rt&&this.nodesBetween(t,e,function(i){return r.isInSet(i.marks)&&(o=!0),!o}),o},Ut.isBlock.get=function(){return this.type.isBlock},Ut.isTextblock.get=function(){return this.type.isTextblock},Ut.inlineContent.get=function(){return this.type.inlineContent},Ut.isInline.get=function(){return this.type.isInline},Ut.isText.get=function(){return this.type.isText},Ut.isLeaf.get=function(){return this.type.isLeaf},Ut.isAtom.get=function(){return this.type.isAtom},j.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()+")"),Dv(this.marks,t)},j.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},j.prototype.canReplace=function(t,e,r,o,i){r===void 0&&(r=E.empty),o===void 0&&(o=0),i===void 0&&(i=r.childCount);var s=this.contentMatchAt(t).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(var l=o;l=0;e--)t=n[e].type.name+"("+t+")";return t}var Vt=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},wo={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};Vt.parse=function(t,e){var r=new So(t,e);if(r.next==null)return Vt.empty;var o=au(r);r.next&&r.err("Unexpected trailing text");var i=Lv(zv(o));return Fv(i,r),i},Vt.prototype.matchType=function(t){for(var e=0;e>1},Vt.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},Vt.prototype.toString=function(){var t=[];function e(r){t.push(r);for(var o=1;o"+t.indexOf(r.next[s+1]);return i}).join(` +`)},Object.defineProperties(Vt.prototype,wo),Vt.empty=new Vt(!0);var So=function(t,e){this.string=t,this.nodeTypes=e,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()},su={next:{configurable:!0}};su.next.get=function(){return this.tokens[this.pos]},So.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},So.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties(So.prototype,su);function au(n){var t=[];do t.push(Rv(n));while(n.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function Rv(n){var t=[];do t.push(Vv(n));while(n.next&&n.next!=")"&&n.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function Vv(n){for(var t=Pv(n);;)if(n.eat("+"))t={type:"plus",expr:t};else if(n.eat("*"))t={type:"star",expr:t};else if(n.eat("?"))t={type:"opt",expr:t};else if(n.eat("{"))t=Iv(n,t);else break;return t}function lu(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");var t=Number(n.next);return n.pos++,t}function Iv(n,t){var e=lu(n),r=e;return n.eat(",")&&(n.next!="}"?r=lu(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:e,max:r,expr:t}}function Bv(n,t){var e=n.nodeTypes,r=e[t];if(r)return[r];var o=[];for(var i in e){var s=e[i];s.groups.indexOf(t)>-1&&o.push(s)}return o.length==0&&n.err("No node type or group '"+t+"' found"),o}function Pv(n){if(n.eat("(")){var t=au(n);return n.eat(")")||n.err("Missing closing paren"),t}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{var e=Bv(n,n.next).map(function(r){return n.inline==null?n.inline=r.isInline:n.inline!=r.isInline&&n.err("Mixing inline and block content"),{type:"name",value:r}});return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function zv(n){var t=[[]];return o(i(n,0),e()),t;function e(){return t.push([])-1}function r(s,a,l){var c={term:l,to:a};return t[s].push(c),c}function o(s,a){s.forEach(function(l){return l.to=a})}function i(s,a){if(s.type=="choice")return s.exprs.reduce(function(k,b){return k.concat(i(b,a))},[]);if(s.type=="seq")for(var l=0;;l++){var c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=e())}else if(s.type=="star"){var u=e();return r(a,u),o(i(s.expr,u),u),[r(u)]}else if(s.type=="plus"){var p=e();return o(i(s.expr,a),p),o(i(s.expr,p),p),[r(p)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){for(var d=a,h=0;h-1&&o[d+1];uu(n,p).forEach(function(m){h||o.push(u,h=[]),h.indexOf(m)==-1&&h.push(m)})}})});for(var i=t[r.join(",")]=new Vt(r.indexOf(n.length-1)>-1),s=0;s-1},Gt.prototype.allowsMarks=function(t){if(this.markSet==null)return!0;for(var e=0;e-1};var ks={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},Hv={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},vu={ol:!0,ul:!0},ws=1,Ss=2,kr=4;function gu(n){return(n?ws:0)|(n==="full"?Ss:0)}var Ae=function(t,e,r,o,i,s,a){this.type=t,this.attrs=e,this.solid=i,this.match=s||(a&kr?null:t.contentMatch),this.options=a,this.content=[],this.marks=r,this.activeMarks=q.none,this.pendingMarks=o,this.stashMarks=[]};Ae.prototype.findWrapping=function(t){if(!this.match){if(!this.type)return[];var e=this.type.contentMatch.fillBefore(E.from(t));if(e)this.match=this.type.contentMatch.matchFragment(e);else{var r=this.type.contentMatch,o;return(o=r.findWrapping(t.type))?(this.match=r,o):null}}return this.match.findWrapping(t.type)},Ae.prototype.finish=function(t){if(!(this.options&ws)){var e=this.content[this.content.length-1],r;e&&e.isText&&(r=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-r[0].length)))}var o=E.from(this.content);return!t&&this.match&&(o=o.append(this.match.fillBefore(E.empty,!0))),this.type?this.type.create(this.attrs,o,this.marks):o},Ae.prototype.popFromStashMark=function(t){for(var e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},Ae.prototype.applyPending=function(t){for(var e=0,r=this.pendingMarks;e=0;o--){var i=this.nodes[o],s=i.findWrapping(t);if(s&&(!e||e.length>s.length)&&(e=s,r=i,!s.length)||i.solid)break}if(!e)return!1;this.sync(r);for(var a=0;athis.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},ot.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},ot.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t){this.open=e;return}},xs.currentPos.get=function(){this.closeExtra();for(var n=0,t=this.open;t>=0;t--){for(var e=this.nodes[t].content,r=e.length-1;r>=0;r--)n+=e[r].nodeSize;t&&n++}return n},ot.prototype.findAtPoint=function(t,e){if(this.find)for(var r=0;r-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var r=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(l,c){for(;l>=0;l--){var u=r[l];if(u==""){if(l==r.length-1||l==0)continue;for(;c>=s;c--)if(a(l-1,c))return!0;return!1}else{var p=c>0||c==0&&i?e.nodes[c].type:o&&c>=s?o.node(c-s).type:null;if(!p||p.name!=u&&p.groups.indexOf(u)==-1)return!1;c--}}return!0};return a(r.length-1,this.open)},ot.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var r=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(var o in this.parser.schema.nodes){var i=this.parser.schema.nodes[o];if(i.isTextblock&&i.defaultAttrs)return i}},ot.prototype.addPendingMark=function(t){var e=jv(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},ot.prototype.removePendingMark=function(t,e){for(var r=this.open;r>=0;r--){var o=this.nodes[r],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==e)break}},Object.defineProperties(ot.prototype,xs);function Jv(n){for(var t=n.firstChild,e=null;t;t=t.nextSibling){var r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&vu.hasOwnProperty(r)&&e?(e.appendChild(t),t=e):r=="li"?e=t:r&&(e=null)}}function $v(n){for(var t=/\s*([\w-]+)\s*:\s*([^;]+)/g,e,r=[];e=t.exec(n);)r.push(e[1],e[2].trim());return r}function qv(n,t){var e=t.schema.nodes,r=function(s){var a=e[s];if(!!a.allowsMarkType(n)){var l=[],c=function(u){l.push(u);for(var p=0;pt)break;var c=this.ranges[a+i],u=this.ranges[a+s],p=l+c;if(t<=p){var d=c?t==l?-1:t==p?1:e:e,h=l+o+(d<0?0:u);if(r)return h;var m=t==(e<0?l:p)?null:Wv(a/3,t-l);return new Ms(h,e<0?t!=l:t!=p,m)}o+=u-c}return r?t+o:new Ms(t+o)},kt.prototype.touches=function(t,e){for(var r=0,o=ku(e),i=this.inverted?2:1,s=this.inverted?1:2,a=0;at)break;var c=this.ranges[a+i],u=l+c;if(t<=u&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1},kt.prototype.forEach=function(t){for(var e=this.inverted?2:1,r=this.inverted?1:2,o=0,i=0;o=0;e--){var o=t.getMirror(e);this.appendMap(t.maps[e].invert(),o!=null&&o>e?r-o-1:null)}},It.prototype.invert=function(){var t=new It;return t.appendMappingInverted(this),t},It.prototype.map=function(t,e){if(e===void 0&&(e=1),this.mirror)return this._map(t,e,!0);for(var r=this.from;ri&&l0},lt.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(lt.prototype,Cs);function xo(){throw new Error("Override me")}var Es=Object.create(null),Ot=function(){};Ot.prototype.apply=function(t){return xo()},Ot.prototype.getMap=function(){return kt.empty},Ot.prototype.invert=function(t){return xo()},Ot.prototype.map=function(t){return xo()},Ot.prototype.merge=function(t){return null},Ot.prototype.toJSON=function(){return xo()},Ot.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var r=Es[e.stepType];if(!r)throw new RangeError("No step type "+e.stepType+" defined");return r.fromJSON(t,e)},Ot.jsonID=function(t,e){if(t in Es)throw new RangeError("Duplicate use of step JSON ID "+t);return Es[t]=e,e.prototype.jsonID=t,e};var Bt=function(t,e){this.doc=t,this.failed=e};Bt.ok=function(t){return new Bt(t,null)},Bt.fail=function(t){return new Bt(null,t)},Bt.fromReplace=function(t,e,r,o){try{return Bt.ok(t.replace(e,r,o))}catch(i){if(i instanceof ke)return Bt.fail(i.message);throw i}};var Ke=function(n){function t(e,r,o,i){n.call(this),this.from=e,this.to=r,this.slice=o,this.structure=!!i}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.apply=function(r){return this.structure&&Os(r,this.from,this.to)?Bt.fail("Structure replace would overwrite content"):Bt.fromReplace(r,this.from,this.to,this.slice)},t.prototype.getMap=function(){return new kt([this.from,this.to-this.from,this.slice.size])},t.prototype.invert=function(r){return new t(this.from,this.from+this.slice.size,r.slice(this.from,this.to))},t.prototype.map=function(r){var o=r.mapResult(this.from,1),i=r.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(r){if(!(r instanceof t)||r.structure||this.structure)return null;if(this.from+this.slice.size==r.from&&!this.slice.openEnd&&!r.slice.openStart){var o=this.slice.size+r.slice.size==0?R.empty:new R(this.slice.content.append(r.slice.content),this.slice.openStart,r.slice.openEnd);return new t(this.from,this.to+(r.to-r.from),o,this.structure)}else if(r.to==this.from&&!this.slice.openStart&&!r.slice.openEnd){var i=this.slice.size+r.slice.size==0?R.empty:new R(r.slice.content.append(this.slice.content),r.slice.openStart,this.slice.openEnd);return new t(r.from,this.to,i,this.structure)}else return null},t.prototype.toJSON=function(){var r={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(r.slice=this.slice.toJSON()),this.structure&&(r.structure=!0),r},t.fromJSON=function(r,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,R.fromJSON(r,o.slice),!!o.structure)},t}(Ot);Ot.jsonID("replace",Ke);var dn=function(n){function t(e,r,o,i,s,a,l){n.call(this),this.from=e,this.to=r,this.gapFrom=o,this.gapTo=i,this.slice=s,this.insert=a,this.structure=!!l}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.apply=function(r){if(this.structure&&(Os(r,this.from,this.gapFrom)||Os(r,this.gapTo,this.to)))return Bt.fail("Structure gap-replace would overwrite content");var o=r.slice(this.gapFrom,this.gapTo);if(o.openStart||o.openEnd)return Bt.fail("Gap is not a flat range");var i=this.slice.insertAt(this.insert,o.content);return i?Bt.fromReplace(r,this.from,this.to,i):Bt.fail("Content does not fit in gap")},t.prototype.getMap=function(){return new kt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},t.prototype.invert=function(r){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,r.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},t.prototype.map=function(r){var o=r.mapResult(this.from,1),i=r.mapResult(this.to,-1),s=r.map(this.gapFrom,-1),a=r.map(this.gapTo,1);return o.deleted&&i.deleted||si.pos?null:new t(o.pos,i.pos,s,a,this.slice,this.insert,this.structure)},t.prototype.toJSON=function(){var r={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(r.slice=this.slice.toJSON()),this.structure&&(r.structure=!0),r},t.fromJSON=function(r,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,R.fromJSON(r,o.slice),o.insert,!!o.structure)},t}(Ot);Ot.jsonID("replaceAround",dn);function Os(n,t,e){for(var r=n.resolve(t),o=e-t,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}lt.prototype.lift=function(n,t){for(var e=n.$from,r=n.$to,o=n.depth,i=e.before(o+1),s=r.after(o+1),a=i,l=s,c=E.empty,u=0,p=o,d=!1;p>t;p--)d||e.index(p)>0?(d=!0,c=E.from(e.node(p).copy(c)),u++):a--;for(var h=E.empty,m=0,g=o,y=!1;g>t;g--)y||r.after(g+1)=0;r--)e=E.from(t[r].type.create(t[r].attrs,e));var o=n.start,i=n.end;return this.step(new dn(o,i,o,i,new R(e,0,0),t.length,!0))},lt.prototype.setBlockType=function(n,t,e,r){var o=this;if(t===void 0&&(t=n),!e.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=this.steps.length;return this.doc.nodesBetween(n,t,function(s,a){if(s.isTextblock&&!s.hasMarkup(e,r)&&Uv(o.doc,o.mapping.slice(i).map(a),e)){o.clearIncompatible(o.mapping.slice(i).map(a,1),e);var l=o.mapping.slice(i),c=l.map(a,1),u=l.map(a+s.nodeSize,1);return o.step(new dn(c,u,c+1,u-1,new R(E.from(e.create(r,null,s.marks)),0,0),1,!0)),!1}}),this};function Uv(n,t,e){var r=n.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,e)}lt.prototype.setNodeMarkup=function(n,t,e,r){var o=this.doc.nodeAt(n);if(!o)throw new RangeError("No node at given position");t||(t=o.type);var i=t.create(e,null,r||o.marks);if(o.isLeaf)return this.replaceWith(n,n+o.nodeSize,i);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);return this.step(new dn(n,n+o.nodeSize,n+1,n+o.nodeSize-1,new R(E.from(i),0,0),1,!0))},lt.prototype.split=function(n,t,e){t===void 0&&(t=1);for(var r=this.doc.resolve(n),o=E.empty,i=E.empty,s=r.depth,a=r.depth-t,l=t-1;s>a;s--,l--){o=E.from(r.node(s).copy(o));var c=e&&e[l];i=E.from(c?c.type.create(c.attrs,i):r.node(s).copy(i))}return this.step(new Ke(n,n,new R(o.append(i),t,t),!0))},lt.prototype.join=function(n,t){t===void 0&&(t=1);var e=new Ke(n-t,n+t,R.empty,!0);return this.step(e)};function Gv(n,t,e){var r=n.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),e))return t;if(r.parentOffset==0)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,e))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,e))return r.after(s+1);if(a=i.pos?null:new t(o.pos,i.pos,this.mark)},t.prototype.merge=function(r){if(r instanceof t&&r.mark.eq(this.mark)&&this.from<=r.to&&this.to>=r.from)return new t(Math.min(this.from,r.from),Math.max(this.to,r.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(r,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,r.markFromJSON(o.mark))},t}(Ot);Ot.jsonID("addMark",Ts);var wr=function(n){function t(e,r,o){n.call(this),this.from=e,this.to=r,this.mark=o}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.apply=function(r){var o=this,i=r.slice(this.from,this.to),s=new R(Ns(i.content,function(a){return a.mark(o.mark.removeFromSet(a.marks))}),i.openStart,i.openEnd);return Bt.fromReplace(r,this.from,this.to,s)},t.prototype.invert=function(){return new Ts(this.from,this.to,this.mark)},t.prototype.map=function(r){var o=r.mapResult(this.from,1),i=r.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(r){if(r instanceof t&&r.mark.eq(this.mark)&&this.from<=r.to&&this.to>=r.from)return new t(Math.min(this.from,r.from),Math.max(this.to,r.to),this.mark)},t.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},t.fromJSON=function(r,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,r.markFromJSON(o.mark))},t}(Ot);Ot.jsonID("removeMark",wr),lt.prototype.addMark=function(n,t,e){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(n,t,function(l,c,u){if(!!l.isInline){var p=l.marks;if(!e.isInSet(p)&&u.type.allowsMarkType(e.type)){for(var d=Math.max(c,n),h=Math.min(c+l.nodeSize,t),m=e.addToSet(p),g=0;g=0;d--)this.step(o[d]);return this};function Yv(n,t,e,r){if(e===void 0&&(e=t),r===void 0&&(r=R.empty),t==e&&!r.size)return null;var o=n.resolve(t),i=n.resolve(e);return wu(o,i,r)?new Ke(t,e,r):new oe(o,i,r).fit()}lt.prototype.replace=function(n,t,e){t===void 0&&(t=n),e===void 0&&(e=R.empty);var r=Yv(this.doc,n,t,e);return r&&this.step(r),this},lt.prototype.replaceWith=function(n,t,e){return this.replace(n,t,new R(E.from(e),0,0))},lt.prototype.delete=function(n,t){return this.replace(n,t,R.empty)},lt.prototype.insert=function(n,t){return this.replaceWith(n,n,t)};function wu(n,t,e){return!e.openStart&&!e.openEnd&&n.start()==t.start()&&n.parent.canReplace(n.index(),t.index(),e.content)}var oe=function(t,e,r){this.$to=e,this.$from=t,this.unplaced=r,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=E.empty;for(var s=t.depth;s>0;s--)this.placed=E.from(t.node(s).copy(this.placed))},Su={depth:{configurable:!0}};Su.depth.get=function(){return this.frontier.length-1},oe.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var e=this.mustMoveInline(),r=this.placed.size-this.depth-this.$from.depth,o=this.$from,i=this.close(e<0?this.$to:o.doc.resolve(e));if(!i)return null;for(var s=this.placed,a=o.depth,l=i.depth;a&&l&&s.childCount==1;)s=s.firstChild.content,a--,l--;var c=new R(s,a,l);if(e>-1)return new dn(o.pos,e,this.$to.pos,this.$to.end(),c,r);if(c.size||o.pos!=this.$to.pos)return new Ke(o.pos,i.pos,c)},oe.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var e=this.unplaced.openStart;e>=0;e--){var r=void 0,o=void 0;e?(o=_s(this.unplaced.content,e-1).firstChild,r=o.content):r=this.unplaced.content;for(var i=r.firstChild,s=this.depth;s>=0;s--){var a=this.frontier[s],l=a.type,c=a.match,u=void 0,p=void 0;if(t==1&&(i?c.matchType(i.type)||(p=c.fillBefore(E.from(i),!1)):l.compatibleContent(o.type)))return{sliceDepth:e,frontierDepth:s,parent:o,inject:p};if(t==2&&i&&(u=c.findWrapping(i.type)))return{sliceDepth:e,frontierDepth:s,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}},oe.prototype.openMore=function(){var t=this.unplaced,e=t.content,r=t.openStart,o=t.openEnd,i=_s(e,r);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new R(e,r+1,Math.max(o,i.size+r>=e.size-o?r+1:0)),!0)},oe.prototype.dropNode=function(){var t=this.unplaced,e=t.content,r=t.openStart,o=t.openEnd,i=_s(e,r);if(i.childCount<=1&&r>0){var s=e.size-r<=r+i.size;this.unplaced=new R(Sr(e,r-1,1),r-1,s?r-1:o)}else this.unplaced=new R(Sr(e,r,1),r,o)},oe.prototype.placeNodes=function(t){for(var e=t.sliceDepth,r=t.frontierDepth,o=t.parent,i=t.inject,s=t.wrap;this.depth>r;)this.closeFrontierNode();if(s)for(var a=0;a1||u==0||b.content.size)&&(m=N,d.push(xu(b.mark(g.allowedMarks(b.marks)),p==1?u:0,p==c.childCount?k:-1)))}var v=p==c.childCount;v||(k=-1),this.placed=xr(this.placed,r,E.from(d)),this.frontier[r].match=m,v&&k<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var O=0,C=c;O1&&i==this.$to.end(--o);)++i;return i},oe.prototype.findCloseLevel=function(t){t:for(var e=Math.min(this.depth,t.depth);e>=0;e--){var r=this.frontier[e],o=r.match,i=r.type,s=e=0;l--){var c=this.frontier[l],u=c.match,p=c.type,d=As(t,l,p,u,!0);if(!d||d.childCount)continue t}return{depth:e,fit:a,move:s?t.doc.resolve(t.after(e+1)):t}}}},oe.prototype.close=function(t){var e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=xr(this.placed,e.depth,e.fit)),t=e.move;for(var r=e.depth+1;r<=t.depth;r++){var o=t.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,t.index(r));this.openFrontierNode(o.type,o.attrs,i)}return t},oe.prototype.openFrontierNode=function(t,e,r){var o=this.frontier[this.depth];o.match=o.match.matchType(t),this.placed=xr(this.placed,this.depth,E.from(t.create(e,r))),this.frontier.push({type:t,match:t.contentMatch})},oe.prototype.closeFrontierNode=function(){var t=this.frontier.pop(),e=t.match.fillBefore(E.empty,!0);e.childCount&&(this.placed=xr(this.placed,this.frontier.length,e))},Object.defineProperties(oe.prototype,Su);function Sr(n,t,e){return t==0?n.cutByIndex(e):n.replaceChild(0,n.firstChild.copy(Sr(n.firstChild.content,t-1,e)))}function xr(n,t,e){return t==0?n.append(e):n.replaceChild(n.childCount-1,n.lastChild.copy(xr(n.lastChild.content,t-1,e)))}function _s(n,t){for(var e=0;e1&&(r=r.replaceChild(0,xu(r.firstChild,t-1,r.childCount==1?e-1:0))),t>0&&(r=n.type.contentMatch.fillBefore(r).append(r),e<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(E.empty,!0)))),n.copy(r)}function As(n,t,e,r,o){var i=n.node(t),s=o?n.indexAfter(t):n.index(t);if(s==i.childCount&&!e.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!Xv(e,i.content,s)?a:null}function Xv(n,t,e){for(var r=e;r0;a--,l--){var c=r.node(a).type.spec;if(c.defining||c.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==l&&i.splice(1,0,-a)}for(var u=i.indexOf(s),p=[],d=e.openStart,h=e.content,m=0;;m++){var g=h.firstChild;if(p.push(g),m==e.openStart)break;h=g.content}d>0&&p[d-1].type.spec.defining&&r.node(u).type!=p[d-1].type?d-=1:d>=2&&p[d-1].isTextblock&&p[d-2].type.spec.defining&&r.node(u).type!=p[d-2].type&&(d-=2);for(var y=e.openStart;y>=0;y--){var k=(y+d+1)%(e.openStart+1),b=p[k];if(!!b)for(var N=0;N=0&&(this.replace(n,t,e),!(this.steps.length>I));V--){var F=i[V];F<0||(n=r.before(F),t=o.after(F))}return this};function Mu(n,t,e,r,o){if(tr){var s=o.contentMatchAt(0),a=s.fillBefore(n).append(n);n=a.append(s.matchFragment(a).fillBefore(E.empty,!0))}return n}lt.prototype.replaceRangeWith=function(n,t,e){if(!e.isInline&&n==t&&this.doc.resolve(n).parent.content.size){var r=Gv(this.doc,n,e.type);r!=null&&(n=t=r)}return this.replaceRange(n,t,new R(E.from(e),0,0))},lt.prototype.deleteRange=function(n,t){for(var e=this.doc.resolve(n),r=this.doc.resolve(t),o=Cu(e,r),i=0;i0&&(a||e.node(s-1).canReplace(e.index(s-1),r.indexAfter(s-1))))return this.delete(e.before(s),r.after(s))}for(var l=1;l<=e.depth&&l<=r.depth;l++)if(n-e.start(l)==e.depth-l&&t>e.end(l)&&r.end(l)-t!=r.depth-l)return this.delete(e.before(l),t);return this.delete(n,t)};function Cu(n,t){for(var e=[],r=Math.min(n.depth,t.depth),o=r;o>=0;o--){var i=n.start(o);if(it.pos+(t.depth-o)||n.node(o).type.spec.isolating||t.node(o).type.spec.isolating)break;(i==t.start(o)||o==n.depth&&o==t.depth&&n.parent.inlineContent&&t.parent.inlineContent&&o&&t.start(o-1)==i-1)&&e.push(o)}return e}var Ds=Object.create(null),it=function(t,e,r){this.ranges=r||[new Qv(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},Ue={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};Ue.anchor.get=function(){return this.$anchor.pos},Ue.head.get=function(){return this.$head.pos},Ue.from.get=function(){return this.$from.pos},Ue.to.get=function(){return this.$to.pos},Ue.$from.get=function(){return this.ranges[0].$from},Ue.$to.get=function(){return this.ranges[0].$to},Ue.empty.get=function(){for(var n=this.ranges,t=0;t=0;i--){var s=e<0?Jn(t.node(0),t.node(i),t.before(i+1),t.index(i),e,r):Jn(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,e,r);if(s)return s}},it.near=function(t,e){return e===void 0&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new Er(t.node(0))},it.atStart=function(t){return Jn(t,t,0,0,1)||new Er(t)},it.atEnd=function(t){return Jn(t,t,t.content.size,t.childCount,-1)||new Er(t)},it.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var r=Ds[e.type];if(!r)throw new RangeError("No selection type "+e.type+" defined");return r.fromJSON(t,e)},it.jsonID=function(t,e){if(t in Ds)throw new RangeError("Duplicate use of selection JSON ID "+t);return Ds[t]=e,e.prototype.jsonID=t,e},it.prototype.getBookmark=function(){return Mr.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(it.prototype,Ue),it.prototype.visible=!0;var Qv=function(t,e){this.$from=t,this.$to=e},Mr=function(n){function t(r,o){o===void 0&&(o=r),n.call(this,r,o)}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={$cursor:{configurable:!0}};return e.$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 n.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=R.empty),n.prototype.replace.call(this,o,i),i==R.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 Cr(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 l=n.findFrom(i,s,!0)||n.findFrom(i,-s,!0);if(l)i=l.$head;else return n.near(i,s)}return o.parent.inlineContent||(a==0?o=i:(o=(n.findFrom(o,-s,!0)||n.findFrom(o,s,!0)).$anchor,o.pos0?0:1);o>0?s=0;s+=o){var a=t.child(s);if(a.isAtom){if(!i&&Hn.isSelectable(a))return Hn.create(n,e-(o<0?a.nodeSize:0))}else{var l=Jn(n,a,e+o,o<0?a.childCount:0,o,i);if(l)return l}e+=a.nodeSize*o}}function Eu(n,t,e){var r=n.steps.length-1;if(!(r0},t.prototype.setStoredMarks=function(o){return this.storedMarks=o,this.updated|=Co,this},t.prototype.ensureMarks=function(o){return q.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()))},e.storedMarksSet.get=function(){return(this.updated&Co)>0},t.prototype.addStep=function(o,i){n.prototype.addStep.call(this,o,i),this.updated=this.updated&~Co,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)||q.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 l=this.storedMarks;if(!l){var c=this.doc.resolve(i);l=s==i?c.marks():c.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(i,s,a.text(o,l)),this.selection.empty||this.setSelection(it.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]},e.isGeneric.get=function(){for(var r in this.meta)return!1;return!0},t.prototype.scrollIntoView=function(){return this.updated|=Nu,this},e.scrolledIntoView.get=function(){return(this.updated&Nu)>0},Object.defineProperties(t.prototype,e),t}(lt);function Tu(n,t){return!t||!n?n:n.bind(t)}var Or=function(t,e,r){this.name=t,this.init=Tu(e.init,r),this.apply=Tu(e.apply,r)},eg=[new Or("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new Or("selection",{init:function(t,e){return t.selection||it.atStart(e.doc)},apply:function(t){return t.selection}}),new Or("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,r,o){return o.selection.$cursor?t.storedMarks:null}}),new Or("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],Rs=function(t,e){var r=this;this.schema=t,this.fields=eg.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach(function(o){if(r.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");r.plugins.push(o),r.pluginsByKey[o.key]=o,o.spec.state&&r.fields.push(new Or(o.key,o.spec.state,o))})},Pt=function(t){this.config=t},Eo={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};Eo.schema.get=function(){return this.config.schema},Eo.plugins.get=function(){return this.config.plugins},Pt.prototype.apply=function(t){return this.applyTransaction(t).state},Pt.prototype.filterTransaction=function(t,e){e===void 0&&(e=-1);for(var r=0;r-1&&Nr.splice(e,1)},Object.defineProperties(Pt.prototype,Eo);var Nr=[];function _u(n,t,e){for(var r in n){var o=n[r];o instanceof Function?o=o.bind(t):r=="handleDOMEvents"&&(o=_u(o,t,{})),e[r]=o}return e}var Au=function(t){this.props={},t.props&&_u(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:Du("plugin")};Au.prototype.getState=function(t){return t[this.key]};var Vs=Object.create(null);function Du(n){return n in Vs?n+"$"+ ++Vs[n]:(Vs[n]=0,n+"$")}var Is=function(t){t===void 0&&(t="key"),this.key=Du(t)};Is.prototype.get=function(t){return t.config.pluginsByKey[this.key]},Is.prototype.getState=function(t){return t[this.key]};const ng=new Is("characterLimit"),rg=yt.create({name:"characterCount",addOptions(){return{limit:0}},addProseMirrorPlugins(){const{options:n}=this;return[new Au({key:ng,appendTransaction:(t,e,r)=>{const o=r.doc.content.size;if(n.limit&&o>n.limit)return r.tr.insertText("",n.limit+1,o)}})]}}),og=yt.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>n.style.textAlign||this.options.defaultAlignment,renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:t})=>this.options.alignments.includes(n)?this.options.types.every(e=>t.updateAttributes(e,{textAlign:n})):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.every(t=>n.resetAttributes(t,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),ig=bt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",pt(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n})=>n().insertContent({type:this.name}).command(({tr:t,dispatch:e})=>{var r;if(e){const{parent:o,pos:i}=t.selection.$from,s=i+1;if(t.doc.nodeAt(s))t.setSelection(K.create(t.doc,s));else{const l=(r=o.type.contentMatch.defaultType)===null||r===void 0?void 0:r.create();l&&(t.insert(s,l),t.setSelection(K.create(t.doc,s)))}t.scrollIntoView()}return!0}).run()}},addInputRules(){return[uc({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),sg=/(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))/;bt.create({name:"image",addOptions(){return{inline:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:"img[src]"}]},renderHTML({HTMLAttributes:n}){return["img",pt(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:t})=>t.insertContent({type:this.name,attrs:n})}},addInputRules(){return[uc({find:sg,type:this.type,getAttributes:n=>{const[,,t,e,r]=n;return{src:e,alt:t,title:r}}})]}});const ag=/^\s*([-+*])\s$/,Ru=bt.create({name:"bulletList",addOptions(){return{HTMLAttributes:{}}},group:"block list",content:"listItem+",parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n})=>n.toggleList("bulletList","listItem")}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){return[ao({find:ag,type:this.type})]}}),lg=/^(\d+)\.\s$/,Vu=bt.create({name:"orderedList",addOptions(){return{HTMLAttributes:{}}},group:"block list",content:"listItem+",addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const r=n,{start:t}=r,e=Uu(r,["start"]);return t===1?["ol",pt(this.options.HTMLAttributes,e),0]:["ol",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n})=>n.toggleList("orderedList","listItem")}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){return[ao({find:lg,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:(n,t)=>t.childCount+t.attrs.start===+n[1]})]}}),cg=bt.create({name:"taskList",addOptions(){return{HTMLAttributes:{}}},group:"block list",content:"taskItem+",parseHTML(){return[{tag:'ul[data-type="taskList"]',priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",pt(this.options.HTMLAttributes,n,{"data-type":"taskList"}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList("taskList","taskItem")}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),ug=/^\s*(\[([ |x])\])\s$/,fg=bt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{}}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>n.getAttribute("data-checked")==="true",renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:'li[data-type="taskItem"]',priority:51}]},renderHTML({node:n,HTMLAttributes:t}){return["li",pt(this.options.HTMLAttributes,t,{"data-type":"taskItem"}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem("taskItem"),"Shift-Tab":()=>this.editor.commands.liftListItem("taskItem")};return this.options.nested?Lt(x({},n),{Tab:()=>this.editor.commands.sinkListItem("taskItem")}):n},addNodeView(){return({node:n,HTMLAttributes:t,getPos:e,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");return i.contentEditable="false",a.type="checkbox",a.addEventListener("change",c=>{if(!r.isEditable){a.checked=!a.checked;return}const{checked:u}=c.target;r.isEditable&&typeof e=="function"&&r.chain().focus().command(({tr:p})=>(p.setNodeMarkup(e(),void 0,{checked:u}),!0)).run()}),Object.entries(this.options.HTMLAttributes).forEach(([c,u])=>{o.setAttribute(c,u)}),o.dataset.checked=n.attrs.checked,n.attrs.checked&&a.setAttribute("checked","checked"),i.append(a,s),o.append(i,l),Object.entries(t).forEach(([c,u])=>{o.setAttribute(c,u)}),{dom:o,contentDOM:l,update:c=>c.type!==this.type?!1:(o.dataset.checked=c.attrs.checked,c.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[ao({find:ug,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),pg=/^\s*>\s$/,dg=bt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block*",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn("blockquote"),toggleBlockquote:()=>({commands:n})=>n.toggleWrap("blockquote"),unsetBlockquote:()=>({commands:n})=>n.lift("blockquote")}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[ao({find:pg,type:this.type})]}}),hg=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,mg=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,vg=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,gg=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,yg=qe.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark("bold"),toggleBold:()=>({commands:n})=>n.toggleMark("bold"),unsetBold:()=>({commands:n})=>n.unsetMark("bold")}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold()}},addInputRules(){return[An({find:hg,type:this.type}),An({find:vg,type:this.type})]},addPasteRules(){return[Dn({find:mg,type:this.type}),Dn({find:gg,type:this.type})]}}),bg=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/,kg=/(?:^|\s)((?:`)((?:[^`]+))(?:`))/g,wg=qe.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark("code"),toggleCode:()=>({commands:n})=>n.toggleMark("code"),unsetCode:()=>({commands:n})=>n.unsetMark("code")}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[An({find:bg,type:this.type})]},addPasteRules(){return[Dn({find:kg,type:this.type})]}}),Sg=bt.create({name:"doc",topNode:!0,content:"block+"});function xg(n){return n===void 0&&(n={}),new Ht({view:function(e){return new we(e,n)}})}var we=function(t,e){var r=this;this.editorView=t,this.width=e.width||1,this.color=e.color||"black",this.class=e.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map(function(o){var i=function(s){return r[o](s)};return t.dom.addEventListener(o,i),{name:o,handler:i}})};we.prototype.destroy=function(){var t=this;this.handlers.forEach(function(e){var r=e.name,o=e.handler;return t.editorView.dom.removeEventListener(r,o)})},we.prototype.update=function(t,e){this.cursorPos!=null&&e.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())},we.prototype.setCursor=function(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},we.prototype.updateOverlay=function(){var t=this.editorView.state.doc.resolve(this.cursorPos),e;if(!t.parent.inlineContent){var r=t.nodeBefore,o=t.nodeAfter;if(r||o){var i=this.editorView.nodeDOM(this.cursorPos-(r?r.nodeSize:0)).getBoundingClientRect(),s=r?i.bottom:i.top;r&&o&&(s=(s+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),e={left:i.left,right:i.right,top:s-this.width/2,bottom:s+this.width/2}}}if(!e){var a=this.editorView.coordsAtPos(this.cursorPos);e={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}var l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{var p=l.getBoundingClientRect();c=p.left-l.scrollLeft,u=p.top-l.scrollTop}this.element.style.left=e.left-c+"px",this.element.style.top=e.top-u+"px",this.element.style.width=e.right-e.left+"px",this.element.style.height=e.bottom-e.top+"px"},we.prototype.scheduleRemoval=function(t){var e=this;clearTimeout(this.timeout),this.timeout=setTimeout(function(){return e.setCursor(null)},t)},we.prototype.dragover=function(t){if(!!this.editorView.editable){var e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY});if(e){var r=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice&&(r=ha(this.editorView.state.doc,r,this.editorView.dragging.slice),r==null))return this.setCursor(null);this.setCursor(r),this.scheduleRemoval(5e3)}}},we.prototype.dragend=function(){this.scheduleRemoval(20)},we.prototype.drop=function(){this.scheduleRemoval(20)},we.prototype.dragleave=function(t){(t.target==this.editorView.dom||!this.editorView.dom.contains(t.relatedTarget))&&this.setCursor(null)};const Mg=yt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:null}},addProseMirrorPlugins(){return[xg(this.options)]}});var pe=function(n){function t(e){n.call(this,e,e)}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.map=function(r,o){var i=r.resolve(o.map(this.head));return t.valid(i)?new t(i):n.near(i)},t.prototype.content=function(){return T.empty},t.prototype.eq=function(r){return r instanceof t&&r.head==this.head},t.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},t.fromJSON=function(r,o){if(typeof o.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(r.resolve(o.pos))},t.prototype.getBookmark=function(){return new Oo(this.anchor)},t.valid=function(r){var o=r.parent;if(o.isTextblock||!Cg(r)||!Eg(r))return!1;var i=o.type.spec.allowGapCursor;if(i!=null)return i;var s=o.contentMatchAt(r.index()).defaultType;return s&&s.isTextblock},t.findFrom=function(r,o,i){t:for(;;){if(!i&&t.valid(r))return r;for(var s=r.pos,a=null,l=r.depth;;l--){var c=r.node(l);if(o>0?r.indexAfter(l)0){a=c.child(o>0?r.indexAfter(l):r.index(l)-1);break}else if(l==0)return null;s+=o;var u=r.doc.resolve(s);if(t.valid(u))return u}for(;;){var p=o>0?a.firstChild:a.lastChild;if(!p){if(a.isAtom&&!a.isText&&!P.isSelectable(a)){r=r.doc.resolve(s+a.nodeSize*o),i=!1;continue t}break}a=p,s+=o;var d=r.doc.resolve(s);if(t.valid(d))return d}return null}},t}(z);pe.prototype.visible=!1,z.jsonID("gapcursor",pe);var Oo=function(t){this.pos=t};Oo.prototype.map=function(t){return new Oo(t.map(this.pos))},Oo.prototype.resolve=function(t){var e=t.resolve(this.pos);return pe.valid(e)?new pe(e):z.near(e)};function Cg(n){for(var t=n.depth;t>=0;t--){var e=n.index(t);if(e!=0)for(var r=n.node(t).child(e-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function Eg(n){for(var t=n.depth;t>=0;t--){var e=n.indexAfter(t),r=n.node(t);if(e!=r.childCount)for(var o=r.child(e);;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 Og=function(){return new Ht({props:{decorations:_g,createSelectionBetween:function(t,e,r){if(e.pos==r.pos&&pe.valid(r))return new pe(r)},handleClick:Tg,handleKeyDown:Ng}})},Ng=Gl({ArrowLeft:No("horiz",-1),ArrowRight:No("horiz",1),ArrowUp:No("vert",-1),ArrowDown:No("vert",1)});function No(n,t){var e=n=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,o,i){var s=r.selection,a=t>0?s.$to:s.$from,l=s.empty;if(s instanceof K){if(!i.endOfTextblock(e)||a.depth==0)return!1;l=!1,a=r.doc.resolve(t>0?a.after():a.before())}var c=pe.findFrom(a,t,l);return c?(o&&o(r.tr.setSelection(new pe(c))),!0):!1}}function Tg(n,t,e){if(!n.editable)return!1;var r=n.state.doc.resolve(t);if(!pe.valid(r))return!1;var o=n.posAtCoords({left:e.clientX,top:e.clientY}),i=o.inside;return i>-1&&P.isSelectable(n.state.doc.nodeAt(i))?!1:(n.dispatch(n.state.tr.setSelection(new pe(r))),!0)}function _g(n){if(!(n.selection instanceof pe))return null;var t=document.createElement("div");return t.className="ProseMirror-gapcursor",Y.create(n.doc,[ut.widget(n.selection.head,t,{key:"gapcursor"})])}const Ag=yt.create({name:"gapCursor",addProseMirrorPlugins(){return[Og()]},extendNodeSchema(n){var t;const e={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(t=L(_(n,"allowGapCursor",e)))!==null&&t!==void 0?t:null}}}),Dg=bt.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",pt(this.options.HTMLAttributes,n)]},renderText(){return` +`},addCommands(){return{setHardBreak:()=>({commands:n,chain:t,state:e,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:o,storedMarks:i}=e;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,l=i||o.$to.parentOffset&&o.$from.marks();return t().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&s){const p=l.filter(d=>a.includes(d.type.name));c.ensureMarks(p)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Rg=bt.create({name:"heading",addOptions(){return{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(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:t}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:n=>({commands:t})=>this.options.levels.includes(n.level)?t.setNode("heading",n):!1,toggleHeading:n=>({commands:t})=>this.options.levels.includes(n.level)?t.toggleNode("heading","paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,t)=>Lt(x({},n),{[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(n=>ts({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var To=200,wt=function(){};wt.prototype.append=function(t){return t.length?(t=wt.from(t),!this.length&&t||t.length=e?wt.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},wt.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},wt.prototype.forEach=function(t,e,r){e===void 0&&(e=0),r===void 0&&(r=this.length),e<=r?this.forEachInner(t,e,r,0):this.forEachInvertedInner(t,e,r,0)},wt.prototype.map=function(t,e,r){e===void 0&&(e=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(t(i,s))},e,r),o},wt.from=function(t){return t instanceof wt?t:t&&t.length?new Iu(t):wt.empty};var Iu=function(n){function t(r){n.call(this),this.values=r}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={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 l=i;l=s;l--)if(o(this.values[l],a+l)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=To)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=To)return new t(o.flatten().concat(this.values))},e.length.get=function(){return this.values.length},e.depth.get=function(){return 0},Object.defineProperties(t.prototype,e),t}(wt);wt.empty=new Iu([]);var Vg=function(n){function t(e,r){n.call(this),this.left=e,this.right=r,this.length=e.length+r.length,this.depth=Math.max(e.depth,r.depth)+1}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return ra&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},t.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},t.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new t(this.left,o)},t.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new t(o,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(wt),Bu=wt,Ig=500,St=function(t,e){this.items=t,this.eventCount=e};St.prototype.popEvent=function(t,e){var r=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;e&&(s=this.remapping(o,this.items.length),a=s.maps.length);var l=t.tr,c,u,p=[],d=[];return this.items.forEach(function(h,m){if(!h.step){s||(s=r.remapping(o,m+1),a=s.maps.length),a--,d.push(h);return}if(s){d.push(new Se(h.map));var g=h.step.map(s.slice(a)),y;g&&l.maybeStep(g).doc&&(y=l.mapping.maps[l.mapping.maps.length-1],p.push(new Se(y,null,null,p.length+d.length))),a--,y&&s.appendMap(y,a)}else l.maybeStep(h.step);if(h.selection)return c=s?h.selection.map(s.slice(a)):h.selection,u=new St(r.items.slice(0,o).append(d.reverse().concat(p)),r.eventCount-1),!1},this.items.length,0),{remaining:u,transform:l,selection:c}},St.prototype.addTransform=function(t,e,r,o){for(var i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null,c=0;cPg&&(a=Bg(a,h),s-=h),new St(a.append(i),s)},St.prototype.remapping=function(t,e){var r=new Mt;return this.items.forEach(function(o,i){var s=o.mirrorOffset!=null&&i-o.mirrorOffset>=t?r.maps.length-o.mirrorOffset:null;r.appendMap(o.map,s)},t,e),r},St.prototype.addMaps=function(t){return this.eventCount==0?this:new St(this.items.append(t.map(function(e){return new Se(e)})),this.eventCount)},St.prototype.rebased=function(t,e){if(!this.eventCount)return this;var r=[],o=Math.max(0,this.items.length-e),i=t.mapping,s=t.steps.length,a=this.eventCount;this.items.forEach(function(h){h.selection&&a--},o);var l=e;this.items.forEach(function(h){var m=i.getMirror(--l);if(m!=null){s=Math.min(s,m);var g=i.maps[m];if(h.step){var y=t.steps[m].invert(t.docs[m]),k=h.selection&&h.selection.map(i.slice(l+1,m));k&&a++,r.push(new Se(g,y,k))}else r.push(new Se(g))}},o);for(var c=[],u=e;uIg&&(d=d.compress(this.items.length-r.length)),d},St.prototype.emptyItemCount=function(){var t=0;return this.items.forEach(function(e){e.step||t++}),t},St.prototype.compress=function(t){t===void 0&&(t=this.items.length);var e=this.remapping(0,t),r=e.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 l=s.step.map(e.slice(r)),c=l&&l.getMap();if(r--,c&&e.appendMap(c,r),l){var u=s.selection&&s.selection.map(e.slice(r));u&&i++;var p=new Se(c.invert(),l,u),d,h=o.length-1;(d=o.length&&o[h].merge(p))?o[h]=d:o.push(p)}}else s.map&&r--},this.items.length,0),new St(Bu.from(o.reverse()),i)},St.empty=new St(Bu.empty,0);function Bg(n,t){var e;return n.forEach(function(r,o){if(r.selection&&t--==0)return e=o,!1}),n.slice(e)}var Se=function(t,e,r,o){this.map=t,this.step=e,this.selection=r,this.mirrorOffset=o};Se.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new Se(e.getMap().invert(),e,this.selection)}};var Ge=function(t,e,r,o){this.done=t,this.undone=e,this.prevRanges=r,this.prevTime=o},Pg=20;function zg(n,t,e,r){var o=e.getMeta(Ye),i;if(o)return o.historyState;e.getMeta(Fg)&&(n=new Ge(n.done,n.undone,null,0));var s=e.getMeta("appendedTransaction");if(e.steps.length==0)return n;if(s&&s.getMeta(Ye))return s.getMeta(Ye).redo?new Ge(n.done.addTransform(e,null,r,_o(t)),n.undone,Pu(e.mapping.maps[e.steps.length-1]),n.prevTime):new Ge(n.done,n.undone.addTransform(e,null,r,_o(t)),null,n.prevTime);if(e.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){var a=n.prevTime==0||!s&&(n.prevTime<(e.time||0)-r.newGroupDelay||!Lg(e,n.prevRanges)),l=s?Bs(n.prevRanges,e.mapping):Pu(e.mapping.maps[e.steps.length-1]);return new Ge(n.done.addTransform(e,a?t.selection.getBookmark():null,r,_o(t)),St.empty,l,e.time)}else return(i=e.getMeta("rebased"))?new Ge(n.done.rebased(e,i),n.undone.rebased(e,i),Bs(n.prevRanges,e.mapping),n.prevTime):new Ge(n.done.addMaps(e.mapping.maps),n.undone.addMaps(e.mapping.maps),Bs(n.prevRanges,e.mapping),n.prevTime)}function Lg(n,t){if(!t)return!1;if(!n.docChanged)return!0;var e=!1;return n.mapping.maps[0].forEach(function(r,o){for(var i=0;i=t[i]&&(e=!0)}),e}function Pu(n){var t=[];return n.forEach(function(e,r,o,i){return t.push(o,i)}),t}function Bs(n,t){if(!n)return null;for(var e=[],r=0;r({state:n,dispatch:t})=>Fu(n,t),redo:()=>({state:n,dispatch:t})=>Hu(n,t)}},addProseMirrorPlugins(){return[Hg(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()}}}),$g=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,qg=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,jg=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,Wg=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,Kg=qe.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark("italic"),toggleItalic:()=>({commands:n})=>n.toggleMark("italic"),unsetItalic:()=>({commands:n})=>n.unsetMark("italic")}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[An({find:$g,type:this.type}),An({find:jg,type:this.type})]},addPasteRules(){return[Dn({find:qg,type:this.type}),Dn({find:Wg,type:this.type})]}}),Ug=bt.create({name:"listItem",addOptions(){return{HTMLAttributes:{}}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",pt(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem("listItem"),Tab:()=>this.editor.commands.sinkListItem("listItem"),"Shift-Tab":()=>this.editor.commands.liftListItem("listItem")}}}),Gg=bt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode("paragraph")}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Yg=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,Xg=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,Qg=qe.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",pt(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark("strike"),toggleStrike:()=>({commands:n})=>n.toggleMark("strike"),unsetStrike:()=>({commands:n})=>n.unsetMark("strike")}},addKeyboardShortcuts(){return{"Mod-Shift-x":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[An({find:Yg,type:this.type})]},addPasteRules(){return[Dn({find:Xg,type:this.type})]}}),Zg=bt.create({name:"text",group:"inline"}),ty=yt.create({name:"starterKit",addExtensions(){var n,t,e,r,o,i,s,a,l,c,u,p,d,h,m,g,y,k;const b=[];return this.options.blockquote!==!1&&b.push(dg.configure((n=this.options)===null||n===void 0?void 0:n.blockquote)),this.options.bold!==!1&&b.push(yg.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.bulletList!==!1&&b.push(Ru.configure((e=this.options)===null||e===void 0?void 0:e.bulletList)),this.options.code!==!1&&b.push(wg.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&b.push(Ev.configure((o=this.options)===null||o===void 0?void 0:o.codeBlock)),this.options.document!==!1&&b.push(Sg.configure((i=this.options)===null||i===void 0?void 0:i.document)),this.options.dropcursor!==!1&&b.push(Mg.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&b.push(Ag.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&b.push(Dg.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&b.push(Rg.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&b.push(Jg.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&b.push(ig.configure((p=this.options)===null||p===void 0?void 0:p.horizontalRule)),this.options.italic!==!1&&b.push(Kg.configure((d=this.options)===null||d===void 0?void 0:d.italic)),this.options.listItem!==!1&&b.push(Ug.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&b.push(Vu.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&b.push(Gg.configure((g=this.options)===null||g===void 0?void 0:g.paragraph)),this.options.strike!==!1&&b.push(Qg.configure((y=this.options)===null||y===void 0?void 0:y.strike)),this.options.text!==!1&&b.push(Zg.configure((k=this.options)===null||k===void 0?void 0:k.text)),b}});var ak="",Ao=(n,t)=>{for(const[e,r]of t)n[e]=r;return n};const ey={components:{EditorContent:xv,BubbleMenu:wv},props:{modelValue:{type:String,default:""},maxChars:{type:Number,default:0},bubbleMenu:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},bold:{type:Boolean,default:!0},italic:{type:Boolean,default:!0},strike:{type:Boolean,default:!0},underline:{type:Boolean,default:!0},code:{type:Boolean,default:!0},codeBlock:{type:Boolean,default:!0},blockquote:{type:Boolean,default:!0},bulletList:{type:Boolean,default:!0},orderedList:{type:Boolean,default:!0},taskList:{type:Boolean,default:!0},heading:{type:Boolean,default:!0},textAlign:{type:Boolean,default:!0},horizontalRule:{type:Boolean,default:!0},undoRedo:{type:Boolean,default:!0}},data(){return{editor:null,headingOpen:!1,alignOpen:!1}},watch:{modelValue(n){this.editor.getHTML()!==n&&this.editor.commands.setContent(this.modelValue,!1)},disabled(n){this.editor&&this.editor.setEditable(!n)}},methods:{insertImageFromURL(n){this.editor.chain().focus().setImage({src:n},!1).run()}},computed:{extensions(){return[ty.configure({orderedList:!1,bulletList:!1}),Ov,og,Vu.configure({class:"inline-flex"}),Ru.configure({class:"inline-flex"}),rg.configure({limit:this.maxChars}),cg,fg]},hasTextAlign(){return this.editor.isActive({textAlign:"left"})||this.editor.isActive({textAlign:"right"})||this.editor.isActive({textAlign:"center"})||this.editor.isActive({textAlign:"justify"})},charPercentage(){return Math.round(100/this.maxChars*this.editor.getCharacterCount())}},mounted(){this.editor=new Sv({content:this.modelValue,extensions:this.extensions,editorProps:{attributes:{class:"h-full overflow-y-auto input"}},editable:!this.disabled}).on("update",({editor:n})=>{this.$emit("update:modelValue",n.getHTML())}),this.$watch(()=>this.maxChars,()=>{})},beforeUnmount(){this.editor.destroy()}},ny=["aria-label"],ry=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7h-6z"}),f.createElementVNode("path",{d:"M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7"})],-1)],oy=["aria-label"],iy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"11",y1:"5",x2:"17",y2:"5"}),f.createElementVNode("line",{x1:"7",y1:"19",x2:"13",y2:"19"}),f.createElementVNode("line",{x1:"14",y1:"5",x2:"10",y2:"19"})],-1)],sy=["aria-label"],ay=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M7 5v9a5 5 0 0 0 10 0v-9"}),f.createElementVNode("path",{d:"M4 12h16"})],-1)],ly=["aria-label"],cy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M7 5v5a5 5 0 0 0 10 0v-5"}),f.createElementVNode("path",{d:"M5 19h14"})],-1)],uy=["aria-label"],fy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("polyline",{points:"7 8 3 12 7 16"}),f.createElementVNode("polyline",{points:"17 8 21 12 17 16"}),f.createElementVNode("line",{x1:"14",y1:"4",x2:"10",y2:"20"})],-1)],py=["aria-label"],dy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),f.createElementVNode("path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"}),f.createElementVNode("path",{d:"M10 13l-1 2l1 2"}),f.createElementVNode("path",{d:"M14 13l1 2l-1 2"})],-1)],hy=["aria-label"],my=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M6 15h15"}),f.createElementVNode("path",{d:"M21 19h-15"}),f.createElementVNode("path",{d:"M15 11h6"}),f.createElementVNode("path",{d:"M21 7h-6"}),f.createElementVNode("path",{d:"M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"}),f.createElementVNode("path",{d:"M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"})],-1)],vy=["aria-label"],gy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"9",y1:"6",x2:"20",y2:"6"}),f.createElementVNode("line",{x1:"9",y1:"12",x2:"20",y2:"12"}),f.createElementVNode("line",{x1:"9",y1:"18",x2:"20",y2:"18"}),f.createElementVNode("line",{x1:"5",y1:"6",x2:"5",y2:"6.01"}),f.createElementVNode("line",{x1:"5",y1:"12",x2:"5",y2:"12.01"}),f.createElementVNode("line",{x1:"5",y1:"18",x2:"5",y2:"18.01"})],-1)],yy=["aria-label"],by=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M11 6h9"}),f.createElementVNode("path",{d:"M11 12h9"}),f.createElementVNode("path",{d:"M12 18h8"}),f.createElementVNode("path",{d:"M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4"}),f.createElementVNode("path",{d:"M6 10v-6l-2 2"})],-1)],ky=["aria-label"],wy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M3.5 5.5l1.5 1.5l2.5 -2.5"}),f.createElementVNode("path",{d:"M3.5 11.5l1.5 1.5l2.5 -2.5"}),f.createElementVNode("path",{d:"M3.5 17.5l1.5 1.5l2.5 -2.5"}),f.createElementVNode("line",{x1:"11",y1:"6",x2:"20",y2:"6"}),f.createElementVNode("line",{x1:"11",y1:"12",x2:"20",y2:"12"}),f.createElementVNode("line",{x1:"11",y1:"18",x2:"20",y2:"18"})],-1)],Sy={key:10},xy=["aria-label"],My=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M7 12h10"}),f.createElementVNode("path",{d:"M7 4v16"}),f.createElementVNode("path",{d:"M17 4v16"}),f.createElementVNode("path",{d:"M15 20h4"}),f.createElementVNode("path",{d:"M15 4h4"}),f.createElementVNode("path",{d:"M5 20h4"}),f.createElementVNode("path",{d:"M5 4h4"})],-1)],Cy={key:0,class:"mx-1 inline-flex space-x-1"},Ey=["aria-label"],Oy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M19 18v-8l-2 2"}),f.createElementVNode("path",{d:"M4 6v12"}),f.createElementVNode("path",{d:"M12 6v12"}),f.createElementVNode("path",{d:"M11 18h2"}),f.createElementVNode("path",{d:"M3 18h2"}),f.createElementVNode("path",{d:"M4 12h8"}),f.createElementVNode("path",{d:"M3 6h2"}),f.createElementVNode("path",{d:"M11 6h2"})],-1)],Ny=["aria-label"],Ty=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 -.001"}),f.createElementVNode("path",{d:"M4 6v12"}),f.createElementVNode("path",{d:"M12 6v12"}),f.createElementVNode("path",{d:"M11 18h2"}),f.createElementVNode("path",{d:"M3 18h2"}),f.createElementVNode("path",{d:"M4 12h8"}),f.createElementVNode("path",{d:"M3 6h2"}),f.createElementVNode("path",{d:"M11 6h2"})],-1)],_y=["aria-label"],Ay=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M19 14a2 2 0 1 0 -2 -2"}),f.createElementVNode("path",{d:"M17 16a2 2 0 1 0 2 -2"}),f.createElementVNode("path",{d:"M4 6v12"}),f.createElementVNode("path",{d:"M12 6v12"}),f.createElementVNode("path",{d:"M11 18h2"}),f.createElementVNode("path",{d:"M3 18h2"}),f.createElementVNode("path",{d:"M4 12h8"}),f.createElementVNode("path",{d:"M3 6h2"}),f.createElementVNode("path",{d:"M11 6h2"})],-1)],Dy=["aria-label"],Ry=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M20 18v-8l-4 6h5"}),f.createElementVNode("path",{d:"M4 6v12"}),f.createElementVNode("path",{d:"M12 6v12"}),f.createElementVNode("path",{d:"M11 18h2"}),f.createElementVNode("path",{d:"M3 18h2"}),f.createElementVNode("path",{d:"M4 12h8"}),f.createElementVNode("path",{d:"M3 6h2"}),f.createElementVNode("path",{d:"M11 6h2"})],-1)],Vy=["aria-label"],Iy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M17 18h2a2 2 0 1 0 0 -4h-2v-4h4"}),f.createElementVNode("path",{d:"M4 6v12"}),f.createElementVNode("path",{d:"M12 6v12"}),f.createElementVNode("path",{d:"M11 18h2"}),f.createElementVNode("path",{d:"M3 18h2"}),f.createElementVNode("path",{d:"M4 12h8"}),f.createElementVNode("path",{d:"M3 6h2"}),f.createElementVNode("path",{d:"M11 6h2"})],-1)],By=["aria-label"],Py=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("circle",{transform:"rotate(180 19 16)",cx:"19",cy:"16",r:"2"}),f.createElementVNode("path",{d:"M21 12a2 2 0 1 0 -4 0v4"}),f.createElementVNode("path",{d:"M4 6v12"}),f.createElementVNode("path",{d:"M12 6v12"}),f.createElementVNode("path",{d:"M11 18h2"}),f.createElementVNode("path",{d:"M3 18h2"}),f.createElementVNode("path",{d:"M4 12h8"}),f.createElementVNode("path",{d:"M3 6h2"}),f.createElementVNode("path",{d:"M11 6h2"})],-1)],zy={key:11},Ly=["aria-label"],Fy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),f.createElementVNode("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),f.createElementVNode("line",{x1:"6",y1:"18",x2:"18",y2:"18"})],-1)],Hy={key:0,class:"inline-flex mx-1 space-x-1"},Jy=["aria-label"],$y=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),f.createElementVNode("line",{x1:"4",y1:"12",x2:"14",y2:"12"}),f.createElementVNode("line",{x1:"4",y1:"18",x2:"18",y2:"18"})],-1)],qy=["aria-label"],jy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),f.createElementVNode("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),f.createElementVNode("line",{x1:"6",y1:"18",x2:"18",y2:"18"})],-1)],Wy=["aria-label"],Ky=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),f.createElementVNode("line",{x1:"10",y1:"12",x2:"20",y2:"12"}),f.createElementVNode("line",{x1:"6",y1:"18",x2:"20",y2:"18"})],-1)],Uy=["aria-label"],Gy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),f.createElementVNode("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),f.createElementVNode("line",{x1:"4",y1:"18",x2:"16",y2:"18"})],-1)],Yy=["aria-label"],Xy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"4",y1:"7",x2:"20",y2:"7"}),f.createElementVNode("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),f.createElementVNode("line",{x1:"14",y1:"11",x2:"14",y2:"17"}),f.createElementVNode("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),f.createElementVNode("path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"})],-1)],Qy=["aria-label"],Zy=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),f.createElementVNode("line",{x1:"4",y1:"4",x2:"4",y2:"4.01"}),f.createElementVNode("line",{x1:"8",y1:"4",x2:"8",y2:"4.01"}),f.createElementVNode("line",{x1:"12",y1:"4",x2:"12",y2:"4.01"}),f.createElementVNode("line",{x1:"16",y1:"4",x2:"16",y2:"4.01"}),f.createElementVNode("line",{x1:"20",y1:"4",x2:"20",y2:"4.01"}),f.createElementVNode("line",{x1:"4",y1:"8",x2:"4",y2:"8.01"}),f.createElementVNode("line",{x1:"12",y1:"8",x2:"12",y2:"8.01"}),f.createElementVNode("line",{x1:"20",y1:"8",x2:"20",y2:"8.01"}),f.createElementVNode("line",{x1:"4",y1:"16",x2:"4",y2:"16.01"}),f.createElementVNode("line",{x1:"12",y1:"16",x2:"12",y2:"16.01"}),f.createElementVNode("line",{x1:"20",y1:"16",x2:"20",y2:"16.01"}),f.createElementVNode("line",{x1:"4",y1:"20",x2:"4",y2:"20.01"}),f.createElementVNode("line",{x1:"8",y1:"20",x2:"8",y2:"20.01"}),f.createElementVNode("line",{x1:"12",y1:"20",x2:"12",y2:"20.01"}),f.createElementVNode("line",{x1:"16",y1:"20",x2:"16",y2:"20.01"}),f.createElementVNode("line",{x1:"20",y1:"20",x2:"20",y2:"20.01"})],-1)],t0=["aria-label"],e0=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M9 13l-4 -4l4 -4m-4 4h11a4 4 0 0 1 0 8h-1"})],-1)],n0=["aria-label"],r0=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M15 13l4 -4l-4 -4m4 4h-11a4 4 0 0 0 0 8h1"})],-1)];function o0(n,t,e,r,o,i){const s=f.resolveComponent("CollapseXTransition"),a=f.resolveComponent("editor-content"),l=f.resolveDirective("tooltip");return f.openBlock(),f.createElementBlock("div",null,[f.createElementVNode("div",null,[o.editor?(f.openBlock(),f.createBlock(f.resolveDynamicComponent(e.bubbleMenu?"bubble-menu":"div"),{key:0,editor:o.editor,class:f.normalizeClass(["flex-wrap space-x-1",e.bubbleMenu?"bg-gray-600 rounded dark p-1":"mb-2"])},{default:f.withCtx(()=>[e.bold?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:0,"aria-label":n.__("tiptap::tiptap.bold"),onClick:t[0]||(t[0]=c=>o.editor.chain().focus().toggleBold().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("bold")}])},ry,10,ny)),[[l,n.__("tiptap::tiptap.bold")]]):f.createCommentVNode("",!0),e.italic?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:1,"aria-label":n.__("tiptap::tiptap.italic"),onClick:t[1]||(t[1]=c=>o.editor.chain().focus().toggleItalic().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("italic")}])},iy,10,oy)),[[l,n.__("tiptap::tiptap.italic")]]):f.createCommentVNode("",!0),e.strike?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:2,"aria-label":n.__("tiptap::tiptap.strike"),onClick:t[2]||(t[2]=c=>o.editor.chain().focus().toggleStrike().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("strike")}])},ay,10,sy)),[[l,n.__("tiptap::tiptap.strike")]]):f.createCommentVNode("",!0),e.underline?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:3,"aria-label":n.__("tiptap::tiptap.underline"),onClick:t[3]||(t[3]=c=>o.editor.chain().focus().toggleUnderline().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("underline")}])},cy,10,ly)),[[l,n.__("tiptap::tiptap.underline")]]):f.createCommentVNode("",!0),e.code?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:4,"aria-label":n.__("tiptap::tiptap.code"),onClick:t[4]||(t[4]=c=>o.editor.chain().focus().toggleCode().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("code")}])},fy,10,uy)),[[l,n.__("tiptap::tiptap.code")]]):f.createCommentVNode("",!0),e.codeBlock?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:5,"aria-label":n.__("tiptap::tiptap.code_block"),onClick:t[5]||(t[5]=c=>o.editor.chain().focus().toggleCodeBlock().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("codeBlock")}])},dy,10,py)),[[l,n.__("tiptap::tiptap.code_block")]]):f.createCommentVNode("",!0),e.blockquote?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:6,"aria-label":n.__("tiptap::tiptap.blockquote"),onClick:t[6]||(t[6]=c=>o.editor.chain().focus().toggleBlockquote().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("blockquote")}])},my,10,hy)),[[l,n.__("tiptap::tiptap.blockquote")]]):f.createCommentVNode("",!0),e.bulletList?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:7,"aria-label":n.__("tiptap::tiptap.bullet_list"),onClick:t[7]||(t[7]=c=>o.editor.chain().focus().toggleBulletList().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("bulletList")}])},gy,10,vy)),[[l,n.__("tiptap::tiptap.bullet_list")]]):f.createCommentVNode("",!0),e.orderedList?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:8,"aria-label":n.__("tiptap::tiptap.ordered_list"),onClick:t[8]||(t[8]=c=>o.editor.chain().focus().toggleOrderedList().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("orderedList")}])},by,10,yy)),[[l,n.__("tiptap::tiptap.ordered_list")]]):f.createCommentVNode("",!0),e.taskList?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:9,"aria-label":n.__("tiptap::tiptap.task_list"),onClick:t[9]||(t[9]=c=>o.editor.chain().focus().toggleTaskList().run()),class:f.normalizeClass(["button",{accent:o.editor.isActive("taskList")}])},wy,10,ky)),[[l,n.__("tiptap::tiptap.task_list")]]):f.createCommentVNode("",!0),e.heading?(f.openBlock(),f.createElementBlock("span",Sy,[f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive("heading")}]),onClick:t[10]||(t[10]=c=>{o.headingOpen=!o.headingOpen,o.alignOpen=!1}),"aria-label":n.__("tiptap::tiptap.heading")},My,10,xy),[[l,n.__("tiptap::tiptap.heading")]]),f.createVNode(s,null,{default:f.withCtx(()=>[o.headingOpen?(f.openBlock(),f.createElementBlock("div",Cy,[f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive("heading",{level:1})}]),"aria-label":`${n.__("tiptap::tiptap.heading")} 1`,onClick:t[11]||(t[11]=c=>o.editor.chain().focus().toggleHeading({level:1}).run())},Oy,10,Ey),[[l,`${n.__("tiptap::tiptap.heading")} 1`]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive("heading",{level:2})}]),"aria-label":`${n.__("tiptap::tiptap.heading")} 2`,onClick:t[12]||(t[12]=c=>o.editor.chain().focus().toggleHeading({level:2}).run())},Ty,10,Ny),[[l,`${n.__("tiptap::tiptap.heading")} 2`]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive("heading",{level:3})}]),"aria-label":`${n.__("tiptap::tiptap.heading")} 3`,onClick:t[13]||(t[13]=c=>o.editor.chain().focus().toggleHeading({level:3}).run())},Ay,10,_y),[[l,`${n.__("tiptap::tiptap.heading")} 3`]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive("heading",{level:4})}]),"aria-label":`${n.__("tiptap::tiptap.heading")} 4`,onClick:t[14]||(t[14]=c=>o.editor.chain().focus().toggleHeading({level:4}).run())},Ry,10,Dy),[[l,`${n.__("tiptap::tiptap.heading")} 4`]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive("heading",{level:5})}]),"aria-label":`${n.__("tiptap::tiptap.heading")} 5`,onClick:t[15]||(t[15]=c=>o.editor.chain().focus().toggleHeading({level:5}).run())},Iy,10,Vy),[[l,`${n.__("tiptap::tiptap.heading")} 5`]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive("heading",{level:6})}]),"aria-label":`${n.__("tiptap::tiptap.heading")} 6`,onClick:t[16]||(t[16]=c=>o.editor.chain().focus().toggleHeading({level:6}).run())},Py,10,By),[[l,`${n.__("tiptap::tiptap.heading")} 6`]])])):f.createCommentVNode("",!0)]),_:1})])):f.createCommentVNode("",!0),e.textAlign?(f.openBlock(),f.createElementBlock("span",zy,[f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:i.hasTextAlign}]),onClick:t[17]||(t[17]=c=>{o.alignOpen=!o.alignOpen,o.headingOpen=!1}),"aria-label":n.__("tiptap::tiptap.text_align")},Fy,10,Ly),[[l,n.__("tiptap::tiptap.text_align")]]),f.createVNode(s,null,{default:f.withCtx(()=>[o.alignOpen?(f.openBlock(),f.createElementBlock("div",Hy,[f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive({textAlign:"left"})}]),"aria-label":n.__("tiptap::tiptap.left"),onClick:t[18]||(t[18]=c=>o.editor.chain().focus().setTextAlign("left").run())},$y,10,Jy),[[l,n.__("tiptap::tiptap.left")]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive({textAlign:"center"})}]),"aria-label":n.__("tiptap::tiptap.center"),onClick:t[19]||(t[19]=c=>o.editor.chain().focus().setTextAlign("center").run())},jy,10,qy),[[l,n.__("tiptap::tiptap.center")]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive({textAlign:"right"})}]),"aria-label":n.__("tiptap::tiptap.right"),onClick:t[20]||(t[20]=c=>o.editor.chain().focus().setTextAlign("right").run())},Ky,10,Wy),[[l,n.__("tiptap::tiptap.right")]]),f.withDirectives(f.createElementVNode("button",{class:f.normalizeClass(["button",{accent:o.editor.isActive({textAlign:"justify"})}]),"aria-label":n.__("tiptap::tiptap.justify"),onClick:t[21]||(t[21]=c=>o.editor.chain().focus().setTextAlign("justify").run())},Gy,10,Uy),[[l,n.__("tiptap::tiptap.justify")]]),f.withDirectives(f.createElementVNode("button",{class:"button","aria-label":n.__("tiptap::tiptap.clear"),onClick:t[22]||(t[22]=c=>o.editor.chain().focus().unsetTextAlign().run())},Xy,8,Yy),[[l,n.__("tiptap::tiptap.clear")]])])):f.createCommentVNode("",!0)]),_:1})])):f.createCommentVNode("",!0),e.horizontalRule?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:12,"aria-label":n.__("tiptap::tiptap.horizontal_rule"),onClick:t[23]||(t[23]=c=>o.editor.chain().focus().setHorizontalRule().run()),class:"button"},Zy,8,Qy)),[[l,n.__("tiptap::tiptap.horizontal_rule")]]):f.createCommentVNode("",!0),e.undoRedo?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:13,"aria-label":n.__("tiptap::tiptap.undo"),onClick:t[24]||(t[24]=c=>o.editor.chain().focus().undo().run()),class:"button"},e0,8,t0)),[[l,n.__("tiptap::tiptap.undo")]]):f.createCommentVNode("",!0),e.undoRedo?f.withDirectives((f.openBlock(),f.createElementBlock("button",{key:14,"aria-label":n.__("tiptap::tiptap.redo"),onClick:t[25]||(t[25]=c=>o.editor.chain().focus().redo().run()),class:"button"},r0,8,n0)),[[l,n.__("tiptap::tiptap.redo")]]):f.createCommentVNode("",!0)]),_:1},8,["editor","class"])):f.createCommentVNode("",!0)]),f.createVNode(a,{editor:o.editor,class:"min-h-64 h-64",onClick:t[26]||(t[26]=c=>{o.headingOpen=!1,o.alignOpen=!1})},null,8,["editor"]),o.editor&&e.maxChars>0?(f.openBlock(),f.createElementBlock("div",{key:0,class:f.normalizeClass(["w-full",i.charPercentage>90?"text-red-500":i.charPercentage>75?"text-yellow-500":null])},f.toDisplayString(n.__("tiptap::tiptap.character_count",{chars:o.editor.getCharacterCount(),max:e.maxChars})),3)):f.createCommentVNode("",!0)])}var Ju=Ao(ey,[["render",o0]]);const i0={components:{Tiptap:Ju},data(){return{bubbleMenu:!1,maxChars:280,content:"

This is tiptap 2 in Voyager II using Vue 3 \u{1F389}

",disabled:!1,bold:!0,italic:!0,strike:!0,underline:!0,code:!0,codeBlock:!0,blockquote:!0,bulletList:!0,orderedList:!0,taskList:!0,heading:!0,textAlign:!0,horizontalRule:!0,undoRedo:!0}}},s0={class:"flex space-x-2"},a0={class:"input-group"},l0=f.createElementVNode("label",{for:"bubble",class:"label"},"Bubble menu",-1),c0={class:"mt-1"},u0={class:"input-group"},f0=f.createElementVNode("label",{for:"maxChars",class:"label"},"Max characters (0 = infinite)",-1),p0={class:"mt-1"},d0={class:"input-group"},h0=f.createElementVNode("label",{for:"disabled",class:"label"},"Disabled",-1),m0={class:"mt-1"},v0={class:"flex flex-wrap space-x-2 mt-4"},g0={class:"input-group"},y0={for:"bold",class:"label"},b0={class:"mt-1"},k0={class:"input-group"},w0={for:"italic",class:"label"},S0={class:"mt-1"},x0={class:"input-group"},M0={for:"strike",class:"label"},C0={class:"mt-1"},E0={class:"input-group"},O0={for:"underline",class:"label"},N0={class:"mt-1"},T0={class:"input-group"},_0={for:"code",class:"label"},A0={class:"mt-1"},D0={class:"input-group"},R0={for:"codeBlock",class:"label"},V0={class:"mt-1"},I0={class:"input-group"},B0={for:"blockquote",class:"label"},P0={class:"mt-1"},z0={class:"input-group"},L0={for:"bulletList",class:"label"},F0={class:"mt-1"},H0={class:"input-group"},J0={for:"orderedList",class:"label"},$0={class:"mt-1"},q0={class:"input-group"},j0={for:"taskList",class:"label"},W0={class:"mt-1"},K0={class:"input-group"},U0={for:"heading",class:"label"},G0={class:"mt-1"},Y0={class:"input-group"},X0={for:"textAlign",class:"label"},Q0={class:"mt-1"},Z0={class:"input-group"},tb={for:"horizontalRule",class:"label"},eb={class:"mt-1"},nb={class:"input-group"},rb={for:"undoRedo",class:"label"},ob={class:"mt-1"};function ib(n,t,e,r,o,i){const s=f.resolveComponent("tiptap"),a=f.resolveComponent("collapsible");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createVNode(s,{bubbleMenu:o.bubbleMenu,maxChars:o.maxChars,modelValue:o.content,"onUpdate:modelValue":t[0]||(t[0]=l=>o.content=l),disabled:o.disabled,bold:o.bold,italic:o.italic,strike:o.strike,underline:o.underline,code:o.code,codeBlock:o.codeBlock,blockquote:o.blockquote,bulletList:o.bulletList,orderedList:o.orderedList,taskList:o.taskList,heading:o.heading,textAlign:o.textAlign,horizontalRule:o.horizontalRule,undoRedo:o.undoRedo,class:"mb-2"},null,8,["bubbleMenu","maxChars","modelValue","disabled","bold","italic","strike","underline","code","codeBlock","blockquote","bulletList","orderedList","taskList","heading","textAlign","horizontalRule","undoRedo"]),f.createVNode(a,{title:"Options"},{default:f.withCtx(()=>[f.createElementVNode("div",s0,[f.createElementVNode("div",a0,[l0,f.createElementVNode("div",c0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[1]||(t[1]=l=>o.bubbleMenu=l),id:"bubble"},null,512),[[f.vModelCheckbox,o.bubbleMenu]])])]),f.createElementVNode("div",u0,[f0,f.createElementVNode("div",p0,[f.withDirectives(f.createElementVNode("input",{type:"number",class:"input","onUpdate:modelValue":t[2]||(t[2]=l=>o.maxChars=l),min:"0",id:"maxChars"},null,512),[[f.vModelText,o.maxChars,void 0,{number:!0}]])])]),f.createElementVNode("div",d0,[h0,f.createElementVNode("div",m0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[3]||(t[3]=l=>o.disabled=l),id:"disabled"},null,512),[[f.vModelCheckbox,o.disabled]])])])]),f.createElementVNode("div",v0,[f.createElementVNode("div",g0,[f.createElementVNode("label",y0,f.toDisplayString(n.__("tiptap::tiptap.bold")),1),f.createElementVNode("div",b0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[4]||(t[4]=l=>o.bold=l),id:"bold"},null,512),[[f.vModelCheckbox,o.bold]])])]),f.createElementVNode("div",k0,[f.createElementVNode("label",w0,f.toDisplayString(n.__("tiptap::tiptap.italic")),1),f.createElementVNode("div",S0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[5]||(t[5]=l=>o.italic=l),id:"italic"},null,512),[[f.vModelCheckbox,o.italic]])])]),f.createElementVNode("div",x0,[f.createElementVNode("label",M0,f.toDisplayString(n.__("tiptap::tiptap.strike")),1),f.createElementVNode("div",C0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[6]||(t[6]=l=>o.strike=l),id:"strike"},null,512),[[f.vModelCheckbox,o.strike]])])]),f.createElementVNode("div",E0,[f.createElementVNode("label",O0,f.toDisplayString(n.__("tiptap::tiptap.underline")),1),f.createElementVNode("div",N0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[7]||(t[7]=l=>o.underline=l),id:"underline"},null,512),[[f.vModelCheckbox,o.underline]])])]),f.createElementVNode("div",T0,[f.createElementVNode("label",_0,f.toDisplayString(n.__("tiptap::tiptap.code")),1),f.createElementVNode("div",A0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[8]||(t[8]=l=>o.code=l),id:"code"},null,512),[[f.vModelCheckbox,o.code]])])]),f.createElementVNode("div",D0,[f.createElementVNode("label",R0,f.toDisplayString(n.__("tiptap::tiptap.code_block")),1),f.createElementVNode("div",V0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[9]||(t[9]=l=>o.codeBlock=l),id:"codeBlock"},null,512),[[f.vModelCheckbox,o.codeBlock]])])]),f.createElementVNode("div",I0,[f.createElementVNode("label",B0,f.toDisplayString(n.__("tiptap::tiptap.blockquote")),1),f.createElementVNode("div",P0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[10]||(t[10]=l=>o.blockquote=l),id:"blockquote"},null,512),[[f.vModelCheckbox,o.blockquote]])])]),f.createElementVNode("div",z0,[f.createElementVNode("label",L0,f.toDisplayString(n.__("tiptap::tiptap.bullet_list")),1),f.createElementVNode("div",F0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[11]||(t[11]=l=>o.bulletList=l),id:"bulletList"},null,512),[[f.vModelCheckbox,o.bulletList]])])]),f.createElementVNode("div",H0,[f.createElementVNode("label",J0,f.toDisplayString(n.__("tiptap::tiptap.ordered_list")),1),f.createElementVNode("div",$0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[12]||(t[12]=l=>o.orderedList=l),id:"orderedList"},null,512),[[f.vModelCheckbox,o.orderedList]])])]),f.createElementVNode("div",q0,[f.createElementVNode("label",j0,f.toDisplayString(n.__("tiptap::tiptap.task_list")),1),f.createElementVNode("div",W0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[13]||(t[13]=l=>o.taskList=l),id:"taskList"},null,512),[[f.vModelCheckbox,o.taskList]])])]),f.createElementVNode("div",K0,[f.createElementVNode("label",U0,f.toDisplayString(n.__("tiptap::tiptap.heading")),1),f.createElementVNode("div",G0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[14]||(t[14]=l=>o.heading=l),id:"heading"},null,512),[[f.vModelCheckbox,o.heading]])])]),f.createElementVNode("div",Y0,[f.createElementVNode("label",X0,f.toDisplayString(n.__("tiptap::tiptap.text_align")),1),f.createElementVNode("div",Q0,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[15]||(t[15]=l=>o.textAlign=l),id:"textAlign"},null,512),[[f.vModelCheckbox,o.textAlign]])])]),f.createElementVNode("div",Z0,[f.createElementVNode("label",tb,f.toDisplayString(n.__("tiptap::tiptap.horizontal_rule")),1),f.createElementVNode("div",eb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[16]||(t[16]=l=>o.horizontalRule=l),id:"horizontalRule"},null,512),[[f.vModelCheckbox,o.horizontalRule]])])]),f.createElementVNode("div",nb,[f.createElementVNode("label",rb,f.toDisplayString(n.__("tiptap::tiptap.undo"))+"/"+f.toDisplayString(n.__("tiptap::tiptap.redo")),1),f.createElementVNode("div",ob,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[17]||(t[17]=l=>o.undoRedo=l),id:"undoRedo"},null,512),[[f.vModelCheckbox,o.undoRedo]])])])])]),_:1}),f.createVNode(a,{title:"HTML Output"},{default:f.withCtx(()=>[f.withDirectives(f.createElementVNode("textarea",{class:"input w-full min-h-64","onUpdate:modelValue":t[18]||(t[18]=l=>o.content=l)},null,512),[[f.vModelText,o.content]])]),_:1})],64)}var sb=Ao(i0,[["render",ib]]);const ab={mixins:[voyager.formfieldMixin]},lb={key:1},cb={key:2};function ub(n,t,e,r,o,i){const s=f.resolveComponent("tiptap");return n.action=="query"?f.renderSlot(n.$slots,"default",{key:0}):n.action=="add"||n.action=="edit"?(f.openBlock(),f.createElementBlock("div",lb,[f.createVNode(s,{bubbleMenu:n.options.bubbleMenu,maxChars:n.options.maxChars,modelValue:n.modelValue,"onUpdate:modelValue":t[0]||(t[0]=a=>n.$emit("update:modelValue",a)),bold:n.options.bold,italic:n.options.italic,strike:n.options.strike,underline:n.options.underline,code:n.options.code,codeBlock:n.options.codeBlock,blockquote:n.options.blockquote,bulletList:n.options.bulletList,orderedList:n.options.orderedList,taskList:n.options.taskList,heading:n.options.heading,textAlign:n.options.textAlign,horizontalRule:n.options.horizontalRule,undoRedo:n.options.undoRedo},null,8,["bubbleMenu","maxChars","modelValue","bold","italic","strike","underline","code","codeBlock","blockquote","bulletList","orderedList","taskList","heading","textAlign","horizontalRule","undoRedo"])])):n.action=="browse"?(f.openBlock(),f.createElementBlock("div",cb,f.toDisplayString(n.modelValue),1)):f.createCommentVNode("",!0)}var fb=Ao(ab,[["render",ub]]);const pb={mixins:[voyager.formfieldBuilderMixin],computed:{defaultListOptions(){return{display_length:150}},defaultViewOptions(){return{bubbleMenu:!1,maxChars:0,bold:!0,italic:!0,strike:!0,underline:!0,code:!0,codeBlock:!0,blockquote:!0,bulletList:!0,orderedList:!0,taskList:!0,heading:!0,textAlign:!0,horizontalRule:!0,undoRedo:!0}}}},db={key:0},hb={for:"length",class:"label"},mb={key:1},vb={class:"mt-2"},gb={for:"maxChars",class:"label"},yb={class:"grid grid-cols-3 lg:grid-cols-2 xl:grid-cols-3 gap-2 mt-2"},bb={class:"flex items-center space-x-1"},kb={for:"bubble",class:"label"},wb={class:"flex items-center space-x-1"},Sb={for:"bold",class:"label"},xb={class:"flex items-center space-x-1"},Mb={for:"italic",class:"label"},Cb={class:"flex items-center space-x-1"},Eb={for:"strike",class:"label"},Ob={class:"flex items-center space-x-1"},Nb={for:"underline",class:"label"},Tb={class:"flex items-center space-x-1"},_b={for:"code",class:"label"},Ab={class:"flex items-center space-x-1"},Db={for:"codeBlock",class:"label"},Rb={class:"flex items-center space-x-1"},Vb={for:"blockquote",class:"label"},Ib={class:"flex items-center space-x-1"},Bb={for:"bulletList",class:"label"},Pb={class:"flex items-center space-x-1"},zb={for:"orderedList",class:"label"},Lb={class:"flex items-center space-x-1"},Fb={for:"taskList",class:"label"},Hb={class:"flex items-center space-x-1"},Jb={for:"heading",class:"label"},$b={class:"flex items-center space-x-1"},qb={for:"textAlign",class:"label"},jb={class:"flex items-center space-x-1"},Wb={for:"horizontalRule",class:"label"},Kb={class:"flex items-center space-x-1"},Ub={for:"undoRedo",class:"label"},Gb={key:2};function Yb(n,t,e,r,o,i){const s=f.resolveComponent("tiptap");return n.action=="list-options"?(f.openBlock(),f.createElementBlock("div",db,[f.createElementVNode("label",hb,f.toDisplayString(n.__("voyager::generic.display_length")),1),f.withDirectives(f.createElementVNode("input",{type:"number",id:"length",class:"input w-full","onUpdate:modelValue":t[0]||(t[0]=a=>n.options.display_length=a)},null,512),[[f.vModelText,n.options.display_length,void 0,{number:!0}]])])):n.action=="view-options"?(f.openBlock(),f.createElementBlock("div",mb,[f.createElementVNode("div",vb,[f.createElementVNode("label",gb,f.toDisplayString(n.__("tiptap::tiptap.max_characters")),1),f.withDirectives(f.createElementVNode("input",{type:"number",class:"input w-full","onUpdate:modelValue":t[1]||(t[1]=a=>n.options.maxChars=a),min:"0",id:"maxChars"},null,512),[[f.vModelText,n.options.maxChars,void 0,{number:!0}]])]),f.createElementVNode("div",yb,[f.createElementVNode("div",bb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[2]||(t[2]=a=>n.options.bubbleMenu=a),id:"bubble"},null,512),[[f.vModelCheckbox,n.options.bubbleMenu]]),f.createElementVNode("label",kb,f.toDisplayString(n.__("tiptap::tiptap.bubble_menu")),1)]),f.createElementVNode("div",wb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[3]||(t[3]=a=>n.options.bold=a),id:"bold"},null,512),[[f.vModelCheckbox,n.options.bold]]),f.createElementVNode("label",Sb,f.toDisplayString(n.__("tiptap::tiptap.bold")),1)]),f.createElementVNode("div",xb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[4]||(t[4]=a=>n.options.italic=a),id:"italic"},null,512),[[f.vModelCheckbox,n.options.italic]]),f.createElementVNode("label",Mb,f.toDisplayString(n.__("tiptap::tiptap.italic")),1)]),f.createElementVNode("div",Cb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[5]||(t[5]=a=>n.options.strike=a),id:"strike"},null,512),[[f.vModelCheckbox,n.options.strike]]),f.createElementVNode("label",Eb,f.toDisplayString(n.__("tiptap::tiptap.strike")),1)]),f.createElementVNode("div",Ob,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[6]||(t[6]=a=>n.options.underline=a),id:"underline"},null,512),[[f.vModelCheckbox,n.options.underline]]),f.createElementVNode("label",Nb,f.toDisplayString(n.__("tiptap::tiptap.underline")),1)]),f.createElementVNode("div",Tb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[7]||(t[7]=a=>n.options.code=a),id:"code"},null,512),[[f.vModelCheckbox,n.options.code]]),f.createElementVNode("label",_b,f.toDisplayString(n.__("tiptap::tiptap.code")),1)]),f.createElementVNode("div",Ab,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[8]||(t[8]=a=>n.options.codeBlock=a),id:"codeBlock"},null,512),[[f.vModelCheckbox,n.options.codeBlock]]),f.createElementVNode("label",Db,f.toDisplayString(n.__("tiptap::tiptap.code_block")),1)]),f.createElementVNode("div",Rb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[9]||(t[9]=a=>n.options.blockquote=a),id:"blockquote"},null,512),[[f.vModelCheckbox,n.options.blockquote]]),f.createElementVNode("label",Vb,f.toDisplayString(n.__("tiptap::tiptap.blockquote")),1)]),f.createElementVNode("div",Ib,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[10]||(t[10]=a=>n.options.bulletList=a),id:"bulletList"},null,512),[[f.vModelCheckbox,n.options.bulletList]]),f.createElementVNode("label",Bb,f.toDisplayString(n.__("tiptap::tiptap.bullet_list")),1)]),f.createElementVNode("div",Pb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[11]||(t[11]=a=>n.options.orderedList=a),id:"orderedList"},null,512),[[f.vModelCheckbox,n.options.orderedList]]),f.createElementVNode("label",zb,f.toDisplayString(n.__("tiptap::tiptap.ordered_list")),1)]),f.createElementVNode("div",Lb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[12]||(t[12]=a=>n.options.taskList=a),id:"taskList"},null,512),[[f.vModelCheckbox,n.options.taskList]]),f.createElementVNode("label",Fb,f.toDisplayString(n.__("tiptap::tiptap.task_list")),1)]),f.createElementVNode("div",Hb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[13]||(t[13]=a=>n.options.heading=a),id:"heading"},null,512),[[f.vModelCheckbox,n.options.heading]]),f.createElementVNode("label",Jb,f.toDisplayString(n.__("tiptap::tiptap.heading")),1)]),f.createElementVNode("div",$b,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[14]||(t[14]=a=>n.options.textAlign=a),id:"textAlign"},null,512),[[f.vModelCheckbox,n.options.textAlign]]),f.createElementVNode("label",qb,f.toDisplayString(n.__("tiptap::tiptap.text_align")),1)]),f.createElementVNode("div",jb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[15]||(t[15]=a=>n.options.horizontalRule=a),id:"horizontalRule"},null,512),[[f.vModelCheckbox,n.options.horizontalRule]]),f.createElementVNode("label",Wb,f.toDisplayString(n.__("tiptap::tiptap.horizontal_rule")),1)]),f.createElementVNode("div",Kb,[f.withDirectives(f.createElementVNode("input",{type:"checkbox",class:"input","onUpdate:modelValue":t[16]||(t[16]=a=>n.options.undoRedo=a),id:"undoRedo"},null,512),[[f.vModelCheckbox,n.options.undoRedo]]),f.createElementVNode("label",Ub,f.toDisplayString(n.__("tiptap::tiptap.undo"))+"/"+f.toDisplayString(n.__("tiptap::tiptap.redo")),1)])])])):n.action=="view"?(f.openBlock(),f.createElementBlock("div",Gb,[f.createVNode(s,{bubbleMenu:n.options.bubbleMenu,maxChars:n.options.maxChars,value:"''",bold:n.options.bold,italic:n.options.italic,strike:n.options.strike,underline:n.options.underline,code:n.options.code,codeBlock:n.options.codeBlock,blockquote:n.options.blockquote,bulletList:n.options.bulletList,orderedList:n.options.orderedList,taskList:n.options.taskList,heading:n.options.heading,textAlign:n.options.textAlign,horizontalRule:n.options.horizontalRule,undoRedo:n.options.undoRedo},null,8,["bubbleMenu","maxChars","bold","italic","strike","underline","code","codeBlock","blockquote","bulletList","orderedList","taskList","heading","textAlign","horizontalRule","undoRedo"])])):f.createCommentVNode("",!0)}var Xb=Ao(pb,[["render",Yb]]);voyager.component("tiptap",Ju),voyager.component("tiptap-demo",sb),voyager.component("tiptap-formfield",fb),voyager.component("tiptap-builder",Xb),voyager.addToUI("Tiptap","tiptap-demo")}); diff --git a/src/components/Tiptap.vue b/src/components/Tiptap.vue index 41c3953..93e5320 100644 --- a/src/components/Tiptap.vue +++ b/src/components/Tiptap.vue @@ -576,10 +576,12 @@ export default { computed: { extensions() { let extensions = [ - StarterKit, + StarterKit.configure({ + orderedList: false, + bulletList: false, + }), Underline, TextAlign, - CodeBlock, OrderedList.configure({ class: 'inline-flex' }),