@novaprose/tinymce-compat 0.0.0-stage → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,38 @@
1
+ "use strict";(()=>{var bh=Object.defineProperty;var O=(n,e)=>()=>(n&&(e=n(n=0)),e);var Be=(n,e)=>{for(var t in e)bh(n,t,{get:e[t],enumerable:!0})};function se(n,e){Zo.set(n,e)}function ei(n){return Zo.has(n)}function gl(n){return typeof n=="function"}function bl(n){let e=[],t=[],r=[];for(let o of n)if(typeof o=="string"){let i=Zo.get(o);i?gl(i)?t.push(i):e.push(i):r.push(`Plugin "${o}" is not registered`)}else gl(o)?t.push(o):e.push(o);return{plugins:e,loaders:t,errors:r}}function ti(n,e=new Set){let t=new Map(n.map(l=>[l.name,l])),r=[],o=[],i=new Map,s=(l,a)=>{let c=i.get(l.name);if(c==="done")return!0;if(c==="failed")return!1;if(c==="visiting")return o.push(`Plugin dependency cycle: ${[...a,l.name].join(" \u2192 ")}`),!1;i.set(l.name,"visiting");for(let u of l.requires??[]){if(e.has(u))continue;let d=t.get(u);if(!d)return o.push(`Plugin "${l.name}" requires "${u}", which is not loaded`),i.set(l.name,"failed"),!1;if(!s(d,[...a,l.name]))return i.set(l.name,"failed"),!1}return i.set(l.name,"done"),r.push(l),!0};for(let l of n)s(l,[]);return{ordered:r,errors:o}}async function yl(n){let e=await n();return"default"in e&&e.default?e.default:e}var Zo,Tr=O(()=>{"use strict";Zo=new Map});function ge(n){this.content=n}var ni,vl=O(()=>{"use strict";ge.prototype={constructor:ge,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),i=r.content.slice();return o==-1?i.push(t||n,e):(i[o+1]=e,t&&(i[o]=t)),new ge(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ge(t)},addToStart:function(n,e){return new ge([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ge(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),i=r.find(n);return o.splice(i==-1?o.length:i,0,e,t),new ge(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=ge.from(n),n.size?new ge(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ge.from(n),n.size?new ge(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ge.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};ge.from=function(n){if(n instanceof ge)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ge(e)};ni=ge});function Ll(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),i=e.child(r);if(o==i){t+=o.nodeSize;continue}if(!o.sameMarkup(i))return t;if(o.isText&&o.text!=i.text){let s=o.text,l=i.text,a=0;for(;s[a]==l[a];a++)t++;return a&&a<s.length&&a<l.length&&Il(s.charCodeAt(a-1))&&Rl(s.charCodeAt(a))&&t--,t}if(o.content.size||i.content.size){let s=Ll(o.content,i.content,t+1);if(s!=null)return s}t+=o.nodeSize}}function Dl(n,e,t,r){for(let o=n.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:t,b:r};let s=n.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let c=s.text,u=l.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,t--,r--;return d&&f&&d<c.length&&Il(c.charCodeAt(d-1))&&Rl(c.charCodeAt(d))&&(t++,r++),{a:t,b:r}}if(s.content.size||l.content.size){let c=Dl(s.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}function Rl(n){return n>=56320&&n<57344}function Il(n){return n>=55296&&n<56320}function Nr(n,e){return ri.index=n,ri.offset=e,ri}function Dr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Dr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Dr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}function Pl(n,e,t){let{index:r,offset:o}=n.findIndex(e),i=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(o==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Pl(i.content,e-o-1,t-o-1)))}function Bl(n,e,t,r,o,i){let{index:s,offset:l}=n.findIndex(e),a=n.maybeChild(s);if(l==e||a.isText)return i&&r<=0&&o<=0&&!i.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=Bl(a.content,e-l-1,t,s==0?r-1:0,s==n.childCount-1?o-1:0,a);return c&&n.replaceChild(s,a.copy(c))}function yh(n,e,t){if(t.openStart>n.depth)throw new bt("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new bt("Inconsistent open depths");return zl(n,e,t,0)}function zl(n,e,t,r){let o=n.index(r),i=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let s=zl(n,e,t,r+1);return i.copy(i.content.replaceChild(o,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,l=s.content;return It(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=vh(t,n);return It(i,Fl(n,s,l,e,r))}else return It(i,Rr(n,e,r))}function Hl(n,e){if(!e.type.compatibleContent(n.type))throw new bt("Cannot join "+e.type.name+" onto "+n.type.name)}function oi(n,e,t){let r=n.node(t);return Hl(r,e.node(t)),r}function Rt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Fn(n,e,t,r){let o=(e||n).node(t),i=0,s=e?e.index(t):o.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Rt(n.nodeAfter,r),i++));for(let l=i;l<s;l++)Rt(o.child(l),r);e&&e.depth==t&&e.textOffset&&Rt(e.nodeBefore,r)}function It(n,e){if(!n.type.validContent(e))throw new bt("Invalid content for node "+n.type.name);return n.copy(e)}function Fl(n,e,t,r,o){let i=n.depth>o&&oi(n,e,o+1),s=r.depth>o&&oi(t,r,o+1),l=[];return Fn(null,n,o,l),i&&s&&e.index(o)==t.index(o)?(Hl(i,s),Rt(It(i,Fl(n,e,t,r,o+1)),l)):(i&&Rt(It(i,Rr(n,e,o+1)),l),Fn(e,t,o,l),s&&Rt(It(s,Rr(t,r,o+1)),l)),Fn(r,null,o,l),new E(l)}function Rr(n,e,t){let r=[];if(Fn(null,n,t,r),n.depth>t){let o=oi(n,e,t+1);Rt(It(o,Rr(n,e,t+1)),r)}return Fn(e,null,t,r),new E(r)}function vh(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)o=e.node(i).copy(E.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}function $l(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function kl(n,e,t,r){for(let o in e)if(!(o in n))throw new RangeError(`Unsupported attribute ${o} for ${t} of type ${r}`);for(let o in n)n[o].validate&&n[o].validate(e[o])}function _l(n){let e=[];do e.push(kh(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function kh(n){let e=[];do e.push(Mh(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Mh(n){let e=Eh(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Sh(n,e);else break;return e}function Ml(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Sh(n,e){let t=Ml(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ml(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Ch(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let i in t){let s=t[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function Eh(n){if(n.eat("(")){let e=_l(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Ch(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Ah(n){let e=[[]];return o(i(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=t())}else if(s.type=="star"){let a=t();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=t();o(i(s.expr,a),u),a=u}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=t();r(a,u),o(i(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Vl(n,e){return e-n}function Sl(n,e){let t=[];return r(e),t.sort(Vl);function r(o){let i=n[o];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&t.indexOf(a)==-1&&r(a)}}}function Th(n){let e=Object.create(null);return t(Sl(n,0));function t(r){let o=[];r.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);Sl(n,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new Bt(r.indexOf(n.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(Vl);i.next.push({type:o[s][0],next:e[l.join(",")]||t(l)})}return i}}function Nh(n,e){for(let t=0,r=[n];t<r.length;t++){let o=r[t],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ql(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Wl(n,e){let t=Object.create(null);for(let r in n){let o=n[r],i=e&&e[r];if(i===void 0)if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r);else o.validate&&o.validate(i);t[r]=i}return t}function Ul(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new ai(n,r,e[r]);return t}function Oh(n,e,t){let r=t.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}function Cl(n,e){let t=[];for(let r=0;r<e.length;r++){let o=e[r],i=n.marks[o],s=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Lh(n){return n.tag!=null}function Dh(n){return n.style!=null}function El(n,e,t){return e!=null?(e?qn:0)|(e==="full"?ci:0):n&&n.whitespace=="pre"?qn|ci:t&~$n}function Ih(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Kl.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Ph(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Al(n){let e={};for(let t in n)e[t]=n[t];return e}function Tl(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}function Nl(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Or(n){return n.document||window.document}function Bh(n){let e=Ol.get(n);return e===void 0&&Ol.set(n,e=zh(n)),e}function zh(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)t(r[o]);else for(let o in r)t(r[o])}return t(n),e}function Lr(n,e,t,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Bh(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(t=o.slice(0,s),o=o.slice(s+1));let l,a=t?n.createElementNS(t,o):n.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof f=="string")a.appendChild(n.createTextNode(f));else{let{dom:p,contentDOM:h}=Lr(n,f,t,r);if(a.appendChild(p),h){if(l)throw new RangeError("Multiple content holes");l=h}}}return{dom:a,contentDOM:l}}var E,ri,q,bt,N,Ir,ii,wh,wl,Pt,xh,Oe,xl,si,Bt,li,nt,ai,_n,Vn,yt,jl,Rh,Kl,qn,ci,$n,an,Pr,We,Ol,le=O(()=>{"use strict";vl();E=class n{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new n(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),o+=l.nodeSize),s=a}return new n(r,o)}cutByIndex(e,t){return e==t?n.empty:e==0&&t==this.content.length?this:new n(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new n(o,i)}addToStart(e){return new n([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new n(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return Ll(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Dl(this,e,t,r)}findIndex(e){if(e==0)return Nr(0,e);if(e==this.size)return Nr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let o=this.child(t),i=r+o.nodeSize;if(i>=e)return i==e?Nr(t+1,i):Nr(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return n.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return n.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return n.empty;let t,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(t||(t=e.slice(0,o)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new n(t||e,r)}static from(e){if(!e)return n.empty;if(e instanceof n)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new n([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};E.empty=new E([],0);ri={index:0,offset:0};q=class n{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Dr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return n.none;if(e instanceof n)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};q.none=[];bt=class extends Error{},N=class n{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Bl(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new n(r,this.openStart,this.openEnd)}removeBetween(e,t){return new n(Pl(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return n.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new n(E.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new n(e,r,o)}};N.empty=new N(E.empty,0,0);Ir=class n{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return q.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Pt(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],o=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new n(t,r,i)}static resolveCached(e,t){let r=wl.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==t)return s}else wl.set(e,r=new ii);let o=r.elts[r.i]=n.resolve(e,t);return r.i=(r.i+1)%wh,o}},ii=class{constructor(){this.elts=[],this.i=0}},wh=12,wl=new WeakMap,Pt=class{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},xh=Object.create(null),Oe=class n{constructor(e,t,r,o=q.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||E.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,o=0){this.content.nodesBetween(e,t,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Dr(this.attrs,t||e.defaultAttrs||xh)&&q.sameSet(this.marks,r||q.none)}copy(e=null){return e==this.content?this:new n(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new n(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return N.empty;let o=this.resolve(e),i=this.resolve(t),s=r?0:o.sharedDepth(t),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new N(c,o.depth-s,i.depth-s)}replace(e,t,r){return yh(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return Ir.resolveCached(this,e)}resolveNoCache(e){return Ir.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),$l(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=E.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),kl(this.type.attrs,this.attrs,"node",this.type.name);let e=q.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];kl(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!q.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=E.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,o,r)}};Oe.prototype.text=void 0;xl=(()=>{let{stack:n}=new Error("/");if(!n||!/\n\s*at\s/.test(n))return t=>t;let e=Object.create(null);return t=>(e[t],t)})(),si=class n extends Oe{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):$l(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return xl(this.text.slice(e,t))}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new n(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new n(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(xl(this.text.slice(e,t)))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};Bt=class n{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new li(e,t);if(r.next==null)return n.empty;let o=_l(r);r.next&&r.err("Unexpected trailing text");let i=Th(Ah(o));return Nh(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let o=this;for(let i=t;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return E.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
2
+ `)}};Bt.empty=new Bt(!0);li=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};nt=class n{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ul(e,r.attrs),this.defaultAttrs=ql(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Bt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Wl(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Oe(this,this.computeAttrs(e),E.from(t),q.setFrom(r))}createChecked(e=null,t,r){return t=E.from(t),this.checkContent(t),new Oe(this,this.computeAttrs(e),t,q.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=E.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(E.empty,!0);return i?new Oe(this,e,t.append(i),q.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:q.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,s)=>r[i]=new n(i,t,s));let o=t.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};ai=class{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Oh(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}},_n=class n{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=Ul(e,o.attrs),this.excluded=null;let i=ql(this.attrs);this.instance=i?new q(this,i):null}create(e=null){return!e&&this.instance?this.instance:new q(this,Wl(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new n(i,o++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}},Vn=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=ni.from(e.nodes),t.marks=ni.from(e.marks||{}),this.nodes=nt.compile(this.spec.nodes,this),this.marks=_n.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=Bt.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Cl(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Cl(this,s.split(" "))}this.nodeFromJSON=o=>Oe.fromJSON(this,o),this.markFromJSON=o=>q.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof nt){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,o)}text(e,t){let r=this.nodes.text;return new si(r,r.defaultAttrs,e,q.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};yt=class n{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(o=>{if(Lh(o))this.tags.push(o);else if(Dh(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Pr(this,t,!1);return r.addAll(e,q.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Pr(this,t,!0);return r.addAll(e,q.none,t.from,t.to),N.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(Ph(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Al(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Al(s)),s.node||s.ignore||s.mark||(s.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new n(e,n.schemaRules(e)))}},jl={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},Rh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Kl={ol:!0,ul:!0},qn=1,ci=2,$n=4;an=class{constructor(e,t,r,o,i,s){this.type=e,this.attrs=t,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=q.none,this.match=i||(s&$n?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(E.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&qn)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let t=E.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(E.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!jl.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Pr=class{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=t.topNode,i,s=El(null,t.preserveWhitespace,0)|(r?$n:0);o?i=new an(o.type,o.attrs,q.none,!0,t.topMatch||o.type.contentMatch,s):r?i=new an(null,null,q.none,!0,null,s):i=new an(e.schema.topNodeType,null,q.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,o=this.top,i=o.options&ci?"full":this.localPreserveWS||(o.options&qn)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
3
+ `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(s.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=o.content[o.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Kl.hasOwnProperty(s)&&this.parser.normalizeLists&&Ih(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Rh.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(jl.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,o){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,r){let o,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],c=a.findWrapping(e);if(c&&(!o||o.length>c.length+l)&&(o=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)t=this.enterInner(o[s],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let o=this.findPlace(e,t,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=q.none;for(let l of o.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Tl(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,r,o){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,o)),i}enterInner(e,t,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=El(e,i,s.options);s.options&$n&&s.content.length==0&&(l|=$n);let a=q.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Tl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new an(e,t,a,o,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=qn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&t.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}};We=class n{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Or(t).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,t);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){if(e.isText)return Or(t).createTextNode(e.text);let{dom:r,contentDOM:o}=Lr(Or(t),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&Lr(Or(r),o(e,t),null,e.attrs)}static renderSpec(e,t,r=null,o){return typeof t=="string"?{dom:e.createTextNode(t)}:Lr(e,t,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new n(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Nl(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Nl(e.marks)}};Ol=new WeakMap});function Hh(n,e){return n+e*Zl}function Jl(n){return n&Ql}function Fh(n){return(n-(n&Ql))/Zl}function hi(n,e,t){let r=[];for(let o=0;o<n.childCount;o++){let i=n.child(o);i.content.size&&(i=i.copy(hi(i.content,e,i))),i.isInline&&(i=e(i,t,o)),r.push(i)}return E.fromArray(r)}function zr(n,e,t,r,o){let i=o.length?o[o.length-1]:null;i&&i instanceof n&&i.to==e&&i.mark.eq(r)?o[o.length-1]=new n(i.from,t,r):o.push(new n(e,t,r))}function fi(n,e,t){let r=n.resolve(e),o=t-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function $h(n,e,t,r){let o=[];n.doc.nodesBetween(e,t,(i,s,l)=>{if(!i.isInline)return;let a=i.marks;if(!r.isInSet(a)&&l.type.allowsMarkType(r.type)){let c=Math.max(s,e),u=Math.min(s+i.nodeSize,t);zr(zt,c,u,r,o)}}),o.forEach(i=>n.step(i))}function _h(n,e,t,r){let o=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline||!s.isAtom)return;i++;let a=null;if(r instanceof _n){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let p=0;p<o.length;p++){let h=o[p];h.step==i-1&&d.eq(o[p].style)&&(f=h)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>n.step(new vt(s.from,s.to,s.style)))}function mi(n,e,t,r=t.contentMatch,o=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new be(l,u,N.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new vt(l,u,c.marks[f]));if(o&&c.isText&&t.whitespace!="pre"){let f,p=/\r?\n|\r/g,h;for(;f=p.exec(c.text);)h||(h=new N(E.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new be(l+f.index,l+f.index+f[0].length,h))}}l=u}if(!r.validEnd){let a=r.fillBefore(E.empty,!0);n.replace(l,l,new N(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function Vh(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Ht(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,o=0,i=0;;--r){let s=n.$from.node(r),l=n.$from.index(r)+o,a=n.$to.indexAfter(r)-i;if(r<n.depth&&s.canReplace(l,a,t))return r;if(r==0||s.type.spec.isolating||!Vh(s,l,a))break;l&&(o=1),a<s.childCount&&(i=1)}return null}function qh(n,e,t){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,u=E.empty,d=0;for(let h=i,m=!1;h>t;h--)m||r.index(h)>0?(m=!0,u=E.from(r.node(h).copy(u)),d++):a--;let f=E.empty,p=0;for(let h=i,m=!1;h>t;h--)m||o.after(h+1)<o.end(h)?(m=!0,f=E.from(o.node(h).copy(f)),p++):c++;n.step(new fe(a,c,s,l,new N(u.append(f),d,p),u.size-d,!0))}function fn(n,e,t=null,r=n){let o=Wh(n,e),i=o&&Uh(r,e);return i?o.map(Gl).concat({type:e,attrs:t}).concat(i.map(Gl)):null}function Gl(n){return{type:n,attrs:null}}function Wh(n,e){let{parent:t,startIndex:r,endIndex:o}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return t.canReplaceWith(r,o,s)?i:null}function Uh(n,e){let{parent:t,startIndex:r,endIndex:o}=n,i=t.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:s}function jh(n,e,t){let r=E.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let l=t[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=E.from(t[s].type.create(t[s].attrs,r))}let o=e.start,i=e.end;n.step(new fe(o,i,o,i,new N(r,0,0),t.length,!0))}function Kh(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,a)&&Jh(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!h?c=!1:!p&&h&&(c=!0)}c===!1&&oa(n,s,l,i),mi(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let u=n.mapping.slice(i),d=u.map(l,1),f=u.map(l+s.nodeSize,1);return n.step(new fe(d,f,d+1,f-1,new N(E.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&ra(n,s,l,i),!1}})}function ra(n,e,t,r){e.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=n.mapping.slice(r).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function oa(n,e,t,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
5
+ `))}})}function Jh(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function Gh(n,e,t,r,o){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(r,null,o||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new fe(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new N(E.from(s),0,0),1,!0))}function wt(n,e,t=1,r){let o=n.resolve(e),i=o.depth-t,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=t-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),h=r&&r[u+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(p))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function Xh(n,e,t=1,r){let o=n.doc.resolve(e),i=E.empty,s=E.empty;for(let l=o.depth,a=o.depth-t,c=t-1;l>a;l--,c--){i=E.from(o.node(l).copy(i));let u=r&&r[c];s=E.from(u?u.type.create(u.attrs,s):o.node(l).copy(s))}n.step(new be(e,e,new N(i.append(s),t,t),!0))}function Ft(n,e){let t=n.resolve(e),r=t.index();return Qh(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Yh(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?n.type.schema.nodes.text:i.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function Qh(n,e){return!!(n&&e&&!n.isLeaf&&Yh(n,e))}function Zh(n,e,t){let r=null,{linebreakReplacement:o}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let l=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);oa(n,u.node(),u.before(),l)}s.inlineContent&&mi(n,e+t-1,s,i.node().contentMatchAt(i.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new be(c,a.map(e+t,-1),N.empty,!0)),r===!0){let u=n.doc.resolve(c);ra(n,u.node(),u.before(),n.steps.length)}return n}function em(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,t))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,t))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function $r(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let i=0;i<t.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1;for(let a=0;a<2;a++){if(a){if(!l)break;l=-l}let c=r.index(s)+(l>0?1:0),u=r.node(s),d=!1;if(i==1)d=u.canReplace(c,c,o);else{let f=u.contentMatchAt(c).findWrapping(o.firstChild.type);d=f&&u.canReplaceWith(c,c,f[0])}if(d)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}}return null}function _r(n,e,t=e,r=N.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),i=n.resolve(t);return ia(o,i,r)?new be(e,t,r):new pi(o,i,r).fit()}function ia(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}function Wn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Wn(n.firstChild.content,e-1,t)))}function Un(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Un(n.lastChild.content,e-1,t)))}function Xl(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function sa(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,sa(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(E.empty,!0)))),n.copy(r)}function di(n,e,t,r,o){let i=n.node(e),s=o?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!tm(t,i.content,s)?l:null}function tm(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function nm(n){return n.spec.defining||n.spec.definingForContent}function Yl(n,e){for(let t=0;;t++){let r=e<0?n.firstChild:n.lastChild;if(!r||r.isAtom)return t;n=r.content}}function rm(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),i=n.doc.resolve(t);if(ia(o,i,r))return n.step(new be(e,t,r));let s=aa(o,i);s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let f=o.depth,p=o.pos-1;f>0;f--,p--){let h=o.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(f)>-1?l=f:o.before(f)==p&&s.splice(1,0,-f)}let a=s.indexOf(l),c=[],u=r.openStart;for(let f=r.content,p=0;;p++){let h=f.firstChild;if(c.push(h),p==r.openStart)break;f=h.content}for(let f=u-1;f>=0;f--){let p=c[f],h=nm(p.type);if(h&&!p.sameMarkup(o.node(Math.abs(l)-1)))u=f;else if(h||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+u+1)%(r.openStart+1),h=c[p];if(h)for(let m=0;m<s.length;m++){let b=s[(m+a)%s.length],g=!0;b<0&&(g=!1,b=-b);let y=o.node(b-1),x=o.index(b-1);if(y.canReplaceWith(x,x,h.type,h.marks))return n.replace(o.before(b),g?i.after(b):t,new N(la(r.content,0,r.openStart,p),p,r.openEnd))}}let d=n.steps.length;for(let f=s.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>d));f--){let p=s[f];p<0||(e=o.before(p),t=i.after(p))}}function la(n,e,t,r,o){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(la(i.content,e+1,t,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(E.empty,!0))}return n}function om(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=em(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new N(E.from(r),0,0))}function im(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t);if(r.parent.isTextblock&&o.parent.isTextblock&&r.start()!=o.start()&&r.parentOffset==0&&o.parentOffset==0){let s=r.sharedDepth(t),l=!1;for(let a=r.depth;a>s;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=o.depth;a>s;a--)o.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=o.depth;a>0&&t==o.start(a);a--)t=o.before(a);r=n.doc.resolve(e),o=n.doc.resolve(t)}}let i=aa(r,o);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return n.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&o.end(s)-t!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function aa(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let i=n.start(o);if(i<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&t.push(o)}return t}var Ql,Zl,ea,ta,Br,na,jn,rt,Kn,ui,re,de,zt,vt,Jn,Gn,cn,be,fe,pi,Hr,Fr,un,dn,Je=O(()=>{"use strict";le();Ql=65535,Zl=Math.pow(2,16);ea=1,ta=2,Br=4,na=8,jn=class{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&na)>0}get deletedBefore(){return(this.delInfo&(ea|Br))>0}get deletedAfter(){return(this.delInfo&(ta|Br))>0}get deletedAcross(){return(this.delInfo&Br)>0}},rt=class n{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&n.empty)return n.empty}recover(e){let t=0,r=Jl(e);if(!this.inverted)for(let o=0;o<r;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+t+Fh(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,p=a+o+(f<0?0:u);if(r)return p;let h=e==(t<0?a:d)?null:Hh(l/3,e-a),m=0;return c&&(m|=e==a?ta:e==d?ea:Br,(t<0?e!=a:e!=d)&&(m|=na)),new jn(p,m,h)}o+=u-c}return r?e+o:new jn(e+o,0,null)}touches(e,t){let r=0,o=Jl(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+t],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new n(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?n.empty:new n(e<0?[0,-e,0]:[0,0,e])}};rt.empty=new rt([]);Kn=class n{constructor(e,t,r=0,o=e?e.length:0){this.mirror=t,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new n(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=e.from,r=this._maps.length;t<e.to;t++){let o=e.getMirror(t);o!=null&&(o=o<t&&o>=e.from?r+(o-e.from):void 0),this.appendMap(e._maps[t],o)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.to-1,r=this._maps.length+e._maps.length;t>=e.from;t--){let o=e.getMirror(t);o!=null&&(o=o>t&&o<e.to?r-(o-e.from)-1:void 0),this.appendMap(e._maps[t].invert(),o)}}invert(){let e=new n;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new jn(e,o,null)}},ui=Object.create(null),re=class{getMap(){return rt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ui[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in ui)throw new RangeError("Duplicate use of step JSON ID "+e);return ui[e]=t,t.prototype.jsonID=e,t}},de=class n{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new n(e,null)}static fail(e){return new n(null,e)}static fromReplace(e,t,r,o){try{return n.ok(e.replace(t,r,o))}catch(i){if(i instanceof bt)return n.fail(i.message);throw i}}};zt=class n extends re{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new N(hi(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),t.openStart,t.openEnd);return de.fromReplace(e,this.from,this.to,i)}invert(e){let t=[];return e.nodesBetween(this.from,this.to,(r,o)=>{if(r.isInline&&r.isAtom){let i=this.mark.addToSet(r.marks);if(!q.sameSet(i,r.marks)){let s=Math.max(this.from,o),l=Math.min(this.to,o+r.nodeSize);zr(vt,s,l,this.mark,t);for(let a of r.marks)a.isInSet(i)||zr(n,s,l,a,t)}}}),t.length==1?t[0]:new Jn(t)}map(e){let t=e.map(this.from,1),r=e.map(this.to,-1);return t>=r?null:new n(t,r,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};re.jsonID("addMark",zt);vt=class n extends re{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new N(hi(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return de.fromReplace(e,this.from,this.to,r)}invert(e){let t=[];return e.nodesBetween(this.from,this.to,(r,o)=>{r.isInline&&r.isAtom&&this.mark.isInSet(r.marks)&&zr(zt,Math.max(this.from,o),Math.min(this.to,o+r.nodeSize),this.mark,t)}),t.length==1?t[0]:new Jn(t)}map(e){let t=e.map(this.from,1),r=e.map(this.to,-1);return t>=r?null:new n(t,r,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};re.jsonID("removeMark",vt);Jn=class n extends re{constructor(e){super(),this.steps=e}apply(e){for(let t of this.steps){let r=t.apply(e);if(!r.doc)return r;e=r.doc}return new de(e,null)}invert(e){return new n(this.steps.map(t=>t.invert(e)))}map(e){let t=[];for(let r of this.steps){let o=r.map(e);o&&t.push(o)}return t.length?new n(t):null}toJSON(){return{stepType:"markSet",steps:this.steps.map(e=>e.toJSON())}}static fromJSON(e,t){if(!Array.isArray(t.steps)||!t.steps.every(r=>r.stepType=="addMark"||r.stepType=="removeMark"))throw new RangeError("Invalid JSON for MarkSetStep");return new n(t.steps.map(r=>re.fromJSON(e,r)))}};re.jsonID("markSet",Jn);Gn=class n extends re{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return de.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return de.fromReplace(e,this.pos,this.pos+1,new N(E.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new n(this.pos,t.marks[o]);return new n(this.pos,this.mark)}}return new cn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new n(t.pos,e.markFromJSON(t.mark))}};re.jsonID("addNodeMark",Gn);cn=class n extends re{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return de.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return de.fromReplace(e,this.pos,this.pos+1,new N(E.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Gn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new n(t.pos,e.markFromJSON(t.mark))}};re.jsonID("removeNodeMark",cn);be=class n extends re{constructor(e,t,r,o=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=o}apply(e){return this.structure&&fi(e,this.from,this.to)?de.fail("Structure replace would overwrite content"):de.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new rt([this.from,this.to-this.from,this.slice.size])}invert(e){return new n(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&n.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new n(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof n)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?N.empty:new N(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new n(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?N.empty:new N(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new n(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new n(t.from,t.to,N.fromJSON(e,t.slice),!!t.structure)}};be.MAP_BIAS=1;re.jsonID("replace",be);fe=class n extends re{constructor(e,t,r,o,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(fi(e,this.from,this.gapFrom)||fi(e,this.gapTo,this.to)))return de.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return de.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?de.fromReplace(e,this.from,this.to,r):de.fail("Content does not fit in gap")}getMap(){return new rt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new n(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||i>r.pos||o>i?null:new n(t.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new n(t.from,t.to,t.gapFrom,t.gapTo,N.fromJSON(e,t.slice),t.insert,!!t.structure)}};re.jsonID("replaceAround",fe);pi=class{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=E.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=E.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new N(i,s,l);return e>-1?new fe(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new be(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=t.firstChild;if(t.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Xl(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(t==1&&(s?c.matchType(s.type)||(d=c.fillBefore(E.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(t==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced;return Yl(e,-1)<=t?!1:(this.unplaced.size>1&&Yl(e,1)>r&&r++,this.unplaced=new N(e,t+1,r),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Xl(e,t);if(o.childCount<=1&&t>0){let i=e.size-t<=t+o.size;this.unplaced=new N(Wn(e,t-1,1),t-1,i?t-1:r)}else this.unplaced=new N(Wn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[t];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let p=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let m=l.child(c),b=d.matchType(m.type);if(!b)break;c++,(c>1||a==0||m.content.size)&&(d=b,u.push(sa(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?p:-1)))}let h=c==l.childCount;h||(p=-1),this.placed=Un(this.placed,t,E.from(u)),this.frontier[t].match=d,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,b=u[u.length-1];b&&m<p;m++)this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),b=b.lastChild;this.unplaced=h?e==0?N.empty:new N(Wn(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new N(Wn(s.content,e,c),e,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!di(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=di(e,t,o,r,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=di(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Un(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Un(this.placed,this.depth,E.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(E.empty,!0);t.childCount&&(this.placed=Un(this.placed,this.frontier.length,t))}};Hr=class n extends re{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return de.fail("No node at attribute step's position");let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return de.fromReplace(e,this.pos,this.pos+1,new N(E.from(o),0,t.isLeaf?0:1))}getMap(){return rt.empty}invert(e){return new n(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new n(t.pos,t.attr,t.value)}};re.jsonID("attr",Hr);Fr=class n extends re{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return de.ok(r)}getMap(){return rt.empty}invert(e){return new n(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new n(t.attr,t.value)}};re.jsonID("docAttr",Fr);un=class extends Error{};un=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};un.prototype=Object.create(Error.prototype);un.prototype.constructor=un;un.prototype.name="TransformError";dn=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Kn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new un(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let o=this.mapping.maps[r];r&&(e=o.map(e,1),t=o.map(t,-1)),o.forEach((i,s,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=N.empty){let o=_r(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new N(E.from(r),0,0))}delete(e,t){return this.replace(e,t,N.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return rm(this,e,t,r),this}replaceRangeWith(e,t,r){return om(this,e,t,r),this}deleteRange(e,t){return im(this,e,t),this}lift(e,t){return qh(this,e,t),this}join(e,t=1){return Zh(this,e,t),this}wrap(e,t){return jh(this,e,t),this}setBlockType(e,t=e,r,o=null){return Kh(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return Gh(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new Hr(e,t,r)),this}setDocAttribute(e,t){return this.step(new Fr(e,t)),this}addNodeMark(e,t){return this.step(new Gn(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof q)t.isInSet(r.marks)&&this.step(new cn(e,t));else{let o=r.marks,i,s=[];for(;i=t.isInSet(o);)s.push(new cn(e,i)),o=i.removeFromSet(o);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,r){return Xh(this,e,t,r),this}addMark(e,t,r){return $h(this,e,t,r),this}removeMark(e,t,r){return _h(this,e,t,r),this}clearIncompatible(e,t,r){return mi(this,e,t,r),this}}});function ua(n){!ca&&!n.parent.inlineContent&&(ca=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}function pn(n,e,t,r,o,i=!1){if(e.inlineContent)return P.create(n,t);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&R.isSelectable(l))return R.create(n,t-(o<0?l.nodeSize:0))}else{let a=pn(n,l,t+o,o<0?l.childCount:0,o,i);if(a)return a}t+=l.nodeSize*o}return null}function da(n,e,t){let r=n.steps.length-1;if(r<e)return;let o=n.steps[r];if(!(o instanceof be||o instanceof fe))return;let i=n.mapping.maps[r],s;i.forEach((l,a,c,u)=>{s==null&&(s=u)}),n.setSelection(B.near(n.doc.resolve(s),t))}function ha(n,e){return!e||!n?n:n.bind(e)}function ma(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=ma(o,e,{})),t[r]=o}return t}function ga(n){return n in bi?n+"$"+ ++bi[n]:(bi[n]=0,n+"$")}var gi,B,xt,ca,P,qr,R,yi,pe,sm,fa,Vr,pa,vi,$t,lm,Xn,hn,_,bi,j,U=O(()=>{"use strict";le();Je();gi=Object.create(null),B=class{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new xt(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=N.empty){let r=t.content.lastChild,o=null;for(let l=0;l<t.openEnd;l++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?N.empty:t),l==0&&da(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:l}=o[i],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),da(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let o=e.parent.inlineContent?new P(e):pn(e.node(0),e.parent,e.pos,e.index(),t,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=t<0?pn(e.node(0),e.node(i),e.before(i+1),e.index(i),t,r):pn(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new pe(e.node(0))}static atStart(e){return pn(e,e,0,0,1)||new pe(e)}static atEnd(e){return pn(e,e,e.content.size,e.childCount,-1)||new pe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=gi[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in gi)throw new RangeError("Duplicate use of selection JSON ID "+e);return gi[e]=t,t.prototype.jsonID=e,t}getBookmark(){return P.between(this.$anchor,this.$head).getBookmark()}};B.prototype.visible=!0;xt=class{constructor(e,t){this.$from=e,this.$to=t}},ca=!1;P=class n extends B{constructor(e,t=e){ua(e),ua(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return B.near(r);let o=e.resolve(t.map(this.anchor));return new n(o.parent.inlineContent?o:r,r)}replace(e,t=N.empty){if(super.replace(e,t),t==N.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof n&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new qr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new n(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let i=B.findFrom(t,r,!0)||B.findFrom(t,-r,!0);if(i)t=i.$head;else return B.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(B.findFrom(e,-r,!0)||B.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new n(e,t)}};B.jsonID("text",P);qr=class n{constructor(e,t){this.anchor=e,this.head=t}map(e){return new n(e.map(this.anchor),e.map(this.head))}resolve(e){return P.between(e.resolve(this.anchor),e.resolve(this.head))}},R=class n extends B{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:o}=t.mapResult(this.anchor),i=e.resolve(o);return r?B.near(i):new n(i)}content(){return new N(E.from(this.node),0,0)}eq(e){return e instanceof n&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new yi(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new n(e.resolve(t.anchor))}static create(e,t){return new n(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};R.prototype.visible=!1;B.jsonID("node",R);yi=class n{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new qr(r,r):new n(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&R.isSelectable(r)?new R(t):B.near(t)}},pe=class n extends B{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=N.empty){if(t==N.empty){e.delete(0,e.doc.content.size);let r=B.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new n(e)}map(e){return new n(e)}eq(e){return e instanceof n}getBookmark(){return sm}};B.jsonID("all",pe);sm={map(){return this},resolve(n){return new pe(n)}};fa=1,Vr=2,pa=4,vi=class extends dn{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|fa)&~Vr,this.storedMarks=null,this}get selectionSet(){return(this.updated&fa)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Vr,this}ensureMarks(e){return q.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Vr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Vr,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||q.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(B.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=pa,this}get scrolledIntoView(){return(this.updated&pa)>0}};$t=class{constructor(e,t,r){this.name=e,this.init=ha(t.init,r),this.apply=ha(t.apply,r)}},lm=[new $t("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new $t("selection",{init(n,e){return n.selection||B.atStart(e.doc)},apply(n){return n.selection}}),new $t("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new $t("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})],Xn=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=lm.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new $t(r.key,r.spec.state,r))})}},hn=class n{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,c=o?o[s].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:t.length})}}if(!i)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new n(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new vi(this)}static create(e){let t=new Xn(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new n(t);for(let o=0;o<t.fields.length;o++)r[t.fields[o].name]=t.fields[o].init(e,r);return r}reconfigure(e){let t=new Xn(this.schema,e.plugins),r=t.fields,o=new n(t);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(t[r]=i.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Xn(e.schema,e.plugins),i=new n(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=Oe.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=B.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[s.name]=c.fromJSON.call(a,e,t[l],i);return}}i[s.name]=s.init(e,i)}}),i}};_=class{constructor(e){this.spec=e,this.props={},e.props&&ma(e.props,this,this.props),this.key=e.key?e.key.key:ga("plugin")}getState(e){return e[this.key]}},bi=Object.create(null);j=class{constructor(e="key"){this.key=ga(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}});function v(n,e={},...t){let r=document.createElement(n);for(let[o,i]of Object.entries(e))i==null||i===!1||(typeof i=="function"?r.addEventListener(o.replace(/^on/,"").toLowerCase(),i):o==="className"?r.className=String(i):r.setAttribute(o,i===!0?"":String(i)));for(let o of t.flat())o==null||o===!1||r.append(o);return r}function te(n){let e=document.createElement("span");return e.className="nova-icon",e.innerHTML=n,e}function ke(n="nova"){return ba+=1,`${n}-${ba}`}function Ge(n){let e=n.split("-"),t=e.pop(),r=t.length===1?t.toUpperCase():t;if(am){let i={Mod:"\u2318",Shift:"\u21E7",Alt:"\u2325",Ctrl:"\u2303"};return e.map(s=>i[s]??s).join("")+r}let o={Mod:"Ctrl",Shift:"Shift",Alt:"Alt",Ctrl:"Ctrl"};return[...e.map(i=>o[i]??i),r].join("+")}var ba,am,wi,X=O(()=>{"use strict";ba=0;am=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);wi='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'});var D,M,Me=O(()=>{"use strict";D=n=>`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n}</svg>`,M={undo:D('<path d="M9 14 4 9l5-5"/><path d="M4 9h11a5 5 0 0 1 0 10h-3"/>'),redo:D('<path d="m15 14 5-5-5-5"/><path d="M20 9H9a5 5 0 0 0 0 10h3"/>'),bold:D('<path d="M7 5h6a3.5 3.5 0 0 1 0 7H7z"/><path d="M7 12h7a3.5 3.5 0 0 1 0 7H7z"/>'),italic:D('<path d="M14 5h-4M14 19h-4M14 5l-4 14"/>'),underline:D('<path d="M7 4v6a5 5 0 0 0 10 0V4"/><path d="M5 20h14"/>'),strike:D('<path d="M4 12h16"/><path d="M16 7a4 3 0 0 0-4-2c-2.5 0-4 1.3-4 3"/><path d="M8 17a4 3 0 0 0 4 2c2.5 0 4-1.3 4-3"/>'),code:D('<path d="m9 8-4 4 4 4"/><path d="m15 8 4 4-4 4"/>'),subscript:D('<path d="m4 6 8 9M12 6l-8 9"/><path d="M20 20h-4c0-1.5 4-2 4-4a1.5 1.5 0 0 0-3-.5"/>'),superscript:D('<path d="m4 9 8 9M12 9l-8 9"/><path d="M20 10h-4c0-1.5 4-2 4-4a1.5 1.5 0 0 0-3-.5"/>'),bulletList:D('<circle cx="5" cy="7" r="1"/><circle cx="5" cy="12" r="1"/><circle cx="5" cy="17" r="1"/><path d="M9 7h11M9 12h11M9 17h11"/>'),orderedList:D('<path d="M4 5h1v4M4 9h2"/><path d="M4 14h2l-2 3h2"/><path d="M10 7h10M10 12h10M10 17h10"/>'),indent:D('<path d="M4 6h16M10 12h10M4 18h16"/><path d="m4 10 3 2-3 2"/>'),outdent:D('<path d="M4 6h16M10 12h10M4 18h16"/><path d="m7 10-3 2 3 2"/>'),blockquote:D('<path d="M6 17c-1.5 0-2.5-1-2.5-3 0-3 2-6 5-7"/><path d="M15 17c-1.5 0-2.5-1-2.5-3 0-3 2-6 5-7"/><circle cx="6" cy="14" r="2.5"/><circle cx="15" cy="14" r="2.5"/>'),codeBlock:D('<rect x="3" y="4" width="18" height="16" rx="2"/><path d="m9 10-2 2 2 2M15 10l2 2-2 2"/>'),alignLeft:D('<path d="M4 6h16M4 10h10M4 14h16M4 18h10"/>'),alignCenter:D('<path d="M4 6h16M7 10h10M4 14h16M7 18h10"/>'),alignRight:D('<path d="M4 6h16M10 10h10M4 14h16M10 18h10"/>'),alignJustify:D('<path d="M4 6h16M4 10h16M4 14h16M4 18h16"/>'),horizontalRule:D('<path d="M4 12h16"/><path d="M8 7h8M8 17h8" opacity=".4"/>'),link:D('<path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/>'),unlink:D('<path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/><path d="M3 3l18 18"/>'),image:D('<rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="9" cy="10" r="2"/><path d="m21 16-5-5-9 9"/>'),clearFormatting:D('<path d="M6 5h12M12 5l-3 14"/><path d="m15 15 5 5M20 15l-5 5"/>'),formatMore:D('<path d="M3 7h10M8 7v12"/><path d="M21 11h-4c0-1.5 4-2 4-4a1.5 1.5 0 0 0-3-.5"/>'),imageLeft:D('<rect x="3" y="5" width="8" height="8" rx="1"/><path d="M14 6h7M14 10h7M3 17h18M3 20h12"/>'),imageCenter:D('<rect x="7" y="4" width="10" height="9" rx="1"/><path d="M3 17h18M6 20h12"/>'),imageRight:D('<rect x="13" y="5" width="8" height="8" rx="1"/><path d="M3 6h7M3 10h7M3 17h18M9 20h12"/>'),resize:D('<path d="M15 3h6v6M9 21H3v-6"/><path d="m21 3-7 7M3 21l7-7"/>'),altText:D('<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M7 15l2.5-6 2.5 6M7.8 13h3.4M15 9v6h3"/>'),trash:D('<path d="M4 7h16M10 11v6M14 11v6"/><path d="M6 7l1 13h10l1-13M9 7V4h6v3"/>'),paragraph:D('<path d="M13 4v16M17 4v16M19 4H9.5a4.5 4.5 0 0 0 0 9H13"/>'),h1:D('<path d="M4 6v12M12 6v12M4 12h8"/><path d="m16 9 3-2v11"/>'),h2:D('<path d="M4 6v12M12 6v12M4 12h8"/><path d="M16 9.5a2.5 2.5 0 1 1 5 .5c0 1.5-5 4-5 8h5"/>'),h3:D('<path d="M4 6v12M12 6v12M4 12h8"/><path d="M16 7.5h4.5l-2.5 3.5a3 3 0 1 1-2.5 5"/>'),pasteText:D('<rect x="5" y="4" width="14" height="17" rx="2"/><path d="M9 4V3h6v1M9 10h6M12 10v7"/>'),table:D('<rect x="3" y="4" width="18" height="16" rx="1.5"/><path d="M3 10h18M3 15h18M9 4v16M15 4v16"/>'),rowBefore:D('<rect x="3" y="12" width="18" height="8" rx="1"/><path d="M12 3v6M9 6h6"/>'),rowAfter:D('<rect x="3" y="4" width="18" height="8" rx="1"/><path d="M12 15v6M9 18h6"/>'),rowDelete:D('<rect x="3" y="8" width="18" height="8" rx="1"/><path d="m10 10 4 4M14 10l-4 4"/>'),colBefore:D('<rect x="12" y="3" width="8" height="18" rx="1"/><path d="M3 12h6M6 9v6"/>'),colAfter:D('<rect x="4" y="3" width="8" height="18" rx="1"/><path d="M15 12h6M18 9v6"/>'),colDelete:D('<rect x="8" y="3" width="8" height="18" rx="1"/><path d="m10 10 4 4M14 10l-4 4"/>'),merge:D('<rect x="3" y="5" width="18" height="14" rx="1"/><path d="M6 12h4M14 12h4M8 10l2 2-2 2M16 10l-2 2 2 2"/>'),split:D('<rect x="3" y="5" width="18" height="14" rx="1"/><path d="M12 5v14M5 12h4M15 12h4M7 10l-2 2 2 2M17 10l2 2-2 2"/>'),rowHeader:D('<rect x="3" y="4" width="18" height="16" rx="1.5"/><path d="M3 9.5h18"/><path d="M4 5h16v4H4z" fill="currentColor" opacity=".35" stroke="none"/>'),colHeader:D('<rect x="3" y="4" width="18" height="16" rx="1.5"/><path d="M9.5 4v16"/><path d="M4 5h5v14H4z" fill="currentColor" opacity=".35" stroke="none"/>'),sort:D('<path d="M7 4v16M4 17l3 3 3-3"/><path d="M14 6h7M14 11h5M14 16h3"/>'),tableProps:D('<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 10h18M9 10v10"/><path d="M15 15h3"/>'),cellProps:D('<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 10h18M9 4v16"/><rect x="11" y="12" width="8" height="6" rx="1"/>'),tableDelete:D('<rect x="3" y="4" width="13" height="12" rx="1"/><path d="M3 10h13M9.5 4v12"/><path d="m17 15 4 4M21 15l-4 4"/>'),chevronUp:D('<path d="m7 14 5-5 5 5"/>'),search:D('<circle cx="11" cy="11" r="6.5"/><path d="m20 20-4.2-4.2"/>'),fullscreen:D('<path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/>'),fullscreenExit:D('<path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/>'),preview:D('<path d="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/>'),sourceCode:D('<path d="m8 7-5 5 5 5M16 7l5 5-5 5M14 4l-4 16"/>'),help:D('<circle cx="12" cy="12" r="9"/><path d="M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6v.6"/><circle cx="12" cy="17" r=".6" fill="currentColor"/>'),print:D('<path d="M7 9V3h10v6"/><rect x="3" y="9" width="18" height="8" rx="2"/><path d="M7 14h10v7H7z"/>'),check:D('<path d="m5 12 5 5 9-10"/>'),close:D('<path d="M6 6l12 12M18 6 6 18"/>'),chevronDown:D('<path d="m7 10 5 5 5-5"/>'),more:D('<circle cx="5" cy="12" r="1.2" fill="currentColor"/><circle cx="12" cy="12" r="1.2" fill="currentColor"/><circle cx="19" cy="12" r="1.2" fill="currentColor"/>'),textColor:D('<path d="m6 16 6-12 6 12"/><path d="M8.5 11h7"/>'),highlight:D('<path d="m14 4 6 6-8 8H6v-6z"/><path d="m11 7 6 6"/>'),lineHeight:D('<path d="M11 6h10M11 12h10M11 18h10"/><path d="m3 8 3-3 3 3M3 16l3 3 3-3M6 5v14"/>'),upload:D('<path d="M12 16V4"/><path d="m7 9 5-5 5 5"/><path d="M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3"/>'),externalLink:D('<path d="M14 4h6v6"/><path d="M20 4 10 14"/><path d="M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/>'),copy:D('<rect x="8" y="8" width="12" height="12" rx="2"/><path d="M16 8V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h3"/>'),edit:D('<path d="M4 20h4L19 9l-4-4L4 16z"/><path d="m13 7 4 4"/>')}});function ya(n){let e=ke("nova-dialog-title"),t=v("p",{className:"nova-dialog-error",role:"alert",hidden:!0}),r=v("button",{type:"submit",className:"nova-button nova-button-primary",hidden:!n.submitLabel},n.submitLabel??""),o=v("button",{type:"button",className:"nova-button"},n.cancelLabel),i=v("button",{type:"button",className:"nova-btn nova-dialog-close","aria-label":n.closeLabel},te(M.close)),s=v("form",{className:n.size==="large"?"nova-dialog nova-dialog-large":"nova-dialog",role:"dialog","aria-modal":"true","aria-labelledby":e,novalidate:!0},v("header",{className:"nova-dialog-header"},v("h2",{id:e},n.title),i),v("div",{className:"nova-dialog-body"},n.body,t),v("footer",{className:"nova-dialog-footer"},o,r)),l=v("div",{className:"nova-dialog-backdrop"},s);n.host.append(l);let a=!1,c=()=>{a||(a=!0,l.remove(),document.removeEventListener("focusin",f,!0),n.onClose?.(),n.returnFocus?.())},u=h=>{t.hidden=!h,t.textContent=h??""},d=h=>{r.disabled=h,s.setAttribute("aria-busy",String(h))};s.addEventListener("submit",async h=>{h.preventDefault(),u(null),d(!0);try{let m=n.onSubmit?await n.onSubmit():!0;typeof m=="string"?u(m):m!==!1&&c()}finally{a||d(!1)}}),o.addEventListener("click",c),i.addEventListener("click",c),l.addEventListener("mousedown",h=>{h.target===l&&c()}),s.addEventListener("keydown",h=>{if(h.key==="Escape")h.preventDefault(),h.stopPropagation(),c();else if(h.key==="Tab"){let m=[...s.querySelectorAll(wi)].filter(y=>!y.hidden),b=m[0],g=m[m.length-1];if(!b||!g)return;h.shiftKey&&document.activeElement===b?(h.preventDefault(),g.focus()):!h.shiftKey&&document.activeElement===g&&(h.preventDefault(),b.focus())}});let f=h=>{s.contains(h.target)||(s.querySelector(wi)??s).focus()};return document.addEventListener("focusin",f,!0),(n.initialFocus??s.querySelector(".nova-dialog-body input, .nova-dialog-body textarea")??(n.submitLabel?r:o)).focus(),{el:s,close:c,setError:u,setBusy:d}}function ae(n){let e=ke("nova-field"),t=n.hint?`${e}-hint`:void 0,r=v("input",{id:e,type:n.type??"text",className:"nova-input",value:n.value??"",placeholder:n.placeholder,required:n.required??!1,autocomplete:n.autocomplete??"off",spellcheck:"false","aria-describedby":t});return r.value=n.value??"",{el:v("div",{className:"nova-field"},v("label",{for:e,className:"nova-label"},n.label),r,n.hint?v("p",{id:t,className:"nova-hint"},n.hint):null),input:r}}function va(n,e=!1){let t=ke("nova-check"),r=v("input",{id:t,type:"checkbox",className:"nova-checkbox"});return r.checked=e,{el:v("div",{className:"nova-field nova-field-inline"},r,v("label",{for:t},n)),input:r}}function Wr(n){let e=ke("nova-field"),t=v("select",{id:e,className:"nova-input nova-select"},...n.options.map(o=>v("option",{value:o.value},o.label)));return t.value=n.value,{el:v("div",{className:"nova-field"},v("label",{for:e,className:"nova-label"},n.label),t),select:t}}var kt=O(()=>{"use strict";X();Me()});function W(n,e){let t=(n.options.language??"en").toLowerCase();return e[t]??e[t.split("-")[0]]??e.en}function mn(n,e){let{state:t,dispatch:r}=n.view;r(t.tr.insertText(e).scrollIntoView()),n.focus()}function Ur(n){let e=v("input",{type:"search",className:"nova-input nova-symbols-search",placeholder:n.searchLabel,"aria-label":n.searchLabel}),t=v("div",{className:"nova-symbols-list"}),r=v("div",{className:`nova-symbols ${n.className}`},e,t),o=i=>{let s=i.trim().toLowerCase(),l=n.groups.map(a=>({title:a.title,items:s?a.items.filter(([c,u])=>u.includes(s)||c===s):a.items})).filter(a=>a.items.length);if(!l.length){t.replaceChildren(v("div",{className:"nova-symbols-empty"},n.emptyText));return}t.replaceChildren(...l.map(a=>v("div",{className:"nova-symbols-group",role:"group","aria-label":a.title},v("div",{className:"nova-symbols-title"},a.title),v("div",{className:"nova-symbols-grid"},...a.items.map(([c,u])=>v("button",{type:"button",className:"nova-symbols-cell",title:u,"aria-label":u,onclick:()=>n.onPick(c)},c))))))};return e.addEventListener("input",()=>o(e.value)),e.addEventListener("keydown",i=>{i.key==="ArrowDown"?(i.preventDefault(),t.querySelector(".nova-symbols-cell")?.focus()):i.key==="Enter"&&(i.preventDefault(),t.querySelector(".nova-symbols-cell")?.click())}),t.addEventListener("keydown",i=>{let s=[...t.querySelectorAll(".nova-symbols-cell")],l=s.indexOf(document.activeElement);if(l<0)return;let a=Math.max(1,s.filter(d=>d.offsetTop===s[0].offsetTop).length),c={ArrowRight:1,ArrowLeft:-1,ArrowDown:a,ArrowUp:-a};if(!(i.key in c))return;i.preventDefault();let u=l+c[i.key];u<0?e.focus():s[Math.min(s.length-1,u)]?.focus()}),o(""),queueMicrotask(()=>e.focus()),r}function jr(n,e,t){let r=null,o=t(()=>r?.close());r=n.ui.openDialog({title:e,body:o,cancelLabel:n.ui.t("dialog.close")})}var Se=O(()=>{"use strict";X()});function vn(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e}function it(n,e,t){let r=Ci||(Ci=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r}function um(){Ci=null}function Jr(n,e,t,r){return t&&(Ma(n,e,t,r,-1)||Ma(n,e,t,r,1))}function Ma(n,e,t,r,o){for(var i;;){if(n==t&&e==r)return!0;if(e==(o<0?0:ve(n))){let s=n.parentNode;if(!s||!z(s)||Gr(n)||ka.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ce(n)+(o<0?0:1),n=s}else if(z(n)){let s=n.childNodes[e+(o<0?-1:0)];if(z(s)&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=o;else return!1;else{if(Gr(s)||ka.test(s.nodeName))return!1;n=s,e=o<0?ve(n):0}}else return!1}}function ve(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function z(n){return n.nodeType==1}function he(n){return n.nodeType==3}function wn(n,e){return e?n.contains(z(e)?e:e.parentNode):!1}function tc(n,e){for(;;){if(he(n)&&e)return n;if(z(n)&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=ve(n)}else if(n.parentNode&&!Gr(n,!0))e=Ce(n),n=n.parentNode;else return null}}function nc(n,e){for(;;){if(he(n)&&e<n.nodeValue.length)return n;if(z(n)&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Gr(n,!0))e=Ce(n)+1,n=n.parentNode;else return null}}function dm(n,e,t){for(let r=e==0,o=e==ve(n);r||o;){if(n==t)return!0;let i=Ce(n);if(n=n.parentNode,!n)return!1;r=r&&i==0,o=o&&i==ve(n)}}function Gr(n,e=!1){let t;for(let r=n;r&&!(t=r.pmViewDesc);r=r.parentNode);return t&&t.node&&(!e||t.node.isBlock)&&(t.dom==n||t.contentDOM==n)}function oo(n){return n.focusNode&&Jr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)}function rc(n,e){n.collapse(e.anchorNode,e.anchorOffset),(e.focusNode!=e.anchorNode||e.focusOffset!=e.anchorOffset)&&n.extend(e.focusNode,e.focusOffset)}function fm(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function pm(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function hm(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(ve(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(ve(r.startContainer),r.startOffset)}}}function gm(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function ot(n,e){return typeof n=="number"?n:n[e]}function bm(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Ca(n,e,t){if(!Ai(e)&&e.left==0)return;let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(!z(s)){s=vn(s);continue}let l=s==i.body,a=l?gm(i):bm(s),c=0,u=0;if(e.top<a.top+ot(r,"top")?u=-(a.top-e.top+ot(o,"top")):e.bottom>a.bottom-ot(r,"bottom")&&(u=e.bottom-e.top>a.bottom-a.top?e.top+ot(o,"top")-a.top:e.bottom-a.bottom+ot(o,"bottom")),e.left<a.left+ot(r,"left")?c=-(a.left-e.left+ot(o,"left")):e.right>a.right-ot(r,"right")&&(c=e.right-a.right+ot(o,"right")),c||u)if(l)i.defaultView.scrollBy(c,u);else{let f=s.scrollLeft,p=s.scrollTop;u&&(s.scrollTop+=u),c&&(s.scrollLeft+=c);let h=s.scrollLeft-f,m=s.scrollTop-p;e={left:e.left-h,top:e.top-m,right:e.right-h,bottom:e.bottom-m}}let d=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s=d=="absolute"?s.offsetParent:vn(s)}}function ym(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(i,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:sc(n.dom)}}function sc(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=vn(r));return e}function vm({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;lc(t,r==0?0:r-e)}function lc(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:o,left:i}=n[t];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}function ac(n){if(n.setActive)return n.setActive();if(gn)return n.focus(gn);let e=sc(n);n.focus(gn==null?{get preventScroll(){return gn={preventScroll:!0},!0}}:void 0),gn||(gn=!1,lc(e,0))}function cc(n,e){let t,r=2e8,o,i=0,s=e.top,l=e.top,a,c;for(let u=n.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(z(u))f=u.getClientRects();else if(he(u))f=it(u).getClientRects();else continue;for(let p=0;p<f.length;p++){let h=f[p];if(h.top<=s&&h.bottom>=l){s=Math.max(h.bottom,s),l=Math.min(h.top,l);let m=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(m<r){t=u,r=m,o=m&&he(t)?{left:h.right<e.left?h.right:h.left,top:e.top}:e,z(u)&&m&&(i=d+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!a&&h.left<=e.left&&h.right>=e.left&&(a=u,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!t&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(i=d+1)}}return!t&&a&&(t=a,o=c,r=0),t&&he(t)?wm(t,o):!t||r?{node:n,offset:i}:cc(t,o)}function wm(n,e){let t=n.nodeValue.length,r=document.createRange(),o;for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let s=Mt(r,1);if(s.top!=s.bottom&&_i(e,s)){o={node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),o||{node:n,offset:0}}function _i(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function xm(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function km(n,e,t){let{node:r,offset:o}=cc(e,t),i=-1;if(z(r)&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,o,i)}function Mm(n,e,t,r){let o=-1;for(let i=e,s=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!0),a;if(!l)return null;if(z(l.dom)&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),s=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function uc(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),i=o;;){let s=n.childNodes[i];if(z(s)){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(_i(e,c))return uc(s,e,c)}}if((i=(i+1)%r)==o)break}return n}function Sm(n,e){let t=n.dom.ownerDocument,r,o=0,i=hm(t,e.left,e.top);i&&({node:r,offset:o}=i);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s)){let c=n.dom.getBoundingClientRect();if(!_i(e,c)||(s=uc(n.dom,e,c),!s))return null}if(Ae)for(let c=s;r&&c;c=vn(c))c.draggable&&(r=void 0);if(s=xm(s,e),r){if(Ue&&z(r)&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;io&&o&&z(r)&&z(c=r.childNodes[o-1])&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&z(r.lastChild)&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(o==0||!z(r)||r.childNodes[o-1].nodeName!="BR")&&(l=Mm(n,r,o,e))}l==null&&(l=km(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Ai(n){return n.top<n.bottom||n.left<n.right}function Mt(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Ai(r))return r}return Array.prototype.find.call(t,Ai)||n.getBoundingClientRect()}function dc(n,e,t){let{node:r,offset:o,atom:i}=n.docView.domFromPos(e,t<0?-1:1),s=io||Ue;if(he(r))if(s&&(Cm.test(r.nodeValue)||(t<0?!o:o==r.nodeValue.length))){let a=Mt(it(r,o,o),t);if(Ue&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Mt(it(r,o-1,o-1),-1);if(c.top==a.top){let u=Mt(it(r,o,o+1),-1);if(u.top!=a.top)return Yn(u,u.left<c.left)}}return a}else{let a=o,c=o,u=t<0?1:-1;return t<0&&!o?(c++,u=-1):t>=0&&o==r.nodeValue.length?(a--,u=1):t<0?a--:c++,Yn(Mt(it(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(t<0||o==ve(r))){let a=r.childNodes[o-1];if(z(a))return xi(a.getBoundingClientRect(),!1)}if(i==null&&o<ve(r)){let a=r.childNodes[o];if(z(a))return xi(a.getBoundingClientRect(),!0)}return xi(r.getBoundingClientRect(),t>=0)}if(i==null&&o&&(t<0||o==ve(r))){let a=r.childNodes[o-1],c=he(a)?it(a,ve(a)-(s?0:1)):z(a)&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Yn(Mt(c,1),!1)}if(i==null&&o<ve(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?he(a)?it(a,0,s?0:1):z(a)?a:null:null;if(c)return Yn(Mt(c,-1),!0)}return Yn(Mt(he(r)?it(r):r,-t),t>=0)}function Yn(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function xi(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function fc(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function Em(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return fc(n,e,()=>{let{node:i}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=dc(n,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(z(l))a=l.getClientRects();else if(he(l))a=it(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(t=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}function Tm(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=n.domSelection();return l?!Am.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:s:fc(n,e,()=>{let a=n.domSel.readRange(),c=l.caretBidiLevel;l.modify("move",t,"character");let u=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:d,focusOffset:f}=n.domSel.readRange(),p=d&&!wn(u,d)||a.focusNode==d&&a.focusOffset==f;return rc(l,a),c!=null&&(l.caretBidiLevel=c),p}):r.pos==r.start()||r.pos==r.end()}function Nm(n,e,t){return Ea==e&&Aa==t?Ta:(Ea=e,Aa=t,Ta=t=="up"||t=="down"?Em(n,e,t):Tm(n,e,t))}function Na(n,e,t,r,o,i){i?Vi(r,r,nr(i,n,!1),nr(e,n,!1)):hc(r,e,n);let s=new At(void 0,n,e,t,r,r,r);return s.contentDOM&&s.updateChildren(o,0),s}function pc(n,e,t){let r=n.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==n){for(;l!=r;)r=Oa(r),o=!0;r=r.nextSibling}else o=!0,n.insertBefore(l,r);if(s instanceof Vt){let a=r?r.previousSibling:n.lastChild;pc(s.contentDOM,s.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=Oa(r),o=!0;o&&t.trackWrites==n&&(t.trackWrites=null)}function nr(n,e,t){if(n.length==0)return _t;let r=t?_t[0]:new Zn,o=[r];for(let i=0;i<n.length;i++){let s=n[i].type.attrs;if(s){s.nodeName&&o.push(r=new Zn(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&o.length==1&&o.push(r=new Zn(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return o}function Vi(n,e,t,r){if(t==_t&&r==_t)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],l=t[i];if(i){let a;l&&l.nodeName==s.nodeName&&o!=n&&(a=o.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=_t[0]),o=a}Om(o,l||_t[0],s)}return o}function Om(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&n.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&n.classList.add(o[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)n.style.removeProperty(o[1])}t.style&&(n.style.cssText+=t.style)}}function hc(n,e,t){return Vi(n,n,_t,nr(e,t,!z(n)))}function Zr(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Oa(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}function Lm(n,e){let t=e,r=t.children.length,o=[],i=n.childCount,s=new Map,l=[];e:for(;i>0;){let a;for(;;)if(r){let u=t.children[r-1];if(u instanceof Vt)o.push(r-1),t=u,r=u.children.length;else{a=u,r--;break}}else{if(t==e)break e;r=o.pop(),t=t.parent}let c=a.node;if(c){if(c!=n.child(i-1))break;--i,s.set(a,i),l.push(a)}}return{index:i,matched:s,matches:l.reverse()}}function Dm(n,e){return n.type.side-e.type.side}function Rm(n,e,t,r){let o=e.locals(n),i=0;if(o.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);r(u,o,e.forChild(i,u),c),i+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let b=o[s++];b.widget&&(u?(d||(d=[u])).push(b):u=b)}if(u)if(d){d.sort(Dm);for(let b=0;b<d.length;b++)t(d[b],c,!!a)}else t(u,c,!!a);let f,p;if(a)p=-1,f=a,a=null;else if(c<n.childCount)p=c,f=n.child(c++);else break;for(let b=0;b<l.length;b++)l[b].to<=i&&l.splice(b--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let h=i+f.nodeSize;if(f.isText){let b=h;s<o.length&&o[s].from<b&&(b=o[s].from);for(let g=0;g<l.length;g++)l[g].to<b&&(b=l[g].to);b<h&&(a=f.cut(b-i),f=f.cut(0,b-i),h=b,p=-1)}else for(;s<o.length&&o[s].to<h;)s++;let m=f.isInline&&!f.isLeaf?l.filter(b=>!b.inline):l.slice();r(f,m,e.forChild(i,f),p),i=h}}function Im(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Pm(n,e,t,r){for(let o=0,i=0;o<n.childCount&&i<=r;){let s=n.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<n.childCount;){let c=n.child(o++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=t){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Oi(n,e,t,r,o){let i=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],c=l,u=l+=a.size;c>=t||u<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),o&&(i.push(o),o=void 0),u>t&&i.push(a.slice(t-c,a.size,r)))}return i}function Li(n,e){let{$anchor:t,$head:r}=n.selection,o=e>0?t.max(r):t.min(r),i=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return i&&B.findFrom(i,e)}function St(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function La(n,e,t){let r=n.state.selection;if(r instanceof P)if(t.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return St(n,new P(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=Li(n.state,e);return o&&o instanceof R?St(n,o):!1}else if(!_e||t.indexOf("m")<0){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?R.isSelectable(i)?St(n,new R(e<0?n.state.doc.resolve(o.pos-i.nodeSize):o)):St(n,new P(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1}}else return!1;else{if(r instanceof R&&r.node.isInline)return St(n,new P(e>0?r.$to:r.$from));{let o=Li(n.state,e);return o?St(n,o):!1}}}function er(n,e){let t=n.pmViewDesc;return t?t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR"):z(n)&&n.contentEditable=="false"}function bn(n,e){return e<0?Bm(n):zm(n)}function Bm(n){let e=n.domSel.readRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o,i,s=!1;for(Ue&&z(t)&&r<ve(t)&&er(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(!z(t))break;let l=t.childNodes[r-1];if(er(l,-1))o=t,i=--r;else if(he(l))t=l,r=t.nodeValue.length;else break}else{if(mc(t))break;{let l=t.previousSibling;for(;l&&er(l,-1);)o=t.parentNode,i=Ce(l),l=l.previousSibling;if(l)t=l,r=ve(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?Di(n,t,r):o&&Di(n,o,i)}function zm(n){let e=n.domSel.readRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o=ve(t),i,s;for(;;)if(r<o){if(!z(t))break;let l=t.childNodes[r];if(er(l,1))i=t,s=++r;else break}else{if(mc(t))break;{let l=t.nextSibling;for(;l&&er(l,1);)i=l.parentNode,s=Ce(l)+1,l=l.nextSibling;if(l)t=l,r=0,o=ve(t);else{if(t=t.parentNode,t==n.dom)break;r=o=0}}}i&&Di(n,i,s)}function mc(n){for(let e=n;e;e=e.parentNode){let t=e.pmViewDesc;if(t)return t.node?t.node.isBlock:!1}return!1}function Di(n,e,t){if(!he(e)){let s,l;(l=nc(e,t))?(e=l,t=0):(s=tc(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection(),o=n.domSel.readRange();if(!r)return;oo(o)?r.collapse(e,t):r.extend&&(r.collapse(o.anchorNode,o.anchorOffset),r.extend(e,t)),n.domSel.ignore();let{state:i}=n;setTimeout(()=>{n.state==i&&n.domSel.sync()},50)}function Da(n,e){let t=n.state.doc.resolve(e);if(!(Ee||ic)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}let r=n.dom;for(let i=t.depth;i>0;i--)if(t.node(i).isBlock){r=n.nodeDOM(t.before(i))||r;break}return getComputedStyle(r).direction=="rtl"?"rtl":"ltr"}function Ra(n,e,t){let r=n.state.selection;if(r instanceof P&&!r.empty||t.indexOf("s")>-1||_e&&t.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Li(n.state,e);if(s&&s instanceof R)return St(n,s)}if(!o.parent.inlineContent){let s=e<0?o:i,l=r instanceof pe?B.near(s,e):B.findFrom(s,e);return l?St(n,l):!1}return!1}function Ia(n,e){if(!(n.state.selection instanceof P))return!0;let{$head:t,$anchor:r,empty:o}=n.state.selection;if(!t.sameParent(r))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function Pa(n,e,t){n.domObserver.stopped(()=>e.contentEditable=t)}function Hm(n){if(!Ae||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSel.readRange();if(e&&z(e)&&t==0&&e.firstChild&&z(e.firstChild)&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Pa(n,r,"true"),setTimeout(()=>Pa(n,r,"false"),20)}return!1}function Fm(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function $m(n,e){let t=e.keyCode,r=Fm(e);if(t==8||_e&&t==72&&r=="c")return Ia(n,-1)||bn(n,-1);if(t==46&&!e.shiftKey||_e&&t==68&&r=="c")return Ia(n,1)||bn(n,1);if(t==13||t==27)return!0;if(t==37||_e&&t==66&&r=="c"){let o=t==37?Da(n,n.state.selection.from)=="ltr"?-1:1:-1;return La(n,o,r)||bn(n,o)}else if(t==39||_e&&t==70&&r=="c"){let o=t==39?Da(n,n.state.selection.from)=="ltr"?1:-1:1;return La(n,o,r)||bn(n,o)}else{if(t==38||_e&&t==80&&r=="c")return Ra(n,-1,r)||bn(n,-1);if(t==40||_e&&t==78&&r=="c")return Hm(n)||Ra(n,1,r)||bn(n,1);if(r==(_e?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function qi(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=n.someProp("clipboardSerializer")||We.fromSchema(n.state.schema),l=xc(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&z(c)&&(u=wc[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let h=l.createElement(u[p]);for(;a.firstChild;)h.appendChild(a.firstChild);a.appendChild(h),d++}c=a.firstChild}c&&z(c)&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
6
+
7
+ `);return{dom:a,text:f,slice:e}}function gc(n,e,t,r,o){let i=o.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=!!e&&(r||i||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,i||r,n)}),i)return l=new N(E.from(n.state.schema.text(e.replace(/\r\n?/g,`
8
+ `))),0,0),n.someProp("transformPasted",f=>{l=f(l,n,!0)}),l;let d=n.someProp("clipboardTextParser",f=>f(e,o,r,n));if(d)l=d;else{let f=o.marks(),{schema:p}=n.state,h=We.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let b=s.appendChild(document.createElement("p"));m&&b.appendChild(h.serializeNode(p.text(m,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),s=Wm(t),io&&Um(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&!z(f);)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||yt.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!_m.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=jm(Ba(l,+u[1],+u[2]),u[4]);else if(l=N.maxOpen(Vm(l.content,o),!0),l.openStart||l.openEnd){let d=0,f=0;for(let p=l.content.firstChild;d<l.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=l.content.lastChild;f<l.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);l=Ba(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n,r)}),l}function Vm(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),i,s=[];if(n.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&i.length&&yc(a,i,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=vc(s[s.length-1],i.length));let u=bc(l,a);s.push(u),o=o.matchType(u.type),i=a}}),s)return E.from(s)}return n}function bc(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,E.from(n));return n}function yc(n,e,t,r,o){if(o<n.length&&o<e.length&&n[o]==e[o]){let i=yc(n,e,t,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==n.length-1?t.type:n[o+1]))return r.copy(r.content.append(E.from(bc(t,n,o+1))))}}function vc(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,vc(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(E.empty,!0);return n.copy(t.append(r))}function Ri(n,e,t,r,o,i){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(i=0),o<r-1&&(l=Ri(l,e,t,r,o+1,i)),o>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(E.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function Ba(n,e,t){return e<n.openStart&&(n=new N(Ri(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new N(Ri(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}function xc(){return document.implementation.createHTMLDocument("title")}function qm(n){let e=window.trustedTypes;if(!e)return n;if(!Qn){if(Qn=e.defaultPolicy)try{return Qn.createHTML(n)}catch{}Qn=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})}return Qn.createHTML(n)}function Wm(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=xc(),r=t.body,o=/<([a-z][^>\s]+)/i.exec(n),i;if((i=o&&wc[o[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),r.innerHTML=qm(n),i)for(let s=0;s<i.length;s++)r=r.querySelector(i[s])||r;for(let s=0;s<t.styleSheets.length;s++){let l=t.styleSheets[s];for(let a=0;a<l.rules.length;a++){let c=l.rules[a];if(c instanceof CSSStyleRule){let u=r.querySelectorAll(c.selectorText);for(let d=0;d<u.length;d++)u[d].style.cssText+=c.style.cssText}}}return r}function Um(n){let e=n.querySelectorAll(Ee?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent=="\xA0"&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function jm(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:o,openStart:i,openEnd:s}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs()||!a.createAndFill(null,o))break;try{o=E.from(a.create(r[l+1],o))}catch{break}i++,s++}return new N(o,i,s)}function Km(n,e){if(e.getComposedRanges){let o=e.getComposedRanges(n.root)[0];if(o)return za(n,o)}let t;function r(o){o.preventDefault(),o.stopImmediatePropagation(),t=o.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?za(n,t):null}function za(n,e){let t=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return Jr(s.node,s.offset,o,i)&&([t,r,o,i]=[o,i,t,r]),new ze(t,r,o,i)}function Wi(n,e,t=null){let r=n.state.doc;if(!e.focusNode)return null;let o=n.docView.nearestDesc(e.focusNode),i=o&&o.size==0,s=n.docView.posFromDOM(e.focusNode,e.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(oo(e)){for(a=s;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&R.isSelectable(o.node)&&o.parent&&!(o.node.isInline&&dm(e.focusNode,e.focusOffset,o.dom))){let d=o.posBefore;c=new R(s==d?l:r.resolve(d))}else if(Ue&&t=="key"&&s>n.state.selection.to&&z(e.focusNode)&&e.focusOffset==e.focusNode.childNodes.length&&o&&o.posAtStart>n.state.selection.to)for(let d=e.focusNode;;d=d.parentNode){if(getComputedStyle(d).overflow!="visible"){c=B.findFrom(r.resolve(o.posAtStart),1);break}if(d==o.dom||d.nextSibling||!d.parentNode||!z(d.parentNode))break}}else{if(e instanceof n.dom.ownerDocument.defaultView.Selection&&e.rangeCount>1){let d=s,f=s;for(let p=0;p<e.rangeCount;p++){let h=e.getRangeAt(p);d=Math.min(d,n.docView.posFromDOM(h.startContainer,h.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(d<0)return null;[a,s]=f==n.state.selection.anchor?[f,d]:[d,f],l=r.resolve(s)}else a=n.docView.posFromDOM(e.anchorNode,e.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=t=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;c=Mn(n,u,l,d)}return c}function kc(n){return n.editable?n.hasFocus():Cc(n,n.domSel.readRange())&&(!document.activeElement||document.activeElement.contains(n.dom))}function Jm(n,e,t,r){let o=n.state.selection,{anchor:i,head:s}=o,l,a;Ha&&!(o instanceof P)&&(o.$from.parent.inlineContent||(l=Fa(n,o.from)),!o.empty&&!o.$from.parent.inlineContent&&(a=Fa(n,o.to)));let c=t.domFromPos(i-r,i>r?-1:1),u=s==i?c:t.domFromPos(s-r,s>r?-1:1);Gm(i,s,c,u,n,e),Ha&&(l&&$a(l),a&&$a(a))}function Mc(n,e,t,r=0){for(let o=0,i=r;o<n.children.length;o++){let s=n.children[o],l=i+s.size;if(e>i&&t<l)return Mc(s,e,t,i+s.border);i=l}return{desc:n,start:r}}function Gm(n,e,t,r,o,i){let s=!1;if((Ue||Ae)&&n==e){let{node:a,offset:c}=t;if(he(a)){if(s=!!(c&&a.nodeValue[c-1]==`
9
+ `),s&&c==a.nodeValue.length)for(let u=a,d;u;u=u.parentNode){if(d=u.nextSibling){d.nodeName=="BR"&&(t=r={node:d.parentNode,offset:Ce(d)+1});break}let f=u.pmViewDesc;if(f&&f.node&&f.node.isBlock)break}}else{let u=a.childNodes[c-1];s=u&&(u.nodeName=="BR"||u.contentEditable=="false")}}let l=o.domSel.readRange();if(Ue&&l.focusNode&&l.focusNode!=r.node&&z(l.focusNode)){let a=l.focusNode.childNodes[l.focusOffset];a&&a.contentEditable=="false"&&(i=!0)}!(i||s&&Ae)&&Jr(t.node,t.offset,l.anchorNode,l.anchorOffset)&&Jr(r.node,r.offset,l.focusNode,l.focusOffset)||rc(o.domSelection(),{focusNode:r.node,focusOffset:r.offset,anchorNode:t.node,anchorOffset:t.offset})}function Fa(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),o=r<t.childNodes.length?t.childNodes[r]:null,i=r?t.childNodes[r-1]:null;if(Ae&&o&&o.contentEditable=="false")return ki(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return ki(o);if(i)return ki(i)}}function ki(n){return n.contentEditable="true",Ae&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function $a(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Xm(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSel.readRange(),r=t.anchorNode,o=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!kc(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Ym(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom;t.nodeName=="IMG"?e.collapse(t.parentNode,Ce(t)+1):e.collapse(t,0)}function Qm(n,e){if(e instanceof R){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(_a(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else _a(n)}function _a(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Mn(n,e,t,r){let o=n.someProp("createSelectionBetween",i=>i(n,e,t))||P.between(e,t,r);return n.someProp("adjustSelectionFromDOM",i=>{o=i(n,o)}),o}function Sc(n){if(n.editable&&!n.hasFocus())return null;let e=n.domSel.readRange();return e&&Cc(n,e)?e:null}function Cc(n,e){if(!e.anchorNode)return!1;try{return wn(n.dom,e.anchorNode)&&(n.editable||wn(n.dom,e.focusNode))}catch{return!1}}function eg(n){for(let e in Te){let t=Te[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{ng(n,r)&&(n.input.composing&&(r.type=="keydown"||r.type=="beforeinput")&&r.isComposing===!1&&Tc(n,!0),!Ui(n,r)&&(n.editable||!(r.type in Ne))&&t(n,r))},Zm[e]?{passive:!0}:void 0)}Ae&&n.dom.addEventListener("input",()=>null),Bi(n)}function so(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function tg(n){n.input.mouseDown&&n.input.mouseDown.done(),n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Bi(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Ui(n,r))})}function Ui(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function ng(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function rg(n,e){!Ui(n,e)&&Te[e.type]&&(n.editable||!(e.type in Ne))&&Te[e.type](n,e)}function Ct(n,e){let{input:t}=n;return t.lastKeyDispatched||n.composing?!1:(t.lastKeyDispatched=!0,typeof e=="string"&&(e=fm(e=="Backspace"?8:13,e)),n.someProp("handleKeyDown",r=>r(n,e)))}function rr(n){return{left:n.clientX,top:n.clientY}}function og(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function ji(n,e,t,r,o){if(r==-1)return!1;let i=n.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,l=>s>i.depth?l(n,t,i.nodeAfter,i.before(s),o,!0):l(n,t,i.node(s),i.before(s),o,!1)))return!0;return!1}function Ec(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function ig(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&R.isSelectable(r)?(Ec(n,new R(t)),!0):!1}function sg(n,e){if(e==-1)return!1;let t=n.state.selection,r,o;t instanceof R&&(r=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(R.isSelectable(l)){r&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?o=i.before(t.$from.depth):o=i.before(s);break}}return o!=null?(Ec(n,R.create(n.state.doc,o)),!0):!1}function lg(n,e,t,r,o){return ji(n,"handleClickOn",e,t,r)||n.someProp("handleClick",i=>i(n,e,r))||(o?sg(n,t):ig(n,t))}function ag(n,e,t,r){return ji(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",o=>o(n,e,r))}function cg(n,e,t,r){return ji(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",o=>o(n,e,r))}function Va(n,e,t){if(e==-1)return n.inlineContent?P.create(n,0,n.content.size):null;let r=n.resolve(e);for(let o=r.depth+1;o>0;o--){let i=o>r.depth?r.nodeAfter:r.node(o),s=r.before(o);if(i.inlineContent)return P.create(n,s+1,s+1+i.content.size);if(t&&R.isSelectable(i))return R.create(n,s)}return null}function qa(n,e){let t=n.resolve(e),r=t.node(),o="",i=e,s=e;for(let m=t.indexAfter(),b=!1;m>0;m--){let g=r.child(m-1);if(!g.text)break;let y=i==e?e-t.posAtIndex(m-1):g.text.length,x=y;for(;x>0;x--)if(/\S/.test(g.text[x-1]))b=!0;else if(b)break;if(o=g.text.slice(x,y)+o,i-=y-x,x||i<e-50)break}for(let m=t.index(),b=!1;m<r.childCount;m++){let g=r.child(m);if(!g.text)break;let y=s==e?e-t.posAtIndex(m):0,x=y;for(;x<g.text.length;x++)if(/\S/.test(g.text[x]))b=!0;else if(b)break;if(o+=g.text.slice(y,x),s+=x-y,x<g.text.length||s>e+50)break}let l=i,a=s;if(Intl.Segmenter){for(let m of new Intl.Segmenter(void 0,{granularity:"word"}).segment(o))if(m.isWordLike){let b=m.index+i,g=b+m.segment.length;if(g<e)l=g;else if(b>e){a=b;break}else return P.create(n,b,g)}}else{zi.lastIndex=0;for(let m;m=zi.exec(o);){let b=m.index+i,g=b+m[0].length;if(g<e)l=g;else if(b>e){a=b;break}else return P.create(n,b,g)}}let c=o.slice(l-i,e-i),u=o.slice(e-i,a-i),d=/\S*$/.exec(c)[0].length,f=/^\S*/.exec(u)[0].length;if(d||f)return P.create(n,e-d,e+f);let p=/\s*$/.exec(c)[0].length,h=/^\s*/.exec(u)[0].length;return P.create(n,e-p,e+h)}function Wa(n){let e=n.dom.getBoundingClientRect();return{x:e.left-n.dom.scrollLeft,y:e.top-n.dom.scrollTop}}function Ua(n,e,t){if(t.inside>-1){let o=e.nodeAt(t.inside);if(o.isAtom&&R.isSelectable(o))return R.create(e,t.inside)}let r=e.resolve(t.pos);return Mn(n,r,r)}function ug(n,e){let{selection:t}=n.state;if(t.empty)return!1;let r=n.domSelection();if(!r||r.rangeCount==0)return!0;let o=r.getRangeAt(0).getClientRects();for(let i=0;i<o.length;i++){let s=o[i];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}function dg(n,e){return n.composing?!0:Ae&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}function pg(n){let{focusNode:e,focusOffset:t}=n.domSel.range;if(!e||!z(e)||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return z(r)&&r.contentEditable=="false"}function Tc(n,e=!1){n.input.composing=!1,n.input.compositionEndedAt=Date.now(),n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,e?jt(n):Nc(n,20)}function Nc(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>jt(n),e))}function Oc(n){n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());for(let e;e=n.input.compositionNodes.pop();)e.markParentDamage()}function hg(n){let e=n.domSel.range;if(!n.domSel.active||!e.focusNode)return null;let t=tc(e.focusNode,e.focusOffset),r=nc(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let o=r.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function jt(n,e=!1){if(!(st&&n.domObserver.flushingSoon>=0)&&(n.domObserver.forceFlush(),Oc(n),e||n.docView&&n.docView.damage)){let t=Wi(n,n.domSel.readRange()),r=n.state.selection;t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state)}}function mg(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}function gg(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function bg(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?ir(n,r.value,null,o,e):ir(n,r.textContent,r.innerHTML,o,e)},50)}function ir(n,e,t,r,o){let i=gc(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,o,i||N.empty)))return!0;if(!i)return!1;let s=gg(i),l=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Lc(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}function Dc(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[yg]}function vg(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(rr(e));if(!r)return;let o=n.state.doc.resolve(r.pos),i=t&&t.slice;i?n.someProp("transformPasted",p=>{i=p(i,n,!1)}):i=gc(n,Lc(e.dataTransfer),or?null:e.dataTransfer.getData("text/html"),!1,o);let s=!!(t&&Dc(n,e));if(n.someProp("handleDrop",p=>p(n,e,i||N.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?$r(n.state.doc,o.pos,i):o.pos;l==null&&(l=o.pos);let a=n.state.tr;if(s){let{node:p}=t;p?p.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&R.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new R(f));else{let p=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((h,m,b,g)=>p=g),a.setSelection(Mn(n,f,a.doc.resolve(p)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}function sr(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}function wg(n,e,t,r,o,i,s){let l=n.slice();for(let c=0,u=i;c<t.maps.length;c++){let d=0;t.maps[c].forEach((f,p,h,m)=>{let b=m-h-(p-f);for(let g=0;g<l.length;g+=3){let y=l[g+1];if(y<0||f>y+u-d)continue;let x=l[g]+u-d;p>=x?l[g+1]=f<=x?-2:-1:f>=u&&b&&(l[g]+=b,l[g+1]+=b)}d+=b}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=t.map(n[c]+i),d=u-o;if(d<0||d>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+i,-1),p=f-o,{index:h,offset:m}=r.content.findIndex(d),b=r.maybeChild(h);if(b&&m==d&&m+b.nodeSize==p){let g=l[c+2].mapInner(t,b,u+1,n[c]+i+1,s);g!=ye?(l[c]=d,l[c+1]=p,l[c+2]=g):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=xg(l,n,e,t,o,i,s),u=ro(c,r,0,s);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let p=u.children[d];for(;f<l.length&&l[f]<p;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new K(e.sort(Et),l)}function Rc(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let o=n[r];t.push(new ee(o.from+e,o.to+e,o.type))}return t}function xg(n,e,t,r,o,i,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,o,c);d?t.push(d):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function Ic(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,o=null;for(let i=0,s;i<n.length;i++)(s=n[i])&&s.from>t&&s.to<r&&((o||(o=[])).push(s),n[i]=null);return o}function Pc(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ro(n,e,t,r){let o=[],i=!1;e.forEach((l,a)=>{let c=Ic(n,l,a+t);if(c){i=!0;let u=ro(c,l,t+a+1,r);u!=ye&&o.push(a,a+l.nodeSize,u)}});let s=Rc(i?Pc(n):n,-t).sort(Et);if(s.length){let l=new lr(e.content);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a],l)||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1))}return s.length||o.length?new K(s,o):ye}function Et(n,e){return n.from-e.from||n.to-e.to}function Ki(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let o=t+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==n&&(e=n.slice()),e[o]=i.copy(i.from,r.to),ja(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,i.from),ja(e,o,r.copy(i.from,r.to)));break}}}return e}function ja(n,e,t){for(;e<n.length&&Et(t,n[e])>0;)e++;n.splice(e,0,t)}function Mi(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=ye&&e.push(r)}),n.cursorWrapper&&e.push(K.create(n.state.doc,[n.cursorWrapper.deco])),no.from(e)}function kg(n,e,t,r){let{node:o,fromOffset:i,toOffset:s,from:l,to:a}=n.docView.parseRange(e,t),c=n.domSel.range,u,d=c.anchorNode;if(d&&wn(n.dom,d)&&(u=[{node:d,offset:c.anchorOffset}],oo(c)||u.push({node:c.focusNode,offset:c.focusOffset})),Ee&&n.input.lastKeyCode===8)for(let g=s;g>i;g--){let y=o.childNodes[g-1],x=y.pmViewDesc;if(y.nodeName=="BR"&&!x){s=g;break}if(!x||x.size)break}let f=n.state.doc,p=n.someProp("domParser")||yt.fromSchema(n.state.schema),h=f.resolve(l),m=null,b=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:Mg(r),context:h});if(u&&u[0].pos!=null){let g=u[0].pos,y=u[1]&&u[1].pos;y==null&&(y=g),m={anchor:g+l,head:y+l}}return{doc:b,sel:m,from:l,to:a}}function Cg(n,e,t,r,o,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let w=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,k=Wi(n,n.domSel.range,w);if(k&&!n.state.selection.eq(k)&&n.domSel.active){if(Ee&&st&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&Ct(n,"Enter"))return;let S=n.state.tr.setSelection(k);w=="pointer"?S.setMeta("pointer",!0):w=="key"&&S.scrollIntoView(),s&&S.setMeta("composition",s),n.dispatch(S)}return}let l=n.state.doc.resolve(e),a=l.sharedDepth(t);e=l.before(a+1),t=n.state.doc.resolve(t).after(a+1);let c=n.state.selection,u=kg(n,e,t,i),d=n.state.doc,f=d.slice(u.from,u.to),p,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(p=n.state.selection.to,h="end"):(p=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let m=Ng(f.content,u.doc.content,u.from,p,h);if(m&&n.input.domChangeCount++,(kn&&n.input.lastIOSEnter>Date.now()-225||st)&&i.some(w=>z(w)&&!Sg.test(w.nodeName))&&(!m||m.endA>=m.endB)&&Ct(n,"Enter")){n.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof P&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(u.sel){let w=Ka(n,n.state.doc,u.sel);if(w&&!w.eq(n.state.selection)){let k=n.state.tr.setSelection(w);s&&k.setMeta("composition",s),n.dispatch(k)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof P&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=u.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=u.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to));let b=u.doc.resolveNoCache(m.start-u.from),g=u.doc.resolveNoCache(m.endB-u.from),y=d.resolve(m.start),x=b.sameParent(g)&&b.parent.inlineContent&&y.end()>=m.endA;if((kn&&n.input.lastIOSEnter>Date.now()-225&&(!x||i.some(w=>w.nodeName=="DIV"||w.nodeName=="P"))||!x&&Tg(u.doc,b.pos,g.pos))&&Ct(n,"Enter")){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&(x?m.endA>m.start&&m.endB==m.start:Ag(d,m.start,m.endA,b,g))&&Ct(n,"Backspace")){st&&Ee&&n.domSel.suppressChanges();return}Ee&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),st&&!x&&b.start()!=g.start()&&g.parentOffset==0&&b.depth==g.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,g=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>Ct(n,"Enter"),20));let A=m.start,L=m.endA,C=w=>{let k=w||n.state.tr.replace(A,L,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let S=Ka(n,k.doc,u.sel);S&&!(Ee&&n.composing&&S.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(S.head==A||S.head==k.mapping.map(L)-1))&&k.setSelection(S)}return s&&k.setMeta("composition",s),k.scrollIntoView()},T;if(x)if(b.pos==g.pos){let w=C(n.state.tr.delete(A,L)),k=d.resolve(m.start).marksAcross(d.resolve(m.endA));k&&w.ensureMarks(k),n.dispatch(w)}else if(m.endA==m.endB&&(T=Eg(b.parent.content.cut(b.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start())))){let w=C(n.state.tr);T.type=="add"?w.addMark(A,L,T.mark):w.removeMark(A,L,T.mark),n.dispatch(w)}else if(b.parent.child(b.index()).isText&&b.index()==g.index()-(g.textOffset?0:1)){let w=b.parent.textBetween(b.parentOffset,g.parentOffset),k=()=>C(n.state.tr.insertText(w,A,L));n.someProp("handleTextInput",S=>S(n,A,L,w,k))||n.dispatch(k())}else n.dispatch(C());else n.dispatch(C())}function Ka(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Mn(n,e.resolve(t.anchor),e.resolve(t.head))}function Eg(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,o=t,i=r,s,l,a;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<t.length;u++)i=t[u].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(o.length==0&&i.length==1)l=i[0],s="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(E.from(c).eq(n))return{mark:l,type:s}}function Ag(n,e,t,r,o){if(t-e<=o.pos-r.pos||Si(r,!0,!1)<o.pos)return!1;let i=n.resolve(e);if(!r.parent.inlineContent){let l=i.nodeAfter;return l!=null&&t==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=n.resolve(Si(i,!0,!0));return!s.parent.isTextblock||s.pos>t||Si(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Tg(n,e,t){let r=0,o=0;return n.nodesBetween(e,t,(i,s)=>{i.isTextblock&&s>=e&&s<t?r++:(i.isText?/\S/.test(i.text.slice(Math.max(0,e-s),Math.min(i.nodeSize,t-s))):i.isLeaf)&&o++}),o==0&&r==1}function Si(n,e,t){let r=n.depth,o=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,o++,e=!1;if(t){let i=n.node(r).maybeChild(n.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function Ng(n,e,t,r,o){let i=n.findDiffStart(e,t),s=t+n.size,l=t+e.size;if(i==null)return null;let{a,b:c}=n.findDiffEnd(e,s,l);if(o=="end"){let u=Math.max(0,i-Math.min(a,c));r-=a+u-i}if(a<i&&s<l){let u=r<=i&&r>=a?i-r:0;i-=u,c=i+(c-a),a=i}else if(c<i){let u=r<=i&&r>=c?i-r:0;i-=u,a=i+(a-c),c=i}return{start:i,endA:a,endB:c}}function Lg(n){if(!Ja.has(n)&&(Ja.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Ue,Ga)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Ga=!0}}function Dg(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function Rg(n,e){var t;let{focusNode:r,focusOffset:o}=n.domSel.range;for(let i of e)if(((t=i.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let a=l.firstChild;if(!a||!z(a)||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),r==i&&n.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}function Xa(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[ee.node(0,n.state.doc.content.size,e)]}function Ya(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:ee.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Qa(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Ig(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Za(n){let e=Object.create(null);function t(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Pg(n,e){let t=0,r=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)r++;return t!=r}function ec(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ce,Ci,ka,Xe,Sa,xn,Ue,Ei,Ee,oc,Ae,kn,_e,ic,st,io,mm,gn,Cm,Am,Ea,Aa,Ta,Ut,Xr,Ti,Vt,At,tr,Yr,Qr,Zn,_t,Ni,_m,wc,Qn,ze,Ii,Ha,Te,Ne,Zm,Pi,zi,Ac,Hi,fg,or,eo,yg,lr,to,qt,Fi,ee,yn,Wt,K,ye,no,Mg,Sg,Og,$i,Ja,Ga,Kt,Tt=O(()=>{"use strict";U();le();Je();Ce=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e};Ci=null;ka=/^(img|br|input|textarea|hr)$/i;Xe=typeof navigator<"u"?navigator:null,Sa=typeof document<"u"?document:null,xn=Xe&&Xe.userAgent||"",Ue=/gecko\/(\d+)/i.test(xn)&&!/edge?\//i.test(xn);Ue&&+(/Firefox\/(\d+)/.exec(xn)||[0,0])[1];Ei=/Chrome\/(\d+)/.exec(xn),Ee=!!Ei,oc=Ei?+Ei[1]:0,Ae=!!Xe&&/Apple Computer/.test(Xe.vendor),kn=Ae&&(/Mobile\/\w+/.test(xn)||!!Xe&&Xe.maxTouchPoints>2),_e=kn||(Xe?/Mac/.test(Xe.platform):!1),ic=Xe?/Win/.test(Xe.platform):!1,st=/Android \d/.test(xn),io=!!Sa&&"webkitFontSmoothing"in Sa.documentElement.style,mm=io?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;gn=null;Cm=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;Am=/[\u0590-\u08ac]/;Ea=null,Aa=null,Ta=!1;Ut=class{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.damage=0,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let o=this.children[t];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&wn(this.contentDOM,e))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=t>Ce(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM)){let i=e.compareDocumentPosition(this.contentDOM);i&16?o=t>Array.from(e.childNodes).findIndex(s=>s.contains(this.contentDOM)):o=!(i&4)}else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!t||i.node))if(r&&(s=i.nodeDOM)&&!(z(s)?wn(s,e):s==e))r=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let o=this.children[t],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let l=o.children[s];if(l.size){o=l;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>e){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(;r>0;r--){let i=this.children[r-1];if(i.size||!(i instanceof Yr||i instanceof Xr&&i.side>=0))break}if(t<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?Ce(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?Ce(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(o==-1&&e<=c){let u=s+a.border;if(e>=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=Ce(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>t||l==this.children.length-1)){t=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=Ce(d.dom);break}t+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(!z(t)||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDamage(e){e&&(this.damage|=e,this.markParentDamage())}markParentDamage(){for(let e=this;;){let{parent:t}=e;if(!t||t.damage&1)break;t.damage|=1,e=t}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},Xr=class extends Ut{constructor(e,t,r,o){let i,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){let l=z(s)?s:document.createElement("span");l!=s&&(l.appendChild(s),s=l),l.hasAttribute("contenteditable")||(l.contentEditable="false"),l.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return!this.damage&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},Ti=class extends Ut{constructor(e,t,r,o){super(e,[],t,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},Vt=class n extends Ut{constructor(e,t,r,o,i){super(e,[],r,o),this.mark=t,this.spec=i}static create(e,t,r,o){let i=o.nodeViews[t.type.name],s=i&&i(t,o,r);return(!s||!s.dom)&&(s=We.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new n(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.damage&4||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return!(this.damage&4)&&this.mark.eq(e)}markDamage(e){var t;this.damage|=e,(t=this.parent)===null||t===void 0||t.markDamage(2)}slice(e,t,r){let o=n.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;t<s&&(i=Oi(i,t,s,r)),e>0&&(i=Oi(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},At=class n extends Ut{constructor(e,t,r,o,i,s,l){super(e,[],i,s),this.node=t,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,t,r,o,i,s){let l=i.nodeViews[t.type.name],a,c=l&&l(t,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(!he(u))throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=We.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=hc(u,r,t),c?a=new Qr(e,t,r,o,u,d||null,f,c):t.isText?new tr(e,t,r,o,u,f):new n(e,t,r,o,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let o=this.children[r];if(this.dom.contains(o.dom.parentNode)){t.contentElement=o.dom.parentNode;break}}if(!t.contentElement){let r=e&&e.find(o=>z(o)&&e.indexOf(o.parentNode)<0&&this.dom.contains(o));r?t.contentElement=r:t.getContent=()=>E.empty}}return t}matchesNode(e,t,r){return!this.damage&&e.eq(this.node)&&Zr(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,o=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new Ni(this,s&&s.node,e),c=this.node.inlineContent,u=c&&this.node.isBlock;Rm(this.node,this.innerDeco,(d,f,p)=>{d.spec.marks?a.syncToMarks(d.spec.marks,r,e,f):d.type.side>=0&&!p&&a.syncToMarks(f==this.node.childCount?q.none:this.node.child(f).marks,r,e,f),a.placeWidget(d,e,o)},(d,f,p,h)=>{a.syncToMarks(d.marks,r,e,h),u&&d.isAtom&&!d.isText&&a.addHackNode("IMG",a.top);let m;a.findNodeMatch(d,f,p,h)||l&&e.state.selection.from>o&&e.state.selection.to<o+d.nodeSize&&(m=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(d,f,p,m,e,o)||a.updateNextNode(d,f,p,e,h,o)||a.addNode(d,f,p,e,o),o+=d.nodeSize,c&&(u=d.isAtom&&!d.isText)}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.damage&2)&&(s&&this.protectLocalComposition(e,s),pc(this.contentDOM,this.children,e),kn&&Im(this.dom))}localCompositionInfo(e,t){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof P)||r<t||o>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=Pm(this.node.content,s,r-t,o-t);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:o}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new Ti(this,i,t,o);e.input.compositionNodes.push(s),this.children=Oi(this.children,r,r+o.length,e,s)}update(e,t,r,o,i){return this.damage&4||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,o,i),!0)}updateInner(e,t,r,o,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,i+1),this.damage=0}updateOuterDeco(e){if(Zr(e,this.outerDeco))return;let t=!z(this.nodeDOM),r=this.dom;this.dom=Vi(this.dom,this.nodeDOM,nr(this.outerDeco,this.node,t),nr(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){z(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){z(this.nodeDOM)&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};tr=class n extends At{constructor(e,t,r,o,i,s){super(e,t,r,o,i,null,s)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,o){return this.damage&4||this.damage&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.damage&8||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.damage=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return!1}slice(e,t,r){let o=this.node.cut(e,t),i=document.createTextNode(o.text);return new n(this.parent,o,this.outerDeco,this.innerDeco,i,i)}get domAtom(){return!1}isText(e){return this.node.text==e}},Yr=class extends Ut{parseRule(){return{ignore:!0}}matchesHack(e){return!this.damage&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},Qr=class extends At{constructor(e,t,r,o,i,s,l,a){super(e,t,r,o,i,s,l),this.spec=a}update(e,t,r,o,i){if(this.damage&4)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,o,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,o,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};Zn=function(n){n&&(this.nodeName=n)};Zn.prototype=Object.create(null);_t=[new Zn];Ni=class{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Lm(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r,o){let i=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.damage=0,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;o<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[s])&&!this.isLocked(d.dom)){a=u;break}}if(a<0&&this.index<this.top.children.length){let u=this.top.children[this.index];u instanceof Vt&&!(u.damage&4)&&u.mark.type==e[s].type&&u.spec.update&&!this.isLocked(u.dom)&&u.spec.update(e[s])&&(u.mark=e[s],a=this.index,this.changed=!0)}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=Vt.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,r,o,i,s){let l=this.top.children[o];return l.damage&4&&l.dom==l.contentDOM&&(l.damage=2),l.update(e,t,r,i,s)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=t}}updateNextNode(e,t,r,o,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof At){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&!(a.damage&4)&&Zr(t,a.outerDeco));if(!f&&a.update(e,t,r,o,s))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,t,r,o,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.damage|=2,d.updateChildren(o,s+1),d.damage=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,o,i,s){if(e.damage&3||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Zr(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=At.create(this.top,t,r,o,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,o,i){let s=At.create(this.top,e,t,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new Xr(this.top,e,t,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Vt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof tr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ae||Ee)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new Yr(this.top,[],r,null);t!=this.top?t.children.push(o):t.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||z(e)&&e.contains(this.lock.parentNode))}};_m=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;wc={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};Qn=null;ze=class n{constructor(e,t,r,o){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=o}static from(e){return e instanceof n?e:new n(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}};ze.null=new ze(null,0,null,0);Ii=class{constructor(e){this.view=e,this.range=ze.null,this.active=!1,this.synced=!1,this.suppress=!1,this.currentDocument=null,this.onSelectionChange=this.onSelectionChange.bind(this)}ensureListener(){let e=this.view.dom.ownerDocument;e!=this.currentDocument&&(this.currentDocument&&this.currentDocument.removeEventListener("selectionchange",this.onSelectionChange),this.currentDocument=e,e.addEventListener("selectionchange",this.onSelectionChange))}destroy(){this.currentDocument&&(this.currentDocument.removeEventListener("selectionchange",this.onSelectionChange),this.currentDocument=null),this.active=!1,this.range=ze.null}suppressChanges(){this.suppress=!0,setTimeout(()=>this.suppress=!1,50)}onSelectionChange(){if(this.suppress&&this.view.hasFocus())return this.sync();this.read()&&this.view.domObserver.flush(!1)}readRange(){let{view:e}=this,t=e.dom.isConnected!==!1&&e.domSelection();return t?Ae&&e.root.nodeType===11&&pm(e.dom.ownerDocument)==e.dom?ze.from(Km(e,t)||t):ze.from(t):ze.null}read(){this.ensureListener();let e=Sc(this.view);if(!e){this.active=!1,this.range=ze.null;return}return this.active=!0,this.range.eq(e)?!1:(this.range=e,this.synced=!1,!0)}sync(e=!1){let{view:t}=this;t.docView&&(this.ensureListener(),t.domObserver.stopped(()=>{Qm(t,t.state.selection);let r=t.state.selection;if(t.input.mouseDown||kc(t)){let{desc:o,start:i}=Mc(t.docView,r.from,r.to,0);t.cursorWrapper?Ym(t):o instanceof Qr&&o.spec.setSelection?o.spec.setSelection(r.anchor-i,r.head-i,t.root):Jm(t,e,o,i),this.synced=this.active=!0}r.visible==t.dom.classList.contains("ProseMirror-hideselection")&&(r.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),Xm(t))),this.range=this.readRange()}))}ignore(e=this.readRange()){this.range=ze.from(e),this.synced=!0}deactivate(){this.range=ze.null,this.active=this.synced=!1}};Ha=Ae||Ee&&oc<63;Te={},Ne={},Zm={touchstart:!0,touchmove:!0},Pi=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastKeyDispatched=!1,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};Ne.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),n.input.lastKeyDispatched=!1,!(st&&Ee&&t.keyCode==13)){if(kn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(Ct(n,"Enter"),n.input.lastIOSEnter=0)},200);return}t.keyCode!=229&&n.domObserver.forceFlush(!0),Ct(n,t)||$m(n,t)?t.preventDefault():so(n,"key")}};Ne.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Ne.keypress=(n,e)=>{let t=e;if(dg(n)||!t.charCode||t.ctrlKey&&!t.altKey||_e&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof P)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,o,i))&&n.dispatch(i()),t.preventDefault()}};zi=/[\w_\u00a1-\uffff]+/g;try{zi=new RegExp("[\\p{L}\\p{N}_]+","gu")}catch{}Ac=_e?"metaKey":"ctrlKey";Te.mousedown=(n,e)=>{let t=e,r=Date.now();if(n.input.shiftKey=t.shiftKey,n.input.lastTouch>r-500)return!1;jt(n);let o="singleClick";r-n.input.lastClick.time<500&&og(t,n.input.lastClick)&&!t[Ac]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:r,x:t.clientX,y:t.clientY,type:o,button:t.button},n.input.mouseDown&&n.input.mouseDown.done();let i=n.posAtCoords(rr(t));if(i)if(t.button==0){if(!n.hasFocus()){ac(n.dom);let l=n.root.activeElement;l&&!l.contains(n.dom)&&l.blur()}(n.input.mouseDown=new Hi(n,i,t,o)).mightDrag||t.preventDefault()}else so(n,"pointer")};Hi=class{constructor(e,t,r,o){var i;this.view=e,this.startPos=t,this.event=r,this.type=o,this.didMove=!1,this.lastPos=-1,this.anchorRange=null,this.startDoc=e.state.doc,this.selectNode=!!r[Ac],this.extend=r.shiftKey,this.anchorDoc=this.startDoc;let s=Wa(e);if(this.extend){let l=e.state.selection;this.anchorRange=l instanceof R?{from:l.from,to:l.to}:{from:l.anchor,to:l.anchor};let a=l instanceof R?e.nodeDOM(l.from).getBoundingClientRect():e.coordsAtPos(l.anchor);this.anchorOffset={x:(a.left+a.right)/2-s.x,y:(a.top+a.bottom)/2-s.y}}else this.anchorOffset={x:r.clientX-s.x,y:r.clientY-s.y};if(o=="singleClick"){let{selection:l}=e.state,a,c,u=!1;if(l instanceof R&&l.from<=t.pos&&l.to>=t.pos)c=l.from,a=l.node,u=!0;else if(t.inside>-1)a=e.state.doc.nodeAt(t.inside),c=t.inside;else{let d=e.state.doc.resolve(t.pos);a=d.parent,c=d.depth?d.before():-1}if(u||c>-1&&a.type.spec.draggable&&a.type.spec.selectable!==!1){let d=(i=e.docView.descAt(c))===null||i===void 0?void 0:i.nodeDOM;this.mightDrag={node:a,elt:d,pos:c,addAttr:!1},d&&!d.draggable&&(this.mightDrag.addAttr=!0,e.domObserver.stopped(()=>d.draggable=!0))}else this.mightDrag=ug(e,r)}else this.mightDrag=!1;e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),this.mightDrag||this.select(this.startPos,!0)}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null),typeof this.mightDrag=="object"&&this.mightDrag.addAttr&&this.view.domObserver.stopped(()=>this.mightDrag.elt.removeAttribute("draggable"))}maybeRunHandler(e,t){return(this.type=="singleClick"?lg:this.type=="doubleClick"?ag:cg)(this.view,e.pos,e.inside,t,this.selectNode)}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.startPos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(rr(e))),t&&(this.didMove||this.maybeRunHandler(t,e)||this.select(t,!0),e.preventDefault())}move(e){if(e.buttons==0){this.done();return}if(!this.didMove&&(Math.abs(this.event.x-e.clientX)>8||Math.abs(this.event.y-e.clientY)>8)&&(this.didMove=!0,this.mightDrag=!1),!this.mightDrag){let t=this.view.posAtCoords(rr(e));t&&this.select(t,!1)}e.preventDefault()}select(e,t){if(e.pos==this.lastPos)return;this.lastPos=e.pos;let{view:r}=this,{doc:o}=r.state,i=this.type=="singleClick"?Ua(r,o,e):this.type=="doubleClick"?qa(o,e.pos):Va(o,e.inside,t);i&&(t&&!this.extend?this.anchorRange=i:(!t||this.extend)&&(o.eq(this.anchorDoc)||this.restoreAnchor(),this.anchorRange&&this.anchorRange.from<i.from?i=Mn(r,o.resolve(this.anchorRange.from),o.resolve(i.to)):this.anchorRange&&this.anchorRange.to>i.to&&(i=Mn(r,o.resolve(this.anchorRange.to),o.resolve(i.from)))),i.eq(r.state.selection)||r.dispatch(r.state.tr.setSelection(i).setMeta("pointer",!0).scrollIntoView()))}restoreAnchor(){let e=Wa(this.view),t=this.view.posAtCoords({left:this.anchorOffset.x+e.x,top:this.anchorOffset.y+e.y});if(!t)this.anchorRange=null;else{let{doc:r}=this.view.state;this.anchorRange=this.type=="singleClick"?Ua(this.view,r,t):this.type=="doubleClick"?qa(r,t.pos):Va(r,t.inside,!1),this.anchorDoc=this.view.state.doc}}};Te.touchstart=n=>{n.input.lastTouch=Date.now(),jt(n),so(n,"pointer")};Te.touchmove=n=>{n.input.lastTouch=Date.now(),so(n,"pointer")};Te.contextmenu=n=>jt(n);fg=st?5e3:-1;Ne.compositionstart=Ne.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof P&&e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ee&&ic&&pg(n)))n.markCursor=n.state.storedMarks||t.marks(),jt(n,!0),n.markCursor=null;else if(jt(n,!e.selection.empty),Ue&&n.domSel.active&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length)for(let{focusNode:r,focusOffset:o}=n.domSel.range;r&&z(r)&&o!=0;){let i=o<0?r.lastChild:r.childNodes[o-1];if(!i)break;if(he(i)){let s=n.domSelection();s&&s.collapse(i,i.nodeValue.length);break}else r=i,o=-1}n.input.composing=!0}Nc(n,fg)};Ne.compositionend=(n,e)=>{n.composing&&Tc(n)};or=kn&&mm<604;Te.copy=Ne.cut=(n,e)=>{let t=e,r=n.state.selection,o=t.type=="cut";if(r.empty)return;let i=or?null:t.clipboardData,s=r.content(),{dom:l,text:a}=qi(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):mg(n,l),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};Ne.paste=(n,e)=>{let t=e;if(n.composing&&!st)return;let r=or?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&ir(n,Lc(r),r.getData("text/html"),o,t)?t.preventDefault():bg(n,t)};eo=class{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}},yg=_e?"altKey":"ctrlKey";Te.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let o=n.state.selection,i=o.empty?null:n.posAtCoords(rr(t)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof R?o.to-1:o.to))){if(r&&typeof r.mightDrag=="object")s=R.create(n.state.doc,r.mightDrag.pos);else if(t.target&&z(t.target)){let d=n.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=n.docView&&(s=R.create(n.state.doc,d.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:u}=qi(n,l);(!t.dataTransfer.files.length||!Ee||oc>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(or?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",or||t.dataTransfer.setData("text/plain",c),n.dragging=new eo(u,Dc(n,t),s)};Te.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Ne.dragover=Ne.dragenter=(n,e)=>e.preventDefault();Ne.drop=(n,e)=>{try{vg(n,e,n.dragging)}finally{n.dragging=null}};Te.focus=n=>{if(n.input.lastFocus=Date.now(),!n.focused&&(n.domObserver.stopped(()=>n.dom.classList.add("ProseMirror-focused")),n.focused=!0,n.domSel.read(),!n.domSel.synced)){let e=n.domSel.range;setTimeout(()=>{let t=n.domSel.readRange();t&&e.eq(t)&&n.domSel.sync()},20)}};Te.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stopped(()=>n.dom.classList.remove("ProseMirror-focused")),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domSel.deactivate(),n.focused=!1)};Te.beforeinput=(n,e)=>{if(st&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||n.domObserver.pendingRecords().length||(n.dom.blur(),n.focus(),Ct(n,"Backspace")))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in Ne)Te[n]=Ne[n];lr=class{constructor(e){this.frag=e,this.index=0,this.off=0}nodeAt(e){for(;this.off<=e&&this.index<this.frag.childCount;){let t=this.frag.child(this.index);if(this.off==e)return t;this.off+=t.nodeSize,this.index++}return null}},to=class n{constructor(e,t){this.toDOM=e,this.spec=t||Wt,this.side=this.spec.side||0}map(e,t,r,o){let{pos:i,deleted:s}=e.mapResult(t.from+o,this.side<0?-1:1);return s?null:new ee(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof n&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&sr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},qt=class n{constructor(e,t){this.attrs=e,this.spec=t||Wt}map(e,t,r,o){let i=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new ee(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof n&&sr(this.attrs,e.attrs)&&sr(this.spec,e.spec)}static is(e){return e.type instanceof n}destroy(){}},Fi=class n{constructor(e,t){this.attrs=e,this.spec=t||Wt}map(e,t,r,o){let i=e.mapResult(t.from+o,1);if(i.deleted)return null;let s=e.mapResult(t.to+o,-1);return s.deleted||s.pos<=i.pos?null:new ee(i.pos-r,s.pos-r,this)}valid(e,t,r){let o=r.nodeAt(t.from);return!!o&&!o.isText&&t.from+o.nodeSize==t.to}eq(e){return this==e||e instanceof n&&sr(this.attrs,e.attrs)&&sr(this.spec,e.spec)}destroy(){}},ee=class n{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new n(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new n(e,e,new to(t,r))}static inline(e,t,r,o){return new n(e,t,new qt(r,o))}static node(e,t,r,o){return new n(e,t,new Fi(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof qt}get widget(){return this.type instanceof to}},yn=[],Wt={},K=class n{constructor(e,t){this.local=e.length?e:yn,this.children=t.length?t:yn}static create(e,t){return t.length?ro(t,e,0,Wt):ye}find(e,t,r){let o=[];return this.findInner(e??0,t??1e9,o,0,r),o}findInner(e,t,r,o,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];if(l.from>t)break;l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;s<this.children.length&&!(this.children[s]>=t);s+=3)if(this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,r,o+l,i)}}map(e,t,r){return this==ye||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Wt)}mapInner(e,t,r,o,i){let s;if(this.local.length){let l=new lr(t.content);for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,o);c&&c.type.valid(t,c,l)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[a].spec)}}return this.children.length?wg(this.children,s||[],e,t,r,o,i):s?new n(s.sort(Et),yn):ye}add(e,t){return t.length?this==ye?n.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let o,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Ic(t,l,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,u,c+1):o.splice(i,0,a,a+l.nodeSize,ro(u,l,c+1,Wt)),i+=3}});let s=Rc(i?Pc(t):t,-r).sort(Et);if(s.length){let l=new lr(e.content);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a],l)||s.splice(a--,1)}return new n(s.length?this.local.concat(s).sort(Et):this.local,o||this.children)}remove(e){return e.length==0||this==ye?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,l=r[i]+t,a=r[i+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,l+1);c!=ye?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<o.length;l++)o[l].eq(s,t)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new n(o,r):ye}forChild(e,t){if(this==ye)return this;if(t.isLeaf)return n.empty;let r,o,i=0,s=this.children.length/3;for(;i<s;){let c=i+s>>>1,u=c*3,d=this.children[u];if(d<e)i=c+1;else if(d>e)s=c;else{r=this.children[u+2];break}}let l=e+1,a=l+t.content.size;for(let c=0;c<this.local.length;c++){let u=this.local[c];if(u.from<a&&u.to>l&&u.type instanceof qt){let d=Math.max(l,u.from)-l,f=Math.min(a,u.to)-l;d<f&&(o||(o=[])).push(u.copy(d,f))}}if(o){let c=new n(o.sort(Et),yn);return r?new no([c,r]):c}return r||ye}eq(e){if(this==e)return!0;if(!(e instanceof n)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ki(this.localsInner(e))}localsInner(e){if(this==ye)return yn;if(e.inlineContent||!this.local.some(qt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof qt||t.push(this.local[r]);return t}forEachSet(e){e(this)}};K.empty=new K([],[]);K.removeOverlap=Ki;ye=K.empty,no=class n{constructor(e){this.members=e}map(e,t){let r=this.members.map(o=>o.map(e,t,Wt));return n.from(r)}forChild(e,t){if(t.isLeaf)return K.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,t);i!=ye&&(i instanceof n?r=r.concat(i.members):r.push(i))}return n.from(r)}eq(e){if(!(e instanceof n)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!t)t=i;else{r&&(t=t.slice(),r=!1);for(let s=0;s<i.length;s++)t.push(i[s])}}return t?Ki(r?t:t.sort(Et)):yn}static from(e){switch(e.length){case 0:return ye;case 1:return e[0];default:return new n(e.every(t=>t instanceof K)?e:e.reduce((t,r)=>t.concat(r instanceof K?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};Mg=n=>e=>{let t=e.pmViewDesc;if(t)return t.parseRule(n);if(e.nodeName=="BR"&&e.parentNode){if(Ae&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||Ae&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},Sg=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;Og={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},$i=class{constructor(e){this.view=e,this.queue=[],this.flushingSoon=-1,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.started=!1,this.observer=new window.MutationObserver(t=>{for(let r=0;r<t.length;r++)this.queue.push(t[r]);Ae&&e.composing&&t.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()})}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(e=!1){this.flushingSoon>-1?(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush(!0)):e&&this.flush(!0)}start(){this.observer.takeRecords(),this.observer.observe(this.view.dom,Og),this.started=!0}stop(){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect(),this.started=!1}stopped(e){if(!this.started)return e();this.stop();try{return e()}finally{this.start()}}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let i=e.focusNode;i;i=vn(i))t.add(i);for(let i=e.anchorNode;i;i=vn(i))if(t.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:he(r)?r.parentNode:r}))return this.view.domSel.ignore(e),!0}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(e=!0){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let r=this.pendingRecords();r.length&&(this.queue=[]),e&&t.domSel.read();let o=!t.domSel.suppress&&!t.domSel.synced&&!!Sc(t)&&!this.ignoreSelectionChange(t.domSel.range),i=-1,s=-1,l=!1,a=[];if(t.editable)for(let u=0;u<r.length;u++){let d=this.registerMutation(r[u],a);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46||Ee&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&r.some(u=>u.type=="childList"&&u.removedNodes.length))){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&z(d);){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Ue&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=t.domSel.range;for(let f of u){let p=f.parentNode;p&&p.nodeName=="LI"&&(!d||Dg(t,d)!=p)&&f.remove()}}}let c=null;i<0&&o&&t.domSel.active&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&oo(t.domSel.range)&&(c=Wi(t,t.domSel.range))&&c.eq(B.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,t.domSel.sync(),t.scrollToSelection()):(i>-1||o)&&(i>-1&&Lg(t),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,Rg(t,a)),Cg(this.view,i,s,o,l,a),t.docView&&t.docView.damage?t.updateState(t.state):o&&t.domSel.sync())}registerMutation(e,t){var r;if(t.indexOf(e.target)>-1)return null;let o;for(let i=e.target;i&&!(o=this.view.docView.getDesc(i));i=i.parentNode);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];t.push(f),he(f)&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return o.markDamage(4),{from:o.posBefore,to:o.posAfter};let i=e.previousSibling,s=e.nextSibling,l=i&&i.parentNode==e.target?Ce(i)+1:0,a=o.localPosFromDOM(e.target,l,-1),c=s&&s.parentNode==e.target?Ce(s):e.target.childNodes.length,u=o.localPosFromDOM(e.target,c,1);return o.markDamage(!((r=o.contentDOM)===null||r===void 0)&&r.contains(e.target)?2:4),{from:a,to:u}}else return e.type=="attributes"?(o.markDamage(4),{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}):(this.lastChangedTextNode=e.target,o.markDamage(o instanceof tr&&e.target==o.nodeDOM?8:4),{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}},Ja=new WeakMap,Ga=!1;Kt=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Pi,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(ec),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Qa(this),Ya(this),this.nodeViews=Za(this),this.docView=Na(this.state.doc,Xa(this),Mi(this),this.dom,this),this.domObserver=new $i(this),this.domSel=new Ii(this),this.domObserver.start(),this.domSel.read(),eg(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Bi(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ec),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Oc(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=Za(this);Pg(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Bi(this),this.editable=Qa(this),Ya(this);let a=Mi(this),c=Xa(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&ym(this);s&&this.domObserver.stopped(()=>{let p=d&&Ee&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Ig(o.selection,e.selection);if(d){let h=Ee?this.trackWrites=this.domSel.range.focusNode:null;if(this.composing&&(this.input.compositionNode=hg(this)),i||!this.docView.update(e.doc,c,a,this,-1)){let m=this.docView.outerDeco;this.docView.destroy(),this.docView=Na(e.doc,c,a,this.dom,this,m)}h&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}this.domSel.sync(p)}),this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&vm(f)}scrollToSelection(){let e=this.domSel.range.focusNode;if(!(!e||!this.domSel.active)){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof R){let t=this.docView.domAfterPos(this.state.selection.from);z(t)&&Ca(this,t.getBoundingClientRect(),e)}else Ca(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,o=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new eo(e.slice,e.move,o<0?void 0:R.create(this.state.doc,o))}someProp(e,t){let r=this._props&&this._props[e],o;if(r!=null&&(o=t?t(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(o=t?t(l):l))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(o=t?t(l):l))return o}}hasFocus(){return this.root.activeElement==this.dom}focus(){this.editable&&ac(this.dom),this.domSel.sync()}get root(){let e=this.dom.isConnected!==!1;e||(this._root=null);let t=this._root;if(t==null&&e){for(let r=this.dom.parentNode;r;r=r.parentNode)if(r.nodeType==9||r.nodeType==11&&r.host)return r.getSelection||(Object.getPrototypeOf(r).getSelection=()=>r.ownerDocument.getSelection()),this._root=r}return t||document}updateRoot(){this._root=null}posAtCoords(e){return Sm(this,e)}coordsAtPos(e,t=1){return dc(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let o=this.docView.posFromDOM(e,t,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return Nm(this,t||this.state,e)}pasteHTML(e,t){return ir(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return ir(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return qi(this,e)}destroy(){this.docView&&(tg(this),this.domSel.destroy(),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Mi(this),this,-1),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,um())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return rg(this,e)}domSelection(){return this.root.getSelection()}};Kt.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))}});function Bc(n){var e=Bg&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||zg&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ao:lt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}var lt,ao,Bg,zg,ce,ce,ce,lo,zc=O(()=>{"use strict";lt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ao={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Bg=typeof navigator<"u"&&/Mac/.test(navigator.platform),zg=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(ce=0;ce<10;ce++)lt[48+ce]=lt[96+ce]=String(ce);for(ce=1;ce<=24;ce++)lt[ce+111]="F"+ce;for(ce=65;ce<=90;ce++)lt[ce]=String.fromCharCode(ce+32),ao[ce]=String.fromCharCode(ce);for(lo in lt)ao.hasOwnProperty(lo)||(ao[lo]=lt[lo])});function $g(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,o,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Hg?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),o&&(t="Ctrl-"+t),s&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function _g(n){let e=Object.create(null);for(let t in n)e[$g(t)]=n[t];return e}function Ji(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function He(n){return new _({props:{handleKeyDown:ar(n)}})}function ar(n){let e=_g(n);return function(t,r){let o=Bc(r),i,s=e[Ji(o,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[Ji(o,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Fg&&r.ctrlKey&&r.altKey)&&(i=lt[r.keyCode])&&i!=o){let l=e[Ji(i,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var Hg,Fg,at=O(()=>{"use strict";zc();U();Hg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Fg=typeof navigator<"u"&&/Win/.test(navigator.platform)});function Xi(n="c"){let e=new Uint8Array(9);return globalThis.crypto.getRandomValues(e),n+Array.from(e,t=>(t%36).toString(36)).join("")}function Hc(n){if(!n||typeof n!="object")return null;let e=n;if(typeof e.id!="string"||!cr.test(e.id))return null;let t=Array.isArray(e.comments)?e.comments.map(Fc).filter(o=>o!==null):[],r=e.resolved;return{id:e.id,createdAt:Number(e.createdAt)||0,comments:t,resolved:r&&typeof r=="object"?{by:Gi(r.by),at:Number(r.at)||0}:null}}function Gi(n){let e=n&&typeof n=="object"?n:{};return{id:String(e.id??"").slice(0,128),name:String(e.name??"").slice(0,80)}}function Fc(n){if(!n||typeof n!="object")return null;let e=n;if(typeof e.id!="string"||!cr.test(e.id))return null;let t={id:e.id,author:Gi(e.author),text:String(e.text??"").slice(0,5e3),createdAt:Number(e.createdAt)||0};if(e.editedAt&&(t.editedAt=Number(e.editedAt)||0),Array.isArray(e.mentions)){let r=e.mentions.slice(0,20).map(Gi).filter(o=>/^[\w.@:+-]{1,128}$/.test(o.id)&&o.name);r.length&&(t.mentions=r)}return t}function $c(n=[],e){let t=n.map(Hc).filter(s=>s!==null),r=new Set,o=s=>{t=s,e?.(t),r.forEach(l=>l())},i=(s,l)=>o(t.map(a=>a.id===s?l(a):a));return{threads:()=>t,subscribe(s){return r.add(s),()=>r.delete(s)},createThread(s){let l=Hc(s);!l||t.some(a=>a.id===l.id)||o([...t,l])},reply(s,l){let a=Fc(l);a&&i(s,c=>({...c,comments:[...c.comments,a]}))},editComment(s,l,a){i(s,c=>({...c,comments:c.comments.map(u=>u.id===l?{...u,text:a.slice(0,5e3),editedAt:Date.now()}:u)}))},deleteComment(s,l){i(s,a=>({...a,comments:a.comments.filter(c=>c.id!==l)}))},setResolved(s,l){i(s,a=>({...a,resolved:l??null}))},deleteThread(s){o(t.filter(l=>l.id!==s))}}}var cr,_c=O(()=>{"use strict";cr=/^[A-Za-z0-9_-]{1,64}$/});var Wc={};Be(Wc,{createCommentsPanel:()=>jg});function Wg(n){let e=0;for(let t of n)e=e*31+t.charCodeAt(0)|0;return qc[Math.abs(e)%qc.length]}function Ug(n){return n.trim().split(/\s+/).filter(Boolean).slice(0,2).map(t=>[...t][0].toUpperCase()).join("")||"?"}function jg(n){let{editor:e,store:t,labels:r}=n,o=e.options.language??"en",i=new Intl.RelativeTimeFormat(o,{numeric:"auto"}),s=new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}),l=ke("nova-comments-title"),a=new Map,c=new Map,u=null,d=!1,f=v("div",{className:"nova-comments-list"}),p=v("span",{className:"nova-comments-count"}),h=v("input",{type:"checkbox"});h.addEventListener("change",()=>{d=h.checked,T()});let m=v("aside",{className:"nova-comments","aria-labelledby":l,hidden:!0,onKeydown:(w=>{w.key==="Escape"&&(w.stopPropagation(),n.pending()?n.cancelPending():n.closePanel())})},v("div",{className:"nova-comments-head"},v("h2",{id:l,className:"nova-comments-title"},r.panel),p,v("button",{type:"button",className:"nova-btn nova-comments-close","aria-label":r.close,title:r.close,onClick:()=>n.closePanel()},"\xD7")),v("label",{className:"nova-comments-filter"},h,r.showResolved),f);function b(w){let k=Math.round((w-Date.now())/1e3),S=Math.abs(k),F=S<45?i.format(0,"second"):S<3600?i.format(Math.round(k/60),"minute"):S<86400?i.format(Math.round(k/3600),"hour"):S<86400*7?i.format(Math.round(k/86400),"day"):s.format(w);return v("time",{dateTime:new Date(w).toISOString(),title:s.format(w)},F)}function g(w,k){let S=v("span",{className:"nova-comment-avatar","aria-hidden":"true"},Ug(k));return S.style.backgroundColor=Wg(w||k),S}function y(w){let k=ke("nova-mention-list"),S=v("textarea",{className:"nova-input nova-comment-input",rows:2,maxlength:5e3,placeholder:w.placeholder,"aria-label":w.placeholder,"data-draft":w.key});S.value=a.get(w.key)??w.initial??"";let F=c.get(w.key)??new Map((w.initialMentions??[]).map(V=>[V.id,V]));c.set(w.key,F);let H=v("button",{type:"button",className:"nova-button nova-button-primary"},w.submitLabel),I=v("ul",{id:k,className:"nova-mention-list",role:"listbox","aria-label":r.people,hidden:!0}),$=[],ie=0,ue=null,Ar=0;n.findUsers&&(S.setAttribute("role","combobox"),S.setAttribute("aria-autocomplete","list"),S.setAttribute("aria-controls",k),S.setAttribute("aria-expanded","false"));let Hn=()=>{ue=null,$=[],I.hidden=!0,I.replaceChildren(),S.setAttribute("aria-expanded","false"),S.removeAttribute("aria-activedescendant")},dl=()=>{if(!ue)return Hn();I.replaceChildren(...$.length?$.map((V,Pe)=>{let Lt=v("li",{id:`${k}-${Pe}`,role:"option",className:"nova-mention-option","aria-selected":String(Pe===ie)},g(V.id,V.name),v("span",{className:"nova-mention-name"},V.name),V.description?v("span",{className:"nova-mention-detail"},V.description):null);return Lt.addEventListener("mousedown",Dt=>{Dt.preventDefault(),pl(Pe)}),Lt}):[v("li",{className:"nova-mention-empty",role:"presentation"},r.noPeople)]),I.hidden=!1,S.setAttribute("aria-expanded","true"),$.length?S.setAttribute("aria-activedescendant",`${k}-${ie}`):S.removeAttribute("aria-activedescendant")},fl=()=>{let V=n.findUsers;if(!V)return;let Pe=S.selectionStart??0,Lt=S.value.slice(0,Pe),Dt=/(?:^|\s)@([\p{L}\p{N}_.-]{0,30})$/u.exec(Lt);if(!Dt)return Hn();let ml=Dt[1]??"";ue={start:Pe-ml.length-1,end:Pe};let mh=++Ar;V(ml).then(gh=>{mh!==Ar||!ue||($=gh,ie=0,dl())})},pl=V=>{let Pe=$[V];if(!Pe||!ue)return;let Lt=`@${Pe.name} `;S.value=S.value.slice(0,ue.start)+Lt+S.value.slice(ue.end);let Dt=ue.start+Lt.length;S.setSelectionRange(Dt,Dt),F.set(Pe.id,{id:Pe.id,name:Pe.name}),Hn(),Qo(),S.focus()},Qo=()=>{a.set(w.key,S.value),H.disabled=S.value.trim()===""},hl=()=>{let V=S.value;V.trim()&&(a.delete(w.key),c.delete(w.key),w.onSubmit(V,[...F.values()]))};S.addEventListener("input",()=>{Qo(),fl()}),S.addEventListener("click",fl),S.addEventListener("blur",()=>setTimeout(Hn,0)),S.addEventListener("keydown",V=>{if(ue&&!I.hidden){if(V.key==="ArrowDown"||V.key==="ArrowUp"){if(V.preventDefault(),!$.length)return;ie=(ie+(V.key==="ArrowDown"?1:-1)+$.length)%$.length,dl();return}if((V.key==="Enter"&&!V.ctrlKey&&!V.metaKey||V.key==="Tab")&&$.length){V.preventDefault(),pl(ie);return}if(V.key==="Escape"){V.preventDefault(),V.stopPropagation(),Hn();return}}V.key==="Enter"&&(V.ctrlKey||V.metaKey)&&(V.preventDefault(),hl())}),H.addEventListener("click",hl),Qo();let hh=w.onCancel?v("button",{type:"button",className:"nova-button",onClick:()=>{a.delete(w.key),c.delete(w.key),w.onCancel()}},r.cancel):null;return v("div",{className:"nova-comment-composer"},v("div",{className:"nova-mention-wrap"},S,I),v("div",{className:"nova-comment-actions"},hh,H))}function x(w){let k=v("p",{className:"nova-comment-text"}),S=(w.mentions??[]).map(I=>`@${I.name}`).sort((I,$)=>$.length-I.length);if(!S.length)return k.textContent=w.text,k;let F=S.map(I=>I.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),H=w.text.split(new RegExp(`(${F.join("|")})`,"g"));return k.append(...H.map(I=>S.includes(I)?v("span",{className:"nova-comment-mention"},I):I)),k}function A(w,k,S){let F=n.canEdit(k),H=u?.threadId===w.id&&u.commentId===k.id&&F,I=k.author.id===n.author.id,$=v("div",{className:"nova-comment-head"},g(k.author.id,k.author.name),v("span",{className:"nova-comment-author"},k.author.name||r.guest,I?v("span",{className:"nova-comment-you"},` (${r.you})`):null),b(k.createdAt),k.editedAt?v("span",{className:"nova-comment-edited"},r.edited):null),ie=H?y({key:`edit:${w.id}:${k.id}`,placeholder:r.placeholder,submitLabel:r.save,initial:k.text,initialMentions:k.mentions??[],onSubmit:Ar=>{u=null,t.editComment(w.id,k.id,Ar.trim())},onCancel:()=>{u=null,T()}}):x(k),ue=F&&!H?v("div",{className:"nova-comment-tools"},v("button",{type:"button",className:"nova-link-btn",onClick:()=>{u={threadId:w.id,commentId:k.id},T(),C(`edit:${w.id}:${k.id}`)}},r.edit),S>0?v("button",{type:"button",className:"nova-link-btn",onClick:()=>t.deleteComment(w.id,k.id)},r.remove):null):null;return v("div",{className:"nova-comment-item"},$,ie,ue)}function L(w){let k=n.active()===w.id,S=n.quote(w.id),F=w.comments[0],H=F?n.canEdit(F):!0,I=v("article",{className:["nova-thread",k?"is-active":"",w.resolved?"is-resolved":"",S?"":"is-orphan"].filter(Boolean).join(" "),"data-thread":w.id,tabindex:"-1","aria-current":k?"true":null},S?v("blockquote",{className:"nova-thread-quote"},S.slice(0,140)):v("p",{className:"nova-thread-orphan"},r.orphan),w.comments.map(($,ie)=>A(w,$,ie)),w.resolved?v("p",{className:"nova-thread-resolved"},r.resolvedBy.replace("{name}",w.resolved.by.name||r.guest)):null,k&&!w.resolved?y({key:`reply:${w.id}`,placeholder:r.replyPlaceholder,submitLabel:r.reply,onSubmit:($,ie)=>n.reply(w.id,$,ie)}):null,v("div",{className:"nova-thread-tools"},v("button",{type:"button",className:"nova-button",onClick:()=>n.setResolved(w.id,!w.resolved)},w.resolved?r.reopen:r.resolve),H?v("button",{type:"button",className:"nova-button nova-button-danger",onClick:()=>n.deleteThread(w.id)},r.deleteThread):null));return I.addEventListener("click",$=>{$.target.closest("button, textarea, input, a")||n.active()!==w.id&&n.setActive(w.id,!0)}),I}function C(w){let k=f.querySelector(`textarea[data-draft="${w}"]`);k&&(k.focus(),k.setSelectionRange(k.value.length,k.value.length))}function T(){let w=f.contains(document.activeElement)?document.activeElement.getAttribute("data-draft"):null,k=[...t.threads()].sort((I,$)=>n.positionOf(I.id)-n.positionOf($.id)||I.createdAt-$.createdAt),S=k.filter(I=>!I.resolved),F=d?k:S;p.textContent=S.length?String(S.length):"",p.setAttribute("aria-label",r.count.replace("{count}",String(S.length)));let H=[];n.pending()&&H.push(v("article",{className:"nova-thread is-active is-new"},v("div",{className:"nova-comment-head"},g(n.author.id,n.author.name),v("span",{className:"nova-comment-author"},n.author.name)),y({key:"new",placeholder:r.placeholder,submitLabel:r.comment,onSubmit:(I,$)=>n.submitPending(I,$),onCancel:()=>n.cancelPending()}))),H.push(...F.map(L)),H.length===0&&H.push(v("p",{className:"nova-comments-empty"},r.empty.replace("{shortcut}",Ge(n.shortcut)))),f.replaceChildren(...H),w&&C(w),f.querySelector(".nova-thread.is-active")?.scrollIntoView?.({block:"nearest"})}return{el:m,render:T,focusComposer:()=>C("new"),destroy:()=>m.remove()}}var qc,Uc=O(()=>{"use strict";X();qc=["#2563eb","#db2777","#16a34a","#ea580c","#7c3aed","#0891b2","#ca8a04","#dc2626"]});function nb(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);let e=rb(n),t=n.childCount,r=[],o=0,i=null,s=[];for(let c=0,u=e*t;c<u;c++)r[c]=0;for(let c=0,u=0;c<t;c++){let d=n.child(c);u++;for(let h=0;;h++){for(;o<r.length&&r[o]!=0;)o++;if(h==d.childCount)break;let m=d.child(h),{colspan:b,rowspan:g,colwidth:y}=m.attrs;for(let x=0;x<g;x++){if(x+c>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:g-x});break}let A=o+x*e;for(let L=0;L<b;L++){r[A+L]==0?r[A+L]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:b-L});let C=y&&y[L];if(C){let T=(A+L)%e*2,w=s[T];w==null||w!=C&&s[T+1]==1?(s[T]=C,s[T+1]=1):w==C&&s[T+1]++}}}o+=b,u+=m.nodeSize}let f=(c+1)*e,p=0;for(;o<f;)r[o++]==0&&p++;p&&(i||(i=[])).push({type:"missing",row:c,n:p}),u++}(e===0||t===0)&&(i||(i=[])).push({type:"zero_sized"});let l=new ne(e,t,r,i),a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<t&&(a=!0);return a&&ob(l,s,n),l}function rb(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){let o=n.child(r),i=0;if(t)for(let s=0;s<r;s++){let l=n.child(s);for(let a=0;a<l.childCount;a++){let c=l.child(a);s+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let s=0;s<o.childCount;s++){let l=o.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function ob(n,e,t){n.problems||(n.problems=[]);let r={};for(let o=0;o<n.map.length;o++){let i=n.map[o];if(r[i])continue;r[i]=!0;let s=t.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null,a=s.attrs;for(let c=0;c<a.colspan;c++){let u=e[(o+c)%n.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=ib(a)))[c]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function ib(n){if(n.colwidth)return n.colwidth.slice();let e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function ou(n,e){if(typeof n=="string")return{};let t=n.getAttribute("data-colwidth"),r=t&&/^\d+(,\d+)*$/.test(t)?t.split(",").map(s=>Number(s)):null,o=Number(n.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(n.getAttribute("rowspan")||1),colwidth:r&&r.length==o?r:null};for(let s in e){let l=e[s].getFromDOM,a=l&&l(n);a!=null&&(i[s]=a)}return i}function iu(n,e){let t={};n.attrs.colspan!=1&&(t.colspan=n.attrs.colspan),n.attrs.rowspan!=1&&(t.rowspan=n.attrs.rowspan),n.attrs.colwidth&&(t["data-colwidth"]=n.attrs.colwidth.join(","));for(let r in e){let o=e[r].setDOMAttr;o&&o(n.attrs[r],t)}return t}function sb(n){if(n!==null){if(!Array.isArray(n))throw new TypeError("colwidth must be null or an array");for(let e of n)if(typeof e!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function mu(n){let e=n.cellAttributes||{},t={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:sb}};for(let r in e)t[r]={default:e[r].default,validate:e[r].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:n.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:n.cellContent,attrs:t,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:r=>ou(r,e)}],toDOM(r){return["td",iu(r,e),0]}},table_header:{content:n.cellContent,attrs:t,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:r=>ou(r,e)}],toDOM(r){return["th",iu(r,e),0]}}}}function we(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(let t in n.nodes){let r=n.nodes[t],o=r.spec.tableRole;o&&(e[o]=r)}}return e}function Jt(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function lb(n){for(let e=n.depth;e>0;e--){let t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function Y(n){let e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function bo(n){let e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;let t=Jt(e.$head)||ab(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function ab(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function ps(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function cb(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function gs(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function gu(n,e,t){let r=n.node(-1),o=ne.get(r),i=n.start(-1),s=o.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function Gt(n,e,t=1){let r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function bu(n,e,t=1){let r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<t;o++)r.colwidth.splice(e,0,0)}return r}function ub(n,e,t){let r=we(e.type.schema).header_cell;for(let o=0;o<n.height;o++)if(e.nodeAt(n.map[t+o*n.width]).type!=r)return!1;return!0}function fb(n){if(!(n.selection instanceof G))return null;let e=[];return n.selection.forEachCell((t,r)=>{e.push(ee.node(r,r+t.nodeSize,{class:"selectedCell"}))}),K.create(n.doc,e)}function pb({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,o=n.depth;for(;o>=0&&!(n.after(o+1)<n.end(o));o--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return t==r&&/row|table/.test(n.node(o).type.spec.tableRole)}function hb({$from:n,$to:e}){let t,r;for(let o=n.depth;o>0;o--){let i=n.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let o=e.depth;o>0;o--){let i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return t!==r&&e.parentOffset===0}function mb(n,e,t){let r=(e||n).selection,o=(e||n).doc,i,s;if(r instanceof R&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=G.create(o,r.from);else if(s=="row"){let l=o.resolve(r.from+1);i=G.rowSelection(l,l)}else if(!t){let l=ne.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];i=G.create(o,a+1,c)}}else r instanceof P&&pb(r)?i=P.create(o,r.from):r instanceof P&&hb(r)&&(i=P.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}function vu(n,e,t,r){let o=n.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){let a=e.child(s);for(let c=l,u=Math.min(o,s+3);c<u;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}r(a,t),l<o&&n.child(l).sameMarkup(a)?vu(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function bb(n,e){let t,r=(o,i)=>{o.type.spec.tableRole=="table"&&(t=yb(n,o,i,t))};return e?e.doc!=n.doc&&vu(e.doc,n.doc,0,r):n.doc.descendants(r),t}function yb(n,e,t,r){let o=ne.get(e);if(!o.problems)return r;r||(r=n.tr);let i=[];for(let a=0;a<o.height;a++)i.push(0);for(let a=0;a<o.problems.length;a++){let c=o.problems[a];if(c.type=="collision"){let u=e.nodeAt(c.pos);if(!u)continue;let d=u.attrs;for(let f=0;f<d.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,Gt(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){let u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){let u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){let u=r.mapping.map(t);r.delete(u,u+e.nodeSize)}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,c=t+1;a<o.height;a++){let u=e.child(a),d=c+u.nodeSize,f=i[a];if(f>0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);let h=[];for(let b=0;b<f;b++){let g=we(n.schema)[p].createAndFill();g&&h.push(g)}let m=(a==0||s==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(m),h)}c=d}return r.setMeta(gb,{fixTables:!0})}function Cn(n){return vb(e=>e.type.spec.tableRole==="table",n)}function vb(n,e){for(let t=e.depth;t>=0;t-=1){let r=e.node(t);if(n(r))return{node:r,pos:t===0?0:e.before(t),start:e.start(t),depth:t}}return null}function $e(n){let e=n.selection,t=bo(n),r=t.node(-1),o=t.start(-1),i=ne.get(r);return{...e instanceof G?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(t.pos-o),tableStart:o,map:i,table:r}}function wu(n,{map:e,tableStart:t,table:r},o){let i=o>0?-1:0;ub(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s<e.height;s++){let l=s*e.width+o;if(o>0&&o<e.width&&e.map[l-1]==e.map[l]){let a=e.map[l],c=r.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,bu(c.attrs,o-e.colCount(a))),s+=c.attrs.rowspan-1}else{let a=i==null?we(r.type.schema).cell:r.nodeAt(e.map[l+i]).type,c=e.positionAt(s,o,r);n.insert(n.mapping.map(t+c),a.createAndFill())}}return n}function xu(n,e){if(!Y(n))return!1;if(e){let t=$e(n);e(wu(n.tr,t,t.left))}return!0}function ku(n,e){if(!Y(n))return!1;if(e){let t=$e(n);e(wu(n.tr,t,t.right))}return!0}function wb(n,{map:e,table:t,tableStart:r},o){let i=n.mapping.maps.length;for(let s=0;s<e.height;){let l=s*e.width+o,a=e.map[l],c=t.nodeAt(a),u=c.attrs;if(o>0&&e.map[l-1]==a||o<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(i).map(r+a),null,Gt(u,o-e.colCount(a)));else{let d=n.mapping.slice(i).map(r+a);n.delete(d,d+c.nodeSize)}s+=u.rowspan}}function Mu(n,e){if(!Y(n))return!1;if(e){let t=$e(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let o=t.right-1;wb(r,t,o),o!=t.left;o--){let i=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=ne.get(i)}e(r)}return!0}function xb(n,e,t){var r;let o=we(e.type.schema).header_cell;for(let i=0;i<n.width;i++)if(((r=e.nodeAt(n.map[i+t*n.width]))===null||r===void 0?void 0:r.type)!=o)return!1;return!0}function Su(n,{map:e,tableStart:t,table:r},o){let i=t;for(let c=0;c<o;c++)i+=r.child(c).nodeSize;let s=[],l=o>0?-1:0;xb(e,r,o+l)&&(l=o==0||o==e.height?null:0);for(let c=0,u=e.width*o;c<e.width;c++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){let d=e.map[u],f=r.nodeAt(d).attrs;n.setNodeMarkup(t+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{var a;let d=l==null?we(r.type.schema).cell:(a=r.nodeAt(e.map[u+l*e.width]))===null||a===void 0?void 0:a.type,f=d?.createAndFill();f&&s.push(f)}return n.insert(i,we(r.type.schema).row.create(null,s)),n}function Cu(n,e){if(!Y(n))return!1;if(e){let t=$e(n);e(Su(n.tr,t,t.top))}return!0}function bs(n,e){if(!Y(n))return!1;if(e){let t=$e(n);e(Su(n.tr,t,t.bottom))}return!0}function kb(n,{map:e,table:t,tableStart:r},o){let i=0;for(let c=0;c<o;c++)i+=t.child(c).nodeSize;let s=i+t.child(o).nodeSize,l=n.mapping.maps.length;n.delete(i+r,s+r);let a=new Set;for(let c=0,u=o*e.width;c<e.width;c++,u++){let d=e.map[u];if(!a.has(d)){if(a.add(d),o>0&&d==e.map[u-e.width]){let f=t.nodeAt(d).attrs;n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(o<e.height&&d==e.map[u+e.width]){let f=t.nodeAt(d),p=f.attrs,h=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(o+1,c,t);n.insert(n.mapping.slice(l).map(r+m),h),c+=p.colspan-1}}}}function Eu(n,e){if(!Y(n))return!1;if(e){let t=$e(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let o=t.bottom-1;kb(r,t,o),o!=t.top;o--){let i=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=ne.get(t.table)}e(r)}return!0}function su(n){let e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function Mb({width:n,height:e,map:t},r){let o=r.top*n+r.left,i=o,s=(r.bottom-1)*n+r.left,l=o+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&t[i]==t[i-1]||r.right<n&&t[l]==t[l+1])return!0;i+=n,l+=n}for(let a=r.left;a<r.right;a++){if(r.top>0&&t[o]==t[o-n]||r.bottom<e&&t[s]==t[s+n])return!0;o++,s++}return!1}function Au(n,e){let t=n.selection;if(!(t instanceof G)||t.$anchorCell.pos==t.$headCell.pos)return!1;let r=$e(n),{map:o}=r;if(Mb(o,r))return!1;if(e){let i=n.tr,s={},l=E.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){let f=o.map[u*o.width+d],p=r.table.nodeAt(f);if(!(s[f]||!p))if(s[f]=!0,a==null)a=f,c=p;else{su(p)||(l=l.append(p.content));let h=i.mapping.map(f+r.tableStart);i.delete(h,h+p.nodeSize)}}if(a==null||c==null)return!0;if(i.setNodeMarkup(a+r.tableStart,null,{...bu(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){let u=a+1+c.content.size,d=su(c)?a+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,l)}i.setSelection(new G(i.doc.resolve(a+r.tableStart))),e(i)}return!0}function Tu(n,e){let t=we(n.schema);return Sb(({node:r})=>t[r.type.spec.tableRole])(n,e)}function Sb(n){return(e,t)=>{let r=e.selection,o,i;if(r instanceof G){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;o=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var s;if(o=lb(r.$from),!o)return!1;i=(s=Jt(r.$from))===null||s===void 0?void 0:s.pos}if(o==null||i==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(t){let l=o.attrs,a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});let u=$e(e),d=e.tr;for(let p=0;p<u.right-u.left;p++)a.push(c?{...l,colwidth:c&&c[p]?[c[p]]:null}:l);let f;for(let p=u.top;p<u.bottom;p++){let h=u.map.positionAt(p,u.left,u.table);p==u.top&&(h+=o.nodeSize);for(let m=u.left,b=0;m<u.right;m++,b++)m==u.left&&p==u.top||d.insert(f=d.mapping.map(h+u.tableStart,1),n({node:o,row:p,col:m}).createAndFill(a[b]))}d.setNodeMarkup(i,n({node:o,row:u.top,col:u.left}),a[0]),r instanceof G&&d.setSelection(new G(d.doc.resolve(r.$anchorCell.pos),f?d.doc.resolve(f):void 0)),t(d)}return!0}}function Nu(n,e){return function(t,r){if(!Y(t))return!1;let o=bo(t);if(o.nodeAfter.attrs[n]===e)return!1;if(r){let i=t.tr;t.selection instanceof G?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&i.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[n]:e}),r(i)}return!0}}function Cb(n){return function(e,t){if(!Y(e))return!1;if(t){let r=we(e.schema),o=$e(e),i=e.tr,s=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map(a=>o.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[a],r.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<s.length;a++)i.setNodeMarkup(o.tableStart+s[a],r.header_cell,l[a].attrs);t(i)}return!0}}function lu(n,e,t){let r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let o=0;o<r.length;o++){let i=e.table.nodeAt(r[o]);if(i&&i.type!==t.header_cell)return!1}return!0}function En(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Cb(n):function(t,r){if(!Y(t))return!1;if(r){let o=we(t.schema),i=$e(t),s=t.tr,l=lu("row",i,o),a=lu("column",i,o),c=(n==="column"?l:n==="row"&&a)?1:0,u=n=="column"?{left:0,top:c,right:1,bottom:i.map.height}:n=="row"?{left:c,top:0,right:i.map.width,bottom:1}:i,d=n=="column"?a?o.cell:o.header_cell:n=="row"?l?o.cell:o.header_cell:o.cell;i.map.cellsInRect(u).forEach(f=>{let p=f+i.tableStart,h=s.doc.nodeAt(p);h&&s.setNodeMarkup(p,d,h.attrs)}),r(s)}return!0}}function Eb(n,e){if(e<0){let t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,o=n.before();r>=0;r--){let i=n.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;let t=n.node(-1);for(let r=n.indexAfter(-1),o=n.after();r<t.childCount;r++){let i=t.child(r);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function yo(n){return function(e,t){if(!Y(e))return!1;let r=Eb(bo(e),n);if(r==null)return!1;if(t){let o=e.doc.resolve(r);t(e.tr.setSelection(P.between(o,cb(o))).scrollIntoView())}return!0}}function Ou(n,e){let t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function fo(n,e){let t=n.selection;if(!(t instanceof G))return!1;if(e){let r=n.tr,o=we(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new N(o,0,0))}),r.docChanged&&e(r)}return!0}function Ab(n){if(n.size===0)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;let o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content,u=a?0:Math.max(0,t-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=hs(we(s).row,new N(c,u,d)).content),l.push(c)}else if(i=="cell"||i=="header_cell")l.push(t||r?hs(we(s).row,new N(e,t,r)).content:e);else return null;return Tb(s,l)}function Tb(n,e){let t=[];for(let o=0;o<e.length;o++){let i=e[o];for(let s=i.childCount-1;s>=0;s--){let{rowspan:l,colspan:a}=i.child(s).attrs;for(let c=o;c<o+l;c++)t[c]=(t[c]||0)+a}}let r=0;for(let o=0;o<t.length;o++)r=Math.max(r,t[o]);for(let o=0;o<t.length;o++)if(o>=e.length&&e.push(E.empty),t[o]<r){let i=we(n).cell.createAndFill(),s=[];for(let l=t[o];l<r;l++)s.push(i);e[o]=e[o].append(E.from(s))}return{height:e.length,width:r,rows:e}}function hs(n,e){let t=n.createAndFill();return new dn(t).replace(0,t.content.size,e).doc}function Nb({width:n,height:e,rows:t},r,o){if(n!=r){let i=[],s=[];for(let l=0;l<t.length;l++){let a=t[l],c=[];for(let u=i[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(Gt(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)i[l+p]=(i[l+p]||0)+f.attrs.colspan}s.push(E.from(c))}t=s,n=r}if(e!=o){let i=[];for(let s=0,l=0;s<o;s++,l++){let a=[],c=t[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),a.push(d)}i.push(E.from(a))}t=i,e=o}return{width:n,height:e,rows:t}}function Ob(n,e,t,r,o,i,s){let l=n.doc.type.schema,a=we(l),c,u;if(o>e.width)for(let d=0,f=0;d<e.height;d++){let p=t.child(d);f+=p.nodeSize;let h=[],m;p.lastChild==null||p.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=u||(u=a.header_cell.createAndFill());for(let b=e.width;b<o;b++)h.push(m);n.insert(n.mapping.slice(s).map(f-1+r),h)}if(i>e.height){let d=[];for(let h=0,m=(e.height-1)*e.width;h<Math.max(e.width,o);h++){let b=h>=e.width?!1:t.nodeAt(e.map[m+h]).type==a.header_cell;d.push(b?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}let f=a.row.create(null,E.from(d)),p=[];for(let h=e.height;h<i;h++)p.push(f);n.insert(n.mapping.slice(s).map(r+t.nodeSize-2),p)}return!!(c||u)}function au(n,e,t,r,o,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=o;c<i;c++){let u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;let f=t.nodeAt(d),{top:p,left:h}=e.findCell(d);n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:s-p}),n.insert(n.mapping.slice(l).map(e.positionAt(s,h,t)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-s})),c+=f.attrs.colspan-1}}return a}function cu(n,e,t,r,o,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=o;c<i;c++){let u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){a=!0;let f=t.nodeAt(d),p=e.colCount(d),h=n.mapping.slice(l).map(d+r);n.setNodeMarkup(h,null,Gt(f.attrs,s-p,f.attrs.colspan-(s-p))),n.insert(h+f.nodeSize,f.type.createAndFill(Gt(f.attrs,0,s-p))),c+=f.attrs.rowspan-1}}return a}function uu(n,e,t,r,o){let i=t?n.doc.nodeAt(t-1):n.doc;if(!i)throw new Error("No table found");let s=ne.get(i),{top:l,left:a}=r,c=a+o.width,u=l+o.height,d=n.tr,f=0;function p(){if(i=t?d.doc.nodeAt(t-1):d.doc,!i)throw new Error("No table found");s=ne.get(i),f=d.mapping.maps.length}Ob(d,s,i,t,c,u,f)&&p(),au(d,s,i,t,a,c,l,f)&&p(),au(d,s,i,t,a,c,u,f)&&p(),cu(d,s,i,t,l,u,a,f)&&p(),cu(d,s,i,t,l,u,c,f)&&p();for(let h=l;h<u;h++){let m=s.positionAt(h,a,i),b=s.positionAt(h,c,i);d.replace(d.mapping.slice(f).map(m+t),d.mapping.slice(f).map(b+t),new N(o.rows[h-l],0,0))}p(),d.setSelection(new G(d.doc.resolve(t+s.positionAt(l,a,i)),d.doc.resolve(t+s.positionAt(u-1,c-1,i)))),e(d)}function mo(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function po(n,e){return(t,r,o)=>{if(!o)return!1;let i=t.selection;if(i instanceof G)return mo(t,r,B.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;let s=Lu(o,n,e);if(s==null)return!1;if(n=="horiz")return mo(t,r,B.near(t.doc.resolve(i.head+e),e));{let l=t.doc.resolve(s),a=gu(l,n,e),c;return a?c=B.near(a,1):e<0?c=B.near(t.doc.resolve(l.before(-1)),-1):c=B.near(t.doc.resolve(l.after(-1)),1),mo(t,r,c)}}}function ho(n,e){return(t,r,o)=>{if(!o)return!1;let i=t.selection,s;if(i instanceof G)s=i;else{let a=Lu(o,n,e);if(a==null)return!1;s=new G(t.doc.resolve(a))}let l=gu(s.$headCell,n,e);return l?mo(t,r,new G(s.$anchorCell,l)):!1}}function Db(n,e){let t=n.state.doc,r=Jt(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new G(r))),!0):!1}function Rb(n,e,t){if(!Y(n.state))return!1;let r=Ab(t),o=n.state.selection;if(o instanceof G){r||(r={width:1,height:1,rows:[E.from(hs(we(n.state.schema).cell,t))]});let i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),l=ne.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=Nb(r,l.right-l.left,l.bottom-l.top),uu(n.state,n.dispatch,s,l,r),!0}else if(r){let i=bo(n.state),s=i.start(-1);return uu(n.state,n.dispatch,s,ne.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function Ib(n,e){var t;if(e.button!=0||e.ctrlKey||e.metaKey)return;let r=du(n,e.target),o;if(e.shiftKey&&n.state.selection instanceof G)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Jt(n.state.selection.$anchor))!=null&&((t=us(n,e))===null||t===void 0?void 0:t.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(a,c){let u=us(n,c),d=Nt.getState(n.state)==null;if(!u||!gs(a,u))if(d)u=a;else return;let f=new G(a,u);if(d||!n.state.selection.eq(f)){let p=n.state.tr.setSelection(f);d&&p.setMeta(Nt,a.pos),n.dispatch(p)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),Nt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Nt,-1))}function l(a){let c=a,u=Nt.getState(n.state),d;if(u!=null)d=n.state.doc.resolve(u);else if(du(n,c.target)!=r&&(d=us(n,e),!d))return s();d&&i(d,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function Lu(n,e,t){if(!(n.state.selection instanceof P))return null;let{$head:r}=n.state.selection;for(let o=r.depth-1;o>=0;o--){let i=r.node(o);if((t<0?r.index(o):r.indexAfter(o))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let s=r.before(o),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?s:null}}return null}function du(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function us(n,e){let t=n.posAtCoords({left:e.clientX,top:e.clientY});if(!t)return null;let{inside:r,pos:o}=t;return r>=0&&Jt(n.state.doc.resolve(r))||Jt(n.state.doc.resolve(o))}function ms(n,e,t,r,o,i){let s=0,l=!0,a=e.firstChild,c=n.firstChild;if(c){for(let d=0,f=0;d<c.childCount;d++){let{colspan:p,colwidth:h}=c.child(d).attrs;for(let m=0;m<p;m++,f++){let b=o==f?i:h&&h[m],g=b?b+"px":"";if(s+=b||r,b||(l=!1),a)a.style.width!=g&&(a.style.width=g),a=a.nextSibling;else{let y=document.createElement("col");y.style.width=g,e.appendChild(y)}}}for(;a;){var u;let d=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=d}l?(t.style.width=s+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=s+"px")}}function Du({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=ys,lastColumnResizable:o=!0}={}){let i=new _({key:Fe,state:{init(s,l){var a;let c=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=we(l.schema).table.name;return r&&c&&(c[u]=(d,f)=>new r(d,t,f)),new Pb(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{let l=Fe.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{Bb(s,l,n,o)},mouseleave:s=>{zb(s)},mousedown:(s,l)=>{Hb(s,l,e,t)}},decorations:s=>{let l=Fe.getState(s);if(l&&l.activeHandle>-1)return qb(s,l.activeHandle)},nodeViews:{}}});return i}function Bb(n,e,t,r){if(!n.editable)return;let o=Fe.getState(n.state);if(o&&!o.dragging){let i=$b(e.target),s=-1;if(i){let{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=fu(n,e,"left",t):a-e.clientX<=t&&(s=fu(n,e,"right",t))}if(s!=o.activeHandle){if(!r&&s!==-1){let l=n.state.doc.resolve(s),a=l.node(-1),c=ne.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Ru(n,s)}}}function zb(n){if(!n.editable)return;let e=Fe.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Ru(n,-1)}function Hb(n,e,t,r){var o;if(!n.editable)return!1;let i=(o=n.dom.ownerDocument.defaultView)!==null&&o!==void 0?o:window,s=Fe.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let l=n.state.doc.nodeAt(s.activeHandle),a=Fb(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(Fe,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);let f=Fe.getState(n.state);f?.dragging&&(_b(n,f.activeHandle,pu(f.dragging,d,t)),n.dispatch(n.state.tr.setMeta(Fe,{setDragging:null})))}function u(d){if(!d.which)return c(d);let f=Fe.getState(n.state);if(f&&f.dragging){let p=pu(f.dragging,d,t);hu(n,f.activeHandle,p,r)}}return hu(n,s.activeHandle,a,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function Fb(n,e,{colspan:t,colwidth:r}){let o=r&&r[r.length-1];if(o)return o;let i=n.domAtPos(e),s=i.node.childNodes[i.offset].offsetWidth,l=t;if(r)for(let a=0;a<t;a++)r[a]&&(s-=r[a],l--);return s/l}function $b(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function fu(n,e,t,r){let o=t=="right"?-r:r,i=n.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;let{pos:s}=i,l=Jt(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;let a=ne.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function pu(n,e,t){let r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function Ru(n,e){n.dispatch(n.state.tr.setMeta(Fe,{setHandle:e}))}function _b(n,e,t){let r=n.state.doc.resolve(e),o=r.node(-1),i=ne.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<i.height;c++){let u=c*i.width+l;if(c&&i.map[u]==i.map[u-i.width])continue;let d=i.map[u],f=o.nodeAt(d).attrs,p=f.colspan==1?0:l-i.colCount(d);if(f.colwidth&&f.colwidth[p]==t)continue;let h=f.colwidth?f.colwidth.slice():Vb(f.colspan);h[p]=t,a.setNodeMarkup(s+d,null,{...f,colwidth:h})}a.docChanged&&n.dispatch(a)}function hu(n,e,t,r){let o=n.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),l=ne.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=n.domAtPos(o.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&ms(i,a.firstChild,a,r,l,t)}function Vb(n){return Array(n).fill(0)}function qb(n,e){let t=[],r=n.doc.resolve(e),o=r.node(-1);if(!o)return K.empty;let i=ne.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){let u=l+c*i.width;if((l==i.width-1||i.map[u]!=i.map[u+1])&&(c==0||i.map[u]!=i.map[u-i.width])){var a;let d=i.map[u],f=s+d+o.nodeAt(d).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",!((a=Fe.getState(n))===null||a===void 0)&&a.dragging&&t.push(ee.node(s+d,s+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),t.push(ee.widget(f,p))}}return K.create(n.doc,t)}function Iu({allowTableNodeSelection:n=!1}={}){return new _({key:Nt,state:{init(){return null},apply(e,t){let r=e.getMeta(Nt);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;let{deleted:o,pos:i}=e.mapping.mapResult(t);return o?null:i}},props:{decorations:fb,handleDOMEvents:{mousedown:Ib},createSelectionBetween(e){return Nt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Db,handleKeyDown:Lb,handlePaste:Rb},appendTransaction(e,t,r){return mb(r,bb(r,t),n)}})}var ds,fs,ne,Nt,G,db,gb,k1,M1,S1,Lb,ys,Fe,Pb,vs=O(()=>{"use strict";U();le();Tt();at();Je();if(typeof WeakMap<"u"){let n=new WeakMap;ds=e=>n.get(e),fs=(e,t)=>(n.set(e,t),t)}else{let n=[],t=0;ds=r=>{for(let o=0;o<n.length;o+=2)if(n[o]==r)return n[o+1]},fs=(r,o)=>(t==10&&(t=0),n[t++]=r,n[t++]=o)}ne=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){let t=this.map[e];if(t!=n)continue;let r=e%this.width,o=e/this.width|0,i=r+1,s=o+1;for(let l=1;i<this.width&&this.map[e+l]==t;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:r,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){let{left:r,right:o,top:i,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?r==0:o==this.width)?null:this.map[i*this.width+(t<0?r-1:o)]:(t<0?i==0:s==this.height)?null:this.map[r+this.width*(t<0?i-1:s)]}rectBetween(n,e){let{left:t,right:r,top:o,bottom:i}=this.findCell(n),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(o,a),right:Math.max(r,l),bottom:Math.max(i,c)}}cellsInRect(n){let e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let o=n.left;o<n.right;o++){let i=r*this.width+o,s=this.map[i];t[s]||(t[s]=!0,!(o==n.left&&o&&this.map[i-1]==s||r==n.top&&r&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let r=0,o=0;;r++){let i=o+t.child(r).nodeSize;if(r==n){let s=e+n*this.width,l=(n+1)*this.width;for(;s<l&&this.map[s]<o;)s++;return s==l?i-1:this.map[s]}o=i}}static get(n){return ds(n)||fs(n,nb(n))}};Nt=new j("selectingCells");G=class ut extends B{constructor(e,t=e){let r=e.node(-1),o=ne.get(r),i=e.start(-1),s=o.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=o.cellsInRect(s).filter(u=>u!=t.pos-i);a.unshift(t.pos-i);let c=a.map(u=>{let d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);let f=i+u+1;return new xt(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){let r=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(ps(r)&&ps(o)&&gs(r,o)){let i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ut.rowSelection(r,o):i&&this.isColSelection()?ut.colSelection(r,o):new ut(r,o)}return P.between(r,o)}content(){let e=this.$anchorCell.node(-1),t=ne.get(e),r=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let a=o.top;a<o.bottom;a++){let c=[];for(let u=a*t.width+o.left,d=o.left;d<o.right;d++,u++){let f=t.map[u];if(i[f])continue;i[f]=!0;let p=t.findCell(f),h=e.nodeAt(f);if(!h)throw new RangeError(`No cell with offset ${f} found`);let m=o.left-p.left,b=p.right-o.right;if(m>0||b>0){let g=h.attrs;if(m>0&&(g=Gt(g,0,m)),b>0&&(g=Gt(g,g.colspan-b,b)),p.left<o.left){if(h=h.type.createAndFill(g),!h)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(g)}`)}else h=h.type.create(g,h.content)}if(p.top<o.top||p.bottom>o.bottom){let g={...h.attrs,rowspan:Math.min(p.bottom,o.bottom)-Math.max(p.top,o.top)};p.top<o.top?h=h.type.createAndFill(g):h=h.type.create(g,h.content)}c.push(h)}s.push(e.child(a).copy(E.from(c)))}let l=this.isColSelection()&&this.isRowSelection()?e:s;return new N(E.from(l),1,1)}replace(e,t=N.empty){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:a}=o[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?N.empty:t)}let i=B.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new N(E.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),r=ne.get(t),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)e(t.nodeAt(i[s]),o+i[s])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){let r=e.node(-1),o=ne.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+o.map[s.left])),l.bottom<o.height&&(t=a.resolve(i+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(i+o.map[l.left])),s.bottom<o.height&&(e=a.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new ut(e,t)}isRowSelection(){let e=this.$anchorCell.node(-1),t=ne.get(e),r=this.$anchorCell.start(-1),o=t.colCount(this.$anchorCell.pos-r),i=t.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return!1;let s=o+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof ut&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){let r=e.node(-1),o=ne.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+o.map[s.top*o.width])),l.right<o.width&&(t=a.resolve(i+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(i+o.map[l.top*o.width])),s.right<o.width&&(e=a.resolve(i+o.map[o.width*(s.top+1)-1]))),new ut(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new ut(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new ut(e.resolve(t),e.resolve(r))}getBookmark(){return new db(this.$anchorCell.pos,this.$headCell.pos)}};G.prototype.visible=!1;B.jsonID("cell",G);db=class yu{constructor(e,t){this.anchor=e,this.head=t}map(e){return new yu(e.map(this.anchor),e.map(this.head))}resolve(e){let t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&gs(t,r)?new G(t,r):B.near(r,1)}};gb=new j("fix-tables");k1=En("row",{useDeprecatedLogic:!0}),M1=En("column",{useDeprecatedLogic:!0}),S1=En("cell",{useDeprecatedLogic:!0});Lb=ar({ArrowLeft:po("horiz",-1),ArrowRight:po("horiz",1),ArrowUp:po("vert",-1),ArrowDown:po("vert",1),"Shift-ArrowLeft":ho("horiz",-1),"Shift-ArrowRight":ho("horiz",1),"Shift-ArrowUp":ho("vert",-1),"Shift-ArrowDown":ho("vert",1),Backspace:fo,"Mod-Backspace":fo,Delete:fo,"Mod-Delete":fo});ys=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ms(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,ms(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};Fe=new j("tableColumnResizing");Pb=class go{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){let t=this,r=e.getMeta(Fe);if(r&&r.setHandle!=null)return new go(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new go(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return ps(e.doc.resolve(o))||(o=-1),new go(o,t.dragging)}return t}}});function Pu(n){let t=n.replace(/[\u0000- \u007f-\u009f]/g,"").match(/^([a-z][a-z0-9+.-]*):/i);return t?`${t[1].toLowerCase()}:`:null}function Le(n){let e=Pu(n);return e===null||Wb.has(e)}function De(n){if(jb.test(n.trim()))return!0;let e=Pu(n);return e===null||Ub.has(e)}var Wb,Ub,jb,dt=O(()=>{"use strict";Wb=new Set(["http:","https:","mailto:","tel:"]),Ub=new Set(["http:","https:","blob:"]),jb=/^data:image\/(png|jpe?g|gif|webp|avif|bmp);base64,/i});function Yb(n){let e=n.trim().toLowerCase(),t=e.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(1|1\.0+)\s*)?\)$/);if(t)return"#"+t.slice(1,4).map(o=>Math.min(255,Number(o)).toString(16).padStart(2,"0")).join("");let r=e.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/);return r?`#${r[1]}${r[1]}${r[2]}${r[2]}${r[3]}${r[3]}`:e}function Qb(n){let e=n.getAttribute("dir")?.toLowerCase();return e==="rtl"||e==="ltr"?e:null}function Bu(n){let e=n.style.textAlign;return{align:Vu.includes(e)?e:null,lineHeight:Q.lineHeight(n.style.lineHeight),dir:Qb(n)}}function zu(n){let e={};(n.dir==="rtl"||n.dir==="ltr")&&(e.dir=n.dir);let t=[],r=n.align;r&&Vu.includes(r)&&t.push(`text-align: ${r};`);let o=Q.lineHeight(n.lineHeight);return o&&t.push(`line-height: ${o};`),t.length&&(e.style=t.join(" ")),e}function Fu(n,e,t){let r=n.style.listStyleType.toLowerCase(),o=Zb[n.getAttribute("type")??""]??"",i=e.includes(r)?r:e.includes(o)?o:null;return i===t?null:i}function $u(n,e){return typeof n=="string"&&e.includes(n)?{style:`list-style-type: ${n};`}:{}}function ty(n){let e=n.style.float||n.getAttribute("align");return e==="left"||e==="right"?e:n.style.display==="block"&&n.style.marginLeft==="auto"&&n.style.marginRight==="auto"?"center":null}function Re(n){if(n==null||n==="")return null;let e=String(n).trim().match(/^(\d{1,5})(px)?$/);if(!e)return null;let t=Number(e[1]);return t>=1&&t<=1e4?t:null}function ny(n){let e=[],t=Q.length(n.width);return t&&e.push(`width: ${t};`),n.align==="center"?e.push("margin-left: auto; margin-right: auto;"):n.align==="right"&&e.push("margin-left: auto;"),e.join(" ")}function oy(){let n=mu({tableGroup:"block",cellContent:"block+",cellAttributes:{background:{default:null,getFromDOM:e=>Q.color(e.getAttribute("data-nova-cell-bg")??e.style.backgroundColor),setDOMAttr:(e,t)=>{let r=Q.color(e);r&&(t.style=`${t.style??""}background-color: ${r};`)}},valign:{default:null,getFromDOM:e=>{let t=e,r=(t.style.verticalAlign||t.getAttribute("valign")||"").toLowerCase();return _u.includes(r)?r:null},setDOMAttr:(e,t)=>{_u.includes(e)&&(t.style=`${t.style??""}vertical-align: ${e};`)}}}});n.table.attrs={width:{default:null},align:{default:null}},n.table.parseDOM=[{tag:"table",getAttrs:e=>{let t=e,r=Q.length(t.style.width)??Q.length(`${t.getAttribute("width")??""}px`),o=s=>s==="auto",i=t.getAttribute("align")==="center"||o(t.style.marginLeft)&&o(t.style.marginRight)?"center":t.getAttribute("align")==="right"||o(t.style.marginLeft)?"right":null;return{width:r,align:i}}}],n.table.toDOM=e=>{let t=ny(e.attrs);return["table",t?{style:t}:{},["tbody",0]]};for(let e of["table_cell","table_header"]){let t=n[e],r=t.parseDOM[0],o=r.getAttrs;r.getAttrs=s=>{let l=o(s);if(!l)return l;let a=c=>Math.min(ry,Math.max(1,Number.isFinite(c)?Math.floor(c):1));return{...l,colspan:a(l.colspan),rowspan:a(l.rowspan)}};let i=t.toDOM;t.toDOM=s=>{let l=i(s),a=s.attrs.colwidth;if(a?.every(c=>c>0)){let c=a.reduce((d,f)=>d+f,0),u=l[1].style?` ${l[1].style}`:"";l[1]={...l[1],style:`width: ${c}px;${u}`}}return l}}return n}function fr(n){return n?{value:n}:!1}function vo(n,e){return e?["span",{style:`${n}: ${e};`},0]:["span",0]}function ks(n={}){let e=Object.entries(n.nodes??{}),t=Object.entries(n.marks??{});if(!e.length&&!t.length)return Xt;for(let[r]of e)if(r in ws)throw new Error(`[nova] node "${r}" already exists in the base schema`);for(let[r]of t)if(r in xs)throw new Error(`[nova] mark "${r}" already exists in the base schema`);return new Vn({nodes:{...ws,...Object.fromEntries(e)},marks:{...xs,...Object.fromEntries(t)}})}var Vu,Kb,Jb,Gb,Xb,Q,Hu,wo,xo,Zb,ey,_u,ry,ws,xs,Xt,ft=O(()=>{"use strict";le();vs();dt();Vu=["left","center","right","justify"],Kb=/^(#[0-9a-f]{3,8}|rgba?\(\s*[\d.]+%?\s*,\s*[\d.]+%?\s*,\s*[\d.]+%?\s*(,\s*[\d.]+%?\s*)?\)|[a-z]{3,20})$/i,Jb=/^\d{1,4}(\.\d{1,3})?(px|pt|em|rem|%)$/,Gb=/^\d{1,2}(\.\d{1,3})?(px|em|%)?$/,Xb=/^[\w\s,'"-]{1,200}$/;Q={color:n=>typeof n=="string"&&Kb.test(n.trim())&&!/^(inherit|initial|unset|currentcolor|transparent|windowtext|window|auto|none)$/i.test(n.trim())?Yb(n):null,length:n=>typeof n=="string"&&Jb.test(n.trim())?n.trim():null,lineHeight:n=>typeof n=="string"&&Gb.test(n.trim())&&n.trim()!=="normal"?n.trim():null,fontFamily:n=>typeof n=="string"&&Xb.test(n.trim())?n.trim():null};Hu={align:{default:null},lineHeight:{default:null},dir:{default:null}},wo=["disc","circle","square"],xo=["decimal","lower-alpha","upper-alpha","lower-roman","upper-roman","lower-greek"],Zb={1:"decimal",a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman"};ey={left:"float: left; margin: 0 1em 1em 0;",right:"float: right; margin: 0 0 1em 1em;",center:"display: block; margin-left: auto; margin-right: auto;"};_u=["top","middle","bottom"];ry=100;ws={doc:{content:"block+"},paragraph:{group:"block",content:"inline*",attrs:{...Hu},parseDOM:[{tag:"p",getAttrs:n=>Bu(n)}],toDOM:n=>["p",zu(n.attrs),0]},heading:{group:"block",content:"inline*",defining:!0,attrs:{level:{default:1},...Hu},parseDOM:[1,2,3,4,5,6].map(n=>({tag:`h${n}`,getAttrs:e=>({level:n,...Bu(e)})})),toDOM:n=>[`h${n.attrs.level}`,zu(n.attrs),0]},blockquote:{group:"block",content:"block+",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["hr"]},code_block:{group:"block",content:"text*",marks:"",code:!0,defining:!0,attrs:{language:{default:null}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:n=>({language:n.querySelector("code")?.className.match(/language-([\w-]+)/)?.[1]??null})}],toDOM:n=>["pre",["code",n.attrs.language?{class:`language-${n.attrs.language}`}:{},0]]},bullet_list:{group:"block",content:"list_item+",attrs:{listStyle:{default:null}},parseDOM:[{tag:"ul",getAttrs:n=>({listStyle:Fu(n,wo,"disc")})}],toDOM:n=>["ul",$u(n.attrs.listStyle,wo),0]},ordered_list:{group:"block",content:"list_item+",attrs:{start:{default:1},listStyle:{default:null}},parseDOM:[{tag:"ol",getAttrs:n=>{let e=n.getAttribute("start");return{start:e?Number(e):1,listStyle:Fu(n,xo,"decimal")}}}],toDOM:n=>["ol",{...n.attrs.start===1?{}:{start:n.attrs.start},...$u(n.attrs.listStyle,xo)},0]},list_item:{content:"paragraph block*",defining:!0,parseDOM:[{tag:"li"}],toDOM:()=>["li",0]},text:{group:"inline"},image:{group:"inline",inline:!0,draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null},width:{default:null},height:{default:null},align:{default:null}},parseDOM:[{tag:"img[src]",getAttrs:n=>{let e=n;return De(e.getAttribute("src")??"")?{src:e.getAttribute("src"),alt:e.getAttribute("alt"),title:e.getAttribute("title"),width:Re(e.getAttribute("width")??e.style.width),height:Re(e.getAttribute("height")??e.style.height),align:ty(e)}:!1}}],toDOM:n=>{let{alt:e,title:t}=n.attrs,r=De(n.attrs.src)?n.attrs.src:"",o=Re(n.attrs.width),i=Re(n.attrs.height),s=ey[n.attrs.align];return["img",{src:r,...e?{alt:e}:{},...t?{title:t}:{},...o?{width:String(o)}:{},...i?{height:String(i)}:{},...s?{style:s}:{}}]}},hard_break:{group:"inline",inline:!0,selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]},...oy()},xs={link:{attrs:{href:{},title:{default:null},target:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:n=>{let e=n;return Le(e.getAttribute("href")??"")?{href:e.getAttribute("href"),title:e.getAttribute("title"),target:e.getAttribute("target")}:!1}}],toDOM:n=>{let{title:e,target:t}=n.attrs;return["a",{href:Le(n.attrs.href)?n.attrs.href:"#",...e?{title:e}:{},...t?{target:t,rel:"noopener noreferrer"}:{}},0]}},bold:{parseDOM:[{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}],toDOM:()=>["strong",0]},italic:{parseDOM:[{tag:"em"},{tag:"i"},{style:"font-style=italic"}],toDOM:()=>["em",0]},underline:{parseDOM:[{tag:"u"},{style:"text-decoration=underline"}],toDOM:()=>["u",0]},strike:{parseDOM:[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration=line-through"}],toDOM:()=>["s",0]},code:{parseDOM:[{tag:"code"}],toDOM:()=>["code",0]},subscript:{excludes:"superscript",parseDOM:[{tag:"sub"},{style:"vertical-align=sub"}],toDOM:()=>["sub",0]},superscript:{excludes:"subscript",parseDOM:[{tag:"sup"},{style:"vertical-align=super"}],toDOM:()=>["sup",0]},color:{attrs:{value:{}},parseDOM:[{style:"color",getAttrs:n=>fr(Q.color(n))},{tag:"font[color]",getAttrs:n=>fr(Q.color(n.getAttribute("color")))}],toDOM:n=>vo("color",Q.color(n.attrs.value))},background:{attrs:{value:{}},parseDOM:[{style:"background-color",getAttrs:n=>fr(Q.color(n))},{tag:"mark",getAttrs:()=>({value:"yellow"})}],toDOM:n=>vo("background-color",Q.color(n.attrs.value))},font_family:{attrs:{value:{}},parseDOM:[{style:"font-family",getAttrs:n=>fr(Q.fontFamily(n))}],toDOM:n=>vo("font-family",Q.fontFamily(n.attrs.value))},font_size:{attrs:{value:{}},parseDOM:[{style:"font-size",getAttrs:n=>fr(Q.length(n))}],toDOM:n=>vo("font-size",Q.length(n.attrs.value))}};Xt=new Vn({nodes:ws,marks:xs})});var Yu={};Be(Yu,{default:()=>fy});function Xu(n,e){let{state:t,dispatch:r}=n.view;r(t.tr.insertText(e).scrollIntoView()),n.focus()}var Ju,Gu,dy,fy,Qu=O(()=>{"use strict";Ju='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="2"/><path d="M3 10h18M8 3v4M16 3v4"/><path d="M12 13v3l2 1"/></svg>',Gu={en:{title:"Insert date/time",date:"Date",time:"Time",dateTime:"Date and time",long:"Long date"},ru:{title:"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0434\u0430\u0442\u0443/\u0432\u0440\u0435\u043C\u044F",date:"\u0414\u0430\u0442\u0430",time:"\u0412\u0440\u0435\u043C\u044F",dateTime:"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",long:"\u0414\u0430\u0442\u0430 \u043F\u0440\u043E\u043F\u0438\u0441\u044C\u044E"}},dy={date:{dateStyle:"short"},long:{dateStyle:"long"},time:{timeStyle:"short"},dateTime:{dateStyle:"short",timeStyle:"short"}};fy={name:"insertdatetime",toolbar:"insertdatetime",setup(n){let e=n.options.language??"en",t=Gu[e.split("-")[0]]??Gu.en,r=()=>n.options.pluginOptions?.insertdatetime?.now?.()??new Date,o=i=>new Intl.DateTimeFormat(e,dy[i]).format(r());n.ui.registry.addMenuItem("insertdatetime",{text:t.title,icon:Ju,onAction:i=>Xu(i,o("dateTime"))}),n.ui.registry.addMenuButton("insertdatetime",{icon:Ju,tooltip:t.title,items:i=>["date","long","time","dateTime"].map(s=>{let l=o(s);return{id:s,label:`${t[s]}: ${l}`,onSelect:()=>Xu(i,l)}})})}}});function py(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}function An(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}function td(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function gy(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}function nd(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}function Ss(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function ky(n){return(e,t)=>{if(e.selection instanceof R&&e.selection.node.isBlock){let{$from:p}=e.selection;return!p.parentOffset||!wt(e.doc,p.pos)?!1:(t&&t(e.tr.split(p.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof P||e.selection instanceof pe)&&r.deleteSelection();let{$from:o}=r.selection,i=r.steps.length,s=[],l,a,c=!1,u=!1;for(let p=o.depth;;p--)if(o.node(p).isBlock){c=o.end(p)==o.pos+(o.depth-p),u=o.start(p)==o.pos-(o.depth-p),a=Ss(o.node(p-1).contentMatchAt(o.indexAfter(p-1)));let m=n&&n(o.parent,c,o);s.unshift(m||(c&&a?{type:a}:null)),l=p;break}else{if(p==1)return!1;s.unshift(null)}let d=o.pos,f=wt(r.doc,d,s.length,s);if(f||(s[0]=a?{type:a}:null,f=wt(r.doc,d,s.length,s)),!f)return!1;if(r.split(d,s.length,s),!c&&u&&o.node(l).type!=a){let p=r.mapping.slice(i),h=p.map(o.before(l)),m=r.doc.resolve(h);a&&o.node(l-1).canReplaceWith(m.index(),m.index()+1,a)&&r.setNodeMarkup(p.map(o.before(l)),a)}return t&&t(r.scrollIntoView()),!0}}function Cy(n,e,t){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||Ft(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function od(n,e,t,r){let o=e.nodeBefore,i=e.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&Cy(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(t){let p=e.pos+i.nodeSize,h=E.empty;for(let g=s.length-1;g>=0;g--)h=E.from(s[g].create(null,h));h=E.from(o.copy(h));let m=n.tr.step(new fe(e.pos-1,p,e.pos,p,new N(h,1,0),s.length,!0)),b=m.doc.resolve(p+2*s.length);b.nodeAfter&&b.nodeAfter.type==o.type&&Ft(m.doc,b.pos)&&m.join(b.pos),t(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&a?null:B.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Ht(d);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(d,f).scrollIntoView()),!0;if(c&&An(i,"start",!0)&&An(o,"end")){let p=o,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=i,b=1;for(;!m.isTextblock;m=m.firstChild)b++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(t){let g=E.empty;for(let x=h.length-1;x>=0;x--)g=E.from(h[x].copy(g));let y=n.tr.step(new fe(e.pos-h.length,e.pos+i.nodeSize,e.pos+b,e.pos+i.nodeSize-b,new N(g,h.length,0),0,!0));t(y.scrollIntoView())}return!0}}return!1}function id(n){return function(e,t){let r=e.selection,o=n<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(t&&t(e.tr.setSelection(P.create(e.doc,n<0?o.start(i):o.end(i)))),!0):!1}}function sd(n,e=null){return function(t,r){let{$from:o,$to:i}=t.selection,s=o.blockRange(i),l=s&&fn(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Es(n,e=null){return function(t,r){let o=!1;for(let i=0;i<t.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(s,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)o=!0;else{let u=t.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,n)}})}if(!o)return!1;if(r){let i=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];i.setBlockType(l,a,n,e)}r(i.scrollIntoView())}return!0}}function Ty(n,e,t,r){for(let o=0;o<e.length;o++){let{$from:i,$to:s}=e[o],l=i.depth==0?n.inlineContent&&n.type.allowsMarkType(t):!1;if(n.nodesBetween(i.pos,s.pos,(a,c)=>{if(l||!r&&a.isAtom&&a.isInline&&c>=i.pos&&c+a.nodeSize<=s.pos)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function Ny(n){let e=[];for(let t=0;t<n.length;t++){let{$from:r,$to:o}=n[t];r.doc.nodesBetween(r.pos,o.pos,(i,s)=>{if(i.isAtom&&i.content.size&&i.isInline&&s>=r.pos&&s+i.nodeSize<=o.pos)return s+1>r.pos&&e.push(new xt(r,r.doc.resolve(s+1))),r=r.doc.resolve(s+1+i.content.size),!1}),r.pos<o.pos&&e.push(new xt(r,o))}return e}function Ot(n,e=null,t){let r=(t&&t.removeWhenPresent)!==!1,o=(t&&t.enterInlineAtoms)!==!1,i=!(t&&t.includeWhitespace);return function(s,l){let{empty:a,$cursor:c,ranges:u}=s.selection;if(a&&!c||!Ty(s.doc,u,n,o))return!1;if(l)if(c)n.isInSet(s.storedMarks||c.marks())?l(s.tr.removeStoredMark(n)):l(s.tr.addStoredMark(n.create(e)));else{let d,f=s.tr;o||(u=Ny(u)),r?d=!u.some(p=>s.doc.rangeHasMark(p.$from.pos,p.$to.pos,n)):d=!u.every(p=>{let h=!1;return f.doc.nodesBetween(p.$from.pos,p.$to.pos,(m,b,g)=>{if(h)return!1;h=!n.isInSet(m.marks)&&!!g&&g.type.allowsMarkType(n)&&!(m.isText&&/^\s*$/.test(m.textBetween(Math.max(0,p.$from.pos-b),Math.min(m.nodeSize,p.$to.pos-b))))}),!h});for(let p=0;p<u.length;p++){let{$from:h,$to:m}=u[p];if(!d)f.removeMark(h.pos,m.pos,n);else{let b=h.pos,g=m.pos,y=h.nodeAfter,x=m.nodeBefore,A=i&&y&&y.isText?/^\s*/.exec(y.text)[0].length:0,L=i&&x&&x.isText?/\s*$/.exec(x.text)[0].length:0;b+A<g&&(b+=A,g-=L),f.addMark(b,g,n.create(e))}}l(f.scrollIntoView())}return!0}}function pr(...n){return function(e,t,r){for(let o=0;o<n.length;o++)if(n[o](e,t,r))return!0;return!1}}var ed,hy,my,by,yy,rd,vy,Cs,wy,xy,My,Sy,Ey,Ay,Ms,Zu,pt,ld,Oy,ad,As=O(()=>{"use strict";Je();le();U();ed=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);hy=(n,e,t)=>{let r=py(n,t);if(!r)return!1;let o=td(r);if(!o){let s=r.blockRange(),l=s&&Ht(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(od(n,o,e,-1))return!0;if(r.parent.content.size==0&&(An(i,"end")||R.isSelectable(i)))for(let s=r.depth;;s--){let l=_r(n.doc,r.before(s),r.after(s),N.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(An(i,"end")?B.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):R.create(a.doc,o.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};my=(n,e,t)=>{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;i=td(r)}let s=i&&i.nodeBefore;return!s||!R.isSelectable(s)?!1:(e&&e(n.tr.setSelection(R.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};by=(n,e,t)=>{let r=gy(n,t);if(!r)return!1;let o=nd(r);if(!o)return!1;let i=o.nodeAfter;if(od(n,o,e,1))return!0;if(r.parent.content.size==0&&(An(i,"start")||R.isSelectable(i))){let s=_r(n.doc,r.before(),r.after(),N.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(An(i,"start")?B.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):R.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},yy=(n,e,t)=>{let{$head:r,empty:o}=n.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;i=nd(r)}let s=i&&i.nodeAfter;return!s||!R.isSelectable(s)?!1:(e&&e(n.tr.setSelection(R.create(n.doc,i.pos)).scrollIntoView()),!0)};rd=(n,e)=>{let{$from:t,$to:r}=n.selection,o=t.blockRange(r),i=o&&Ht(o);return i==null?!1:(e&&e(n.tr.lift(o,i).scrollIntoView()),!0)},vy=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
10
+ `).scrollIntoView()),!0)};Cs=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let o=t.node(-1),i=t.indexAfter(-1),s=Ss(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(B.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},wy=(n,e)=>{let t=n.selection,{$from:r,$to:o}=t;if(t instanceof pe||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Ss(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=n.tr.insert(s,i.createAndFill());l.setSelection(P.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},xy=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(wt(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let r=t.blockRange(),o=r&&Ht(r);return o==null?!1:(e&&e(n.tr.lift(r,o).scrollIntoView()),!0)};My=ky(),Sy=(n,e)=>(e&&e(n.tr.setSelection(new pe(n.doc))),!0);Ey=id(-1),Ay=id(1);Ms=pr(ed,hy,my),Zu=pr(ed,by,yy),pt={Enter:pr(vy,wy,xy,My),"Mod-Enter":Cs,Backspace:Ms,"Mod-Backspace":Ms,"Shift-Backspace":Ms,Delete:Zu,"Mod-Delete":Zu,"Mod-a":Sy},ld={"Ctrl-h":pt.Backspace,"Alt-Backspace":pt["Mod-Backspace"],"Ctrl-d":pt.Delete,"Ctrl-Alt-Backspace":pt["Mod-Delete"],"Alt-Delete":pt["Mod-Delete"],"Alt-d":pt["Mod-Delete"],"Ctrl-a":Ey,"Ctrl-e":Ay};for(let n in pt)ld[n]=pt[n];Oy=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,ad=Oy?ld:pt});var Mo,me,cd,Ly,Ts,ud=O(()=>{"use strict";Mo=200,me=function(){};me.prototype.append=function(e){return e.length?(e=me.from(e),!this.length&&e||e.length<Mo&&this.leafAppend(e)||this.length<Mo&&e.leafPrepend(this)||this.appendInner(e)):this};me.prototype.prepend=function(e){return e.length?me.from(e).append(this):this};me.prototype.appendInner=function(e){return new Ly(this,e)};me.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?me.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};me.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};me.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};me.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},t,r),o};me.from=function(e){return e instanceof me?e:e&&e.length?new cd(e):me.empty};cd=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,l){for(var a=i-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Mo)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Mo)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(me);me.empty=new cd([]);Ly=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,i,s){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(o,l),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(me),Ts=me});function Ry(n,e){let t;return n.forEach((r,o)=>{if(r.selection&&e--==0)return t=o,!1}),n.slice(t)}function Py(n,e,t,r){let o=t.getMeta(Yt),i;if(o)return o.historyState;t.getMeta(hd)&&(n=new Qe(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(Yt))return s.getMeta(Yt).redo?new Qe(n.done.addTransform(t,void 0,r,So(e)),n.undone,dd(t.mapping.maps),n.prevTime,n.prevComposition):new Qe(n.done,n.undone.addTransform(t,void 0,r,So(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!By(t,n.prevRanges)),c=s?Ns(n.prevRanges,t.mapping):dd(t.mapping.maps);return new Qe(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,So(e)),Qt.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new Qe(n.done.rebased(t,i),n.undone.rebased(t,i),Ns(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Qe(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ns(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function By(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(t=!0)}),t}function dd(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,o,i,s)=>e.push(i,s));return e}function Ns(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let o=e.map(n[r],1),i=e.map(n[r+1],-1);o<=i&&t.push(o,i)}return t}function zy(n,e){for(let t=0;t<e.steps.length;t++){let r=e.mapping.maps[t],o=-1;if(r.forEach((i,s)=>o=s),o<0){let i=e.steps[t];(i instanceof zt||i instanceof vt)&&(o=i.to)}if(o>-1)return B.near(n.doc.resolve(o))}return n.selection}function Hy(n,e,t){let r=So(e),o=Yt.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,zy(e,i.transform).getBookmark(),o,r),a=new Qe(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(Yt,{redo:t,historyState:a})}function So(n){let e=n.plugins;if(fd!=e){Os=!1,fd=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Os=!0;break}}return Os}function pd(n){return n.setMeta(hd,!0)}function md(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new _({key:Yt,state:{init(){return new Qe(Qt.empty,Qt.empty,null,0,-1)},apply(e,t,r){return Py(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,o=r=="historyUndo"?Ls:r=="historyRedo"?Ds:null;return!o||!e.editable?!1:(t.preventDefault(),o(e.state,e.dispatch))}}}})}function Co(n,e){return(t,r)=>{let o=Yt.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(r){let i=Hy(o,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}var Dy,Qt,Ye,Qe,Iy,Os,fd,Yt,hd,Ls,Ds,X1,Y1,Eo=O(()=>{"use strict";ud();Je();U();Dy=500,Qt=class n{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;t&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new Ye(d.map));let p=d.step.map(o.slice(i)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new Ye(h,void 0,void 0,c.length+u.length))),i--,h&&o.appendMap(h,i)}else s.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(i)):d.selection,a=new n(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new Ye(e.mapping.maps[u],d,t),p;(p=a&&a.merge(f))&&(f=p,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),t&&(s++,t=void 0),o||(a=f)}let c=s-r.depth;return c>Iy&&(l=Ry(l,c),s-=c),new n(l.append(i),s)}remapping(e,t){let r=new Kn;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new n(this.items.append(e.map(t=>new Ye(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;t=Math.min(this.items.length,t);let r=[],o=this.items.length-t,i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=t;this.items.forEach(f=>{let p=i.getMirror(--a);if(p==null)return;s=Math.min(s,p);let h=i.maps[p];if(f.step){let m=e.steps[p].invert(e.docs[p]),b=f.selection&&f.selection.map(i.slice(a+1,p));b&&l++,r.push(new Ye(h,m,b))}else r.push(new Ye(h))},o);let c=[];for(let f=t;f<s;f++)c.push(new Ye(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new n(u,l);return d.emptyItemCount()>Dy&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=s.selection&&s.selection.map(t.slice(r));u&&i++;let d=new Ye(c.invert(),a,u),f,p=o.length-1;(f=o.length&&o[p].merge(d))?o[p]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new n(Ts.from(o.reverse()),i)}};Qt.empty=new Qt(Ts.empty,0);Ye=class n{constructor(e,t,r,o){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new n(t.getMap().invert(),t,this.selection)}}},Qe=class{constructor(e,t,r,o,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}},Iy=20;Os=!1,fd=null;Yt=new j("history"),hd=new j("closeHistory");Ls=Co(!1,!0),Ds=Co(!0,!0),X1=Co(!1,!1),Y1=Co(!0,!1)});function gd(n,e=null){return function(t,r){let{$from:o,$to:i}=t.selection,s=o.blockRange(i);if(!s)return!1;let l=r?t.tr:null;return Fy(l,s,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Fy(n,e,t,r=null){let o=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new Pt(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Pt(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let l=fn(i,t,r,e);return l?(n&&$y(n,e,l,o,t),!0):!1}function $y(n,e,t,r,o){let i=E.empty;for(let u=t.length-1;u>=0;u--)i=E.from(t[u].type.create(t[u].attrs,i));n.step(new fe(e.start-(r?2:0),e.end,e.start,e.end,new N(i,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==o&&(s=u+1);let l=t.length-s,a=e.start+t.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&l&&wt(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return n}function Tn(n,e){return n instanceof nt?e==n:n.indexOf(e)>-1}function bd(n,e){return function(t,r){let{$from:o,$to:i,node:s}=t.selection;if(s&&s.isBlock||o.depth<2||!o.sameParent(i))return!1;let l=o.node(-1);if(!Tn(n,l.type))return!1;if(o.parent.content.size==0&&o.node(-1).childCount==o.indexAfter(-1)){if(o.depth==3||!Tn(n,o.node(-3).type)||o.index(-2)!=o.node(-2).childCount-1)return!1;if(r){let d=E.empty,f=o.index(-1)?1:o.index(-2)?2:3;for(let g=o.depth-f;g>=o.depth-3;g--)d=E.from(o.node(g).copy(d));let p=o.indexAfter(-1)<o.node(-2).childCount?1:o.indexAfter(-2)<o.node(-3).childCount?2:3;d=d.append(E.from(o.node(-3).type.createAndFill()));let h=o.before(o.depth-(f-1)),m=t.tr.replace(h,o.after(-p),new N(d,4-f,0)),b=-1;m.doc.nodesBetween(h,m.doc.content.size,(g,y)=>{if(b>-1)return!1;g.isTextblock&&g.content.size==0&&(b=y+1)}),b>-1&&m.setSelection(B.near(m.doc.resolve(b))),r(m.scrollIntoView())}return!0}let a=i.pos==o.end()?l.contentMatchAt(0).defaultType:null,c=t.tr.delete(o.pos,i.pos),u=a||e?[e?{type:l.type,attrs:e}:null,a?{type:a}:null]:void 0;return wt(c.doc,o.pos,2,u)?(r&&r(c.split(o.pos,2,u).scrollIntoView()),!0):!1}}function Rs(n){return function(e,t){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&Tn(n,s.firstChild.type));return i?t?Tn(n,r.node(i.depth-1).type)?_y(e,t,i):Vy(e,t,i):!0:!1}}function _y(n,e,t){let r=n.tr,o=t.end,i=t.$to.end(t.depth),s=t.parent.child(t.endIndex-1).type;o<i&&(r.step(new fe(o-1,i,o,i,new N(E.from(s.create(null,t.parent.copy())),1,0),1,!0)),t=new Pt(r.doc.resolve(t.$from.pos),r.doc.resolve(i),t.depth));let l=Ht(t);if(l==null)return!1;r.lift(t,l);let a=r.doc.resolve(r.mapping.map(o,-1)-1);return Ft(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos),e(r.scrollIntoView()),!0}function Vy(n,e,t){let r=n.tr,o=t.parent;for(let p=t.end,h=t.endIndex-1,m=t.startIndex;h>m;h--)p-=o.child(h).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(t.start),s=i.nodeAfter;if(r.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?E.empty:E.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new fe(d-(l?1:0),f+(a?1:0),d+1,f-1,new N((l?E.empty:E.from(o.copy(E.empty))).append(a?E.empty:E.from(o.copy(E.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function yd(n){return function(e,t){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&Tn(n,c.firstChild.type));if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(!Tn(n,a.type))return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,u=E.from(c?a.lastChild.lastChild.type.create():null),d=new N(E.from(a.type.create(null,E.from(l.type.create(null,u)))),c?3:1,0),f=i.start,p=i.end;t(e.tr.step(new fe(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}var Is=O(()=>{"use strict";Je();le();U()});function Ao(n){return(e,t)=>{let{from:r,to:o}=e.selection,i=e.tr,s=!1;return e.doc.nodesBetween(r,o,(l,a)=>{let c=Z(e);(l.type===c.paragraph||l.type===c.heading)&&(s=!0,i=i.setNodeMarkup(a,void 0,{...l.attrs,align:n}))}),s?(t?.(i),!0):!1}}function wd(n,e={}){let t=Es(n,e);return(r,o)=>{if(!t(r))return!1;if(o){let i=r.tr;for(let s of r.selection.ranges)i.setBlockType(s.$from.pos,s.$to.pos,n,l=>({...e,..."align"in n.spec.attrs&&l.attrs.align?{align:l.attrs.align}:{},..."lineHeight"in n.spec.attrs&&l.attrs.lineHeight?{lineHeight:l.attrs.lineHeight}:{},..."dir"in n.spec.attrs&&l.attrs.dir?{dir:l.attrs.dir}:{}}));o(i.scrollIntoView())}return!0}}function Nn(n){return en("heading",e=>wd(e,{level:n}))}function vd(n){return(e,t)=>Ze(e,n)?Rs(Z(e).list_item)(e,t):gd(n)(e,t)}function xd(n,e){return(t,r)=>De(n)?(r?.(t.tr.replaceSelectionWith(Z(t).image.create({src:n,alt:e??null})).scrollIntoView()),!0):!1}function hr(n,e){let{from:t,$from:r,to:o,empty:i}=n.selection;return i?!!e.isInSet(n.storedMarks??r.marks()):n.doc.rangeHasMark(t,o,e)}function Ze(n,e,t){let{$from:r,to:o}=n.selection;for(let i=r.depth;i>0;i--){let s=r.node(i);if(s.type===e&&(!t||Object.entries(t).every(([l,a])=>s.attrs[l]===a)))return o<=r.end(i)}return!1}function tn(n){return n.selection.$from.parent.attrs.align??"left"}function kd(n,e){let t=n.selection.$from.parent,r=Z(n),o=oe(n);switch(e){case"bold":case"italic":case"underline":case"strike":case"code":case"subscript":case"superscript":return hr(n,o[e]);case"paragraph":return t.type===r.paragraph;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return t.type===r.heading&&t.attrs.level===Number(e[1]);case"codeBlock":return t.type===r.code_block;case"blockquote":return Ze(n,r.blockquote);case"bulletList":return Ze(n,r.bullet_list);case"orderedList":return Ze(n,r.ordered_list);case"alignLeft":return tn(n)==="left";case"alignCenter":return tn(n)==="center";case"alignRight":return tn(n)==="right";case"alignJustify":return tn(n)==="justify";default:return!1}}function On(n){let{$from:e}=n.selection,t=oe(n),r=t.link.isInSet(e.marks())??t.link.isInSet(e.nodeAfter?.marks??[]);return r?r.attrs:null}function mr(n,e,t){let r=n.doc.resolve(t),o=r.start(),i=[];return r.parent.forEach((s,l)=>{if(!e.isInSet(s.marks))return;let a=o+l,c=a+s.nodeSize,u=i[i.length-1];u&&u.to===a?u.to=c:i.push({from:a,to:c})}),i.find(s=>s.from<=t&&t<=s.to)??null}var Z,oe,en,Zt,qy,Wy,Uy,J,Ie=O(()=>{"use strict";As();Eo();Is();dt();Z=n=>n.schema.nodes,oe=n=>n.schema.marks,en=(n,e)=>(t,r,o)=>e(Z(t)[n])(t,r,o),Zt=(n,e)=>(t,r,o)=>e(oe(t)[n])(t,r,o);qy=(n,e)=>(e?.(n.tr.replaceSelectionWith(Z(n).horizontal_rule.create()).scrollIntoView()),!0),Wy=(n,e)=>{let{from:t,to:r,empty:o,$from:i}=n.selection,s=oe(n);if(o){let l=mr(n,s.link,i.pos);return l?(e?.(n.tr.removeMark(l.from,l.to,s.link)),!0):!1}return n.doc.rangeHasMark(t,r,s.link)?(e?.(n.tr.removeMark(t,r,s.link)),!0):!1},Uy=(n,e)=>{let{from:t,to:r,empty:o}=n.selection;if(o)return!1;if(e){let i=oe(n),s=n.tr;for(let l of Object.values(i))l!==i.link&&(s=s.removeMark(t,r,l));e(s)}return!0};J={bold:Zt("bold",Ot),italic:Zt("italic",Ot),underline:Zt("underline",Ot),strike:Zt("strike",Ot),code:Zt("code",Ot),subscript:Zt("subscript",Ot),superscript:Zt("superscript",Ot),paragraph:en("paragraph",n=>wd(n)),h1:Nn(1),h2:Nn(2),h3:Nn(3),h4:Nn(4),h5:Nn(5),h6:Nn(6),blockquote:(n,e)=>Ze(n,Z(n).blockquote)?rd(n,e):sd(Z(n).blockquote)(n,e),codeBlock:en("code_block",n=>Es(n)),bulletList:en("bullet_list",vd),orderedList:en("ordered_list",vd),indent:en("list_item",yd),outdent:en("list_item",Rs),alignLeft:Ao(null),alignCenter:Ao("center"),alignRight:Ao("right"),alignJustify:Ao("justify"),horizontalRule:qy,unlink:Wy,clearFormatting:Uy,undo:Ls,redo:Ds}});function Ln(n){return jy.test(n.type)}function Ky(n){return new Promise((e,t)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>t(r.error??new Error("FileReader failed")),r.readAsDataURL(n)})}function Md(n,e){let t=null;return n.state.doc.descendants((r,o)=>t!==null?!1:(r.type===Z(n.state).image&&r.attrs.src===e&&(t=o),!0)),t}function gr(n,e,t){let r=e.filter(Ln),o=n.view;for(let i of r){let s=URL.createObjectURL(i),l=Z(o.state).image.create({src:s,alt:null}),a=o.state.tr;t!==void 0?a.insert(Math.min(t,a.doc.content.size),l):a.replaceSelectionWith(l),o.dispatch(a.scrollIntoView());let c=n.options.uploadImage,u=c?n.ui.notify({text:n.ui.t("image.uploading"),timeout:0}):null;(c?c(i,f=>u?.setText(`${n.ui.t("image.uploading")} ${Math.round(f)}%`)):Ky(i)).then(f=>{if(!De(f))throw new Error(`Unsafe image URL returned: ${f}`);let p=Md(o,s);if(p===null)return;let h=o.state.doc.nodeAt(p);o.dispatch(o.state.tr.setNodeMarkup(p,void 0,{...h.attrs,src:f}).setMeta("addToHistory",!1))}).catch(f=>{console.error("[nova] image upload failed",f);let p=Md(o,s);p!==null&&o.dispatch(o.state.tr.delete(p,p+1).setMeta("addToHistory",!1)),n.ui.notify({text:n.ui.t("image.uploadFailed"),type:"error"})}).finally(()=>{u?.close(),URL.revokeObjectURL(s)})}}function Jy(n,e="pasted-image"){let t=n.match(Cd);if(!t)return null;let r=t[1].toLowerCase();try{let o=atob(t[2]),i=new Uint8Array(o.length);for(let l=0;l<o.length;l++)i[l]=o.charCodeAt(l);let s=r.split("/")[1].replace("jpeg","jpg");return new File([i],`${e}.${s}`,{type:r})}catch{return null}}function Gy(n,e,t){let r=n.state.tr;n.state.doc.descendants((o,i)=>{o.type===Z(n.state).image&&o.attrs.src===e&&r.setNodeMarkup(i,void 0,{...o.attrs,src:t})}),r.docChanged&&n.dispatch(r.setMeta("addToHistory",!1))}async function Xy(n,e){let t=n.options.uploadImage,r=t?Jy(e):null;if(!t||!r)return;let o=n.ui.notify({text:n.ui.t("image.uploading"),timeout:0});try{let i=await t(r,s=>o.setText(`${n.ui.t("image.uploading")} ${Math.round(s)}%`));if(!De(i))throw new Error(`Unsafe image URL returned: ${i}`);Gy(n.view,e,i)}catch(i){console.error("[nova] embedded image upload failed",i),n.ui.notify({text:n.ui.t("image.uploadFailed"),type:"error"})}finally{o.close()}}function Sd(n,e){let t=new Set;return n.descendants(r=>{r.type===e&&Cd.test(r.attrs.src)&&t.add(r.attrs.src)}),t}function Ed(n){return new _({key:new j("nova-embedded-image-upload"),appendTransaction(e,t,r){if(!n.options.uploadImage||!e.some(a=>["paste","drop"].includes(a.getMeta("uiEvent")))||!e.some(a=>a.docChanged))return null;let i=Z(r).image,s=Sd(t.doc,i),l=[...Sd(r.doc,i)].filter(a=>!s.has(a));return l.length&&queueMicrotask(()=>l.forEach(a=>{Xy(n,a)})),null}})}function Ad(n){return new _({key:new j("nova-image-drop-paste"),props:{handlePaste(e,t){if(!n.isAllowed("image"))return!1;let r=t.clipboardData;if(!r||r.getData("text/html"))return!1;let o=[...r.files].filter(Ln);return o.length?(gr(n,o),!0):!1},handleDrop(e,t){if(!n.isAllowed("image"))return!1;let r=[...t.dataTransfer?.files??[]].filter(Ln);if(!r.length)return!1;t.preventDefault();let o=e.posAtCoords({left:t.clientX,top:t.clientY});return gr(n,r,o?.pos),!0}}})}function To(n){let{t:e}=n.ui,t=v("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp,image/avif",className:"nova-visually-hidden",tabindex:"-1"}),r=v("button",{type:"button",className:"nova-dropzone"},te(M.upload),v("span",{},e("image.drop"))),o=ae({label:e("image.url"),type:"url",placeholder:"https://"}),i=ae({label:e("image.alt"),hint:e("image.altHint")}),s=v("div",{className:"nova-form"},r,t,v("div",{className:"nova-divider"},v("span",{},e("image.or"))),o.el,i.el),l=n.ui.openDialog({title:e("image.title"),body:s,submitLabel:e("dialog.insert"),initialFocus:o.input,onSubmit:()=>{let c=o.input.value.trim();return!c||!De(c)?(o.input.setAttribute("aria-invalid","true"),o.input.focus(),e("image.invalid")):(n.exec(xd(c,i.input.value.trim()||void 0)),!0)}}),a=c=>{let u=c.filter(Ln);u.length&&(l.close(),gr(n,u))};r.addEventListener("click",()=>t.click()),t.addEventListener("change",()=>a([...t.files??[]])),r.addEventListener("dragover",c=>{c.preventDefault(),r.classList.add("is-dragover")}),r.addEventListener("dragleave",()=>r.classList.remove("is-dragover")),r.addEventListener("drop",c=>{c.preventDefault(),r.classList.remove("is-dragover"),a([...c.dataTransfer?.files??[]])})}function nn(n){let{selection:e}=n;return e instanceof R&&e.node.type===Z(n).image?{node:e.node,pos:e.from}:null}function br(n){return(e,t)=>{let r=nn(e);if(!r)return!1;if(t){let o=e.tr.setNodeMarkup(r.pos,void 0,{...r.node.attrs,...n});o.setSelection(R.create(o.doc,r.pos)),t(o)}return!0}}function Td(n,e){let t=nn(n.view.state);if(!t)return!1;if(e===null)return n.exec(br({width:null,height:null}));let o=n.view.nodeDOM(t.pos)?.querySelector("img")??null,i=getComputedStyle(n.view.dom),s=n.view.dom.clientWidth-parseFloat(i.paddingLeft||"0")-parseFloat(i.paddingRight||"0"),l=Math.max(24,Math.round(s*e)),a=o&&o.naturalWidth?o.naturalHeight/o.naturalWidth:null;return n.exec(br({width:l,height:a?Math.round(l*a):null}))}function Nd(n){let e=nn(n.view.state);if(!e)return;let{t}=n.ui,r=ae({label:t("image.alt"),value:e.node.attrs.alt??"",hint:t("image.altHint")}),o=ae({label:t("link.tooltip"),value:e.node.attrs.title??""});n.ui.openDialog({title:t("image.editAlt"),body:v("div",{className:"nova-form"},r.el,o.el),submitLabel:t("dialog.save"),initialFocus:r.input,onSubmit:()=>(n.exec(br({alt:r.input.value.trim()||null,title:o.input.value.trim()||null})),!0)})}var jy,Cd,yr=O(()=>{"use strict";U();Ie();Ie();kt();X();Me();dt();jy=/^image\/(png|jpe?g|gif|webp|avif|bmp)$/;Cd=/^data:(image\/(?:png|jpe?g|gif|webp|avif|bmp));base64,(.+)$/i});function Od(n){let e=n.trim();return e?/^[a-z][a-z0-9+.-]*:/i.test(e)||/^[/#?.]/.test(e)?e:/^[^\s@/]+@[^\s@/]+\.[^\s@/]+$/.test(e)?`mailto:${e}`:/^(www\.)?[^\s/]+\.[a-z]{2,}([/:?#].*)?$/i.test(e)?`https://${e}`:e:""}function Ps(n){let{from:e,to:t,empty:r,$from:o}=n.selection;return r?mr(n,oe(n).link,o.pos)??{from:e,to:t}:{from:e,to:t}}function Yy(n){return(e,t)=>{let r=Od(n.href);if(!r||!Le(r))return!1;if(!t)return!0;let{from:o,to:i}=Ps(e),s=oe(e).link.create({href:r,title:n.title||null,target:n.target||null}),l=e.doc.textBetween(o,i),a=n.text?.trim()?n.text:null,c=e.tr;if(o===i||a!==null&&a!==l){let u=oe(e).link.removeFromSet(e.doc.resolve(o).marks()),d=e.schema.text(a??(l||r),s.addToSet(u));c.replaceWith(o,i,d)}else c.removeMark(o,i,oe(e).link).addMark(o,i,s);return t(c.scrollIntoView()),!0}}function vr(){return(n,e)=>{let{from:t,to:r}=Ps(n);return t===r||!n.doc.rangeHasMark(t,r,oe(n).link)?!1:(e?.(n.tr.removeMark(t,r,oe(n).link)),!0)}}function et(n){let{t:e}=n.ui,t=n.view.state,r=On(t),o=Ps(t),i=t.doc.textBetween(o.from,o.to),s=!i.includes(`
11
+ `)&&t.selection.$from.sameParent(t.doc.resolve(o.to)),l=ae({label:e("link.url"),type:"url",value:r?.href??"",placeholder:"https://",required:!0}),a=ae({label:e("link.text"),value:i}),c=ae({label:e("link.tooltip"),value:r?.title??""}),u=va(e("link.newTab"),r?.target==="_blank"),d=v("div",{className:"nova-form"},l.el,s?a.el:null,c.el,u.el);n.ui.openDialog({title:e(r?"link.editTitle":"link.title"),body:d,submitLabel:e(r?"dialog.save":"dialog.insert"),initialFocus:l.input,onSubmit:()=>{let f=Od(l.input.value);return!f||!Le(f)?(l.input.setAttribute("aria-invalid","true"),l.input.focus(),e("link.invalid")):(n.exec(Yy({href:f,...s?{text:a.input.value}:{},title:c.input.value.trim()||null,target:u.input.checked?"_blank":null})),!0)}})}var Dn=O(()=>{"use strict";Ie();Ie();kt();X();dt()});function Qy(n,e,t=!0,r=Xt){let{table:o,table_row:i,table_cell:s,table_header:l,paragraph:a}=r.nodes,c=[];for(let u=0;u<n;u++){let d=t&&u===0?l:s,f=[];for(let p=0;p<e;p++)f.push(d.create(null,a.create()));c.push(i.create(null,f))}return o.create(null,c)}function tt(n,e,t=!0){return(r,o)=>{if(n<1||e<1||n>100||e>50||Y(r))return!1;if(o){let i=Qy(n,e,t,r.schema),s=r.tr.replaceSelectionWith(i),l=-1;s.doc.descendants((a,c)=>(a===i&&(l=c),l<0)),l>=0&&s.setSelection(P.near(s.doc.resolve(l+3))),o(s.scrollIntoView())}return!0}}function Ld(){return[Du({cellMinWidth:48,View:Bs}),Iu(),He({Tab:Zy,"Shift-Tab":yo(-1)})]}function Dd(n){return Nu("background",n)}function Rd(n){if(!Y(n))return!1;let e=Cn(n.selection.$from)?.node.firstChild;if(!e||e.childCount===0)return!1;let t=!0;return e.forEach(r=>{r.type!==n.schema.nodes.table_header&&(t=!1)}),t}function Id(n){if(!Y(n))return!1;let e=Cn(n.selection.$from)?.node;if(!e)return!1;let t=!0;return e.forEach(r=>{r.firstChild?.type!==n.schema.nodes.table_header&&(t=!1)}),t}function Pd(n){let{state:e}=n.view;if(!Y(e))return null;let t=Cn(e.selection.$from);return t?n.view.nodeDOM(t.pos)?.getBoundingClientRect()??null:null}function Bd(n,e,t){let r=1,o=1,i=[],s=v("div",{className:"nova-grid-caption","aria-live":"polite"}),l=v("div",{className:"nova-grid",role:"grid","aria-label":t}),a=()=>{for(let c of i){let u=Number(c.dataset.row),d=Number(c.dataset.col);c.classList.toggle("is-on",u<=r&&d<=o),c.tabIndex=u===r&&d===o?0:-1}s.textContent=e(r,o)};for(let c=1;c<=wr;c++)for(let u=1;u<=wr;u++){let d=v("button",{type:"button",className:"nova-grid-cell",role:"gridcell","aria-label":e(c,u),"data-row":String(c),"data-col":String(u)});d.addEventListener("mouseenter",()=>{r=c,o=u,a()}),d.addEventListener("click",()=>n(c,u)),i.push(d),l.append(d)}return l.addEventListener("keydown",c=>{let d={ArrowRight:[0,1],ArrowLeft:[0,-1],ArrowDown:[1,0],ArrowUp:[-1,0]}[c.key];d&&(c.preventDefault(),r=Math.min(wr,Math.max(1,r+d[0])),o=Math.min(wr,Math.max(1,o+d[1])),a(),i[(r-1)*wr+(o-1)].focus())}),a(),v("div",{className:"nova-grid-panel"},l,s)}function ev(n){let e=n.replace(/\s/g,"").replace(/^[^\d+-]+|[^\d]+$/g,"").replace(/,(?=\d{3}(?:\D|$))/g,"").replace(",",".");return/^[+-]?\d+(\.\d+)?$/.test(e)?Number(e):null}function tv(n){if(!Y(n))return null;let e=$e(n),t=e.table,r=!1;if(t.descendants(s=>((s.attrs.colspan>1||s.attrs.rowspan>1)&&(r=!0),!r&&s.type.spec.tableRole!=="cell"&&s.type.spec.tableRole!=="header_cell")),r)return null;let o=n.schema.nodes,i=0;for(let s=0;s<t.childCount;s++){let l=!0;if(t.child(s).forEach(a=>{a.type!==o.table_header&&(l=!1)}),!l)break;i++}return t.childCount-i<2?null:{pos:e.tableStart-1,table:t,column:e.left,headerRows:i}}function zs(n,e){return(t,r)=>{let o=tv(t);if(!o)return!1;if(r){let{table:i,column:s,headerRows:l,pos:a}=o,c=[];i.forEach(y=>c.push(y));let u=c.slice(0,l),d=c.slice(l),f=d.map(y=>s<y.childCount?y.child(s).textContent.trim():""),p=f.map(ev),h=f.every((y,x)=>y===""||p[x]!==null),m=new Intl.Collator(e,{numeric:!0,sensitivity:"base"}),b=d.map((y,x)=>({row:y,i:x})).sort((y,x)=>{let A=f[y.i],L=f[x.i];if(!A||!L)return A?-1:L?1:y.i-x.i;let C=h?p[y.i]-p[x.i]:m.compare(A,L);return(n==="asc"?C:-C)||y.i-x.i}).map(({row:y})=>y),g=i.copy(E.from([...u,...b]));r(t.tr.replaceWith(a,a+i.nodeSize,g).scrollIntoView())}return!0}}function zd(n){let e=Cn(n.selection.$from);return e?{width:e.node.attrs.width??null,align:e.node.attrs.align??null}:null}function Hd(n){return(e,t)=>{let r=Cn(e.selection.$from);return!r||n.width!==null&&!Q.length(n.width)?!1:(t?.(e.tr.setNodeMarkup(r.pos,void 0,{...r.node.attrs,...n})),!0)}}function Fd(n){let e=[];if(n.selection instanceof G)return n.selection.forEachCell((r,o)=>e.push({node:r,pos:o})),e;let{$from:t}=n.selection;for(let r=t.depth;r>0;r--){let o=t.node(r),i=o.type.spec.tableRole;if(i==="cell"||i==="header_cell"){e.push({node:o,pos:t.before(r)});break}}return e}function $d(n){let e=Fd(n)[0];if(!e)return null;let t=e.node.attrs.colwidth;return{valign:e.node.attrs.valign??null,header:e.node.type===n.schema.nodes.table_header,width:t?.[0]??null}}function _d(n){return(e,t)=>{let r=Fd(e);if(!r.length||n.width!=null&&!(n.width>=24&&n.width<=4e3))return!1;if(!t)return!0;let o=e.schema.nodes,i=e.tr;for(let{pos:s,node:l}of r){let a=n.header===void 0?l.type:n.header?o.table_header:o.table_cell,c={...l.attrs,...n.valign!==void 0?{valign:n.valign}:{}};i.setNodeMarkup(s,a,c)}if(n.width!==void 0){let s=$e(e),l=s.map,a=new Set;for(let c=s.left;c<s.right;c++)for(let u=0;u<l.height;u++){let d=l.map[u*l.width+c],f=d*1e3+c;if(a.has(f))continue;a.add(f);let p=s.tableStart+d,h=i.doc.nodeAt(p);if(!h)continue;let m=c-l.colCount(d),b=[...h.attrs.colwidth??new Array(h.attrs.colspan).fill(0)];b[m]=n.width??0,i.setNodeMarkup(p,void 0,{...h.attrs,colwidth:b.every(g=>!g)?null:b})}}return t(i),!0}}var wr,Zy,Ve,Bs,Rn=O(()=>{"use strict";at();le();U();vs();ft();X();wr=10;Zy=(n,e,t)=>{if(!Y(n))return!1;if(yo(1)(n,e,t)||!e)return!0;let r=n;return bs(n,o=>{r=n.apply(o),e(o)}),yo(1)(r,e,t)};Ve={addRowBefore:Cu,addRowAfter:bs,deleteRow:Eu,addColumnBefore:xu,addColumnAfter:ku,deleteColumn:Mu,mergeCells:Au,splitCell:Tu,toggleHeaderRow:En("row"),toggleHeaderColumn:En("column"),deleteTable:Ou};Bs=class extends ys{constructor(e,t){super(e,t),this.apply(e)}update(e){return super.update(e)?(this.apply(e),!0):!1}apply(e){let t=Q.length(e.attrs.width);t&&(this.table.style.width=t,this.table.style.minWidth="");let r=e.attrs.align;this.table.style.marginLeft=r?"auto":"",this.table.style.marginRight=r==="center"?"auto":""}}});var jd={};Be(jd,{DEFAULT_INSERT:()=>qd,DEFAULT_SELECTION:()=>Vd,default:()=>rv,hasTextSelection:()=>Wd,isOnEmptyLine:()=>Ud});function Wd(n){let{selection:e}=n.view.state;return!(e instanceof P)||e.empty||e.$from.parent.type.spec.code?!1:n.view.state.doc.textBetween(e.from,e.to).trim().length>0}function Ud(n){let{selection:e}=n.view.state;if(!e.empty)return!1;let{$from:t}=e;return t.depth===1&&t.parent.type===n.schema.nodes.paragraph&&t.parent.content.size===0&&!Y(n.view.state)}function nv(n){let e=document.createElement("input");e.type="file",e.accept="image/png,image/jpeg,image/gif,image/webp,image/avif",e.addEventListener("change",()=>{let t=[...e.files??[]].filter(Ln);t.length&&gr(n,t)}),e.click()}var Vd,qd,rv,Kd=O(()=>{"use strict";U();yr();Dn();Rn();Me();Vd="bold italic underline | quicklink h2 h3 blockquote",qd="quickimage quicktable";rv={name:"quickbars",setup(n){let{registry:e,t}=n.ui,r=n.options.pluginOptions?.quickbars??{};e.addButton("quicklink",{icon:M.link,tooltip:t("link"),shortcut:"Mod-k",onAction:s=>et(s)}),e.addButton("quickimage",{icon:M.image,tooltip:t("image"),onAction:s=>nv(s)}),e.addButton("quicktable",{icon:M.table,tooltip:t("table.insert"),onAction:s=>s.exec(tt(2,2))});let o=r.selection===void 0?Vd:r.selection;o&&e.addContextToolbar("quickbars-selection",{label:t("quickbars.selection"),predicate:Wd,items:o,position:"selection",placement:"top-start",priority:10});let i=r.insert===void 0?qd:r.insert;i&&e.addContextToolbar("quickbars-insert",{label:t("quickbars.insert"),predicate:Ud,items:i,position:"selection",placement:"bottom-start"})}}});var Gd={};Be(Gd,{default:()=>sv});var Jd,ov,iv,sv,Xd=O(()=>{"use strict";Se();Jd='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 20h4v-3a7 7 0 1 1 6 0v3h4"/></svg>',ov={en:{title:"Special character",search:"Search characters",empty:"Nothing found",groups:["Currency","Typography","Math","Arrows","Latin","Greek"]},ru:{title:"\u0421\u043F\u0435\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0439 \u0441\u0438\u043C\u0432\u043E\u043B",search:"\u041F\u043E\u0438\u0441\u043A \u0441\u0438\u043C\u0432\u043E\u043B\u0430",empty:"\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",groups:["\u0412\u0430\u043B\u044E\u0442\u044B","\u0422\u0438\u043F\u043E\u0433\u0440\u0430\u0444\u0438\u043A\u0430","\u041C\u0430\u0442\u0435\u043C\u0430\u0442\u0438\u043A\u0430","\u0421\u0442\u0440\u0435\u043B\u043A\u0438","\u041B\u0430\u0442\u0438\u043D\u0438\u0446\u0430","\u0413\u0440\u0435\u0447\u0435\u0441\u043A\u0438\u0435"]}},iv=[[["\u20AC","euro"],["\xA3","pound"],["\xA5","yen"],["\u20BD","ruble"],["$","dollar"],["\xA2","cent"],["\u20B4","hryvnia"],["\u20B8","tenge"],["\u20B9","rupee"],["\u20A9","won"],["\u20BA","lira"],["\u20BF","bitcoin"]],[["\u2014","em dash"],["\u2013","en dash"],["\u2026","ellipsis"],["\xAB","left guillemet"],["\xBB","right guillemet"],["\u201E","low double quote"],["\u201C","left double quote"],["\u201D","right double quote"],["\u2018","left single quote"],["\u2019","right single quote apostrophe"],["\u2022","bullet"],["\xB7","middle dot"],["\xA7","section"],["\xB6","paragraph pilcrow"],["\u2020","dagger"],["\u2021","double dagger"],["\xA9","copyright"],["\xAE","registered"],["\u2122","trademark"],["\xB0","degree"],["\u2116","numero number"],["\u2030","per mille"],["\u2032","prime minutes"],["\u2033","double prime seconds"],["\xA1","inverted exclamation"],["\xBF","inverted question"]],[["\xB1","plus minus"],["\xD7","multiply times"],["\xF7","divide"],["\u2260","not equal"],["\u2248","approximately"],["\u2264","less or equal"],["\u2265","greater or equal"],["\u221E","infinity"],["\u221A","square root"],["\u2211","sum sigma"],["\u220F","product"],["\u222B","integral"],["\u2202","partial"],["\u2206","increment delta"],["\u2208","element of"],["\u2209","not element of"],["\u2229","intersection"],["\u222A","union"],["\u2282","subset"],["\u2200","for all"],["\u2203","exists"],["\xAC","not"],["\u2227","and"],["\u2228","or"],["\xBD","one half"],["\u2153","one third"],["\xBC","one quarter"],["\xBE","three quarters"],["\xB2","superscript two squared"],["\xB3","superscript three cubed"],["\xB5","micro"],["\u2030","per mille"]],[["\u2190","left arrow"],["\u2192","right arrow"],["\u2191","up arrow"],["\u2193","down arrow"],["\u2194","left right arrow"],["\u2195","up down arrow"],["\u21D0","left double arrow"],["\u21D2","right double arrow implies"],["\u21D4","left right double arrow iff"],["\u21A9","return arrow"],["\u2197","north east arrow"],["\u2198","south east arrow"]],[["\xE0","a grave"],["\xE1","a acute"],["\xE2","a circumflex"],["\xE4","a umlaut"],["\xE5","a ring"],["\xE6","ae ligature"],["\xE7","c cedilla"],["\xE9","e acute"],["\xE8","e grave"],["\xEA","e circumflex"],["\xEB","e umlaut"],["\xED","i acute"],["\xEF","i umlaut"],["\xF1","n tilde"],["\xF3","o acute"],["\xF4","o circumflex"],["\xF6","o umlaut"],["\xF8","o slash"],["\u0153","oe ligature"],["\xDF","sharp s eszett"],["\xFA","u acute"],["\xFC","u umlaut"],["\xFD","y acute"],["\u0142","l stroke"],["\u0161","s caron"],["\u017E","z caron"]],[["\u03B1","alpha"],["\u03B2","beta"],["\u03B3","gamma"],["\u03B4","delta"],["\u03B5","epsilon"],["\u03B8","theta"],["\u03BB","lambda"],["\u03BC","mu"],["\u03C0","pi"],["\u03C3","sigma"],["\u03C6","phi"],["\u03C9","omega"],["\u0394","capital delta"],["\u03A3","capital sigma"],["\u03A9","capital omega ohm"]]],sv={name:"charmap",toolbar:"charmap",setup(n){let e=W(n,ov),t=iv.map((o,i)=>({title:e.groups[i],items:o})),r=o=>Ur({groups:t,searchLabel:e.search,emptyText:e.empty,className:"nova-charmap",onPick:i=>{o(),mn(n,i)}});n.ui.registry.addPanelButton("charmap",{icon:Jd,tooltip:e.title,isEnabled:o=>o.isEditable(),render:(o,i)=>r(i)}),n.ui.registry.addMenuItem("charmap",{text:e.title,icon:Jd,onAction:()=>jr(n,e.title,r)})}}});var Zd={};Be(Zd,{default:()=>av});var Yd,lv,Qd,av,ef=O(()=>{"use strict";Se();Yd='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><path d="M9 9h.01M15 9h.01"/></svg>',lv={en:{title:"Emoji",search:"Search emoji",empty:"No emoji found",groups:["Smileys","Gestures","Hearts","Nature","Food","Activities","Objects","Symbols"]},ru:{title:"\u042D\u043C\u043E\u0434\u0437\u0438",search:"\u041F\u043E\u0438\u0441\u043A \u044D\u043C\u043E\u0434\u0437\u0438",empty:"\u042D\u043C\u043E\u0434\u0437\u0438 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B",groups:["\u0421\u043C\u0430\u0439\u043B\u044B","\u0416\u0435\u0441\u0442\u044B","\u0421\u0435\u0440\u0434\u0446\u0430","\u041F\u0440\u0438\u0440\u043E\u0434\u0430","\u0415\u0434\u0430","\u0417\u0430\u043D\u044F\u0442\u0438\u044F","\u041F\u0440\u0435\u0434\u043C\u0435\u0442\u044B","\u0421\u0438\u043C\u0432\u043E\u043B\u044B"]}},Qd=[[["\u{1F600}","grinning"],["\u{1F603}","smiley"],["\u{1F604}","smile"],["\u{1F601}","grin"],["\u{1F606}","laughing"],["\u{1F605}","sweat smile"],["\u{1F602}","joy tears"],["\u{1F642}","slight smile"],["\u{1F609}","wink"],["\u{1F60A}","blush"],["\u{1F607}","innocent halo"],["\u{1F60D}","heart eyes"],["\u{1F929}","star struck"],["\u{1F618}","kiss"],["\u{1F60B}","yum"],["\u{1F60E}","sunglasses cool"],["\u{1F914}","thinking"],["\u{1F610}","neutral"],["\u{1F60F}","smirk"],["\u{1F634}","sleeping"],["\u{1F62E}","open mouth surprised"],["\u{1F622}","cry sad"],["\u{1F62D}","sob"],["\u{1F621}","angry rage"],["\u{1F92F}","mind blown"],["\u{1F973}","party"],["\u{1F917}","hug"],["\u{1F644}","eye roll"],["\u{1F62C}","grimace"],["\u{1F913}","nerd"]],[["\u{1F44D}","thumbs up like yes"],["\u{1F44E}","thumbs down dislike no"],["\u{1F44F}","clap"],["\u{1F64C}","raised hands"],["\u{1F64F}","pray thanks please"],["\u{1F44B}","wave hello"],["\u270C\uFE0F","victory peace"],["\u{1F91D}","handshake deal"],["\u{1F4AA}","muscle strong"],["\u{1F44C}","ok"],["\u{1F91E}","fingers crossed"],["\u{1F449}","point right"],["\u{1F440}","eyes look"]],[["\u2764\uFE0F","red heart love"],["\u{1F9E1}","orange heart"],["\u{1F49B}","yellow heart"],["\u{1F49A}","green heart"],["\u{1F499}","blue heart"],["\u{1F49C}","purple heart"],["\u{1F5A4}","black heart"],["\u{1F494}","broken heart"],["\u{1F4AF}","hundred"],["\u2728","sparkles"],["\u{1F525}","fire hot"],["\u2B50","star"]],[["\u2600\uFE0F","sun"],["\u{1F319}","moon"],["\u26C5","cloud sun"],["\u{1F327}\uFE0F","rain"],["\u2744\uFE0F","snow"],["\u{1F308}","rainbow"],["\u{1F338}","blossom flower"],["\u{1F333}","tree"],["\u{1F340}","clover luck"],["\u{1F436}","dog"],["\u{1F431}","cat"],["\u{1F98A}","fox"],["\u{1F43B}","bear"],["\u{1F427}","penguin"],["\u{1F98B}","butterfly"]],[["\u{1F34E}","apple"],["\u{1F34C}","banana"],["\u{1F355}","pizza"],["\u{1F354}","burger"],["\u{1F370}","cake"],["\u{1F36A}","cookie"],["\u2615","coffee"],["\u{1F375}","tea"],["\u{1F37A}","beer"],["\u{1F377}","wine"],["\u{1F382}","birthday cake"]],[["\u26BD","soccer football"],["\u{1F3C0}","basketball"],["\u{1F3BE}","tennis"],["\u{1F3AE}","video game"],["\u{1F3B5}","music note"],["\u{1F3A8}","art palette"],["\u{1F389}","tada celebration"],["\u{1F381}","gift present"],["\u{1F3C6}","trophy winner"],["\u{1F680}","rocket launch"],["\u2708\uFE0F","airplane travel"]],[["\u{1F4A1}","bulb idea"],["\u{1F4CC}","pin"],["\u{1F4CE}","paperclip attachment"],["\u{1F4C5}","calendar date"],["\u{1F4C8}","chart up growth"],["\u{1F4C9}","chart down"],["\u{1F4DD}","memo note"],["\u{1F4DA}","books"],["\u{1F4BB}","laptop computer"],["\u{1F4F1}","phone mobile"],["\u{1F512}","lock secure"],["\u{1F511}","key"],["\u23F0","alarm clock"],["\u{1F4E7}","email mail"],["\u{1F4B0}","money bag"],["\u{1F6E0}\uFE0F","tools"]],[["\u2705","check done yes"],["\u274C","cross no"],["\u26A0\uFE0F","warning"],["\u2757","exclamation"],["\u2753","question"],["\u2795","plus"],["\u2796","minus"],["\u{1F534}","red circle"],["\u{1F7E2}","green circle"],["\u{1F535}","blue circle"],["\u2B06\uFE0F","up"],["\u2B07\uFE0F","down"],["\u{1F195}","new"],["\u{1F197}","ok button"]]],av={name:"emoticons",toolbar:"emoticons",setup(n){let e=W(n,lv),t=Qd.map((i,s)=>({title:e.groups[s],items:i})),r=Qd.flat(),o=i=>Ur({groups:t,searchLabel:e.search,emptyText:e.empty,className:"nova-emoticons",onPick:s=>{i(),mn(n,s)}});n.ui.registry.addPanelButton("emoticons",{icon:Yd,tooltip:e.title,isEnabled:i=>i.isEditable(),render:(i,s)=>o(s)}),n.ui.registry.addMenuItem("emoticons",{text:e.title,icon:Yd,onAction:()=>jr(n,e.title,o)}),n.ui.registry.addAutocompleter("emoticons",{trigger:":",minChars:2,label:e.title,maxResults:8,fetch:i=>{let s=i.toLowerCase();return/^[a-z]+$/.test(s)?r.filter(([,l])=>l.split(" ").some(a=>a.startsWith(s))).map(([l,a])=>({value:l,label:a,icon:l})):[]},onSelect:(i,s,l)=>{let{state:a,dispatch:c}=l.view;c(a.tr.insertText(i.value,s.from,s.to).scrollIntoView())}})}}});var rf={};Be(rf,{default:()=>uv});var tf,nf,cv,uv,of=O(()=>{"use strict";at();Se();tf="\xA0",nf='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 9v5h16V9"/></svg>',cv={en:{title:"Nonbreaking space"},ru:{title:"\u041D\u0435\u0440\u0430\u0437\u0440\u044B\u0432\u043D\u044B\u0439 \u043F\u0440\u043E\u0431\u0435\u043B"}},uv={name:"nonbreaking",toolbar:"nonbreaking",prosemirrorPlugins:()=>[He({"Mod-Shift-Space":(n,e)=>(e?.(n.tr.insertText(tf).scrollIntoView()),!0)})],setup(n){let{title:e}=W(n,cv),t={icon:nf,tooltip:e,shortcut:"Mod-Shift-Space",isEnabled:()=>n.isEditable(),onAction:()=>mn(n,tf)};n.ui.registry.addButton("nonbreaking",t),n.ui.registry.addMenuItem("nonbreaking",{text:e,icon:nf,onAction:t.onAction})}}});function dv(n){return function(e,t,r,o){let i=n;if(t[1]){let s=t[0].lastIndexOf(t[1]);i+=t[0].slice(s+t[1].length),r+=s;let l=r-o;l>0&&(i=t[0].slice(s-l,s)+i,r=o)}return e.tr.insertText(i,r,o)}}function No({rules:n}){let e=new _({state:{init(){return null},apply(t,r){let o=t.getMeta(this);return o||(t.selectionSet||t.docChanged?null:r)}},props:{handleTextInput(t,r,o,i){return sf(t,r,o,i,n,e)},handleDOMEvents:{compositionend:t=>{setTimeout(()=>{let{$cursor:r}=t.state.selection;r&&sf(t,r.pos,r.pos,"",n,e)})}}},isInputRules:!0});return e}function sf(n,e,t,r,o,i){if(n.composing)return!1;let s=n.state,l=s.doc.resolve(e),a=n.state.selection,c=l.parent.textBetween(Math.max(0,l.parentOffset-fv),l.parentOffset,null,"\uFFFC")+r,u=e==a.from&&t==a.to&&n.state.storedMarks||(e==t?l.marks():l.marksAcross(s.doc.resolve(t))||[]);for(let d=0;d<o.length;d++){let f=o[d];if(!f.inCodeMark&&u.some(b=>b.type.spec.code))continue;if(l.parent.type.spec.code){if(!f.inCode)continue}else if(f.inCode==="only")continue;let p=f.match.exec(c);if(!p||p[0].length<r.length)continue;let h=e-(p[0].length-r.length);if(!f.inCodeMark){let b=!1;if(s.doc.nodesBetween(h,l.pos,g=>{g.isInline&&g.marks.some(y=>y.type.spec.code)&&(b=!0)}),b)continue}let m=f.handler(s,p,h,t,r);if(m)return f.undoable&&m.setMeta(i,{transform:m,from:e,to:t,text:r}),n.dispatch(m),!0}return!1}function Oo(n,e,t,r){let o,i;return e instanceof nt?i=e:(o=e,i=e.nodeType,t=e.getAttrs,r=e.joinPredicate),new qe(n,(s,l,a,c)=>{let u=t instanceof Function?t(l):t,d=s.tr.delete(a,c),f=d.doc.resolve(a),p=f.blockRange(),h=p&&fn(p,i,u);if(!h)return null;d.wrap(p,h);let m=d.doc.resolve(a-1).nodeBefore;return m&&m.type==i&&Ft(d.doc,a-1)&&(!r||r(l,m))&&d.join(a-1),d},o)}function Hs(n,e,t){let r,o;return e instanceof nt?o=e:(r=e,o=e.nodeType,t=e.getAttrs),new qe(n,(i,s,l,a)=>{let c=i.doc.resolve(l),u=t instanceof Function?t(s):t;return c.node(-1).canReplaceWith(c.index(-1),c.indexAfter(-1),o)?i.tr.delete(l,a).setBlockType(l,l,o,u):null},r)}var qe,fv,lf,af,_x,Vx,qx,Wx,Fs=O(()=>{"use strict";U();Je();le();qe=class{constructor(e,t,r={}){this.match=e,this.match=e,this.handler=typeof t=="string"?dv(t):t,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}};fv=500;lf=new qe(/--$/,"\u2014",{inCodeMark:!1}),af=new qe(/\.\.\.$/,"\u2026",{inCodeMark:!1}),_x=new qe(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"\u201C",{inCodeMark:!1}),Vx=new qe(/"$/,"\u201D",{inCodeMark:!1}),qx=new qe(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"\u2018",{inCodeMark:!1}),Wx=new qe(/'$/,"\u2019",{inCodeMark:!1})});var df={};Be(df,{default:()=>mv});function uf(n){return/^www\./i.test(n)?`https://${n}`:/^[\w.+-]+@/.test(n)?`mailto:${n}`:n}function cf(n,e,t){let r=n.doc.resolve(t);if(!r.parent.isTextblock||r.parent.type.spec.code)return!1;let i=r.parent.textBetween(0,r.parentOffset,void 0,"\uFFFC").match(pv);if(!i)return!1;let s=i[1],l=t-i[2].length,a=l-s.length,c=oe(n).link;if(n.doc.rangeHasMark(a,l,c))return!1;let u=uf(s);return Le(u)?(e.addMark(a,l,c.create({href:u})),!0):!1}var pv,hv,mv,ff=O(()=>{"use strict";Fs();U();Ie();dt();pv=/(?:^|[\s(])((?:https?:\/\/|www\.)[^\s<>"]*[^\s<>".,;:!?)\]'"]|[\w.+-]+@[\w-]+(?:\.[\w-]+)+)([.,;:!?)\]'"]*)$/i,hv=/^(?:https?:\/\/|www\.)\S+$|^mailto:\S+$/i;mv={name:"autolink",prosemirrorPlugins:n=>[No({rules:[new qe(/\S\s$/,(e,t,r,o)=>{if(!n.isAllowed("link"))return null;let i=e.tr,s=r+t[0].length-1;return cf(e,i,s)?i.insertText(t[0].slice(-1),o).removeStoredMark(oe(e).link):null})]}),new _({appendTransaction(e,t,r){if(!n.isAllowed("link")||!e.some(a=>a.docChanged))return null;let{$from:o,empty:i}=r.selection;if(!i||o.parentOffset!==0||o.depth<1)return null;let s=B.findFrom(r.doc.resolve(o.before()),-1,!0);if(!s||!s.empty||s.$from.parentOffset!==s.$from.parent.content.size)return null;let l=r.tr;return cf(r,l,s.from)?l:null}}),new _({props:{handlePaste(e,t){let{state:r}=e;if(r.selection.empty||!n.isAllowed("link"))return!1;let o=(t.clipboardData?.getData("text/plain")??"").trim();if(!hv.test(o))return!1;let i=uf(o);if(!Le(i))return!1;let{from:s,to:l}=r.selection,a=oe(r).link;return e.dispatch(r.tr.removeMark(s,l,a).addMark(s,l,a.create({href:i}))),!0}}})]}});var hf={};Be(hf,{default:()=>yv});function bv(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}var pf,gv,yv,mf=O(()=>{"use strict";Se();pf='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l3 2"/></svg>',gv={en:{restore:"Restore last draft",found:"An unsaved draft was found. Use \u201CRestore last draft\u201D to bring it back.",restored:"Draft restored"},ru:{restore:"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A",found:"\u041D\u0430\u0439\u0434\u0435\u043D \u043D\u0435\u0441\u043E\u0445\u0440\u0430\u043D\u0451\u043D\u043D\u044B\u0439 \u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A. \u0415\u0433\u043E \u043C\u043E\u0436\u043D\u043E \u0432\u0435\u0440\u043D\u0443\u0442\u044C \u043A\u043D\u043E\u043F\u043A\u043E\u0439 \xAB\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A\xBB.",restored:"\u0427\u0435\u0440\u043D\u043E\u0432\u0438\u043A \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D"}};yv={name:"autosave",toolbar:"restoredraft",setup(n){let e=n.options.pluginOptions?.autosave??{},t=W(n,gv),r=bv(),o=e.key??`novaprose-draft:${typeof location>"u"?"":location.pathname}:${n.options.element.id||"editor"}`,i=e.delay??1e3,s=(e.retention??10080)*6e4,l=()=>{try{let h=JSON.parse(r?.getItem(o)??"null");return!h||typeof h.html!="string"||Date.now()-h.time>s?null:h}catch{return null}},a=l();a&&a.html===n.getHTML()&&(a=null),a&&n.ui.notify({text:t.found,timeout:8e3});let c,u=()=>{c=void 0;try{n.isEmpty()?r?.removeItem(o):r?.setItem(o,JSON.stringify({html:n.getHTML(),time:Date.now()}))}catch{}},d=n.on("change",()=>{a=null,clearTimeout(c),c=setTimeout(u,i)}),f=()=>{let h=a??l();h&&(n.setContent(h.html),a=null,n.ui.notify({text:t.restored}),n.focus())},p={icon:pf,tooltip:t.restore,isEnabled:()=>n.isEditable()&&a!==null,onAction:f};return n.ui.registry.addButton("restoredraft",p),n.ui.registry.addMenuItem("restoredraft",{text:t.restore,icon:pf,onAction:f}),()=>{d(),c!==void 0&&(clearTimeout(c),u())}}}});var gf={};Be(gf,{default:()=>vv});var vv,bf=O(()=>{"use strict";vv={name:"autoresize",setup(n){let{minHeight:e,maxHeight:t}=n.options.pluginOptions?.autoresize??{},r=n.root.querySelector(".nova-content");if(r)return n.root.classList.add("nova-autoresize"),e!==void 0&&n.root.style.setProperty("--nova-min-height",`${e}px`),t!==void 0&&(r.style.maxHeight=`${t}px`),()=>{n.root.classList.remove("nova-autoresize"),n.root.style.removeProperty("--nova-min-height"),r.style.removeProperty("max-height")}}}});var vf={};Be(vf,{default:()=>xv});var yf,wv,xv,wf=O(()=>{"use strict";Se();yf='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="3 3" aria-hidden="true"><rect x="3" y="4" width="18" height="6" rx="1"/><rect x="3" y="14" width="18" height="6" rx="1"/></svg>',wv={en:{title:"Show blocks"},ru:{title:"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0431\u043B\u043E\u043A\u0438"}},xv={name:"visualblocks",toolbar:"visualblocks",setup(n){let{title:e}=W(n,wv),t=n.options.pluginOptions?.visualblocks??{},r=()=>n.root.classList.contains("nova-visualblocks"),o=()=>{n.root.classList.toggle("nova-visualblocks"),n.updateUI(),n.focus()};return t.default&&n.root.classList.add("nova-visualblocks"),n.ui.registry.addToggleButton("visualblocks",{icon:yf,tooltip:e,isActive:r,onAction:o}),n.ui.registry.addToggleMenuItem("visualblocks",{text:e,icon:yf,isActive:r,onAction:o}),()=>n.root.classList.remove("nova-visualblocks")}}});var Mf={};Be(Mf,{default:()=>Sv});function Mv(n){return n.view.state.selection.$from.parent.attrs.dir??null}function kf(n){return(e,t)=>{let{paragraph:r,heading:o}=Z(e),i=e.tr,s=!1;return e.doc.nodesBetween(e.selection.from,e.selection.to,(l,a)=>l.type!==r&&l.type!==o?!0:(s=!0,i.setNodeMarkup(a,void 0,{...l.attrs,dir:n}),!1)),s?(t?.(i),!0):!1}}var xf,kv,Sv,Sf=O(()=>{"use strict";Ie();Se();xf={ltr:'<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 4v10M13 4v10M7 4h9M5 19h14l-3-3M19 19l-3 3"/></svg>',rtl:'<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11 4v10M15 4v10M9 4h9M19 19H5l3-3M5 19l3 3"/></svg>'},kv={en:{ltr:"Left to right",rtl:"Right to left"},ru:{ltr:"\u0421\u043B\u0435\u0432\u0430 \u043D\u0430\u043F\u0440\u0430\u0432\u043E",rtl:"\u0421\u043F\u0440\u0430\u0432\u0430 \u043D\u0430\u043B\u0435\u0432\u043E"}};Sv={name:"directionality",toolbar:"ltr rtl",setup(n){let e=W(n,kv);for(let t of["ltr","rtl"]){let r=()=>Mv(n)===t,o=()=>{n.exec(kf(r()?null:t)),n.focus()};n.ui.registry.addToggleButton(t,{icon:xf[t],tooltip:e[t],isActive:r,isEnabled:i=>i.can(kf(t)),onAction:o}),n.ui.registry.addToggleMenuItem(t,{text:e[t],icon:xf[t],isActive:r,onAction:o})}}}});var Cf={};Be(Cf,{default:()=>Av});function $s(n,e){let{$from:t}=n.selection;for(let r=t.depth;r>0;r--){let o=t.node(r);if(o.type===e)return{pos:t.before(r),attrs:o.attrs}}return null}function Ev(n,e,t,r){let o=()=>Z(n.view.state)[e];$s(n.view.state,o())||n.exec(e==="bullet_list"?"bulletList":"orderedList");let i=$s(n.view.state,o());if(!i)return;let{state:s,dispatch:l}=n.view;l(s.tr.setNodeMarkup(i.pos,void 0,{...i.attrs,listStyle:t===r?null:t})),n.focus()}var Cv,Av,Ef=O(()=>{"use strict";Ie();ft();Se();Cv={en:{disc:"Default",circle:"Circle",square:"Square",decimal:"Default (1, 2, 3)","lower-alpha":"Lower alpha (a, b, c)","upper-alpha":"Upper alpha (A, B, C)","lower-roman":"Lower roman (i, ii, iii)","upper-roman":"Upper roman (I, II, III)","lower-greek":"Lower greek (\u03B1, \u03B2, \u03B3)"},ru:{disc:"\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",circle:"\u041A\u0440\u0443\u0436\u043E\u043A",square:"\u041A\u0432\u0430\u0434\u0440\u0430\u0442",decimal:"\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E (1, 2, 3)","lower-alpha":"\u0421\u0442\u0440\u043E\u0447\u043D\u044B\u0435 \u0431\u0443\u043A\u0432\u044B (a, b, c)","upper-alpha":"\u041F\u0440\u043E\u043F\u0438\u0441\u043D\u044B\u0435 \u0431\u0443\u043A\u0432\u044B (A, B, C)","lower-roman":"\u0420\u0438\u043C\u0441\u043A\u0438\u0435 \u0441\u0442\u0440\u043E\u0447\u043D\u044B\u0435 (i, ii, iii)","upper-roman":"\u0420\u0438\u043C\u0441\u043A\u0438\u0435 \u043F\u0440\u043E\u043F\u0438\u0441\u043D\u044B\u0435 (I, II, III)","lower-greek":"\u0413\u0440\u0435\u0447\u0435\u0441\u043A\u0438\u0435 (\u03B1, \u03B2, \u03B3)"}};Av={name:"advlist",setup(n){let e=W(n,Cv),t=n.options.pluginOptions?.advlist??{},r=[{control:"bullist",kind:"bullet_list",styles:t.bullets??[...wo],fallback:"disc"},{control:"numlist",kind:"ordered_list",styles:t.numbers??[...xo],fallback:"decimal"}];for(let{control:o,kind:i,styles:s,fallback:l}of r){let a=n.ui.registry.get(o);if(!a||a.type!=="button")continue;let{type:c,...u}=a;n.ui.registry.addSplitButton(o,{...u,items:d=>{let f=$s(d.view.state,Z(d.view.state)[i]),p=f?.attrs.listStyle??(f?l:null);return s.map(h=>({id:h,label:e[h],active:p===h,onSelect:()=>Ev(d,i,h,l)}))}})}}}});function Af(n={}){return new _({view(e){return new _s(e,n)}})}var _s,Tf=O(()=>{"use strict";U();Je();_s=class{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,l=i.height/o.offsetHeight;if(t){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let h=p.getBoundingClientRect(),m=d?h.bottom:h.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*l;r={left:h.left,right:h.right,top:m-b,bottom:m+b}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,p=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*p}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,t,e):o;if(!t||i)return null;let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=$r(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}return s}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}});function Nf(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function Tv(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||Nf(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Nv(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||Nf(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Of(){return new _({props:{decorations:Rv,createSelectionBetween(n,e,t){return e.pos==t.pos&&xe.valid(t)?new xe(t):null},handleClick:Lv,handleKeyDown:Ov,handleDOMEvents:{beforeinput:Dv}}})}function Lo(n,e){let t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof P){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=xe.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new xe(c))),!0):!1}}function Lv(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!xe.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&R.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new xe(r))),!0)}function Dv(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof xe))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let o=E.empty;for(let s=r.length-1;s>=0;s--)o=E.from(r[s].createAndFill(null,o));let i=n.state.tr.replace(t.pos,t.pos,new N(o,0,0));return i.setSelection(P.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function Rv(n){if(!(n.selection instanceof xe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",K.create(n.doc,[ee.widget(n.selection.head,e,{key:"gapcursor"})])}var xe,Vs,Ov,Lf=O(()=>{"use strict";at();U();le();Tt();xe=class n extends B{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return n.valid(r)?new n(r):B.near(r)}content(){return N.empty}eq(e){return e instanceof n&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new n(e.resolve(t.pos))}getBookmark(){return new Vs(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Tv(e)||!Nv(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&n.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=t;let a=e.doc.resolve(o);if(n.valid(a))return a}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!R.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*t),r=!1;continue e}break}i=s,o+=t;let l=e.doc.resolve(o);if(n.valid(l))return l}return null}}};xe.prototype.visible=!1;xe.findFrom=xe.findGapCursorFrom;B.jsonID("gapcursor",xe);Vs=class n{constructor(e){this.pos=e}map(e){return new n(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return xe.valid(t)?new xe(t):B.near(t)}};Ov=ar({ArrowLeft:Lo("horiz",-1),ArrowRight:Lo("horiz",1),ArrowUp:Lo("vert",-1),ArrowDown:Lo("vert",1)})});var Do,Df=O(()=>{"use strict";Do={"toolbar.label":"Formatting","toolbar.options":"options","editor.label":"Rich text editor","editor.required":"Please fill in this field.",undo:"Undo",redo:"Redo",bold:"Bold",italic:"Italic",underline:"Underline",strike:"Strikethrough",code:"Inline code",subscript:"Subscript",superscript:"Superscript",link:"Link",unlink:"Remove link",image:"Image",bulletList:"Bulleted list",orderedList:"Numbered list",indent:"Increase indent",outdent:"Decrease indent",align:"Alignment",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignJustify:"Justify",blockquote:"Quote",codeBlock:"Code block",horizontalRule:"Horizontal line",clearFormatting:"Clear formatting",more:"More",moreFormats:"More formatting",blocks:"Text style",paragraph:"Paragraph",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",fontFamily:"Font",fontSize:"Font size",lineHeight:"Line height",default:"Default",textColor:"Text color",backgroundColor:"Highlight color",removeColor:"Remove color",customColor:"Custom color","dialog.cancel":"Cancel","dialog.save":"Save","dialog.insert":"Insert","dialog.close":"Close","link.title":"Insert link","link.editTitle":"Edit link","link.url":"URL","link.text":"Text to display","link.tooltip":"Title (tooltip)","link.newTab":"Open in new tab","link.open":"Open link","link.edit":"Edit link","link.copy":"Copy link","link.copied":"Link copied","link.invalid":"This URL is not allowed","image.title":"Insert image","image.url":"Image URL","image.alt":"Alternative text","image.altHint":"Describe the image for people using screen readers","image.upload":"Upload","image.drop":"Drop an image here or click to choose","image.uploading":"Uploading image\u2026","image.uploadFailed":"Image upload failed","image.invalid":"This image URL is not allowed","image.or":"or","image.toolbar":"Image options","image.alignLeft":"Float left","image.alignCenter":"Center","image.alignRight":"Float right","image.editAlt":"Alternative text","image.size":"Size","image.sizeSmall":"Small (25%)","image.sizeMedium":"Medium (50%)","image.sizeLarge":"Large (75%)","image.sizeFull":"Full width","image.sizeOriginal":"Original size","image.delete":"Remove image","status.words":"{count} words",pasteAsText:"Paste as text","menu.label":"Menu","menu.file":"File","menu.edit":"Edit","menu.view":"View","menu.insert":"Insert","menu.format":"Format","menu.table":"Table","menu.help":"Help",selectAll:"Select all",print:"Print","table.rows":"Rows","table.cols":"Columns","table.invalidSize":"Enter a number from 1 to 50","quickbars.selection":"Quick formatting","quickbars.insert":"Quick insert","search.title":"Find and replace","search.find":"Find","search.replace":"Replace with","search.next":"Next match","search.prev":"Previous match","search.replaceOne":"Replace","search.replaceAll":"Replace all","search.matchCase":"Match case","search.wholeWord":"Whole words only","search.count":"{current} of {total}","search.none":"No results",fullscreen:"Fullscreen",preview:"Preview",sourceCode:"Source code",help:"Keyboard shortcuts","help.formatting":"Text formatting","help.blocks":"Paragraphs and lists","help.editing":"Editing","help.navigation":"Navigation","help.slash":"Insert block (slash commands)","help.toMenubar":"Move to the menu bar","help.toToolbar":"Move to the toolbar","help.toContextToolbar":"Move to the image/table toolbar","help.toEditor":"Back to the text","help.nextCell":"Next table cell",table:"Table","table.insert":"Insert table","table.size":"{rows} \xD7 {cols}","table.toolbar":"Table options","table.rowBefore":"Insert row above","table.rowAfter":"Insert row below","table.rowDelete":"Delete row","table.colBefore":"Insert column left","table.colAfter":"Insert column right","table.colDelete":"Delete column","table.merge":"Merge cells","table.split":"Split cell","table.rowHeader":"Header row","table.colHeader":"Header column","table.cellBackground":"Cell background","table.delete":"Delete table","table.sort":"Sort","table.sortAsc":"Sort A \u2192 Z, 1 \u2192 9","table.sortDesc":"Sort Z \u2192 A, 9 \u2192 1","table.props":"Table properties","table.width":"Width","table.widthHint":"For example 100% or 600px. Leave empty to fit the content.","table.invalidWidth":"Enter a width such as 100% or 600px","table.align":"Alignment on the page","table.alignDefault":"Default","table.alignCenter":"Center","table.alignRight":"Right","table.cellProps":"Cell properties","table.valign":"Vertical alignment","table.valignTop":"Top","table.valignMiddle":"Middle","table.valignBottom":"Bottom","table.cellType":"Cell type","table.cellData":"Data cell","table.cellHeader":"Header cell","table.colWidth":"Column width, px","table.colWidthHint":"Leave empty to fit the content.","table.invalidColWidth":"Enter a number from 24 to 4000","slash.label":"Commands","slash.empty":"No matching commands"}});var Rf,If=O(()=>{"use strict";Rf={"toolbar.label":"\u0424\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435","toolbar.options":"\u0432\u0430\u0440\u0438\u0430\u043D\u0442\u044B","editor.label":"\u0422\u0435\u043A\u0441\u0442\u043E\u0432\u044B\u0439 \u0440\u0435\u0434\u0430\u043A\u0442\u043E\u0440","editor.required":"\u0417\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u0435 \u044D\u0442\u043E \u043F\u043E\u043B\u0435.",undo:"\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C",redo:"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C",bold:"\u0416\u0438\u0440\u043D\u044B\u0439",italic:"\u041A\u0443\u0440\u0441\u0438\u0432",underline:"\u041F\u043E\u0434\u0447\u0451\u0440\u043A\u043D\u0443\u0442\u044B\u0439",strike:"\u0417\u0430\u0447\u0451\u0440\u043A\u043D\u0443\u0442\u044B\u0439",code:"\u041A\u043E\u0434 \u0432 \u0441\u0442\u0440\u043E\u043A\u0435",subscript:"\u041F\u043E\u0434\u0441\u0442\u0440\u043E\u0447\u043D\u044B\u0439",superscript:"\u041D\u0430\u0434\u0441\u0442\u0440\u043E\u0447\u043D\u044B\u0439",link:"\u0421\u0441\u044B\u043B\u043A\u0430",unlink:"\u0423\u0431\u0440\u0430\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443",image:"\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435",bulletList:"\u041C\u0430\u0440\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0441\u043F\u0438\u0441\u043E\u043A",orderedList:"\u041D\u0443\u043C\u0435\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0441\u043F\u0438\u0441\u043E\u043A",indent:"\u0423\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C \u043E\u0442\u0441\u0442\u0443\u043F",outdent:"\u0423\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C \u043E\u0442\u0441\u0442\u0443\u043F",align:"\u0412\u044B\u0440\u0430\u0432\u043D\u0438\u0432\u0430\u043D\u0438\u0435",alignLeft:"\u041F\u043E \u043B\u0435\u0432\u043E\u043C\u0443 \u043A\u0440\u0430\u044E",alignCenter:"\u041F\u043E \u0446\u0435\u043D\u0442\u0440\u0443",alignRight:"\u041F\u043E \u043F\u0440\u0430\u0432\u043E\u043C\u0443 \u043A\u0440\u0430\u044E",alignJustify:"\u041F\u043E \u0448\u0438\u0440\u0438\u043D\u0435",blockquote:"\u0426\u0438\u0442\u0430\u0442\u0430",codeBlock:"\u0411\u043B\u043E\u043A \u043A\u043E\u0434\u0430",horizontalRule:"\u0413\u043E\u0440\u0438\u0437\u043E\u043D\u0442\u0430\u043B\u044C\u043D\u0430\u044F \u043B\u0438\u043D\u0438\u044F",clearFormatting:"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435",more:"\u0415\u0449\u0451",moreFormats:"\u0415\u0449\u0451 \u0444\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435",blocks:"\u0421\u0442\u0438\u043B\u044C \u0442\u0435\u043A\u0441\u0442\u0430",paragraph:"\u041E\u0431\u044B\u0447\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442",h1:"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 1",h2:"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 2",h3:"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 3",h4:"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 4",h5:"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 5",h6:"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A 6",fontFamily:"\u0428\u0440\u0438\u0444\u0442",fontSize:"\u0420\u0430\u0437\u043C\u0435\u0440 \u0448\u0440\u0438\u0444\u0442\u0430",lineHeight:"\u041C\u0435\u0436\u0441\u0442\u0440\u043E\u0447\u043D\u044B\u0439 \u0438\u043D\u0442\u0435\u0440\u0432\u0430\u043B",default:"\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",textColor:"\u0426\u0432\u0435\u0442 \u0442\u0435\u043A\u0441\u0442\u0430",backgroundColor:"\u0426\u0432\u0435\u0442 \u0432\u044B\u0434\u0435\u043B\u0435\u043D\u0438\u044F",removeColor:"\u0423\u0431\u0440\u0430\u0442\u044C \u0446\u0432\u0435\u0442",customColor:"\u0421\u0432\u043E\u0439 \u0446\u0432\u0435\u0442","dialog.cancel":"\u041E\u0442\u043C\u0435\u043D\u0430","dialog.save":"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C","dialog.insert":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C","dialog.close":"\u0417\u0430\u043A\u0440\u044B\u0442\u044C","link.title":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443","link.editTitle":"\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443","link.url":"\u0410\u0434\u0440\u0435\u0441","link.text":"\u0422\u0435\u043A\u0441\u0442 \u0441\u0441\u044B\u043B\u043A\u0438","link.tooltip":"\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430 (title)","link.newTab":"\u041E\u0442\u043A\u0440\u044B\u0432\u0430\u0442\u044C \u0432 \u043D\u043E\u0432\u043E\u0439 \u0432\u043A\u043B\u0430\u0434\u043A\u0435","link.open":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443","link.edit":"\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443","link.copy":"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443","link.copied":"\u0421\u0441\u044B\u043B\u043A\u0430 \u0441\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u0430","link.invalid":"\u0422\u0430\u043A\u043E\u0439 \u0430\u0434\u0440\u0435\u0441 \u043D\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043D","image.title":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435","image.url":"\u0410\u0434\u0440\u0435\u0441 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F","image.alt":"\u0410\u043B\u044C\u0442\u0435\u0440\u043D\u0430\u0442\u0438\u0432\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442","image.altHint":"\u041E\u043F\u0438\u0448\u0438\u0442\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0434\u043B\u044F \u043B\u044E\u0434\u0435\u0439, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044E\u0449\u0438\u0445 \u044D\u043A\u0440\u0430\u043D\u043D\u044B\u0439 \u0434\u0438\u043A\u0442\u043E\u0440","image.upload":"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C","image.drop":"\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0441\u044E\u0434\u0430 \u0438\u043B\u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u0432\u044B\u0431\u0440\u0430\u0442\u044C","image.uploading":"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F\u2026","image.uploadFailed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435","image.invalid":"\u0422\u0430\u043A\u043E\u0439 \u0430\u0434\u0440\u0435\u0441 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u043D\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043D","image.or":"\u0438\u043B\u0438","image.toolbar":"\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F","image.alignLeft":"\u041E\u0431\u0442\u0435\u043A\u0430\u043D\u0438\u0435, \u0441\u043B\u0435\u0432\u0430","image.alignCenter":"\u041F\u043E \u0446\u0435\u043D\u0442\u0440\u0443","image.alignRight":"\u041E\u0431\u0442\u0435\u043A\u0430\u043D\u0438\u0435, \u0441\u043F\u0440\u0430\u0432\u0430","image.editAlt":"\u0410\u043B\u044C\u0442\u0435\u0440\u043D\u0430\u0442\u0438\u0432\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442","image.size":"\u0420\u0430\u0437\u043C\u0435\u0440","image.sizeSmall":"\u041C\u0430\u043B\u0435\u043D\u044C\u043A\u0438\u0439 (25%)","image.sizeMedium":"\u0421\u0440\u0435\u0434\u043D\u0438\u0439 (50%)","image.sizeLarge":"\u0411\u043E\u043B\u044C\u0448\u043E\u0439 (75%)","image.sizeFull":"\u0412\u043E \u0432\u0441\u044E \u0448\u0438\u0440\u0438\u043D\u0443","image.sizeOriginal":"\u0418\u0441\u0445\u043E\u0434\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440","image.delete":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435","status.words":"\u0421\u043B\u043E\u0432: {count}",pasteAsText:"\u0412\u0441\u0442\u0430\u0432\u043B\u044F\u0442\u044C \u043A\u0430\u043A \u0442\u0435\u043A\u0441\u0442","menu.label":"\u041C\u0435\u043D\u044E","menu.file":"\u0424\u0430\u0439\u043B","menu.edit":"\u041F\u0440\u0430\u0432\u043A\u0430","menu.view":"\u0412\u0438\u0434","menu.insert":"\u0412\u0441\u0442\u0430\u0432\u043A\u0430","menu.format":"\u0424\u043E\u0440\u043C\u0430\u0442","menu.table":"\u0422\u0430\u0431\u043B\u0438\u0446\u0430","menu.help":"\u0421\u043F\u0440\u0430\u0432\u043A\u0430",selectAll:"\u0412\u044B\u0434\u0435\u043B\u0438\u0442\u044C \u0432\u0441\u0451",print:"\u041F\u0435\u0447\u0430\u0442\u044C","table.rows":"\u0421\u0442\u0440\u043E\u043A\u0438","table.cols":"\u0421\u0442\u043E\u043B\u0431\u0446\u044B","table.invalidSize":"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043B\u043E \u043E\u0442 1 \u0434\u043E 50","quickbars.selection":"\u0411\u044B\u0441\u0442\u0440\u043E\u0435 \u0444\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435","quickbars.insert":"\u0411\u044B\u0441\u0442\u0440\u0430\u044F \u0432\u0441\u0442\u0430\u0432\u043A\u0430","search.title":"\u041D\u0430\u0439\u0442\u0438 \u0438 \u0437\u0430\u043C\u0435\u043D\u0438\u0442\u044C","search.find":"\u041D\u0430\u0439\u0442\u0438","search.replace":"\u0417\u0430\u043C\u0435\u043D\u0438\u0442\u044C \u043D\u0430","search.next":"\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0435 \u0441\u043E\u0432\u043F\u0430\u0434\u0435\u043D\u0438\u0435","search.prev":"\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0435\u0435 \u0441\u043E\u0432\u043F\u0430\u0434\u0435\u043D\u0438\u0435","search.replaceOne":"\u0417\u0430\u043C\u0435\u043D\u0438\u0442\u044C","search.replaceAll":"\u0417\u0430\u043C\u0435\u043D\u0438\u0442\u044C \u0432\u0441\u0435","search.matchCase":"\u0423\u0447\u0438\u0442\u044B\u0432\u0430\u0442\u044C \u0440\u0435\u0433\u0438\u0441\u0442\u0440","search.wholeWord":"\u0422\u043E\u043B\u044C\u043A\u043E \u0441\u043B\u043E\u0432\u043E \u0446\u0435\u043B\u0438\u043A\u043E\u043C","search.count":"{current} \u0438\u0437 {total}","search.none":"\u041D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",fullscreen:"\u041D\u0430 \u0432\u0435\u0441\u044C \u044D\u043A\u0440\u0430\u043D",preview:"\u041F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440",sourceCode:"HTML-\u043A\u043E\u0434",help:"\u0413\u043E\u0440\u044F\u0447\u0438\u0435 \u043A\u043B\u0430\u0432\u0438\u0448\u0438","help.formatting":"\u0424\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u0442\u0435\u043A\u0441\u0442\u0430","help.blocks":"\u0410\u0431\u0437\u0430\u0446\u044B \u0438 \u0441\u043F\u0438\u0441\u043A\u0438","help.editing":"\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435","help.navigation":"\u041D\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044F","help.slash":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0431\u043B\u043E\u043A (\u0441\u043B\u044D\u0448-\u043A\u043E\u043C\u0430\u043D\u0434\u044B)","help.toMenubar":"\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0433\u043B\u0430\u0432\u043D\u043E\u0435 \u043C\u0435\u043D\u044E","help.toToolbar":"\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u043D\u0430 \u043F\u0430\u043D\u0435\u043B\u044C \u0438\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442\u043E\u0432","help.toContextToolbar":"\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u043D\u0430 \u043F\u0430\u043D\u0435\u043B\u044C \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0438/\u0442\u0430\u0431\u043B\u0438\u0446\u044B","help.toEditor":"\u0412\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F \u0432 \u0442\u0435\u043A\u0441\u0442","help.nextCell":"\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F \u044F\u0447\u0435\u0439\u043A\u0430 \u0442\u0430\u0431\u043B\u0438\u0446\u044B",table:"\u0422\u0430\u0431\u043B\u0438\u0446\u0430","table.insert":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0442\u0430\u0431\u043B\u0438\u0446\u0443","table.size":"{rows} \xD7 {cols}","table.toolbar":"\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0442\u0430\u0431\u043B\u0438\u0446\u044B","table.rowBefore":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443 \u0432\u044B\u0448\u0435","table.rowAfter":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443 \u043D\u0438\u0436\u0435","table.rowDelete":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443","table.colBefore":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0435\u0446 \u0441\u043B\u0435\u0432\u0430","table.colAfter":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0435\u0446 \u0441\u043F\u0440\u0430\u0432\u0430","table.colDelete":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0435\u0446","table.merge":"\u041E\u0431\u044A\u0435\u0434\u0438\u043D\u0438\u0442\u044C \u044F\u0447\u0435\u0439\u043A\u0438","table.split":"\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u044C \u044F\u0447\u0435\u0439\u043A\u0443","table.rowHeader":"\u0421\u0442\u0440\u043E\u043A\u0430 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u043E\u0432","table.colHeader":"\u0421\u0442\u043E\u043B\u0431\u0435\u0446 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u043E\u0432","table.cellBackground":"\u0424\u043E\u043D \u044F\u0447\u0435\u0439\u043A\u0438","table.delete":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0442\u0430\u0431\u043B\u0438\u0446\u0443","table.sort":"\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430","table.sortAsc":"\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0410 \u2192 \u042F, 1 \u2192 9","table.sortDesc":"\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u042F \u2192 \u0410, 9 \u2192 1","table.props":"\u0421\u0432\u043E\u0439\u0441\u0442\u0432\u0430 \u0442\u0430\u0431\u043B\u0438\u0446\u044B","table.width":"\u0428\u0438\u0440\u0438\u043D\u0430","table.widthHint":"\u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, 100% \u0438\u043B\u0438 600px. \u041F\u0443\u0441\u0442\u043E \u2014 \u043F\u043E \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u043C\u0443.","table.invalidWidth":"\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0448\u0438\u0440\u0438\u043D\u0443, \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 100% \u0438\u043B\u0438 600px","table.align":"\u0412\u044B\u0440\u0430\u0432\u043D\u0438\u0432\u0430\u043D\u0438\u0435 \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435","table.alignDefault":"\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E","table.alignCenter":"\u041F\u043E \u0446\u0435\u043D\u0442\u0440\u0443","table.alignRight":"\u0421\u043F\u0440\u0430\u0432\u0430","table.cellProps":"\u0421\u0432\u043E\u0439\u0441\u0442\u0432\u0430 \u044F\u0447\u0435\u0439\u043A\u0438","table.valign":"\u0412\u0435\u0440\u0442\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0435 \u0432\u044B\u0440\u0430\u0432\u043D\u0438\u0432\u0430\u043D\u0438\u0435","table.valignTop":"\u0421\u0432\u0435\u0440\u0445\u0443","table.valignMiddle":"\u041F\u043E \u0446\u0435\u043D\u0442\u0440\u0443","table.valignBottom":"\u0421\u043D\u0438\u0437\u0443","table.cellType":"\u0422\u0438\u043F \u044F\u0447\u0435\u0439\u043A\u0438","table.cellData":"\u041E\u0431\u044B\u0447\u043D\u0430\u044F","table.cellHeader":"\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A","table.colWidth":"\u0428\u0438\u0440\u0438\u043D\u0430 \u0441\u0442\u043E\u043B\u0431\u0446\u0430, px","table.colWidthHint":"\u041F\u0443\u0441\u0442\u043E \u2014 \u043F\u043E \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u043C\u0443.","table.invalidColWidth":"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043B\u043E \u043E\u0442 24 \u0434\u043E 4000","slash.label":"\u041A\u043E\u043C\u0430\u043D\u0434\u044B","slash.empty":"\u041D\u0435\u0442 \u043F\u043E\u0434\u0445\u043E\u0434\u044F\u0449\u0438\u0445 \u043A\u043E\u043C\u0430\u043D\u0434"}});function Bf(n="en",e={}){let t=n.toLowerCase(),r=Pf[t]??Pf[t.split("-")[0]]??Do,o={...Do,...r,...e};return(i,s)=>{let l=o[i]??i;return s?l.replace(/\{(\w+)\}/g,(a,c)=>String(s[c]??`{${c}}`)):l}}var Pf,zf=O(()=>{"use strict";Df();If();Pf={en:Do,ru:Rf}});function Hf(n=()=>!0,e=Xt){let{nodes:t}=e,r=[af,lf];n("blockquote")&&r.push(Oo(/^\s*>\s$/,t.blockquote)),n("numlist")&&r.push(Oo(/^(\d+)\.\s$/,t.ordered_list,o=>({start:Number(o[1])}),(o,i)=>i.childCount+i.attrs.start===Number(o[1]))),n("bullist")&&r.push(Oo(/^\s*([-+*])\s$/,t.bullet_list)),n("codeblock")&&r.push(Hs(/^```$/,t.code_block));for(let o=1;o<=6;o++)n(`h${o}`)&&r.push(Hs(new RegExp(`^(#{${o}})\\s$`),t.heading,{level:o}));return No({rules:r})}var Ff=O(()=>{"use strict";Fs();ft()});function $f(n=e=>J[e]){let e={"Mod-z":qs(n,"undo"),"Shift-Mod-z":qs(n,"redo"),"Mod-b":J.bold,"Mod-i":J.italic,"Mod-u":J.underline,"Mod-Shift-x":J.strike,"Mod-e":J.code,"Mod-,":J.subscript,"Mod-.":J.superscript,"Mod-Alt-0":J.paragraph,"Mod-Alt-1":J.h1,"Mod-Alt-2":J.h2,"Mod-Alt-3":J.h3,"Mod-Alt-4":J.h4,"Mod-Alt-5":J.h5,"Mod-Alt-6":J.h6,"Mod-Shift-7":J.orderedList,"Mod-Shift-8":J.bulletList,"Mod-Shift-l":J.alignLeft,"Mod-Shift-e":J.alignCenter,"Mod-Shift-r":J.alignRight,"Mod-Shift-j":J.alignJustify,"Mod-\\":J.clearFormatting,"Shift-Enter":Pv,Enter:(t,r)=>bd(Z(t).list_item)(t,r),Tab:J.indent,"Shift-Tab":J.outdent};return Iv||(e["Mod-y"]=qs(n,"redo")),[He(e),He(ad)]}var Iv,Pv,qs,_f=O(()=>{"use strict";As();at();Is();Ie();Iv=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Pv=pr(Cs,(n,e)=>(e?.(n.tr.replaceSelectionWith(Z(n).hard_break.create()).scrollIntoView()),!0)),qs=(n,e)=>(t,r,o)=>n(e)(t,r,o)});function Bv(n){return/data-pm-slice=/.test(n)?"nova":/<google-sheets-html-origin|data-sheets-(root|value)/i.test(n)?"google-sheets":/id="docs-internal-guid-/.test(n)?"google-docs":/urn:schemas-microsoft-com:office:excel|ProgId"?\s+content="?Excel\.Sheet/i.test(n)?"excel":/urn:schemas-microsoft-com:office:word|class="?Mso|mso-list:|content="?Microsoft Word/i.test(n)?"word":/class="[^"]*\b(TextRun|OutlineElement|EOP|SCXW\d+|BCX\d+)\b|data-ccp-props|paraid=/.test(n)?"word-online":/content="?LibreOffice|content="?OpenOffice/i.test(n)?"libreoffice":"web"}function Uf(n,e="clean"){let t=Bv(n);if(t==="nova")return n;let r=document.createElement("template");r.innerHTML=n;let o=document.createElement("div");return o.append(r.content),zv(o),Fv(o),t==="word"&&jv(o),t==="google-docs"&&Yv(o),Gv(o),Qv(o),o.querySelectorAll("[style]").forEach(i=>tw(i,e)),e==="clean"&&nw(o),rw(o),ow(o),iw(o),sw(o),o.innerHTML}function Ws(n){let e=new Map;for(let t of n.split(";")){let r=t.indexOf(":");if(r<0)continue;let o=t.slice(0,r).trim().toLowerCase(),i=t.slice(r+1).trim().replace(/\s*!important$/i,"");o&&i&&e.set(o,i)}return e}function jf(n){return[...n].map(([e,t])=>`${e}: ${t}`).join("; ")}function zv(n){let e=[...n.querySelectorAll("style")].map(o=>o.textContent??"");if(!e.length)return;let t=[],r=e.join(`
12
+ `).replace(/\/\*[\s\S]*?\*\//g,"").replace(/<!--|-->/g,"");for(let o of r.matchAll(/([^{}@]+)\{([^{}]*)\}/g)){let i=Ws(o[2]);for(let s of o[1].split(",")){let l=s.trim().match(/^([a-z][a-z0-9]*)?\.([\w-]+)$/i);l&&t.push({tag:(l[1]??"").toLowerCase(),cls:l[2],decls:i})}}t.length&&n.querySelectorAll("[class]").forEach(o=>{let i=o.className.split(/\s+/).filter(Boolean),s=new Map;for(let l of t)i.includes(l.cls)&&(l.tag&&l.tag!==o.tagName.toLowerCase()||l.decls.forEach((a,c)=>s.set(c,a)));s.size&&(Ws(o.getAttribute("style")??"").forEach((l,a)=>s.set(a,l)),o.setAttribute("style",jf(s)))})}function Fv(n){let e=document.createTreeWalker(n,NodeFilter.SHOW_COMMENT),t=[];for(;e.nextNode();)t.push(e.currentNode);t.forEach(r=>r.parentNode?.removeChild(r));for(let r of[...n.querySelectorAll("*")]){if(!n.contains(r))continue;let o=r.tagName.toUpperCase();if(Hv.test(o)){r.remove();continue}if(o.includes(":")){let i=o.split(":")[0];i==="O"||i==="V"?r.remove():In(r)}}n.querySelectorAll("span.EOP").forEach(r=>{/^\s*$/.test(r.textContent??"")&&r.remove()}),n.querySelectorAll("a").forEach(r=>{let o=r.getAttribute("href")??"",i=o.match(/^https?:\/\/(www\.)?google\.[a-z.]+\/url\?(.*)$/i);if(i){let s=new URLSearchParams(i[2]).get("q");s&&r.setAttribute("href",s)}(!o||/^#_(ftn|edn|msocom|Toc|Ref)/i.test(o))&&In(r)}),n.querySelectorAll('br[style*="page-break"]').forEach(r=>r.remove()),n.querySelectorAll('[style*="mso-element:footnote-list"], [style*="mso-element:comment-list"], [style*="mso-element:endnote-list"]').forEach(r=>r.remove())}function _v(n){let t=(n.getAttribute("style")??"").match(/mso-list:\s*(l\d+)\s+level(\d+)/i);if(!t)return null;let r=[...n.querySelectorAll("[style]")].find(a=>/mso-list:\s*Ignore/i.test(a.getAttribute("style")??"")),o=(r?.textContent??"").replace(/\s+/g,"");r?.remove();let i=$v.test(o),{style:s,start:l}=i?Wv(o):{style:Uv(o),start:1};return{el:n,level:Math.max(1,Math.min(9,Number(t[2]))),ordered:i,start:l,style:s}}function qv(n){let e=0,t=n.toLowerCase();for(let r=0;r<t.length;r++){let o=Vf[t[r]],i=Vf[t[r+1]??""]??0;e+=o<i?-o:o}return e}function Wv(n){let e=n.match(/\d+/);if(e)return{style:null,start:Number(e[0])};let t=n.replace(/[^a-z]/gi,"");return Vv.test(t)?{style:t===t.toLowerCase()?"lower-roman":"upper-roman",start:qv(t)}:{style:t===t.toLowerCase()?"lower-alpha":"upper-alpha",start:t.toLowerCase().charCodeAt(0)-96}}function Uv(n){return n==="o"?"circle":/^[§▪■]$/.test(n)?"square":null}function jv(n){let e=[...n.querySelectorAll("p, div, h1, h2, h3, h4, h5, h6")].filter(o=>/mso-list:\s*l\d+\s+level\d+/i.test(o.getAttribute("style")??""));for(let o of e.filter(i=>/^H[1-6]$/.test(i.tagName)))o.querySelectorAll("[style]").forEach(i=>{if(!/mso-list:\s*Ignore/i.test(i.getAttribute("style")??""))return;let s=(i.textContent??"").replace(/\s+/g,"");i.replaceWith(i.ownerDocument.createTextNode(`${s} `))});let t=e.filter(o=>!/^H[1-6]$/.test(o.tagName)),r=new Set;for(let o of t){if(r.has(o))continue;let i=[],s=o;for(;s instanceof HTMLElement&&t.includes(s);){let l=_v(s);if(!l)break;i.push(l),r.add(s),s=Kf(s)}i.length&&Kv(i)}}function Kf(n){let e=n.nextSibling;for(;e&&e.nodeType===Node.TEXT_NODE&&!e.textContent?.trim();)e=e.nextSibling;return e instanceof Element?e:null}function Kv(n){let e=n[0].el.ownerDocument,t=n[0].el,r=[],o=null;for(let i of n){for(;r.length&&r[r.length-1].level>i.level;)r.pop();let s=r[r.length-1];if(!s||s.level<i.level){let c=e.createElement(i.ordered?"ol":"ul");i.ordered&&i.start!==1&&c.setAttribute("start",String(i.start)),i.style&&(c.style.listStyleType=i.style),s?(s.list.lastElementChild??s.list.appendChild(e.createElement("li"))).appendChild(c):o=c,s={list:c,level:i.level},r.push(s)}let l=e.createElement("li"),a=e.createElement("p");for(;i.el.firstChild;)a.appendChild(i.el.firstChild);l.appendChild(a),s.list.appendChild(l)}t.replaceWith(o),n.slice(1).forEach(i=>i.el.remove())}function Jv(n){let e=n.getAttribute("aria-level")??n.getAttribute("data-aria-level"),t=e?Number(e):NaN;return Number.isFinite(t)&&t>=1?Math.min(9,t):null}function Gv(n){n.querySelectorAll("div").forEach(r=>{let o=r.children.length===1?r.firstElementChild:null;o&&/^(UL|OL)$/.test(o.tagName)&&!r.textContent?.replace(o.textContent??"","").trim()&&In(r)}),n.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol").forEach(r=>{let o=r.previousElementSibling;o?.tagName==="LI"&&o.appendChild(r)});let e=[...n.querySelectorAll("ul, ol")].filter(r=>!r.parentElement?.closest("ul, ol")&&r.querySelector("li[aria-level], li[data-aria-level]")),t=new Set;for(let r of e){if(t.has(r)||!n.contains(r))continue;let o=[],i=r;for(;i&&/^(UL|OL)$/.test(i.tagName);){t.add(i),Jf(i,1,o);let l=Kf(i);i!==r&&i.remove(),i=l}if(!o.length)continue;let s=r.ownerDocument.createElement("div");r.replaceWith(s),Xv(o,s)}}function Jf(n,e,t){for(let r of[...n.children]){if(r.tagName!=="LI")continue;let o=Jv(r)??e,i=[...r.children].filter(l=>/^(UL|OL)$/.test(l.tagName));i.forEach(l=>l.remove());let s=r.ownerDocument.createElement("div");for(;r.firstChild;)s.appendChild(r.firstChild);t.push({el:s,level:o,ordered:n.tagName==="OL",start:Number(n.getAttribute("start")??1)||1}),i.forEach(l=>Jf(l,o+1,t))}}function Xv(n,e){let t=e.ownerDocument,r=[],o=null;for(let i of n){for(;r.length&&r[r.length-1].level>i.level;)r.pop();let s=r[r.length-1];if(!s||s.level<i.level){let a=t.createElement(i.ordered?"ol":"ul");i.ordered&&i.start!==1&&!s&&a.setAttribute("start",String(i.start)),s?(s.list.lastElementChild??s.list.appendChild(t.createElement("li"))).appendChild(a):o=a,s={list:a,level:i.level},r.push(s)}let l=t.createElement("li");for(;i.el.firstChild;)l.appendChild(i.el.firstChild);s.list.appendChild(l)}e.replaceWith(o)}function Yv(n){n.querySelectorAll('[id^="docs-internal-guid-"]').forEach(In),n.querySelectorAll('li[role="checkbox"]').forEach(e=>{e.removeAttribute("role"),e.removeAttribute("aria-checked")})}function Qv(n){n.querySelectorAll('p.MsoTitle, p[class*="Title"]').forEach(e=>{/\bMsoTitle\b|^Title$/.test(e.className)&&lw(e,"h1")}),n.querySelectorAll('div.WordSection1, div[class^="WordSection"], div.Section1').forEach(In)}function tw(n,e){let t=Ws(n.getAttribute("style")??""),r=new Map;t.forEach((s,l)=>{if(l.startsWith("mso-")){l==="mso-highlight"&&!qf.test(s)&&!t.has("background-color")&&r.set("background-color",s);return}if(!(l.startsWith("-webkit-")||l.startsWith("-moz-"))){if(l==="background"){let a=s.split(/\s+/)[0];/^(#[0-9a-f]{3,8}|rgba?\([^)]*\)|[a-z]+)$/i.test(a)&&!r.has("background-color")&&r.set("background-color",a);return}if(l==="text-decoration"||l==="text-decoration-line"){/underline/.test(s)?r.set("text-decoration","underline"):/line-through/.test(s)&&r.set("text-decoration","line-through");return}e==="clean"&&ew.test(l)||e==="clean"&&l==="vertical-align"&&/^(TD|TH)$/.test(n.tagName)||r.set(l,s)}});let o=r.get("color");o&&Zv.test(o.trim())&&e==="clean"&&r.delete("color");let i=r.get("background-color");i&&qf.test(i.trim())&&r.delete("background-color"),r.get("font-weight")==="normal"&&n.tagName!=="B"&&r.delete("font-weight"),r.get("font-style")==="normal"&&r.delete("font-style"),r.get("text-decoration")==="none"&&r.delete("text-decoration"),r.get("vertical-align")==="baseline"&&r.delete("vertical-align"),/^(left|start)$/i.test(r.get("text-align")??"")&&r.delete("text-align"),e==="clean"&&n.closest("a")&&(r.delete("color"),r.get("text-decoration")==="underline"&&r.delete("text-decoration")),r.size?n.setAttribute("style",jf(r)):n.removeAttribute("style")}function nw(n){n.querySelectorAll("table, tr, td, th, col, colgroup").forEach(e=>{e.removeAttribute("width"),e.removeAttribute("height"),e.removeAttribute("valign")})}function rw(n){for(let e of[...n.querySelectorAll("span, font")].reverse()){if(!n.contains(e))continue;e.hasAttribute("style")||e.tagName==="FONT"&&e.hasAttribute("color")||In(e)}n.querySelectorAll("[class]").forEach(e=>e.removeAttribute("class")),n.querySelectorAll("[lang]").forEach(e=>e.removeAttribute("lang")),n.querySelectorAll("[dir]").forEach(e=>{/^rtl$/i.test(e.getAttribute("dir")??"")||e.removeAttribute("dir")})}function ow(n){n.querySelectorAll("br").forEach(e=>{let t=e.parentElement;if(!t||!(t===n||t.tagName==="DIV"||t.tagName==="TD"||t.tagName==="LI"))return;let r=Wf(e,-1),o=Wf(e,1);(r&&Us.test(r.tagName)||o&&Us.test(o.tagName)||!r&&!o&&t===n)&&e.remove()})}function Wf(n,e){let t=e<0?n.previousSibling:n.nextSibling;for(;t&&t.nodeType===Node.TEXT_NODE&&!t.textContent?.trim();)t=e<0?t.previousSibling:t.nextSibling;return t instanceof Element?t:null}function iw(n){n.querySelectorAll("p").forEach(e=>{e.children.length===0&&/^\s*$/.test(e.textContent??"")&&(e.textContent="")})}function sw(n){n.querySelectorAll("td, th").forEach(e=>{let t=e.style.textAlign,r=[...e.children].some(i=>Us.test(i.tagName));if(!t||r||!e.textContent?.trim())return;let o=e.ownerDocument.createElement("p");for(o.style.textAlign=t;e.firstChild;)o.appendChild(e.firstChild);e.appendChild(o),e.style.removeProperty("text-align"),e.getAttribute("style")||e.removeAttribute("style")})}function In(n){let e=n.parentNode;if(e){for(;n.firstChild;)e.insertBefore(n.firstChild,n);e.removeChild(n)}}function lw(n,e){let t=n.ownerDocument.createElement(e);for(let r of[...n.attributes])t.setAttribute(r.name,r.value);for(;n.firstChild;)t.appendChild(n.firstChild);return n.replaceWith(t),t}var Hv,$v,Vv,Vf,Zv,qf,ew,Us,Gf=O(()=>{"use strict";Hv=/^(STYLE|SCRIPT|META|LINK|TITLE|XML|HEAD|NOSCRIPT|TEMPLATE)$/;$v=/^[([]?(\d+(\.\d+)*[.)\]]?|[a-z]{1,4}[.)\]])$/i;Vv=/^(i|ii|iii|iv|v|vi|vii|viii|ix|x|xi|xii)$/i,Vf={i:1,v:5,x:10};Zv=/^(black|windowtext|auto|#000|#000000|rgb\(0,\s*0,\s*0\)|initial|inherit)$/i,qf=/^(transparent|white|window|auto|none|#fff|#ffffff|rgba?\(255,\s*255,\s*255(,\s*1)?\)|rgba\(\d+,\s*\d+,\s*\d+,\s*0\)|initial|inherit)$/i,ew=/^(font|font-family|font-size|line-height|margin|margin-.+|padding|padding-.+|text-indent|letter-spacing|word-spacing|white-space|height|width|min-height|border|border-.+|tab-stops|layout-grid-mode|page-break-.+|break-.+|orphans|widows|direction|unicode-bidi|font-variant.*|text-transform)$/i;Us=/^(P|DIV|H[1-6]|UL|OL|TABLE|BLOCKQUOTE|PRE|HR)$/});function aw(n,e){let t=0;for(let r=e;r<n.length;r++){let o=n[r];if(o==="\\"){r++;continue}if(o==="{")t++;else if(o==="}"&&(t--,t===0))return r}return-1}function cw(n){let e="",t=0;for(let r=0;r<n.length;r++){let o=n[r];if(o==="\\"){t===0&&(e+=o+(n[r+1]??"")),r++;continue}o==="{"?t++:o==="}"?t--:t===0&&(e+=o)}return e}function dw(n){if(n.length%2!==0||n.length/2>uw||!/^[0-9a-f]+$/i.test(n))return null;let e="";for(let t=0;t<n.length;t+=2)e+=String.fromCharCode(parseInt(n.slice(t,t+2),16));return btoa(e)}function Xf(n){let e=[],t=0;for(;;){let r=n.indexOf("{\\pict",t);if(r<0)break;let o=aw(n,r);if(o<0)break;if(t=o+1,/\\nonshppict\s*$/.test(n.slice(Math.max(0,r-16),r)))continue;let i=cw(n.slice(r+1,o)),s=/\\pngblip(?![a-z])/.test(i)?"image/png":/\\jpegblip(?![a-z])/.test(i)?"image/jpeg":null;if(!s)continue;let l=i.replace(/\\[a-z]+-?\d* ?/gi,"").replace(/\s+/g,""),a=dw(l);if(!a)continue;let c=atob(a.slice(0,12));(s==="image/png"?c.startsWith("\x89PNG"):c.charCodeAt(0)===255&&c.charCodeAt(1)===216)&&e.push({type:s,base64:a})}return e}function Yf(n){return/<img[^>]+src=["']?file:/i.test(n)}function Qf(n,e){let t=document.createElement("template");t.innerHTML=n;let r=[...t.content.querySelectorAll("img")].filter(o=>/^file:/i.test(o.getAttribute("src")??""));return!r.length||r.length!==e.length?n:(r.forEach((o,i)=>{let s=e[i];o.setAttribute("src",`data:${s.type};base64,${s.base64}`)}),t.innerHTML)}var uw,Zf=O(()=>{"use strict";uw=20*1024*1024});function pw(n){let e=document.createElement("template");e.innerHTML=n;let t=/^(P|DIV|H[1-6]|LI|BLOCKQUOTE|PRE|TR|SECTION|ARTICLE|HEADER|FOOTER)$/,r="",o=i=>{if(i.nodeType===Node.TEXT_NODE){r+=(i.textContent??"").replace(/\s+/g," ");return}if(!(i instanceof Element)){i.childNodes.forEach(o);return}if(/^(SCRIPT|STYLE|META|TITLE|HEAD)$/.test(i.tagName))return;if(i.tagName==="BR"){r+=`
13
+ `;return}let s=t.test(i.tagName);s&&r&&!r.endsWith(`
14
+ `)&&(r+=`
15
+ `),i.childNodes.forEach(o),s&&(r+=`
16
+ `)};return e.content.childNodes.forEach(o),r.split(`
17
+ `).map(i=>i.trim()).join(`
18
+ `).replace(/\n{3,}/g,`
19
+
20
+ `).trim()}function ep(n){let e=!1;return new _({key:fw,props:{transformPasted(t,r){let{selection:o}=r.state,i=o.$from.parent;return t.openStart>0&&o.empty&&i.isTextblock&&i.content.size===0&&t.content.firstChild?.isBlock?new N(t.content,0,t.openEnd):t},transformPastedHTML(t){let{pastePreprocess:r,pastePostprocess:o,pasteStyles:i}=n.options,s=r?r(t,n):t;if(s=Uf(s,i??"clean"),o){let l=document.createElement("template");l.innerHTML=s;let a=document.createElement("div");a.append(l.content),o(a,n),s=a.innerHTML}return s},handlePaste(t,r,o){if(e)return!1;let i=r.clipboardData?.getData("text/html");if(!n.isPasteAsText()){let l=i&&Yf(i)?r.clipboardData?.getData("text/rtf"):"";if(!i||!l||!n.isAllowed("image"))return!1;let a=Qf(i,Xf(l));if(a===i)return!1;e=!0;try{t.pasteHTML(a,r)}finally{e=!1}return!0}let s=i?pw(i):r.clipboardData?.getData("text/plain")||o.content.textBetween(0,o.content.size,`
21
+
22
+ `);if(!s)return!1;e=!0;try{t.pasteText(s)}finally{e=!1}return!0}}})}var fw,tp=O(()=>{"use strict";le();U();Gf();Zf();fw=new j("nova-paste")});function np(n){n.querySelectorAll("td, th").forEach(e=>{let t=e.style.backgroundColor;t&&(e.setAttribute(hw,t),e.style.removeProperty("background-color"),e.getAttribute("style")||e.removeAttribute("style"))})}function rn(n){let e=rp.get(n);return e||(e=new js(n,yt.fromSchema(n).rules),rp.set(n,e)),e}var hw,js,rp,Rk,Ks=O(()=>{"use strict";le();ft();hw="data-nova-cell-bg";js=class extends yt{parse(e,t){return np(e),super.parse(e,t)}parseSlice(e,t){return np(e),super.parseSlice(e,t)}},rp=new WeakMap;Rk=rn(Xt)});function Ro(n,e,t){let r=[],o=v("div",{className:"nova-menu",role:"menu","aria-label":t}),i=n.some(a=>a.type!=="separator"&&a.active!==void 0);for(let a of n){if(a.type==="separator"){o.append(v("div",{className:"nova-menu-sep",role:"separator"}));continue}let c=v("span",{className:"nova-menu-label"},a.label);a.labelStyle&&c.setAttribute("style",a.labelStyle);let u=v("button",{type:"button",className:"nova-menu-item",role:a.active===void 0?"menuitem":a.checkbox?"menuitemcheckbox":"menuitemradio",tabindex:"-1","data-id":a.id,disabled:a.disabled??!1,...a.active!==void 0?{"aria-checked":String(a.active)}:{}},i?v("span",{className:"nova-menu-check"},a.active?te(M.check):null):null,a.icon?te(a.icon):null,c,a.shortcut?v("kbd",{className:"nova-menu-shortcut"},Ge(a.shortcut)):null);u.addEventListener("click",()=>{e(),a.onSelect()}),r.push(u),o.append(u)}let s=()=>r.filter(a=>!a.disabled),l=a=>{let c=s();c.length&&c[(a+c.length)%c.length].focus()};return o.addEventListener("keydown",a=>{let c=s(),u=c.indexOf(document.activeElement);switch(a.key){case"ArrowDown":a.preventDefault(),l(u+1);break;case"ArrowUp":a.preventDefault(),l(u-1);break;case"Home":a.preventDefault(),l(0);break;case"End":a.preventDefault(),l(c.length-1);break;case"Tab":a.preventDefault();break;default:if(a.key.length===1&&/\S/.test(a.key)){let d=a.key.toLowerCase(),f=u+1;[...c.slice(f),...c.slice(0,f)].find(h=>h.textContent?.trim().toLowerCase().startsWith(d))?.focus()}}}),o}function Io(n){(n.querySelector('[aria-checked="true"]:not(:disabled)')??n.querySelector(".nova-menu-item:not(:disabled)"))?.focus()}var Js=O(()=>{"use strict";X();Me()});function sp(n,e,t,r){let{t:o}=n.ui;e.className="nova-menubar",e.setAttribute("role","menubar"),e.setAttribute("aria-label",o("menu.label"));let i=new AbortController,{signal:s}=i,l=p=>p.title.startsWith("menu.")?o(p.title):p.title,a=p=>{let h=[];for(let m of p.items.split(/\s+/)){if(!m)continue;if(m==="|"){h.length&&h[h.length-1].type!=="separator"&&h.push({type:"separator"});continue}if(!n.isAllowed(m))continue;let b=n.ui.registry.getMenuItem(m);b&&h.push({id:m,label:b.text,...b.icon?{icon:b.icon}:{},...b.shortcut?{shortcut:b.shortcut}:{},...b.isActive?{active:b.isActive(n),checkbox:!0}:{},disabled:!n.isEditable()||(b.isEnabled?!b.isEnabled(n):!1),onSelect:()=>b.onAction(n)})}for(;h.length&&h[h.length-1].type==="separator";)h.pop();return h},c=[],u=null,d=()=>{u?.popover.close(),u=null},f=(p,h)=>{d();let m=c[p],b=r[m.dataset.menu],g=a(b);if(!g.length)return;let y=Ro(g,()=>n.ui.closePopover(),l(b));y.addEventListener("keydown",A=>{if(A.key!=="ArrowLeft"&&A.key!=="ArrowRight")return;A.preventDefault();let L=(p+(A.key==="ArrowRight"?1:-1)+c.length)%c.length;f(L,!0)}),m.setAttribute("aria-expanded","true");let x=n.ui.openPopover({anchor:m,content:y,ignore:[e],className:"nova-popover-menu",onClose:A=>{m.setAttribute("aria-expanded","false"),u?.popover===x&&(u=null),A==="escape"&&m.focus()}});u={index:p,popover:x},h&&Io(y)};for(let p of t.split(/\s+/).filter(Boolean)){let h=r[p];if(!h)continue;let m=v("button",{type:"button",className:"nova-menubar-item",role:"menuitem","aria-haspopup":"menu","aria-expanded":"false","data-menu":p,tabindex:c.length===0?"0":"-1"},l(h)),b=c.length;m.addEventListener("click",g=>{if(u?.index===b)return d();f(b,g.detail===0)}),m.addEventListener("mouseenter",()=>{u&&u.index!==b&&f(b,!1)}),c.push(m),e.append(m)}return e.addEventListener("keydown",p=>{let h=c.indexOf(document.activeElement);if(h<0)return;let m=b=>{p.preventDefault();let g=(b+c.length)%c.length;c.forEach((y,x)=>y.tabIndex=x===g?0:-1),c[g].focus()};p.key==="ArrowRight"?m(h+1):p.key==="ArrowLeft"?m(h-1):p.key==="Home"?m(0):p.key==="End"?m(c.length-1):p.key==="ArrowDown"?(p.preventDefault(),f(h,!0)):p.key==="Escape"&&(p.preventDefault(),n.focus())},{signal:s}),e.addEventListener("mousedown",p=>{p.target.closest("button")&&p.preventDefault()},{signal:s}),{focus:()=>(c.find(p=>p.tabIndex===0)??c[0])?.focus(),destroy:()=>{d(),i.abort(),e.replaceChildren()}}}var op,ip,lp=O(()=>{"use strict";X();Js();op={file:{title:"menu.file",items:"preview | print"},edit:{title:"menu.edit",items:"undo redo | selectall | searchreplace pastetext"},view:{title:"menu.view",items:"code preview | fullscreen"},insert:{title:"menu.insert",items:"image link inserttable hr | insertdatetime"},format:{title:"menu.format",items:"bold italic underline strikethrough superscript subscript inlinecode | paragraph h1 h2 h3 blockquote codeblock | alignleft aligncenter alignright alignjustify | removeformat"},table:{title:"menu.table",items:"inserttable | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol | tablemergecells tablesplitcells | tabledelete"},help:{title:"menu.help",items:"help"}},ip="file edit view insert format table help"});function gw(n){let e=v("iframe",{title:"print","aria-hidden":"true",tabindex:"-1"});e.style.cssText="position:fixed;width:0;height:0;border:0;right:0;bottom:0;visibility:hidden",document.body.append(e);let t=e.contentDocument;if(!t)return e.remove();let r=t.createElement("style");r.textContent=mw,t.head.append(r),t.body.append(We.fromSchema(n.schema).serializeFragment(n.view.state.doc.content,{document:t}));let o=e.contentWindow,i=()=>setTimeout(()=>e.remove(),1e3);o?.addEventListener("afterprint",i),o?.focus(),o?.print(),i()}function bw(n){let{t:e}=n.ui,t=ae({label:e("table.rows"),value:"3"}),r=ae({label:e("table.cols"),value:"3"});for(let o of[t,r])o.input.type="number",o.input.min="1",o.input.max="50",o.input.inputMode="numeric";n.ui.openDialog({title:e("table.insert"),body:v("div",{className:"nova-form nova-form-row"},t.el,r.el),submitLabel:e("dialog.insert"),initialFocus:t.input,onSubmit:()=>{let o=Number(t.input.value),i=Number(r.input.value);return!Number.isInteger(o)||!Number.isInteger(i)||o<1||i<1||o>50||i>50?e("table.invalidSize"):(n.exec(tt(o,i)),!0)}})}function ap(n){let{registry:e,t}=n.ui;e.addToggleMenuItem("paragraph",{text:t("paragraph"),icon:M.paragraph,shortcut:"Mod-Alt-0",isActive:r=>r.view.state.selection.$from.parent.type.name==="paragraph",onAction:r=>r.exec("paragraph")}),e.addMenuItem("selectall",{text:t("selectAll"),shortcut:"Mod-a",onAction:r=>{r.view.dispatch(r.view.state.tr.setSelection(new pe(r.view.state.doc))),r.focus()}}),e.addMenuItem("print",{text:t("print"),icon:M.print,shortcut:"Mod-p",onAction:r=>gw(r)}),e.addMenuItem("inserttable",{text:t("table.insert"),icon:M.table,isEnabled:r=>r.can(tt(1,1)),onAction:r=>bw(r)})}var mw,cp=O(()=>{"use strict";le();U();Rn();kt();X();Me();mw=`
23
+ body { font: 16px/1.6 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: #000; margin: 2cm; }
24
+ img { max-width: 100%; height: auto; }
25
+ table { border-collapse: collapse; width: 100%; }
26
+ td, th { border: 1px solid #999; padding: 4px 8px; vertical-align: top; }
27
+ pre { white-space: pre-wrap; background: #f5f5f5; padding: 8px; }
28
+ blockquote { border-left: 3px solid #ccc; margin-left: 0; padding-left: 1em; color: #444; }
29
+ `});function up(n){if(n===void 0)return null;let e=new Set;for(let t of n.split(",")){let r=t.trim().replace(/^[-#+!]+/,"").replace(/\[.*$/,"").toLowerCase();for(let o of r.split("/")){let i=o.trim();i&&e.add(dp[i]??i)}}return e}function ww(n){if(n===void 0)return null;let e=typeof n=="string"?n:Object.values(n).join(",");return new Set(e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean))}function Gs(n){let e=[],t=[],r=()=>{t.length&&e.push(t[0].type.schema.nodes.paragraph.create(null,t)),t=[]};return n.forEach(o=>{o.isInline?t.push(o):(r(),e.push(o))}),r(),e}function xw(n){let e=[];return n.forEach(t=>{t.type===t.type.schema.nodes.list_item?t.content.forEach(r=>e.push(r)):e.push(...Gs(E.from(t)))}),e}function kw(n){let e=[];return n.forEach(t=>t.forEach(r=>r.forEach(o=>e.push(o)))),e}function fp(n){return new _({key:Mw,appendTransaction(e,t,r){if(!e.some(c=>c.docChanged))return null;let o=t.doc.content.findDiffStart(r.doc.content);if(o===null)return null;let i=t.doc.content.findDiffEnd(r.doc.content)?.b??r.doc.content.size,s=r.doc,l=[];if(s.forEach((c,u)=>{let d=u,f=u+c.nodeSize;if(f<o||d>Math.max(o,i))return;let p=n.normalize(c);p.length===1&&p[0].eq(c)||l.push({from:d,to:f,nodes:p})}),!l.length)return null;let a=r.tr;for(let{from:c,to:u,nodes:d}of l.reverse())d.length?a.replaceWith(c,u,d):a.doc.childCount>1?a.delete(c,u):a.replaceWith(c,u,r.schema.nodes.paragraph.create());return a.setMeta("addToHistory",e.every(c=>c.getMeta("addToHistory")!==!1))}})}var dp,yw,vw,Po,Mw,pp=O(()=>{"use strict";le();U();dp={b:"strong",i:"em",strike:"s",del:"s",tbody:"table",thead:"table",tfoot:"table",caption:"table",colgroup:"table",col:"table"},yw=["p","h1","h2","h3","h4","h5","h6","blockquote","pre","hr","ul","ol","li","img","br","table","tr","td","th","strong","em","u","s","code","a","sub","sup","span"],vw={bold:["strong"],italic:["em"],underline:["u"],strikethrough:["s"],strike:["s"],inlinecode:["code"],code:["code"],subscript:["sub"],superscript:["sup"],link:["a"],unlink:["a"],quicklink:["a"],image:["img"],quickimage:["img"],table:["table"],quicktable:["table"],inserttable:["table"],tableinsertrowbefore:["table"],tableinsertrowafter:["table"],tabledeleterow:["table"],tableinsertcolbefore:["table"],tableinsertcolafter:["table"],tabledeletecol:["table"],tablemergecells:["table"],tablesplitcells:["table"],tabledelete:["table"],tablerowheader:["th"],tablecolheader:["th"],tablecellbackground:["style:background-color"],bullist:["ul"],bulletlist:["ul"],numlist:["ol"],orderedlist:["ol"],blockquote:["blockquote"],codeblock:["pre"],hr:["hr"],horizontalrule:["hr"],h1:["h1"],h2:["h2"],h3:["h3"],h4:["h4"],h5:["h5"],h6:["h6"],forecolor:["span","style:color"],backcolor:["span","style:background-color"],fontfamily:["span","style:font-family"],fontsize:["span","style:font-size"],lineheight:["style:line-height"],align:["style:text-align"],alignleft:["style:text-align"],aligncenter:["style:text-align"],alignright:["style:text-align"],alignjustify:["style:text-align"],imagealignleft:["style:float"],imagealigncenter:["style:float"],imagealignright:["style:float"]};Po=class{tags;styles;constructor(e){let t=up(e.validElements),r=up(e.invalidElements)??new Set,o=new Set(t??yw);(o.has("ul")||o.has("ol"))&&o.add("li"),o.has("table")&&(o.add("tr"),o.add("td"));for(let i of r)o.delete(i);o.add("p"),this.tags=o,this.styles=ww(e.validStyles)}isTagAllowed(e){let t=e.toLowerCase();return this.tags.has(dp[t]??t)}isStyleAllowed(e){return!this.styles||this.styles.has(e.toLowerCase())}isAllowed(e){let t=vw[e.toLowerCase()];return t?t.every(r=>r.startsWith("style:")?this.isStyleAllowed(r.slice(6)):this.isTagAllowed(r)):!0}markAllowed(e){switch(e.type.name){case"bold":return this.isTagAllowed("strong");case"italic":return this.isTagAllowed("em");case"underline":return this.isTagAllowed("u");case"strike":return this.isTagAllowed("s");case"code":return this.isTagAllowed("code");case"link":return this.isTagAllowed("a");case"subscript":return this.isTagAllowed("sub");case"superscript":return this.isTagAllowed("sup");case"color":return this.isTagAllowed("span")&&this.isStyleAllowed("color");case"background":return this.isTagAllowed("span")&&this.isStyleAllowed("background-color");case"font_family":return this.isTagAllowed("span")&&this.isStyleAllowed("font-family");case"font_size":return this.isTagAllowed("span")&&this.isStyleAllowed("font-size");default:return!0}}blockAttrs(e){return{...e,...this.isStyleAllowed("text-align")?{}:{align:null},...this.isStyleAllowed("line-height")?{}:{lineHeight:null}}}normalize(e){let t=e.type.schema,{nodes:r}=t;if(e.isText){let l=e.marks.filter(a=>this.markAllowed(a));return[l.length===e.marks.length?e:e.mark(l)]}let o=e.marks.filter(l=>this.markAllowed(l));switch(e.type){case r.image:return this.isTagAllowed("img")?[r.image.create({...e.attrs,...this.isStyleAllowed("float")?{}:{align:null}},null,o)]:[];case r.hard_break:return this.isTagAllowed("br")?[e.mark(o)]:[t.text(" ",o)];case r.horizontal_rule:return this.isTagAllowed("hr")?[e]:[]}let i=this.normalizeChildren(e.content),s=(l=e.type,a=e.attrs)=>{try{return[l.createChecked(a,i,e.marks)]}catch{let c=l.createAndFill(a,i,e.marks);return c?[c]:i.content.length?Gs(i):[]}};switch(e.type){case r.paragraph:return s(r.paragraph,this.blockAttrs(e.attrs));case r.heading:return this.isTagAllowed(`h${e.attrs.level}`)?s(r.heading,this.blockAttrs(e.attrs)):s(r.paragraph,this.blockAttrs({align:e.attrs.align,lineHeight:e.attrs.lineHeight}));case r.blockquote:return this.isTagAllowed("blockquote")?s():Gs(i);case r.code_block:return this.isTagAllowed("pre")?s():e.textContent.split(`
30
+ `).map(l=>r.paragraph.create(null,l?t.text(l):null));case r.bullet_list:case r.ordered_list:return this.isTagAllowed(e.type===r.bullet_list?"ul":"ol")?s(e.type,{...e.attrs,...this.isStyleAllowed("list-style-type")?{}:{listStyle:null}}):xw(i);case r.table:return this.isTagAllowed("table")?s():kw(i);case r.table_header:return this.isTagAllowed("th")?s():s(r.table_cell,e.attrs);case r.table_cell:return s(r.table_cell,{...e.attrs,...this.isStyleAllowed("background-color")?{}:{background:null}});default:return s()}}normalizeChildren(e){let t=[];return e.forEach(r=>t.push(...this.normalize(r))),E.from(t)}normalizeDoc(e){let t=this.normalizeChildren(e.content),r=e.type.schema;return e.type.createAndFill(null,t.size?t:r.nodes.paragraph.create())}};Mw=new j("nova-content-rules")});function Cw({query:n,caseSensitive:e,wholeWord:t}){if(!n)return null;let r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=t?`(?<![\\p{L}\\p{N}_])${r}(?![\\p{L}\\p{N}_])`:r;return new RegExp(o,e?"gu":"giu")}function hp(n,e){let t=Cw(e);if(!t)return[];let r=[];return n.descendants((o,i)=>{if(r.length>=xr)return!1;if(!o.isTextblock)return!0;let s=o.textBetween(0,o.content.size,void 0,Sw);t.lastIndex=0;let l;for(;(l=t.exec(s))&&r.length<xr;){if(l[0].length===0){t.lastIndex+=1;continue}r.push({from:i+1+l.index,to:i+1+l.index+l[0].length})}return!1}),r}function mp(n,e){if(!n.length)return-1;let t=n.findIndex(r=>r.from>=e);return t<0?0:t}function gp(){return new _({key:on,state:{init:()=>Xs,apply(n,e,t,r){let o=n.getMeta(on);if(o?.type==="clear")return Xs;if(o?.type==="set"){let i=hp(r.doc,o.options);return{...o.options,matches:i,current:mp(i,r.selection.from)}}if(o?.type==="goto")return{...e,current:o.index};if(n.docChanged&&e.query){let i=hp(r.doc,e),s=e.matches[e.current]?.from,l=s===void 0?-1:mp(i,n.mapping.map(s));return{...e,matches:i,current:l}}return e}},props:{decorations(n){let e=on.getState(n);return e?.matches.length?K.create(n.doc,e.matches.map((t,r)=>ee.inline(t.from,t.to,{class:r===e.current?"nova-search-match nova-search-current":"nova-search-match"}))):null}}})}function Pn(n){return on.getState(n)??Xs}function bp(n){return(e,t)=>(t?.(e.tr.setMeta(on,{type:"set",options:n})),!0)}function Ew(n,e,t){return n.setMeta(on,{type:"goto",index:t}).setSelection(P.create(n.doc,e.from,e.to)).scrollIntoView()}function kr(n=1){return(e,t)=>{let{matches:r,current:o}=Pn(e);if(!r.length)return!1;let s=o>=0&&e.selection.from===r[o].from&&e.selection.to===r[o].to||o<0?(Math.max(o,0)+n+r.length)%r.length:o;return t&&t(Ew(e.tr,r[s],s)),!0}}function vp(n){return(e,t)=>{let{matches:r,current:o}=Pn(e),i=r[o];if(!i)return!1;if(t){let s=e.tr,l=e.doc.resolve(i.from).marksAcross(e.doc.resolve(i.to))??[];n?s.replaceWith(i.from,i.to,e.schema.text(n,l)):s.delete(i.from,i.to);let a=s.mapping.map(i.to);t(s.setSelection(P.create(s.doc,a)).scrollIntoView())}return!0}}function wp(n){return(e,t)=>{let{matches:r}=Pn(e);if(!r.length)return!1;if(t){let o=e.tr;for(let i=r.length-1;i>=0;i--){let{from:s,to:l}=r[i],a=e.doc.resolve(s).marksAcross(e.doc.resolve(l))??[];n?o.replaceWith(s,l,e.schema.text(n,a)):o.delete(s,l)}t(o.scrollIntoView())}return!0}}var xr,Sw,on,Xs,yp,Ys=O(()=>{"use strict";U();Tt();xr=1e4,Sw="\uFFFC",on=new j("nova-search"),Xs={query:"",caseSensitive:!1,wholeWord:!1,matches:[],current:-1};yp=(n,e)=>(e?.(n.tr.setMeta(on,{type:"clear"})),!0)});function xp(n,e){let{t}=n.ui,r=ke("nova-find"),o=ke("nova-replace"),i=v("input",{id:r,type:"search",className:"nova-input",placeholder:t("search.find"),"aria-label":t("search.find"),autocomplete:"off",spellcheck:"false"}),s=v("input",{id:o,type:"text",className:"nova-input",placeholder:t("search.replace"),"aria-label":t("search.replace"),autocomplete:"off",spellcheck:"false"}),l=v("span",{className:"nova-search-count","aria-live":"polite"}),a=(T,w)=>{let k=v("button",{type:"button",className:"nova-btn nova-search-toggle","aria-pressed":"false","aria-label":T,"data-tooltip":T},w);return n.ui.tooltip.attach(k),k.addEventListener("click",()=>{k.setAttribute("aria-pressed",String(k.getAttribute("aria-pressed")!=="true")),x(),i.focus()}),k},c=a(t("search.matchCase"),"Aa"),u=a(t("search.wholeWord"),"ab|"),d=(T,w,k)=>{let S=v("button",{type:"button",className:"nova-btn","aria-label":w,"data-tooltip":w},te(T));return n.ui.tooltip.attach(S),S.addEventListener("click",k),S},f=d(M.chevronUp,t("search.prev"),()=>{n.exec(kr(-1)),i.focus()}),p=d(M.chevronDown,t("search.next"),()=>{n.exec(kr(1)),i.focus()}),h=d(M.close,t("dialog.close"),()=>C.close()),m=v("button",{type:"button",className:"nova-button"},t("search.replaceOne")),b=v("button",{type:"button",className:"nova-button"},t("search.replaceAll"));m.addEventListener("click",()=>{A(),n.exec(vp(s.value)),n.exec(kr(1)),s.focus()}),b.addEventListener("click",()=>{A(),n.exec(wp(s.value)),s.focus()});let g=v("div",{className:"nova-search",role:"search","aria-label":t("search.title"),hidden:!0},v("div",{className:"nova-search-row"},i,l,c,u,f,p,h),v("div",{className:"nova-search-row"},s,m,b));e.parentElement.insertBefore(g,e);let y=null,x=()=>{y&&clearTimeout(y),y=null,bp({query:i.value,caseSensitive:c.getAttribute("aria-pressed")==="true",wholeWord:u.getAttribute("aria-pressed")==="true"})(n.view.state,n.view.dispatch)},A=()=>{(y||Pn(n.view.state).query!==i.value)&&x()};i.addEventListener("input",()=>{y&&clearTimeout(y),y=setTimeout(x,120)}),i.addEventListener("keydown",T=>{T.key==="Enter"&&(T.preventDefault(),A(),n.exec(kr(T.shiftKey?-1:1)),i.focus())}),s.addEventListener("keydown",T=>{T.key==="Enter"&&(T.preventDefault(),m.click(),s.focus())}),g.addEventListener("keydown",T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),C.close())}),g.addEventListener("mousedown",T=>{T.target.closest("button")&&T.preventDefault()});let L=()=>{if(g.hidden)return;let{matches:T,current:w,query:k}=Pn(n.view.state),S=T.length;k?S?l.textContent=t("search.count",{current:w+1,total:S>=xr?`${xr}+`:S}):l.textContent=t("search.none"):l.textContent="",g.classList.toggle("is-empty",!!k&&!S);for(let F of[f,p,m,b])F.disabled=!S;m.disabled=!S||!n.isEditable(),b.disabled=!S||!n.isEditable()},C={open(){let T=g.hidden;g.hidden=!1;let{from:w,to:k,empty:S}=n.view.state.selection,F=S?"":n.view.state.doc.textBetween(w,k," ");F&&!F.includes(`
31
+ `)&&F.length<=100&&(i.value=F),(T||F)&&x(),i.focus(),i.select(),L()},close(){g.hidden||(g.hidden=!0,y&&clearTimeout(y),yp(n.view.state,n.view.dispatch),n.focus())},isOpen:()=>!g.hidden,update:L,destroy(){y&&clearTimeout(y),g.remove()}};return C}var kp=O(()=>{"use strict";Ys();X();Me()});function Qs(n){return n.root.classList.contains("nova-fullscreen")}function Mr(n,e=!Qs(n)){n.root.classList.toggle("nova-fullscreen",e),document.documentElement.classList.toggle("nova-fullscreen-lock",e),n.ui.closePopover(),n.updateUI(),n.focus()}function Mp(n){let{t:e}=n.ui,t=v("div",{className:"nova-prosemirror nova-preview"});t.append(We.fromSchema(n.schema).serializeFragment(n.view.state.doc.content)),t.querySelectorAll("a[href]").forEach(r=>{r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer")}),n.ui.openDialog({title:e("preview"),body:t,size:"large",cancelLabel:e("dialog.close")})}function Aw(n){return n.replace(/(<\/(p|h[1-6]|ul|ol|li|blockquote|pre|table|tbody|tr)>|<hr>)/g,`$1
32
+ `).replace(/(<(ul|ol|table|tbody|tr|blockquote)( [^>]*)?>)/g,`$1
33
+ `).replace(/\n{2,}/g,`
34
+ `).trim()}function Sp(n){let{t:e}=n.ui,t=Aw(n.getHTML()),r=v("textarea",{className:"nova-input nova-source",spellcheck:"false","aria-label":e("sourceCode"),autocomplete:"off",rows:"18"});r.value=t,n.ui.openDialog({title:e("sourceCode"),body:r,size:"large",submitLabel:e("dialog.save"),initialFocus:r,onSubmit:()=>(r.value!==t&&n.setContent(r.value),!0)})}function Bo(n){let{t:e}=n.ui,t=v("div",{className:"nova-help"});for(let{group:r,rows:o}of Tw)t.append(v("section",{},v("h3",{},e(r)),v("table",{className:"nova-help-table"},v("tbody",{},o.map(({label:i,keys:s})=>v("tr",{},v("td",{},e(i)),v("td",{},v("kbd",{},s.length===1?s:Ge(s)))))))));n.ui.openDialog({title:e("help"),body:t,size:"large",cancelLabel:e("dialog.close")})}var Tw,Zs=O(()=>{"use strict";le();X();Tw=[{group:"help.formatting",rows:[{label:"bold",keys:"Mod-b"},{label:"italic",keys:"Mod-i"},{label:"underline",keys:"Mod-u"},{label:"strike",keys:"Mod-Shift-x"},{label:"code",keys:"Mod-e"},{label:"superscript",keys:"Mod-."},{label:"subscript",keys:"Mod-,"},{label:"link",keys:"Mod-k"},{label:"clearFormatting",keys:"Mod-\\"}]},{group:"help.blocks",rows:[{label:"paragraph",keys:"Mod-Alt-0"},{label:"h1",keys:"Mod-Alt-1"},{label:"h2",keys:"Mod-Alt-2"},{label:"h3",keys:"Mod-Alt-3"},{label:"bulletList",keys:"Mod-Shift-8"},{label:"orderedList",keys:"Mod-Shift-7"},{label:"alignCenter",keys:"Mod-Shift-e"}]},{group:"help.editing",rows:[{label:"undo",keys:"Mod-z"},{label:"redo",keys:"Mod-Shift-z"},{label:"search.title",keys:"Mod-f"},{label:"pasteAsText",keys:"Mod-Shift-v"},{label:"fullscreen",keys:"Mod-Shift-f"},{label:"help.slash",keys:"/"}]},{group:"help.navigation",rows:[{label:"help.toMenubar",keys:"Alt-F9"},{label:"help.toToolbar",keys:"Alt-F10"},{label:"help.toContextToolbar",keys:"Ctrl-F9"},{label:"help.toEditor",keys:"Escape"},{label:"help.nextCell",keys:"Tab"},{label:"help",keys:"Alt-0"}]}]});function Ap(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(Ep,"&nbsp;")}function Ow(n){return n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(Ep,"&nbsp;")}function Bw(n,e){let t=n.toLowerCase();return t.startsWith("on")?null:Rw.has(t)?Le(e)?e:null:Iw.has(t)?De(e)?e:null:t==="srcset"?e.split(",").map(o=>o.trim().split(/\s+/)[0]??"").every(o=>De(o))?e:null:t==="style"&&Pw.test(e)?null:e}function zw(n){Cp.has(n)||(Cp.add(n),console.error(`[nova] toDOM produced <${n}>, which is not allowed in output; the tag was dropped`))}function el(n){if(typeof n=="string")return{open:"",close:"",hole:!1,html:Ap(n)};if(!Array.isArray(n))throw new Error("[nova] serializer supports only array/string toDOM specs");let[e,...t]=n,r=e.includes(" ")?e.split(" ")[1]:e;if(!Lw.test(r))throw new Error(`[nova] invalid tag in toDOM: ${r}`);let o=Dw.has(r.toLowerCase());o&&zw(r.toLowerCase());let i="",s=t,l=t[0];if(l&&typeof l=="object"&&!Array.isArray(l)){for(let[p,h]of Object.entries(l)){if(h==null)continue;let m=p.includes(" ")?p.split(" ")[1]:p;if(!Hw.test(m))continue;let b=Bw(m,String(h));b!==null&&(i+=` ${m}="${Ow(b)}"`)}s=t.slice(1)}let a=o?"":`<${r}${i}>`;if(Nw.has(r.toLowerCase()))return{open:a,close:"",hole:!1,html:a};let c="",u="",d=!1;for(let p of s){if(p===0){if(d)throw new Error("[nova] toDOM spec has more than one content hole");d=!0;continue}let h=el(p);if(d){if(h.hole)throw new Error("[nova] toDOM spec has more than one content hole");u+=h.html}else h.hole?(c+=h.open,u+=h.close,d=!0):c+=h.html}if(o)return{open:"",close:"",hole:d,html:""};let f=`</${r}>`;return{open:a+c,close:u+f,hole:d,html:a+c+u+f}}var Nw,Ep,Lw,Dw,Rw,Iw,Pw,Cp,Hw,ht,zo=O(()=>{"use strict";dt();Nw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]),Ep=new RegExp("\xA0","g");Lw=/^[a-z][a-z0-9-]*$/i,Dw=new Set(["script","style","base","link","meta","object","embed","applet","frame","frameset","template","noscript"]),Rw=new Set(["href","xlink:href","action","formaction","cite"]),Iw=new Set(["src","poster","data","background"]),Pw=/url\s*\(|expression\s*\(|javascript:|@import|behavior\s*:|-moz-binding/i;Cp=new Set;Hw=/^[a-z_:][a-z0-9_.:-]*$/i;ht=class{cache=new Map;serializeFragment(e){let t="",r=[],o=[],i=s=>{for(;r.length>s;)t+=o.pop(),r.pop()};return e.forEach(s=>{if(!s.isInline){i(0),t+=this.serializeNode(s);return}let l=0;for(;l<r.length&&l<s.marks.length&&r[l].eq(s.marks[l]);)l++;i(l);for(let a=l;a<s.marks.length;a++){let c=s.marks[a],u=this.renderMark(c,s.isText);t+=u.open,o.push(u.close),r.push(c)}t+=s.isText?Ap(s.text??""):this.serializeNode(s)}),i(0),r=[],o=[],t}serializeNode(e){let t=e.type.spec.toDOM;if(!t)throw new Error(`[nova] node "${e.type.name}" has no toDOM`);let r=el(t(e));return r.hole?r.open+this.serializeFragment(e.content)+r.close:r.html}renderMark(e,t){let r=e.type.spec.toDOM;if(!r)throw new Error(`[nova] mark "${e.type.name}" has no toDOM`);let o=`${e.type.name}:${JSON.stringify(e.attrs)}`,i=this.cache.get(o);return i||(i=el(r(e,t)),this.cache.size>500&&this.cache.clear(),this.cache.set(o,i)),i}}});function Bn(n,e){return(t,r)=>{let o=oe(t)[n],i=e===null?null:Fw[n](e);if(e!==null&&!i)return!1;let{empty:s}=t.selection;if(!r)return!0;let l=t.tr;if(s)l.removeStoredMark(o),i&&l.addStoredMark(o.create({value:i}));else for(let a of t.selection.ranges)l.removeMark(a.$from.pos,a.$to.pos,o),i&&l.addMark(a.$from.pos,a.$to.pos,o.create({value:i}));return r(l.scrollIntoView()),!0}}function sn(n,e){let t=oe(n)[e],{$from:r,empty:o}=n.selection,i=o?n.storedMarks??r.marks():r.nodeAfter?.marks??r.marks(),s=t.isInSet(i);return s?s.attrs.value:null}function Ho(n){return(e,t)=>{let r=n===null?null:Q.lineHeight(n);if(n!==null&&!r)return!1;let{from:o,to:i}=e.selection,s=e.tr,l=!1;return e.doc.nodesBetween(o,i,(a,c)=>{(a.type===Z(e).paragraph||a.type===Z(e).heading)&&(l=!0,s.setNodeMarkup(c,void 0,{...a.attrs,lineHeight:r}))}),l?(t?.(s),!0):!1}}function Tp(n){return n.selection.$from.parent.attrs.lineHeight??null}var Fw,Np=O(()=>{"use strict";Ie();ft();Fw={color:Q.color,background:Q.color,font_family:Q.fontFamily,font_size:Q.length}});function $o(n){let t=[],r=n.current?.toLowerCase()??null,o=v("div",{className:"nova-swatches",role:"grid","aria-label":n.label});for(let l of n.colors){let a=r===l.toLowerCase(),c=v("button",{type:"button",className:"nova-swatch",role:"gridcell","aria-label":l,"aria-selected":String(a),title:l,tabindex:"-1"},a?te(M.check):null);c.style.setProperty("--swatch",l),c.addEventListener("click",()=>n.onPick(l)),t.push(c),o.append(c)}(t.find(l=>l.getAttribute("aria-selected")==="true")??t[0])?.setAttribute("tabindex","0"),o.addEventListener("keydown",l=>{let a=t.indexOf(document.activeElement);if(a<0)return;let u={ArrowRight:1,ArrowLeft:-1,ArrowDown:8,ArrowUp:-8}[l.key];if(u===void 0)return;l.preventDefault();let d=t[Math.min(t.length-1,Math.max(0,a+u))];t[a].tabIndex=-1,d.tabIndex=0,d.focus()});let i=v("button",{type:"button",className:"nova-panel-action"},te(M.clearFormatting),n.removeLabel);i.addEventListener("click",()=>n.onPick(null));let s=v("input",{type:"color",className:"nova-color-input","aria-label":n.customLabel,value:/^#[0-9a-f]{6}$/i.test(r??"")?r:"#000000"});return s.addEventListener("change",()=>n.onPick(s.value)),v("div",{className:"nova-color-panel"},o,v("div",{className:"nova-panel-footer"},i,v("label",{className:"nova-panel-action"},s,n.customLabel)))}var Fo,tl=O(()=>{"use strict";X();Me();Fo=["#000000","#434343","#666666","#999999","#b7b7b7","#d9d9d9","#efefef","#ffffff","#b91c1c","#c2410c","#a16207","#15803d","#0e7490","#1d4ed8","#6d28d9","#be185d","#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#fecaca","#fed7aa","#fef08a","#bbf7d0","#a5f3fc","#bfdbfe","#ddd6fe","#fbcfe8"]});function Op(n){let{registry:e,t}=n.ui,r=(i,s)=>t("table.size",{rows:i,cols:s});e.addPanelButton("table",{icon:M.table,tooltip:t("table.insert"),isEnabled:i=>i.can(tt(1,1)),render:(i,s)=>Bd((l,a)=>{s(),i.exec(tt(l,a))},r,t("table.insert"))});let o=(i,s,l,a,c)=>e.addButton(i,{icon:l,tooltip:t(s),onAction:u=>u.exec(a),isEnabled:u=>u.can(a),...c?{isActive:c}:{}});o("tableinsertrowbefore","table.rowBefore",M.rowBefore,Ve.addRowBefore),o("tableinsertrowafter","table.rowAfter",M.rowAfter,Ve.addRowAfter),o("tabledeleterow","table.rowDelete",M.rowDelete,Ve.deleteRow),o("tableinsertcolbefore","table.colBefore",M.colBefore,Ve.addColumnBefore),o("tableinsertcolafter","table.colAfter",M.colAfter,Ve.addColumnAfter),o("tabledeletecol","table.colDelete",M.colDelete,Ve.deleteColumn),o("tablemergecells","table.merge",M.merge,Ve.mergeCells),o("tablesplitcells","table.split",M.split,Ve.splitCell),o("tablerowheader","table.rowHeader",M.rowHeader,Ve.toggleHeaderRow,i=>Rd(i.view.state)),o("tablecolheader","table.colHeader",M.colHeader,Ve.toggleHeaderColumn,i=>Id(i.view.state)),o("tabledelete","table.delete",M.tableDelete,Ve.deleteTable),e.addPanelButton("tablecellbackground",{icon:M.highlight,tooltip:t("table.cellBackground"),isEnabled:i=>Y(i.view.state),render:(i,s)=>$o({colors:i.options.colors??Fo,current:null,label:t("table.cellBackground"),removeLabel:t("removeColor"),customLabel:t("customColor"),onPick:l=>{s(),i.exec(Dd(l))}})}),e.addMenuButton("advtablesort",{icon:M.sort,tooltip:t("table.sort"),isEnabled:i=>i.can(zs("asc")),items:i=>["asc","desc"].map(s=>({id:s,label:t(s==="asc"?"table.sortAsc":"table.sortDesc"),onSelect:()=>i.exec(zs(s,i.options.language))}))}),e.addButton("tableprops",{icon:M.tableProps,tooltip:t("table.props"),isEnabled:i=>Y(i.view.state),onAction:i=>$w(i)}),e.addButton("tablecellprops",{icon:M.cellProps,tooltip:t("table.cellProps"),isEnabled:i=>Y(i.view.state),onAction:i=>_w(i)}),e.addContextToolbar("table",{label:t("table.toolbar"),predicate:i=>Y(i.view.state),anchor:i=>Pd(i),placement:"bottom-start",items:"tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol | tablemergecells tablesplitcells | tablerowheader tablecolheader tablecellbackground | advtablesort tablecellprops tableprops | tabledelete"})}function $w(n){let{t:e}=n.ui,t=zd(n.view.state);if(!t)return;let r=ae({label:e("table.width"),hint:e("table.widthHint"),value:t.width??""}),o=Wr({label:e("table.align"),value:t.align??"",options:[{value:"",label:e("table.alignDefault")},{value:"center",label:e("table.alignCenter")},{value:"right",label:e("table.alignRight")}]});n.ui.openDialog({title:e("table.props"),body:v("div",{className:"nova-form"},r.el,o.el),submitLabel:e("dialog.save"),onSubmit:()=>{let s={width:r.input.value.trim().replace(/^(\d+(\.\d+)?)$/,"$1px")||null,align:o.select.value||null};return n.exec(Hd(s))||e("table.invalidWidth")}})}function _w(n){let{t:e}=n.ui,t=$d(n.view.state);if(!t)return;let r=Wr({label:e("table.valign"),value:t.valign??"",options:[{value:"",label:e("table.alignDefault")},{value:"top",label:e("table.valignTop")},{value:"middle",label:e("table.valignMiddle")},{value:"bottom",label:e("table.valignBottom")}]}),o=Wr({label:e("table.cellType"),value:t.header?"th":"td",options:[{value:"td",label:e("table.cellData")},{value:"th",label:e("table.cellHeader")}]}),i=ae({label:e("table.colWidth"),hint:e("table.colWidthHint"),value:t.width?String(t.width):""});n.ui.openDialog({title:e("table.cellProps"),body:v("div",{className:"nova-form"},r.el,o.el,i.el),submitLabel:e("dialog.save"),onSubmit:()=>{let s=i.input.value.trim(),l=s?Number(s.replace(/px$/i,"")):null;return l!==null&&!(Number.isInteger(l)&&l>=24&&l<=4e3)?e("table.invalidColWidth"):(n.exec(_d({valign:r.select.value||null,header:o.select.value==="th",width:l})),!0)}})}var Lp=O(()=>{"use strict";Rn();tl();kt();X();Me()});function Dp(n){try{let{node:e}=n.view.domAtPos(n.view.state.selection.from),t=e.nodeType===Node.TEXT_NODE?e.parentElement:e;return t?getComputedStyle(t):null}catch{return null}}function Rp(n){let e=n.split(",")[0].trim().replace(/["']/g,"");return Uw[e.toLowerCase()]??e}function jw(n){let e=parseFloat(n);return!Number.isFinite(e)||e<=0?null:`${Math.round(e*.75*2)/2}pt`}function Pp(n){let{registry:e,t}=n.ui,r=()=>n.view.state,o=(g,y,x,A)=>e.addButton(g,{icon:x,tooltip:t(y),...je[y]?{shortcut:je[y]}:{},onAction:L=>L.exec(y),isEnabled:L=>L.can(y),...A?{isActive:A}:{}}),i=(g,y,x,A)=>o(g,y,A,()=>hr(r(),n.schema.marks[x]));o("undo","undo",M.undo),o("redo","redo",M.redo),i("bold","bold","bold",M.bold),i("italic","italic","italic",M.italic),i("underline","underline","underline",M.underline),i("strikethrough","strike","strike",M.strike),i("inlinecode","code","code",M.code),i("subscript","subscript","subscript",M.subscript),i("superscript","superscript","superscript",M.superscript),o("bullist","bulletList",M.bulletList,()=>Ze(r(),n.schema.nodes.bullet_list)),o("numlist","orderedList",M.orderedList,()=>Ze(r(),n.schema.nodes.ordered_list)),o("indent","indent",M.indent),o("outdent","outdent",M.outdent),o("blockquote","blockquote",M.blockquote,()=>Ze(r(),n.schema.nodes.blockquote)),o("codeblock","codeBlock",M.codeBlock,()=>Ze(r(),n.schema.nodes.code_block)),o("hr","horizontalRule",M.horizontalRule),o("removeformat","clearFormatting",M.clearFormatting);let s=[["alignLeft","left",M.alignLeft],["alignCenter","center",M.alignCenter],["alignRight","right",M.alignRight],["alignJustify","justify",M.alignJustify]];for(let[g,y,x]of s)o(g.toLowerCase(),g,x,()=>tn(r())===y);e.addMenuButton("align",{icon:M.alignLeft,tooltip:t("align"),isEnabled:g=>g.can("alignLeft"),items:g=>s.map(([y,x,A])=>({id:y,label:t(y),icon:A,...je[y]?{shortcut:je[y]}:{},active:tn(g.view.state)===x,onSelect:()=>g.exec(y)}))});let l=[{command:"paragraph",style:""},{command:"h1",style:"font-size: 1.6em; font-weight: 700"},{command:"h2",style:"font-size: 1.35em; font-weight: 700"},{command:"h3",style:"font-size: 1.15em; font-weight: 700"},{command:"h4",style:"font-size: 1em; font-weight: 700"},{command:"h5",style:"font-size: 0.9em; font-weight: 700"},{command:"h6",style:"font-size: 0.85em; font-weight: 700"},{command:"codeBlock",style:"font-family: ui-monospace, monospace"}],a=()=>{let g=r().selection.$from.parent;return g.type===n.schema.nodes.heading?`h${g.attrs.level}`:g.type===n.schema.nodes.code_block?"codeBlock":"paragraph"};for(let g=1;g<=6;g++){let y=`h${g}`;e.addToggleButton(y,{...g<=3?{icon:M[`h${g}`]}:{text:`H${g}`},tooltip:t(y),...je[y]?{shortcut:je[y]}:{},isActive:()=>a()===y,isEnabled:x=>x.can(y)||a()===y,onAction:x=>x.exec(a()===y?"paragraph":y)})}e.addMenuButton("blocks",{tooltip:t("blocks"),label:()=>t(a()),minChars:11,isEnabled:g=>l.some(({command:y})=>g.can(y)),items:g=>l.filter(({command:y})=>g.isAllowed(y)).map(({command:y,style:x})=>({id:y,label:t(y),labelStyle:x,...je[y]?{shortcut:je[y]}:{},active:a()===y,onSelect:()=>g.exec(y)}))});let c=n.options.fontFamilies??Vw;e.addMenuButton("fontfamily",{tooltip:t("fontFamily"),minChars:9,label:g=>{let y=sn(r(),"font_family");if(y)return c.find(A=>Ip(y,A.value))?.label??Rp(y);let x=Dp(g)?.fontFamily;return x?Rp(x):t("fontFamily")},items:g=>{let y=sn(g.view.state,"font_family");return[{id:"default",label:t("default"),active:y===null,onSelect:()=>g.exec(Bn("font_family",null))},{type:"separator"},...c.map(x=>({id:x.label,label:x.label,labelStyle:`font-family: ${x.value}`,active:Ip(y,x.value),onSelect:()=>g.exec(Bn("font_family",x.value))}))]}});let u=n.options.fontSizes??qw;e.addMenuButton("fontsize",{tooltip:t("fontSize"),minChars:4,label:g=>sn(r(),"font_size")??jw(Dp(g)?.fontSize??"")??"\u2014",items:g=>{let y=sn(g.view.state,"font_size");return[{id:"default",label:t("default"),active:y===null,onSelect:()=>g.exec(Bn("font_size",null))},{type:"separator"},...u.map(x=>({id:x,label:x,active:y===x,onSelect:()=>g.exec(Bn("font_size",x))}))]}});let d=n.options.lineHeights??Ww;e.addMenuButton("lineheight",{icon:M.lineHeight,tooltip:t("lineHeight"),isEnabled:g=>g.can(Ho(null)),items:g=>{let y=Tp(g.view.state);return[{id:"default",label:t("default"),active:y===null,onSelect:()=>g.exec(Ho(null))},...d.map(x=>({id:x,label:x,active:y===x,onSelect:()=>g.exec(Ho(x))}))]}});let f=(g,y,x,A)=>e.addPanelButton(g,{icon:x,tooltip:t(A),indicator:()=>sn(r(),y),render:(L,C)=>$o({colors:L.options.colors??Fo,current:sn(L.view.state,y),label:t(A),removeLabel:t("removeColor"),customLabel:t("customColor"),onPick:T=>{C(),L.exec(Bn(y,T))}})});f("forecolor","color",M.textColor,"textColor"),f("backcolor","background",M.highlight,"backgroundColor");let p=[["superscript","superscript",M.superscript],["subscript","subscript",M.subscript],["code","code",M.code]];e.addMenuButton("moreformats",{icon:M.formatMore,tooltip:t("moreFormats"),isActive:g=>p.some(([,y])=>hr(g.view.state,n.schema.marks[y])),items:g=>[...p.filter(([y])=>g.isAllowed(y)).map(([y,x,A])=>({id:y,label:t(y),icon:A,checkbox:!0,active:hr(g.view.state,n.schema.marks[x]),disabled:!g.can(y),...je[y]?{shortcut:je[y]}:{},onSelect:()=>g.exec(y)})),{type:"separator"},{id:"clearFormatting",label:t("clearFormatting"),icon:M.clearFormatting,disabled:!g.can("clearFormatting"),shortcut:je.clearFormatting,onSelect:()=>g.exec("clearFormatting")},{id:"pasteAsText",label:t("pasteAsText"),icon:M.pasteText,checkbox:!0,active:g.isPasteAsText(),onSelect:()=>{g.setPasteAsText(!g.isPasteAsText()),g.focus()}}]}),e.addToggleButton("pastetext",{icon:M.pasteText,tooltip:t("pasteAsText"),isActive:g=>g.isPasteAsText(),onAction:g=>{g.setPasteAsText(!g.isPasteAsText()),g.focus()}}),e.addButton("link",{icon:M.link,tooltip:t("link"),shortcut:"Mod-k",onAction:g=>et(g),isActive:()=>!!On(r())}),e.addButton("unlink",{icon:M.unlink,tooltip:t("unlink"),onAction:g=>g.exec(vr()),isEnabled:g=>g.can(vr())}),e.addButton("image",{icon:M.image,tooltip:t("image"),onAction:g=>To(g)});let h=()=>nn(r())?.node.attrs.align??null,m=(g,y,x,A)=>e.addToggleButton(g,{icon:x,tooltip:t(A),isActive:()=>h()===y,onAction:L=>L.exec(br({align:h()===y?null:y}))});m("imagealignleft","left",M.imageLeft,"image.alignLeft"),m("imagealigncenter","center",M.imageCenter,"image.alignCenter"),m("imagealignright","right",M.imageRight,"image.alignRight");let b=[["image.sizeSmall",.25],["image.sizeMedium",.5],["image.sizeLarge",.75],["image.sizeFull",1],["image.sizeOriginal",null]];e.addMenuButton("imagesize",{icon:M.resize,tooltip:t("image.size"),items:g=>b.map(([y,x])=>({id:y,label:t(y),onSelect:()=>Td(g,x)}))}),e.addButton("imagealt",{icon:M.altText,tooltip:t("image.editAlt"),onAction:g=>Nd(g)}),e.addButton("imagedelete",{icon:M.trash,tooltip:t("image.delete"),onAction:g=>g.exec((y,x)=>nn(y)?(x?.(y.tr.deleteSelection().scrollIntoView()),!0):!1)}),Op(n),e.addButton("searchreplace",{icon:M.search,tooltip:t("search.title"),shortcut:"Mod-f",onAction:g=>g.openSearch()}),e.addToggleButton("fullscreen",{icon:M.fullscreen,tooltip:t("fullscreen"),shortcut:"Mod-Shift-f",isActive:g=>Qs(g),onAction:g=>Mr(g)}),e.addButton("preview",{icon:M.preview,tooltip:t("preview"),onAction:g=>Mp(g)}),e.addButton("code",{icon:M.sourceCode,tooltip:t("sourceCode"),onAction:g=>Sp(g)}),e.addButton("help",{icon:M.help,tooltip:t("help"),shortcut:"Alt-0",onAction:g=>Bo(g)}),e.addContextToolbar("image",{label:t("image.toolbar"),predicate:g=>!!nn(g.view.state),items:"imagealignleft imagealigncenter imagealignright | imagesize imagealt | imagedelete"})}var Vw,qw,Ww,je,Uw,Ip,Bp=O(()=>{"use strict";Ie();yr();Dn();Np();tl();Lp();Zs();Me();Vw=[{label:"Sans Serif",value:'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif'},{label:"Serif",value:'Georgia, "Times New Roman", serif'},{label:"Monospace",value:"ui-monospace, Menlo, Consolas, monospace"},{label:"Arial",value:"Arial, Helvetica, sans-serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Times New Roman",value:'"Times New Roman", Times, serif'},{label:"Verdana",value:"Verdana, Geneva, sans-serif"},{label:"Courier New",value:'"Courier New", Courier, monospace'}],qw=["8pt","10pt","12pt","14pt","16pt","18pt","24pt","36pt","48pt"],Ww=["1","1.15","1.5","2","2.5","3"],je={undo:"Mod-z",redo:"Mod-Shift-z",bold:"Mod-b",italic:"Mod-i",underline:"Mod-u",strike:"Mod-Shift-x",code:"Mod-e",subscript:"Mod-,",superscript:"Mod-.",bulletList:"Mod-Shift-8",orderedList:"Mod-Shift-7",alignLeft:"Mod-Shift-l",alignCenter:"Mod-Shift-e",alignRight:"Mod-Shift-r",alignJustify:"Mod-Shift-j",clearFormatting:"Mod-\\",paragraph:"Mod-Alt-0",h1:"Mod-Alt-1",h2:"Mod-Alt-2",h3:"Mod-Alt-3",h4:"Mod-Alt-4",h5:"Mod-Alt-5",h6:"Mod-Alt-6"};Uw={"system-ui":"Sans Serif","-apple-system":"Sans Serif","sans-serif":"Sans Serif",serif:"Serif",monospace:"Monospace","ui-monospace":"Monospace"};Ip=(n,e)=>n!==null&&n.replace(/["'\s]/g,"").toLowerCase()===e.replace(/["'\s]/g,"").toLowerCase()});function mt(n,e,t){let r=window.innerWidth,o=window.innerHeight,{width:i,height:s}=n.getBoundingClientRect(),l=o-e.bottom,a=e.top,u=t==="top-start"?a>=s+6||a>l:l<s+6&&a>l,d=u?e.top-s-6:e.bottom+6,f=t==="bottom-end"?e.right-i:t==="bottom"?e.left+e.width/2-i/2:e.left;f=Math.max(8,Math.min(f,r-i-8)),d=Math.max(8,Math.min(d,o-s-8)),n.style.left=`${Math.round(f)}px`,n.style.top=`${Math.round(d)}px`,n.dataset.side=u?"top":"bottom"}var Sr,zn,ln=O(()=>{"use strict";Sr=[],zn=class{el;options;closed=!1;constructor(e){this.options=e,this.el=document.createElement("div"),this.el.className=`nova-popover ${e.className??""}`.trim(),this.el.append(e.content),e.host.append(this.el),this.reposition(),document.addEventListener("keydown",this.onKeyDown,!0),document.addEventListener("pointerdown",this.onPointerDown,!0),Sr.push(this),window.addEventListener("resize",this.reposition),window.addEventListener("scroll",this.reposition,!0)}get isOpen(){return!this.closed}reposition=()=>{if(this.closed)return;let{anchor:e,placement:t="bottom-start"}=this.options,r=typeof e=="function"?e():e.getBoundingClientRect();mt(this.el,r,t)};close(e="api"){this.closed||(this.closed=!0,Sr.splice(Sr.indexOf(this),1),document.removeEventListener("keydown",this.onKeyDown,!0),document.removeEventListener("pointerdown",this.onPointerDown,!0),window.removeEventListener("resize",this.reposition),window.removeEventListener("scroll",this.reposition,!0),this.el.remove(),this.options.onClose?.(e))}focusWasInside=!1;onKeyDown=e=>{e.key!=="Escape"||e.defaultPrevented||Sr[Sr.length-1]===this&&(e.target?.closest?.(".nova-dialog")||(e.preventDefault(),e.stopPropagation(),this.focusWasInside=this.el.contains(document.activeElement),this.close("escape")))};onPointerDown=e=>{if(this.options.dismissOnOutside===!1)return;let t=e.target;this.el.contains(t)||this.options.ignore?.some(r=>r.contains(t))||this.close("outside")}}});function zp(n){return new _({key:new j("nova-link-bubble"),view(e){let{t}=n.ui,r=v("a",{className:"nova-bubble-link",target:"_blank",rel:"noopener noreferrer"}),o=(c,u,d)=>{let f=v("button",{type:"button",className:"nova-btn","aria-label":u,"data-tooltip":u},te(c));return f.addEventListener("click",d),n.ui.tooltip.attach(f),f},i=v("div",{className:"nova-bubble",role:"toolbar","aria-label":t("link"),hidden:!0},te(M.externalLink),r,v("span",{className:"nova-bubble-sep"}),o(M.edit,t("link.edit"),()=>et(n)),o(M.copy,t("link.copy"),()=>{navigator.clipboard?.writeText(r.href).then(()=>n.ui.notify({text:t("link.copied"),type:"success",timeout:2e3}))}),o(M.unlink,t("unlink"),()=>n.exec(vr())));i.addEventListener("mousedown",c=>{c.target.closest("button")&&c.preventDefault()}),n.ui.overlayHost.append(i);let s=()=>{i.hidden=!0},l=()=>{let c=e.state,u=On(c),d=e.hasFocus()||i.contains(document.activeElement);if(!u||!d||!n.isEditable()||n.ui.activeDialog||!c.selection.empty){s();return}let f=mr(c,oe(c).link,c.selection.from);if(!f)return s();r.textContent=u.href,r.title=u.href,Le(u.href)?r.setAttribute("href",u.href):r.removeAttribute("href"),i.hidden=!1;let p=e.coordsAtPos(f.from),h=e.coordsAtPos(f.to),m=new DOMRect(p.left,p.top,Math.max(1,h.right-p.left),h.bottom-p.top);mt(i,m,"bottom-start")},a=c=>{i.contains(c.relatedTarget)||s()};return e.dom.addEventListener("blur",a),i.addEventListener("focusout",c=>{!i.contains(c.relatedTarget)&&!e.hasFocus()&&s()}),{update:l,destroy(){e.dom.removeEventListener("blur",a),i.remove()}}}})}var Hp=O(()=>{"use strict";U();Ie();Dn();Ie();dt();X();Me();ln()});function rl(n){let e=Array.isArray(n)?n:n.split(/\s+/),t=[[]];for(let r of e){let o=r.trim();o&&(o==="|"?t.push([]):t[t.length-1].push(o))}return t.filter(r=>r.length>0)}function ol(n,e,t,r,{warnUnknown:o=!0}={}){let{ui:i}=n,s=i.t,l=new AbortController,{signal:a}=l;e.className=`nova-toolbar nova-toolbar-${r}`,e.setAttribute("role","toolbar"),e.setAttribute("aria-label",s("toolbar.label"));let c=[],u=[];for(let w of rl(t)){let k=v("div",{className:"nova-tb-group",role:"group"});for(let S of w){if(!n.isAllowed(S))continue;let F=i.registry.get(S);if(!F){o&&console.warn(`[nova] Unknown toolbar item "${S}"`);continue}let H=Cr(n,S,F);c.push(H),k.append(H.el)}k.childElementCount&&(u.push(k),e.append(k))}let d=v("div",{className:"nova-toolbar nova-tb-overflow",role:"group"}),f=v("button",{type:"button",className:"nova-btn nova-tb-more","aria-label":s("more"),"aria-haspopup":"true","aria-expanded":"false","data-tooltip":s("more"),hidden:!0},te(M.more));i.tooltip.attach(f);let p=null,h=()=>{p?.close(),p=null},m=i.onDialogOpen(h);f.addEventListener("click",w=>{if(p)return h();f.setAttribute("aria-expanded","true");let k=new zn({host:i.overlayHost,anchor:f,placement:"bottom-end",content:d,className:"nova-tb-overflow-popover",ignore:[i.overlayHost,f],onClose:S=>{p=null,f.setAttribute("aria-expanded","false"),S==="escape"&&k.focusWasInside&&f.focus()}});p=k,w.detail===0&&d.querySelector("button:not(:disabled)")?.focus()}),r==="sliding"&&e.append(f);let b=()=>{if(r!=="sliding")return;for(let k of u)e.insertBefore(k,f);if(f.hidden=!0,e.scrollWidth<=e.clientWidth+1){h();return}f.hidden=!1;let w=u.length;for(;w>1&&e.scrollWidth>e.clientWidth+1;)w-=1,d.prepend(u[w]);d.childElementCount||(f.hidden=!0),p?.reposition(),L()},g=-1,y=typeof ResizeObserver<"u"&&r==="sliding"?new ResizeObserver(()=>{e.clientWidth!==g&&(g=e.clientWidth,b())}):null;y?.observe(e);let x=()=>[...e.querySelectorAll("button")].filter(w=>!w.disabled&&!w.hidden),A=null,L=()=>{let w=x();(!A||!w.includes(A))&&(A=w[0]??null);for(let k of e.querySelectorAll("button"))k.tabIndex=k===A?0:-1};e.addEventListener("focusin",w=>{let k=w.target;k instanceof HTMLButtonElement&&e.contains(k)&&(A=k,L())},{signal:a}),e.addEventListener("keydown",w=>{let k=x(),S=k.indexOf(document.activeElement);if(S<0)return;let F=null;if(w.key==="ArrowRight")F=S+1;else if(w.key==="ArrowLeft")F=S-1;else if(w.key==="Home")F=0;else if(w.key==="End")F=k.length-1;else if(w.key==="Escape"){w.preventDefault(),n.focus();return}F!==null&&(w.preventDefault(),k[(F+k.length)%k.length].focus())},{signal:a});let C=w=>{w.target.closest("button")&&w.preventDefault()};e.addEventListener("mousedown",C,{signal:a}),d.addEventListener("mousedown",C),d.addEventListener("keydown",w=>{if(w.key==="Escape")return;let k=[...d.querySelectorAll("button")].filter(F=>!F.disabled),S=k.indexOf(document.activeElement);S<0||(w.key==="ArrowRight"||w.key==="ArrowDown"?(w.preventDefault(),k[(S+1)%k.length].focus()):(w.key==="ArrowLeft"||w.key==="ArrowUp")&&(w.preventDefault(),k[(S-1+k.length)%k.length].focus()))});let T=()=>{for(let w of c)w.update();L()};return T(),b(),{update:T,focus:()=>{L(),A?.focus()},destroy:()=>{y?.disconnect(),m(),h(),l.abort(),e.replaceChildren()}}}function Cr(n,e,t){if(t.type==="split")return Kw(n,e,t);let{ui:r}=n,o=v("button",{type:"button",className:`nova-btn nova-tb-${t.type}`,"aria-label":t.tooltip,"data-tooltip":t.tooltip,"data-control":e,...t.shortcut?{"data-shortcut":t.shortcut}:{}});r.tooltip.attach(o),t.icon&&o.append(te(t.icon));let i=t.type==="menu"&&(t.label||t.text)?v("span",{className:"nova-tb-label"}):null;i?(t.type==="menu"&&t.minChars&&(i.style.minWidth=`${t.minChars}ch`),o.append(i),o.classList.add("nova-tb-has-label")):!t.icon&&t.text&&o.append(t.text);let s=null;return t.type==="panel"&&t.indicator&&(s=v("span",{className:"nova-color-bar"}),o.append(s)),t.type!=="button"&&(o.setAttribute("aria-haspopup",t.type==="menu"?"menu":"dialog"),o.setAttribute("aria-expanded","false"),o.append(te(M.chevronDown)),o.lastElementChild?.classList.add("nova-chevron")),o.addEventListener("click",a=>{if(t.type==="button"){t.onAction(n);return}if(o.getAttribute("aria-expanded")==="true"){r.closePopover();return}let c=a.detail===0,u=()=>r.closePopover(),d=t.type==="menu"?Ro(t.items(n),u,t.tooltip):t.render(n,u);o.setAttribute("aria-expanded","true");let f=r.openPopover({anchor:o,content:d,ignore:[o],className:t.type==="menu"?"nova-popover-menu":"nova-popover-panel",onClose:p=>{o.setAttribute("aria-expanded","false"),p==="escape"&&f.focusWasInside&&o.focus()}});t.type==="menu"?Io(d):c&&d.querySelector("button, input")?.focus()}),t.type!=="button"&&o.addEventListener("keydown",a=>{a.key==="ArrowDown"&&o.getAttribute("aria-expanded")!=="true"&&(a.preventDefault(),o.click())}),{el:o,update:()=>{let a=n.isEditable();if(o.disabled=!a||(t.isEnabled?!t.isEnabled(n):!1),t.isActive){let c=t.isActive(n);o.classList.toggle("is-active",c),t.type==="button"&&o.setAttribute("aria-pressed",String(c))}if(i&&t.type==="menu"&&(i.textContent=t.label?.(n)??t.text??""),s&&t.type==="panel"&&t.indicator){let c=t.indicator(n);s.style.background=c??"",s.classList.toggle("is-empty",!c)}}}}function Kw(n,e,t){let r=Cr(n,e,{type:"button",tooltip:t.tooltip,onAction:t.onAction,...t.icon?{icon:t.icon}:{},...t.text?{text:t.text}:{},...t.shortcut?{shortcut:t.shortcut}:{},...t.isActive?{isActive:t.isActive}:{},...t.isEnabled?{isEnabled:t.isEnabled}:{}}),o=Cr(n,`${e}-options`,{type:"menu",tooltip:`${t.tooltip}: ${n.ui.t("toolbar.options")}`,items:t.items,...t.isEnabled?{isEnabled:t.isEnabled}:{}});return o.el.classList.add("nova-tb-split-more"),{el:v("span",{className:"nova-tb-split"},r.el,o.el),update:()=>{r.update(),o.update()}}}var nl,il=O(()=>{"use strict";X();Me();Js();ln();nl="undo redo | blocks | bold italic underline strikethrough moreformats | forecolor backcolor | link image table | bullist numlist | align lineheight outdent indent | fontfamily fontsize | blockquote codeblock hr | removeformat | searchreplace preview code fullscreen help"});function Fp(n){return new _({key:new j("nova-context-toolbar"),view(e){let t=v("div",{className:"nova-bubble nova-context-toolbar",role:"toolbar",hidden:!0});n.ui.overlayHost.append(t);let r=new Map,o=null,i=(m,b)=>{let g=r.get(m);if(g)return g;let y=v("div",{className:"nova-context-items"}),x=[];return rl(b.items).forEach((A,L)=>{L>0&&y.append(v("span",{className:"nova-bubble-sep",role:"separator"}));for(let C of A){if(!n.isAllowed(C))continue;let T=n.ui.registry.get(C);if(!T)continue;let w=Cr(n,C,T);x.push(w),y.append(w.el)}}),g={el:y,controls:x},r.set(m,g),g},s=()=>{t.hidden=!0,o=null},l=m=>{let{selection:b}=e.state;if((m.position??"node")==="node"&&b instanceof R)return e.nodeDOM(b.from)?.getBoundingClientRect()??null;let g=e.coordsAtPos(b.from),y=e.coordsAtPos(b.to);return new DOMRect(g.left,g.top,Math.max(1,y.right-g.left),y.bottom-g.top)},a=!1,c=m=>{m.pointerType==="mouse"&&m.button===0&&(a=!0)},u=()=>{a&&(a=!1,setTimeout(()=>f(e),0))};e.dom.addEventListener("pointerdown",c),document.addEventListener("pointerup",u);let d=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,f=m=>{if(!(m.hasFocus()||t.contains(document.activeElement))||!n.isEditable()||n.ui.activeDialog||a)return s();let g=n.ui.registry.getContextToolbars().find(([,T])=>T.predicate(n));if(!g)return s();let[y,x]=g,A=i(y,x);o!==y&&(t.replaceChildren(A.el),t.setAttribute("aria-label",x.label),o=y);for(let T of A.controls)T.update();let L=x.anchor?x.anchor(n):l(x);if(!L)return s();t.hidden=!1;let C=x.placement??(x.position==="selection"?"bottom-start":"top-start");d&&x.position==="selection"&&(C="bottom-start"),mt(t,L,C)};t.addEventListener("mousedown",m=>{m.target.closest("button")&&m.preventDefault()}),t.addEventListener("keydown",m=>{let b=[...t.querySelectorAll("button:not(:disabled)")],g=b.indexOf(document.activeElement);if(m.key==="Escape")m.preventDefault(),n.focus();else if(g>=0&&(m.key==="ArrowRight"||m.key==="ArrowLeft")){m.preventDefault();let y=m.key==="ArrowRight"?1:-1;b[(g+y+b.length)%b.length].focus()}});let p=m=>{let b=m.relatedTarget;!t.contains(b)&&!n.ui.overlayHost.contains(b)&&s()};e.dom.addEventListener("blur",p),t.addEventListener("focusout",m=>{let b=m.relatedTarget;!t.contains(b)&&!e.hasFocus()&&!n.ui.overlayHost.contains(b)&&s()});let h=()=>{t.hidden||f(e)};return window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),{update:f,destroy(){e.dom.removeEventListener("blur",p),e.dom.removeEventListener("pointerdown",c),document.removeEventListener("pointerup",u),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h),t.remove()}}}})}function $p(n){let e=n.ui.overlayHost.querySelector(".nova-context-toolbar:not([hidden]) button:not(:disabled)");return e?.focus(),!!e}var _p=O(()=>{"use strict";U();X();ln();il()});var Vp,_o,qp=O(()=>{"use strict";U();ft();dt();Vp=24,_o=class{constructor(e,t,r,o){this.view=t;this.getPos=r;this.editor=o;this.node=e,this.dom=document.createElement("span"),this.dom.className="nova-image",this.img=document.createElement("img"),this.img.draggable=!1,this.dom.append(this.img);for(let i of["nw","ne","sw","se"]){let s=document.createElement("span");s.className=`nova-image-handle nova-image-handle-${i}`,s.dataset.corner=i,s.addEventListener("pointerdown",l=>this.startResize(l,i)),this.dom.append(s)}this.render()}view;getPos;editor;dom;img;node;resizing=!1;render(){let{src:e,alt:t,title:r,width:o,height:i,align:s}=this.node.attrs,l=De(e)?e:"";this.img.getAttribute("src")!==l&&this.img.setAttribute("src",l),this.setAttr("alt",t),this.setAttr("title",r);let a=Re(o),c=Re(i);this.img.style.width=a?`${a}px`:"",this.img.style.aspectRatio=a&&c?`${a} / ${c}`:"",this.dom.dataset.align=s??""}setAttr(e,t){t?this.img.setAttribute(e,t):this.img.removeAttribute(e)}update(e){return e.type!==this.node.type?!1:(this.node=e,this.resizing||this.render(),!0)}selectNode(){this.dom.classList.add("is-selected")}deselectNode(){this.dom.classList.remove("is-selected")}stopEvent(e){return e.target.classList?.contains("nova-image-handle")??!1}ignoreMutation(){return!0}startResize(e,t){if(!this.editor.isEditable())return;e.preventDefault(),e.stopPropagation();let r=e.currentTarget;r.setPointerCapture(e.pointerId);let o=this.img.getBoundingClientRect(),i=e.clientX,s=o.width,l=o.width>0?o.height/o.width:this.img.naturalHeight/(this.img.naturalWidth||1),a=Math.max(Vp,this.view.dom.clientWidth-40),c=t==="ne"||t==="se"?1:-1,u=s;this.resizing=!0,this.dom.classList.add("is-resizing");let d=p=>{u=Math.round(Math.min(a,Math.max(Vp,s+c*(p.clientX-i)))),this.img.style.width=`${u}px`,this.dom.dataset.size=`${u} \xD7 ${Math.round(u*l)}`},f=()=>{r.removeEventListener("pointermove",d),r.removeEventListener("pointerup",f),r.removeEventListener("pointercancel",f),this.resizing=!1,this.dom.classList.remove("is-resizing"),delete this.dom.dataset.size;let p=this.getPos();if(p===void 0||Math.abs(u-s)<1)return this.render();let h=this.view.state.tr.setNodeMarkup(p,void 0,{...this.node.attrs,width:u,height:Math.round(u*l)});h.setSelection(R.create(h.doc,p)),this.view.dispatch(h)};r.addEventListener("pointermove",d),r.addEventListener("pointerup",f),r.addEventListener("pointercancel",f)}}});function Gw(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xw(n,e){let{selection:t}=n.state;if(!t.empty)return null;let r=t.$from;if(!r.parent.isTextblock||r.parent.type.spec.code)return null;let o=r.parent.textBetween(Math.max(0,r.parentOffset-Jw-1),r.parentOffset,"\0","\0");for(let[i,s]of e.ui.registry.getAutocompleters()){let l=new RegExp(`(?:^|\\s)${Gw(s.trigger)}([\\p{L}\\p{N}_-]*)$`,"u"),a=o.match(l);if(!a)continue;let c=a[1]??"";if(c.length<(s.minChars??0))continue;let u=r.parentOffset-c.length-s.trigger.length,d=u>0?r.parent.textBetween(u-1,u,"\0","\0"):"";if(!(d&&!/\s/.test(d)))return{name:i,spec:s,from:r.pos-c.length-s.trigger.length,to:r.pos,query:c}}return null}function Wp(n){let e,t=[],r=0,o=null,i=null,s=0,l=ke("nova-ac"),a=()=>!e.hidden,c=h=>{e.hidden=!0,o=null,t=[],h.dom.removeAttribute("aria-activedescendant"),h.dom.removeAttribute("aria-controls"),h.dom.setAttribute("aria-expanded","false")},u=(h,m)=>{let b=t[m];if(!b||!o)return;let{spec:g,from:y,to:x}=o;c(h),g.onSelect(b,{from:y,to:x},n)},d=h=>{if(!o)return;let{spec:m}=o;if(e.replaceChildren(),e.setAttribute("aria-label",m.label),!t.length){if(!m.emptyText)return c(h);e.append(v("div",{className:"nova-ac-empty"},m.emptyText))}t.forEach((g,y)=>{let x=v("div",{id:`${l}-${y}`,className:"nova-menu-item nova-ac-item",role:"option","aria-selected":String(y===r)},g.icon?te(g.icon):null,v("span",{className:"nova-menu-label"},g.label),g.shortcut?v("kbd",{className:"nova-menu-shortcut"},Ge(g.shortcut)):g.detail?v("span",{className:"nova-menu-shortcut"},g.detail):null);x.addEventListener("mousedown",A=>{A.preventDefault(),u(h,y)}),x.addEventListener("mousemove",()=>{r!==y&&f(h,y)}),e.append(x)}),e.hidden=!1,h.dom.setAttribute("aria-controls",l),h.dom.setAttribute("aria-expanded","true"),f(h,Math.min(r,Math.max(0,t.length-1)));let b=h.coordsAtPos(o.from);mt(e,new DOMRect(b.left,b.top,1,b.bottom-b.top),"bottom-start")},f=(h,m)=>{r=m,e.querySelectorAll('[role="option"]').forEach((g,y)=>g.setAttribute("aria-selected",String(y===m)));let b=e.querySelector(`#${l}-${m}`);b&&(h.dom.setAttribute("aria-activedescendant",b.id),b.scrollIntoView?.({block:"nearest"}))},p=h=>{let m=n.isEditable()&&h.hasFocus()?Xw(h,n):null;if(!m||m.from===i){m||(i=null),(a()||o)&&c(h);return}let b=!o||o.query!==m.query||o.from!==m.from;if(o=m,!b&&a())return d(h);let g=++s;Promise.resolve(m.spec.fetch(m.query,n)).then(y=>{g!==s||!o||(t=y.slice(0,m.spec.maxResults??10),r=0,d(h))})};return new _({key:new j("nova-autocompleter"),view(h){e=v("div",{className:"nova-popover nova-ac",id:l,role:"listbox",hidden:!0}),n.ui.overlayHost.append(e),h.dom.setAttribute("aria-autocomplete","list");let m=()=>c(h);return h.dom.addEventListener("blur",m),{update:b=>p(b),destroy(){h.dom.removeEventListener("blur",m),e.remove()}}},props:{handleKeyDown(h,m){if(!a()||!o)return!1;let b=t.length;switch(m.key){case"ArrowDown":return b&&f(h,(r+1)%b),!0;case"ArrowUp":return b&&f(h,(r-1+b)%b),!0;case"Enter":case"Tab":return b?(u(h,r),!0):!1;case"Escape":return i=o.from,c(h),!0;default:return!1}}}})}var Jw,Up=O(()=>{"use strict";U();X();ln();Jw=30});function Qw(n,e,t){let r=e.toLowerCase();if(!r)return n;let o=[];return n.forEach((i,s)=>{let l=t(i.label).toLowerCase(),a=[l,...l.split(/\s+/),...i.keywords],c=-1;l.startsWith(r)?c=3:a.some(u=>u.startsWith(r))?c=2:a.some(u=>u.includes(r))&&(c=1),c>0&&o.push([c,s,i])}),o.sort((i,s)=>s[0]-i[0]||i[1]-s[1]).map(([,,i])=>i)}function jp(n,e=[]){let{t}=n.ui,r=[...Yw,...e].filter(o=>n.isAllowed(o.name));n.ui.registry.addAutocompleter("slashcommands",{trigger:"/",label:t("slash.label"),emptyText:t("slash.empty"),fetch:o=>Qw(r,o,t).map(i=>({value:i.name,label:t(i.label),icon:i.icon,...i.shortcut?{shortcut:i.shortcut}:{}})),onSelect:(o,i,s)=>{let l=r.find(a=>a.name===o.value);l&&(s.view.dispatch(s.view.state.tr.delete(i.from,i.to)),l.run(s))}})}var gt,Yw,Kp=O(()=>{"use strict";yr();Dn();Rn();Me();gt=n=>e=>e.exec(n),Yw=[{name:"paragraph",label:"paragraph",icon:M.paragraph,keywords:["text","p","paragraph"],run:gt("paragraph")},{name:"h1",label:"h1",icon:M.h1,keywords:["h1","heading","title"],shortcut:"Mod-Alt-1",run:gt("h1")},{name:"h2",label:"h2",icon:M.h2,keywords:["h2","heading","subtitle"],shortcut:"Mod-Alt-2",run:gt("h2")},{name:"h3",label:"h3",icon:M.h3,keywords:["h3","heading"],shortcut:"Mod-Alt-3",run:gt("h3")},{name:"bullist",label:"bulletList",icon:M.bulletList,keywords:["ul","list","bullet"],shortcut:"Mod-Shift-8",run:gt("bulletList")},{name:"numlist",label:"orderedList",icon:M.orderedList,keywords:["ol","list","numbered"],shortcut:"Mod-Shift-7",run:gt("orderedList")},{name:"blockquote",label:"blockquote",icon:M.blockquote,keywords:["quote","blockquote","citation"],run:gt("blockquote")},{name:"codeblock",label:"codeBlock",icon:M.codeBlock,keywords:["code","pre","snippet"],run:gt("codeBlock")},{name:"hr",label:"horizontalRule",icon:M.horizontalRule,keywords:["hr","divider","line","separator"],run:gt("horizontalRule")},{name:"table",label:"table",icon:M.table,keywords:["table","grid"],run:n=>n.exec(tt(3,3))},{name:"image",label:"image",icon:M.image,keywords:["image","picture","photo","img"],run:n=>To(n)},{name:"link",label:"link",icon:M.link,keywords:["link","url","href"],shortcut:"Mod-k",run:n=>et(n)}]});var Vo,Jp=O(()=>{"use strict";X();Me();Vo=class{region;closeLabel;constructor(e,t){this.closeLabel=t,this.region=v("div",{className:"nova-notifications","aria-live":"polite"}),e.append(this.region)}open(e){let t=e.type??"info",r=e.timeout??(t==="error"?0:4e3),o=v("span",{className:"nova-notification-text"},e.text),i=v("button",{type:"button",className:"nova-btn","aria-label":this.closeLabel},te(M.close)),s=v("div",{className:`nova-notification nova-notification-${t}`,role:t==="error"?"alert":"status"},o,i);this.region.append(s);let l=null,a=()=>{l&&clearTimeout(l),s.remove()};return i.addEventListener("click",a),r>0&&(l=setTimeout(a,r)),{close:a,setText:c=>o.textContent=c}}destroy(){this.region.remove()}}});var qo,Gp=O(()=>{"use strict";qo=class{controls=new Map;addButton(e,t){this.controls.set(e.toLowerCase(),{type:"button",...t})}addToggleButton(e,t){this.addButton(e,t)}addMenuButton(e,t){this.controls.set(e.toLowerCase(),{type:"menu",...t})}addPanelButton(e,t){this.controls.set(e.toLowerCase(),{type:"panel",...t})}addSplitButton(e,t){this.controls.set(e.toLowerCase(),{type:"split",...t})}menuItems=new Map;addMenuItem(e,t){this.menuItems.set(e.toLowerCase(),t)}addToggleMenuItem(e,t){this.addMenuItem(e,t)}getMenuItem(e){let t=this.menuItems.get(e.toLowerCase());if(t)return t;let r=this.get(e);if(!(r?.type!=="button"&&r?.type!=="split"))return{text:r.tooltip,...r.icon?{icon:r.icon}:{},...r.shortcut?{shortcut:r.shortcut}:{},onAction:r.onAction,...r.isActive?{isActive:r.isActive}:{},...r.isEnabled?{isEnabled:r.isEnabled}:{}}}contextToolbars=new Map;autocompleters=new Map;addAutocompleter(e,t){this.autocompleters.set(e.toLowerCase(),t)}getAutocompleters(){return[...this.autocompleters]}addContextToolbar(e,t){this.contextToolbars.set(e.toLowerCase(),t)}getContextToolbars(){return[...this.contextToolbars].sort((e,t)=>(t[1].priority??0)-(e[1].priority??0))}get(e){return this.controls.get(e.toLowerCase())}has(e){return this.controls.has(e.toLowerCase())}names(){return[...this.controls.keys()]}}});var Zw,Wo,Xp=O(()=>{"use strict";X();ln();Zw=450,Wo=class{el;timer=null;target=null;constructor(e){this.el=v("div",{className:"nova-tooltip",role:"tooltip",hidden:!0}),e.append(this.el)}attach(e){e.addEventListener("pointerenter",t=>{t.pointerType==="mouse"&&this.schedule(e)}),e.addEventListener("pointerleave",()=>this.hide()),e.addEventListener("focus",()=>{e.matches(":focus-visible")&&this.show(e)}),e.addEventListener("blur",()=>this.hide()),e.addEventListener("pointerdown",()=>this.hide())}schedule(e){this.clearTimer(),this.timer=setTimeout(()=>this.show(e),Zw)}show(e){this.clearTimer();let t=e.dataset.tooltip;if(!t||e.getAttribute("aria-expanded")==="true")return;this.target=e;let r=e.dataset.shortcut;this.el.replaceChildren(v("span",{},t)),r&&this.el.append(v("kbd",{},Ge(r))),this.el.hidden=!1,mt(this.el,e.getBoundingClientRect(),"bottom")}hide(){this.clearTimer(),this.el.hidden=!0,this.target=null}get current(){return this.target}destroy(){this.hide(),this.el.remove()}clearTimer(){this.timer&&clearTimeout(this.timer),this.timer=null}}});var Uo,Yp=O(()=>{"use strict";kt();X();Jp();ln();Gp();Xp();Uo=class{constructor(e,t,r){this.focusEditor=r;this.t=t,this.overlayHost=v("div",{className:"nova-overlays"}),e.append(this.overlayHost),this.tooltip=new Wo(this.overlayHost),this.notifications=new Vo(e,t("dialog.close"))}focusEditor;registry=new qo;t;overlayHost;tooltip;notifications;popover=null;dialog=null;openPopover(e){this.closePopover(),this.tooltip.hide();let t=new zn({...e,host:this.overlayHost,onClose:r=>{this.popover===t&&(this.popover=null),e.onClose?.(r)}});return this.popover=t,t}closePopover(){this.popover?.close("api"),this.popover=null}get activePopover(){return this.popover}dialogListeners=new Set;onDialogOpen(e){return this.dialogListeners.add(e),()=>this.dialogListeners.delete(e)}closeOverlays(){this.closePopover(),this.dialogListeners.forEach(e=>e())}openDialog(e){this.closePopover(),this.dialogListeners.forEach(r=>r()),this.dialog?.close();let t=ya({cancelLabel:this.t("dialog.cancel"),closeLabel:this.t("dialog.close"),...e,host:this.overlayHost,returnFocus:this.focusEditor,onClose:()=>{this.dialog===t&&(this.dialog=null),e.onClose?.()}});return this.dialog=t,t}get activeDialog(){return this.dialog}notify(e){return this.notifications.open(typeof e=="string"?{text:e}:e)}destroy(){this.closePopover(),this.dialog?.close(),this.tooltip.destroy(),this.notifications.destroy(),this.overlayHost.remove()}}});function n0(n){let e=n.match(/[\p{L}\p{N}]+(?:['’-][\p{L}\p{N}]+)*/gu);return e?e.length:0}function Qp(n,e){e.className="nova-statusbar";let t=v("div",{className:"nova-path","aria-hidden":"true"}),r=v("div",{className:"nova-wordcount","aria-live":"off"});e.append(t,r);let o=null,i=()=>{let l=n.view.state.doc;r.textContent=n.ui.t("status.words",{count:n0(l.textBetween(0,l.content.size," "," "))})},s=l=>{let{$from:a}=n.view.state.selection,c=[];for(let d=1;d<=a.depth;d++){let f=a.node(d),p=e0[f.type.name]?.(f);p&&c.push(p)}n.view.state.selection.node?.type.name==="image"&&c.push("img");for(let d of a.marks()){let f=t0[d.type.name];f&&c.push(f)}t.textContent=c.join(" \u203A "),l&&(o&&clearTimeout(o),o=setTimeout(i,250))};return i(),s(!1),{update:s,destroy:()=>{o&&clearTimeout(o),e.replaceChildren()}}}var e0,t0,Zp=O(()=>{"use strict";X();e0={paragraph:()=>"p",heading:n=>`h${n.attrs.level}`,blockquote:()=>"blockquote",code_block:()=>"pre",bullet_list:()=>"ul",ordered_list:()=>"ol",list_item:()=>"li",table:()=>"table",table_row:()=>"tr",table_cell:()=>"td",table_header:()=>"th"},t0={bold:"strong",italic:"em",underline:"u",strike:"s",code:"code",link:"a",subscript:"sub",superscript:"sup"}});function Ke(n,e){console.error(`[nova] ${n}`,...e===void 0?[]:[e])}function Ko(n,e){if(typeof e!="string")return Oe.fromJSON(n,e);let t=document.createElement("div"),r=document.createElement("template");return r.innerHTML=e,t.appendChild(r.content),rn(n).parse(t)}function sl(n){return new jo(n)}var r0,jo,ll=O(()=>{"use strict";Tf();Lf();Eo();at();le();U();Tt();Ie();zf();yr();Ff();_f();Dn();tp();Rn();Ks();lp();cp();pp();Tr();Ys();kp();Zs();ft();zo();Bp();Hp();_p();qp();Up();Kp();Yp();Zp();il();r0=new ht,jo=class{view;root;ui;options;listeners=new Map;ready;toolbar;toolbarHost;menubar;mode;pluginsByName=new Map;commandOverrides=new Map;transactionTransforms=[];cleanups=[];contentRules;schema;statusbar;searchBar;destroyed=!1;editable;pasteAsText;constructor(e){this.options=e,this.root=document.createElement("div"),this.root.className="nova-editor",e.element.appendChild(this.root);let t=document.createElement("div"),r=document.createElement("div"),o=document.createElement("div");r.className="nova-content";let i=document.createElement("div");i.className="nova-header";let s=document.createElement("div");i.append(s,t),this.root.append(i,r,o),this.toolbarHost=t,this.mode=e.mode??"classic",this.root.classList.add(`nova-mode-${this.mode}`);let l=this.mode==="distraction-free";this.mode!=="classic"&&(this.root.addEventListener("focusin",()=>this.root.classList.add("is-focused")),this.root.addEventListener("focusout",()=>{setTimeout(()=>{this.root.contains(document.activeElement)||this.root.classList.remove("is-focused")},0)})),this.ui=new Uo(this.root,Bf(e.language,e.translations),()=>this.focus());let a=He({"Mod-k":()=>(et(this),!0),"Alt-F9":()=>this.menubar?(this.menubar.focus(),!0):!1,"Alt-F10":()=>this.toolbar?(this.toolbar.focus(),!0):!1,"Ctrl-F9":()=>$p(this),"Mod-f":()=>(this.openSearch(),!0),"Mod-Shift-f":()=>(Mr(this),!0),"Alt-0":()=>(Bo(this),!0),Escape:()=>this.searchBar.isOpen()?(this.searchBar.close(),!0):!1}),c=[...e.plugins??[]];l&&!c.includes("quickbars")&&c.push("quickbars");let u=bl(c);u.errors.forEach(A=>Ke(A));let{ordered:d,errors:f}=ti(u.plugins);f.forEach(A=>Ke(A));let p=d.flatMap(A=>this.collectPmPlugins(A)),h=e.validElements!==void 0||e.invalidElements!==void 0||e.validStyles!==void 0;this.contentRules=h?new Po(e):null,this.schema=this.buildSchema(d),d.forEach(A=>this.registerCommands(A));let m=Ko(this.schema,e.content??""),b=hn.create({doc:this.contentRules?this.contentRules.normalizeDoc(m):m,plugins:[Wp(this),Hf(A=>this.isAllowed(A),this.schema),a,...Ld(),gp(),...$f(A=>this.resolveCommand(A)),...d.some(A=>A.replaceHistory)?[]:[md()],Af({color:"var(--nova-accent)",width:2}),Of(),Ad(this),Ed(this),ep(this),zp(this),Fp(this),...this.contentRules?[fp(this.contentRules)]:[],...p,...e.prosemirrorPlugins??[]]});this.editable=e.editable??!0,this.pasteAsText=e.pasteAsText??!1;let g=this.handleTransaction.bind(this);this.view=new Kt(r,{state:b,editable:()=>this.editable,attributes:{class:"nova-prosemirror",role:"textbox","aria-multiline":"true","aria-label":this.ui.t("editor.label"),...e.placeholder?{"data-placeholder":e.placeholder}:{}},dispatchTransaction:function(A){g(A,this)},clipboardParser:rn(this.schema),nodeViews:{image:(A,L,C)=>new _o(A,L,C,this)},handleDOMEvents:{focus:()=>(this.emit("focus"),!1),blur:()=>(this.emit("blur"),!1)}}),this.root.classList.toggle("nova-readonly",!this.editable),Pp(this),ap(this),e.slashCommands!==!1&&jp(this,e.slashCommands??[]),d.forEach(A=>this.setupPlugin(A)),e.setup?.(this);let y=e.menubar===!0?ip:typeof e.menubar=="string"?e.menubar:null;this.menubar=y?sp(this,s,y,{...op,...e.menu}):null,this.menubar||s.remove(),this.toolbar=e.toolbar===!1||l&&e.toolbar===void 0?null:ol(this,t,this.toolbarConfig(),e.toolbarMode??"sliding",{warnUnknown:u.loaders.length===0}),this.toolbar||t.remove(),!this.toolbar&&!this.menubar&&i.remove(),this.searchBar=xp(this,r);let x=e.statusbar??this.mode==="classic";this.statusbar=x?Qp(this,o):null,this.statusbar||o.remove(),e.onChange&&this.on("change",e.onChange),this.updatePlaceholder(),this.ready=u.loaders.length?this.loadLazyPlugins(u.loaders):Promise.resolve()}isAllowed(e){return this.contentRules?.isAllowed(e)??!0}hasPlugin(e){return this.pluginsByName.has(e)}buildSchema(e){let t={},r={};for(let o of e){for(let[i,s]of Object.entries(o.nodes??{}))i in t?Ke(`Node "${i}" is defined by several plugins`):t[i]=s;for(let[i,s]of Object.entries(o.marks??{}))i in r?Ke(`Mark "${i}" is defined by several plugins`):r[i]=s}try{return ks({nodes:t,marks:r})}catch(o){return Ke("Failed to build the document schema from plugins",o),ks()}}collectPmPlugins(e){try{return e.prosemirrorPlugins?.(this)??[]}catch(t){return Ke(`Plugin "${e.name}" failed to create ProseMirror plugins`,t),[]}}setupPlugin(e){try{let t=e.setup?.(this);typeof t=="function"&&this.cleanups.push(t),this.pluginsByName.set(e.name,e)}catch(t){Ke(`Plugin "${e.name}" failed during setup`,t)}}async loadLazyPlugins(e){let t=await Promise.all(e.map(l=>yl(l).catch(a=>(Ke("Failed to load plugin",a),null))));if(this.destroyed)return;let r=t.filter(l=>l?l.nodes||l.marks?(Ke(`Plugin "${l.name}" defines nodes or marks and cannot be loaded lazily; pass the plugin object instead`),!1):!0:!1),{ordered:o,errors:i}=ti(r,new Set(this.pluginsByName.keys()));i.forEach(l=>Ke(l));let s=o.flatMap(l=>this.collectPmPlugins(l));if(s.length){let l=this.view.state;this.view.updateState(l.reconfigure({plugins:[...l.plugins,...s]}))}o.forEach(l=>{this.registerCommands(l),this.setupPlugin(l)}),this.rebuildToolbar()}updateUI(){this.destroyed||this.toolbar?.update()}rebuildToolbar(){!this.toolbar||this.destroyed||(this.toolbar.destroy(),this.toolbar=ol(this,this.toolbarHost,this.toolbarConfig(),this.options.toolbarMode??"sliding"))}toolbarConfig(){if(this.options.toolbar)return this.options.toolbar;let e=[...this.pluginsByName.values()].map(t=>t.toolbar).filter(Boolean);return e.length?`${nl} | ${e.join(" ")}`:nl}handleTransaction(e,t=this.view){if(!t.isDestroyed){for(let r of this.transactionTransforms)e=r(e,t.state,this);t.updateState(t.state.apply(e)),this.view&&(this.toolbar?.update(),this.statusbar?.update(e.docChanged),this.searchBar?.update(),this.updatePlaceholder(),e.docChanged&&this.emit("change"),(e.selectionSet||e.docChanged)&&this.emit("selectionChange"))}}updatePlaceholder(){let e=this.view.state.doc,t=e.childCount===1&&e.firstChild?.type===this.schema.nodes.paragraph&&e.firstChild.content.size===0;this.view.dom.classList.toggle("nova-empty",t)}getHTML(){return r0.serializeFragment(this.view.state.doc.content)}getJSON(){return this.view.state.doc.toJSON()}getText(){return this.view.state.doc.textBetween(0,this.view.state.doc.content.size,`
35
+
36
+ `)}setContent(e,{addToHistory:t=!0}={}){let r=Ko(this.schema,e),o=this.view.state.tr.replaceWith(0,this.view.state.doc.content.size,r.content);t||o.setMeta("addToHistory",!1),this.view.dispatch(o)}isEmpty(){return this.view.dom.classList.contains("nova-empty")}resolveCommand(e){return this.commandOverrides.get(e)??J[e]}registerCommands(e){for(let[t,r]of Object.entries(e.commands??{}))r&&this.commandOverrides.set(t,r);e.transformTransaction&&this.transactionTransforms.push(e.transformTransaction)}exec(e){let r=(typeof e=="string"?this.resolveCommand(e):e)(this.view.state,this.view.dispatch,this.view);return r&&this.view.focus(),r}can(e){return(typeof e=="string"?this.resolveCommand(e):e)(this.view.state,void 0,this.view)}isActive(e){return kd(this.view.state,e)}focus(){this.destroyed||this.view.focus()}isPasteAsText(){return this.pasteAsText}setPasteAsText(e){this.pasteAsText=e,this.toolbar?.update()}openSearch(){this.searchBar.open()}closeSearch(){this.searchBar.close()}isEditable(){return this.editable}setEditable(e){this.editable!==e&&(this.editable=e,this.view.setProps({}),this.root.classList.toggle("nova-readonly",!e),e||this.ui.closePopover(),this.toolbar?.update(),this.emit("editableChange"))}on(e,t){let r=this.listeners.get(e);return r||this.listeners.set(e,r=new Set),r.add(t),()=>this.off(e,t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(e){for(let t of this.listeners.get(e)??[])t(this)}destroy(){if(!this.destroyed){this.emit("destroy"),this.destroyed=!0,this.menubar?.destroy(),this.ui.destroy(),this.toolbar?.destroy(),this.statusbar?.destroy();for(let e of this.cleanups.splice(0))try{e()}catch(t){Ke("Plugin cleanup failed",t)}this.searchBar.destroy(),this.root.classList.contains("nova-fullscreen")&&Mr(this,!1),this.view.destroy(),this.root.remove(),this.listeners.clear()}}}});function eh(n){let e=[];return n.descendants((t,r)=>{if(!t.isTextblock)return!0;let o="",i=[];return t.forEach((s,l)=>{let a=r+1+l;if(s.isText){for(let c=0;c<s.text.length;c+=1)i.push(a+c);o+=s.text}else{let c=s.type.spec.leafText?.(s)??" ";for(let u=0;u<c.length;u+=1)i.push(a);o+=c}}),e.push({pos:r,end:r+t.nodeSize-1,depth:n.resolve(r).depth,type:t.type.name,text:o,chars:i}),!1}),e}function nh(n,e,t){let r=n.length,o=e.length;if((r+1)*(o+1)>2e6)return null;let i=new Uint32Array((r+1)*(o+1)),s=(u,d)=>u*(o+1)+d;for(let u=r-1;u>=0;u-=1)for(let d=o-1;d>=0;d-=1)i[s(u,d)]=t(n[u],e[d])?i[s(u+1,d+1)]+1:Math.max(i[s(u+1,d)],i[s(u,d+1)]);let l=[],a=0,c=0;for(;a<r&&c<o;)t(n[a],e[c])?(l.push([a,c]),a+=1,c+=1):i[s(a+1,c)]>=i[s(a,c+1)]?a+=1:c+=1;return l}function Jo(n,e,t){if(e>=t)return;let r=n.added[n.added.length-1];r&&r.to>=e?r.to=Math.max(r.to,t):n.added.push({from:e,to:t})}function o0(n,e,t){if(e.text===t.text){e.text&&Jo(n,e.chars[0],e.end);return}let r=th(e.text),o=th(t.text),i=nh(r,o,(f,p)=>f===p);if(!i){e.text&&Jo(n,e.chars[0],e.end),t.text&&n.removed.push({pos:e.end,text:t.text,block:!1});return}let s=[],l=0;for(let f of r)s.push(l),l+=f.length;let a=f=>f<e.chars.length?e.chars[f]:e.end,c=0,u=0,d=(f,p)=>{let h=o.slice(u,f).join("");if(h.trim()){let m=p<r.length?a(s[p]):e.end;n.removed.push({pos:m,text:h,block:!1})}u=f};for(let[f,p]of[...i,[r.length,o.length]]){for(;c<f;c+=1){if(!r[c].trim())continue;let h=s[c];Jo(n,a(h),a(h+r[c].length-1)+1)}d(p,f),c=f+1,u=p+1}}function i0(n,e,t){return e?t>=e.depth?e.pos:n.resolve(e.pos).before(t+1):n.content.size}function rh(n,e){let t={added:[],removed:[]},r=eh(n),o=eh(e),s=nh(r,o,(c,u)=>c.type===u.type&&c.text===u.text)??[],l=0,a=0;for(let[c,u]of[...s,[r.length,o.length]]){let d=r.slice(l,c),f=o.slice(a,u),p=Math.min(d.length,f.length);for(let h=0;h<p;h+=1)o0(t,d[h],f[h]);for(let h of d.slice(p))h.text&&Jo(t,h.chars[0],h.end);for(let h of f.slice(p))h.text.trim()&&t.removed.push({pos:i0(n,r[c],h.depth),text:h.text,block:!0});l=c+1,a=u+1}return t}var th,oh=O(()=>{"use strict";th=n=>n.split(/(\s+)/).filter(Boolean)});var lh={};Be(lh,{default:()=>c0});function l0(n,e){let t=typeof e=="string"?e:s0.serializeFragment(Oe.fromJSON(n.schema,e).content);return Ko(n.schema,t)}function a0(n,e){let t=W(n,sh),r=n.options.language??"en",o=new Intl.DateTimeFormat(r,{dateStyle:"medium",timeStyle:"short"}),i=ke("nova-history-title"),s=[],l=null,a=null,c=!0,u=null,d=0,f=v("ol",{className:"nova-history-list","aria-label":t.versions}),p=v("div",{className:"nova-history-preview"}),h=v("p",{className:"nova-history-status",role:"status"}),m=v("button",{type:"button",className:"nova-button nova-button-primary",disabled:!0},t.restore),b=v("input",{type:"checkbox",checked:!0}),g=v("div",{className:"nova-history-legend"},v("label",{className:"nova-history-toggle"},b,t.highlight),v("span",{className:"nova-history-swatch is-added"},t.onlyHere),v("span",{className:"nova-history-swatch is-removed"},t.onlyNow)),y=e.save?v("button",{type:"button",className:"nova-button"},t.save):null,x=v("button",{type:"button",className:"nova-button"},t.close),A=v("section",{className:"nova-history",role:"region","aria-labelledby":i},v("header",{className:"nova-history-head"},v("h2",{id:i,className:"nova-history-title"},t.title),g,v("span",{className:"nova-history-spacer"}),y,m,x),v("div",{className:"nova-history-body"},p,v("aside",{className:"nova-history-side"},h,f))),L=H=>{if(!c||!l)return K.empty;let{added:I,removed:$}=rh(H,n.view.state.doc),ie=[...I.map(ue=>ee.inline(ue.from,ue.to,{class:"nova-diff-added"})),...$.map(ue=>ee.widget(ue.pos,()=>v(ue.block?"div":"span",{className:"nova-diff-removed"},ue.text),{side:-1,ignoreSelection:!0}))];return K.create(H,ie)},C=H=>{a=H;let I=hn.create({doc:H}),$=L(H);if(u){u.setProps({state:I,decorations:()=>$});return}u=new Kt(p,{state:I,editable:()=>!1,decorations:()=>$,attributes:{class:"nova-prosemirror nova-history-doc","aria-label":t.title,"aria-readonly":"true"}})},T=()=>{let H=[{revision:null,title:t.current,detail:""},...[...s].sort((I,$)=>$.createdAt-I.createdAt).map(I=>({revision:I,title:o.format(I.createdAt),detail:(I.authors??[]).join(", "),...I.label?{label:I.label}:{}}))];f.replaceChildren(...H.map(I=>{let $=I.revision?.id===l?.id&&!!I.revision==!!l,ie=v("button",{type:"button",className:"nova-history-item","aria-current":$?"true":null,tabindex:$?"0":"-1","data-revision":I.revision?.id??"current"},v("span",{className:"nova-history-time"},I.title),I.label?v("span",{className:"nova-history-label"},I.label):null,I.detail?v("span",{className:"nova-history-authors"},I.detail):null);return ie.addEventListener("click",()=>{k(I.revision),w()}),v("li",{},ie)}))};function w(){f.querySelector('.nova-history-item[aria-current="true"]')?.focus()}async function k(H){l=H,T(),m.disabled=!0;let I=++d;if(!H){C(n.view.state.doc);return}h.textContent=t.loading;try{let $=await e.load(H,n);if(I!==d)return;C(l0(n,$)),h.textContent="",m.disabled=!n.isEditable()}catch{I===d&&(h.textContent=t.failed)}}async function S(){h.textContent=t.loading;try{s=(await e.list()).filter(H=>H&&typeof H.id=="string"),h.textContent=s.length?"":t.empty,T()}catch{h.replaceChildren(t.failed," ",v("button",{type:"button",className:"nova-link-btn",onClick:()=>{S()}},t.retry))}}function F(){u?.destroy(),A.remove(),n.root.classList.remove("nova-history-open"),n.focus()}return m.addEventListener("click",()=>{if(!l||!a)return;let H=l,{state:I}=n.view;n.view.dispatch(pd(I.tr.replaceWith(0,I.doc.content.size,a.content))),e.onRestore?.(H),n.ui.notify({text:t.restored.replace("{date}",o.format(H.createdAt)),type:"success"}),F()}),y?.addEventListener("click",async()=>{y.disabled=!0;try{await e.save(),n.ui.notify({text:t.saved,type:"success"}),await S(),w()}finally{y.disabled=!1}}),x.addEventListener("click",F),b.addEventListener("change",()=>{c=b.checked,a&&C(a)}),A.addEventListener("keydown",H=>{if(H.key==="Escape"){H.preventDefault(),F();return}let I=H.target;if(!I.classList.contains("nova-history-item")||H.key!=="ArrowDown"&&H.key!=="ArrowUp")return;H.preventDefault();let $=[...f.querySelectorAll(".nova-history-item")],ie=$[$.indexOf(I)+(H.key==="ArrowDown"?1:-1)];ie?.click(),f.querySelector(`[data-revision="${ie?.dataset.revision}"]`)?.focus()}),n.ui.closeOverlays(),n.root.classList.add("nova-history-open"),n.root.append(A),k(null),S().then(()=>{f.querySelector(".nova-history-item")?.focus()}),{close:F,element:A}}var sh,ih,s0,c0,ah=O(()=>{"use strict";le();Eo();U();Tt();ll();zo();X();oh();Se();sh={en:{button:"Version history",title:"Version history",current:"Current version",restore:"Restore this version",close:"Close",save:"Save version",saved:"Version saved",highlight:"Highlight changes",onlyHere:"Only in this version",onlyNow:"Only in the current text",loading:"Loading\u2026",failed:"Could not load the version history.",retry:"Try again",empty:"No saved versions yet.",restored:"Restored the version from {date}. Undo with Ctrl+Z.",versions:"Versions"},ru:{button:"\u0418\u0441\u0442\u043E\u0440\u0438\u044F \u0432\u0435\u0440\u0441\u0438\u0439",title:"\u0418\u0441\u0442\u043E\u0440\u0438\u044F \u0432\u0435\u0440\u0441\u0438\u0439",current:"\u0422\u0435\u043A\u0443\u0449\u0430\u044F \u0432\u0435\u0440\u0441\u0438\u044F",restore:"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u044D\u0442\u0443 \u0432\u0435\u0440\u0441\u0438\u044E",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",save:"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0432\u0435\u0440\u0441\u0438\u044E",saved:"\u0412\u0435\u0440\u0441\u0438\u044F \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0430",highlight:"\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F",onlyHere:"\u0422\u043E\u043B\u044C\u043A\u043E \u0432 \u044D\u0442\u043E\u0439 \u0432\u0435\u0440\u0441\u0438\u0438",onlyNow:"\u0422\u043E\u043B\u044C\u043A\u043E \u0432 \u0442\u0435\u043A\u0443\u0449\u0435\u043C \u0442\u0435\u043A\u0441\u0442\u0435",loading:"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430\u2026",failed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0441\u0442\u043E\u0440\u0438\u044E \u0432\u0435\u0440\u0441\u0438\u0439.",retry:"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C",empty:"\u0421\u043E\u0445\u0440\u0430\u043D\u0451\u043D\u043D\u044B\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u043F\u043E\u043A\u0430 \u043D\u0435\u0442.",restored:"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0430 \u0432\u0435\u0440\u0441\u0438\u044F \u043E\u0442 {date}. \u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u2014 Ctrl+Z.",versions:"\u0412\u0435\u0440\u0441\u0438\u0438"}},ih='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l3 2"/></svg>',s0=new ht;c0={name:"revisionhistory",toolbar:"revisionhistory",setup(n){let e=n.options.pluginOptions?.revisionhistory;if(!e?.list||!e.load){console.warn("[nova] revisionhistory: set pluginOptions.revisionhistory.list and .load");return}let t=W(n,sh),r=null,o=()=>{r?.element.isConnected||(r=a0(n,e))};return n.ui.registry.addButton("revisionhistory",{icon:ih,tooltip:t.button,onAction:o}),n.ui.registry.addMenuItem("revisionhistory",{text:t.button,icon:ih,onAction:o}),()=>r?.close()}}});Tr();U();kt();X();Se();var wa='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="5" r="2"/><path d="M12 7v14M5 12H3a9 9 0 0 0 18 0h-2"/></svg>',cm={en:{title:"Anchor",id:"ID",hint:"Letters, digits, \u201C-\u201D, \u201C_\u201D, \u201C.\u201D; must start with a letter. Link to it with #ID.",invalid:"Use letters, digits, \u201C-\u201D, \u201C_\u201D or \u201C.\u201D, starting with a letter",save:"Save"},ru:{title:"\u042F\u043A\u043E\u0440\u044C",id:"\u0418\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440",hint:"\u041B\u0430\u0442\u0438\u043D\u0441\u043A\u0438\u0435 \u0431\u0443\u043A\u0432\u044B, \u0446\u0438\u0444\u0440\u044B, \xAB-\xBB, \xAB_\xBB, \xAB.\xBB; \u043D\u0430\u0447\u0438\u043D\u0430\u0435\u0442\u0441\u044F \u0441 \u0431\u0443\u043A\u0432\u044B. \u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u044F\u043A\u043E\u0440\u044C \u2014 #\u0438\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440.",invalid:"\u0422\u043E\u043B\u044C\u043A\u043E \u043B\u0430\u0442\u0438\u043D\u0441\u043A\u0438\u0435 \u0431\u0443\u043A\u0432\u044B, \u0446\u0438\u0444\u0440\u044B, \xAB-\xBB, \xAB_\xBB \u0438\u043B\u0438 \xAB.\xBB, \u043F\u0435\u0440\u0432\u0430\u044F \u2014 \u0431\u0443\u043A\u0432\u0430",save:"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C"}},Kr=/^[A-Za-z][\w.-]{0,63}$/,xa={name:"anchor",toolbar:"anchor",nodes:{anchor:{group:"inline",inline:!0,atom:!0,selectable:!0,attrs:{id:{}},parseDOM:[{tag:"a[id]:not([href])",getAttrs:n=>{let e=n.getAttribute("id")??"";return Kr.test(e)?{id:e}:!1}},{tag:"a[name]:not([href])",getAttrs:n=>{let e=n.getAttribute("name")??"";return Kr.test(e)?{id:e}:!1}}],toDOM:n=>["a",{id:Kr.test(n.attrs.id)?n.attrs.id:null}]}},setup(n){let e=W(n,cm),t=()=>{let{selection:o}=n.view.state;return o instanceof R&&o.node.type.name==="anchor"?o:null},r=()=>{let o=t(),i=ae({label:e.id,hint:e.hint,value:o?.node.attrs.id??""});n.ui.openDialog({title:e.title,body:v("div",{className:"nova-form"},i.el),submitLabel:e.save,onSubmit:()=>{let s=i.input.value.trim();if(!Kr.test(s))return e.invalid;let{state:l,dispatch:a}=n.view,c=n.schema.nodes.anchor,u=t();return a(u?l.tr.setNodeMarkup(u.from,void 0,{id:s}):l.tr.replaceSelectionWith(c.create({id:s}),!1).scrollIntoView()),!0}})};n.ui.registry.addToggleButton("anchor",{icon:wa,tooltip:e.title,isActive:()=>t()!==null,isEnabled:o=>o.isEditable(),onAction:r}),n.ui.registry.addMenuItem("anchor",{text:e.title,icon:wa,onAction:r})}};U();Tt();at();_c();Se();var Vg={en:{list:"People",empty:"No matches"},ru:{list:"\u041B\u044E\u0434\u0438",empty:"\u041D\u0438\u043A\u043E\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E"}},Yi=/^[\w.@:+-]{1,128}$/,qg=80,co=n=>n.replace(/^@/,"").trim().slice(0,qg);async function Qi(n,e,t=8){let r=await n(e);return Array.isArray(r)?r.filter(o=>o&&typeof o.id=="string"&&Yi.test(o.id)&&o.name).slice(0,t).map(o=>({id:o.id,name:co(String(o.name)),...o.description?{description:String(o.description).slice(0,120)}:{}})):[]}var Vc={name:"mentions",nodes:{mention:{group:"inline",inline:!0,atom:!0,selectable:!1,attrs:{id:{},name:{default:""}},parseDOM:[{tag:"span[data-mention]",getAttrs:n=>{let e=n,t=e.getAttribute("data-mention")??"";return Yi.test(t)?{id:t,name:co(e.textContent??"")}:!1}}],toDOM:n=>["span",{"data-mention":Yi.test(n.attrs.id)?n.attrs.id:null},`@${co(String(n.attrs.name))}`],leafText:n=>`@${co(String(n.attrs.name))}`}},setup(n){let e=n.options.pluginOptions?.mentions;if(!e?.fetch){console.warn("[nova] mentions: set pluginOptions.mentions.fetch to search people");return}let t=W(n,Vg),r=e.maxResults??8,o=new Map;n.ui.registry.addAutocompleter("mentions",{trigger:"@",label:t.list,emptyText:t.empty,maxResults:r,fetch:async i=>{let s=await Qi(e.fetch,i,r);return o=new Map(s.map(l=>[l.id,l])),s.map(l=>({value:l.id,label:l.name,...l.description?{detail:l.description}:{}}))},onSelect:(i,s,l)=>{let a=o.get(i.value)??{id:i.value,name:i.label},{state:c,dispatch:u}=l.view,d=l.schema.nodes.mention.create({id:a.id,name:a.name});u(c.tr.replaceWith(s.from,s.to,[d,c.schema.text(" ")]).scrollIntoView()),e.onMention?.(a,l)}})}};Se();var Jg={en:{add:"Add comment",show:"Comments",panel:"Comments",guest:"Guest",newComment:"New comment",placeholder:"Add a comment\u2026",replyPlaceholder:"Reply\u2026",comment:"Comment",reply:"Reply",cancel:"Cancel",save:"Save",edit:"Edit",remove:"Delete",resolve:"Resolve",reopen:"Reopen",deleteThread:"Delete thread",close:"Close comments",showResolved:"Show resolved",resolvedBy:"Resolved by {name}",orphan:"The commented text was deleted",empty:"No comments yet. Select text and press \u201CAdd comment\u201D ({shortcut}).",people:"People",noPeople:"No matches",edited:"edited",you:"you",count:"{count} comments"},ru:{add:"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439",show:"\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438",panel:"\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438",guest:"\u0413\u043E\u0441\u0442\u044C",newComment:"\u041D\u043E\u0432\u044B\u0439 \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439",placeholder:"\u041D\u0430\u043F\u0438\u0448\u0438\u0442\u0435 \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439\u2026",replyPlaceholder:"\u041E\u0442\u0432\u0435\u0442\u0438\u0442\u044C\u2026",comment:"\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C",reply:"\u041E\u0442\u0432\u0435\u0442\u0438\u0442\u044C",cancel:"\u041E\u0442\u043C\u0435\u043D\u0430",save:"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C",edit:"\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C",remove:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C",resolve:"\u0420\u0435\u0448\u0435\u043D\u043E",reopen:"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0441\u043D\u043E\u0432\u0430",deleteThread:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043E\u0431\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u0435",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438",showResolved:"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0440\u0435\u0448\u0451\u043D\u043D\u044B\u0435",resolvedBy:"\u0420\u0435\u0448\u0435\u043D\u043E: {name}",orphan:"\u041F\u0440\u043E\u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442 \u0443\u0434\u0430\u043B\u0451\u043D",empty:"\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0435\u0432 \u043F\u043E\u043A\u0430 \u043D\u0435\u0442. \u0412\u044B\u0434\u0435\u043B\u0438\u0442\u0435 \u0442\u0435\u043A\u0441\u0442 \u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \xAB\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439\xBB ({shortcut}).",people:"\u041B\u044E\u0434\u0438",noPeople:"\u041D\u0438\u043A\u043E\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",edited:"\u0438\u0437\u043C\u0435\u043D\u0435\u043D\u043E",you:"\u0432\u044B",count:"\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0435\u0432: {count}"}},jc='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z"/><path d="M12 8v8M8 12h8"/></svg>',Kc='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z"/><path d="M8.5 10h7M8.5 14h4"/></svg>',uo="Mod-Alt-m",ct=new j("nova-comments"),ts=new WeakMap;function es(n){return ts.get(n)}function Jc(n){let e=new Map;return n.descendants((t,r)=>{if(t.isInline)for(let o of t.marks){if(o.type.name!=="comment")continue;let i=o.attrs.id,s=e.get(i)??[],l=s[s.length-1];l&&l.to===r?l.to=r+t.nodeSize:s.push({from:r,to:r+t.nodeSize}),e.set(i,s)}}),e}function Gg(n){let{$from:e,empty:t}=n.selection;return(t?[...e.nodeBefore?.marks??[],...e.nodeAfter?.marks??[]]:e.nodeAfter?.marks??[]).filter(o=>o.type.name==="comment").map(o=>o.attrs.id)}var Gc={name:"comments",toolbar:"addcomment showcomments",marks:{comment:{attrs:{id:{}},inclusive:!1,excludes:"",parseDOM:[{tag:"span[data-comment]",getAttrs:n=>{let e=n.getAttribute("data-comment")??"";return cr.test(e)?{id:e}:!1}}],toDOM:n=>["span",{"data-comment":cr.test(n.attrs.id)?n.attrs.id:null},0]}},prosemirrorPlugins:n=>{let e=null;return[He({[uo]:()=>es(n)?.startComment()??!1}),new _({key:ct,state:{init:()=>({pending:null,active:null}),apply(t,r){let o=t.getMeta(ct),i=r;if(t.docChanged&&i.pending){let s=t.mapping.map(i.pending.from,1),l=t.mapping.map(i.pending.to,-1);i={...i,pending:s<l?{from:s,to:l}:null}}return o&&("pending"in o||"active"in o)&&(i={...i,...o}),i}},props:{decorations(t){let r=es(n),o=ct.getState(t),i=r?.store.threads();if(e&&e.doc===t.doc&&e.threads===i&&e.state===o)return e.set;let s=new Set((i??[]).filter(c=>!c.resolved).map(c=>c.id)),l=[];for(let[c,u]of Jc(t.doc)){if(!s.has(c))continue;let d=c===o.active?"nova-comment is-active":"nova-comment";for(let{from:f,to:p}of u)l.push(ee.inline(f,p,{class:d}))}if(o.pending){let{from:c,to:u}=o.pending;l.push(ee.inline(c,u,{class:"nova-comment is-active is-pending"}))}let a=K.create(t.doc,l);return e={doc:t.doc,threads:i,state:o,set:a},a}},view:()=>({update(t,r){if(r.selection.eq(t.state.selection)||r.doc!==t.state.doc)return;let o=es(n);if(!o||ct.getState(t.state).pending)return;let i=new Set(o.store.threads().filter(l=>!l.resolved).map(l=>l.id)),s=Gg(t.state).find(l=>i.has(l));s&&(s!==o.active()||!o.isPanelOpen())&&queueMicrotask(()=>{o.setActive(s),o.openPanel()})}})})]},setup(n){let e=W(n,Jg),t=n.options.pluginOptions?.comments??{},r=t.store??$c(t.threads??[],t.onChange),o={id:String(t.author?.id??"guest").slice(0,128),name:String(t.author?.name||e.guest).slice(0,80)},i=()=>n.schema.marks.comment,s=t.mentions??n.options.pluginOptions?.mentions?.fetch,l=(C,T=[])=>[...new Map(T.map(k=>[k.id,k])).values()].filter(k=>C.includes(`@${k.name}`)),a=(C,T)=>{let w=l(C,T);return{id:Xi(),author:o,text:C,createdAt:Date.now(),...w.length?{mentions:w}:{}}},c=(C,T)=>{T.mentions?.length&&t.onMention?.({threadId:C,comment:T,users:T.mentions})},u=()=>ct.getState(n.view.state),d=C=>n.view.dispatch(n.view.state.tr.setMeta(ct,C)),f=null,p=!1,h=null,m=n.view.dom.parentElement,b=document.createElement("div");b.className="nova-body",m.parentElement.insertBefore(b,m),b.append(m);let g={editor:n,store:r,author:o,labels:e,shortcut:uo,pending:()=>u().pending,active:()=>u().active,setActive(C,T=!1){u().active!==C&&d({active:C}),f?.render();let w=C?g.ranges(C)[0]:void 0;if(T&&w){let{node:k}=n.view.domAtPos(w.from);(k instanceof Element?k:k.parentElement)?.scrollIntoView({block:"nearest"})}},startComment(){let{selection:C}=n.view.state;return C.empty||!n.isEditable()?!1:(d({pending:{from:C.from,to:C.to},active:null}),g.openPanel().then(()=>{f?.render(),f?.focusComposer()}),!0)},cancelPending(){d({pending:null}),f?.render(),n.focus()},findUsers:s?C=>Qi(s,C):null,submitPending(C,T){let w=u().pending,k=C.trim().slice(0,5e3);if(!w||!k)return null;let S=Xi("t"),F=a(k,T);r.createThread({id:S,createdAt:F.createdAt,comments:[F],resolved:null});let{state:H}=n.view;return n.view.dispatch(H.tr.addMark(w.from,w.to,i().create({id:S})).setMeta(ct,{pending:null,active:S}).setMeta("addToHistory",!1)),f?.render(),c(S,F),S},reply(C,T,w){let k=T.trim().slice(0,5e3);if(!k)return;let S=a(k,w);r.reply(C,S),c(C,S)},ranges:C=>Jc(n.view.state.doc).get(C)??[],quote(C){let{doc:T}=n.view.state;return g.ranges(C).map(({from:w,to:k})=>T.textBetween(w,k," ")).join(" \u2026 ")},positionOf:C=>g.ranges(C)[0]?.from??Number.MAX_SAFE_INTEGER,deleteThread(C){let{state:T}=n.view,w=T.tr;for(let{from:k,to:S}of g.ranges(C))w.removeMark(k,S,i().create({id:C}));u().active===C&&w.setMeta(ct,{active:null}),(w.docChanged||w.getMeta(ct))&&n.view.dispatch(w.setMeta("addToHistory",!1)),r.deleteThread(C)},setResolved(C,T){r.setResolved(C,T?{by:o,at:Date.now()}:null),T&&u().active===C&&d({active:null})},canEdit:C=>t.canEdit?t.canEdit(C,o):C.author.id===o.id,isPanelOpen:()=>p,async openPanel(){f||(h??=Promise.resolve().then(()=>(Uc(),Wc)).then(({createCommentsPanel:C})=>{n.view.isDestroyed||(f=C(g),b.append(f.el))}),await h),!(!f||p)&&(n.ui.closeOverlays(),p=!0,f.el.hidden=!1,n.root.classList.add("nova-comments-open"),f.render(),n.updateUI())},closePanel(){!f||!p||(p=!1,f.el.hidden=!0,n.root.classList.remove("nova-comments-open"),u().pending&&d({pending:null}),n.updateUI(),n.focus())}};ts.set(n,g);let y=r.subscribe(()=>{n.view.isDestroyed||(d({refresh:!0}),f?.render())}),x=()=>g.startComment(),A=()=>g.isPanelOpen()?g.closePanel():void g.openPanel(),L=C=>C.isEditable()&&!C.view.state.selection.empty;return n.ui.registry.addButton("addcomment",{icon:jc,tooltip:e.add,shortcut:uo,isEnabled:L,onAction:x}),n.ui.registry.addToggleButton("showcomments",{icon:Kc,tooltip:e.show,isActive:()=>p,onAction:A}),n.ui.registry.addMenuItem("addcomment",{text:e.add,icon:jc,shortcut:uo,isEnabled:L,onAction:x}),n.ui.registry.addMenuItem("showcomments",{text:e.show,icon:Kc,isActive:()=>p,onAction:A}),()=>{y(),f?.destroy(),ts.delete(n)}}};le();U();Je();Tt();at();Se();var Xc=/^[A-Za-z0-9_-]{1,64}$/,ls=/^[\w.@:+-]{1,128}$/,ns={en:{toggle:"Suggest edits",review:"Review suggestions",accept:"Accept",reject:"Reject",acceptAll:"Accept all suggestions",rejectAll:"Reject all suggestions",next:"Next suggestion",previous:"Previous suggestion",inserted:"Inserted by {name}",deleted:"Deleted by {name}",toolbar:"Suggestion",guest:"Guest",none:"No suggestions"},ru:{toggle:"\u041F\u0440\u0435\u0434\u043B\u0430\u0433\u0430\u0442\u044C \u043F\u0440\u0430\u0432\u043A\u0438",review:"\u041F\u0440\u0430\u0432\u043A\u0438",accept:"\u041F\u0440\u0438\u043D\u044F\u0442\u044C",reject:"\u041E\u0442\u043A\u043B\u043E\u043D\u0438\u0442\u044C",acceptAll:"\u041F\u0440\u0438\u043D\u044F\u0442\u044C \u0432\u0441\u0435 \u043F\u0440\u0430\u0432\u043A\u0438",rejectAll:"\u041E\u0442\u043A\u043B\u043E\u043D\u0438\u0442\u044C \u0432\u0441\u0435 \u043F\u0440\u0430\u0432\u043A\u0438",next:"\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F \u043F\u0440\u0430\u0432\u043A\u0430",previous:"\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0430\u044F \u043F\u0440\u0430\u0432\u043A\u0430",inserted:"\u0412\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u043E: {name}",deleted:"\u0423\u0434\u0430\u043B\u0435\u043D\u043E: {name}",toolbar:"\u041F\u0440\u0430\u0432\u043A\u0430",guest:"\u0413\u043E\u0441\u0442\u044C",none:"\u041F\u0440\u0430\u0432\u043E\u043A \u043D\u0435\u0442"}},Yc='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z"/></svg>',Xg='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 11l3 3 8-8"/><path d="M20 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"/></svg>',Yg='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12l5 5 9-10"/></svg>',Qg='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',ur=new j("nova-suggestions"),as="nova-suggestions-own",Qc=["#1a7f37","#8250df","#bf3989","#0969da","#bc4c00","#1b7c83"];function Zg(n){let e=0;for(let t of n)e=e*31+t.charCodeAt(0)|0;return Qc[Math.abs(e)%Qc.length]}function Zc(){let n=new Uint8Array(9);return globalThis.crypto.getRandomValues(n),"s"+Array.from(n,e=>(e%36).toString(36)).join("")}function eu(n){let e=n==="insert"?"ins":"del";return{attrs:{id:{},author:{default:""},name:{default:""},time:{default:0}},inclusive:!1,excludes:"",parseDOM:[{tag:`${e}[data-suggestion]`,priority:60,getAttrs:t=>{let r=t,o=r.getAttribute("data-suggestion")??"";if(!Xc.test(o))return!1;let i=r.getAttribute("data-author")??"";return{id:o,author:ls.test(i)?i:"",name:(r.getAttribute("data-name")??"").slice(0,80),time:Number(r.getAttribute("data-time"))||0}}}],toDOM:t=>[e,{"data-suggestion":Xc.test(t.attrs.id)?t.attrs.id:null,"data-author":ls.test(t.attrs.author)?t.attrs.author:null,"data-name":String(t.attrs.name??"").slice(0,80)||null,"data-time":Number(t.attrs.time)||null},0]}}var cs=n=>({insert:n.marks.suggestion_insert,delete:n.marks.suggestion_delete});function eb(n){return!n.docChanged||n.getMeta(as)||n.getMeta("addToHistory")===!1||n.getMeta("history$")||n.getMeta("y-sync$")?.isChangeOrigin?!1:n.steps.every(t=>t instanceof be)}function rs(n,e,t,r){let o=n.resolve(e);for(let i of[o.nodeBefore,o.nodeAfter]){let s=i?.marks.find(l=>l.type===t&&l.attrs.author===r);if(s)return s}return null}function nu(n,e,t){let r=[];return n.forEach(o=>{o.isInline?r.push(t&&!t.allowsMarkType(e.type)?o:o.mark(e.addToSet(o.marks))):r.push(o.copy(nu(o.content,e,o.type)))}),E.from(r)}function tb(n,e,t){if(!eb(n))return n;let r=cs(e.schema),o=e.tr,i=Date.now(),s=c=>c,l=null,a=null;if(n.steps.forEach(c=>{let u=c,d=o.steps.length,f=s,p=f(u.from),h=Math.max(p,f(u.to));if(h>p){let g=[],y=[];if(o.doc.nodesBetween(p,h,(L,C)=>{if(!L.isInline)return!0;let T=Math.max(C,p),w=Math.min(C+L.nodeSize,h);return T>=w||(L.marks.some(S=>S.type===r.insert&&S.attrs.author===t.id)?g.push({from:T,to:w}):r.delete.isInSet(L.marks)||y.push({from:T,to:w})),!1}),y.length){let L=y[0],C=rs(o.doc,L.from,r.delete,t.id)??rs(o.doc,y[y.length-1].to,r.delete,t.id)??r.delete.create({id:Zc(),author:t.id,name:t.name,time:i});for(let T of y)o.addMark(T.from,T.to,C)}for(let L of g.reverse())o.delete(L.from,L.to);let x=o.mapping.slice(d);p=x.map(p,1),h=x.map(h,-1);let A=e.selection;n.steps.length===1&&u.slice.size===0&&A.empty&&A.from===u.from&&n.selection.head===u.from&&(l=h)}if(u.slice.size>0){let g=h;if(!u.slice.openStart)for(let L=o.doc.resolve(g).nodeAfter;L&&r.delete.isInSet(L.marks);)g+=L.nodeSize,L=o.doc.resolve(g).nodeAfter;let y=rs(o.doc,g,r.insert,t.id)??r.insert.create({id:Zc(),author:t.id,name:t.name,time:i}),x=o.doc.resolve(g),A=nu(u.slice.content,y,u.slice.openStart?null:x.parent.type);o.replace(g,g,new N(A,u.slice.openStart,u.slice.openEnd)),n.steps.length===1&&(a=g+u.slice.size)}let m=u.getMap().invert(),b=o.mapping.slice(d);s=g=>b.map(f(m.map(g,-1)),1)}),l!==null)o.setSelection(P.create(o.doc,l));else if(a!==null&&n.selection.empty)o.setSelection(P.create(o.doc,a));else{let c=s(n.selection.anchor),u=s(n.selection.head);try{o.setSelection(P.create(o.doc,c,u))}catch{}}for(let c of["addToHistory","uiEvent","paste","scrollIntoView"]){let u=n.getMeta(c);u!==void 0&&o.setMeta(c,u)}return n.scrolledIntoView&&o.scrollIntoView(),o}function dr(n){let e=cs(n.type.schema),t=[];return n.descendants((r,o)=>{if(!r.isInline)return!0;for(let i of r.marks){let s=i.type===e.insert?"insert":i.type===e.delete?"delete":null;if(!s)continue;let l=t[t.length-1],a=r.isText?r.text:"";l&&l.id===i.attrs.id&&l.kind===s&&l.to===o?(l.to=o+r.nodeSize,l.text+=a):t.push({id:i.attrs.id,kind:s,author:{id:i.attrs.author,name:i.attrs.name},time:Number(i.attrs.time)||0,from:o,to:o+r.nodeSize,text:a})}return!1}),t}function is(n,e,t){let r=cs(n.schema),o=n.tr.setMeta(as,!0),i=dr(n.doc).filter(s=>!t||t.includes(s.id));for(let s of[...i].sort((l,a)=>a.from-l.from))s.kind==="insert"==(e==="reject")?o.delete(s.from,s.to):o.removeMark(s.from,s.to,s.kind==="insert"?r.insert:r.delete);return o}function tu(n){let{from:e}=n.selection;return dr(n.doc).find(t=>e>=t.from&&e<=t.to&&(t.to>e||t.from<e))??null}function Sn(n){return ur.getState(n)?.enabled??!1}function ss(n,e){let{state:t,dispatch:r}=n.view;r(t.tr.setMeta(ur,{enabled:e}).setMeta(as,!0)),n.updateUI()}var ru={name:"suggestions",toolbar:"suggestions reviewsuggestions",marks:{suggestion_insert:eu("insert"),suggestion_delete:eu("delete")},prosemirrorPlugins:n=>{let e=n.options.pluginOptions?.suggestions??{},t=null;return[new _({key:ur,state:{init:()=>({enabled:!!(e.enabled||e.force)}),apply(r,o){let i=r.getMeta(ur);return i?{enabled:e.force?!0:i.enabled}:o}},props:{attributes:r=>ur.getState(r)?.enabled?{class:"nova-suggesting"}:{},decorations(r){if(t?.doc===r.doc)return t.set;let o=W(n,ns),i=new Intl.DateTimeFormat(n.options.language??"en",{dateStyle:"medium",timeStyle:"short"}),s=K.create(r.doc,dr(r.doc).map(l=>ee.inline(l.from,l.to,{title:(l.kind==="insert"?o.inserted:o.deleted).replace("{name}",l.author.name||o.guest)+(l.time?` \xB7 ${i.format(l.time)}`:""),class:l.kind==="insert"?"nova-sugg-insert":"nova-sugg-delete",style:`--nova-suggestion: ${Zg(l.author.id||l.author.name)}`})));return t={doc:r.doc,set:s},s}}}),He({"Mod-Alt-Shift-e":()=>e.force?!1:(ss(n,!Sn(n.view.state)),!0)})]},transformTransaction(n,e,t){if(!Sn(e))return n;let r=t.options.pluginOptions?.suggestions??{},o=W(t,ns),i={id:ls.test(r.author?.id??"")?r.author.id:"guest",name:String(r.author?.name||o.guest).slice(0,80)};return tb(n,e,i)},setup(n){let e=n.options.pluginOptions?.suggestions??{},t=W(n,ns),r=e.canReview!==!1,o=c=>n.view.dispatch(c),i=()=>tu(n.view.state),s=c=>{let u=i();u&&o(is(n.view.state,c,[u.id])),n.focus()},l=c=>{let{state:u}=n.view,d=dr(u.doc),f=u.selection.from,p=c===1?d.find(h=>h.from>f)??d[0]:[...d].reverse().find(h=>h.to<f)??d[d.length-1];if(!p){n.ui.notify(t.none);return}o(u.tr.setSelection(P.create(u.doc,p.from)).scrollIntoView()),n.focus()},a=()=>dr(n.view.state.doc).length>0;n.ui.registry.addToggleButton("suggestions",{icon:Yc,tooltip:t.toggle,shortcut:"Mod-Alt-Shift-e",isActive:c=>Sn(c.view.state),isEnabled:()=>!e.force,onAction:c=>ss(c,!Sn(c.view.state))}),n.ui.registry.addMenuButton("reviewsuggestions",{icon:Xg,tooltip:t.review,isEnabled:a,items:()=>[{id:"next",label:t.next,onSelect:()=>l(1)},{id:"previous",label:t.previous,onSelect:()=>l(-1)},...r?[{type:"separator"},{id:"accept-all",label:t.acceptAll,onSelect:()=>o(is(n.view.state,"accept"))},{id:"reject-all",label:t.rejectAll,onSelect:()=>o(is(n.view.state,"reject"))}]:[]]}),r&&(n.ui.registry.addButton("acceptsuggestion",{icon:Yg,text:t.accept,tooltip:t.accept,onAction:()=>s("accept")}),n.ui.registry.addButton("rejectsuggestion",{icon:Qg,text:t.reject,tooltip:t.reject,onAction:()=>s("reject")}),n.ui.registry.addContextToolbar("suggestion",{label:t.toolbar,predicate:c=>tu(c.view.state)!==null,items:"acceptsuggestion rejectsuggestion",position:"selection",placement:"bottom-start",priority:20})),n.ui.registry.addMenuItem("suggestions",{text:t.toggle,icon:Yc,isActive:c=>Sn(c.view.state),isEnabled:()=>!e.force,onAction:c=>ss(c,!Sn(c.view.state))})}};U();ft();kt();X();Se();var iy=/^https?:\/\/(?:www\.|m\.)?(?:youtube(?:-nocookie)?\.com\/(?:watch\?(?:[^#]*&)?v=|embed\/|shorts\/|live\/)|youtu\.be\/)([\w-]{11})(?:[?&#]|$)/i,sy=/^https?:\/\/(?:www\.|player\.)?vimeo\.com\/(?:video\/)?(\d{1,12})(?:[/?#]|$)/i,ly=/^https:\/\/[^\s"'<>]+\.(?:mp4|webm|ogv|ogg)(?:\?[^\s"'<>#]*)?$/i;function ko(n){let e=n.trim(),t=e.match(iy);if(t)return{kind:"youtube",src:`https://www.youtube-nocookie.com/embed/${t[1]}`};let r=e.match(sy);return r?{kind:"vimeo",src:`https://player.vimeo.com/video/${r[1]}`}:ly.test(e)?{kind:"video",src:e}:null}var qu='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="5" width="20" height="14" rx="2"/><path d="m10 9 5 3-5 3z"/></svg>',ay={en:{title:"Video",url:"Video URL",hint:"YouTube, Vimeo or a link to an .mp4 / .webm file",name:"Title (for screen readers)",invalid:"This video address is not supported",save:"Insert"},ru:{title:"\u0412\u0438\u0434\u0435\u043E",url:"\u0410\u0434\u0440\u0435\u0441 \u0432\u0438\u0434\u0435\u043E",hint:"YouTube, Vimeo \u0438\u043B\u0438 \u0441\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u0444\u0430\u0439\u043B .mp4 / .webm",name:"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 (\u0434\u043B\u044F \u044D\u043A\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0434\u0438\u043A\u0442\u043E\u0440\u0430)",invalid:"\u042D\u0442\u043E\u0442 \u0430\u0434\u0440\u0435\u0441 \u0432\u0438\u0434\u0435\u043E \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F",save:"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C"}};function Wu(n,e){let t=e?ko(e):null;return t?{...t,width:Re(n.getAttribute("width"))??560,height:Re(n.getAttribute("height"))??315,title:n.getAttribute("title")??""}:!1}function cy(n){let e=ko(n.attrs.src);if(!e)return null;let t=String(Re(n.attrs.width)??560),r=String(Re(n.attrs.height)??315);return e.kind==="video"?v("video",{src:e.src,controls:!0,width:t,height:r,preload:"metadata"}):v("iframe",{src:e.src,width:t,height:r,title:n.attrs.title||"Video",allow:"accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen",allowfullscreen:!0,loading:"lazy",referrerpolicy:"strict-origin-when-cross-origin"})}var Uu={name:"media",toolbar:"media",nodes:{media:{group:"block",atom:!0,selectable:!0,draggable:!0,attrs:{kind:{default:"youtube"},src:{},width:{default:560},height:{default:315},title:{default:""}},parseDOM:[{tag:"iframe[src]",getAttrs:n=>Wu(n,n.getAttribute("src"))},{tag:"video",getAttrs:n=>{let e=n,t=e.getAttribute("src")??e.querySelector("source[src]")?.getAttribute("src")??null;return Wu(e,t)}}],toDOM:n=>{let e=ko(n.attrs.src),t=String(Re(n.attrs.width)??560),r=String(Re(n.attrs.height)??315);return e?e.kind==="video"?["video",{src:e.src,controls:"",width:t,height:r}]:["iframe",{src:e.src,width:t,height:r,title:n.attrs.title||null,allow:"accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen",allowfullscreen:"",loading:"lazy",referrerpolicy:"strict-origin-when-cross-origin"}]:["p"]}}},prosemirrorPlugins:()=>[new _({props:{nodeViews:{media:n=>{let e=cy(n);return{dom:v("div",{className:"nova-media",contenteditable:"false"},e,v("div",{className:"nova-media-overlay","aria-hidden":"true"})),ignoreMutation:()=>!0,stopEvent:()=>!1}}}}})],setup(n){let e=W(n,ay),t=()=>{let{selection:o}=n.view.state;return o instanceof R&&o.node.type.name==="media"?o:null},r=()=>{let o=t(),i=ae({label:e.url,type:"url",placeholder:"https://",hint:e.hint,value:o?.node.attrs.src??""}),s=ae({label:e.name,value:o?.node.attrs.title??""});n.ui.openDialog({title:e.title,body:v("div",{className:"nova-form"},i.el,s.el),submitLabel:e.save,onSubmit:()=>{let l=ko(i.input.value);if(!l)return e.invalid;let{state:a,dispatch:c}=n.view,u={...l,title:s.input.value.trim()},d=t();return c(d?a.tr.setNodeMarkup(d.from,void 0,{...d.node.attrs,...u}):a.tr.replaceSelectionWith(n.schema.nodes.media.create(u)).scrollIntoView()),!0}})};n.ui.registry.addToggleButton("media",{icon:qu,tooltip:e.title,isActive:()=>t()!==null,isEnabled:o=>o.isEditable(),onAction:r}),n.ui.registry.addMenuItem("media",{text:e.title,icon:qu,onAction:r})}};Se();var ju='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 3v5h12V3M6 21v-5h12v5"/><path d="M3 12h2M9 12h2M15 12h2M21 12h-0"/></svg>',uy={en:{title:"Page break"},ru:{title:"\u0420\u0430\u0437\u0440\u044B\u0432 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B"}},Ku={name:"pagebreak",toolbar:"pagebreak",nodes:{pagebreak:{group:"block",atom:!0,selectable:!0,parseDOM:[{tag:"div.nova-pagebreak"},{tag:"div",getAttrs:n=>{let e=n;return(e.style.breakAfter==="page"||e.style.pageBreakAfter==="always")&&!e.textContent?.trim()?null:!1}}],toDOM:()=>["div",{class:"nova-pagebreak",style:"break-after: page;"}]}},setup(n){let{title:e}=W(n,uy),t=()=>{let{state:r,dispatch:o}=n.view,i=n.schema.nodes.pagebreak;o(r.tr.replaceSelectionWith(i.create()).scrollIntoView()),n.focus()};n.ui.registry.addButton("pagebreak",{icon:ju,tooltip:e,isEnabled:r=>r.isEditable(),onAction:t}),n.ui.registry.addMenuItem("pagebreak",{text:e,icon:ju,onAction:t})}};se("insertdatetime",()=>Promise.resolve().then(()=>(Qu(),Yu)));se("quickbars",()=>Promise.resolve().then(()=>(Kd(),jd)));se("charmap",()=>Promise.resolve().then(()=>(Xd(),Gd)));se("emoticons",()=>Promise.resolve().then(()=>(ef(),Zd)));se("nonbreaking",()=>Promise.resolve().then(()=>(of(),rf)));se("autolink",()=>Promise.resolve().then(()=>(ff(),df)));se("autosave",()=>Promise.resolve().then(()=>(mf(),hf)));se("autoresize",()=>Promise.resolve().then(()=>(bf(),gf)));se("visualblocks",()=>Promise.resolve().then(()=>(wf(),vf)));se("anchor",xa);se("pagebreak",Ku);se("media",Uu);se("comments",Gc);se("mentions",Vc);se("suggestions",ru);se("directionality",()=>Promise.resolve().then(()=>(Sf(),Mf)));se("advlist",()=>Promise.resolve().then(()=>(Ef(),Cf)));se("revisionhistory",()=>Promise.resolve().then(()=>(ah(),lh)));ll();Ks();Tr();Me();zo();le();U();var u0=new ht,d0=new Set(["P","H1","H2","H3","H4","H5","H6","UL","OL","TABLE","BLOCKQUOTE","PRE","HR","DIV","FIGURE"]),Go={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike",superscript:"superscript",subscript:"subscript",justifyleft:"alignLeft",justifycenter:"alignCenter",justifyright:"alignRight",justifyfull:"alignJustify",insertunorderedlist:"bulletList",insertorderedlist:"orderedList",indent:"indent",outdent:"outdent",undo:"undo",redo:"redo",removeformat:"clearFormatting",unlink:"unlink",inserthorizontalrule:"horizontalRule",mceblockquote:"blockquote"},f0={p:"paragraph",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",blockquote:"blockquote",pre:"codeBlock"},p0={bold:"bold",italic:"italic",underline:"underline","strike-through":"strike",link:"link",unlink:"unlink",image:"image",table:"table",undo:"undo",redo:"redo","align-left":"alignLeft","align-center":"alignCenter","align-right":"alignRight","align-justify":"alignJustify","unordered-list":"bulletList","ordered-list":"orderedList",indent:"indent",outdent:"outdent",quote:"blockquote","code-sample":"codeBlock","horizontal-rule":"horizontalRule","remove-formatting":"clearFormatting",fullscreen:"fullscreen",preview:"preview",sourcecode:"sourceCode",help:"help",print:"print",search:"search",copy:"copy","edit-block":"edit",checkmark:"check",close:"close",upload:"upload",subscript:"subscript",superscript:"superscript","paste-text":"pasteText","text-color":"textColor","highlight-bg-color":"highlight","line-height":"lineHeight"},Xo=new Map;function al(n){if(typeof n!="string"||!n)return;if(Xo.has(n))return Xo.get(n);let e=p0[n]??(n in M?n:void 0);return e?M[e]:void 0}function h0(n){let e=!1,t=!0;return{state:{get active(){return e},get enabled(){return t}},api:{isActive:()=>e,setActive:r=>{e=r,n.core.updateUI()},isEnabled:()=>t,setEnabled:r=>{t=r,n.core.updateUI()},isDisabled:()=>!t,setDisabled:r=>{t=!r,n.core.updateUI()}}}}var Er=class{id;core;targetElm;settings;initialized=!1;removed=!1;handlers=new Map;dirty=!1;teardowns=[];constructor(e,t,r,o){this.core=e,this.targetElm=t,this.id=r,this.settings=o}getContent(e={}){let t={format:e.format??"html",content:""};return t.content=t.format==="text"?this.core.getText():this.core.getHTML(),this.fire("GetContent",t),t.content}setContent(e,t={}){let r={content:e,...t};return this.fire("BeforeSetContent",r),this.core.setContent(r.content),this.fire("SetContent",r),r.content}insertContent(e){let t=document.createElement("template");t.innerHTML=e;let r=document.createElement("div");r.append(t.content);let o=rn(this.core.schema),s=[...r.children].some(c=>d0.has(c.tagName))?new N(o.parse(r).content,0,0):o.parseSlice(r),{state:l,dispatch:a}=this.core.view;a(l.tr.replaceSelection(s).scrollIntoView())}resetContent(e){this.core.setContent(e??this.settings.__initialContent??"",{addToHistory:!1}),this.setDirty(!1)}getBody(){return this.core.view.dom}getElement(){return this.targetElm}getContainer(){return this.core.root}getContentAreaContainer(){return this.core.view.dom.parentElement??this.core.root}getDoc(){return this.core.root.ownerDocument}getWin(){return this.core.root.ownerDocument.defaultView}execCommand(e,t,r){let o=e.toLowerCase(),i=!1;if(Go[o])i=this.core.exec(Go[o]);else if(o==="formatblock"||o==="mcetoggleformat"){let s=f0[String(r??"").toLowerCase()];i=s?this.core.exec(s):!1}else if(o==="mceinsertcontent"||o==="inserthtml")this.insertContent(String(r??"")),i=!0;else if(o==="mcesetcontent")this.setContent(String(r??"")),i=!0;else if(o==="selectall"){let{state:s,dispatch:l}=this.core.view;l(s.tr.setSelection(new pe(s.doc))),i=!0}else if(o==="mcecleanup")i=!0;else{let s=this.commands.get(o);s&&(s(t,r),i=!0)}return i&&this.fire("ExecCommand",{command:e,ui:t,value:r}),i}queryCommandState(e){let t=Go[e.toLowerCase()];return t?this.core.isActive(t):!1}queryCommandSupported(e){let t=e.toLowerCase();return t in Go||["formatblock","mceinsertcontent","mcesetcontent"].includes(t)||this.commands.has(t)}commands=new Map;addCommand(e,t){this.commands.set(e.toLowerCase(),t)}on(e,t,r=!1){for(let o of e.toLowerCase().split(/\s+/).filter(Boolean)){let i=this.handlers.get(o)??new Set;r?this.handlers.set(o,new Set([t,...i])):this.handlers.set(o,i.add(t))}return this}off(e,t){if(!e)return this.handlers.clear(),this;for(let r of e.toLowerCase().split(/\s+/).filter(Boolean))t?this.handlers.get(r)?.delete(t):this.handlers.delete(r);return this}once(e,t){let r=o=>(this.off(e,r),t(o));return this.on(e,r)}fire(e,t={}){let r=Object.assign(t,{type:e.toLowerCase(),target:this});for(let o of[...this.handlers.get(e.toLowerCase())??[]])try{o(r)}catch(i){console.error(`[nova] tinymce-compat: "${e}" handler failed`,i)}return r}fireNative(e,t){for(let r of[...this.handlers.get(e)??[]])try{r(t)}catch(o){console.error(`[nova] tinymce-compat: "${e}" handler failed`,o)}}static registerIcon(e,t){Xo.set(e,t)}dispatch(e,t){return this.fire(e,t)}hasEventListeners(e){return(this.handlers.get(e.toLowerCase())?.size??0)>0}isDirty(){return this.dirty}setDirty(e){let t=this.dirty!==e;this.dirty=e,t&&e&&this.fire("Dirty")}save(){let e=this.getContent(),t=this.fire("SaveContent",{content:e});return this.targetElm instanceof HTMLTextAreaElement&&(this.targetElm.value=String(t.content)),this.setDirty(!1),String(t.content)}focus(){this.core.focus()}hasFocus(){return this.core.view.hasFocus()}hide(){this.core.root.hidden=!0,this.targetElm instanceof HTMLTextAreaElement&&(this.targetElm.hidden=!1)}show(){this.core.root.hidden=!1,this.targetElm instanceof HTMLTextAreaElement&&(this.targetElm.hidden=!0)}isHidden(){return this.core.root.hidden===!0}getParam(e,t){return e in this.settings?this.settings[e]:t}options={get:e=>this.settings[e],set:(e,t)=>(this.settings[e]=t,!0),isSet:e=>e in this.settings,isRegistered:()=>!0,register:()=>{}};mode={get:()=>this.core.isEditable()?"design":"readonly",set:e=>this.core.setEditable(e!=="readonly"),isReadOnly:()=>!this.core.isEditable()};undoManager={undo:()=>this.core.exec("undo"),redo:()=>this.core.exec("redo"),hasUndo:()=>this.core.can("undo"),hasRedo:()=>this.core.can("redo"),add:()=>null,clear:()=>{},transact:e=>(e(),null),ignore:e=>e()};selection={getContent:(e={})=>{let{state:t}=this.core.view,{from:r,to:o}=t.selection;return e.format==="text"?t.doc.textBetween(r,o,`
37
+ `):u0.serializeFragment(t.selection.content().content)},setContent:e=>this.insertContent(e),getNode:()=>{let{from:e}=this.core.view.state.selection,{node:t}=this.core.view.domAtPos(e);return t instanceof Element?t:t.parentElement},getStart:()=>this.selection.getNode(),getEnd:()=>this.selection.getNode(),isCollapsed:()=>this.core.view.state.selection.empty,collapse:(e=!1)=>{let{state:t,dispatch:r}=this.core.view,o=e?t.selection.from:t.selection.to;r(t.tr.setSelection(P.near(t.doc.resolve(o))))}};notificationManager={open:e=>this.core.ui.notify({text:e.text,...e.type?{type:e.type}:{},...e.timeout!==void 0?{timeout:e.timeout}:{}}),close:()=>{}};windowManager={alert:(e,t)=>{let r=document.createElement("p");r.textContent=e,this.core.ui.openDialog({title:"",body:r,onSubmit:()=>!0,...t?{onClose:t}:{}})},confirm:(e,t)=>{let r=document.createElement("p");r.textContent=e;let o=!1;this.core.ui.openDialog({title:"",body:r,submitLabel:"OK",onSubmit:()=>(o=!0,!0),onClose:()=>t?.(o)})},open:()=>(console.warn("[nova] tinymce-compat: windowManager.open is not supported yet \u2014 use editor.ui.openDialog"),{close:()=>{}})};ui={registry:{addIcon:(e,t)=>{Xo.set(e,t)},addButton:(e,t)=>this.addButton(e,t,!1),addToggleButton:(e,t)=>this.addButton(e,t,!0),addMenuButton:(e,t)=>{let r=[];t.fetch(i=>r=i);let o=al(t.icon);this.core.ui.registry.addMenuButton(e,{tooltip:t.tooltip??t.text??e,...o?{icon:o}:{text:t.text??e},items:()=>(t.fetch(i=>r=i),r.map((i,s)=>i.type==="separator"?{type:"separator"}:{id:`${e}-${s}`,label:i.text??"",onSelect:()=>i.onAction?.({})}))})},addMenuItem:(e,t)=>{let r=al(t.icon);this.core.ui.registry.addMenuItem(e,{text:t.text??e,...r?{icon:r}:{},onAction:()=>t.onAction?.({})})},addContextToolbar:()=>{console.warn("[nova] tinymce-compat: addContextToolbar is not supported yet")},getAll:()=>({})}};addButton(e,t,r){let{api:o,state:i}=h0(this);t.enabled===!1&&o.setEnabled(!1),t.active&&o.setActive(!0);let s=al(t.icon);if(this.core.ui.registry.addButton(e,{tooltip:t.tooltip??t.text??e,...s?{icon:s}:{text:t.text??e},isEnabled:()=>i.enabled,...r?{isActive:()=>i.active}:{},onAction:()=>t.onAction?.(o)}),t.onSetup){let l=()=>{let a=t.onSetup(o);typeof a=="function"&&this.teardowns.push(a)};this.initialized?l():this.once("init",l)}}remove(){if(this.removed)return;this.fire("remove"),this.save(),this.teardowns.splice(0).forEach(t=>t()),this.removed=!0,this.core.destroy(),this.core.root.remove(),this.settings.__wrapper?.remove(),this.targetElm.hidden=!1,this.off()}destroy(){this.remove()}};var m0=new Set(["lists","link","image","table","code","codesample","preview","searchreplace","fullscreen","help","wordcount","paste","hr","print","textcolor","colorpicker","contextmenu","tabfocus","textpattern","imagetools","powerpaste","importcss","accordion"]),g0={tinycomments:"comments"},b0=new Set(["selector","target","license_key","api_key","branding","promotion","skin","skin_url","content_css","icons","icons_url","theme","theme_url","base_url","suffix","referrer_policy","convert_urls","relative_urls","remove_script_host","document_base_url","entity_encoding","height","min_height","max_height","width","resize","content_style","setup","init_instance_callback","inline","plugins","toolbar","menubar","statusbar","placeholder","readonly","language","images_upload_handler","paste_as_text","paste_preprocess","paste_postprocess","invalid_elements","valid_elements","valid_styles","toolbar_mode","toolbar_sticky","font_family_formats","font_size_formats","line_height_formats","color_map","autosave_interval","autosave_retention","autosave_prefix","quickbars_selection_toolbar","quickbars_insert_toolbar","mentions_fetch","tinycomments_author","tinycomments_author_name"]),y0=n=>(Array.isArray(n)?n.join(" "):String(n??"")).split(/[\s,]+/).filter(Boolean);function cl(n){if(typeof n=="string")return n.split(";").map(e=>e.trim()).filter(Boolean).map(e=>{let[t,r]=e.includes("=")?e.split("="):[e,e];return{label:t.trim(),value:(r??t).trim()}})}function v0(n){let e="",t=new Promise(o=>{let i=new FileReader;i.onload=()=>{e=String(i.result).replace(/^data:[^,]*,/,""),o()},i.onerror=()=>o(),i.readAsDataURL(n)}),r="";return{ready:t,info:{id:()=>n.name.replace(/\.[^.]+$/,"")||"image",name:()=>n.name.replace(/\.[^.]+$/,"")||"image",filename:()=>n.name||"image",blob:()=>n,base64:()=>e,blobUri:()=>r||=URL.createObjectURL(n),uri:()=>{}}}}function ch(n){let e=Object.keys(n).filter(c=>!b0.has(c)),t=[],r=[];for(let c of y0(n.plugins)){let u=g0[c]??c;m0.has(c)||(ei(u)?t.push(u):r.push(c))}let o={plugins:t};if(n.toolbar===!1?o.toolbar=!1:Array.isArray(n.toolbar)?o.toolbar=n.toolbar.join(" | "):typeof n.toolbar=="string"&&(o.toolbar=n.toolbar),n.menubar!==void 0&&(o.menubar=n.menubar),typeof n.statusbar=="boolean"&&(o.statusbar=n.statusbar),typeof n.placeholder=="string"&&(o.placeholder=n.placeholder),n.readonly===!0&&(o.editable=!1),typeof n.language=="string"&&(o.language=n.language.replace("_","-")),n.toolbar_mode==="sliding"||n.toolbar_mode==="wrap"?o.toolbarMode=n.toolbar_mode:(n.toolbar_mode==="floating"||n.toolbar_mode==="scrolling")&&(o.toolbarMode="sliding"),n.inline===!0&&(o.mode="inline"),n.paste_as_text===!0&&(o.pasteAsText=!0),typeof n.paste_preprocess=="function"){let c=n.paste_preprocess;o.pastePreprocess=(u,d)=>{let f={content:u};return c(d,f),f.content}}typeof n.invalid_elements=="string"&&(o.invalidElements=n.invalid_elements),typeof n.valid_elements=="string"&&(o.validElements=n.valid_elements),n.valid_styles&&(o.validStyles=n.valid_styles);let i=cl(n.font_family_formats);i&&(o.fontFamilies=i);let s=cl(n.font_size_formats);s&&(o.fontSizes=s.map(c=>c.value));let l=cl(n.line_height_formats);if(l&&(o.lineHeights=l.map(c=>c.value)),Array.isArray(n.color_map)&&(o.colors=n.color_map.filter((c,u)=>u%2===0).map(c=>c.startsWith("#")?c:`#${c}`)),typeof n.images_upload_handler=="function"){let c=n.images_upload_handler,u=async(d,f)=>{let{ready:p,info:h}=v0(d);return await p,c(h,f)};o.uploadImage=u}let a={};if(n.autosave_interval||n.autosave_retention||n.autosave_prefix){let c=u=>parseInt(String(u),10);a.autosave={...n.autosave_interval?{delay:c(n.autosave_interval)*1e3}:{},...n.autosave_retention?{retention:c(n.autosave_retention)}:{},...n.autosave_prefix?{key:String(n.autosave_prefix)}:{}}}if((n.quickbars_selection_toolbar!==void 0||n.quickbars_insert_toolbar!==void 0)&&(a.quickbars={...n.quickbars_selection_toolbar!==void 0?{selection:n.quickbars_selection_toolbar}:{},...n.quickbars_insert_toolbar!==void 0?{insert:n.quickbars_insert_toolbar}:{}}),typeof n.mentions_fetch=="function"){let c=n.mentions_fetch;a.mentions={fetch:u=>new Promise(d=>c({term:u},d))}}return n.tinycomments_author&&(a.comments={author:{id:String(n.tinycomments_author),name:String(n.tinycomments_author_name??n.tinycomments_author)}}),Object.keys(a).length&&(o.pluginOptions=a),{options:o,unknown:e,missingPlugins:r}}var uh=new Set;function ul(n){uh.has(n)||(uh.add(n),console.warn(`[nova] tinymce-compat: ${n}`))}var dh=0;function w0(n,e){let t=`nova-compat-${++dh}`;n.root.classList.add(t);let r=document.createElement("style");r.setAttribute("data-nova-compat",t),r.textContent=`.${t} .nova-prosemirror { ${e.replace(/\b(html|body)\b/g,"&")} }`,n.root.prepend(r)}var Yo=n=>typeof n=="number"?`${n}px`:String(n);function x0(){let n=[],e=new Map,t=null;async function r(i,s){let l=n.find(C=>C.targetElm===i&&!C.removed);if(l)return l;let{options:a,unknown:c,missingPlugins:u}=ch(s);c.length&&ul(`options not supported yet: ${c.join(", ")}`);let d=String(Array.isArray(s.plugins)?s.plugins.join(" "):s.plugins??"").split(/[\s,]+/).filter(C=>e.has(C)),f=u.filter(C=>!e.has(C));f.length&&ul(`plugins not available: ${f.join(", ")}`);let p=i.id||`mce_${++dh}`;i.id||(i.id=p);let h=i instanceof HTMLTextAreaElement,m=h?i.value:i.innerHTML,b={...s,__initialContent:m},g;s.inline===!0&&!h?(i.replaceChildren(),g=i):(g=document.createElement("div"),g.className="nova-compat",i.after(g),i.hidden=!0,b.__wrapper=g);let y,x=sl({...a,element:g,content:m,setup:C=>{y=new Er(C,i,p,b);for(let T of d)try{e.get(T)(y,"")}catch(w){console.error(`[nova] tinymce-compat: plugin "${T}" failed`,w)}s.setup?.(y)}});s.height!==void 0&&(x.root.style.height=Yo(s.height)),s.min_height!==void 0&&(x.root.style.minHeight=Yo(s.min_height)),s.max_height!==void 0&&(x.root.style.maxHeight=Yo(s.max_height)),s.width!==void 0&&(x.root.style.width=Yo(s.width)),typeof s.content_style=="string"&&w0(x,s.content_style);let A=!1;x.on("change",()=>{y.setDirty(!0),A=!0,y.fire("input")}),x.on("selectionChange",()=>{y.fire("NodeChange",{element:y.selection.getNode(),selectionChange:!0})}),x.on("focus",()=>{t=y,A=!1,y.fire("focus")}),x.on("blur",()=>{A&&y.fire("change",{level:{content:y.getContent()}}),A=!1,y.fire("blur")});for(let C of["keydown","keyup","keypress","click","dblclick","mousedown","mouseup","paste","copy","cut","drop"])x.view.dom.addEventListener(C,T=>y.fireNative(C,T));return(h?i.form:i.closest("form"))?.addEventListener("submit",()=>y.save()),y.on("remove",()=>{let C=n.indexOf(y);C>=0&&n.splice(C,1),t===y&&(t=n[0]??null)}),n.push(y),t??=y,await x.ready,y.removed||(y.initialized=!0,y.fire("init"),s.init_instance_callback?.(y)),y}return{majorVersion:"7",minorVersion:"0.0",novaprose:!0,get activeEditor(){return t},get editors(){return[...n]},async init(i){document.readyState==="loading"&&await new Promise(a=>document.addEventListener("DOMContentLoaded",a,{once:!0}));let s=i.target?[i.target]:i.selector?[...document.querySelectorAll(i.selector)]:[];s.length||ul(`no elements match "${i.selector??""}"`);let l=[];for(let a of s)l.push(await r(a,i));return l},get:(i=>i===void 0?[...n]:typeof i=="number"?n[i]??null:n.find(s=>s.id===i)??null),remove(i){(i===void 0?[...n]:typeof i=="string"?n.filter(l=>l.id===i.replace(/^#/,"")||l.targetElm.matches(i)):[i]).forEach(l=>l.remove())},triggerSave(){n.forEach(i=>i.save())},execCommand(i,s,l){return t?.execCommand(i,s,l)??!1},PluginManager:{add:(i,s)=>{e.set(i,s)},get:i=>e.get(i),requireLangPack:()=>{},urls:{}},IconManager:{add:(i,s)=>{for(let[l,a]of Object.entries(s.icons??{}))Er.registerIcon(l,a)}},util:{I18n:{translate:i=>i}}}}var fh=x0();var ph=document.currentScript;if(ph?.src&&!document.querySelector("link[data-novaprose-css]")){let n=document.createElement("link");n.rel="stylesheet",n.href=ph.src.replace(/[^/]*$/,"novaprose.css"),n.setAttribute("data-novaprose-css",""),document.head.append(n)}window.tinymce=fh;})();
38
+ //# sourceMappingURL=tinymce.global.js.map