@paroicms/tiptap-editor-plugin 1.2.3 → 1.2.4
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"English",fr:"French",es:"Spanish",de:"German",it:"Italian",pt:"Portuguese"},fr:{en:"Anglais",fr:"Français",es:"Espagnol",de:"Allemand",it:"Italien",pt:"Portugais"},es:{en:"Inglés",fr:"Francés",es:"Español",de:"Alemán",it:"Italiano",pt:"Portugués"},de:{en:"Englisch",fr:"Französisch",es:"Spanisch",de:"Deutsch",it:"Italienisch",pt:"Portugiesisch"},it:{en:"Inglese",fr:"Francese",es:"Spagnolo",de:"Tedesco",it:"Italiano",pt:"Portoghese"},pt:{en:"Inglês",fr:"Francês",es:"Espanhol",de:"Alemão",it:"Italiano",pt:"Português"}},Xa=Object.keys(jf);function qf(n,{pluginLanguages:e,siteLanguages:t=[]}){if(e.includes(n)||Xa.includes(n)&&e.includes(n))return n;const r=t.find(i=>Xa.includes(i)&&e.includes(i));return r||(e.includes("en")?"en":e[0]??"en")}function _e(n){this.content=n}_e.prototype={constructor:_e,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,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new _e(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new _e(t)},addToStart:function(n,e){return new _e([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new _e(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new _e(i)},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=_e.from(n),n.size?new _e(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=_e.from(n),n.size?new _e(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=_e.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}};_e.from=function(n){if(n instanceof _e)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new _e(e)};function Kc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Kc(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Wc(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=0,d=Math.min(o.text.length,a.text.length);for(;c<d&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||a.content.size){let c=Wc(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}class w{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,i=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,t-d),r,i+d)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new w(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),i+=a.nodeSize),o=l}return new w(r,i)}cutByIndex(e,t){return e==t?w.empty:e==0&&t==this.content.length?this:new w(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new w(i,s)}addToStart(e){return new w([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new w(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 i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Kc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wc(this,e,t,r)}findIndex(e){if(e==0)return jr(0,e);if(e==this.size)return jr(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 i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?jr(t+1,s):jr(t,r);r=s}}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 w.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new w(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return w.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new w(t||e,r)}static from(e){if(!e)return w.empty;if(e instanceof w)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new w([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}w.empty=new w([],0);const Os={index:0,offset:0};function jr(n,e){return Os.index=n,Os.offset=e,Os}function hi(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(!hi(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!hi(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ie=class oo{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}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&&hi(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`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}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 oo.none;if(e instanceof oo)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};ie.none=[];class fi extends Error{}class O{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=qc(this.content,e+this.openStart,t);return r&&new O(r,this.openStart,this.openEnd)}removeBetween(e,t){return new O(jc(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 O.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new O(w.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new O(e,r,i)}}O.empty=new O(w.empty,0,0);function jc(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(i==e||s.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(jc(s.content,e-i-1,t-i-1)))}function qc(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=qc(o.content,e-s-1,t,o);return a&&n.replaceChild(i,o.copy(a))}function Gf(n,e,t){if(t.openStart>n.depth)throw new fi("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new fi("Inconsistent open depths");return Gc(n,e,t,0)}function Gc(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=Gc(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return bn(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Jf(t,n);return bn(s,Zc(n,o,a,e,r))}else return bn(s,pi(n,e,r))}function Jc(n,e){if(!e.type.compatibleContent(n.type))throw new fi("Cannot join "+e.type.name+" onto "+n.type.name)}function ao(n,e,t){let r=n.node(t);return Jc(r,e.node(t)),r}function gn(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 ar(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(gn(n.nodeAfter,r),s++));for(let a=s;a<o;a++)gn(i.child(a),r);e&&e.depth==t&&e.textOffset&&gn(e.nodeBefore,r)}function bn(n,e){return n.type.checkContent(e),n.copy(e)}function Zc(n,e,t,r,i){let s=n.depth>i&&ao(n,e,i+1),o=r.depth>i&&ao(t,r,i+1),a=[];return ar(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(Jc(s,o),gn(bn(s,Zc(n,e,t,r,i+1)),a)):(s&&gn(bn(s,pi(n,e,i+1)),a),ar(e,t,i,a),o&&gn(bn(o,pi(t,r,i+1)),a)),ar(r,null,i,a),new w(a)}function pi(n,e,t){let r=[];if(ar(null,n,t,r),n.depth>t){let i=ao(n,e,t+1);gn(bn(i,pi(n,e,t+1)),r)}return ar(e,null,t,r),new w(r)}function Jf(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(w.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class kr{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],i=e.child(t);return r?e.child(t).cut(r):i}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],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ie.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].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 mi(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=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new kr(t,r,s)}static resolveCached(e,t){let r=Qa.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==t)return o}else Qa.set(e,r=new Zf);let i=r.elts[r.i]=kr.resolve(e,t);return r.i=(r.i+1)%Yf,i}}class Zf{constructor(){this.elts=[],this.i=0}}const Yf=12,Qa=new WeakMap;class mi{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)}}const Xf=Object.create(null);class dt{constructor(e,t,r,i=ie.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||w.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,i=0){this.content.nodesBetween(e,t,r,i,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,i){return this.content.textBetween(e,t,r,i)}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&&hi(this.attrs,t||e.defaultAttrs||Xf)&&ie.sameSet(this.marks,r||ie.none)}copy(e=null){return e==this.content?this:new dt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new dt(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 O.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new O(c,i.depth-o,s.depth-o)}replace(e,t,r){return Gf(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+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 i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return kr.resolveCached(this,e)}resolveNoCache(e){return kr.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),Yc(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=w.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ie.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ie.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 i=w.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}}dt.prototype.text=void 0;class gi extends dt{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Yc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new gi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new gi(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Yc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class En{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Qf(e,t);if(r.next==null)return En.empty;let i=Xc(r);r.next&&r.err("Unexpected trailing text");let s=op(sp(i));return ap(s,r),s}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 i=this;for(let s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}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 i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!t||l.validEnd))return w.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let h=s(u,a.concat(d));if(h)return h}}return null}return s(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 i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),t[a.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 i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`\n`)}}En.empty=new En(!0);class Qf{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+"')")}}function Xc(n){let e=[];do{e.push(ep(n))}while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function ep(n){let e=[];do{e.push(tp(n))}while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function tp(n){let e=ip(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=np(n,e);else break;return e}function el(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function np(n,e){let t=el(n),r=t;return n.eat(",")&&(n.next!="}"?r=el(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function rp(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function ip(n){if(n.eat("(")){let e=Xc(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=rp(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 sp(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=t())}else if(o.type=="star"){let l=t();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let d=t();i(s(o.expr,l),d),l=d}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let d=t();r(l,d),i(s(o.expr,l),d),l=d}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Qc(n,e){return e-n}function tl(n,e){let t=[];return r(e),t.sort(Qc);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&r(l)}}}function op(n){let e=Object.create(null);return t(tl(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<i.length;d++)i[d][0]==a&&(c=i[d][1]);tl(n,l).forEach(d=>{c||i.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let s=e[r.join(",")]=new En(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(Qc);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function ap(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ed(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 td(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function nd(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let s=n[i];s.validate&&s.validate(e[i])}}function rd(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new cp(n,r,e[r]);return t}let nl=class id{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=rd(e,r.attrs),this.defaultAttrs=ed(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==En.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:td(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new dt(this,this.computeAttrs(e),w.from(t),ie.setFrom(r))}createChecked(e=null,t,r){return t=w.from(t),this.checkContent(t),new dt(this,this.computeAttrs(e),t,ie.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=w.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(w.empty,!0);return s?new dt(this,e,t.append(s),ie.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){nd(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let 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:ie.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new id(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function lp(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class cp{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?lp(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class ss{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=rd(e,i.attrs),this.excluded=null;let s=ed(this.attrs);this.instance=s?new ie(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ie(this,td(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new ss(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){nd(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class sd{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=_e.from(e.nodes),t.marks=_e.from(e.marks||{}),this.nodes=nl.compile(this.spec.nodes,this),this.marks=ss.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=En.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?rl(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:rl(this,o.split(" "))}this.nodeFromJSON=i=>dt.fromJSON(this,i),this.markFromJSON=i=>ie.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof nl){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,i)}text(e,t){let r=this.nodes.text;return new gi(r,r.defaultAttrs,e,ie.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}}function rl(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],o=s;if(s)t.push(s);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function dp(n){return n.tag!=null}function up(n){return n.style!=null}class qt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(dp(i))this.tags.push(i);else if(up(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new sl(this,t,!1);return r.addAll(e,ie.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new sl(this,t,!0);return r.addAll(e,ie.none,t.from,t.to),O.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(pp(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=ol(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=ol(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new qt(e,qt.schemaRules(e)))}}const od={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},hp={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ad={ol:!0,ul:!0},vr=1,lo=2,lr=4;function il(n,e,t){return e!=null?(e?vr:0)|(e==="full"?lo:0):n&&n.whitespace=="pre"?vr|lo:t&~lr}class qr{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=ie.none,this.match=s||(o&lr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(w.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&vr)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=w.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(w.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&&!od.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class sl{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=il(null,t.preserveWhitespace,0)|(r?lr:0);i?s=new qr(i.type,i.attrs,ie.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new qr(null,null,ie.none,!0,null,o):s=new qr(e.schema.topNodeType,null,ie.none,!0,null,o),this.nodes=[s],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,i=this.top,s=i.options&lo?"full":this.localPreserveWS||(i.options&vr)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`\n`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));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 a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;ad.hasOwnProperty(o)&&this.parser.normalizeLists&&fp(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:hp.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,d=this.needsBlock;if(od.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let u=l&&l.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(s),this.needsBlock=d}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`\n`),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 i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,t.attrs||null,r,t.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=ie.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):al(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,i)),s}enterInner(e,t,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=il(e,s,o.options);o.options&lr&&o.content.length==0&&(a|=lr);let l=ie.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):al(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new qr(e,t,l,i,null,a)),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|=vr)}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 i=r.length-1;i>=0;i--)e+=r[i].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 i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].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,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let d=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return o(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}}}function fp(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ad.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function pp(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ol(n){let e={};for(let t in n)e[t]=n[t];return e}function al(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||s.indexOf(d)<0&&o(d))return!0}};if(o(i.contentMatch))return!0}}class An{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Is(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],d=this.serializeMark(c,o.isInline,t);d&&(s.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=oi(Is(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&oi(Is(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return oi(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new An(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ll(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return ll(e.marks)}}function ll(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Is(n){return n.document||window.document}const cl=new WeakMap;function mp(n){let e=cl.get(n);return e===void 0&&cl.set(n,e=gp(n)),e}function gp(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 i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function oi(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=mp(r))&&s.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 o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?n.createElementNS(t,i):n.createElement(i),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?l.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):u=="style"&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let h=e[u];if(h===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:p}=oi(n,h,t,r);if(l.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const ld=65535,cd=Math.pow(2,16);function bp(n,e){return n+e*cd}function dl(n){return n&ld}function yp(n){return(n-(n&ld))/cd}const dd=1,ud=2,ai=4,hd=8;class co{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&hd)>0}get deletedBefore(){return(this.delInfo&(dd|ai))>0}get deletedAfter(){return(this.delInfo&(ud|ai))>0}get deletedAcross(){return(this.delInfo&ai)>0}}class Ze{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ze.empty)return Ze.empty}recover(e){let t=0,r=dl(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+yp(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 i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],d=this.ranges[a+o],u=l+c;if(e<=u){let h=c?e==l?-1:e==u?1:t:t,f=l+i+(h<0?0:d);if(r)return f;let p=e==(t<0?l:u)?null:bp(a/3,e-l),m=e==l?ud:e==u?dd:ai;return(t<0?e!=l:e!=u)&&(m|=hd),new co(f,m,p)}i+=d-c}return r?e+i:new co(e+i,0,null)}touches(e,t){let r=0,i=dl(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],d=l+c;if(e<=d&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+t],d=this.ranges[i+r];e(a,a+c,l,l+d),s+=d-c}}invert(){return new Ze(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ze.empty:new Ze(e<0?[0,-e,0]:[0,0,e])}}Ze.empty=new Ze([]);class Er{constructor(e,t,r=0,i=(e?e.length:0)){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Er(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=0,r=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Er;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 i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new co(e,i,null)}}const Ls=Object.create(null);class ze{getMap(){return Ze.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ls[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 Ls)throw new RangeError("Duplicate use of step JSON ID "+e);return Ls[e]=t,t.prototype.jsonID=e,t}}class ve{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ve(e,null)}static fail(e){return new ve(null,e)}static fromReplace(e,t,r,i){try{return ve.ok(e.replace(t,r,i))}catch(s){if(s instanceof fi)return ve.fail(s.message);throw s}}}function Uo(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(Uo(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return w.fromArray(r)}class Kt extends ze{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),i=r.node(r.sharedDepth(this.to)),s=new O(Uo(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return ve.fromReplace(e,this.from,this.to,s)}invert(){return new ct(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Kt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Kt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kt(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 Kt(t.from,t.to,e.markFromJSON(t.mark))}}ze.jsonID("addMark",Kt);class ct extends ze{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 O(Uo(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ve.fromReplace(e,this.from,this.to,r)}invert(){return new Kt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ct(t.pos,r.pos,this.mark)}merge(e){return e instanceof ct&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ct(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 ct(t.from,t.to,e.markFromJSON(t.mark))}}ze.jsonID("removeMark",ct);class Wt extends ze{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ve.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ve.fromReplace(e,this.pos,this.pos+1,new O(w.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 i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Wt(this.pos,t.marks[i]);return new Wt(this.pos,this.mark)}}return new xn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Wt(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 Wt(t.pos,e.markFromJSON(t.mark))}}ze.jsonID("addNodeMark",Wt);class xn extends ze{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ve.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ve.fromReplace(e,this.pos,this.pos+1,new O(w.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Wt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new xn(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 xn(t.pos,e.markFromJSON(t.mark))}}ze.jsonID("removeNodeMark",xn);class Me extends ze{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&uo(e,this.from,this.to)?ve.fail("Structure replace would overwrite content"):ve.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ze([this.from,this.to-this.from,this.slice.size])}invert(e){return new Me(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Me(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Me)||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?O.empty:new O(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Me(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?O.empty:new O(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Me(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 Me(t.from,t.to,O.fromJSON(e,t.slice),!!t.structure)}}ze.jsonID("replace",Me);class Ce extends ze{constructor(e,t,r,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(uo(e,this.from,this.gapFrom)||uo(e,this.gapTo,this.to)))return ve.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ve.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ve.fromReplace(e,this.from,this.to,r):ve.fail("Content does not fit in gap")}getMap(){return new Ze([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 Ce(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),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new Ce(t.pos,r.pos,i,s,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 Ce(t.from,t.to,t.gapFrom,t.gapTo,O.fromJSON(e,t.slice),t.insert,!!t.structure)}}ze.jsonID("replaceAround",Ce);function uo(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function kp(n,e,t,r){let i=[],s=[],o,a;n.doc.nodesBetween(e,t,(l,c,d)=>{if(!l.isInline)return;let u=l.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,t),p=r.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(u[m])?o.to=f:i.push(o=new ct(h,f,u[m])));a&&a.to==h?a.to=f:s.push(a=new Kt(h,f,r))}}),i.forEach(l=>n.step(l)),s.forEach(l=>n.step(l))}function vp(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof ss){let c=o.marks,d;for(;d=r.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let d=0;d<l.length;d++){let u=l[d],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&u.eq(i[f].style)&&(h=p)}h?(h.to=c,h.step=s):i.push({style:u,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>n.step(new ct(o.from,o.to,o.style)))}function Vo(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),d=a+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Me(a,d,O.empty));else{r=u;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||n.step(new ct(a,d,c.marks[h]));if(i&&c.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new O(w.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new Me(a+h.index,a+h.index+h[0].length,p))}}a=d}if(!r.validEnd){let l=r.fillBefore(w.empty,!0);n.replace(a,a,new O(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function Ep(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Yn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,s=0;;--r){let o=n.$from.node(r),a=n.$from.index(r)+i,l=n.$to.indexAfter(r)-s;if(r<n.depth&&o.canReplace(a,l,t))return r;if(r==0||o.type.spec.isolating||!Ep(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function xp(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,d=w.empty,u=0;for(let p=s,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,d=w.from(r.node(p).copy(d)),u++):l--;let h=w.empty,f=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,h=w.from(i.node(p).copy(h)),f++):c++;n.step(new Ce(l,c,o,a,new O(d.append(h),u,f),d.size-u,!0))}function Ko(n,e,t=null,r=n){let i=Sp(n,e),s=i&&wp(r,e);return s?i.map(ul).concat({type:e,attrs:t}).concat(s.map(ul)):null}function ul(n){return{type:n,attrs:null}}function Sp(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function wp(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function Tp(n,e,t){let r=w.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=w.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new Ce(i,s,i,s,new O(r,0,0),t.length,!0))}function Mp(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&Cp(n.doc,n.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&pd(n,o,a,s),Vo(n,n.mapping.slice(s).map(a,1),r,void 0,c===null);let d=n.mapping.slice(s),u=d.map(a,1),h=d.map(a+o.nodeSize,1);return n.step(new Ce(u,h,u+1,h-1,new O(w.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&fd(n,o,a,s),!1}})}function fd(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function pd(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`\n`))}})}function Cp(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Ap(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Ce(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new O(w.from(o),0,0),1,!0))}function _t(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,d=t-2;c>s;c--,d--){let u=i.node(c),h=i.index(c);if(u.type.spec.isolating)return!1;let f=u.content.cutByIndex(h,u.childCount),p=r&&r[d+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[d]||u;if(!u.canReplace(h+1,u.childCount)||!m.type.validContent(f))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function Np(n,e,t=1,r){let i=n.doc.resolve(e),s=w.empty,o=w.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){s=w.from(i.node(a).copy(s));let d=r&&r[c];o=w.from(d?d.type.create(d.attrs,o):i.node(a).copy(o))}n.step(new Me(e,e,new O(s.append(o),t,t),!0))}function tn(n,e){let t=n.resolve(e),r=t.index();return md(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function _p(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function md(n,e){return!!(n&&e&&!n.isLeaf&&_p(n,e))}function as(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&md(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Op(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let d=o.whitespace=="pre",u=!!o.contentMatch.matchType(i);d&&!u?r=!1:!d&&u&&(r=!0)}let a=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);pd(n,d.node(),d.before(),a)}o.inlineContent&&Vo(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let l=n.mapping.slice(a),c=l.map(e-t);if(n.step(new Me(c,l.map(e+t,-1),O.empty,!0)),r===!0){let d=n.doc.resolve(c);fd(n,d.node(),d.before(),n.steps.length)}return n}function Ip(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 i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function gd(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),d=!1;if(s==1)d=c.canReplace(l,l,i);else{let u=c.contentMatchAt(l).findWrapping(i.firstChild.type);d=u&&c.canReplaceWith(l,l,u[0])}if(d)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function ls(n,e,t=e,r=O.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return bd(i,s,r)?new Me(e,t,r):new Lp(i,s,r).fit()}function bd(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Lp{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=w.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=w.from(e.node(i).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,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new O(s,o,a);return e>-1?new Ce(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new Me(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Rs(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,u=null;if(t==1&&(o?c.matchType(o.type)||(u=c.fillBefore(w.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:u};if(t==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:d};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Rs(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new O(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Rs(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new O(rr(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new O(rr(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,d=[],{match:u,type:h}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)d.push(i.child(m));u=u.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let m=a.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(u=g,d.push(yd(m.mark(h.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?f:-1)))}let p=c==a.childCount;p||(f=-1),this.placed=ir(this.placed,t,w.from(d)),this.frontier[t].match=u,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?O.empty:new O(rr(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new O(rr(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Ds(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,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=Ds(e,t,i,r,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=Ds(e,a,c,l,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:s?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=ir(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=ir(this.placed,this.depth,w.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(w.empty,!0);t.childCount&&(this.placed=ir(this.placed,this.frontier.length,t))}}function rr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(rr(n.firstChild.content,e-1,t)))}function ir(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ir(n.lastChild.content,e-1,t)))}function Rs(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function yd(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,yd(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(w.empty,!0)))),n.copy(r)}function Ds(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!Rp(t,s.content,o)?a:null}function Rp(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Dp(n){return n.spec.defining||n.spec.definingForContent}function $p(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(bd(i,s,r))return n.step(new Me(e,t,r));let o=vd(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],d=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==r.openStart)break;h=p.content}for(let h=d-1;h>=0;h--){let f=c[h],p=Dp(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))d=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+d+1)%(r.openStart+1),p=c[f];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],b=!0;g<0&&(b=!1,g=-g);let k=i.node(g-1),E=i.index(g-1);if(k.canReplaceWith(E,E,p.type,p.marks))return n.replace(i.before(g),b?s.after(g):t,new O(kd(r.content,0,r.openStart,f),f,r.openEnd))}}let u=n.steps.length;for(let h=o.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>u));h--){let f=o[h];f<0||(e=i.before(f),t=s.after(f))}}function kd(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(kd(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(w.empty,!0))}return n}function Pp(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Ip(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new O(w.from(r),0,0))}function Bp(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=vd(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function vd(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Hn extends ze{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 ve.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ve.fromReplace(e,this.pos,this.pos+1,new O(w.from(i),0,t.isLeaf?0:1))}getMap(){return Ze.empty}invert(e){return new Hn(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 Hn(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 Hn(t.pos,t.attr,t.value)}}ze.jsonID("attr",Hn);class xr extends ze{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ve.ok(r)}getMap(){return Ze.empty}invert(e){return new xr(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 xr(t.attr,t.value)}}ze.jsonID("docAttr",xr);let 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";class Ed{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Er}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}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=O.empty){let i=ls(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new O(w.from(r),0,0))}delete(e,t){return this.replace(e,t,O.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return $p(this,e,t,r),this}replaceRangeWith(e,t,r){return Pp(this,e,t,r),this}deleteRange(e,t){return Bp(this,e,t),this}lift(e,t){return xp(this,e,t),this}join(e,t=1){return Op(this,e,t),this}wrap(e,t){return Tp(this,e,t),this}setBlockType(e,t=e,r,i=null){return Mp(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Ap(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Hn(e,t,r)),this}setDocAttribute(e,t){return this.step(new xr(e,t)),this}addNodeMark(e,t){return this.step(new Wt(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 ie)t.isInSet(r.marks)&&this.step(new xn(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new xn(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,r){return Np(this,e,t,r),this}addMark(e,t,r){return kp(this,e,t,r),this}removeMark(e,t,r){return vp(this,e,t,r),this}clearIncompatible(e,t,r){return Vo(this,e,t,r),this}}const $s=Object.create(null);class j{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new zp(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=O.empty){let r=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],d=e.mapping.slice(s);e.replaceRange(d.map(l.pos),d.map(c.pos),a?O.empty:t),a==0&&pl(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),c=l.map(o.pos),d=l.map(a.pos);s?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),pl(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new F(e):Ln(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?Ln(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):Ln(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Ye(e.node(0))}static atStart(e){return Ln(e,e,0,0,1)||new Ye(e)}static atEnd(e){return Ln(e,e,e.content.size,e.childCount,-1)||new Ye(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=$s[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 $s)throw new RangeError("Duplicate use of selection JSON ID "+e);return $s[e]=t,t.prototype.jsonID=e,t}getBookmark(){return F.between(this.$anchor,this.$head).getBookmark()}}j.prototype.visible=!0;class zp{constructor(e,t){this.$from=e,this.$to=t}}let hl=!1;function fl(n){!hl&&!n.parent.inlineContent&&(hl=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class F extends j{constructor(e,t=e){fl(e),fl(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 j.near(r);let i=e.resolve(t.map(this.anchor));return new F(i.parent.inlineContent?i:r,r)}replace(e,t=O.empty){if(super.replace(e,t),t==O.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof F&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new cs(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 F(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=j.findFrom(t,r,!0)||j.findFrom(t,-r,!0);if(s)t=s.$head;else return j.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(j.findFrom(e,-r,!0)||j.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new F(e,t)}}j.jsonID("text",F);class cs{constructor(e,t){this.anchor=e,this.head=t}map(e){return new cs(e.map(this.anchor),e.map(this.head))}resolve(e){return F.between(e.resolve(this.anchor),e.resolve(this.head))}}class B extends j{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:i}=t.mapResult(this.anchor),s=e.resolve(i);return r?j.near(s):new B(s)}content(){return new O(w.from(this.node),0,0)}eq(e){return e instanceof B&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Wo(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new B(e.resolve(t.anchor))}static create(e,t){return new B(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}B.prototype.visible=!1;j.jsonID("node",B);class Wo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new cs(r,r):new Wo(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&B.isSelectable(r)?new B(t):j.near(t)}}class Ye extends j{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=O.empty){if(t==O.empty){e.delete(0,e.doc.content.size);let r=j.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ye(e)}map(e){return new Ye(e)}eq(e){return e instanceof Ye}getBookmark(){return Hp}}j.jsonID("all",Ye);const Hp={map(){return this},resolve(n){return new Ye(n)}};function Ln(n,e,t,r,i,s=!1){if(e.inlineContent)return F.create(n,t);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&B.isSelectable(a))return B.create(n,t-(i<0?a.nodeSize:0))}else{let l=Ln(n,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function pl(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof Me||i instanceof Ce))return;let s=n.mapping.maps[r],o;s.forEach((a,l,c,d)=>{o==null&&(o=d)}),n.setSelection(j.near(n.doc.resolve(o),t))}const ml=1,Gr=2,gl=4;class Fp extends Ed{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|ml)&~Gr,this.storedMarks=null,this}get selectionSet(){return(this.updated&ml)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Gr,this}ensureMarks(e){return ie.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&Gr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Gr,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)||ie.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(j.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|=gl,this}get scrolledIntoView(){return(this.updated&gl)>0}}function bl(n,e){return!e||!n?n:n.bind(e)}class sr{constructor(e,t,r){this.name=e,this.init=bl(t.init,r),this.apply=bl(t.apply,r)}}const Up=[new sr("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new sr("selection",{init(n,e){return n.selection||j.atStart(e.doc)},apply(n){return n.selection}}),new sr("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new sr("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Ps{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Up.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 sr(r.key,r.spec.state,r))})}}class zn{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 i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,d=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<o?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),s=!0}i&&(i[o]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new zn(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new Fp(this)}static create(e){let t=new Ps(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new zn(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new Ps(this.schema,e.plugins),r=t.fields,i=new zn(t);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}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 i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.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 i=new Ps(e.schema,e.plugins),s=new zn(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=dt.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=j.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=c.fromJSON.call(l,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function xd(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=xd(i,e,{})),t[r]=i}return t}class ne{constructor(e){this.spec=e,this.props={},e.props&&xd(e.props,this,this.props),this.key=e.key?e.key.key:Sd("plugin")}getState(e){return e[this.key]}}const Bs=Object.create(null);function Sd(n){return n in Bs?n+"$"+ ++Bs[n]:(Bs[n]=0,n+"$")}class ce{constructor(e="key"){this.key=Sd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const jo=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function wd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Td=(n,e,t)=>{let r=wd(n,t);if(!r)return!1;let i=qo(r);if(!i){let o=r.blockRange(),a=o&&Yn(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(Rd(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Vn(s,"end")||B.isSelectable(s)))for(let o=r.depth;;o--){let a=ls(n.doc,r.before(o),r.after(o),O.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(Vn(s,"end")?j.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):B.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Vp=(n,e,t)=>{let r=wd(n,t);if(!r)return!1;let i=qo(r);return i?Md(n,i,e):!1},Kp=(n,e,t)=>{let r=Ad(n,t);if(!r)return!1;let i=Go(r);return i?Md(n,i,e):!1};function Md(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let c=ls(n.doc,s,l,O.empty);if(!c||c.from!=s||c instanceof Me&&c.slice.size>=l-s)return!1;if(t){let d=n.tr.step(c);d.setSelection(F.create(d.doc,s)),t(d.scrollIntoView())}return!0}function Vn(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}const Cd=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=qo(r)}let o=s&&s.nodeBefore;return!o||!B.isSelectable(o)?!1:(e&&e(n.tr.setSelection(B.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function qo(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 Ad(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Nd=(n,e,t)=>{let r=Ad(n,t);if(!r)return!1;let i=Go(r);if(!i)return!1;let s=i.nodeAfter;if(Rd(n,i,e,1))return!0;if(r.parent.content.size==0&&(Vn(s,"start")||B.isSelectable(s))){let o=ls(n.doc,r.before(),r.after(),O.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(Vn(s,"start")?j.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):B.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},_d=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=Go(r)}let o=s&&s.nodeAfter;return!o||!B.isSelectable(o)?!1:(e&&e(n.tr.setSelection(B.create(n.doc,s.pos)).scrollIntoView()),!0)};function Go(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}const Wp=(n,e)=>{let t=n.selection,r=t instanceof B,i;if(r){if(t.node.isTextblock||!tn(n.doc,t.from))return!1;i=t.from}else if(i=as(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(B.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},jp=(n,e)=>{let t=n.selection,r;if(t instanceof B){if(t.node.isTextblock||!tn(n.doc,t.to))return!1;r=t.to}else if(r=as(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},qp=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&Yn(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},Od=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`\n`).scrollIntoView()),!0)};function Jo(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Gp=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=Jo(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,o.createAndFill());l.setSelection(j.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Id=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Ye||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Jo(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=n.tr.insert(o,s.createAndFill());a.setSelection(F.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Ld=(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 s=t.before();if(_t(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Yn(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function Jp(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof B&&e.selection.node.isBlock)return!r.parentOffset||!_t(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,l=!1,c=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){l=r.end(f)==r.pos+(r.depth-f),c=r.start(f)==r.pos-(r.depth-f),a=Jo(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),s.unshift(l&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof F||e.selection instanceof Ye)&&d.deleteSelection();let u=d.mapping.map(r.pos),h=_t(d.doc,u,s.length,s);if(h||(s[0]=a?{type:a}:null,h=_t(d.doc,u,s.length,s)),!h)return!1;if(d.split(u,s.length,s),!l&&c&&r.node(o).type!=a){let f=d.mapping.map(r.before(o)),p=d.doc.resolve(f);a&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,a)&&d.setNodeMarkup(d.mapping.map(r.before(o)),a)}return t&&t(d.scrollIntoView()),!0}}const Zp=Jp(),Yp=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(B.create(n.doc,i))),!0)};function Xp(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||tn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Rd(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&Xp(n,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(t){let f=e.pos+s.nodeSize,p=w.empty;for(let b=o.length-1;b>=0;b--)p=w.from(o[b].create(null,p));p=w.from(i.copy(p));let m=n.tr.step(new Ce(e.pos-1,f,e.pos,f,new O(p,1,0),o.length,!0)),g=m.doc.resolve(f+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&tn(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&l?null:j.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),h=u&&Yn(u);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(u,h).scrollIntoView()),!0;if(c&&Vn(s,"start",!0)&&Vn(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(t){let b=w.empty;for(let E=p.length-1;E>=0;E--)b=w.from(p[E].copy(b));let k=n.tr.step(new Ce(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new O(b,p.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function Dd(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(F.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const Qp=Dd(-1),em=Dd(1);function tm(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&Ko(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function yl(n,e=null){return function(t,r){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)i=!0;else{let d=t.doc.resolve(c),u=d.index();i=d.parent.canReplaceWith(u,u+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];s.setBlockType(a,l,n,e)}r(s.scrollIntoView())}return!0}}function Zo(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}Zo(jo,Td,Cd);Zo(jo,Nd,_d);Zo(Od,Id,Ld,Zp);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function nm(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let a=r?t.tr:null;return rm(a,o,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function rm(n,e,t,r=null){let i=!1,s=e,o=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 l=o.resolve(e.start-2);s=new mi(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new mi(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Ko(s,t,r,e);return a?(n&&im(n,e,a,i,t),!0):!1}function im(n,e,t,r,i){let s=w.empty;for(let d=t.length-1;d>=0;d--)s=w.from(t[d].type.create(t[d].attrs,s));n.step(new Ce(e.start-(r?2:0),e.end,e.start,e.end,new O(s,0,0),t.length,!0));let o=0;for(let d=0;d<t.length;d++)t[d].type==i&&(o=d+1);let a=t.length-o,l=e.start+t.length-(r?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,h=!0;d<u;d++,h=!1)!h&&_t(n.doc,l,a)&&(n.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return n}function sm(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?om(e,t,n,s):am(e,t,s):!0:!1}}function om(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Ce(s-1,o,s,o,new O(w.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new mi(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=Yn(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return tn(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function am(n,e,t){let r=n.tr,i=t.parent;for(let f=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=s.node(-1),d=s.index(-1);if(!c.canReplace(d+(a?0:1),d+1,o.content.append(l?w.empty:w.from(i))))return!1;let u=s.pos,h=u+o.nodeSize;return r.step(new Ce(u-(a?1:0),h+(l?1:0),u+1,h-1,new O((a?w.empty:w.from(i.copy(w.empty))).append(l?w.empty:w.from(i.copy(w.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function lm(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=n)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,d=w.from(c?n.create():null),u=new O(w.from(n.create(null,w.from(a.type.create(null,d)))),c?3:1,0),h=s.start,f=s.end;t(e.tr.step(new Ce(h-(c?3:1),f,h,f,u,1,!0)).scrollIntoView())}return!0}}const Oe=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Kn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let ho=null;const At=function(n,e,t){let r=ho||(ho=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},cm=function(){ho=null},Sn=function(n,e,t,r){return t&&(kl(n,e,t,r,-1)||kl(n,e,t,r,1))},dm=/^(img|br|input|textarea|hr)$/i;function kl(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:tt(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Lr(n)||dm.test(n.nodeName)||n.contentEditable=="false")return!1;e=Oe(n)+(i<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else n=o,e=i<0?tt(n):0}else return!1}}function tt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function um(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=tt(n)}else if(n.parentNode&&!Lr(n))e=Oe(n),n=n.parentNode;else return null}}function hm(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Lr(n))e=Oe(n)+1,n=n.parentNode;else return null}}function fm(n,e,t){for(let r=e==0,i=e==tt(n);r||i;){if(n==t)return!0;let s=Oe(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==tt(n)}}function Lr(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const ds=function(n){return n.focusNode&&Sn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function dn(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 mm(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(tt(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(tt(r.startContainer),r.startOffset)}}}const bt=typeof navigator<"u"?navigator:null,vl=typeof document<"u"?document:null,nn=bt&&bt.userAgent||"",fo=/Edge\/(\d+)/.exec(nn),$d=/MSIE \d/.exec(nn),po=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nn),je=!!($d||po||fo),Gt=$d?document.documentMode:po?+po[1]:fo?+fo[1]:0,nt=!je&&/gecko\/(\d+)/i.test(nn);nt&&+(/Firefox\/(\d+)/.exec(nn)||[0,0])[1];const mo=!je&&/Chrome\/(\d+)/.exec(nn),$e=!!mo,Pd=mo?+mo[1]:0,Ue=!je&&!!bt&&/Apple Computer/.test(bt.vendor),Wn=Ue&&(/Mobile\/\w+/.test(nn)||!!bt&&bt.maxTouchPoints>2),et=Wn||(bt?/Mac/.test(bt.platform):!1),gm=bt?/Win/.test(bt.platform):!1,Nt=/Android \d/.test(nn),Rr=!!vl&&"webkitFontSmoothing"in vl.documentElement.style,bm=Rr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ym(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 wt(n,e){return typeof n=="number"?n:n[e]}function km(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 El(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(o.nodeType!=1){o=Kn(o);continue}let a=o,l=a==s.body,c=l?ym(s):km(a),d=0,u=0;if(e.top<c.top+wt(r,"top")?u=-(c.top-e.top+wt(i,"top")):e.bottom>c.bottom-wt(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+wt(i,"top")-c.top:e.bottom-c.bottom+wt(i,"bottom")),e.left<c.left+wt(r,"left")?d=-(c.left-e.left+wt(i,"left")):e.right>c.right-wt(r,"right")&&(d=e.right-c.right+wt(i,"right")),d||u)if(l)s.defaultView.scrollBy(d,u);else{let f=a.scrollLeft,p=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);let m=a.scrollLeft-f,g=a.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let h=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:Kn(o)}}function vm(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=n.root.elementFromPoint(s,o);if(!a||a==n.dom||!n.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Bd(n.dom)}}function Bd(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Kn(r));return e}function Em({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;zd(t,r==0?0:r-e)}function zd(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:s}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let On=null;function xm(n){if(n.setActive)return n.setActive();if(On)return n.focus(On);let e=Bd(n);n.focus(On==null?{get preventScroll(){return On={preventScroll:!0},!0}}:void 0),On||(On=!1,zd(e,0))}function Hd(n,e){let t,r=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let d=n.firstChild,u=0;d;d=d.nextSibling,u++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=At(d).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){t=d,r=m,i=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,d.nodeType==1&&m&&(s=u+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=u+1)}}return!t&&l&&(t=l,i=c,r=0),t&&t.nodeType==3?Sm(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Hd(t,i)}function Sm(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let s=Pt(r,1);if(s.top!=s.bottom&&Yo(e,s))return{node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function Yo(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function wm(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Tm(n,e,t){let{node:r,offset:i}=Hd(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function Mm(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let a=n.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function Fd(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=n.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Yo(e,c))return Fd(o,e,c)}}if((s=(s+1)%r)==i)break}return n}function Cm(n,e){let t=n.dom.ownerDocument,r,i=0,s=mm(t,e.left,e.top);s&&({node:r,offset:i}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!Yo(e,c)||(o=Fd(n.dom,e,c),!o))return null}if(Ue)for(let c=o;r&&c;c=Kn(c))c.draggable&&(r=void 0);if(o=wm(o,e),r){if(nt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&i++}let c;Rr&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=Mm(n,r,i,e))}a==null&&(a=Tm(n,o,e));let l=n.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function xl(n){return n.top<n.bottom||n.left<n.right}function Pt(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(xl(r))return r}return Array.prototype.find.call(t,xl)||n.getBoundingClientRect()}const Am=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ud(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=Rr||nt;if(r.nodeType==3)if(o&&(Am.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let l=Pt(At(r,i,i),t);if(nt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Pt(At(r,i-1,i-1),-1);if(c.top==l.top){let d=Pt(At(r,i,i+1),-1);if(d.top!=l.top)return er(d,d.left<c.left)}}return l}else{let l=i,c=i,d=t<0?1:-1;return t<0&&!i?(c++,d=-1):t>=0&&i==r.nodeValue.length?(l--,d=1):t<0?l--:c++,er(Pt(At(r,l,c),d),d<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==tt(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return zs(l.getBoundingClientRect(),!1)}if(s==null&&i<tt(r)){let l=r.childNodes[i];if(l.nodeType==1)return zs(l.getBoundingClientRect(),!0)}return zs(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==tt(r))){let l=r.childNodes[i-1],c=l.nodeType==3?At(l,tt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return er(Pt(c,1),!1)}if(s==null&&i<tt(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?At(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return er(Pt(c,-1),!0)}return er(Pt(r.nodeType==3?At(r):r,-t),t>=0)}function er(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 zs(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 Vd(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function Nm(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return Vd(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=Ud(n,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=At(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const _m=/[\u0590-\u08ac]/;function Om(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=n.domSelection();return a?!_m.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:Vd(n,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let f=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==m;try{a.collapse(d,u),l&&(l!=d||c!=u)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),g}):r.pos==r.start()||r.pos==r.end()}let Sl=null,wl=null,Tl=!1;function Im(n,e,t){return Sl==e&&wl==t?Tl:(Sl=e,wl=t,Tl=t=="up"||t=="down"?Nm(n,e,t):Om(n,e,t))}const rt=0,Ml=1,un=2,yt=3;class Dr{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=rt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.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&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Oe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}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 i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof Wd){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Kd&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?Oe(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?Oe(s.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 i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let d=o+l.border;if(e>=d&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,d);e=o;for(let u=a;u>0;u--){let h=this.children[u-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Oe(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>t||a==this.children.length-1)){t=c;for(let d=a+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){s=Oe(u.dom);break}t+=u.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}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(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],g=p+m.size;if(s>p&&o<g)return m.setSelection(e-p-m.border,t-p-m.border,r,i);p=g}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),d=r.domSelectionRange(),u=!1;if((nt||Ue)&&e==t){let{node:f,offset:p}=a;if(f.nodeType==3){if(u=!!(p&&f.nodeValue[p-1]==`\n`),u&&p==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Oe(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=f.childNodes[p-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(nt&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let f=d.focusNode.childNodes[d.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||u&&Ue)&&Sn(a.node,a.offset,d.anchorNode,d.anchorOffset)&&Sn(l.node,l.offset,d.focusNode,d.focusOffset))return;let h=!1;if((c.extend||e==t)&&!(u&&nt)){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>t){let p=a;a=l,l=p}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let a=r+s.border,l=o-s.border;if(e>=a&&t<=l){this.dirty=e==r||t==o?un:Ml,e==a&&t==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=yt:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?un:yt}r=o}this.dirty=un}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?un:Ml;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Kd extends Dr{constructor(e,t,r,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==rt&&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}}class Lm extends Dr{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}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}}class wn extends Dr{constructor(e,t,r,i,s){super(e,[],r,i),this.mark=t,this.spec=s}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=An.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new wn(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&yt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=yt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=rt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=rt}}slice(e,t,r){let i=wn.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;t<o&&(s=bo(s,t,o,r)),e>0&&(s=bo(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Jt extends Dr{constructor(e,t,r,i,s,o,a,l,c){super(e,[],s,o),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,t,r,i,s,o){let a=s.nodeViews[t.type.name],l,c=a&&a(t,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=An.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let h=d;return d=Gd(d,r,t),c?l=new Rm(e,t,r,i,d,u||null,h,c,s,o+1):t.isText?new us(e,t,r,i,d,h,s):new Jt(e,t,r,i,d,u||null,h,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>w.empty)}return e}matchesNode(e,t,r){return this.dirty==rt&&e.eq(this.node)&&bi(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,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new $m(this,o&&o.node,e);zm(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!u&&l.syncToMarks(d==this.node.childCount?ie.none:this.node.child(d).marks,r,e),l.placeWidget(c,e,i)},(c,d,u,h)=>{l.syncToMarks(c.marks,r,e);let f;l.findNodeMatch(c,d,u,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(f=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,d,u,f,e)||l.updateNextNode(c,d,u,e,h,i)||l.addNode(c,d,u,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==un)&&(o&&this.protectLocalComposition(e,o),jd(this.contentDOM,this.children,e),Wn&&Hm(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof F)||r<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=Fm(this.node.content,o,r-t,i-t);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new Lm(this,s,t,i);e.input.compositionNodes.push(o),this.children=bo(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==yt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=rt}updateOuterDeco(e){if(bi(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=qd(this.dom,this.nodeDOM,go(this.outerDeco,this.node,t),go(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Cl(n,e,t,r,i){Gd(r,e,n);let s=new Jt(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class us extends Jt{constructor(e,t,r,i,s,o,a){super(e,t,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==yt||this.dirty!=rt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=rt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=rt,!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 e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new us(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=yt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Wd extends Dr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==rt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Rm extends Jt{constructor(e,t,r,i,s,o,a,l,c,d){super(e,t,r,i,s,o,a,c,d),this.spec=l}update(e,t,r,i){if(this.dirty==yt)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,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function jd(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==n){for(;a!=r;)r=Al(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(a,r);if(o instanceof wn){let l=r?r.previousSibling:n.lastChild;jd(o.contentDOM,o.children,t),r=l?l.nextSibling:n.firstChild}}for(;r;)r=Al(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const cr=function(n){n&&(this.nodeName=n)};cr.prototype=Object.create(null);const hn=[new cr];function go(n,e,t){if(n.length==0)return hn;let r=t?hn[0]:new cr,i=[r];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&i.push(r=new cr(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&i.length==1&&i.push(r=new cr(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function qd(n,e,t,r){if(t==hn&&r==hn)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=t[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=n&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=hn[0]),i=l}Dm(i,a||hn[0],o)}return i}function Dm(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):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.add(i[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function Gd(n,e,t){return qd(n,n,hn,go(e,t,n.nodeType!=1))}function bi(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 Al(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class $m{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Pm(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){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(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.dirty=rt,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;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=wn.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,r,i,s){let o=this.top.children[i];return o.dirty==yt&&o.dom==o.contentDOM&&(o.dirty=un),o.update(e,t,r,s)?(this.destroyBetween(this.index,i),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 i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Jt){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let d=l.dom,u,h=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=yt&&bi(t,l.outerDeco));if(!h&&l.update(e,t,r,i))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(u=this.recreateWrapper(l,e,t,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=un,u.updateChildren(i,o+1),u.dirty=rt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!bi(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Jt.create(this.top,t,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,r,i,s){let o=Jt.create(this.top,e,t,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Kd(this.top,e,t,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof wn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof us)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ue||$e)&&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 i=new Wd(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Pm(n,e){let t=e,r=t.children.length,i=n.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof wn)t=c,r=c.children.length;else{a=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function Bm(n,e){return n.type.side-e.type.side}function zm(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);r(d,i,e.forChild(s,d),c),s+=d.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let d,u;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(d?(u||(u=[d])).push(g):d=g)}if(d)if(u){u.sort(Bm);for(let g=0;g<u.length;g++)t(u[g],c,!!l)}else t(d,c,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(c<n.childCount)f=c,h=n.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=s&&a.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let p=s+h.nodeSize;if(h.isText){let g=p;o<i.length&&i[o].from<g&&(g=i[o].from);for(let b=0;b<a.length;b++)a[b].to<g&&(g=a[b].to);g<p&&(l=h.cut(g-s),h=h.cut(0,g-s),p=g,f=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();r(h,m,e.forChild(s,h),f),s=p}}function Hm(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 Fm(n,e,t,r){for(let i=0,s=0;i<n.childCount&&s<=r;){let o=n.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<n.childCount;){let c=n.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=t){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=t)return a+c;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function bo(n,e,t,r,i){let s=[];for(let o=0,a=0;o<n.length;o++){let l=n[o],c=a,d=a+=l.size;c>=t||d<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,r)),i&&(s.push(i),i=void 0),d>t&&s.push(l.slice(t-c,l.size,r)))}return s}function Xo(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(ds(t)){for(l=o;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&B.isSelectable(u)&&i.parent&&!(u.isInline&&fm(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;c=new B(o==h?a:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=o,h=o;for(let f=0;f<t.rangeCount;f++){let p=t.getRangeAt(f);u=Math.min(u,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(u<0)return null;[l,o]=h==n.state.selection.anchor?[h,u]:[u,h],a=r.resolve(o)}else l=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!c){let u=e=="pointer"||n.state.selection.head<a.pos&&!s?1:-1;c=Qo(n,d,a,u)}return c}function Jd(n){return n.editable?n.hasFocus():Yd(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Ot(n,e=!1){let t=n.state.selection;if(Zd(n,t),!!Jd(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&$e){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Sn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Vm(n);else{let{anchor:r,head:i}=t,s,o;Nl&&!(t instanceof F)&&(t.$from.parent.inlineContent||(s=_l(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=_l(n,t.to))),n.docView.setSelection(r,i,n,e),Nl&&(s&&Ol(s),o&&Ol(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Um(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Nl=Ue||$e&&Pd<63;function _l(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(Ue&&i&&i.contentEditable=="false")return Hs(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Hs(i);if(s)return Hs(s)}}function Hs(n){return n.contentEditable="true",Ue&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Ol(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Um(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Jd(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Vm(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Oe(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&je&&Gt<=11&&(t.disabled=!0,t.disabled=!1)}function Zd(n,e){if(e instanceof B){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Il(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Il(n)}function Il(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Qo(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||F.between(e,t,r)}function Ll(n){return n.editable&&!n.hasFocus()?!1:Yd(n)}function Yd(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Km(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Sn(e.node,e.offset,t.anchorNode,t.anchorOffset)}function yo(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&j.findFrom(s,e)}function Bt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Rl(n,e,t){let r=n.state.selection;if(r instanceof F)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Bt(n,new F(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=yo(n.state,e);return i&&i instanceof B?Bt(n,i):!1}else if(!(et&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(a))&&!o.contentDOM?B.isSelectable(s)?Bt(n,new B(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Rr?Bt(n,new F(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof B&&r.node.isInline)return Bt(n,new F(e>0?r.$to:r.$from));{let i=yo(n.state,e);return i?Bt(n,i):!1}}}function yi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function dr(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function In(n,e){return e<0?Wm(n):jm(n)}function Wm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(nt&&t.nodeType==1&&r<yi(t)&&dr(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(dr(a,-1))i=t,s=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(Xd(t))break;{let a=t.previousSibling;for(;a&&dr(a,-1);)i=t.parentNode,s=Oe(a),a=a.previousSibling;if(a)t=a,r=yi(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?ko(n,t,r):i&&ko(n,i,s)}function jm(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=yi(t),s,o;for(;;)if(r<i){if(t.nodeType!=1)break;let a=t.childNodes[r];if(dr(a,1))s=t,o=++r;else break}else{if(Xd(t))break;{let a=t.nextSibling;for(;a&&dr(a,1);)s=a.parentNode,o=Oe(a)+1,a=a.nextSibling;if(a)t=a,r=0,i=yi(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&ko(n,s,o)}function Xd(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function qm(n,e){for(;n&&e==n.childNodes.length&&!Lr(n);)e=Oe(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Gm(n,e){for(;n&&!e&&!Lr(n);)e=Oe(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function ko(n,e,t){if(e.nodeType!=3){let s,o;(o=qm(e,t))?(e=o,t=0):(s=Gm(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(ds(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Ot(n)},50)}function Dl(n,e){let t=n.state.doc.resolve(e);if(!($e||gm)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<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),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function $l(n,e,t){let r=n.state.selection;if(r instanceof F&&!r.empty||t.indexOf("s")>-1||et&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=yo(n.state,e);if(o&&o instanceof B)return Bt(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof Ye?j.near(o,e):j.findFrom(o,e);return a?Bt(n,a):!1}return!1}function Pl(n,e){if(!(n.state.selection instanceof F))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function Bl(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Jm(n){if(!Ue||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Bl(n,r,"true"),setTimeout(()=>Bl(n,r,"false"),20)}return!1}function Zm(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Ym(n,e){let t=e.keyCode,r=Zm(e);if(t==8||et&&t==72&&r=="c")return Pl(n,-1)||In(n,-1);if(t==46&&!e.shiftKey||et&&t==68&&r=="c")return Pl(n,1)||In(n,1);if(t==13||t==27)return!0;if(t==37||et&&t==66&&r=="c"){let i=t==37?Dl(n,n.state.selection.from)=="ltr"?-1:1:-1;return Rl(n,i,r)||In(n,i)}else if(t==39||et&&t==70&&r=="c"){let i=t==39?Dl(n,n.state.selection.from)=="ltr"?1:-1:1;return Rl(n,i,r)||In(n,i)}else{if(t==38||et&&t==80&&r=="c")return $l(n,-1,r)||In(n,-1);if(t==40||et&&t==78&&r=="c")return Jm(n)||$l(n,1,r)||In(n,1);if(r==(et?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function ea(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let f=r.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=n.someProp("clipboardSerializer")||An.fromSchema(n.state.schema),a=iu(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=ru[c.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let p=a.createElement(d[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),u++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${u?` -${u}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,`\n\n`);return{dom:l,text:h,slice:e}}function Qd(n,e,t,r,i){let s=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=!!e&&(r||s||!t);if(l){if(n.someProp("transformPastedText",h=>{e=h(e,s||r,n)}),s)return a=new O(w.from(n.state.schema.text(e.replace(/\r\n?/g,`\n`))),0,0),n.someProp("transformPasted",h=>{a=h(a,n,!0)}),a;let u=n.someProp("clipboardTextParser",h=>h(e,i,r,n));if(u)a=u;else{let h=i.marks(),{schema:f}=n.state,p=An.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),o=tg(t),Rr&&ng(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||qt.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||d),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Xm.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=rg(zl(a,+d[1],+d[2]),d[4]);else if(a=O.maxOpen(Qm(a.content,i),!0),a.openStart||a.openEnd){let u=0,h=0;for(let f=a.content.firstChild;u<a.openStart&&!f.type.spec.isolating;u++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=zl(a,u,h)}return n.someProp("transformPasted",u=>{a=u(a,n,l)}),a}const Xm=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Qm(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&tu(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=nu(o[o.length-1],s.length));let d=eu(a,l);o.push(d),i=i.matchType(d.type),s=l}}),o)return w.from(o)}return n}function eu(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,w.from(n));return n}function tu(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=tu(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(w.from(eu(t,n,i+1))))}}function nu(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,nu(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(w.empty,!0);return n.copy(t.append(r))}function vo(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,a=o.content;return n.childCount>1&&(s=0),i<r-1&&(a=vo(a,e,t,r,i+1,s)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(w.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function zl(n,e,t){return e<n.openStart&&(n=new O(vo(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new O(vo(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const ru={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Hl=null;function iu(){return Hl||(Hl=document.implementation.createHTMLDocument("title"))}let Fs=null;function eg(n){let e=window.trustedTypes;return e?(Fs||(Fs=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Fs.createHTML(n)):n}function tg(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=iu().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&ru[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=eg(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function ng(n){let e=n.querySelectorAll($e?"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==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function rg(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:i,openStart:s,openEnd:o}=n;for(let a=r.length-2;a>=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=w.from(l.create(r[a+1],i)),s++,o++}return new O(i,s,o)}const Ve={},Ke={},ig={touchstart:!0,touchmove:!0};class sg{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,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.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function og(n){for(let e in Ve){let t=Ve[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{lg(n,r)&&!ta(n,r)&&(n.editable||!(r.type in Ke))&&t(n,r)},ig[e]?{passive:!0}:void 0)}Ue&&n.dom.addEventListener("input",()=>null),Eo(n)}function jt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function ag(n){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 Eo(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>ta(n,r))})}function ta(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function lg(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 cg(n,e){!ta(n,e)&&Ve[e.type]&&(n.editable||!(e.type in Ke))&&Ve[e.type](n,e)}Ke.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!ou(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Nt&&$e&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Wn&&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&&(n.someProp("handleKeyDown",i=>i(n,dn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Ym(n,t)?t.preventDefault():jt(n,"key")};Ke.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Ke.keypress=(n,e)=>{let t=e;if(ou(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||et&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof F)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};function hs(n){return{left:n.clientX,top:n.clientY}}function dg(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function na(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,a=>o>s.depth?a(n,t,s.nodeAfter,s.before(o),i,!0):a(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Fn(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 ug(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&B.isSelectable(r)?(Fn(n,new B(t)),!0):!1}function hg(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof B&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(B.isSelectable(a)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Fn(n,B.create(n.state.doc,i)),!0):!1}function fg(n,e,t,r,i){return na(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?hg(n,t):ug(n,t))}function pg(n,e,t,r){return na(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function mg(n,e,t,r){return na(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||gg(n,t,r)}function gg(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Fn(n,F.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Fn(n,F.create(r,a+1,a+1+o.content.size));else if(B.isSelectable(o))Fn(n,B.create(r,a));else continue;return!0}}function ra(n){return ki(n)}const su=et?"metaKey":"ctrlKey";Ve.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=ra(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&dg(t,n.input.lastClick)&&!t[su]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=n.posAtCoords(hs(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new bg(n,o,t,!!r)):(s=="doubleClick"?pg:mg)(n,o.pos,o.inside,t)?t.preventDefault():jt(n,"pointer"))};class bg{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[su],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);s=d.parent,o=d.depth?d.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof B&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&nt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),jt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ot(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(hs(e))),this.updateAllowDefault(e),this.allowDefault||!t?jt(this.view,"pointer"):fg(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ue&&this.mightDrag&&!this.mightDrag.node.isAtom||$e&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Fn(this.view,j.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):jt(this.view,"pointer")}move(e){this.updateAllowDefault(e),jt(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ve.touchstart=n=>{n.input.lastTouch=Date.now(),ra(n),jt(n,"pointer")};Ve.touchmove=n=>{n.input.lastTouch=Date.now(),jt(n,"pointer")};Ve.contextmenu=n=>ra(n);function ou(n,e){return n.composing?!0:Ue&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const yg=Nt?5e3:-1;Ke.compositionstart=Ke.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof F&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),ki(n,!0),n.markCursor=null;else if(ki(n,!e.selection.empty),nt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}au(n,yg)};Ke.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,au(n,20))};function au(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>ki(n),e))}function lu(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=vg());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function kg(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=um(e.focusNode,e.focusOffset),r=hm(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function vg(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function ki(n,e=!1){if(!(Nt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),lu(n),e||n.docView&&n.docView.dirty){let t=Xo(n),r=n.state.selection;return 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),!0}return!1}}function Eg(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(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Sr=je&&Gt<15||Wn&&bm<604;Ve.copy=Ke.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=Sr?null:t.clipboardData,o=r.content(),{dom:a,text:l}=ea(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):Eg(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function xg(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Sg(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 i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?wr(n,r.value,null,i,e):wr(n,r.textContent,r.innerHTML,i,e)},50)}function wr(n,e,t,r,i){let s=Qd(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,i,s||O.empty)))return!0;if(!s)return!1;let o=xg(s),a=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function cu(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," "):""}Ke.paste=(n,e)=>{let t=e;if(n.composing&&!Nt)return;let r=Sr?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&wr(n,cu(r),r.getData("text/html"),i,t)?t.preventDefault():Sg(n,t)};class du{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const wg=et?"altKey":"ctrlKey";function uu(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[wg]}Ve.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(hs(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof B?i.to-1:i.to))){if(r&&r.mightDrag)o=B.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(o=B.create(n.state.doc,u.posBefore))}}let a=(o||n.state.selection).content(),{dom:l,text:c,slice:d}=ea(n,a);(!t.dataTransfer.files.length||!$e||Pd>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Sr?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Sr||t.dataTransfer.setData("text/plain",c),n.dragging=new du(d,uu(n,t),o)};Ve.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Ke.dragover=Ke.dragenter=(n,e)=>e.preventDefault();Ke.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(hs(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",p=>{o=p(o,n,!1)}):o=Qd(n,cu(t.dataTransfer),Sr?null:t.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&uu(n,t));if(n.someProp("handleDrop",p=>p(n,t,o||O.empty,a))){t.preventDefault();return}if(!o)return;t.preventDefault();let l=o?gd(n.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let c=n.state.tr;if(a){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,h=c.doc;if(u?c.replaceRangeWith(d,d,o.content.firstChild):c.replaceRange(d,d,o),c.doc.eq(h))return;let f=c.doc.resolve(d);if(u&&B.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new B(f));else{let p=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,k)=>p=k),c.setSelection(Qo(n,f,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};Ve.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Ot(n)},20))};Ve.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};Ve.beforeinput=(n,e)=>{if($e&&Nt&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,dn(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in Ke)Ve[n]=Ke[n];function Tr(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}class vi{constructor(e,t){this.toDOM=e,this.spec=t||yn,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Pe(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof vi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Tr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Zt{constructor(e,t){this.attrs=e,this.spec=t||yn}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Pe(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Zt&&Tr(this.attrs,e.attrs)&&Tr(this.spec,e.spec)}static is(e){return e.type instanceof Zt}destroy(){}}class ia{constructor(e,t){this.attrs=e,this.spec=t||yn}map(e,t,r,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Pe(s.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(r)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof ia&&Tr(this.attrs,e.attrs)&&Tr(this.spec,e.spec)}destroy(){}}class Pe{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Pe(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 Pe(e,e,new vi(t,r))}static inline(e,t,r,i){return new Pe(e,t,new Zt(r,i))}static node(e,t,r,i){return new Pe(e,t,new ia(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Zt}get widget(){return this.type instanceof vi}}const Rn=[],yn={};class le{constructor(e,t){this.local=e.length?e:Rn,this.children=t.length?t:Rn}static create(e,t){return t.length?Ei(t,e,0,yn):De}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,r,i+a,s)}}map(e,t,r){return this==De||e.maps.length==0?this:this.mapInner(e,t,0,0,r||yn)}mapInner(e,t,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?Tg(this.children,o||[],e,t,r,i,s):o?new le(o.sort(kn),Rn):De}add(e,t){return t.length?this==De?le.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((a,l)=>{let c=l+r,d;if(d=fu(t,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,d,c+1):i.splice(s,0,l,l+a.nodeSize,Ei(d,a,c+1,yn)),s+=3}});let o=hu(s?pu(t):t,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new le(o.length?this.local.concat(o).sort(kn):this.local,i||this.children)}remove(e){return e.length==0||this==De?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+t,l=r[s+1]+t;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>a&&u.to<l&&(e[d]=null,(o||(o=[])).push(u));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,a+1);c!=De?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new le(i,r):De}forChild(e,t){if(this==De)return this;if(t.isLeaf)return le.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof Zt){let c=Math.max(s,l.from)-s,d=Math.min(o,l.to)-s;c<d&&(i||(i=[])).push(l.copy(c,d))}}if(i){let a=new le(i.sort(kn),Rn);return r?new Ft([a,r]):a}return r||De}eq(e){if(this==e)return!0;if(!(e instanceof le)||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 sa(this.localsInner(e))}localsInner(e){if(this==De)return Rn;if(e.inlineContent||!this.local.some(Zt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Zt||t.push(this.local[r]);return t}forEachSet(e){e(this)}}le.empty=new le([],[]);le.removeOverlap=sa;const De=le.empty;class Ft{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,yn));return Ft.from(r)}forChild(e,t){if(t.isLeaf)return le.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=De&&(s instanceof Ft?r=r.concat(s.members):r.push(s))}return Ft.from(r)}eq(e){if(!(e instanceof Ft)||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 i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?sa(r?t:t.sort(kn)):Rn}static from(e){switch(e.length){case 0:return De;case 1:return e[0];default:return new Ft(e.every(t=>t instanceof le)?e:e.reduce((t,r)=>t.concat(r instanceof le?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Tg(n,e,t,r,i,s,o){let a=n.slice();for(let c=0,d=s;c<t.maps.length;c++){let u=0;t.maps[c].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let b=0;b<a.length;b+=3){let k=a[b+1];if(k<0||h>k+d-u)continue;let E=a[b]+d-u;f>=E?a[b+1]=h<=E?-2:-1:h>=d&&g&&(a[b]+=g,a[b+1]+=g)}u+=g}),d=t.maps[c].map(d,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let d=t.map(n[c]+s),u=d-i;if(u<0||u>=r.content.size){l=!0;continue}let h=t.map(n[c+1]+s,-1),f=h-i,{index:p,offset:m}=r.content.findIndex(u),g=r.maybeChild(p);if(g&&m==u&&m+g.nodeSize==f){let b=a[c+2].mapInner(t,g,d+1,n[c]+s+1,o);b!=De?(a[c]=u,a[c+1]=f,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Mg(a,n,e,t,i,s,o),d=Ei(c,r,0,o);e=d.local;for(let u=0;u<a.length;u+=3)a[u+1]<0&&(a.splice(u,3),u-=3);for(let u=0,h=0;u<d.children.length;u+=3){let f=d.children[u];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,d.children[u],d.children[u+1],d.children[u+2])}}return new le(e.sort(kn),a)}function hu(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new Pe(i.from+e,i.to+e,i.type))}return t}function Mg(n,e,t,r,i,s,o){function a(l,c){for(let d=0;d<l.local.length;d++){let u=l.local[d].map(r,i,c);u?t.push(u):o.onRemove&&o.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+c+1)}for(let l=0;l<n.length;l+=3)n[l+1]==-1&&a(n[l+2],e[l]+s+1);return t}function fu(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let s=0,o;s<n.length;s++)(o=n[s])&&o.from>t&&o.to<r&&((i||(i=[])).push(o),n[s]=null);return i}function pu(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Ei(n,e,t,r){let i=[],s=!1;e.forEach((a,l)=>{let c=fu(n,a,l+t);if(c){s=!0;let d=Ei(c,a,t+l+1,r);d!=De&&i.push(l,l+a.nodeSize,d)}});let o=hu(s?pu(n):n,-t).sort(kn);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new le(o,i):De}function kn(n,e){return n.from-e.from||n.to-e.to}function sa(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,r.to),Fl(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),Fl(e,i,r.copy(s.from,r.to)));break}}}return e}function Fl(n,e,t){for(;e<n.length&&kn(t,n[e])>0;)e++;n.splice(e,0,t)}function Us(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=De&&e.push(r)}),n.cursorWrapper&&e.push(le.create(n.state.doc,[n.cursorWrapper.deco])),Ft.from(e)}const Cg={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ag=je&&Gt<=11;class Ng{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class _g{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Ng,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);je&&Gt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Ag&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Cg)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ll(this.view)){if(this.suppressingSelectionUpdates)return Ot(this.view);if(je&&Gt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Sn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=Kn(s))t.add(s);for(let s=e.anchorNode;s;s=Kn(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ll(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let d=0;d<t.length;d++){let u=this.registerMutation(t[d],l);u&&(s=s<0?u.from:Math.min(u.from,s),o=o<0?u.to:Math.max(u.to,o),u.typeOver&&(a=!0))}if(nt&&l.length){let d=l.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,h]=d;u.parentNode&&u.parentNode.parentNode==h.parentNode?h.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let h of d){let f=h.parentNode;f&&f.nodeName=="LI"&&(!u||Lg(e,u)!=f)&&h.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ds(r)&&(c=Xo(e))&&c.eq(j.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ot(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),Og(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ot(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];t.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(je&&Gt<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:h}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?Oe(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?Oe(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Ul=new WeakMap,Vl=!1;function Og(n){if(!Ul.has(n)&&(Ul.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=nt,Vl)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."),Vl=!0}}function Kl(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return Sn(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function Ig(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Kl(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Kl(n,t):null}function Lg(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,t){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=n.docView.parseRange(e,t),l=n.domSelectionRange(),c,d=l.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:l.anchorOffset}],ds(l)||c.push({node:l.focusNode,offset:l.focusOffset})),$e&&n.input.lastKeyCode===8)for(let g=s;g>i;g--){let b=r.childNodes[g-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){s=g;break}if(!k||k.size)break}let u=n.state.doc,h=n.someProp("domParser")||qt.fromSchema(n.state.schema),f=u.resolve(o),p=null,m=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:s,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Dg,context:f});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),p={anchor:g+o,head:b+o}}return{doc:m,sel:p,from:o,to:a}}function Dg(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Ue&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||Ue&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const $g=/^(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;function Pg(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let A=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,R=Xo(n,A);if(R&&!n.state.selection.eq(R)){if($e&&Nt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",te=>te(n,dn(13,"Enter"))))return;let H=n.state.tr.setSelection(R);A=="pointer"?H.setMeta("pointer",!0):A=="key"&&H.scrollIntoView(),s&&H.setMeta("composition",s),n.dispatch(H)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=Rg(n,e,t),d=n.state.doc,u=d.slice(c.from,c.to),h,f;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,f="end"):(h=n.state.selection.from,f="start"),n.input.lastKeyCode=null;let p=Hg(u.content,c.doc.content,c.from,h,f);if(p&&n.input.domChangeCount++,(Wn&&n.input.lastIOSEnter>Date.now()-225||Nt)&&i.some(A=>A.nodeType==1&&!$g.test(A.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",A=>A(n,dn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof F&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let A=Wl(n,n.state.doc,c.sel);if(A&&!A.eq(n.state.selection)){let R=n.state.tr.setSelection(A);s&&R.setMeta("composition",s),n.dispatch(R)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof F&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),je&&Gt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),b=d.resolve(p.start),k=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA;if((Wn&&n.input.lastIOSEnter>Date.now()-225&&(!k||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!k&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"","")))&&n.someProp("handleKeyDown",A=>A(n,dn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&zg(d,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",A=>A(n,dn(8,"Backspace")))){Nt&&$e&&n.domObserver.suppressSelectionUpdates();return}$e&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),Nt&&!k&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(A){return A(n,dn(13,"Enter"))})},20));let E=p.start,x=p.endA,S=A=>{let R=A||n.state.tr.replace(E,x,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let H=Wl(n,R.doc,c.sel);H&&!($e&&n.composing&&H.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(H.head==E||H.head==R.mapping.map(x)-1)||je&&H.empty&&H.head==E)&&R.setSelection(H)}return s&&R.setMeta("composition",s),R.scrollIntoView()},C;if(k)if(m.pos==g.pos){je&&Gt<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ot(n),20));let A=S(n.state.tr.delete(E,x)),R=d.resolve(p.start).marksAcross(d.resolve(p.endA));R&&A.ensureMarks(R),n.dispatch(A)}else if(p.endA==p.endB&&(C=Bg(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let A=S(n.state.tr);C.type=="add"?A.addMark(E,x,C.mark):A.removeMark(E,x,C.mark),n.dispatch(A)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let A=m.parent.textBetween(m.parentOffset,g.parentOffset),R=()=>S(n.state.tr.insertText(A,E,x));n.someProp("handleTextInput",H=>H(n,E,x,A,R))||n.dispatch(R())}else n.dispatch(S());else n.dispatch(S())}function Wl(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Qo(n,e.resolve(t.anchor),e.resolve(t.head))}function Bg(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,a,l;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<t.length;d++)s=t[d].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=d=>d.mark(a.addToSet(d.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(l(e.child(d)));if(w.from(c).eq(n))return{mark:a,type:o}}function zg(n,e,t,r,i){if(t-e<=i.pos-r.pos||Vs(r,!0,!1)<i.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=n.resolve(Vs(s,!0,!0));return!o.parent.isTextblock||o.pos>t||Vs(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Vs(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Hg(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&n.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&jl(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<n.size&&jl(n.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function jl(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class mu{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 sg,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Yl),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=Jl(this),Gl(this),this.nodeViews=Zl(this),this.docView=Cl(this.state.doc,ql(this),Us(this),this.dom,this),this.domObserver=new _g(this,(r,i,s,o)=>Pg(this,r,i,s,o)),this.domObserver.start(),og(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&&Eo(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Yl),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 i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(lu(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=Zl(this);Ug(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Eo(this),this.editable=Jl(this),Gl(this);let l=Us(this),c=ql(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",u=s||!this.docView.matchesNode(e.doc,c,l);(u||!e.selection.eq(i.selection))&&(o=!0);let h=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&vm(this);if(o){this.domObserver.stop();let f=u&&(je||$e)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Fg(i.selection,e.selection);if(u){let p=$e?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=kg(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Cl(e.doc,c,l,this.dom,this)),p&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Km(this))?Ot(this,f):(Zd(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&Em(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof B){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&El(this,t.getBoundingClientRect(),e)}else El(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,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new du(e.slice,e.move,i<0?void 0:B.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=t?t(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(je){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&xm(this.dom),Ot(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Cm(this,e)}coordsAtPos(e,t=1){return Ud(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 i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return Im(this,t||this.state,e)}pasteHTML(e,t){return wr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return wr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return ea(this,e)}destroy(){this.docView&&(ag(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Us(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,cm())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return cg(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ue&&this.root.nodeType===11&&pm(this.dom.ownerDocument)==this.dom&&Ig(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}mu.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function ql(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"),[Pe.node(0,n.state.doc.content.size,e)]}function Gl(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:Pe.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Jl(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Fg(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 Zl(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Ug(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Yl(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 Xt={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:"'"},xi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Vg=typeof navigator<"u"&&/Mac/.test(navigator.platform),Kg=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ie=0;Ie<10;Ie++)Xt[48+Ie]=Xt[96+Ie]=String(Ie);for(var Ie=1;Ie<=24;Ie++)Xt[Ie+111]="F"+Ie;for(var Ie=65;Ie<=90;Ie++)Xt[Ie]=String.fromCharCode(Ie+32),xi[Ie]=String.fromCharCode(Ie);for(var Ks in Xt)xi.hasOwnProperty(Ks)||(xi[Ks]=Xt[Ks]);function Wg(n){var e=Vg&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Kg&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?xi:Xt)[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}const jg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),qg=typeof navigator<"u"&&/Win/.test(navigator.platform);function Gg(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))jg?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function Jg(n){let e=Object.create(null);for(let t in n)e[Gg(t)]=n[t];return e}function Ws(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 Zg(n){return new ne({props:{handleKeyDown:gu(n)}})}function gu(n){let e=Jg(n);return function(t,r){let i=Wg(r),s,o=e[Ws(i,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Ws(i,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(qg&&r.ctrlKey&&r.altKey)&&(s=Xt[r.keyCode])&&s!=i){let a=e[Ws(s,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var Yg=Object.defineProperty,oa=(n,e)=>{for(var t in e)Yg(n,t,{get:e[t],enumerable:!0})};function fs(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}var ps=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:i}=t,s=this.buildProps(i);return Object.fromEntries(Object.entries(n).map(([o,a])=>[o,(...c)=>{const d=a(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o=[],a=!!n,l=n||i.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),o.every(u=>u===!0)),d={...Object.fromEntries(Object.entries(t).map(([u,h])=>[u,(...p)=>{const m=this.buildProps(l,e),g=h(...p)(m);return o.push(g),d}])),run:c};return d}createCan(n){const{rawCommands:e,state:t}=this,r=!1,i=n||t.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o={tr:n,editor:r,view:s,state:fs({state:i,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},bu={};oa(bu,{blur:()=>Xg,clearContent:()=>Qg,clearNodes:()=>eb,command:()=>tb,createParagraphNear:()=>nb,cut:()=>rb,deleteCurrentNode:()=>ib,deleteNode:()=>sb,deleteRange:()=>ob,deleteSelection:()=>ab,enter:()=>lb,exitCode:()=>cb,extendMarkRange:()=>db,first:()=>ub,focus:()=>fb,forEach:()=>pb,insertContent:()=>mb,insertContentAt:()=>yb,joinBackward:()=>Eb,joinDown:()=>vb,joinForward:()=>xb,joinItemBackward:()=>Sb,joinItemForward:()=>wb,joinTextblockBackward:()=>Tb,joinTextblockForward:()=>Mb,joinUp:()=>kb,keyboardShortcut:()=>Ab,lift:()=>Nb,liftEmptyBlock:()=>_b,liftListItem:()=>Ob,newlineInCode:()=>Ib,resetAttributes:()=>Lb,scrollIntoView:()=>Rb,selectAll:()=>Db,selectNodeBackward:()=>$b,selectNodeForward:()=>Pb,selectParentNode:()=>Bb,selectTextblockEnd:()=>zb,selectTextblockStart:()=>Hb,setContent:()=>Fb,setMark:()=>ay,setMeta:()=>ly,setNode:()=>cy,setNodeSelection:()=>dy,setTextDirection:()=>uy,setTextSelection:()=>hy,sinkListItem:()=>fy,splitBlock:()=>py,splitListItem:()=>my,toggleList:()=>gy,toggleMark:()=>by,toggleNode:()=>yy,toggleWrap:()=>ky,undoInputRule:()=>vy,unsetAllMarks:()=>Ey,unsetMark:()=>xy,unsetTextDirection:()=>Sy,updateAttributes:()=>wy,wrapIn:()=>Ty,wrapInList:()=>My});var Xg=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),Qg=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),eb=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:d}=e,u=c.resolve(d.map(l)),h=c.resolve(d.map(l+a.nodeSize)),f=u.blockRange(h);if(!f)return;const p=Yn(f);if(a.type.isTextblock){const{defaultType:m}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(f.start,m)}(p||p===0)&&e.lift(f,p)})}),!0},tb=n=>e=>n(e),nb=()=>({state:n,dispatch:e})=>Id(n,e),rb=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new F(r.doc.resolve(Math.max(o-1,0)))),!0},ib=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);n.delete(a,l).scrollIntoView()}return!0}return!1};function Ee(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var sb=n=>({tr:e,state:t,dispatch:r})=>{const i=Ee(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},ob=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},ab=()=>({state:n,dispatch:e})=>jo(n,e),lb=()=>({commands:n})=>n.keyboardShortcut("Enter"),cb=()=>({state:n,dispatch:e})=>Gp(n,e);function aa(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Si(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:aa(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function yu(n,e,t={}){return n.find(r=>r.type===e&&Si(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Xl(n,e,t={}){return!!yu(n,e,t)}function jn(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e)||(t=t||((r=i.node.marks[0])==null?void 0:r.attrs),!yu([...i.node.marks],e,t)))return;let o=i.index,a=n.start()+i.offset,l=o+1,c=a+i.node.nodeSize;for(;o>0&&Xl([...n.parent.child(o-1).marks],e,t);)o-=1,a-=n.parent.child(o).nodeSize;for(;l<n.parent.childCount&&Xl([...n.parent.child(l).marks],e,t);)c+=n.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function It(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var db=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const s=It(n,r.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:d}=a;if(i){const u=jn(l,s,e);if(u&&u.from<=c&&u.to>=d){const h=F.create(o,u.from,u.to);t.setSelection(h)}}return!0},ub=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function ku(n){return n instanceof F}function fn(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function vu(n,e=null){if(!e)return null;const t=j.atStart(n),r=j.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,s=r.to;return e==="all"?F.create(n,fn(0,i,s),fn(n.content.size,i,s)):F.create(n,fn(e,i,s),fn(e,i,s))}function Ql(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function wi(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function hb(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var fb=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(wi()||Ql())&&r.dom.focus(),hb()&&!wi()&&!Ql()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!ku(t.state.selection))return o(),!0;const a=vu(i.doc,n)||t.state.selection,l=t.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},pb=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),mb=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Eu=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Eu(r)}return n};function Jr(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=(new window.DOMParser).parseFromString(e,"text/html").body;return Eu(t)}function Mr(n,e,t){if(n instanceof dt||n instanceof w)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return w.fromArray(n.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),Mr("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const l=new sd({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?qt.fromSchema(l).parseSlice(Jr(n),t.parseOptions):qt.fromSchema(l).parse(Jr(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=qt.fromSchema(e);return t.slice?s.parseSlice(Jr(n),t.parseOptions).content:s.parse(Jr(n),t.parseOptions)}return Mr("",e,t)}function gb(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof Me||i instanceof Ce))return;const s=n.mapping.maps[r];let o=0;s.forEach((a,l,c,d)=>{o===0&&(o=d)}),n.setSelection(j.near(n.doc.resolve(o),t))}var bb=n=>!("type"in n),yb=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Mr(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{a=Mr(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(g){return l(g),!1}let{from:d,to:u}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,f=!0;if((bb(a)?a:[a]).forEach(g=>{g.check(),h=h?g.isText&&g.marks.length===0:!1,f=f?g.isBlock:!1}),d===u&&f){const{parent:g}=r.doc.resolve(d);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(d-=1,u+=1)}let m;if(h){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof w){let g="";e.forEach(b=>{b.text&&(g+=b.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,d,u)}else{m=a;const g=r.doc.resolve(d),b=g.node(),k=g.parentOffset===0,E=b.isText||b.isTextblock,x=b.content.size>0;k&&E&&x&&(d=Math.max(0,d-1)),r.replaceWith(d,u,m)}t.updateSelection&&gb(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:m}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:m})}return!0},kb=()=>({state:n,dispatch:e})=>Wp(n,e),vb=()=>({state:n,dispatch:e})=>jp(n,e),Eb=()=>({state:n,dispatch:e})=>Td(n,e),xb=()=>({state:n,dispatch:e})=>Nd(n,e),Sb=()=>({state:n,dispatch:e,tr:t})=>{try{const r=as(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},wb=()=>({state:n,dispatch:e,tr:t})=>{try{const r=as(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},Tb=()=>({state:n,dispatch:e})=>Vp(n,e),Mb=()=>({state:n,dispatch:e})=>Kp(n,e);function xu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Cb(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))wi()||xu()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var Ab=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const s=Cb(n).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l?.steps.forEach(c=>{const d=c.map(r.mapping);d&&i&&r.maybeStep(d)}),!0};function Qt(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?Ee(e,n.schema):null,a=[];n.doc.nodesBetween(r,i,(u,h)=>{if(u.isText)return;const f=Math.max(r,h),p=Math.min(i,h+u.nodeSize);a.push({node:u,from:f,to:p})});const l=i-r,c=a.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>Si(u.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((u,h)=>u+h.to-h.from,0)>=l}var Nb=(n,e={})=>({state:t,dispatch:r})=>{const i=Ee(n,t.schema);return Qt(t,i,e)?qp(t,r):!1},_b=()=>({state:n,dispatch:e})=>Ld(n,e),Ob=n=>({state:e,dispatch:t})=>{const r=Ee(n,e.schema);return sm(r)(e,t)},Ib=()=>({state:n,dispatch:e})=>Od(n,e);function ms(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function ec(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}var Lb=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=ms(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(s=Ee(n,r.schema)),a==="mark"&&(o=It(n,r.schema));let l=!1;return t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,u)=>{s&&s===d.type&&(l=!0,i&&t.setNodeMarkup(u,void 0,ec(d.attrs,e))),o&&d.marks.length&&d.marks.forEach(h=>{o===h.type&&(l=!0,i&&t.addMark(u,u+d.nodeSize,o.create(ec(h.attrs,e))))})})}),l},Rb=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Db=()=>({tr:n,dispatch:e})=>{if(e){const t=new Ye(n.doc);n.setSelection(t)}return!0},$b=()=>({state:n,dispatch:e})=>Cd(n,e),Pb=()=>({state:n,dispatch:e})=>_d(n,e),Bb=()=>({state:n,dispatch:e})=>Yp(n,e),zb=()=>({state:n,dispatch:e})=>em(n,e),Hb=()=>({state:n,dispatch:e})=>Qp(n,e);function xo(n,e,t={},r={}){return Mr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Fb=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(r.preserveWhitespace!=="full"){const c=xo(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:l.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function Su(n,e){const t=It(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function wu(n,e){const t=new Ed(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function Ub(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function So(n,e){const t=[];return n.descendants((r,i)=>{e(r)&&t.push({node:r,pos:i})}),t}function Vb(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function Kb(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function gs(n){return e=>Kb(e.$from,n)}function $(n,e,t){return n.config[e]===void 0&&n.parent?$(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?$(n.parent,e,t):null}):n.config[e]}function la(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=$(e,"addExtensions",t);return r?[e,...la(r())]:e}).flat(10)}function ca(n,e){const t=An.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function Tu(n){return typeof n=="function"}function Q(n,e=void 0,...t){return Tu(n)?e?n.bind(e)(...t):n(...t):n}function Wb(n={}){return Object.keys(n).length===0&&n.constructor===Object}function qn(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function Mu(n){const e=[],{nodeExtensions:t,markExtensions:r}=qn(n),i=[...t,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=$(o,"addGlobalAttributes",a);if(!l)return;l().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([h,f])=>{e.push({type:u,name:h,attribute:{...s,...f}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=$(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([d,u])=>{const h={...s,...u};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:o.name,name:d,attribute:h})})}),e}function de(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(d=>!l.includes(d));r[i]=[...l,...c].join(" ")}else if(i==="style"){const a=s?s.split(";").map(d=>d.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;l.forEach(d=>{const[u,h]=d.split(":").map(f=>f.trim());c.set(u,h)}),a.forEach(d=>{const[u,h]=d.split(":").map(f=>f.trim());c.set(u,h)}),r[i]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ")}else r[i]=s}),r},{})}function Cr(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>de(t,r),{})}function jb(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function tc(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):jb(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function nc(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Wb(t)?!1:t!=null))}function rc(n){var e,t;const r={};return!((e=n?.attribute)!=null&&e.isRequired)&&"default"in(n?.attribute||{})&&(r.default=n.attribute.default),((t=n?.attribute)==null?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function qb(n,e){var t;const r=Mu(n),{nodeExtensions:i,markExtensions:s}=qn(n),o=(t=i.find(c=>$(c,"topNode")))==null?void 0:t.name,a=Object.fromEntries(i.map(c=>{const d=r.filter(b=>b.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=n.reduce((b,k)=>{const E=$(k,"extendNodeSchema",u);return{...b,...E?E(c):{}}},{}),f=nc({...h,content:Q($(c,"content",u)),marks:Q($(c,"marks",u)),group:Q($(c,"group",u)),inline:Q($(c,"inline",u)),atom:Q($(c,"atom",u)),selectable:Q($(c,"selectable",u)),draggable:Q($(c,"draggable",u)),code:Q($(c,"code",u)),whitespace:Q($(c,"whitespace",u)),linebreakReplacement:Q($(c,"linebreakReplacement",u)),defining:Q($(c,"defining",u)),isolating:Q($(c,"isolating",u)),attrs:Object.fromEntries(d.map(rc))}),p=Q($(c,"parseHTML",u));p&&(f.parseDOM=p.map(b=>tc(b,d)));const m=$(c,"renderHTML",u);m&&(f.toDOM=b=>m({node:b,HTMLAttributes:Cr(b,d)}));const g=$(c,"renderText",u);return g&&(f.toText=g),[c.name,f]})),l=Object.fromEntries(s.map(c=>{const d=r.filter(g=>g.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=n.reduce((g,b)=>{const k=$(b,"extendMarkSchema",u);return{...g,...k?k(c):{}}},{}),f=nc({...h,inclusive:Q($(c,"inclusive",u)),excludes:Q($(c,"excludes",u)),group:Q($(c,"group",u)),spanning:Q($(c,"spanning",u)),code:Q($(c,"code",u)),attrs:Object.fromEntries(d.map(rc))}),p=Q($(c,"parseHTML",u));p&&(f.parseDOM=p.map(g=>tc(g,d)));const m=$(c,"renderHTML",u);return m&&(f.toDOM=g=>m({mark:g,HTMLAttributes:Cr(g,d)})),[c.name,f]}));return new sd({topNode:o,nodes:a,marks:l})}function Gb(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function Ti(n){return n.sort((t,r)=>{const i=$(t,"priority")||100,s=$(r,"priority")||100;return i>s?-1:i<s?1:0})}function Cu(n){const e=Ti(la(n)),t=Gb(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Au(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=`\n\n`,textSerializers:o={}}=t||{};let a="";return n.nodesBetween(r,i,(l,c,d,u)=>{var h;l.isBlock&&c>r&&(a+=s);const f=o?.[l.type.name];if(f)return d&&(a+=f({node:l,pos:c,parent:d,index:u,range:e})),!1;l.isText&&(a+=(h=l?.text)==null?void 0:h.slice(Math.max(r,c)-c,i-c))}),a}function Jb(n,e){const t={from:0,to:n.content.size};return Au(n,t,e)}function Nu(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Zb(n,e){const t=Ee(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function _u(n,e){const t=ms(typeof e=="string"?e:e.name,n.schema);return t==="node"?Zb(n,e):t==="mark"?Su(n,e):{}}function Yb(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function Xb(n){const e=Yb(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function Ou(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=t[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),d=e.slice(s).map(l),u=e.invert().map(c,-1),h=e.invert().map(d);r.push({oldRange:{from:u,to:h},newRange:{from:c,to:d}})})}),Xb(r)}function da(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n),o=jn(s,i.type);o&&r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var Qb=(n,e,t,r=20)=>{const i=n.doc.resolve(t);let s=r,o=null;for(;s>0&&o===null;){const a=i.node(s);a?.type.name===e?o=a:s-=1}return[o,s]};function Zr(n,e){return e.nodes[n]||e.marks[n]||null}function li(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var ey=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,c;const d=((c=(l=i.type.spec).toText)==null?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,r-s))}),t};function wo(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?It(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>s?s.name===u.type.name:!0).find(u=>Si(u.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:u,$to:h})=>{const f=u.pos,p=h.pos;n.doc.nodesBetween(f,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(f,g),k=Math.min(p,g+m.nodeSize),E=k-b;o+=E,a.push(...m.marks.map(x=>({mark:x,from:b,to:k})))})}),o===0)return!1;const l=a.filter(u=>s?s.name===u.mark.type.name:!0).filter(u=>Si(u.mark.attrs,t,{strict:!1})).reduce((u,h)=>u+h.to-h.from,0),c=a.filter(u=>s?u.mark.type!==s&&u.mark.type.excludes(s):!0).reduce((u,h)=>u+h.to-h.from,0);return(l>0?l+c:l)>=o}function ty(n,e,t={}){if(!e)return Qt(n,null,t)||wo(n,null,t);const r=ms(e,n.schema);return r==="node"?Qt(n,e,t):r==="mark"?wo(n,e,t):!1}var ny=(n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const s=gs(a=>a.type.name===e)(n.selection);if(!s)return!1;const o=n.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},ry=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function ic(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function sc(n,e){const{nodeExtensions:t}=qn(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=Q($(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function bs(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(s=>{i!==!1&&(bs(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Iu(n){return n instanceof B}var Lu=class Ru{constructor(e){this.position=e}static fromJSON(e){return new Ru(e.position)}toJSON(){return{position:this.position}}};function iy(n,e){const t=e.mapping.mapResult(n.position);return{position:new Lu(t.pos),mapResult:t}}function sy(n){return new Lu(n)}function oy(n,e,t){var r;const{selection:i}=e;let s=null;if(ku(i)&&(s=i.$cursor),s){const a=(r=n.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(c=>c.type.excludes(t)))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.pos,(d,u,h)=>{if(c)return!1;if(d.isInline){const f=!h||h.type.allowsMarkType(t),p=!!t.isInSet(d.marks)||!d.marks.some(m=>m.type.excludes(t));c=f&&p}return!c}),c})}var ay=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=It(n,r.schema);if(i)if(o){const c=Su(r,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(h,f)=>{const p=Math.max(f,d),m=Math.min(f+h.nodeSize,u);h.marks.find(b=>b.type===l)?h.marks.forEach(b=>{l===b.type&&t.addMark(p,m,l.create({...b.attrs,...e}))}):t.addMark(p,m,l.create(e))})});return oy(r,t,l)},ly=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),cy=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=Ee(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>yl(s,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>yl(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},dy=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=fn(n,0,r.content.size),s=B.create(r,i);e.setSelection(s)}return!0},uy=(n,e)=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=s.from,a=s.to),i&&t.doc.nodesBetween(o,a,(l,c)=>{l.isText||t.setNodeMarkup(c,void 0,{...l.attrs,dir:n})}),!0},hy=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=F.atStart(r).from,a=F.atEnd(r).to,l=fn(i,o,a),c=fn(s,o,a),d=F.create(r,l,c);e.setSelection(d)}return!0},fy=n=>({state:e,dispatch:t})=>{const r=Ee(n,e.schema);return lm(r)(e,t)};function oc(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}var py=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,d=li(c,a.node().type.name,a.node().attrs);if(s instanceof B&&s.node.isBlock)return!a.parentOffset||!_t(o,a.pos)?!1:(r&&(n&&oc(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:Ub(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=u&&h?[{type:h,attrs:d}]:void 0,p=_t(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!p&&_t(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:d}]:void 0),r){if(p&&(s instanceof F&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!u&&!a.parentOffset&&a.parent.type!==h)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}n&&oc(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},my=(n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var o;const a=Ee(n,r.schema),{$from:l,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;const h=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let b=w.empty;const k=l.index(-1)?1:l.index(-2)?2:3;for(let R=l.depth-k;R>=l.depth-3;R-=1)b=w.from(l.node(R).copy(b));const E=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,x={...li(h,l.node().type.name,l.node().attrs),...e},S=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(x))||void 0;b=b.append(w.from(a.createAndFill(null,S)||void 0));const C=l.before(l.depth-(k-1));t.replace(C,l.after(-E),new O(b,4-k,0));let A=-1;t.doc.nodesBetween(C,t.doc.content.size,(R,H)=>{if(A>-1)return!1;R.isTextblock&&R.content.size===0&&(A=H+1)}),A>-1&&t.setSelection(F.near(t.doc.resolve(A))),t.scrollIntoView()}return!0}const f=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...li(h,u.type.name,u.attrs),...e},m={...li(h,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const g=f?[{type:a,attrs:p},{type:f,attrs:m}]:[{type:a,attrs:p}];if(!_t(t.doc,l.pos,2))return!1;if(i){const{selection:b,storedMarks:k}=r,{splittableMarks:E}=s.extensionManager,x=k||b.$to.parentOffset&&b.$from.marks();if(t.split(l.pos,2,g).scrollIntoView(),!x||!i)return!0;const S=x.filter(C=>E.includes(C.type.name));t.ensureMarks(S)}return!0},js=(n,e)=>{const t=gs(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&tn(n.doc,t.pos)&&n.join(t.pos),!0},qs=(n,e)=>{const t=gs(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&tn(n.doc,r)&&n.join(r),!0},gy=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=i.extensionManager,f=Ee(n,o.schema),p=Ee(e,o.schema),{selection:m,storedMarks:g}=o,{$from:b,$to:k}=m,E=b.blockRange(k),x=g||m.$to.parentOffset&&m.$from.marks();if(!E)return!1;const S=gs(C=>sc(C.type.name,u))(m);if(E.depth>=1&&S&&E.depth-S.depth<=1){if(S.node.type===f)return c.liftListItem(p);if(sc(S.node.type.name,u)&&f.validContent(S.node.content)&&a)return l().command(()=>(s.setNodeMarkup(S.pos,f),!0)).command(()=>js(s,f)).command(()=>qs(s,f)).run()}return!t||!x||!a?l().command(()=>d().wrapInList(f,r)?!0:c.clearNodes()).wrapInList(f,r).command(()=>js(s,f)).command(()=>qs(s,f)).run():l().command(()=>{const C=d().wrapInList(f,r),A=x.filter(R=>h.includes(R.type.name));return s.ensureMarks(A),C?!0:c.clearNodes()}).wrapInList(f,r).command(()=>js(s,f)).command(()=>qs(s,f)).run()},by=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=It(n,r.schema);return wo(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},yy=(n,e,t={})=>({state:r,commands:i})=>{const s=Ee(n,r.schema),o=Ee(e,r.schema),a=Qt(r,s,t);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...t})},ky=(n,e={})=>({state:t,commands:r})=>{const i=Ee(n,t.schema);return Qt(t,i,e)?r.lift(i):r.wrapIn(i,e)},vy=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let s;if(i.spec.isInputRules&&(s=i.getState(n))){if(e){const o=n.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},Ey=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},xy=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=It(n,r.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&o){let{from:h,to:f}=a;const p=(s=c.marks().find(g=>g.type===l))==null?void 0:s.attrs,m=jn(c,l,p);m&&(h=m.from,f=m.to),t.removeMark(h,f,l)}else u.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,l)});return t.removeStoredMark(l),!0},Sy=n=>({tr:e,state:t,dispatch:r})=>{const{selection:i}=t;let s,o;return typeof n=="number"?(s=n,o=n):n&&"from"in n&&"to"in n?(s=n.from,o=n.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},wy=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=ms(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(s=Ee(n,r.schema)),a==="mark"&&(o=It(n,r.schema));let l=!1;return t.selection.ranges.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;let h,f,p,m;t.selection.empty?r.doc.nodesBetween(d,u,(g,b)=>{s&&s===g.type&&(l=!0,p=Math.max(b,d),m=Math.min(b+g.nodeSize,u),h=b,f=g)}):r.doc.nodesBetween(d,u,(g,b)=>{b<d&&s&&s===g.type&&(l=!0,p=Math.max(b,d),m=Math.min(b+g.nodeSize,u),h=b,f=g),b>=d&&b<=u&&(s&&s===g.type&&(l=!0,i&&t.setNodeMarkup(b,void 0,{...g.attrs,...e})),o&&g.marks.length&&g.marks.forEach(k=>{if(o===k.type&&(l=!0,i)){const E=Math.max(b,d),x=Math.min(b+g.nodeSize,u);t.addMark(E,x,o.create({...k.attrs,...e}))}}))}),f&&(h!==void 0&&i&&t.setNodeMarkup(h,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&i&&t.addMark(p,m,o.create({...g.attrs,...e}))}))}),l},Ty=(n,e={})=>({state:t,dispatch:r})=>{const i=Ee(n,t.schema);return tm(i,e)(t,r)},My=(n,e={})=>({state:t,dispatch:r})=>{const i=Ee(n,t.schema);return nm(i,e)(t,r)},Cy=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},ys=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},Ay=(n,e)=>{if(aa(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function Yr(n){var e;const{editor:t,from:r,to:i,text:s,rules:o,plugin:a}=n,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let d=!1;const u=ey(c)+s;return o.forEach(h=>{if(d)return;const f=Ay(u,h.find);if(!f)return;const p=l.state.tr,m=fs({state:l.state,transaction:p}),g={from:r-(f[0].length-s.length),to:i},{commands:b,chain:k,can:E}=new ps({editor:t,state:m});h.handler({state:m,range:g,match:f,commands:b,chain:k,can:E})===null||!p.steps.length||(h.undoable&&p.setMeta(a,{transform:p,from:r,to:i,text:s}),l.dispatch(p),d=!0)}),d}function Ny(n){const{editor:e,rules:t}=n,r=new ne({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=ca(w.from(d),o.schema);const{from:u}=l,h=u+d.length;Yr({editor:e,from:u,to:h,text:d,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Yr({editor:e,from:s,to:o,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Yr({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Yr({editor:e,from:o.pos,to:o.pos,text:`\n`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function _y(n){return Object.prototype.toString.call(n).slice(8,-1)}function Xr(n){return _y(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Du(n,e){const t={...n};return Xr(n)&&Xr(e)&&Object.keys(e).forEach(r=>{Xr(e[r])&&Xr(n[r])?t[r]=Du(n[r],e[r]):t[r]=e[r]}),t}var ua=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...Q($(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Q($(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Du(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},it=class $u extends ua{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new $u(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>c?.type.name===t.name))return!1;const l=o.find(c=>c?.type.name===t.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Oy(n){return typeof n=="number"}var Iy=class{constructor(n){this.find=n.find,this.handler=n.handler}},Ly=(n,e,t)=>{if(aa(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function Ry(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=n,{commands:l,chain:c,can:d}=new ps({editor:e,state:t}),u=[];return t.doc.nodesBetween(r,i,(f,p)=>{var m,g,b,k,E;if((g=(m=f.type)==null?void 0:m.spec)!=null&&g.code||!(f.isText||f.isTextblock||f.isInline))return;const x=(E=(k=(b=f.content)==null?void 0:b.size)!=null?k:f.nodeSize)!=null?E:0,S=Math.max(r,p),C=Math.min(i,p+x);if(S>=C)return;const A=f.isText?f.text||"":f.textBetween(S-p,C-p,void 0,"");Ly(A,s.find,o).forEach(H=>{if(H.index===void 0)return;const te=S+H.index+1,re=te+H[0].length,ge={from:t.tr.mapping.map(te),to:t.tr.mapping.map(re)},we=s.handler({state:t,range:ge,match:H,commands:l,chain:c,can:d,pasteEvent:o,dropEvent:a});u.push(we)})}),u.every(f=>f!==null)}var Qr=null,Dy=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function $y(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:d,from:u,to:h,rule:f,pasteEvt:p})=>{const m=d.tr,g=fs({state:d,transaction:m});if(!(!Ry({editor:e,state:g,from:Math.max(u-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(d=>new ne({view(u){const h=p=>{var m;r=(m=u.dom.parentElement)!=null&&m.contains(p.target)?u.dom.parentElement:null,r&&(Qr=e)},f=()=>{Qr&&(Qr=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(u,h)=>{if(s=r===u.dom.parentElement,a=h,!s){const f=Qr;f?.isEditable&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(u,h)=>{var f;const p=(f=h.clipboardData)==null?void 0:f.getData("text/html");return o=h,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(u,h,f)=>{const p=u[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,b=p.getMeta("applyPasteRules"),k=!!b;if(!m&&!g&&!k)return;if(k){let{text:S}=b;typeof S=="string"?S=S:S=ca(w.from(S),f.schema);const{from:C}=b,A=C+S.length,R=Dy(S);return l({rule:d,state:f,from:C,to:{b:A},pasteEvt:R})}const E=h.doc.content.findDiffStart(f.doc.content),x=h.doc.content.findDiffEnd(f.doc.content);if(!(!Oy(E)||!x||E===x.b))return l({rule:d,state:f,from:E,to:x,pasteEvt:o})}}))}var ks=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Cu(n),this.schema=qb(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Zr(e.name,this.schema)},r=$(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return Ti([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Zr(r.name,this.schema)},s=[],o=$(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&$(r,"exitable",i)&&(a.ArrowRight=()=>it.handleExit({editor:n,mark:r})),o){const h=Object.fromEntries(Object.entries(o()).map(([f,p])=>[f,()=>p({editor:n})]));a={...a,...h}}const l=Zg(a);s.push(l);const c=$(r,"addInputRules",i);if(ic(r,n.options.enableInputRules)&&c){const h=c();if(h&&h.length){const f=Ny({editor:n,rules:h}),p=Array.isArray(f)?f:[f];s.push(...p)}}const d=$(r,"addPasteRules",i);if(ic(r,n.options.enablePasteRules)&&d){const h=d();if(h&&h.length){const f=$y({editor:n,rules:h});s.push(...f)}}const u=$(r,"addProseMirrorPlugins",i);if(u){const h=u();s.push(...h)}return s})}get attributes(){return Mu(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=qn(this.extensions);return Object.fromEntries(e.filter(t=>!!$(t,"addNodeView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:Ee(t.name,this.schema)},s=$(t,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const a=(l,c,d,u,h)=>{const f=Cr(l,r);return o({node:l,view:c,getPos:d,decorations:u,innerDecorations:h,editor:n,extension:t,HTMLAttributes:f})};return[t.name,a]}))}dispatchTransaction(n){const{editor:e}=this;return Ti([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Zr(i.name,this.schema)},o=$(i,"dispatchTransaction",s);return o?a=>{o.call(s,{transaction:a,next:r})}:r},n)}get markViews(){const{editor:n}=this,{markExtensions:e}=qn(this.extensions);return Object.fromEntries(e.filter(t=>!!$(t,"addMarkView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:It(t.name,this.schema)},s=$(t,"addMarkView",i);if(!s)return[];const o=(a,l,c)=>{const d=Cr(a,r);return s()({mark:a,view:l,inline:c,editor:n,extension:t,HTMLAttributes:d,updateAttributes:u=>{Zy(a,n,u)}})};return[t.name,o]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Zr(e.name,this.schema)};e.type==="mark"&&((t=Q($(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const i=$(e,"onBeforeCreate",r),s=$(e,"onCreate",r),o=$(e,"onUpdate",r),a=$(e,"onSelectionUpdate",r),l=$(e,"onTransaction",r),c=$(e,"onFocus",r),d=$(e,"onBlur",r),u=$(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u)})}};ks.resolve=Cu;ks.sort=Ti;ks.flatten=la;var Py={};oa(Py,{ClipboardTextSerializer:()=>Bu,Commands:()=>zu,Delete:()=>Hu,Drop:()=>Fu,Editable:()=>Uu,FocusEvents:()=>Ku,Keymap:()=>Wu,Paste:()=>ju,Tabindex:()=>qu,TextDirection:()=>Gu,focusEventsPluginKey:()=>Vu});var ee=class Pu extends ua{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Pu(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Bu=ee.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ne({key:new ce("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(d=>d.$from.pos)),a=Math.max(...s.map(d=>d.$to.pos)),l=Nu(t);return Au(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),zu=ee.create({name:"commands",addCommands(){return{...bu}}}),Hu=ee.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;const s=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,n))!=null?c:n.getMeta("y-sync$"))return;const d=wu(n.before,[n,...e]);Ou(d).forEach(f=>{d.mapping.mapResult(f.oldRange.from).deletedAfter&&d.mapping.mapResult(f.oldRange.to).deletedBefore&&d.before.nodesBetween(f.oldRange.from,f.oldRange.to,(p,m)=>{const g=m+p.nodeSize-2,b=f.oldRange.from<=m&&g<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:g,newFrom:d.mapping.map(m),newTo:d.mapping.map(g),deletedRange:f.oldRange,newRange:f.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:d})})});const h=d.mapping;d.steps.forEach((f,p)=>{var m,g;if(f instanceof ct){const b=h.slice(p).map(f.from,-1),k=h.slice(p).map(f.to),E=h.invert().map(b,-1),x=h.invert().map(k),S=(m=d.doc.nodeAt(b-1))==null?void 0:m.marks.some(A=>A.eq(f.mark)),C=(g=d.doc.nodeAt(k))==null?void 0:g.marks.some(A=>A.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:E,to:x},newRange:{from:b,to:k},partial:!!(C||S),editor:this.editor,transaction:n,combinedTransform:d})}})};(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),Fu=ee.create({name:"drop",addProseMirrorPlugins(){return[new ne({key:new ce("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Uu=ee.create({name:"editable",addProseMirrorPlugins(){return[new ne({key:new ce("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Vu=new ce("focusEvents"),Ku=ee.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ne({key:Vu,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Wu=ee.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:d,$anchor:u}=l,{pos:h,parent:f}=u,p=u.parent.isTextblock&&h>0?a.doc.resolve(h-1):u,m=p.parent.type.spec.isolating,g=u.pos-u.parentOffset,b=m&&p.parent.childCount===1?g===u.pos:j.atStart(c).from===h;return!d||!f.type.isTextblock||f.textContent.length||!b||b&&u.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return wi()||xu()?s:i},addProseMirrorPlugins(){return[new ne({key:new ce("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(m=>m.getMeta("composition")))return;const r=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=n.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,l=j.atStart(e.doc).from,c=j.atEnd(e.doc).to;if(s||!(o===l&&a===c)||!bs(t.doc))return;const h=t.tr,f=fs({state:t,transaction:h}),{commands:p}=new ps({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),ju=ee.create({name:"paste",addProseMirrorPlugins(){return[new ne({key:new ce("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),qu=ee.create({name:"tabindex",addProseMirrorPlugins(){return[new ne({key:new ce("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Gu=ee.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=qn(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new ne({key:new ce("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),By=class Dn{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Dn(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Dn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Dn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=this.pos+r+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!i&&a.depth<=this.depth)return;const l=new Dn(a,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new Dn(a,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==t[l])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>t[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},zy=`.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}`;function Hy(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}var Fy=class extends Cy{constructor(n={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:iy,createMappablePosition:sy},this.setOptions(n),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),t=vu(e,this.options.autofocus);this.editorState=zn.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(n){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(n),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const n=this.editorView.dom;n?.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(n){console.warn("Failed to remove CSS element:",n)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=Hy(zy,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,e=!0){this.setOptions({editable:n}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in n)return Reflect.get(n,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(n,e){const t=Tu(e)?e(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(n).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;t=t.filter(o=>!o.key.startsWith(s))}),e.length===t.length)return;const r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}createExtensionManager(){var n,e;const r=[...this.options.enableCoreExtensions?[Uu,Bu.configure({blockSeparator:(e=(n=this.options.coreExtensionOptions)==null?void 0:n.clipboardTextSerializer)==null?void 0:e.blockSeparator}),zu,Ku,Wu,qu,Fu,ju,Hu,Gu.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new ks(r,this)}createCommandManager(){this.commandManager=new ps({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=xo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>t.name!=="collaboration"),this.createExtensionManager()}}),n=xo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return n}createView(n){const{editorProps:e,enableExtensionDispatchTransaction:t}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=t?this.extensionManager.dispatchTransaction(r):r;this.editorView=new mu(n,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(c=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(c)});return}const{state:e,transactions:t}=this.state.applyTransaction(n),r=!this.state.selection.eq(e.selection),i=t.includes(n),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:t.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});const o=t.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o?.getMeta("focus"),l=o?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(n.getMeta("preventUpdate")||!t.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:t.slice(1)})}getAttributes(n){return _u(this.state,n)}isActive(n,e){const t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return ty(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ca(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:e=`\n\n`,textSerializers:t={}}=n||{};return Jb(this.state.doc,{blockSeparator:e,textSerializers:{...Nu(this.schema),...t}})}get isEmpty(){return bs(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var n,e;return(e=(n=this.editorView)==null?void 0:n.isDestroyed)!=null?e:!0}$node(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(n,e))||null}$pos(n){const e=this.state.doc.resolve(n);return new By(e,this)}get $doc(){return this.$pos(0)}};function Gn(n){return new ys({find:n.find,handler:({state:e,range:t,match:r})=>{const i=Q(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=t.from+a.indexOf(o),d=c+o.length;if(da(t.from,t.to,e.doc).filter(f=>f.mark.type.excluded.find(m=>m===n.type&&m!==f.mark.type)).filter(f=>f.to>c).length)return null;d<t.to&&s.delete(d,t.to),c>t.from&&s.delete(t.from+l,c);const h=t.from+l+o.length;s.addMark(t.from+l,h,n.type.create(i||{})),s.removeStoredMark(n.type)}},undoable:n.undoable})}function Uy(n){return new ys({find:n.find,handler:({state:e,range:t,match:r})=>{const i=Q(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let a=t.to;const l=n.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let d=o+c;d>a?d=a:a=d+r[1].length;const u=r[0][r[0].length-1];s.insertText(u,o+r[0].length-1),s.replaceWith(d,a,l)}else if(r[0]){const c=n.type.isInline?o:o-1;s.insert(c,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()},undoable:n.undoable})}function To(n){return new ys({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=Q(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)},undoable:n.undoable})}function Jn(n){return new ys({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=Q(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),c=l&&Ko(l,n.type,s);if(!c)return null;if(o.wrap(l,c),n.keepMarks&&n.editor){const{selection:u,storedMarks:h}=e,{splittableMarks:f}=n.editor.extensionManager,p=h||u.$to.parentOffset&&u.$from.marks();if(p){const m=p.filter(g=>f.includes(g.type.name));o.ensureMarks(m)}}if(n.keepAttributes){const u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,s).run()}const d=o.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&tn(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&o.join(t.from-1)},undoable:n.undoable})}function Vy(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof B){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}var Ky={};oa(Ky,{createAtomBlockMarkdownSpec:()=>Wy,createBlockMarkdownSpec:()=>jy,createInlineMarkdownSpec:()=>Jy,parseAttributes:()=>ha,parseIndentedBlocks:()=>Mo,renderNestedMarkdownContent:()=>pa,serializeAttributes:()=>fa});function ha(n){if(!n?.trim())return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,c=>(t.push(c),`__QUOTED_${t.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const c=i.map(d=>d.trim().slice(1));e.class=c.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,d])=>{var u;const h=parseInt(((u=d.match(/__QUOTED_(\d+)__/))==null?void 0:u[1])||"0",10),f=t[h];f&&(e[c]=f.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function fa(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function Wy(n){const{nodeName:e,name:t,parseAttributes:r=ha,serializeAttributes:i=fa,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=n,l=t||e,c=d=>{if(!a)return d;const u={};return a.forEach(h=>{h in d&&(u[h]=d[h])}),u};return{parseMarkdown:(d,u)=>{const h={...s,...d.attributes};return u.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(d){var u;const h=new RegExp(`^:::${l}(?:\\s|$)`,"m"),f=(u=d.match(h))==null?void 0:u.index;return f!==void 0?f:-1},tokenize(d,u,h){const f=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=d.match(f);if(!p)return;const m=p[1]||"",g=r(m);if(!o.find(k=>!(k in g)))return{type:e,raw:p[0],attributes:g}}},renderMarkdown:d=>{const u=c(d.attrs||{}),h=i(u),f=h?` {${h}}`:"";return`:::${l}${f} :::`}}}function jy(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=ha,serializeAttributes:s=fa,defaultAttributes:o={},content:a="block",allowedAttributes:l}=n,c=t||e,d=u=>{if(!l)return u;const h={};return l.forEach(f=>{f in u&&(h[f]=u[f])}),h};return{parseMarkdown:(u,h)=>{let f;if(r){const m=r(u);f=typeof m=="string"?[{type:"text",text:m}]:m}else a==="block"?f=h.parseChildren(u.tokens||[]):f=h.parseInline(u.tokens||[]);const p={...o,...u.attributes};return h.createNode(e,p,f)},markdownTokenizer:{name:e,level:"block",start(u){var h;const f=new RegExp(`^:::${c}`,"m"),p=(h=u.match(f))==null?void 0:h.index;return p!==void 0?p:-1},tokenize(u,h,f){var p;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=u.match(m);if(!g)return;const[b,k=""]=g,E=i(k);let x=1;const S=b.length;let C="";const A=/^:::([\w-]*)(\s.*)?/gm,R=u.slice(S);for(A.lastIndex=0;;){const H=A.exec(R);if(H===null)break;const te=H.index,re=H[1];if(!((p=H[2])!=null&&p.endsWith(":::"))){if(re)x+=1;else if(x-=1,x===0){const ge=R.slice(0,te);C=ge.trim();const we=u.slice(0,S+te+H[0].length);let Z=[];if(C)if(a==="block")for(Z=f.blockTokens(ge),Z.forEach(J=>{J.text&&(!J.tokens||J.tokens.length===0)&&(J.tokens=f.inlineTokens(J.text))});Z.length>0;){const J=Z[Z.length-1];if(J.type==="paragraph"&&(!J.text||J.text.trim()===""))Z.pop();else break}else Z=f.inlineTokens(C);return{type:e,raw:we,attributes:E,content:C,tokens:Z}}}}}},renderMarkdown:(u,h)=>{const f=d(u.attrs||{}),p=s(f),m=p?` {${p}}`:"",g=h.renderChildren(u.content||[],`\n\n`);return`:::${c}${m}\n\n${g}\n\n:::`}}}function qy(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,i,s,o]=r;e[i]=s||o,r=t.exec(n)}return e}function Gy(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function Jy(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=qy,serializeAttributes:s=Gy,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=n,c=t||e,d=h=>{if(!l)return h;const f={};return l.forEach(p=>{const m=typeof p=="string"?p:p.name,g=typeof p=="string"?void 0:p.skipIfDefault;if(m in h){const b=h[m];if(g!==void 0&&b===g)return;f[m]=b}}),f},u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,f)=>{const p={...o,...h.attributes};if(a)return f.createNode(e,p);const m=r?r(h):h.content||"";return m?f.createNode(e,p,[f.createTextNode(m)]):f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(h){const f=a?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),p=h.match(f),m=p?.index;return m!==void 0?m:-1},tokenize(h,f,p){const m=a?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),g=h.match(m);if(!g)return;let b="",k="";if(a){const[,x]=g;k=x}else{const[,x,S]=g;k=x,b=S||""}const E=i(k.trim());return{type:e,raw:g[0],content:b.trim(),attributes:E}}},renderMarkdown:h=>{let f="";r?f=r(h):h.content&&h.content.length>0&&(f=h.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const p=d(h.attrs||{}),m=s(p),g=m?` ${m}`:"";return a?`[${c}${g}]`:`[${c}${g}]${f}[/${c}]`}}}function Mo(n,e,t){var r,i,s,o;const a=n.split(`\n`),l=[];let c="",d=0;const u=e.baseIndentSize||2;for(;d<a.length;){const h=a[d],f=h.match(e.itemPattern);if(!f){if(l.length>0)break;if(h.trim()===""){d+=1,c=`${c}${h}\n`;continue}else return}const p=e.extractItemData(f),{indentLevel:m,mainContent:g}=p;c=`${c}${h}\n`;const b=[g];for(d+=1;d<a.length;){const S=a[d];if(S.trim()===""){const A=a.slice(d+1).findIndex(te=>te.trim()!=="");if(A===-1)break;if((((i=(r=a[d+1+A].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>m){b.push(S),c=`${c}${S}\n`,d+=1;continue}else break}if((((o=(s=S.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>m)b.push(S),c=`${c}${S}\n`,d+=1;else break}let k;const E=b.slice(1);if(E.length>0){const S=E.map(C=>C.slice(m+u)).join(`\n`);S.trim()&&(e.customNestedParser?k=e.customNestedParser(S):k=t.blockTokens(S))}const x=e.createToken(p,k);l.push(x)}if(l.length!==0)return{items:l,raw:c}}function pa(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const i=typeof t=="function"?t(r):t,[s,...o]=n.content,a=e.renderChildren([s]),l=[`${i}${a}`];return o&&o.length>0&&o.forEach(c=>{const d=e.renderChildren([c]);if(d){const u=d.split(`\n`).map(h=>h?e.indent(h):"").join(`\n`);l.push(u)}}),l.join(`\n`)}function Zy(n,e,t={}){const{state:r}=e,{doc:i,tr:s}=r,o=n;i.descendants((a,l)=>{const c=s.mapping.map(l),d=s.mapping.map(l)+a.nodeSize;let u=null;if(a.marks.forEach(f=>{if(f!==o)return!1;u=f}),!u)return;let h=!1;if(Object.keys(t).forEach(f=>{t[f]!==u.attrs[f]&&(h=!0)}),h){const f=n.type.create({...n.attrs,...t});s.removeMark(c,d,n.type),s.addMark(c,d,f)}}),s.docChanged&&e.view.dispatch(s)}var Le=class Ju extends ua{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Ju(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Tn(n){return new Iy({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const s=Q(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=t.to;if(a){const d=l.search(/\S/),u=t.from+l.indexOf(a),h=u+a.length;if(da(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>u).length)return null;h<t.to&&o.delete(h,t.to),u>t.from&&o.delete(t.from+d,u),c=t.from+d+a.length,o.addMark(t.from+d,c,n.type.create(s||{})),o.removeStoredMark(n.type)}}})}var Yy=/(^|[^`])`([^`]+)`(?!`)$/,Xy=/(^|[^`])`([^`]+)`(?!`)/g,Zu=it.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",de(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Gn({find:Yy,type:this.type})]},addPasteRules(){return[Tn({find:Xy,type:this.type})]}}),Qy=Zu,Gs=4,e0=/^```([a-z]+)?[\s\n]$/,t0=/^~~~([a-z]+)?[\s\n]$/,Yu=Le.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Gs,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const s=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",de(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="";const i=((t=n.attrs)==null?void 0:t.language)||"";return n.content?r=[`\`\`\`${i}`,e.renderChildren(n.content),"```"].join(`\n`):r=`\`\`\`${i}\n\n\`\`\``,r},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Gs,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const a=" ".repeat(t);return o?n.commands.insertContent(a):n.commands.command(({tr:l})=>{const{from:c,to:d}=i,f=r.doc.textBetween(c,d,`\n`,`\n`).split(`\n`).map(p=>a+p).join(`\n`);return l.replaceWith(c,d,r.schema.text(f)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Gs,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?n.commands.command(({tr:a})=>{var l;const{pos:c}=s,d=s.start(),u=s.end(),f=r.doc.textBetween(d,u,`\n`,`\n`).split(`\n`);let p=0,m=0;const g=c-d;for(let C=0;C<f.length;C+=1){if(m+f[C].length>=g){p=C;break}m+=f[C].length+1}const k=((l=f[p].match(/^ */))==null?void 0:l[0])||"",E=Math.min(k.length,t);if(E===0)return!0;let x=d;for(let C=0;C<p;C+=1)x+=f[C].length+1;return a.delete(x,x+E),c-x<=E&&a.setSelection(F.create(a.doc,x)),!0}):n.commands.command(({tr:a})=>{const{from:l,to:c}=i,h=r.doc.textBetween(l,c,`\n`,`\n`).split(`\n`).map(f=>{var p;const m=((p=f.match(/^ */))==null?void 0:p[0])||"",g=Math.min(m.length,t);return f.slice(g)}).join(`\n`);return a.replaceWith(l,c,r.schema.text(h)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`\n\n`);return!s||!o?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:r.nodeAt(a)?n.commands.command(({tr:c})=>(c.setSelection(j.near(r.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[To({find:e0,type:this.type,getAttributes:n=>({language:n[1]})}),To({find:t0,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new ne({key:new ce("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!t||!s)return!1;const{tr:o,schema:a}=n.state,l=a.text(t.replace(/\r\n?/g,`\n`));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(F.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),n0=Yu;function r0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Js,ac;function i0(){if(ac)return Js;ac=1;function n(y){return y instanceof Map?y.clear=y.delete=y.set=function(){throw new Error("map is read-only")}:y instanceof Set&&(y.add=y.clear=y.delete=function(){throw new Error("set is read-only")}),Object.freeze(y),Object.getOwnPropertyNames(y).forEach(v=>{const N=y[v],V=typeof N;(V==="object"||V==="function")&&!Object.isFrozen(N)&&n(N)}),y}class e{constructor(v){v.data===void 0&&(v.data={}),this.data=v.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(y){return y.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(y,...v){const N=Object.create(null);for(const V in y)N[V]=y[V];return v.forEach(function(V){for(const pe in V)N[pe]=V[pe]}),N}const i="</span>",s=y=>!!y.scope,o=(y,{prefix:v})=>{if(y.startsWith("language:"))return y.replace("language:","language-");if(y.includes(".")){const N=y.split(".");return[`${v}${N.shift()}`,...N.map((V,pe)=>`${V}${"_".repeat(pe+1)}`)].join(" ")}return`${v}${y}`};class a{constructor(v,N){this.buffer="",this.classPrefix=N.classPrefix,v.walk(this)}addText(v){this.buffer+=t(v)}openNode(v){if(!s(v))return;const N=o(v.scope,{prefix:this.classPrefix});this.span(N)}closeNode(v){s(v)&&(this.buffer+=i)}value(){return this.buffer}span(v){this.buffer+=`<span class="${v}">`}}const l=(y={})=>{const v={children:[]};return Object.assign(v,y),v};class c{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(v){this.top.children.push(v)}openNode(v){const N=l({scope:v});this.add(N),this.stack.push(N)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(v){return this.constructor._walk(v,this.rootNode)}static _walk(v,N){return typeof N=="string"?v.addText(N):N.children&&(v.openNode(N),N.children.forEach(V=>this._walk(v,V)),v.closeNode(N)),v}static _collapse(v){typeof v!="string"&&v.children&&(v.children.every(N=>typeof N=="string")?v.children=[v.children.join("")]:v.children.forEach(N=>{c._collapse(N)}))}}class d extends c{constructor(v){super(),this.options=v}addText(v){v!==""&&this.add(v)}startScope(v){this.openNode(v)}endScope(){this.closeNode()}__addSublanguage(v,N){const V=v.root;N&&(V.scope=`language:${N}`),this.add(V)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function u(y){return y?typeof y=="string"?y:y.source:null}function h(y){return m("(?=",y,")")}function f(y){return m("(?:",y,")*")}function p(y){return m("(?:",y,")?")}function m(...y){return y.map(N=>u(N)).join("")}function g(y){const v=y[y.length-1];return typeof v=="object"&&v.constructor===Object?(y.splice(y.length-1,1),v):{}}function b(...y){return"("+(g(y).capture?"":"?:")+y.map(V=>u(V)).join("|")+")"}function k(y){return new RegExp(y.toString()+"|").exec("").length-1}function E(y,v){const N=y&&y.exec(v);return N&&N.index===0}const x=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function S(y,{joinWith:v}){let N=0;return y.map(V=>{N+=1;const pe=N;let me=u(V),L="";for(;me.length>0;){const I=x.exec(me);if(!I){L+=me;break}L+=me.substring(0,I.index),me=me.substring(I.index+I[0].length),I[0][0]==="\\"&&I[1]?L+="\\"+String(Number(I[1])+pe):(L+=I[0],I[0]==="("&&N++)}return L}).map(V=>`(${V})`).join(v)}const C=/\b\B/,A="[a-zA-Z]\\w*",R="[a-zA-Z_]\\w*",H="\\b\\d+(\\.\\d+)?",te="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",re="\\b(0b[01]+)",ge="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",we=(y={})=>{const v=/^#![ ]*\//;return y.binary&&(y.begin=m(v,/.*\b/,y.binary,/\b.*/)),r({scope:"meta",begin:v,end:/$/,relevance:0,"on:begin":(N,V)=>{N.index!==0&&V.ignoreMatch()}},y)},Z={begin:"\\\\[\\s\\S]",relevance:0},J={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Z]},be={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Z]},st={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Y=function(y,v,N={}){const V=r({scope:"comment",begin:y,end:v,contains:[]},N);V.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const pe=b("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return V.contains.push({begin:m(/[ ]+/,"(",pe,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),V},He=Y("//","$"),Ge=Y("/\\*","\\*/"),ot=Y("#","$"),xt={scope:"number",begin:H,relevance:0},sn={scope:"number",begin:te,relevance:0},nf={scope:"number",begin:re,relevance:0},rf={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Z,{begin:/\[/,end:/\]/,relevance:0,contains:[Z]}]},sf={scope:"title",begin:A,relevance:0},of={scope:"title",begin:R,relevance:0},af={begin:"\\.\\s*"+R,relevance:0};var zr=Object.freeze({__proto__:null,APOS_STRING_MODE:J,BACKSLASH_ESCAPE:Z,BINARY_NUMBER_MODE:nf,BINARY_NUMBER_RE:re,COMMENT:Y,C_BLOCK_COMMENT_MODE:Ge,C_LINE_COMMENT_MODE:He,C_NUMBER_MODE:sn,C_NUMBER_RE:te,END_SAME_AS_BEGIN:function(y){return Object.assign(y,{"on:begin":(v,N)=>{N.data._beginMatch=v[1]},"on:end":(v,N)=>{N.data._beginMatch!==v[1]&&N.ignoreMatch()}})},HASH_COMMENT_MODE:ot,IDENT_RE:A,MATCH_NOTHING_RE:C,METHOD_GUARD:af,NUMBER_MODE:xt,NUMBER_RE:H,PHRASAL_WORDS_MODE:st,QUOTE_STRING_MODE:be,REGEXP_MODE:rf,RE_STARTERS_RE:ge,SHEBANG:we,TITLE_MODE:sf,UNDERSCORE_IDENT_RE:R,UNDERSCORE_TITLE_MODE:of});function lf(y,v){y.input[y.index-1]==="."&&v.ignoreMatch()}function cf(y,v){y.className!==void 0&&(y.scope=y.className,delete y.className)}function df(y,v){v&&y.beginKeywords&&(y.begin="\\b("+y.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",y.__beforeBegin=lf,y.keywords=y.keywords||y.beginKeywords,delete y.beginKeywords,y.relevance===void 0&&(y.relevance=0))}function uf(y,v){Array.isArray(y.illegal)&&(y.illegal=b(...y.illegal))}function hf(y,v){if(y.match){if(y.begin||y.end)throw new Error("begin & end are not supported with match");y.begin=y.match,delete y.match}}function ff(y,v){y.relevance===void 0&&(y.relevance=1)}const pf=(y,v)=>{if(!y.beforeMatch)return;if(y.starts)throw new Error("beforeMatch cannot be used with starts");const N=Object.assign({},y);Object.keys(y).forEach(V=>{delete y[V]}),y.keywords=N.keywords,y.begin=m(N.beforeMatch,h(N.begin)),y.starts={relevance:0,contains:[Object.assign(N,{endsParent:!0})]},y.relevance=0,delete N.beforeMatch},mf=["of","and","for","in","not","or","if","then","parent","list","value"],gf="keyword";function $a(y,v,N=gf){const V=Object.create(null);return typeof y=="string"?pe(N,y.split(" ")):Array.isArray(y)?pe(N,y):Object.keys(y).forEach(function(me){Object.assign(V,$a(y[me],v,me))}),V;function pe(me,L){v&&(L=L.map(I=>I.toLowerCase())),L.forEach(function(I){const U=I.split("|");V[U[0]]=[me,bf(U[0],U[1])]})}}function bf(y,v){return v?Number(v):yf(y)?0:1}function yf(y){return mf.includes(y.toLowerCase())}const Pa={},on=y=>{console.error(y)},Ba=(y,...v)=>{console.log(`WARN: ${y}`,...v)},Nn=(y,v)=>{Pa[`${y}/${v}`]||(console.log(`Deprecated as of ${y}. ${v}`),Pa[`${y}/${v}`]=!0)},Hr=new Error;function za(y,v,{key:N}){let V=0;const pe=y[N],me={},L={};for(let I=1;I<=v.length;I++)L[I+V]=pe[I],me[I+V]=!0,V+=k(v[I-1]);y[N]=L,y[N]._emit=me,y[N]._multi=!0}function kf(y){if(Array.isArray(y.begin)){if(y.skip||y.excludeBegin||y.returnBegin)throw on("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Hr;if(typeof y.beginScope!="object"||y.beginScope===null)throw on("beginScope must be object"),Hr;za(y,y.begin,{key:"beginScope"}),y.begin=S(y.begin,{joinWith:""})}}function vf(y){if(Array.isArray(y.end)){if(y.skip||y.excludeEnd||y.returnEnd)throw on("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Hr;if(typeof y.endScope!="object"||y.endScope===null)throw on("endScope must be object"),Hr;za(y,y.end,{key:"endScope"}),y.end=S(y.end,{joinWith:""})}}function Ef(y){y.scope&&typeof y.scope=="object"&&y.scope!==null&&(y.beginScope=y.scope,delete y.scope)}function xf(y){Ef(y),typeof y.beginScope=="string"&&(y.beginScope={_wrap:y.beginScope}),typeof y.endScope=="string"&&(y.endScope={_wrap:y.endScope}),kf(y),vf(y)}function Sf(y){function v(L,I){return new RegExp(u(L),"m"+(y.case_insensitive?"i":"")+(y.unicodeRegex?"u":"")+(I?"g":""))}class N{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(I,U){U.position=this.position++,this.matchIndexes[this.matchAt]=U,this.regexes.push([U,I]),this.matchAt+=k(I)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const I=this.regexes.map(U=>U[1]);this.matcherRe=v(S(I,{joinWith:"|"}),!0),this.lastIndex=0}exec(I){this.matcherRe.lastIndex=this.lastIndex;const U=this.matcherRe.exec(I);if(!U)return null;const Te=U.findIndex((Qn,Ts)=>Ts>0&&Qn!==void 0),ye=this.matchIndexes[Te];return U.splice(0,Te),Object.assign(U,ye)}}class V{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(I){if(this.multiRegexes[I])return this.multiRegexes[I];const U=new N;return this.rules.slice(I).forEach(([Te,ye])=>U.addRule(Te,ye)),U.compile(),this.multiRegexes[I]=U,U}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(I,U){this.rules.push([I,U]),U.type==="begin"&&this.count++}exec(I){const U=this.getMatcher(this.regexIndex);U.lastIndex=this.lastIndex;let Te=U.exec(I);if(this.resumingScanAtSamePosition()&&!(Te&&Te.index===this.lastIndex)){const ye=this.getMatcher(0);ye.lastIndex=this.lastIndex+1,Te=ye.exec(I)}return Te&&(this.regexIndex+=Te.position+1,this.regexIndex===this.count&&this.considerAll()),Te}}function pe(L){const I=new V;return L.contains.forEach(U=>I.addRule(U.begin,{rule:U,type:"begin"})),L.terminatorEnd&&I.addRule(L.terminatorEnd,{type:"end"}),L.illegal&&I.addRule(L.illegal,{type:"illegal"}),I}function me(L,I){const U=L;if(L.isCompiled)return U;[cf,hf,xf,pf].forEach(ye=>ye(L,I)),y.compilerExtensions.forEach(ye=>ye(L,I)),L.__beforeBegin=null,[df,uf,ff].forEach(ye=>ye(L,I)),L.isCompiled=!0;let Te=null;return typeof L.keywords=="object"&&L.keywords.$pattern&&(L.keywords=Object.assign({},L.keywords),Te=L.keywords.$pattern,delete L.keywords.$pattern),Te=Te||/\w+/,L.keywords&&(L.keywords=$a(L.keywords,y.case_insensitive)),U.keywordPatternRe=v(Te,!0),I&&(L.begin||(L.begin=/\B|\b/),U.beginRe=v(U.begin),!L.end&&!L.endsWithParent&&(L.end=/\B|\b/),L.end&&(U.endRe=v(U.end)),U.terminatorEnd=u(U.end)||"",L.endsWithParent&&I.terminatorEnd&&(U.terminatorEnd+=(L.end?"|":"")+I.terminatorEnd)),L.illegal&&(U.illegalRe=v(L.illegal)),L.contains||(L.contains=[]),L.contains=[].concat(...L.contains.map(function(ye){return wf(ye==="self"?L:ye)})),L.contains.forEach(function(ye){me(ye,U)}),L.starts&&me(L.starts,I),U.matcher=pe(U),U}if(y.compilerExtensions||(y.compilerExtensions=[]),y.contains&&y.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return y.classNameAliases=r(y.classNameAliases||{}),me(y)}function Ha(y){return y?y.endsWithParent||Ha(y.starts):!1}function wf(y){return y.variants&&!y.cachedVariants&&(y.cachedVariants=y.variants.map(function(v){return r(y,{variants:null},v)})),y.cachedVariants?y.cachedVariants:Ha(y)?r(y,{starts:y.starts?r(y.starts):null}):Object.isFrozen(y)?r(y):y}var Tf="11.11.1";class Mf extends Error{constructor(v,N){super(v),this.name="HTMLInjectionError",this.html=N}}const ws=t,Fa=r,Ua=Symbol("nomatch"),Cf=7,Va=function(y){const v=Object.create(null),N=Object.create(null),V=[];let pe=!0;const me="Could not find the language '{}', did you forget to load/include a language module?",L={disableAutodetect:!0,name:"Plain text",contains:[]};let I={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function U(M){return I.noHighlightRe.test(M)}function Te(M){let P=M.className+" ";P+=M.parentNode?M.parentNode.className:"";const G=I.languageDetectRe.exec(P);if(G){const se=Rt(G[1]);return se||(Ba(me.replace("{}",G[1])),Ba("Falling back to no-highlight mode for this block.",M)),se?G[1]:"no-highlight"}return P.split(/\s+/).find(se=>U(se)||Rt(se))}function ye(M,P,G){let se="",xe="";typeof P=="object"?(se=M,G=P.ignoreIllegals,xe=P.language):(Nn("10.7.0","highlight(lang, code, ...args) has been deprecated."),Nn("10.7.0",`Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277`),xe=M,se=P),G===void 0&&(G=!0);const at={code:se,language:xe};Ur("before:highlight",at);const Dt=at.result?at.result:Qn(at.language,at.code,G);return Dt.code=at.code,Ur("after:highlight",Dt),Dt}function Qn(M,P,G,se){const xe=Object.create(null);function at(_,D){return _.keywords[D]}function Dt(){if(!K.keywords){Ne.addText(oe);return}let _=0;K.keywordPatternRe.lastIndex=0;let D=K.keywordPatternRe.exec(oe),q="";for(;D;){q+=oe.substring(_,D.index);const X=ft.case_insensitive?D[0].toLowerCase():D[0],Re=at(K,X);if(Re){const[St,Kf]=Re;if(Ne.addText(q),q="",xe[X]=(xe[X]||0)+1,xe[X]<=Cf&&(Wr+=Kf),St.startsWith("_"))q+=D[0];else{const Wf=ft.classNameAliases[St]||St;ht(D[0],Wf)}}else q+=D[0];_=K.keywordPatternRe.lastIndex,D=K.keywordPatternRe.exec(oe)}q+=oe.substring(_),Ne.addText(q)}function Vr(){if(oe==="")return;let _=null;if(typeof K.subLanguage=="string"){if(!v[K.subLanguage]){Ne.addText(oe);return}_=Qn(K.subLanguage,oe,!0,Ya[K.subLanguage]),Ya[K.subLanguage]=_._top}else _=Ms(oe,K.subLanguage.length?K.subLanguage:null);K.relevance>0&&(Wr+=_.relevance),Ne.__addSublanguage(_._emitter,_.language)}function Je(){K.subLanguage!=null?Vr():Dt(),oe=""}function ht(_,D){_!==""&&(Ne.startScope(D),Ne.addText(_),Ne.endScope())}function qa(_,D){let q=1;const X=D.length-1;for(;q<=X;){if(!_._emit[q]){q++;continue}const Re=ft.classNameAliases[_[q]]||_[q],St=D[q];Re?ht(St,Re):(oe=St,Dt(),oe=""),q++}}function Ga(_,D){return _.scope&&typeof _.scope=="string"&&Ne.openNode(ft.classNameAliases[_.scope]||_.scope),_.beginScope&&(_.beginScope._wrap?(ht(oe,ft.classNameAliases[_.beginScope._wrap]||_.beginScope._wrap),oe=""):_.beginScope._multi&&(qa(_.beginScope,D),oe="")),K=Object.create(_,{parent:{value:K}}),K}function Ja(_,D,q){let X=E(_.endRe,q);if(X){if(_["on:end"]){const Re=new e(_);_["on:end"](D,Re),Re.isMatchIgnored&&(X=!1)}if(X){for(;_.endsParent&&_.parent;)_=_.parent;return _}}if(_.endsWithParent)return Ja(_.parent,D,q)}function zf(_){return K.matcher.regexIndex===0?(oe+=_[0],1):(_s=!0,0)}function Hf(_){const D=_[0],q=_.rule,X=new e(q),Re=[q.__beforeBegin,q["on:begin"]];for(const St of Re)if(St&&(St(_,X),X.isMatchIgnored))return zf(D);return q.skip?oe+=D:(q.excludeBegin&&(oe+=D),Je(),!q.returnBegin&&!q.excludeBegin&&(oe=D)),Ga(q,_),q.returnBegin?0:D.length}function Ff(_){const D=_[0],q=P.substring(_.index),X=Ja(K,_,q);if(!X)return Ua;const Re=K;K.endScope&&K.endScope._wrap?(Je(),ht(D,K.endScope._wrap)):K.endScope&&K.endScope._multi?(Je(),qa(K.endScope,_)):Re.skip?oe+=D:(Re.returnEnd||Re.excludeEnd||(oe+=D),Je(),Re.excludeEnd&&(oe=D));do{K.scope&&Ne.closeNode(),!K.skip&&!K.subLanguage&&(Wr+=K.relevance),K=K.parent}while(K!==X.parent);return X.starts&&Ga(X.starts,_),Re.returnEnd?0:D.length}function Uf(){const _=[];for(let D=K;D!==ft;D=D.parent)D.scope&&_.unshift(D.scope);_.forEach(D=>Ne.openNode(D))}let Kr={};function Za(_,D){const q=D&&D[0];if(oe+=_,q==null)return Je(),0;if(Kr.type==="begin"&&D.type==="end"&&Kr.index===D.index&&q===""){if(oe+=P.slice(D.index,D.index+1),!pe){const X=new Error(`0 width match regex (${M})`);throw X.languageName=M,X.badRule=Kr.rule,X}return 1}if(Kr=D,D.type==="begin")return Hf(D);if(D.type==="illegal"&&!G){const X=new Error('Illegal lexeme "'+q+'" for mode "'+(K.scope||"<unnamed>")+'"');throw X.mode=K,X}else if(D.type==="end"){const X=Ff(D);if(X!==Ua)return X}if(D.type==="illegal"&&q==="")return oe+=`\n`,1;if(Ns>1e5&&Ns>D.index*3)throw new Error("potential infinite loop, way more iterations than matches");return oe+=q,q.length}const ft=Rt(M);if(!ft)throw on(me.replace("{}",M)),new Error('Unknown language: "'+M+'"');const Vf=Sf(ft);let As="",K=se||Vf;const Ya={},Ne=new I.__emitter(I);Uf();let oe="",Wr=0,an=0,Ns=0,_s=!1;try{if(ft.__emitTokens)ft.__emitTokens(P,Ne);else{for(K.matcher.considerAll();;){Ns++,_s?_s=!1:K.matcher.considerAll(),K.matcher.lastIndex=an;const _=K.matcher.exec(P);if(!_)break;const D=P.substring(an,_.index),q=Za(D,_);an=_.index+q}Za(P.substring(an))}return Ne.finalize(),As=Ne.toHTML(),{language:M,value:As,relevance:Wr,illegal:!1,_emitter:Ne,_top:K}}catch(_){if(_.message&&_.message.includes("Illegal"))return{language:M,value:ws(P),illegal:!0,relevance:0,_illegalBy:{message:_.message,index:an,context:P.slice(an-100,an+100),mode:_.mode,resultSoFar:As},_emitter:Ne};if(pe)return{language:M,value:ws(P),illegal:!1,relevance:0,errorRaised:_,_emitter:Ne,_top:K};throw _}}function Ts(M){const P={value:ws(M),illegal:!1,relevance:0,_top:L,_emitter:new I.__emitter(I)};return P._emitter.addText(M),P}function Ms(M,P){P=P||I.languages||Object.keys(v);const G=Ts(M),se=P.filter(Rt).filter(ja).map(Je=>Qn(Je,M,!1));se.unshift(G);const xe=se.sort((Je,ht)=>{if(Je.relevance!==ht.relevance)return ht.relevance-Je.relevance;if(Je.language&&ht.language){if(Rt(Je.language).supersetOf===ht.language)return 1;if(Rt(ht.language).supersetOf===Je.language)return-1}return 0}),[at,Dt]=xe,Vr=at;return Vr.secondBest=Dt,Vr}function Af(M,P,G){const se=P&&N[P]||G;M.classList.add("hljs"),M.classList.add(`language-${se}`)}function Cs(M){let P=null;const G=Te(M);if(U(G))return;if(Ur("before:highlightElement",{el:M,language:G}),M.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",M);return}if(M.children.length>0&&(I.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(M)),I.throwUnescapedHTML))throw new Mf("One of your code blocks includes unescaped HTML.",M.innerHTML);P=M;const se=P.textContent,xe=G?ye(se,{language:G,ignoreIllegals:!0}):Ms(se);M.innerHTML=xe.value,M.dataset.highlighted="yes",Af(M,G,xe.language),M.result={language:xe.language,re:xe.relevance,relevance:xe.relevance},xe.secondBest&&(M.secondBest={language:xe.secondBest.language,relevance:xe.secondBest.relevance}),Ur("after:highlightElement",{el:M,result:xe,text:se})}function Nf(M){I=Fa(I,M)}const _f=()=>{Fr(),Nn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Of(){Fr(),Nn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Ka=!1;function Fr(){function M(){Fr()}if(document.readyState==="loading"){Ka||window.addEventListener("DOMContentLoaded",M,!1),Ka=!0;return}document.querySelectorAll(I.cssSelector).forEach(Cs)}function If(M,P){let G=null;try{G=P(y)}catch(se){if(on("Language definition for '{}' could not be registered.".replace("{}",M)),pe)on(se);else throw se;G=L}G.name||(G.name=M),v[M]=G,G.rawDefinition=P.bind(null,y),G.aliases&&Wa(G.aliases,{languageName:M})}function Lf(M){delete v[M];for(const P of Object.keys(N))N[P]===M&&delete N[P]}function Rf(){return Object.keys(v)}function Rt(M){return M=(M||"").toLowerCase(),v[M]||v[N[M]]}function Wa(M,{languageName:P}){typeof M=="string"&&(M=[M]),M.forEach(G=>{N[G.toLowerCase()]=P})}function ja(M){const P=Rt(M);return P&&!P.disableAutodetect}function Df(M){M["before:highlightBlock"]&&!M["before:highlightElement"]&&(M["before:highlightElement"]=P=>{M["before:highlightBlock"](Object.assign({block:P.el},P))}),M["after:highlightBlock"]&&!M["after:highlightElement"]&&(M["after:highlightElement"]=P=>{M["after:highlightBlock"](Object.assign({block:P.el},P))})}function $f(M){Df(M),V.push(M)}function Pf(M){const P=V.indexOf(M);P!==-1&&V.splice(P,1)}function Ur(M,P){const G=M;V.forEach(function(se){se[G]&&se[G](P)})}function Bf(M){return Nn("10.7.0","highlightBlock will be removed entirely in v12.0"),Nn("10.7.0","Please use highlightElement now."),Cs(M)}Object.assign(y,{highlight:ye,highlightAuto:Ms,highlightAll:Fr,highlightElement:Cs,highlightBlock:Bf,configure:Nf,initHighlighting:_f,initHighlightingOnLoad:Of,registerLanguage:If,unregisterLanguage:Lf,listLanguages:Rf,getLanguage:Rt,registerAliases:Wa,autoDetection:ja,inherit:Fa,addPlugin:$f,removePlugin:Pf}),y.debugMode=function(){pe=!1},y.safeMode=function(){pe=!0},y.versionString=Tf,y.regex={concat:m,lookahead:h,either:b,optional:p,anyNumberOfTimes:f};for(const M in zr)typeof zr[M]=="object"&&n(zr[M]);return Object.assign(y,zr),y},_n=Va({});return _n.newInstance=()=>Va({}),Js=_n,_n.HighlightJS=_n,_n.default=_n,Js}var s0=i0();const Xu=r0(s0);function Qu(n,e=[]){return n.flatMap(t=>{const r=[...e,...t.properties?t.properties.className:[]];return t.children?Qu(t.children,r):{text:t.value,classes:r}})}function lc(n){return n.value||n.children||[]}function o0(n){return!!Xu.getLanguage(n)}function cc({doc:n,name:e,lowlight:t,defaultLanguage:r}){const i=[];return So(n,s=>s.type.name===e).forEach(s=>{var o;let a=s.pos+1;const l=s.node.attrs.language||r,c=t.listLanguages(),d=l&&(c.includes(l)||o0(l)||(o=t.registered)!=null&&o.call(t,l))?lc(t.highlight(l,s.node.textContent)):lc(t.highlightAuto(s.node.textContent));Qu(d).forEach(u=>{const h=a+u.text.length;if(u.classes.length){const f=Pe.inline(a,h,{class:u.classes.join(" ")});i.push(f)}a=h})}),le.create(n,i)}function a0(n){return typeof n=="function"}function l0({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(i=>a0(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new ne({key:new ce("lowlight"),state:{init:(i,{doc:s})=>cc({doc:s,name:n,lowlight:e,defaultLanguage:t}),apply:(i,s,o,a)=>{const l=o.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,d=So(o.doc,h=>h.type.name===n),u=So(a.doc,h=>h.type.name===n);return i.docChanged&&([l,c].includes(n)||u.length!==d.length||i.steps.some(h=>h.from!==void 0&&h.to!==void 0&&d.some(f=>f.pos>=h.from&&f.pos+f.node.nodeSize<=h.to)))?cc({doc:i.doc,name:n,lowlight:e,defaultLanguage:t}):s.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var c0=n0.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],l0({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),d0=c0,eh=Le.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`\n\n`):""}),u0=eh,h0=Object.defineProperty,f0=(n,e)=>{for(var t in e)h0(n,t,{get:e[t],enumerable:!0})},p0="listItem",dc="textStyle",uc=/^\s*([-+*])\s$/,ma=Le.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",de(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`\n`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(p0,this.editor.getAttributes(dc)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Jn({find:uc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Jn({find:uc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(dc),editor:this.editor})),[n]}}),ga=Le.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",de(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(i=>i.type==="paragraph"))t=e.parseChildren(n.tokens);else{const i=n.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(i.tokens)}],n.tokens.length>1){const o=n.tokens.slice(1),a=e.parseChildren(o);t.push(...a)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>pa(n,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),m0={};f0(m0,{findListItemPos:()=>$r,getNextListDepth:()=>ba,handleBackspace:()=>Co,handleDelete:()=>Ao,hasListBefore:()=>th,hasListItemAfter:()=>g0,hasListItemBefore:()=>nh,listItemHasSubList:()=>rh,nextListIsDeeper:()=>ih,nextListIsHigher:()=>sh});var $r=(n,e)=>{const{$from:t}=e.selection,r=Ee(n,e.schema);let i=null,s=t.depth,o=t.pos,a=null;for(;s>0&&a===null;)i=t.node(s),i.type===r?a=s:(s-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},ba=(n,e)=>{const t=$r(n,e);if(!t)return!1;const[,r]=Qb(e,n,t.$pos.pos+4);return r},th=(n,e,t)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),s=n.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},nh=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},rh=(n,e,t)=>{if(!t)return!1;const r=Ee(n,e.schema);let i=!1;return t.descendants(s=>{s.type===r&&(i=!0)}),i},Co=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Qt(n.state,e)&&th(n.state,e,t)){const{$anchor:a}=n.state.selection,l=n.state.doc.resolve(a.before()-1),c=[];l.node().descendants((h,f)=>{h.type.name===e&&c.push({node:h,pos:f})});const d=c.at(-1);if(!d)return!1;const u=n.state.doc.resolve(l.start()+d.pos+1);return n.chain().cut({from:a.start()-1,to:a.end()+1},u.end()).joinForward().run()}if(!Qt(n.state,e)||!ry(n.state))return!1;const r=$r(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=rh(e,n.state,s);return nh(e,n.state)&&!o?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},ih=(n,e)=>{const t=ba(n,e),r=$r(n,e);return!r||!t?!1:t>r.depth},sh=(n,e)=>{const t=ba(n,e),r=$r(n,e);return!r||!t?!1:t<r.depth},Ao=(n,e)=>{if(!Qt(n.state,e)||!ny(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:ih(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():sh(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},g0=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},oh=ee.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Ao(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Ao(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Co(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Co(n,t,r)&&(e=!0)}),e}}}}),hc=/^(\s*)(\d+)\.\s+(.*)$/,b0=/^\s/;function y0(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t],s=i.match(hc);if(!s)break;const[,o,a,l]=s,c=o.length;let d=l,u=t+1;const h=[i];for(;u<n.length;){const f=n[u];if(f.match(hc))break;if(f.trim()==="")h.push(f),d+=`\n`,u+=1;else if(f.match(b0))h.push(f),d+=`\n${f.slice(c+2)}`,u+=1;else break}e.push({indent:c,number:parseInt(a,10),content:d.trim(),raw:h.join(`\n`)}),r=u,t=u}return[e,r]}function ah(n,e,t){var r;const i=[];let s=0;for(;s<n.length;){const o=n[s];if(o.indent===e){const a=o.content.split(`\n`),l=((r=a[0])==null?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:t.inlineTokens(l)});const d=a.slice(1).join(`\n`).trim();if(d){const f=t.blockTokens(d);c.push(...f)}let u=s+1;const h=[];for(;u<n.length&&n[u].indent>e;)h.push(n[u]),u+=1;if(h.length>0){const f=Math.min(...h.map(m=>m.indent)),p=ah(h,f,t);c.push({type:"list",ordered:!0,start:h[0].number,items:p,raw:h.map(m=>m.raw).join(`\n`)})}i.push({type:"list_item",raw:o.raw,tokens:c}),s=u}else s+=1}return i}function k0(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var v0="listItem",fc="textStyle",pc=/^(\d+)\.\s$/,ya=Le.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",de(this.options.HTMLAttributes,t),0]:["ol",de(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.items?k0(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:r}:{type:"orderedList",content:r}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`\n`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e?.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var r;const i=n.split(`\n`),[s,o]=y0(i);if(s.length===0)return;const a=ah(s,0,t);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:a,raw:i.slice(0,o).join(`\n`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(v0,this.editor.getAttributes(fc)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Jn({find:pc,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Jn({find:pc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(fc)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),E0=/^\s*(\[([( |x])?\])\s$/,x0=Le.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",de(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const i=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return pa(n,e,i)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=u=>{var h,f;a.ariaLabel=((f=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:f.call(h,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};c(n),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:h}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const p=t();if(typeof p!="number")return!1;const m=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,{...m?.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,h)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,h])=>{i.setAttribute(u,h)}),i.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,s.append(a,o),i.append(s,l),Object.entries(e).forEach(([u,h])=>{i.setAttribute(u,h)});let d=new Set(Object.keys(e));return{dom:i,contentDOM:l,update:u=>{if(u.type!==this.type)return!1;i.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,c(u);const h=r.extensionManager.attributes,f=Cr(u,h),p=new Set(Object.keys(f)),m=this.options.HTMLAttributes;return d.forEach(g=>{p.has(g)||(g in m?i.setAttribute(g,m[g]):i.removeAttribute(g))}),Object.entries(f).forEach(([g,b])=>{b==null?g in m?i.setAttribute(g,m[g]):i.removeAttribute(g):i.setAttribute(g,b)}),d=p,!0}}}},addInputRules(){return[Jn({find:E0,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),S0=Le.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",de(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`\n`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=s=>{const o=Mo(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(s)},i=Mo(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ee.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(ma.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(ga.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(oh.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(ya.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(x0.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(S0.configure(this.options.taskList)),n}});var w0=it.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",de(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),T0=w0,M0=it.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",de(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),C0=M0,A0=ee.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).some(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),N0=A0,_0=20,lh=(n,e=0)=>{const t=[];return!n.children.length||e>_0||Array.from(n.children).forEach(r=>{r.tagName==="SPAN"?t.push(r):r.children.length&&t.push(...lh(r,e+1))}),t},O0=n=>{if(!n.children.length)return;const e=lh(n);e&&e.forEach(t=>{var r,i;const s=t.getAttribute("style"),o=(i=(r=t.parentElement)==null?void 0:r.closest("span"))==null?void 0:i.getAttribute("style");t.setAttribute("style",`${o};${s}`)})},ch=it.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&O0(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",de(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleTextStyle:n=>({commands:e})=>e.toggleMark(this.name,n),removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(s=>!!s))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),I0=ee.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const s=r[i].split(":");if(s.length>=2){const o=s[0].trim().toLowerCase(),a=s.slice(1).join(":").trim();if(o==="background-color")return a.replace(/['"]+/g,"")}}}return(e=n.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:e})=>e().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),L0=ee.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const s=r[i].split(":");if(s.length>=2){const o=s[0].trim().toLowerCase(),a=s.slice(1).join(":").trim();if(o==="color")return a.replace(/['"]+/g,"")}}}return(e=n.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),R0=ee.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>n.style.fontFamily,renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),D0=ee.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>n.style.fontSize,renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),$0=ee.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:n=>n.style.lineHeight,renderHTML:n=>n.lineHeight?{style:`line-height: ${n.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:n=>({chain:e})=>e().setMark("textStyle",{lineHeight:n}).run(),unsetLineHeight:()=>({chain:n})=>n().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});ee.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(I0.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(L0.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(R0.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(D0.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push($0.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(ch.configure(this.options.textStyle)),n}});var Mi=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},P0=/^\s*>\s$/,B0=Le.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Mi("blockquote",{...de(this.options.HTMLAttributes,n),children:Mi("slot",{})})},parseMarkdown:(n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach(i=>{const a=e.renderChildren([i]).split(`\n`).map(l=>l.trim()===""?t:`${t} ${l}`);r.push(a.join(`\n`))}),r.join(`\n${t}\n`)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Jn({find:P0,type:this.type})]}}),z0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,H0=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,F0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,U0=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,V0=it.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return Mi("strong",{...de(this.options.HTMLAttributes,n),children:Mi("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Gn({find:z0,type:this.type}),Gn({find:F0,type:this.type})]},addPasteRules(){return[Tn({find:H0,type:this.type}),Tn({find:U0,type:this.type})]}}),K0=Le.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",de(this.options.HTMLAttributes,n)]},renderText(){return`\n`},renderMarkdown:()=>` \n`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&l&&o){const u=l.filter(h=>a.includes(h.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),W0=Le.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,de(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,i="#".repeat(r);return n.content?`${i} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>To({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),j0=Le.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",de(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!Vy(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return Iu(t)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(F.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(B.create(o.doc,l.pos)):o.setSelection(F.create(o.doc,l.pos));else{const d=s.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,u=d?.create();u&&(o.insert(c,u),o.setSelection(F.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Uy({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),q0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,G0=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,J0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Z0=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Y0=it.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",de(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Gn({find:q0,type:this.type}),Gn({find:J0,type:this.type})]},addPasteRules(){return[Tn({find:G0,type:this.type}),Tn({find:Z0,type:this.type})]}});const X0="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Q0="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",No="numeric",_o="ascii",Oo="alpha",ur="asciinumeric",or="alphanumeric",Io="domain",dh="emoji",ek="scheme",tk="slashscheme",Zs="whitespace";function nk(n,e){return n in e||(e[n]=[]),e[n]}function pn(n,e,t){e[No]&&(e[ur]=!0,e[or]=!0),e[_o]&&(e[ur]=!0,e[Oo]=!0),e[ur]&&(e[or]=!0),e[Oo]&&(e[or]=!0),e[or]&&(e[Io]=!0),e[dh]&&(e[Io]=!0);for(const r in e){const i=nk(r,t);i.indexOf(n)<0&&i.push(n)}}function rk(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function We(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}We.groups={};We.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(n))return s}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||We.groups;let i;return e&&e.j?i=e:(i=new We(e),t&&r&&pn(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const s=n.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(n[o]);return i.tt(n[s-1],e,t,r)},tt(n,e,t,r){r=r||We.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const s=e;let o,a=i.go(n);if(a?(o=new We,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new We,s){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(rk(o.t,r),t);pn(s,l,r)}else t&&pn(s,t,r);o.t=s}return i.j[n]=o,o}};const W=(n,e,t,r,i)=>n.ta(e,t,r,i),ue=(n,e,t,r,i)=>n.tr(e,t,r,i),mc=(n,e,t,r,i)=>n.ts(e,t,r,i),T=(n,e,t,r,i)=>n.tt(e,t,r,i),Ct="WORD",Lo="UWORD",uh="ASCIINUMERICAL",hh="ALPHANUMERICAL",Ar="LOCALHOST",Ro="TLD",Do="UTLD",ci="SCHEME",$n="SLASH_SCHEME",ka="NUM",$o="WS",va="NL",hr="OPENBRACE",fr="CLOSEBRACE",Ci="OPENBRACKET",Ai="CLOSEBRACKET",Ni="OPENPAREN",_i="CLOSEPAREN",Oi="OPENANGLEBRACKET",Ii="CLOSEANGLEBRACKET",Li="FULLWIDTHLEFTPAREN",Ri="FULLWIDTHRIGHTPAREN",Di="LEFTCORNERBRACKET",$i="RIGHTCORNERBRACKET",Pi="LEFTWHITECORNERBRACKET",Bi="RIGHTWHITECORNERBRACKET",zi="FULLWIDTHLESSTHAN",Hi="FULLWIDTHGREATERTHAN",Fi="AMPERSAND",Ui="APOSTROPHE",Vi="ASTERISK",zt="AT",Ki="BACKSLASH",Wi="BACKTICK",ji="CARET",Ut="COLON",Ea="COMMA",qi="DOLLAR",pt="DOT",Gi="EQUALS",xa="EXCLAMATION",Qe="HYPHEN",pr="PERCENT",Ji="PIPE",Zi="PLUS",Yi="POUND",mr="QUERY",Sa="QUOTE",fh="FULLWIDTHMIDDLEDOT",wa="SEMI",mt="SLASH",gr="TILDE",Xi="UNDERSCORE",ph="EMOJI",Qi="SYM";var mh=Object.freeze({__proto__:null,ALPHANUMERICAL:hh,AMPERSAND:Fi,APOSTROPHE:Ui,ASCIINUMERICAL:uh,ASTERISK:Vi,AT:zt,BACKSLASH:Ki,BACKTICK:Wi,CARET:ji,CLOSEANGLEBRACKET:Ii,CLOSEBRACE:fr,CLOSEBRACKET:Ai,CLOSEPAREN:_i,COLON:Ut,COMMA:Ea,DOLLAR:qi,DOT:pt,EMOJI:ph,EQUALS:Gi,EXCLAMATION:xa,FULLWIDTHGREATERTHAN:Hi,FULLWIDTHLEFTPAREN:Li,FULLWIDTHLESSTHAN:zi,FULLWIDTHMIDDLEDOT:fh,FULLWIDTHRIGHTPAREN:Ri,HYPHEN:Qe,LEFTCORNERBRACKET:Di,LEFTWHITECORNERBRACKET:Pi,LOCALHOST:Ar,NL:va,NUM:ka,OPENANGLEBRACKET:Oi,OPENBRACE:hr,OPENBRACKET:Ci,OPENPAREN:Ni,PERCENT:pr,PIPE:Ji,PLUS:Zi,POUND:Yi,QUERY:mr,QUOTE:Sa,RIGHTCORNERBRACKET:$i,RIGHTWHITECORNERBRACKET:Bi,SCHEME:ci,SEMI:wa,SLASH:mt,SLASH_SCHEME:$n,SYM:Qi,TILDE:gr,TLD:Ro,UNDERSCORE:Xi,UTLD:Do,UWORD:Lo,WORD:Ct,WS:$o});const Tt=/[a-z]/,tr=/\p{L}/u,Ys=/\p{Emoji}/u,Mt=/\d/,Xs=/\s/,gc="\r",Qs=`\n`,ik="️",sk="",eo="";let ei=null,ti=null;function ok(n=[]){const e={};We.groups=e;const t=new We;ei==null&&(ei=bc(X0)),ti==null&&(ti=bc(Q0)),T(t,"'",Ui),T(t,"{",hr),T(t,"}",fr),T(t,"[",Ci),T(t,"]",Ai),T(t,"(",Ni),T(t,")",_i),T(t,"<",Oi),T(t,">",Ii),T(t,"(",Li),T(t,")",Ri),T(t,"「",Di),T(t,"」",$i),T(t,"『",Pi),T(t,"』",Bi),T(t,"<",zi),T(t,">",Hi),T(t,"&",Fi),T(t,"*",Vi),T(t,"@",zt),T(t,"`",Wi),T(t,"^",ji),T(t,":",Ut),T(t,",",Ea),T(t,"$",qi),T(t,".",pt),T(t,"=",Gi),T(t,"!",xa),T(t,"-",Qe),T(t,"%",pr),T(t,"|",Ji),T(t,"+",Zi),T(t,"#",Yi),T(t,"?",mr),T(t,'"',Sa),T(t,"/",mt),T(t,";",wa),T(t,"~",gr),T(t,"_",Xi),T(t,"\\",Ki),T(t,"・",fh);const r=ue(t,Mt,ka,{[No]:!0});ue(r,Mt,r);const i=ue(r,Tt,uh,{[ur]:!0}),s=ue(r,tr,hh,{[or]:!0}),o=ue(t,Tt,Ct,{[_o]:!0});ue(o,Mt,i),ue(o,Tt,o),ue(i,Mt,i),ue(i,Tt,i);const a=ue(t,tr,Lo,{[Oo]:!0});ue(a,Tt),ue(a,Mt,s),ue(a,tr,a),ue(s,Mt,s),ue(s,Tt),ue(s,tr,s);const l=T(t,Qs,va,{[Zs]:!0}),c=T(t,gc,$o,{[Zs]:!0}),d=ue(t,Xs,$o,{[Zs]:!0});T(t,eo,d),T(c,Qs,l),T(c,eo,d),ue(c,Xs,d),T(d,gc),T(d,Qs),ue(d,Xs,d),T(d,eo,d);const u=ue(t,Ys,ph,{[dh]:!0});T(u,"#"),ue(u,Ys,u),T(u,ik,u);const h=T(u,sk);T(h,"#"),ue(h,Ys,u);const f=[[Tt,o],[Mt,i]],p=[[Tt,null],[tr,a],[Mt,s]];for(let m=0;m<ei.length;m++)$t(t,ei[m],Ro,Ct,f);for(let m=0;m<ti.length;m++)$t(t,ti[m],Do,Lo,p);pn(Ro,{tld:!0,ascii:!0},e),pn(Do,{utld:!0,alpha:!0},e),$t(t,"file",ci,Ct,f),$t(t,"mailto",ci,Ct,f),$t(t,"http",$n,Ct,f),$t(t,"https",$n,Ct,f),$t(t,"ftp",$n,Ct,f),$t(t,"ftps",$n,Ct,f),pn(ci,{scheme:!0,ascii:!0},e),pn($n,{slashscheme:!0,ascii:!0},e),n=n.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<n.length;m++){const g=n[m][0],k=n[m][1]?{[ek]:!0}:{[tk]:!0};g.indexOf("-")>=0?k[Io]=!0:Tt.test(g)?Mt.test(g)?k[ur]=!0:k[_o]=!0:k[No]=!0,mc(t,g,g,k)}return mc(t,"localhost",Ar,{ascii:!0}),t.jd=new We(Qi),{start:t,tokens:Object.assign({groups:e},mh)}}function gh(n,e){const t=ak(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o<r;){let a=n,l=null,c=0,d=null,u=-1,h=-1;for(;o<r&&(l=a.go(t[o]));)a=l,a.accepts()?(u=0,h=0,d=a):u>=0&&(u+=t[o].length,h++),c+=t[o].length,s+=t[o].length,o++;s-=u,o-=h,c-=u,i.push({t:d.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function ak(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),s,o=i<55296||i>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function $t(n,e,t,r,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];n.j[l]?s=n.j[l]:(s=new We(r),s.jr=i.slice(),n.j[l]=s),n=s}return s=new We(t),s.jr=i.slice(),n.j[e[o-1]]=s,s}function bc(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const Nr={defaultProtocol:"http",events:null,format:yc,formatHref:yc,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ta(n,e=null){let t=Object.assign({},Nr);n&&(t=Object.assign(t,n instanceof Ta?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}Ta.prototype={o:Nr,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:Nr[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function yc(n){return n}function bh(n,e){this.t="token",this.v=n,this.tk=e}bh.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Nr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},a=n.get("className",t,e),l=n.get("target",t,e),c=n.get("rel",t,e),d=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),d&&Object.assign(o,d),{tagName:i,attributes:o,content:s,eventListeners:u}}};function vs(n,e){class t extends bh{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const kc=vs("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),vc=vs("text"),lk=vs("nl"),ni=vs("url",{isLink:!0,toHref(n=Nr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Ar&&n[1].t===Ut}}),Xe=n=>new We(n);function ck({groups:n}){const e=n.domain.concat([Fi,Vi,zt,Ki,Wi,ji,qi,Gi,Qe,ka,pr,Ji,Zi,Yi,mt,Qi,gr,Xi]),t=[Ui,Ut,Ea,pt,xa,pr,mr,Sa,wa,Oi,Ii,hr,fr,Ai,Ci,Ni,_i,Li,Ri,Di,$i,Pi,Bi,zi,Hi],r=[Fi,Ui,Vi,Ki,Wi,ji,qi,Gi,Qe,hr,fr,pr,Ji,Zi,Yi,mr,mt,Qi,gr,Xi],i=Xe(),s=T(i,gr);W(s,r,s),W(s,n.domain,s);const o=Xe(),a=Xe(),l=Xe();W(i,n.domain,o),W(i,n.scheme,a),W(i,n.slashscheme,l),W(o,r,s),W(o,n.domain,o);const c=T(o,zt);T(s,zt,c),T(a,zt,c),T(l,zt,c);const d=T(s,pt);W(d,r,s),W(d,n.domain,s);const u=Xe();W(c,n.domain,u),W(u,n.domain,u);const h=T(u,pt);W(h,n.domain,u);const f=Xe(kc);W(h,n.tld,f),W(h,n.utld,f),T(c,Ar,f);const p=T(u,Qe);T(p,Qe,p),W(p,n.domain,u),W(f,n.domain,u),T(f,pt,h),T(f,Qe,p);const m=T(f,Ut);W(m,n.numeric,kc);const g=T(o,Qe),b=T(o,pt);T(g,Qe,g),W(g,n.domain,o),W(b,r,s),W(b,n.domain,o);const k=Xe(ni);W(b,n.tld,k),W(b,n.utld,k),W(k,n.domain,o),W(k,r,s),T(k,pt,b),T(k,Qe,g),T(k,zt,c);const E=T(k,Ut),x=Xe(ni);W(E,n.numeric,x);const S=Xe(ni),C=Xe();W(S,e,S),W(S,t,C),W(C,e,S),W(C,t,C),T(k,mt,S),T(x,mt,S);const A=T(a,Ut),R=T(l,Ut),H=T(R,mt),te=T(H,mt);W(a,n.domain,o),T(a,pt,b),T(a,Qe,g),W(l,n.domain,o),T(l,pt,b),T(l,Qe,g),W(A,n.domain,S),T(A,mt,S),T(A,mr,S),W(te,n.domain,S),W(te,e,S),T(te,mt,S);const re=[[hr,fr],[Ci,Ai],[Ni,_i],[Oi,Ii],[Li,Ri],[Di,$i],[Pi,Bi],[zi,Hi]];for(let ge=0;ge<re.length;ge++){const[we,Z]=re[ge],J=T(S,we);T(C,we,J),T(J,Z,S);const be=Xe(ni);W(J,e,be);const st=Xe();W(J,t),W(be,e,be),W(be,t,st),W(st,e,be),W(st,t,st),T(be,Z,S),T(st,Z,S)}return T(i,Ar,k),T(i,va,lk),{start:i,tokens:mh}}function dk(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i<r;){let a=n,l=null,c=null,d=0,u=null,h=-1;for(;i<r&&!(l=a.go(t[i].t));)o.push(t[i++]);for(;i<r&&(c=l||a.go(t[i].t));)l=null,a=c,a.accepts()?(h=0,u=a):h>=0&&h++,i++,d++;if(h<0)i-=d,i<r&&(o.push(t[i]),i++);else{o.length>0&&(s.push(to(vc,e,o)),o=[]),i-=h,d-=h;const f=u.t,p=t.slice(i-d,i);s.push(to(f,e,p))}}return o.length>0&&s.push(to(vc,e,o)),s}function to(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const uk=typeof console<"u"&&console&&console.warn||(()=>{}),hk="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ae={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function fk(){return We.groups={},ae.scanner=null,ae.parser=null,ae.tokenQueue=[],ae.pluginQueue=[],ae.customSchemes=[],ae.initialized=!1,ae}function Ec(n,e=!1){if(ae.initialized&&uk(`linkifyjs: already initialized - will not register custom scheme "${n}" ${hk}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat`);ae.customSchemes.push([n,e])}function pk(){ae.scanner=ok(ae.customSchemes);for(let n=0;n<ae.tokenQueue.length;n++)ae.tokenQueue[n][1]({scanner:ae.scanner});ae.parser=ck(ae.scanner.tokens);for(let n=0;n<ae.pluginQueue.length;n++)ae.pluginQueue[n][1]({scanner:ae.scanner,parser:ae.parser});return ae.initialized=!0,ae}function Ma(n){return ae.initialized||pk(),dk(ae.parser.start,n,gh(ae.scanner.start,n))}Ma.scan=gh;function yh(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Ta(t),i=Ma(n),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var Ca="[\0- -\u2029 ]",mk=new RegExp(Ca),gk=new RegExp(`${Ca}$`),bk=new RegExp(Ca,"g");function yk(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function kk(n){return new ne({key:new ce("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=wu(t.doc,[...e]);if(Ou(a).forEach(({newRange:c})=>{const d=Vb(r.doc,c,f=>f.isTextblock);let u,h;if(d.length>1)u=d[0],h=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){const f=r.doc.textBetween(c.from,c.to," "," ");if(!gk.test(f))return;u=d[0],h=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&h){const f=h.split(mk).filter(Boolean);if(f.length<=0)return!1;const p=f[f.length-1],m=u.pos+h.lastIndexOf(p);if(!p)return!1;const g=Ma(p).map(b=>b.toObject(n.defaultProtocol));if(!yk(g))return!1;g.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{da(b.from,b.to,r.doc).some(k=>k.mark.type===n.type)||o.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function vk(n){return new ne({key:new ce("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=!1;if(n.enableClickSelection&&(o=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){let a=null;if(r.target instanceof HTMLAnchorElement)a=r.target;else{let u=r.target;const h=[];for(;u.nodeName!=="DIV";)h.push(u),u=u.parentNode;a=h.find(f=>f.nodeName==="A")}if(!a)return o;const l=_u(e.state,n.type.name),c=(i=a?.href)!=null?i:l.href,d=(s=a?.target)!=null?s:l.target;a&&c&&(window.open(c,d),o=!0)}return o}}})}function Ek(n){return new ne({key:new ce("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:i}=n,{state:s}=e,{selection:o}=s,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(d=>{l+=d.textContent});const c=yh(l,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!c||i!==void 0&&!i(c.value)?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function ln(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(bk,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var kh=it.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Ec(n);return}Ec(n.scheme,n.optionalSlashes)})},onDestroy(){fk()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!ln(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const i=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!ln(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!ln(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",de(this.options.HTMLAttributes,n),0]:["a",de(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t;const r=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${r})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!ln(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!ln(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Tn({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=yh(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!ln(o,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(kk({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!ln(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(vk({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Ek({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),xk=kh,Sk=Le.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",de(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),wk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Tk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Mk=it.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",de(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Gn({find:wk,type:this.type})]},addPasteRules(){return[Tn({find:Tk,type:this.type})]}}),Ck=Le.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),Ak=it.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",de(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:t.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Nk(n={}){return new ne({view(e){return new _k(e,n)}})}class _k{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,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(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):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,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(t){let u=e.nodeBefore,h=e.nodeAfter;if(u||h){let f=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(f){let p=f.getBoundingClientRect(),m=u?p.bottom:p.top;u&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:u.left-h,right:u.left+h,top:u.top,bottom:u.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",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,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=l.getBoundingClientRect(),h=u.width/l.offsetWidth,f=u.height/l.offsetHeight;c=u.left-l.scrollLeft*h,d=u.top-l.scrollTop*f}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=gd(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class he extends j{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return he.valid(r)?new he(r):j.near(r)}content(){return O.empty}eq(e){return e instanceof he&&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 he(e.resolve(t.pos))}getBookmark(){return new Aa(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Ok(e)||!Ik(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&he.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let l=e.doc.resolve(i);if(he.valid(l))return l}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!B.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let a=e.doc.resolve(i);if(he.valid(a))return a}return null}}}he.prototype.visible=!1;he.findFrom=he.findGapCursorFrom;j.jsonID("gapcursor",he);class Aa{constructor(e){this.pos=e}map(e){return new Aa(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return he.valid(t)?new he(t):j.near(t)}}function vh(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function Ok(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 i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||vh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Ik(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 i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||vh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Lk(){return new ne({props:{decorations:Pk,createSelectionBetween(n,e,t){return e.pos==t.pos&&he.valid(t)?new he(t):null},handleClick:Dk,handleKeyDown:Rk,handleDOMEvents:{beforeinput:$k}}})}const Rk=gu({ArrowLeft:ri("horiz",-1),ArrowRight:ri("horiz",1),ArrowUp:ri("vert",-1),ArrowDown:ri("vert",1)});function ri(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof F){if(!s.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=he.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new he(c))),!0):!1}}function Dk(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!he.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&B.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new he(r))),!0)}function $k(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof he))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 i=w.empty;for(let o=r.length-1;o>=0;o--)i=w.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new O(i,0,0));return s.setSelection(F.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function Pk(n){if(!(n.selection instanceof he))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",le.create(n.doc,[Pe.widget(n.selection.head,e,{key:"gapcursor"})])}var es=200,Ae=function(){};Ae.prototype.append=function(e){return e.length?(e=Ae.from(e),!this.length&&e||e.length<es&&this.leafAppend(e)||this.length<es&&e.leafPrepend(this)||this.appendInner(e)):this};Ae.prototype.prepend=function(e){return e.length?Ae.from(e).append(this):this};Ae.prototype.appendInner=function(e){return new Bk(this,e)};Ae.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ae.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Ae.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ae.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)};Ae.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};Ae.from=function(e){return e instanceof Ae?e:e&&e.length?new Eh(e):Ae.empty};var Eh=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(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=es)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=es)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(Ae);Ae.empty=new Eh([]);var Bk=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,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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}(Ae);const zk=500;class lt{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 i,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],d=[];return this.items.forEach((u,h)=>{if(!u.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,d.push(u);return}if(i){d.push(new gt(u.map));let f=u.step.map(i.slice(s)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new gt(p,void 0,void 0,c.length+d.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(u.step);if(u.selection)return a=i?u.selection.map(i.slice(s)):u.selection,l=new lt(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),h=new gt(e.mapping.maps[d],u,t),f;(f=l&&l.merge(h))&&(h=f,d?s.pop():a=a.slice(0,a.length-1)),s.push(h),t&&(o++,t=void 0),i||(l=h)}let c=o-r.depth;return c>Fk&&(a=Hk(a,c),o-=c),new lt(a.append(s),o)}remapping(e,t){let r=new Er;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new lt(this.items.append(e.map(t=>new gt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=t;this.items.forEach(h=>{let f=s.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=s.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(s.slice(l+1,f));g&&a++,r.push(new gt(p,m,g))}else r.push(new gt(p))},i);let c=[];for(let h=t;h<o;h++)c.push(new gt(s.maps[h]));let d=this.items.slice(0,i).append(c).append(r),u=new lt(d,a);return u.emptyItemCount()>zk&&(u=u.compress(this.items.length-r.length)),u}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,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(t.slice(r)),c=l&&l.getMap();if(r--,c&&t.appendMap(c,r),l){let d=o.selection&&o.selection.map(t.slice(r));d&&s++;let u=new gt(c.invert(),l,d),h,f=i.length-1;(h=i.length&&i[f].merge(u))?i[f]=h:i.push(u)}}else o.map&&r--},this.items.length,0),new lt(Ae.from(i.reverse()),s)}}lt.empty=new lt(Ae.empty,0);function Hk(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class gt{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new gt(t.getMap().invert(),t,this.selection)}}}class Ht{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const Fk=20;function Uk(n,e,t,r){let i=t.getMeta(vn),s;if(i)return i.historyState;t.getMeta(Wk)&&(n=new Ht(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(vn))return o.getMeta(vn).redo?new Ht(n.done.addTransform(t,void 0,r,di(e)),n.undone,xc(t.mapping.maps),n.prevTime,n.prevComposition):new Ht(n.done,n.undone.addTransform(t,void 0,r,di(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Vk(t,n.prevRanges)),c=o?no(n.prevRanges,t.mapping):xc(t.mapping.maps);return new Ht(n.done.addTransform(t,l?e.selection.getBookmark():void 0,r,di(e)),lt.empty,c,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Ht(n.done.rebased(t,s),n.undone.rebased(t,s),no(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Ht(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),no(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Vk(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function xc(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function no(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}function Kk(n,e,t){let r=di(e),i=vn.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new Ht(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(vn,{redo:t,historyState:l})}let ro=!1,Sc=null;function di(n){let e=n.plugins;if(Sc!=e){ro=!1,Sc=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){ro=!0;break}}return ro}const vn=new ce("history"),Wk=new ce("closeHistory");function jk(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ne({key:vn,state:{init(){return new Ht(lt.empty,lt.empty,null,0,-1)},apply(e,t,r){return Uk(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?Sh:r=="historyRedo"?wh:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function xh(n,e){return(t,r)=>{let i=vn.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=Kk(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const Sh=xh(!1,!0),wh=xh(!0,!0);ee.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new ne({key:new ce("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const o=s-i,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(a,l);return n=!0,c}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=s-r,c=a-l,d=a;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var qk=ee.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Nk(this.options)]}});ee.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ne({key:new ce("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!t||!r)return le.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((l,c)=>{if(l.isText)return;if(!(i>=c&&i<=c+l.nodeSize-1))return!1;o+=1});let a=0;return n.descendants((l,c)=>{if(l.isText||!(i>=c&&i<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(Pe.node(c,c+l.nodeSize,{class:this.options.className}))}),le.create(n,s)}}})]}});var Gk=ee.create({name:"gapCursor",addProseMirrorPlugins(){return[Lk()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=Q($(n,"allowGapCursor",t)))!=null?e:null}}});ee.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ne({key:new ce("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!t)return null;const s=this.editor.isEmpty;return n.descendants((o,a)=>{const l=r>=a&&r<=a+o.nodeSize,c=!o.isLeaf&&bs(o);if((l||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const u=Pe.node(a,a+o.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:a,hasAnchor:l}):this.options.placeholder});i.push(u)}return this.options.includeChildren}),le.create(n,i)}}})]}});ee.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new ne({key:new ce("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||Iu(t.selection)||n.view.dragging?null:le.create(t.doc,[Pe.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function wc({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var Jk=ee.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new ce(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new ne({key:e,appendTransaction:(i,s,o)=>{const{doc:a,tr:l,schema:c}=o,d=e.getState(o),u=a.content.size,h=c.nodes[t];if(d)return l.insert(u,h.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!wc({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!wc({node:o,types:r})}}})]}}),Zk=ee.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Sh(n,e),redo:()=>({state:n,dispatch:e})=>wh(n,e)}},addProseMirrorPlugins(){return[jk(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Yk=ee.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(V0.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(B0.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(ma.configure(this.options.bulletList)),this.options.code!==!1&&i.push(Zu.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(Yu.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(eh.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(qk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(Gk.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(K0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(W0.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Zk.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(j0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(Y0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(ga.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(oh.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(kh.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(ya.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(Sk.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(Mk.configure(this.options.strike)),this.options.text!==!1&&i.push(Ck.configure(this.options.text)),this.options.underline!==!1&&i.push(Ak.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(Jk.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Xk=Yk;const ui=globalThis,Na=ui.ShadowRoot&&(ui.ShadyCSS===void 0||ui.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,_a=Symbol(),Tc=new WeakMap;let Th=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==_a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Na&&e===void 0){const r=t!==void 0&&t.length===1;r&&(e=Tc.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Tc.set(t,e))}return e}toString(){return this.cssText}};const Mh=n=>new Th(typeof n=="string"?n:n+"",void 0,_a),vt=(n,...e)=>{const t=n.length===1?n[0]:e.reduce((r,i,s)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[s+1],n[0]);return new Th(t,n,_a)},Qk=(n,e)=>{if(Na)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const r=document.createElement("style"),i=ui.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},Mc=Na?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return Mh(t)})(n):n;const{is:ev,defineProperty:tv,getOwnPropertyDescriptor:nv,getOwnPropertyNames:rv,getOwnPropertySymbols:iv,getPrototypeOf:sv}=Object,Es=globalThis,Cc=Es.trustedTypes,ov=Cc?Cc.emptyScript:"",av=Es.reactiveElementPolyfillSupport,br=(n,e)=>n,ts={toAttribute(n,e){switch(e){case Boolean:n=n?ov:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},Oa=(n,e)=>!ev(n,e),Ac={attribute:!0,type:String,converter:ts,reflect:!1,useDefault:!1,hasChanged:Oa};Symbol.metadata??=Symbol("metadata"),Es.litPropertyMetadata??=new WeakMap;let Pn=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ac){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&tv(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){const{get:i,set:s}=nv(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:i,set(o){const a=i?.call(this);s?.call(this,o),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ac}static _$Ei(){if(this.hasOwnProperty(br("elementProperties")))return;const e=sv(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(br("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(br("properties"))){const t=this.properties,r=[...rv(t),...iv(t)];for(const i of r)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(const[t,r]of this.elementProperties){const i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const i of r)t.unshift(Mc(i))}else e!==void 0&&t.push(Mc(e));return t}static _$Eu(e,t){const r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Qk(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){const r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){const s=(r.converter?.toAttribute!==void 0?r.converter:ts).toAttribute(t,r.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){const r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const s=r.getPropertyOptions(i),o=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:ts;this._$Em=i;const a=o.fromAttribute(t,s.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,r){if(e!==void 0){const i=this.constructor,s=this[e];if(r??=i.getPropertyOptions(e),!((r.hasChanged??Oa)(s,t)||r.useDefault&&r.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:s},o){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),s!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[i,s]of r){const{wrapped:o}=s,a=this[i];o!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,s,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};Pn.elementStyles=[],Pn.shadowRootOptions={mode:"open"},Pn[br("elementProperties")]=new Map,Pn[br("finalized")]=new Map,av?.({ReactiveElement:Pn}),(Es.reactiveElementVersions??=[]).push("2.1.1");const Ia=globalThis,ns=Ia.trustedTypes,Nc=ns?ns.createPolicy("lit-html",{createHTML:n=>n}):void 0,Ch="$lit$",Vt=`lit$${Math.random().toFixed(9).slice(2)}$`,Ah="?"+Vt,lv=`<${Ah}>`,Mn=document,_r=()=>Mn.createComment(""),Or=n=>n===null||typeof n!="object"&&typeof n!="function",La=Array.isArray,cv=n=>La(n)||typeof n?.[Symbol.iterator]=="function",io=`[ \t\n\f\r]`,nr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_c=/-->/g,Oc=/>/g,cn=RegExp(`>|${io}(?:([^\\s"'>=/]+)(${io}*=${io}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Ic=/'/g,Lc=/"/g,Nh=/^(?:script|style|textarea|title)$/i,dv=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),z=dv(1),Cn=Symbol.for("lit-noChange"),fe=Symbol.for("lit-nothing"),Rc=new WeakMap,mn=Mn.createTreeWalker(Mn,129);function _h(n,e){if(!La(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Nc!==void 0?Nc.createHTML(e):e}const uv=(n,e)=>{const t=n.length-1,r=[];let i,s=e===2?"<svg>":e===3?"<math>":"",o=nr;for(let a=0;a<t;a++){const l=n[a];let c,d,u=-1,h=0;for(;h<l.length&&(o.lastIndex=h,d=o.exec(l),d!==null);)h=o.lastIndex,o===nr?d[1]==="!--"?o=_c:d[1]!==void 0?o=Oc:d[2]!==void 0?(Nh.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=cn):d[3]!==void 0&&(o=cn):o===cn?d[0]===">"?(o=i??nr,u=-1):d[1]===void 0?u=-2:(u=o.lastIndex-d[2].length,c=d[1],o=d[3]===void 0?cn:d[3]==='"'?Lc:Ic):o===Lc||o===Ic?o=cn:o===_c||o===Oc?o=nr:(o=cn,i=void 0);const f=o===cn&&n[a+1].startsWith("/>")?" ":"";s+=o===nr?l+lv:u>=0?(r.push(c),l.slice(0,u)+Ch+l.slice(u)+Vt+f):l+Vt+(u===-2?a:f)}return[_h(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class Ir{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0;const a=e.length-1,l=this.parts,[c,d]=uv(e,t);if(this.el=Ir.createElement(c,r),mn.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=mn.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(Ch)){const h=d[o++],f=i.getAttribute(u).split(Vt),p=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:p[2],strings:f,ctor:p[1]==="."?fv:p[1]==="?"?pv:p[1]==="@"?mv:xs}),i.removeAttribute(u)}else u.startsWith(Vt)&&(l.push({type:6,index:s}),i.removeAttribute(u));if(Nh.test(i.tagName)){const u=i.textContent.split(Vt),h=u.length-1;if(h>0){i.textContent=ns?ns.emptyScript:"";for(let f=0;f<h;f++)i.append(u[f],_r()),mn.nextNode(),l.push({type:2,index:++s});i.append(u[h],_r())}}}else if(i.nodeType===8)if(i.data===Ah)l.push({type:2,index:s});else{let u=-1;for(;(u=i.data.indexOf(Vt,u+1))!==-1;)l.push({type:7,index:s}),u+=Vt.length-1}s++}}static createElement(e,t){const r=Mn.createElement("template");return r.innerHTML=e,r}}function Zn(n,e,t=n,r){if(e===Cn)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl;const s=Or(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=Zn(n,i._$AS(n,e.values),i,r)),e}class hv{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??Mn).importNode(t,!0);mn.currentNode=i;let s=mn.nextNode(),o=0,a=0,l=r[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new Pr(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new gv(s,this,e)),this._$AV.push(c),l=r[++a]}o!==l?.index&&(s=mn.nextNode(),o++)}return mn.currentNode=Mn,i}p(e){let t=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class Pr{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=fe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Zn(this,e,t),Or(e)?e===fe||e==null||e===""?(this._$AH!==fe&&this._$AR(),this._$AH=fe):e!==this._$AH&&e!==Cn&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):cv(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==fe&&Or(this._$AH)?this._$AA.nextSibling.data=e:this.T(Mn.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=Ir.createElement(_h(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{const s=new hv(i,this),o=s.u(this.options);s.p(t),this.T(o),this._$AH=s}}_$AC(e){let t=Rc.get(e.strings);return t===void 0&&Rc.set(e.strings,t=new Ir(e)),t}k(e){La(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const s of e)i===t.length?t.push(r=new Pr(this.O(_r()),this.O(_r()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class xs{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=fe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=fe}_$AI(e,t=this,r,i){const s=this.strings;let o=!1;if(s===void 0)e=Zn(this,e,t,0),o=!Or(e)||e!==this._$AH&&e!==Cn,o&&(this._$AH=e);else{const a=e;let l,c;for(e=s[0],l=0;l<s.length-1;l++)c=Zn(this,a[r+l],t,l),c===Cn&&(c=this._$AH[l]),o||=!Or(c)||c!==this._$AH[l],c===fe?e=fe:e!==fe&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}o&&!i&&this.j(e)}j(e){e===fe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class fv extends xs{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===fe?void 0:e}}class pv extends xs{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==fe)}}class mv extends xs{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=Zn(this,e,t,0)??fe)===Cn)return;const r=this._$AH,i=e===fe&&r!==fe||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==fe&&(r===fe||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class gv{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Zn(this,e)}}const bv=Ia.litHtmlPolyfillSupport;bv?.(Ir,Pr),(Ia.litHtmlVersions??=[]).push("3.3.1");const Fe=(n,e,t)=>{const r=t?.renderBefore??e;let i=r._$litPart$;if(i===void 0){const s=t?.renderBefore??null;r._$litPart$=i=new Pr(e.insertBefore(_r(),s),s,void 0,t??{})}return i._$AI(n),i};const Ra=globalThis;let Yt=class extends Pn{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Fe(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Cn}};Yt._$litElement$=!0,Yt.finalized=!0,Ra.litElementHydrateSupport?.({LitElement:Yt});const yv=Ra.litElementPolyfillSupport;yv?.({LitElement:Yt});(Ra.litElementVersions??=[]).push("4.2.1");const Ss=n=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(n,e)}):customElements.define(n,e)};const kv={attribute:!0,type:String,converter:ts,reflect:!1,hasChanged:Oa},vv=(n=kv,e,t)=>{const{kind:r,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),r==="setter"&&((n=Object.create(n)).wrapped=!0),s.set(t.name,n),r==="accessor"){const{name:o}=t;return{set(a){const l=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,l,n)},init(a){return a!==void 0&&this.C(o,void 0,n,a),a}}}if(r==="setter"){const{name:o}=t;return function(a){const l=this[o];e.call(this,a),this.requestUpdate(o,l,n)}}throw Error("Unsupported decorator location: "+r)};function Se(n){return(e,t)=>typeof t=="object"?vv(n,e,t):((r,i,s)=>{const o=i.hasOwnProperty(s);return i.constructor.createProperty(s,r),o?Object.getOwnPropertyDescriptor(i,s):void 0})(n,e,t)}function Et(n){return Se({...n,state:!0,attribute:!1})}const Ev=(n,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(n,e,t),t);function Br(n,e){return(t,r,i)=>{const s=o=>o.renderRoot?.querySelector(n)??null;return Ev(t,r,{get(){return s(this)}})}}const xv=n=>n.strings===void 0;const Oh={CHILD:2},Ih=n=>(...e)=>({_$litDirective$:n,values:e});class Lh{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}const yr=(n,e)=>{const t=n._$AN;if(t===void 0)return!1;for(const r of t)r._$AO?.(e,!1),yr(r,e);return!0},rs=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while(t?.size===0)},Rh=n=>{for(let e;e=n._$AM;n=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(n))break;t.add(n),Tv(e)}};function Sv(n){this._$AN!==void 0?(rs(this),this._$AM=n,Rh(this)):this._$AM=n}function wv(n,e=!1,t=0){const r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let s=t;s<r.length;s++)yr(r[s],!1),rs(r[s]);else r!=null&&(yr(r,!1),rs(r));else yr(this,n)}const Tv=n=>{n.type==Oh.CHILD&&(n._$AP??=wv,n._$AQ??=Sv)};class Mv extends Lh{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),Rh(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(yr(this,e),rs(this))}setValue(e){if(xv(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}const so=new WeakMap,Cv=Ih(class extends Mv{render(n){return fe}update(n,[e]){const t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=n.options?.host,this.rt(this.ct=n.element)),fe}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=so.get(e);t===void 0&&(t=new WeakMap,so.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){return typeof this.G=="function"?so.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function Av(n){const e=n.regex,t={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]};Object.assign(t,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[n.BACKSLASH_ESCAPE]},s=n.inherit(n.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,t,i]};i.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},d={match:/\\'/},u={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},n.NUMBER_MODE,t]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=n.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[n.inherit(n.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],g=["true","false"],b={match:/(\/[a-z._-]+)+/},k=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],E=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],x=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],S=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:g,built_in:[...k,...E,"set","shopt",...x,...S]},contains:[f,n.SHEBANG(),p,u,s,o,b,a,l,c,d,t]}}function Nv(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},n.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},n.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},t,n.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:e.optional(i)+n.IDENT_RE,relevance:0},f=e.optional(i)+n.IDENT_RE+"\\s*\\(",g={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},b=[u,a,t,n.C_BLOCK_COMMENT_MODE,d,c],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:g,contains:b.concat([{begin:/\(/,end:/\)/,keywords:g,contains:b.concat(["self"]),relevance:0}]),relevance:0},E={begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:f,returnBegin:!0,contains:[n.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,u]};return{name:"C",aliases:["h"],keywords:g,disableAutodetect:!0,illegal:"</",contains:[].concat(k,E,b,[u,{begin:n.IDENT_RE+"::",keywords:g},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},n.TITLE_MODE]}]),exports:{preprocessor:u,strings:c,keywords:g}}}function _v(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},n.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},n.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},t,n.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:e.optional(i)+n.IDENT_RE,relevance:0},f=e.optional(i)+n.IDENT_RE+"\\s*\\(",p=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],m=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],b=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],x={type:m,keyword:p,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},S={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,n.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},C=[S,u,a,t,n.C_BLOCK_COMMENT_MODE,d,c],A={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:x,contains:C.concat([{begin:/\(/,end:/\)/,keywords:x,contains:C.concat(["self"]),relevance:0}]),relevance:0},R={className:"function",begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:x,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:x,relevance:0},{begin:f,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,u]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:x,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(A,R,S,C,[u,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:x,contains:["self",a]},{begin:n.IDENT_RE+"::",keywords:x},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Ov(n){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],t=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],s=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:i.concat(s),built_in:e,literal:r},a=n.inherit(n.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},u=n.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:o},f=n.inherit(h,{illegal:/\n/}),p={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},n.BACKSLASH_ESCAPE,f]},m={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},g=n.inherit(m,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]});h.contains=[m,p,d,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,l,n.C_BLOCK_COMMENT_MODE],f.contains=[g,p,u,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,l,n.inherit(n.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const b={variants:[c,m,p,d,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},k={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},E=n.IDENT_RE+"(<"+n.IDENT_RE+"(\\s*,\\s*"+n.IDENT_RE+")*>)?(\\[\\])?",x={begin:"@"+n.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[n.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"\x3c!--|--\x3e"},{begin:"</?",end:">"}]}]}),n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},b,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,k,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,k,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+E+"\\s+)+"+n.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:t.join(" "),relevance:0},{begin:n.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[n.TITLE_MODE,k],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[b,l,n.C_BLOCK_COMMENT_MODE]},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},x]}}const Iv=n=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:n.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:n.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Lv=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Rv=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Dv=[...Lv,...Rv],$v=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Pv=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Bv=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),zv=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Hv(n){const e=n.regex,t=Iv(n),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[t.BLOCK_COMMENT,r,t.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Pv.join("|")+")"},{begin:":(:)?("+Bv.join("|")+")"}]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+zv.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[t.BLOCK_COMMENT,t.HEXCOLOR,t.IMPORTANT,t.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},t.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:$v.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,t.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Dv.join("|")+")\\b"}]}}var Bn="[0-9](_*[0-9])*",ii=`\\.(${Bn})`,si="[0-9a-fA-F](_*[0-9a-fA-F])*",Dc={className:"number",variants:[{begin:`(\\b(${Bn})((${ii})|\\.)?|(${ii}))[eE][+-]?(${Bn})[fFdD]?\\b`},{begin:`\\b(${Bn})((${ii})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${ii})[fFdD]?\\b`},{begin:`\\b(${Bn})[fFdD]\\b`},{begin:`\\b0[xX]((${si})\\.?|(${si})?\\.(${si}))[pP][+-]?(${Bn})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${si})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Dh(n,e,t){return t===-1?"":n.replace(e,r=>Dh(n,e,t-1))}function Fv(n){const e=n.regex,t="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=t+Dh("(?:<"+t+"~~~(?:\\s*,\\s*"+t+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},c={className:"meta",begin:"@"+t,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[n.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[n.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[n.BACKSLASH_ESCAPE]},n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,t],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,t),/\s+/,t,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,t],className:{1:"keyword",3:"title.class"},contains:[d,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",n.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[c,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,Dc,n.C_BLOCK_COMMENT_MODE]},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},Dc,c]}}const $c="[A-Za-z$_][0-9A-Za-z$_]*",Uv=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Vv=["true","false","null","undefined","NaN","Infinity"],$h=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Ph=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Bh=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Kv=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Wv=[].concat(Bh,$h,Ph);function jv(n){const e=n.regex,t=(Y,{after:He})=>{const Ge="</"+Y[0].slice(1);return Y.input.indexOf(Ge,He)!==-1},r=$c,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Y,He)=>{const Ge=Y[0].length+Y.index,ot=Y.input[Ge];if(ot==="<"||ot===","){He.ignoreMatch();return}ot===">"&&(t(Y,{after:Ge})||He.ignoreMatch());let xt;const sn=Y.input.substring(Ge);if(xt=sn.match(/^\s*=/)){He.ignoreMatch();return}if((xt=sn.match(/^\s+extends\s+/))&&xt.index===0){He.ignoreMatch();return}}},a={$pattern:$c,keyword:Uv,literal:Vv,built_in:Wv,"variable.language":Kv},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,h]},k={className:"comment",variants:[n.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),n.C_BLOCK_COMMENT_MODE,n.C_LINE_COMMENT_MODE]},E=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,f,p,m,g,{match:/\$\d+/},u];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(E)});const x=[].concat(k,h.contains),S=x.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(x)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:S},A={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},R={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...$h,...Ph]}},H={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},te={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},re={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ge(Y){return e.concat("(?!",Y.join("|"),")")}const we={match:e.concat(/\b/,ge([...Bh,"super","import"].map(Y=>`${Y}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Z={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},J={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},be="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",st={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(be)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),H,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,f,p,m,g,k,{match:/\$\d+/},u,R,{scope:"attr",match:r+e.lookahead(":"),relevance:0},st,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,n.REGEXP_MODE,{className:"function",begin:be,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},te,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[C,n.inherit(n.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Z,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},we,re,A,J,{match:/\$[(.]/}]}}function qv(n){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},t={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,t,n.QUOTE_STRING_MODE,i,n.C_NUMBER_MODE,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function Gv(n){const e=n.regex,t={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},s={className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=n.inherit(c,{contains:[]}),h=n.inherit(d,{contains:[]});c.contains.push(h),d.contains.push(u);let f=[t,l];return[c,d,u,h].forEach(b=>{b.contains=b.contains.concat(f)}),f=f.concat(c,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},t,s,c,d,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},i,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Jv(n){const e=n.regex,t=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,t),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,t),s=e.concat(/[A-Z]+/,t),o={scope:"variable",match:"\\$+"+r},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=n.inherit(n.APOS_STRING_MODE,{illegal:null}),d=n.inherit(n.QUOTE_STRING_MODE,{illegal:null,contains:n.QUOTE_STRING_MODE.contains.concat(l)}),u={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:n.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(Z,J)=>{J.data._beginMatch=Z[1]||Z[2]},"on:end":(Z,J)=>{J.data._beginMatch!==Z[1]&&J.ignoreMatch()}},h=n.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[ \t\n]`,p={scope:"string",variants:[d,c,u,h]},m={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},g=["false","null","true"],b=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],k=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],x={keyword:b,literal:(Z=>{const J=[];return Z.forEach(be=>{J.push(be),be.toLowerCase()===be?J.push(be.toUpperCase()):J.push(be.toLowerCase())}),J})(g),built_in:k},S=Z=>Z.map(J=>J.replace(/\|\d+$/,"")),C={variants:[{match:[/new/,e.concat(f,"+"),e.concat("(?!",S(k).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},A=e.concat(r,"\\b(?!\\()"),R={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),A],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),A],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},H={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},te={relevance:0,begin:/\(/,end:/\)/,keywords:x,contains:[H,o,R,n.C_BLOCK_COMMENT_MODE,p,m,C]},re={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",S(b).join("\\b|"),"|",S(k).join("\\b|"),"\\b)"),r,e.concat(f,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[te]};te.contains.push(re);const ge=[H,R,n.C_BLOCK_COMMENT_MODE,p,m,C],we={begin:e.concat(/#\[\s*\\?/,e.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...ge]},...ge,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:x,contains:[we,n.HASH_COMMENT_MODE,n.COMMENT("//","$"),n.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:n.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},o,re,R,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},C,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},n.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:x,contains:["self",we,o,R,n.C_BLOCK_COMMENT_MODE,p,m]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},n.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[n.inherit(n.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},n.UNDERSCORE_TITLE_MODE]},p,m]}}function Zv(n){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function Yv(n){const e=n.regex,t=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},d={begin:/\{\{/,relevance:0},u={className:"string",contains:[n.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[n.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[n.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[n.BACKSLASH_ESCAPE,l,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[n.BACKSLASH_ESCAPE,l,d,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[n.BACKSLASH_ESCAPE,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,d,c]},n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",f=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,p=`\\b|${r.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${f}))[eE][+-]?(${h})[jJ]?(?=${p})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${h})[jJ](?=${p})`}]},g={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,m,u,n.HASH_COMMENT_MODE]}]};return c.contains=[u,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},u,g,n.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[b]},{variants:[{match:[/\bclass/,/\s+/,t,/\s*/,/\(\s*/,t,/\s*\)/]},{match:[/\bclass/,/\s+/,t]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,b,u]}]}}function Xv(n){const e=n.regex,t="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[n.COMMENT("#","$",{contains:[a]}),n.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),n.COMMENT("^__END__",n.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:o},u={className:"string",contains:[n.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[n.BACKSLASH_ESCAPE,d]})]}]},h="[1-9](_?[0-9])*|0",f="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${f}))?([eE][+-]?(${f})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},m={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},C=[u,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[m]},{begin:n.IDENT_RE+"::"},{className:"symbol",begin:n.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[u,{begin:t}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+n.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[n.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);d.contains=C,m.contains=C;const te=[{begin:/^\s*=>/,starts:{end:"$",contains:C}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:C}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[n.SHEBANG({binary:"ruby"})].concat(te).concat(c).concat(C)}}function Qv(n){const e=n.regex,t=/(r#)?/,r=e.concat(t,n.UNDERSCORE_IDENT_RE),i=e.concat(t,n.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:n.IDENT_RE+"!?",type:d,keyword:a,literal:l,built_in:c},illegal:"</",contains:[n.C_LINE_COMMENT_MODE,n.COMMENT("/\\*","\\*/",{contains:["self"]}),n.inherit(n.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:n.IDENT_RE+"::",keywords:{keyword:"Self",built_in:c,type:d}},{className:"punctuation",begin:"->"},s]}}function eE(n){const e=n.regex,t=n.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],u=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=d,p=[...c,...l].filter(S=>!d.includes(S)),m={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},g={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},b={match:e.concat(/\b/,e.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function k(S){return e.concat(/\b/,e.either(...S.map(C=>C.replace(/\s+/,"\\s+"))),/\b/)}const E={scope:"keyword",match:k(h),relevance:0};function x(S,{exceptions:C,when:A}={}){const R=A;return C=C||[],S.map(H=>H.match(/\|\d+$/)||C.includes(H)?H:R(H)?`${H}|0`:H)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:x(p,{when:S=>S.length<3}),literal:s,type:a,built_in:u},contains:[{scope:"type",match:k(o)},E,b,m,r,i,n.C_NUMBER_MODE,n.C_BLOCK_COMMENT_MODE,t,g]}}const is="[A-Za-z$_][0-9A-Za-z$_]*",zh=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Hh=["true","false","null","undefined","NaN","Infinity"],Fh=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Uh=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Vh=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Kh=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Wh=[].concat(Vh,Fh,Uh);function tE(n){const e=n.regex,t=(Y,{after:He})=>{const Ge="</"+Y[0].slice(1);return Y.input.indexOf(Ge,He)!==-1},r=is,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Y,He)=>{const Ge=Y[0].length+Y.index,ot=Y.input[Ge];if(ot==="<"||ot===","){He.ignoreMatch();return}ot===">"&&(t(Y,{after:Ge})||He.ignoreMatch());let xt;const sn=Y.input.substring(Ge);if(xt=sn.match(/^\s*=/)){He.ignoreMatch();return}if((xt=sn.match(/^\s+extends\s+/))&&xt.index===0){He.ignoreMatch();return}}},a={$pattern:is,keyword:zh,literal:Hh,built_in:Wh,"variable.language":Kh},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,h]},k={className:"comment",variants:[n.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),n.C_BLOCK_COMMENT_MODE,n.C_LINE_COMMENT_MODE]},E=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,f,p,m,g,{match:/\$\d+/},u];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(E)});const x=[].concat(k,h.contains),S=x.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(x)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:S},A={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},R={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Fh,...Uh]}},H={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},te={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},re={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ge(Y){return e.concat("(?!",Y.join("|"),")")}const we={match:e.concat(/\b/,ge([...Vh,"super","import"].map(Y=>`${Y}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Z={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},J={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},be="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",st={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(be)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),H,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,f,p,m,g,k,{match:/\$\d+/},u,R,{scope:"attr",match:r+e.lookahead(":"),relevance:0},st,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,n.REGEXP_MODE,{className:"function",begin:be,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},te,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[C,n.inherit(n.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Z,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},we,re,A,J,{match:/\$[(.]/}]}}function nE(n){const e=n.regex,t=tE(n),r=is,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,n.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[t.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:is,keyword:zh.concat(l),literal:Hh,built_in:Wh.concat(i),"variable.language":Kh},d={className:"meta",begin:"@"+r},u=(m,g,b)=>{const k=m.contains.findIndex(E=>E.label===g);if(k===-1)throw new Error("can not find mode to replace");m.contains.splice(k,1,b)};Object.assign(t.keywords,c),t.exports.PARAMS_CONTAINS.push(d);const h=t.contains.find(m=>m.scope==="attr"),f=Object.assign({},h,{match:e.concat(r,e.lookahead(/\s*\?:/))});t.exports.PARAMS_CONTAINS.push([t.exports.CLASS_REFERENCE,h,f]),t.contains=t.contains.concat([d,s,o,f]),u(t,"shebang",n.SHEBANG()),u(t,"use_strict",a);const p=t.contains.find(m=>m.label==="func.def");return p.relevance=0,Object.assign(t,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),t}function rE(n){const e=n.regex,t=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=n.inherit(s,{begin:/\(/,end:/\)/}),a=n.inherit(n.APOS_STRING_MODE,{className:"string"}),l=n.inherit(n.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[s,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[s,o,l,a]}]}]},n.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(t,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:t,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(t,/>/))),contains:[{className:"name",begin:t,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function iE(n){const e="true false yes no null",t="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[n.BACKSLASH_ESCAPE,i]},a=n.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},p={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},m={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},g=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+t},{className:"type",begin:"!<"+t+">"},{className:"type",begin:"!"+t},{className:"type",begin:"!!"+t},{className:"meta",begin:"&"+n.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+n.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},n.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},h,{className:"number",begin:n.C_NUMBER_RE+"\\b",relevance:0},p,m,s,o],b=[...g];return b.pop(),b.push(a),f.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:g}}const Pc={},sE="hljs-";function oE(n){const e=Xu.newInstance();return{highlight:t,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:a};function t(l,c,d){const u=d||Pc,h=typeof u.prefix=="string"?u.prefix:sE;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:aE,classPrefix:h});const f=e.highlight(c,{ignoreIllegals:!0,language:l});if(f.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:f.errorRaised});const p=f._emitter.root,m=p.data;return m.language=f.language,m.relevance=f.relevance,p}function r(l,c){const u=(c||Pc).subset||i();let h=-1,f=0,p;for(;++h<u.length;){const m=u[h];if(!e.getLanguage(m))continue;const g=t(m,l,c);g.data&&g.data.relevance!==void 0&&g.data.relevance>f&&(f=g.data.relevance,p=g)}return p||{type:"root",children:[],data:{language:void 0,relevance:f}}}function i(){return e.listLanguages()}function s(l,c){if(typeof l=="string")e.registerLanguage(l,c);else{let d;for(d in l)Object.hasOwn(l,d)&&e.registerLanguage(d,l[d])}}function o(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let d;for(d in l)if(Object.hasOwn(l,d)){const u=l[d];e.registerAliases(typeof u=="string"?u:[...u],{languageName:d})}}}function a(l){return!!e.getLanguage(l)}}class aE{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const t=this.stack[this.stack.length-1],r=t.children[t.children.length-1];r&&r.type==="text"?r.value+=e:t.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){const r=this.stack[this.stack.length-1],i=e.root.children;t?r.children.push({type:"element",tagName:"span",properties:{className:[t]},children:i}):r.children.push(...i)}openNode(e){const t=this,r=e.split(".").map(function(o,a){return a?o+"_".repeat(a):t.options.classPrefix+o}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const jh=oE();jh.register({bash:Av,c:Nv,cpp:_v,csharp:Ov,css:Hv,java:Fv,javascript:jv,json:qv,markdown:Gv,plaintext:Zv,php:Jv,python:Yv,ruby:Xv,rust:Qv,sql:eE,typescript:nE,xml:rE,yaml:iE});const lE=[{key:"bash",label:"Bash"},{key:"c",label:"C"},{key:"cpp",label:"C++"},{key:"csharp",label:"C#"},{key:"css",label:"CSS"},{key:"java",label:"Java"},{key:"javascript",label:"JavaScript"},{key:"json",label:"JSON"},{key:"markdown",label:"Markdown"},{key:"php",label:"PHP"},{key:"plaintext",label:"Plain Text"},{key:"python",label:"Python"},{key:"ruby",label:"Ruby"},{key:"rust",label:"Rust"},{key:"sql",label:"SQL"},{key:"typescript",label:"TypeScript"},{key:"xml",label:"XML"},{key:"yaml",label:"YAML"}];class cE{constructor(e,t,r,i,s){this.node=e,this.editor=t,this.getPos=r,this.dom=document.createElement("div"),this.dom.classList.add("code-block-wrapper"),this.dom.style.position="relative";const o=document.createElement("pre");e.attrs.language&&o.setAttribute("data-language",e.attrs.language),this.contentDOM=document.createElement("code"),e.attrs.language&&(this.contentDOM.className=`language-${e.attrs.language}`),o.appendChild(this.contentDOM),this.dom.appendChild(o),this.selectContainer=document.createElement("div"),this.selectContainer.classList.add("code-block-selector"),this.dom.appendChild(this.selectContainer),this.renderSelector(),this.setupSelectionTracking()}setupSelectionTracking(){this.selectionUpdateHandler=()=>{const e=this.getPos();if(e===void 0)return;const{from:t}=this.editor.state.selection,r=e,i=e+this.node.nodeSize;t>=r&&t<i?this.dom.classList.add("has-focus"):this.dom.classList.remove("has-focus")},this.editor.on("selectionUpdate",this.selectionUpdateHandler),this.editor.on("transaction",this.selectionUpdateHandler),this.selectionUpdateHandler()}renderSelector(){const e=this.node.attrs.language||"plaintext",t=z`
|
|
1
|
+
function Id(t){return typeof t=="object"&&t!==null&&"j"in t}const Kp={en:{en:"English",fr:"French",es:"Spanish",de:"German",it:"Italian",pt:"Portuguese"},fr:{en:"Anglais",fr:"Français",es:"Espagnol",de:"Allemand",it:"Italien",pt:"Portugais"},es:{en:"Inglés",fr:"Francés",es:"Español",de:"Alemán",it:"Italiano",pt:"Portugués"},de:{en:"Englisch",fr:"Französisch",es:"Spanisch",de:"Deutsch",it:"Italienisch",pt:"Portugiesisch"},it:{en:"Inglese",fr:"Francese",es:"Spagnolo",de:"Tedesco",it:"Italiano",pt:"Portoghese"},pt:{en:"Inglês",fr:"Francês",es:"Espanhol",de:"Alemão",it:"Italiano",pt:"Português"}},Tl=Object.keys(Kp);function jp(t,{pluginLanguages:e,siteLanguages:n=[]}){if(e.includes(t)||Tl.includes(t)&&e.includes(t))return t;const r=n.find(i=>Tl.includes(i)&&e.includes(i));return r||(e.includes("en")?"en":e[0]??"en")}function De(t){this.content=t}De.prototype={constructor:De,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new De(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new De(n)},addToStart:function(t,e){return new De([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new De(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new De(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=De.from(t),t.size?new De(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=De.from(t),t.size?new De(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=De.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};De.from=function(t){if(t instanceof De)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new De(e)};function Rd(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=Rd(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Ld(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,d=Math.min(s.text.length,a.text.length);for(;c<d&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let c=Ld(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class S{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,o){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,n-d),r,i+d)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new S(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l}return new S(r,i)}cutByIndex(e,n){return e==n?S.empty:e==0&&n==this.content.length?this:new S(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new S(i,o)}addToStart(e){return new S([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new S(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Rd(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Ld(this,e,n,r)}findIndex(e){if(e==0)return ri(0,e);if(e==this.size)return ri(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),o=r+i.nodeSize;if(o>=e)return o==e?ri(n+1,o):ri(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return S.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new S(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return S.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new S(n||e,r)}static from(e){if(!e)return S.empty;if(e instanceof S)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new S([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}S.empty=new S([],0);const Jo={index:0,offset:0};function ri(t,e){return Jo.index=t,Jo.offset=e,Jo}function Ni(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Ni(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Ni(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let oe=class Ts{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ni(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ts.none;if(e instanceof Ts)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};oe.none=[];class _i extends Error{}class N{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=$d(this.content,e+this.openStart,n);return r&&new N(r,this.openStart,this.openEnd)}removeBetween(e,n){return new N(Dd(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return N.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new N(S.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new N(e,r,i)}}N.empty=new N(S.empty,0,0);function Dd(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(Dd(o.content,e-i-1,n-i-1)))}function $d(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=$d(s.content,e-o-1,n,s);return a&&t.replaceChild(i,s.copy(a))}function qp(t,e,n){if(n.openStart>t.depth)throw new _i("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new _i("Inconsistent open depths");return Pd(t,e,n,0)}function Pd(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=Pd(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return Cn(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=Gp(n,t);return Cn(o,zd(t,s,a,e,r))}else return Cn(o,Oi(t,e,r))}function Bd(t,e){if(!e.type.compatibleContent(t.type))throw new _i("Cannot join "+e.type.name+" onto "+t.type.name)}function Ms(t,e,n){let r=t.node(n);return Bd(r,e.node(n)),r}function Sn(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function br(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Sn(t.nodeAfter,r),o++));for(let a=o;a<s;a++)Sn(i.child(a),r);e&&e.depth==n&&e.textOffset&&Sn(e.nodeBefore,r)}function Cn(t,e){return t.type.checkContent(e),t.copy(e)}function zd(t,e,n,r,i){let o=t.depth>i&&Ms(t,e,i+1),s=r.depth>i&&Ms(n,r,i+1),a=[];return br(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(Bd(o,s),Sn(Cn(o,zd(t,e,n,r,i+1)),a)):(o&&Sn(Cn(o,Oi(t,e,i+1)),a),br(e,n,i,a),s&&Sn(Cn(s,Oi(n,r,i+1)),a)),br(r,null,i,a),new S(a)}function Oi(t,e,n){let r=[];if(br(null,t,n,r),t.depth>n){let i=Ms(t,e,n+1);Sn(Cn(i,Oi(t,e,n+1)),r)}return br(e,null,n,r),new S(r)}function Gp(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(S.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Nr{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return oe.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){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)&&(!n||n(this.node(r))))return new Ii(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),c=o-l;if(r.push(s,a,i+l),!c||(s=s.child(a),s.isText))break;o=c-1,i+=l+1}return new Nr(n,r,o)}static resolveCached(e,n){let r=Ml.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else Ml.set(e,r=new Jp);let i=r.elts[r.i]=Nr.resolve(e,n);return r.i=(r.i+1)%Zp,i}}class Jp{constructor(){this.elts=[],this.i=0}}const Zp=12,Ml=new WeakMap;class Ii{constructor(e,n,r){this.$from=e,this.$to=n,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)}}const Yp=Object.create(null);class pt{constructor(e,n,r,i=oe.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||S.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,n,r,i=0){this.content.nodesBetween(e,n,r,i,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,n,r,i){return this.content.textBetween(e,n,r,i)}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,n,r){return this.type==e&&Ni(this.attrs,n||e.defaultAttrs||Yp)&&oe.sameSet(this.marks,r||oe.none)}copy(e=null){return e==this.content?this:new pt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new pt(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return N.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),a=i.start(s),c=i.node(s).content.cut(i.pos-a,o.pos-a);return new N(c,i.depth-s,o.depth-s)}replace(e,n,r){return qp(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Nr.resolveCached(this,e)}resolveNoCache(e){return Nr.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}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()+")"),Hd(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=S.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);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),this.type.checkAttrs(this.attrs);let e=oe.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!oe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=S.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}}pt.prototype.text=void 0;class Ri extends pt{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Hd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ri(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ri(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Hd(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Nn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Xp(e,n);if(r.next==null)return Nn.empty;let i=Fd(r);r.next&&r.err("Unexpected trailing text");let o=om(im(i));return sm(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function o(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return S.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:d,next:u}=s.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let h=o(u,a.concat(d));if(h)return h}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.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 n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`\n`)}}Nn.empty=new Nn(!0);class Xp{constructor(e,n){this.string=e,this.nodeTypes=n,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+"')")}}function Fd(t){let e=[];do{e.push(Qp(t))}while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Qp(t){let e=[];do{e.push(em(t))}while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function em(t){let e=rm(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=tm(t,e);else break;return e}function Al(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function tm(t,e){let n=Al(t),r=n;return t.eat(",")&&(t.next!="}"?r=Al(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function nm(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function rm(t){if(t.eat("(")){let e=Fd(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=nm(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function im(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function i(s,a){s.forEach(l=>l.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(o(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=o(s.exprs[l],a);if(l==s.exprs.length-1)return c;i(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let d=n();i(o(s.expr,l),d),l=d}if(s.max==-1)i(o(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let d=n();r(l,d),i(o(s.expr,l),d),l=d}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Ud(t,e){return e-t}function Nl(t,e){let n=[];return r(e),n.sort(Ud);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];!a&&n.indexOf(l)==-1&&r(l)}}}function om(t){let e=Object.create(null);return n(Nl(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<i.length;d++)i[d][0]==a&&(c=i[d][1]);Nl(t,l).forEach(d=>{c||i.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let o=e[r.join(",")]=new Nn(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(Ud);o.next.push({type:i[s][0],next:e[a.join(",")]||n(a)})}return o}}function sm(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];s.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Vd(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Wd(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let o=t[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function Kd(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let o=t[i];o.validate&&o.validate(e[i])}}function jd(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new lm(t,r,e[r]);return n}let _l=class qd{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=jd(e,r.attrs),this.defaultAttrs=Vd(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==Nn.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:Wd(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new pt(this,this.computeAttrs(e),S.from(n),oe.setFrom(r))}createChecked(e=null,n,r){return n=S.from(n),this.checkContent(n),new pt(this,this.computeAttrs(e),n,oe.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=S.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(S.empty,!0);return o?new pt(this,e,n.append(o),oe.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.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){Kd(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:oe.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new qd(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function am(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}class lm{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?am(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class xo{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=jd(e,i.attrs),this.excluded=null;let o=Vd(this.attrs);this.instance=o?new oe(this,o):null}create(e=null){return!e&&this.instance?this.instance:new oe(this,Wd(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new xo(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Kd(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Gd{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=De.from(e.nodes),n.marks=De.from(e.marks||{}),this.nodes=_l.compile(this.spec.nodes,this),this.marks=xo.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=Nn.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?Ol(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:Ol(this,s.split(" "))}this.nodeFromJSON=i=>pt.fromJSON(this,i),this.markFromJSON=i=>oe.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof _l){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(n,r,i)}text(e,n){let r=this.nodes.text;return new Ri(r,r.defaultAttrs,e,oe.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Ol(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],s=o;if(o)n.push(o);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function cm(t){return t.tag!=null}function dm(t){return t.style!=null}class tn{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(cm(i))this.tags.push(i);else if(dm(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new Rl(this,n,!1);return r.addAll(e,oe.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Rl(this,n,!0);return r.addAll(e,oe.none,n.from,n.to),N.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(fm(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<o)break}n.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Ll(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Ll(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new tn(e,tn.schemaRules(e)))}}const Jd={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},um={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Zd={ol:!0,ul:!0},_r=1,As=2,yr=4;function Il(t,e,n){return e!=null?(e?_r:0)|(e==="full"?As:0):t&&t.whitespace=="pre"?_r|As:n&~yr}class ii{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=oe.none,this.match=o||(s&yr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(S.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&_r)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=S.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(S.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Jd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Rl{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,s=Il(null,n.preserveWhitespace,0)|(r?yr:0);i?o=new ii(i.type,i.attrs,oe.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new ii(null,null,oe.none,!0,null,s):o=new ii(e.schema.topNodeType,null,oe.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,o=i.options&As?"full":this.localPreserveWS||(i.options&_r)>0,{schema:s}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`\n`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(s.text(a[l]),n,!/\S/.test(a[l]));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 a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;Zd.hasOwnProperty(s)&&this.parser.normalizeLists&&hm(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:um.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,d=this.needsBlock;if(Jd.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let u=l&&l.skip?n:this.readStyles(e,n);u&&this.addAll(e,u),c&&this.sync(o),this.needsBlock=d}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`\n`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(o,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let o,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(o=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}o&&this.sync(a)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o)}findPlace(e,n,r){let i,o;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,o=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)n=this.enterInner(i[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=oe.none;for(let a of i.concat(e.marks))(o.type?o.type.allowsMarkType(a.type):Dl(a.type,e.type))&&(s=a.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r,!1);return o&&(o=this.enterInner(e,n,r,!0,i)),o}enterInner(e,n,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=Il(e,o,s.options);s.options&yr&&s.content.length==0&&(a|=yr);let l=oe.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Dl(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new ii(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=_r)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}else{let d=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function hm(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Zd.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function fm(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Ll(t){let e={};for(let n in t)e[n]=t[n];return e}function Dl(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||o.indexOf(d)<0&&s(d))return!0}};if(s(i.contentMatch))return!0}}class Bn{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Zo(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(o[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],d=this.serializeMark(c,s.isInline,n);d&&(o.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=vi(Zo(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&vi(Zo(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return vi(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Bn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=$l(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return $l(e.marks)}}function $l(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Zo(t){return t.document||window.document}const Pl=new WeakMap;function pm(t){let e=Pl.get(t);return e===void 0&&Pl.set(t,e=mm(t)),e}function mm(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function vi(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=pm(r))&&o.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=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?l.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):u=="style"&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let h=e[u];if(h===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:p}=vi(t,h,n,r);if(l.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const Yd=65535,Xd=Math.pow(2,16);function gm(t,e){return t+e*Xd}function Bl(t){return t&Yd}function bm(t){return(t-(t&Yd))/Xd}const Qd=1,eu=2,Ei=4,tu=8;class Ns{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&tu)>0}get deletedBefore(){return(this.delInfo&(Qd|Ei))>0}get deletedAfter(){return(this.delInfo&(eu|Ei))>0}get deletedAcross(){return(this.delInfo&Ei)>0}}class Qe{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Qe.empty)return Qe.empty}recover(e){let n=0,r=Bl(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+bm(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+o],d=this.ranges[a+s],u=l+c;if(e<=u){let h=c?e==l?-1:e==u?1:n:n,f=l+i+(h<0?0:d);if(r)return f;let p=e==(n<0?l:u)?null:gm(a/3,e-l),m=e==l?eu:e==u?Qd:Ei;return(n<0?e!=l:e!=u)&&(m|=tu),new Ns(f,m,p)}i+=d-c}return r?e+i:new Ns(e+i,0,null)}touches(e,n){let r=0,i=Bl(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+o],d=l+c;if(e<=d&&a==i*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),c=this.ranges[i+n],d=this.ranges[i+r];e(a,a+c,l,l+d),o+=d-c}}invert(){return new Qe(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Qe.empty:new Qe(e<0?[0,-e,0]:[0,0,e])}}Qe.empty=new Qe([]);class Or{constructor(e,n,r=0,i=(e?e.length:0)){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Or(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Or;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this._maps[o],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Ns(e,i,null)}}const Yo=Object.create(null);class Ve{getMap(){return Qe.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Yo[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Yo)throw new RangeError("Duplicate use of step JSON ID "+e);return Yo[e]=n,n.prototype.jsonID=e,n}}class xe{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new xe(e,null)}static fail(e){return new xe(null,e)}static fromReplace(e,n,r,i){try{return xe.ok(e.replace(n,r,i))}catch(o){if(o instanceof _i)return xe.fail(o.message);throw o}}}function fa(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(fa(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return S.fromArray(r)}class Xt extends Ve{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new N(fa(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return xe.fromReplace(e,this.from,this.to,o)}invert(){return new ft(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Xt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Xt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Xt(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Xt(n.from,n.to,e.markFromJSON(n.mark))}}Ve.jsonID("addMark",Xt);class ft extends Ve{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new N(fa(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return xe.fromReplace(e,this.from,this.to,r)}invert(){return new Xt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ft(n.pos,r.pos,this.mark)}merge(e){return e instanceof ft&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ft(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ft(n.from,n.to,e.markFromJSON(n.mark))}}Ve.jsonID("removeMark",ft);class Qt extends Ve{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return xe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return xe.fromReplace(e,this.pos,this.pos+1,new N(S.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Qt(this.pos,n.marks[i]);return new Qt(this.pos,this.mark)}}return new _n(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Qt(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Qt(n.pos,e.markFromJSON(n.mark))}}Ve.jsonID("addNodeMark",Qt);class _n extends Ve{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return xe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return xe.fromReplace(e,this.pos,this.pos+1,new N(S.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Qt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new _n(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new _n(n.pos,e.markFromJSON(n.mark))}}Ve.jsonID("removeNodeMark",_n);class _e extends Ve{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&_s(e,this.from,this.to)?xe.fail("Structure replace would overwrite content"):xe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Qe([this.from,this.to-this.from,this.slice.size])}invert(e){return new _e(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new _e(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof _e)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=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 _e(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=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 _e(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new _e(n.from,n.to,N.fromJSON(e,n.slice),!!n.structure)}}Ve.jsonID("replace",_e);class Ie extends Ve{constructor(e,n,r,i,o,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(_s(e,this.from,this.gapFrom)||_s(e,this.gapTo,this.to)))return xe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return xe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?xe.fromReplace(e,this.from,this.to,r):xe.fail("Content does not fit in gap")}getMap(){return new Qe([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Ie(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new Ie(n.pos,r.pos,i,o,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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ie(n.from,n.to,n.gapFrom,n.gapTo,N.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ve.jsonID("replaceAround",Ie);function _s(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function ym(t,e,n,r){let i=[],o=[],s,a;t.doc.nodesBetween(e,n,(l,c,d)=>{if(!l.isInline)return;let u=l.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,n),p=r.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(p)||(s&&s.to==h&&s.mark.eq(u[m])?s.to=f:i.push(s=new ft(h,f,u[m])));a&&a.to==h?a.to=f:o.push(a=new Xt(h,f,r))}}),i.forEach(l=>t.step(l)),o.forEach(l=>t.step(l))}function km(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof xo){let c=s.marks,d;for(;d=r.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let d=0;d<l.length;d++){let u=l[d],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==o-1&&u.eq(i[f].style)&&(h=p)}h?(h.to=c,h.step=o):i.push({style:u,from:Math.max(a,e),to:c,step:o})}}}),i.forEach(s=>t.step(new ft(s.from,s.to,s.style)))}function pa(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<o.childCount;l++){let c=o.child(l),d=a+c.nodeSize,u=r.matchType(c.type);if(!u)s.push(new _e(a,d,N.empty));else{r=u;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new ft(a,d,c.marks[h]));if(i&&c.isText&&n.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new N(S.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new _e(a+h.index,a+h.index+h[0].length,p))}}a=d}if(!r.validEnd){let l=r.fillBefore(S.empty,!0);t.replace(a,a,new N(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function wm(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function ar(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,o=0;;--r){let s=t.$from.node(r),a=t.$from.index(r)+i,l=t.$to.indexAfter(r)-o;if(r<t.depth&&s.canReplace(a,l,n))return r;if(r==0||s.type.spec.isolating||!wm(s,a,l))break;a&&(i=1),l<s.childCount&&(o=1)}return null}function vm(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),l=s,c=a,d=S.empty,u=0;for(let p=o,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,d=S.from(r.node(p).copy(d)),u++):l--;let h=S.empty,f=0;for(let p=o,m=!1;p>n;p--)m||i.after(p+1)<i.end(p)?(m=!0,h=S.from(i.node(p).copy(h)),f++):c++;t.step(new Ie(l,c,s,a,new N(d.append(h),u,f),d.size-u,!0))}function ma(t,e,n=null,r=t){let i=Em(t,e),o=i&&xm(r,e);return o?i.map(zl).concat({type:e,attrs:n}).concat(o.map(zl)):null}function zl(t){return{type:t,attrs:null}}function Em(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return n.canReplaceWith(r,i,s)?o:null}function xm(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function Sm(t,e,n){let r=S.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=S.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new Ie(i,o,i,o,new N(r,0,0),n.length,!0))}function Cm(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&Tm(t.doc,t.mapping.slice(o).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&ru(t,s,a,o),pa(t,t.mapping.slice(o).map(a,1),r,void 0,c===null);let d=t.mapping.slice(o),u=d.map(a,1),h=d.map(a+s.nodeSize,1);return t.step(new Ie(u,h,u+1,h-1,new N(S.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&nu(t,s,a,o),!1}})}function nu(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function ru(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(`\n`))}})}function Tm(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Mm(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ie(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new N(S.from(s),0,0),1,!0))}function Pt(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,d=n-2;c>o;c--,d--){let u=i.node(c),h=i.index(c);if(u.type.spec.isolating)return!1;let f=u.content.cutByIndex(h,u.childCount),p=r&&r[d+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[d]||u;if(!u.canReplace(h+1,u.childCount)||!m.type.validContent(f))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function Am(t,e,n=1,r){let i=t.doc.resolve(e),o=S.empty,s=S.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){o=S.from(i.node(a).copy(o));let d=r&&r[c];s=S.from(d?d.type.create(d.attrs,s):i.node(a).copy(s))}t.step(new _e(e,e,new N(o.append(s),n,n),!0))}function dn(t,e){let n=t.resolve(e),r=n.index();return iu(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Nm(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?t.type.schema.nodes.text:o.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(o.marks))return!1}return n.validEnd}function iu(t,e){return!!(t&&e&&!t.isLeaf&&Nm(t,e))}function So(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let o,s,a=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):n>0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&iu(o,s)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function _m(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),s=o.node().type;if(i&&s.inlineContent){let d=s.whitespace=="pre",u=!!s.contentMatch.matchType(i);d&&!u?r=!1:!d&&u&&(r=!0)}let a=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);ru(t,d.node(),d.before(),a)}s.inlineContent&&pa(t,e+n-1,s,o.node().contentMatchAt(o.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new _e(c,l.map(e+n,-1),N.empty,!0)),r===!0){let d=t.doc.resolve(c);nu(t,d.node(),d.before(),t.steps.length)}return t}function Om(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function ou(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),d=!1;if(o==1)d=c.canReplace(l,l,i);else{let u=c.contentMatchAt(l).findWrapping(i.firstChild.type);d=u&&c.canReplaceWith(l,l,u[0])}if(d)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Co(t,e,n=e,r=N.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return su(i,o,r)?new _e(e,n,r):new Im(i,o,r).fit()}function su(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Im{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=S.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=S.from(e.node(i).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(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new N(o,s,a);return e>-1?new Ie(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new _e(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=Xo(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,u=null;if(n==1&&(s?c.matchType(s.type)||(u=c.fillBefore(S.from(s),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:u};if(n==2&&s&&(d=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:d};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Xo(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new N(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Xo(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new N(fr(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new N(fr(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[m]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,c=0,d=[],{match:u,type:h}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)d.push(i.child(m));u=u.matchFragment(i)}let f=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let m=a.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(u=g,d.push(au(m.mark(h.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?f:-1)))}let p=c==a.childCount;p||(f=-1),this.placed=pr(this.placed,n,S.from(d)),this.frontier[n].match=u,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?N.empty:new N(fr(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new N(fr(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Qo(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Qo(e,n,i,r,o);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=Qo(e,a,c,l,!0);if(!d||d.childCount)continue e}return{depth:n,fit:s,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=pr(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=pr(this.placed,this.depth,S.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(S.empty,!0);n.childCount&&(this.placed=pr(this.placed,this.frontier.length,n))}}function fr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(fr(t.firstChild.content,e-1,n)))}function pr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(pr(t.lastChild.content,e-1,n)))}function Xo(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function au(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,au(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(S.empty,!0)))),t.copy(r)}function Qo(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!Rm(n,o.content,s)?a:null}function Rm(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Lm(t){return t.spec.defining||t.spec.definingForContent}function Dm(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(su(i,o,r))return t.step(new _e(e,n,r));let s=cu(i,o);s[s.length-1]==0&&s.pop();let a=-(i.depth+1);s.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(h)>-1?a=h:i.before(h)==f&&s.splice(1,0,-h)}let l=s.indexOf(a),c=[],d=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==r.openStart)break;h=p.content}for(let h=d-1;h>=0;h--){let f=c[h],p=Lm(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))d=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+d+1)%(r.openStart+1),p=c[f];if(p)for(let m=0;m<s.length;m++){let g=s[(m+l)%s.length],b=!0;g<0&&(b=!1,g=-g);let k=i.node(g-1),w=i.index(g-1);if(k.canReplaceWith(w,w,p.type,p.marks))return t.replace(i.before(g),b?o.after(g):n,new N(lu(r.content,0,r.openStart,f),f,r.openEnd))}}let u=t.steps.length;for(let h=s.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>u));h--){let f=s[h];f<0||(e=i.before(f),n=o.after(f))}}function lu(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(lu(o.content,e+1,n,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(S.empty,!0))}return t}function $m(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Om(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new N(S.from(r),0,0))}function Pm(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=cu(r,i);for(let s=0;s<o.length;s++){let a=o[s],l=s==o.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function cu(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(o<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class Zn extends Ve{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return xe.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return xe.fromReplace(e,this.pos,this.pos+1,new N(S.from(i),0,n.isLeaf?0:1))}getMap(){return Qe.empty}invert(e){return new Zn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Zn(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Zn(n.pos,n.attr,n.value)}}Ve.jsonID("attr",Zn);class Ir extends Ve{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return xe.ok(r)}getMap(){return Qe.empty}invert(e){return new Ir(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ir(n.attr,n.value)}}Ve.jsonID("docAttr",Ir);let Xn=class extends Error{};Xn=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Xn.prototype=Object.create(Error.prototype);Xn.prototype.constructor=Xn;Xn.prototype.name="TransformError";class ga{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Or}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Xn(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=N.empty){let i=Co(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new N(S.from(r),0,0))}delete(e,n){return this.replace(e,n,N.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Dm(this,e,n,r),this}replaceRangeWith(e,n,r){return $m(this,e,n,r),this}deleteRange(e,n){return Pm(this,e,n),this}lift(e,n){return vm(this,e,n),this}join(e,n=1){return _m(this,e,n),this}wrap(e,n){return Sm(this,e,n),this}setBlockType(e,n=e,r,i=null){return Cm(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return Mm(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Zn(e,n,r)),this}setDocAttribute(e,n){return this.step(new Ir(e,n)),this}addNodeMark(e,n){return this.step(new Qt(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof oe)n.isInSet(r.marks)&&this.step(new _n(e,n));else{let i=r.marks,o,s=[];for(;o=n.isInSet(i);)s.push(new _n(e,o)),i=o.removeFromSet(i);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,n=1,r){return Am(this,e,n,r),this}addMark(e,n,r){return ym(this,e,n,r),this}removeMark(e,n,r){return km(this,e,n,r),this}clearIncompatible(e,n,r){return pa(this,e,n,r),this}}const es=Object.create(null);class U{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new du(e.min(n),e.max(n))]}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 n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=N.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],d=e.mapping.slice(o);e.replaceRange(d.map(l.pos),d.map(c.pos),a?N.empty:n),a==0&&Ul(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=e.mapping.slice(r),c=l.map(s.pos),d=l.map(a.pos);o?e.deleteRange(c,d):(e.replaceRangeWith(c,d,n),Ul(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new P(e):Vn(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=n<0?Vn(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Vn(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new tt(e.node(0))}static atStart(e){return Vn(e,e,0,0,1)||new tt(e)}static atEnd(e){return Vn(e,e,e.content.size,e.childCount,-1)||new tt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=es[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in es)throw new RangeError("Duplicate use of selection JSON ID "+e);return es[e]=n,n.prototype.jsonID=e,n}getBookmark(){return P.between(this.$anchor,this.$head).getBookmark()}}U.prototype.visible=!0;class du{constructor(e,n){this.$from=e,this.$to=n}}let Hl=!1;function Fl(t){!Hl&&!t.parent.inlineContent&&(Hl=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class P extends U{constructor(e,n=e){Fl(e),Fl(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return U.near(r);let i=e.resolve(n.map(this.anchor));return new P(i.parent.inlineContent?i:r,r)}replace(e,n=N.empty){if(super.replace(e,n),n==N.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof P&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new To(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new P(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=U.findFrom(n,r,!0)||U.findFrom(n,-r,!0);if(o)n=o.$head;else return U.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(U.findFrom(e,-r,!0)||U.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new P(e,n)}}U.jsonID("text",P);class To{constructor(e,n){this.anchor=e,this.head=n}map(e){return new To(e.map(this.anchor),e.map(this.head))}resolve(e){return P.between(e.resolve(this.anchor),e.resolve(this.head))}}class B extends U{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?U.near(o):new B(o)}content(){return new N(S.from(this.node),0,0)}eq(e){return e instanceof B&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ba(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new B(e.resolve(n.anchor))}static create(e,n){return new B(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}B.prototype.visible=!1;U.jsonID("node",B);class ba{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new To(r,r):new ba(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&B.isSelectable(r)?new B(n):U.near(n)}}class tt extends U{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=N.empty){if(n==N.empty){e.delete(0,e.doc.content.size);let r=U.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new tt(e)}map(e){return new tt(e)}eq(e){return e instanceof tt}getBookmark(){return Bm}}U.jsonID("all",tt);const Bm={map(){return this},resolve(t){return new tt(t)}};function Vn(t,e,n,r,i,o=!1){if(e.inlineContent)return P.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&B.isSelectable(a))return B.create(t,n-(i<0?a.nodeSize:0))}else{let l=Vn(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i}return null}function Ul(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof _e||i instanceof Ie))return;let o=t.mapping.maps[r],s;o.forEach((a,l,c,d)=>{s==null&&(s=d)}),t.setSelection(U.near(t.doc.resolve(s),n))}const Vl=1,oi=2,Wl=4;class zm extends ga{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|Vl)&~oi,this.storedMarks=null,this}get selectionSet(){return(this.updated&Vl)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=oi,this}ensureMarks(e){return oe.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&oi)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~oi,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||oe.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(U.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,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|=Wl,this}get scrolledIntoView(){return(this.updated&Wl)>0}}function Kl(t,e){return!e||!t?t:t.bind(e)}class mr{constructor(e,n,r){this.name=e,this.init=Kl(n.init,r),this.apply=Kl(n.apply,r)}}const Hm=[new mr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new mr("selection",{init(t,e){return t.selection||U.atStart(e.doc)},apply(t){return t.selection}}),new mr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new mr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class ts{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Hm.slice(),n&&n.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 mr(r.key,r.spec.state,r))})}}class Jn{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,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=i?i[s].n:0,c=i?i[s].state:this,d=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(d&&r.filterTransaction(d,s)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<s?{state:r,n:n.length}:{state:this,n:0})}n.push(d),r=r.applyInner(d),o=!0}i&&(i[s]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Jn(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(e,this[o.name],this,n)}return n}get tr(){return new zm(this)}static create(e){let n=new ts(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Jn(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new ts(this.schema,e.plugins),r=n.fields,i=new Jn(n);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.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 i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new ts(e.schema,e.plugins),o=new Jn(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=pt.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=U.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[s.name]=c.fromJSON.call(l,e,n[a],o);return}}o[s.name]=s.init(e,o)}}),o}}function uu(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=uu(i,e,{})),n[r]=i}return n}class Q{constructor(e){this.spec=e,this.props={},e.props&&uu(e.props,this,this.props),this.key=e.key?e.key.key:hu("plugin")}getState(e){return e[this.key]}}const ns=Object.create(null);function hu(t){return t in ns?t+"$"+ ++ns[t]:(ns[t]=0,t+"$")}class ae{constructor(e="key"){this.key=hu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ya=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function fu(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const pu=(t,e,n)=>{let r=fu(t,n);if(!r)return!1;let i=ka(r);if(!i){let s=r.blockRange(),a=s&&ar(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(xu(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Qn(o,"end")||B.isSelectable(o)))for(let s=r.depth;;s--){let a=Co(t.doc,r.before(s),r.after(s),N.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Qn(o,"end")?U.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):B.create(l.doc,i.pos-o.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},Fm=(t,e,n)=>{let r=fu(t,n);if(!r)return!1;let i=ka(r);return i?mu(t,i,e):!1},Um=(t,e,n)=>{let r=bu(t,n);if(!r)return!1;let i=wa(r);return i?mu(t,i,e):!1};function mu(t,e,n){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let s=e.nodeAfter,a=s,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let c=Co(t.doc,o,l,N.empty);if(!c||c.from!=o||c instanceof _e&&c.slice.size>=l-o)return!1;if(n){let d=t.tr.step(c);d.setSelection(P.create(d.doc,o)),n(d.scrollIntoView())}return!0}function Qn(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const gu=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=ka(r)}let s=o&&o.nodeBefore;return!s||!B.isSelectable(s)?!1:(e&&e(t.tr.setSelection(B.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function ka(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function bu(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const yu=(t,e,n)=>{let r=bu(t,n);if(!r)return!1;let i=wa(r);if(!i)return!1;let o=i.nodeAfter;if(xu(t,i,e,1))return!0;if(r.parent.content.size==0&&(Qn(o,"start")||B.isSelectable(o))){let s=Co(t.doc,r.before(),r.after(),N.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(Qn(o,"start")?U.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):B.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},ku=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;o=wa(r)}let s=o&&o.nodeAfter;return!s||!B.isSelectable(s)?!1:(e&&e(t.tr.setSelection(B.create(t.doc,o.pos)).scrollIntoView()),!0)};function wa(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Vm=(t,e)=>{let n=t.selection,r=n instanceof B,i;if(r){if(n.node.isTextblock||!dn(t.doc,n.from))return!1;i=n.from}else if(i=So(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(B.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Wm=(t,e)=>{let n=t.selection,r;if(n instanceof B){if(n.node.isTextblock||!dn(t.doc,n.to))return!1;r=n.to}else if(r=So(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Km=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&ar(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},wu=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`\n`).scrollIntoView()),!0)};function va(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const jm=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=va(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(U.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},vu=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof tt||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=va(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(s,o.createAndFill());a.setSelection(P.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},Eu=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Pt(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&ar(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function qm(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof B&&e.selection.node.isBlock)return!r.parentOffset||!Pt(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,a,l=!1,c=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){l=r.end(f)==r.pos+(r.depth-f),c=r.start(f)==r.pos-(r.depth-f),a=va(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),o.unshift(l&&a?{type:a}:null),s=f;break}else{if(f==1)return!1;o.unshift(null)}let d=e.tr;(e.selection instanceof P||e.selection instanceof tt)&&d.deleteSelection();let u=d.mapping.map(r.pos),h=Pt(d.doc,u,o.length,o);if(h||(o[0]=a?{type:a}:null,h=Pt(d.doc,u,o.length,o)),!h)return!1;if(d.split(u,o.length,o),!l&&c&&r.node(s).type!=a){let f=d.mapping.map(r.before(s)),p=d.doc.resolve(f);a&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,a)&&d.setNodeMarkup(d.mapping.map(r.before(s)),a)}return n&&n(d.scrollIntoView()),!0}}const Gm=qm(),Jm=(t,e)=>{let{$from:n,to:r}=t.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(B.create(t.doc,i))),!0)};function Zm(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||dn(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function xu(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&Zm(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(s[0]||o.type).validEnd){if(n){let f=e.pos+o.nodeSize,p=S.empty;for(let b=s.length-1;b>=0;b--)p=S.from(s[b].create(null,p));p=S.from(i.copy(p));let m=t.tr.step(new Ie(e.pos-1,f,e.pos,f,new N(p,1,0),s.length,!0)),g=m.doc.resolve(f+2*s.length);g.nodeAfter&&g.nodeAfter.type==i.type&&dn(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let d=o.type.spec.isolating||r>0&&l?null:U.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),h=u&&ar(u);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(u,h).scrollIntoView()),!0;if(c&&Qn(o,"start",!0)&&Qn(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=o,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(n){let b=S.empty;for(let w=p.length-1;w>=0;w--)b=S.from(p[w].copy(b));let k=t.tr.step(new Ie(e.pos-p.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new N(b,p.length,0),0,!0));n(k.scrollIntoView())}return!0}}return!1}function Su(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(P.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const Ym=Su(-1),Xm=Su(1);function Qm(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&ma(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function jl(t,e=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[o];n.doc.nodesBetween(s,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let d=n.doc.resolve(c),u=d.index();i=d.parent.canReplaceWith(u,u+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];o.setBlockType(a,l,t,e)}r(o.scrollIntoView())}return!0}}function Ea(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}Ea(ya,pu,gu);Ea(ya,yu,ku);Ea(wu,vu,Eu,Gm);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function eg(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o);if(!s)return!1;let a=r?n.tr:null;return tg(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function tg(t,e,n,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=s.resolve(e.start-2);o=new Ii(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Ii(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=ma(o,n,r,e);return a?(t&&ng(t,e,a,i,n),!0):!1}function ng(t,e,n,r,i){let o=S.empty;for(let d=n.length-1;d>=0;d--)o=S.from(n[d].type.create(n[d].attrs,o));t.step(new Ie(e.start-(r?2:0),e.end,e.start,e.end,new N(o,0,0),n.length,!0));let s=0;for(let d=0;d<n.length;d++)n[d].type==i&&(s=d+1);let a=n.length-s,l=e.start+n.length-(r?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,h=!0;d<u;d++,h=!1)!h&&Pt(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return t}function rg(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?ig(e,n,t,o):og(e,n,o):!0:!1}}function ig(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new Ie(o-1,s,o,s,new N(S.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ii(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=ar(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(o,-1)-1);return dn(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function og(t,e,n){let r=t.tr,i=n.parent;for(let f=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,c=o.node(-1),d=o.index(-1);if(!c.canReplace(d+(a?0:1),d+1,s.content.append(l?S.empty:S.from(i))))return!1;let u=o.pos,h=u+s.nodeSize;return r.step(new Ie(u-(a?1:0),h+(l?1:0),u+1,h-1,new N((a?S.empty:S.from(i.copy(S.empty))).append(l?S.empty:S.from(i.copy(S.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function sg(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,d=S.from(c?t.create():null),u=new N(S.from(t.create(null,S.from(a.type.create(null,d)))),c?3:1,0),h=o.start,f=o.end;n(e.tr.step(new Ie(h-(c?3:1),f,h,f,u,1,!0)).scrollIntoView())}return!0}}const $e=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},er=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Os=null;const Dt=function(t,e,n){let r=Os||(Os=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},ag=function(){Os=null},On=function(t,e,n,r){return n&&(ql(t,e,n,r,-1)||ql(t,e,n,r,1))},lg=/^(img|br|input|textarea|hr)$/i;function ql(t,e,n,r,i){for(var o;;){if(t==n&&e==r)return!0;if(e==(i<0?0:ot(t))){let s=t.parentNode;if(!s||s.nodeType!=1||Wr(t)||lg.test(t.nodeName)||t.contentEditable=="false")return!1;e=$e(t)+(i<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else t=s,e=i<0?ot(t):0}else return!1}}function ot(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function cg(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=ot(t)}else if(t.parentNode&&!Wr(t))e=$e(t),t=t.parentNode;else return null}}function dg(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Wr(t))e=$e(t)+1,t=t.parentNode;else return null}}function ug(t,e,n){for(let r=e==0,i=e==ot(t);r||i;){if(t==n)return!0;let o=$e(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==ot(t)}}function Wr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Mo=function(t){return t.focusNode&&On(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function yn(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function hg(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function fg(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(ot(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(ot(r.startContainer),r.startOffset)}}}const Et=typeof navigator<"u"?navigator:null,Gl=typeof document<"u"?document:null,un=Et&&Et.userAgent||"",Is=/Edge\/(\d+)/.exec(un),Cu=/MSIE \d/.exec(un),Rs=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(un),Je=!!(Cu||Rs||Is),nn=Cu?document.documentMode:Rs?+Rs[1]:Is?+Is[1]:0,st=!Je&&/gecko\/(\d+)/i.test(un);st&&+(/Firefox\/(\d+)/.exec(un)||[0,0])[1];const Ls=!Je&&/Chrome\/(\d+)/.exec(un),Oe=!!Ls,Tu=Ls?+Ls[1]:0,Be=!Je&&!!Et&&/Apple Computer/.test(Et.vendor),tr=Be&&(/Mobile\/\w+/.test(un)||!!Et&&Et.maxTouchPoints>2),it=tr||(Et?/Mac/.test(Et.platform):!1),Mu=Et?/Win/.test(Et.platform):!1,$t=/Android \d/.test(un),Kr=!!Gl&&"webkitFontSmoothing"in Gl.documentElement.style,pg=Kr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function mg(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function _t(t,e){return typeof t=="number"?t:t[e]}function gg(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Jl(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=er(s);continue}let a=s,l=a==o.body,c=l?mg(o):gg(a),d=0,u=0;if(e.top<c.top+_t(r,"top")?u=-(c.top-e.top+_t(i,"top")):e.bottom>c.bottom-_t(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+_t(i,"top")-c.top:e.bottom-c.bottom+_t(i,"bottom")),e.left<c.left+_t(r,"left")?d=-(c.left-e.left+_t(i,"left")):e.right>c.right-_t(r,"right")&&(d=e.right-c.right+_t(i,"right")),d||u)if(l)o.defaultView.scrollBy(d,u);else{let f=a.scrollLeft,p=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);let m=a.scrollLeft-f,g=a.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let h=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(h))break;s=h=="absolute"?s.offsetParent:er(s)}}function bg(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=t.root.elementFromPoint(o,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Au(t.dom)}}function Au(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=er(r));return e}function yg({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Nu(n,r==0?0:r-e)}function Nu(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:o}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Fn=null;function kg(t){if(t.setActive)return t.setActive();if(Fn)return t.focus(Fn);let e=Au(t);t.focus(Fn==null?{get preventScroll(){return Fn={preventScroll:!0},!0}}:void 0),Fn||(Fn=!1,Nu(e,0))}function _u(t,e){let n,r=2e8,i,o=0,s=e.top,a=e.top,l,c;for(let d=t.firstChild,u=0;d;d=d.nextSibling,u++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=Dt(d).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=s&&p.bottom>=a){s=Math.max(p.bottom,s),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=d,r=m,i=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,d.nodeType==1&&m&&(o=u+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(o=u+1)}}return!n&&l&&(n=l,i=c,r=0),n&&n.nodeType==3?wg(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:_u(n,i)}function wg(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let s=Wt(r,1);if(s.top!=s.bottom&&xa(e,s)){i={node:t,offset:o+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function xa(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function vg(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Eg(t,e,n){let{node:r,offset:i}=_u(e,n),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function xg(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!s&&l.left>r.left||l.top>r.top?i=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),s=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;o=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Ou(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let s=t.childNodes[o];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(xa(e,c))return Ou(s,e,c)}}if((o=(o+1)%r)==i)break}return t}function Sg(t,e){let n=t.dom.ownerDocument,r,i=0,o=fg(n,e.left,e.top);o&&({node:r,offset:i}=o);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!xa(e,c)||(s=Ou(t.dom,e,c),!s))return null}if(Be)for(let c=s;r&&c;c=er(c))c.draggable&&(r=void 0);if(s=vg(s,e),r){if(st&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&i++}let c;Kr&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=xg(t,r,i,e))}a==null&&(a=Eg(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Zl(t){return t.top<t.bottom||t.left<t.right}function Wt(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Zl(r))return r}return Array.prototype.find.call(n,Zl)||t.getBoundingClientRect()}const Cg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Iu(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=Kr||st;if(r.nodeType==3)if(s&&(Cg.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=Wt(Dt(r,i,i),n);if(st&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Wt(Dt(r,i-1,i-1),-1);if(c.top==l.top){let d=Wt(Dt(r,i,i+1),-1);if(d.top!=l.top)return dr(d,d.left<c.left)}}return l}else{let l=i,c=i,d=n<0?1:-1;return n<0&&!i?(c++,d=-1):n>=0&&i==r.nodeValue.length?(l--,d=1):n<0?l--:c++,dr(Wt(Dt(r,l,c),d),d<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==ot(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return rs(l.getBoundingClientRect(),!1)}if(o==null&&i<ot(r)){let l=r.childNodes[i];if(l.nodeType==1)return rs(l.getBoundingClientRect(),!0)}return rs(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==ot(r))){let l=r.childNodes[i-1],c=l.nodeType==3?Dt(l,ot(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return dr(Wt(c,1),!1)}if(o==null&&i<ot(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Dt(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return dr(Wt(c,-1),!0)}return dr(Wt(r.nodeType==3?Dt(r):r,-n),n>=0)}function dr(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function rs(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Ru(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function Tg(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Ru(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=Iu(t,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Dt(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(n=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}const Mg=/[\u0590-\u08ac]/;function Ag(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=t.domSelection();return a?!Mg.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:s:Ru(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:u}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==m;try{a.collapse(d,u),l&&(l!=d||c!=u)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),g}):r.pos==r.start()||r.pos==r.end()}let Yl=null,Xl=null,Ql=!1;function Ng(t,e,n){return Yl==e&&Xl==n?Ql:(Yl=e,Xl=n,Ql=n=="up"||n=="down"?Tg(t,e,n):Ag(t,e,n))}const at=0,ec=1,kn=2,xt=3;class jr{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=at,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].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 n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.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,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>$e(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let a=i.children[s];if(a.size){i=a;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.size;if(a>e||s instanceof Du){i=e-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Lu&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?$e(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?$e(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(i==-1&&e<=c){let d=s+l.border;if(e>=d&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,d);e=s;for(let u=a;u>0;u--){let h=this.children[u-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=$e(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>n||a==this.children.length-1)){n=c;for(let d=a+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){o=$e(u.dom);break}n+=u.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let o=Math.min(e,n),s=Math.max(e,n);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],g=p+m.size;if(o>p&&s<g)return m.setSelection(e-p-m.border,n-p-m.border,r,i);p=g}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),d=r.domSelectionRange(),u=!1;if((st||Be)&&e==n){let{node:f,offset:p}=a;if(f.nodeType==3){if(u=!!(p&&f.nodeValue[p-1]==`\n`),u&&p==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:$e(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=f.childNodes[p-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(st&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let f=d.focusNode.childNodes[d.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||u&&Be)&&On(a.node,a.offset,d.anchorNode,d.anchorOffset)&&On(l.node,l.offset,d.focusNode,d.focusOffset))return;let h=!1;if((c.extend||e==n)&&!(u&&st)){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>n){let p=a;a=l,l=p}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let a=r+o.border,l=s-o.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?kn:ec,e==a&&n==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=xt:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?kn:xt}r=s}this.dirty=kn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?kn:ec;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Lu extends jr{constructor(e,n,r,i){let o,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==at&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(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}}class _g extends jr{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class In extends jr{constructor(e,n,r,i,o){super(e,[],r,i),this.mark=n,this.spec=o}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=Bn.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new In(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&xt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=xt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=at){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=at}}slice(e,n,r){let i=In.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=$s(o,n,s,r)),e>0&&(o=$s(o,0,e,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class rn extends jr{constructor(e,n,r,i,o,s,a,l,c){super(e,[],o,s),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,o,s){let a=o.nodeViews[n.type.name],l,c=a&&a(n,o,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,i),d=c&&c.dom,u=c&&c.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=Bn.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!u&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let h=d;return d=Bu(d,r,n),c?l=new Og(e,n,r,i,d,u||null,h,c,o,s+1):n.isText?new Ao(e,n,r,i,d,h,o):new rn(e,n,r,i,d,u||null,h,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>S.empty)}return e}matchesNode(e,n,r){return this.dirty==at&&e.eq(this.node)&&Li(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new Rg(this,s&&s.node,e);$g(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,d):c.type.side>=0&&!u&&l.syncToMarks(d==this.node.childCount?oe.none:this.node.child(d).marks,r,e,d),l.placeWidget(c,e,i)},(c,d,u,h)=>{l.syncToMarks(c.marks,r,e,h);let f;l.findNodeMatch(c,d,u,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(f=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(c,d,u,f,e)||l.updateNextNode(c,d,u,e,h,i)||l.addNode(c,d,u,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==kn)&&(s&&this.protectLocalComposition(e,s),$u(this.contentDOM,this.children,e),tr&&Pg(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof P)||r<n||i>n+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,a=Bg(this.node.content,s,r-n,i-n);return a<0?null:{node:o,pos:a,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new _g(this,o,n,i);e.input.compositionNodes.push(s),this.children=$s(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==xt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=at}updateOuterDeco(e){if(Li(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Pu(this.dom,this.nodeDOM,Ds(this.outerDeco,this.node,n),Ds(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function tc(t,e,n,r,i){Bu(r,e,t);let o=new rn(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Ao extends rn{constructor(e,n,r,i,o,s,a){super(e,n,r,i,o,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==xt||this.dirty!=at&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=at||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=at,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new Ao(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=xt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Du extends jr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==at&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Og extends rn{constructor(e,n,r,i,o,s,a,l,c,d){super(e,n,r,i,o,s,a,c,d),this.spec=l}update(e,n,r,i){if(this.dirty==xt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function $u(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=nc(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(s instanceof In){let l=r?r.previousSibling:t.lastChild;$u(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=nc(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const kr=function(t){t&&(this.nodeName=t)};kr.prototype=Object.create(null);const wn=[new kr];function Ds(t,e,n){if(t.length==0)return wn;let r=n?wn[0]:new kr,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new kr(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&i.length==1&&i.push(r=new kr(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function Pu(t,e,n,r){if(n==wn&&r==wn)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],a=n[o];if(o){let l;a&&a.nodeName==s.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=wn[0]),i=l}Ig(i,a||wn[0],s)}return i}function Ig(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&t.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&t.classList.add(i[o]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Bu(t,e,n){return Pu(t,t,wn,Ds(e,n,t.nodeType!=1))}function Li(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function nc(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Rg{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Lg(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let o=0,s=this.stack.length>>1,a=Math.min(s,e.length);for(;o<a&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=at,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let d=this.index;d<c;d++){let u=this.top.children[d];if(u.matchesMark(e[s])&&!this.isLocked(u.dom)){l=d;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let d=In.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){o=a;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,n,r,i,o){let s=this.top.children[i];return s.dirty==xt&&s.dom==s.contentDOM&&(s.dirty=kn),s.update(e,n,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,o,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof rn){let c=this.preMatch.matched.get(l);if(c!=null&&c!=o)return!1;let d=l.dom,u,h=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=xt&&Li(n,l.outerDeco));if(!h&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(u=this.recreateWrapper(l,e,n,r,i,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=kn,u.updateChildren(i,s+1),u.dirty=at),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,o,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Li(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=rn.create(this.top,n,r,i,o,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,o){let s=rn.create(this.top,e,n,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new Lu(this.top,e,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof In;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Ao)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Be||Oe)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.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 i=new Du(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Lg(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,s=[];e:for(;i>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof In)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function Dg(t,e){return t.type.side-e.type.side}function $g(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let d=t.child(c);r(d,i,e.forChild(o,d),c),o+=d.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let d,u;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(d?(u||(u=[d])).push(g):d=g)}if(d)if(u){u.sort(Dg);for(let g=0;g<u.length;g++)n(u[g],c,!!l)}else n(d,c,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(c<t.childCount)f=c,h=t.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=o&&a.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let p=o+h.nodeSize;if(h.isText){let g=p;s<i.length&&i[s].from<g&&(g=i[s].from);for(let b=0;b<a.length;b++)a[b].to<g&&(g=a[b].to);g<p&&(l=h.cut(g-o),h=h.cut(0,g-o),p=g,f=-1)}else for(;s<i.length&&i[s].to<p;)s++;let m=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();r(h,m,e.forChild(o,h),f),o=p}}function Pg(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Bg(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let s=t.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<t.childCount;){let c=t.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=n){if(o>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function $s(t,e,n,r,i){let o=[];for(let s=0,a=0;s<t.length;s++){let l=t[s],c=a,d=a+=l.size;c>=n||d<=e?o.push(l):(c<e&&o.push(l.slice(0,e-c,r)),i&&(o.push(i),i=void 0),d>n&&o.push(l.slice(n-c,l.size,r)))}return o}function Sa(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(Mo(n)){for(l=s;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&B.isSelectable(u)&&i.parent&&!(u.isInline&&ug(n.focusNode,n.focusOffset,i.dom))){let h=i.posBefore;c=new B(s==h?a:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let u=s,h=s;for(let f=0;f<n.rangeCount;f++){let p=n.getRangeAt(f);u=Math.min(u,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(u<0)return null;[l,s]=h==t.state.selection.anchor?[h,u]:[u,h],a=r.resolve(s)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!c){let u=e=="pointer"||t.state.selection.head<a.pos&&!o?1:-1;c=Ca(t,d,a,u)}return c}function zu(t){return t.editable?t.hasFocus():Fu(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Bt(t,e=!1){let n=t.state.selection;if(Hu(t,n),!!zu(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Oe){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&On(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Hg(t);else{let{anchor:r,head:i}=n,o,s;rc&&!(n instanceof P)&&(n.$from.parent.inlineContent||(o=ic(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=ic(t,n.to))),t.docView.setSelection(r,i,t,e),rc&&(o&&oc(o),s&&oc(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&zg(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const rc=Be||Oe&&Tu<63;function ic(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(Be&&i&&i.contentEditable=="false")return is(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return is(i);if(o)return is(o)}}function is(t){return t.contentEditable="true",Be&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function oc(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function zg(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!zu(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Hg(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,$e(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Je&&nn<=11&&(n.disabled=!0,n.disabled=!1)}function Hu(t,e){if(e instanceof B){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(sc(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else sc(t)}function sc(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Ca(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||P.between(e,n,r)}function ac(t){return t.editable&&!t.hasFocus()?!1:Fu(t)}function Fu(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Fg(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return On(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Ps(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&U.findFrom(o,e)}function Kt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function lc(t,e,n){let r=t.state.selection;if(r instanceof P)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return Kt(t,new P(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Ps(t.state,e);return i&&i instanceof B?Kt(t,i):!1}else if(!(it&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?B.isSelectable(o)?Kt(t,new B(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Kr?Kt(t,new P(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof B&&r.node.isInline)return Kt(t,new P(e>0?r.$to:r.$from));{let i=Ps(t.state,e);return i?Kt(t,i):!1}}}function Di(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function wr(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Un(t,e){return e<0?Ug(t):Vg(t)}function Ug(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(st&&n.nodeType==1&&r<Di(n)&&wr(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(wr(a,-1))i=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(Uu(n))break;{let a=n.previousSibling;for(;a&&wr(a,-1);)i=n.parentNode,o=$e(a),a=a.previousSibling;if(a)n=a,r=Di(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Bs(t,n,r):i&&Bs(t,i,o)}function Vg(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Di(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(wr(a,1))o=n,s=++r;else break}else{if(Uu(n))break;{let a=n.nextSibling;for(;a&&wr(a,1);)o=a.parentNode,s=$e(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=Di(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&Bs(t,o,s)}function Uu(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Wg(t,e){for(;t&&e==t.childNodes.length&&!Wr(t);)e=$e(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Kg(t,e){for(;t&&!e&&!Wr(t);)e=$e(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Bs(t,e,n){if(e.nodeType!=3){let o,s;(s=Wg(e,n))?(e=s,n=0):(o=Kg(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Mo(r)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Bt(t)},50)}function cc(t,e){let n=t.state.doc.resolve(e);if(!(Oe||Mu)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function dc(t,e,n){let r=t.state.selection;if(r instanceof P&&!r.empty||n.indexOf("s")>-1||it&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Ps(t.state,e);if(s&&s instanceof B)return Kt(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof tt?U.near(s,e):U.findFrom(s,e);return a?Kt(t,a):!1}return!1}function uc(t,e){if(!(t.state.selection instanceof P))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function hc(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function jg(t){if(!Be||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;hc(t,r,"true"),setTimeout(()=>hc(t,r,"false"),20)}return!1}function qg(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Gg(t,e){let n=e.keyCode,r=qg(e);if(n==8||it&&n==72&&r=="c")return uc(t,-1)||Un(t,-1);if(n==46&&!e.shiftKey||it&&n==68&&r=="c")return uc(t,1)||Un(t,1);if(n==13||n==27)return!0;if(n==37||it&&n==66&&r=="c"){let i=n==37?cc(t,t.state.selection.from)=="ltr"?-1:1:-1;return lc(t,i,r)||Un(t,i)}else if(n==39||it&&n==70&&r=="c"){let i=n==39?cc(t,t.state.selection.from)=="ltr"?1:-1:1;return lc(t,i,r)||Un(t,i)}else{if(n==38||it&&n==80&&r=="c")return dc(t,-1,r)||Un(t,-1);if(n==40||it&&n==78&&r=="c")return jg(t)||dc(t,1,r)||Un(t,1);if(r==(it?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Ta(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let s=t.someProp("clipboardSerializer")||Bn.fromSchema(t.state.schema),a=Gu(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=qu[c.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let p=a.createElement(d[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),u++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`\n\n`);return{dom:l,text:h,slice:e}}function Vu(t,e,n,r,i){let o=i.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=!!e&&(r||o||!n);if(l){if(t.someProp("transformPastedText",h=>{e=h(e,o||r,t)}),o)return a=new N(S.from(t.state.schema.text(e.replace(/\r\n?/g,`\n`))),0,0),t.someProp("transformPasted",h=>{a=h(a,t,!0)}),a;let u=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(u)a=u;else{let h=i.marks(),{schema:f}=t.state,p=Bn.fromSchema(f);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else t.someProp("transformPastedHTML",u=>{n=u(n,t)}),s=Xg(n),Kr&&Qg(s);let c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||tn.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||d),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Jg.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=eb(fc(a,+d[1],+d[2]),d[4]);else if(a=N.maxOpen(Zg(a.content,i),!0),a.openStart||a.openEnd){let u=0,h=0;for(let f=a.content.firstChild;u<a.openStart&&!f.type.spec.isolating;u++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=fc(a,u,h)}return t.someProp("transformPasted",u=>{a=u(a,t,l)}),a}const Jg=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Zg(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,s=[];if(t.forEach(a=>{if(!s)return;let l=i.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&o.length&&Ku(l,o,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=ju(s[s.length-1],o.length));let d=Wu(a,l);s.push(d),i=i.matchType(d.type),o=l}}),s)return S.from(s)}return t}function Wu(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,S.from(t));return t}function Ku(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=Ku(t,e,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(S.from(Wu(n,t,i+1))))}}function ju(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,ju(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(S.empty,!0);return t.copy(n.append(r))}function zs(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(o=0),i<r-1&&(a=zs(a,e,n,r,i+1,o)),i>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(S.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function fc(t,e,n){return e<t.openStart&&(t=new N(zs(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new N(zs(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const qu={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let pc=null;function Gu(){return pc||(pc=document.implementation.createHTMLDocument("title"))}let ss=null;function Yg(t){let e=window.trustedTypes;return e?(ss||(ss=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),ss.createHTML(t)):t}function Xg(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Gu().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&qu[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=Yg(t),i)for(let o=0;o<i.length;o++)n=n.querySelector(i[o])||n;return n}function Qg(t){let e=t.querySelectorAll(Oe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function eb(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:o,openEnd:s}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=S.from(l.create(r[a+1],i)),o++,s++}return new N(i,o,s)}const je={},qe={},tb={touchstart:!0,touchmove:!0};class nb{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,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}}function rb(t){for(let e in je){let n=je[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{ob(t,r)&&!Ma(t,r)&&(t.editable||!(r.type in qe))&&n(t,r)},tb[e]?{passive:!0}:void 0)}Be&&t.dom.addEventListener("input",()=>null),Hs(t)}function en(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function ib(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Hs(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Ma(t,r))})}function Ma(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function ob(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function sb(t,e){!Ma(t,e)&&je[e.type]&&(t.editable||!(e.type in qe))&&je[e.type](t,e)}qe.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Zu(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!($t&&Oe&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),tr&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,yn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Gg(t,n)?n.preventDefault():en(t,"key")};qe.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};qe.keypress=(t,e)=>{let n=e;if(Zu(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||it&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof P)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i,o))&&t.dispatch(o()),n.preventDefault()}};function No(t){return{left:t.clientX,top:t.clientY}}function ab(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Aa(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,a=>s>o.depth?a(t,n,o.nodeAfter,o.before(s),i,!0):a(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function Yn(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function lb(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&B.isSelectable(r)?(Yn(t,new B(n)),!0):!1}function cb(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof B&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(B.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(Yn(t,B.create(t.state.doc,i)),!0):!1}function db(t,e,n,r,i){return Aa(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?cb(t,n):lb(t,n))}function ub(t,e,n,r){return Aa(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function hb(t,e,n,r){return Aa(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||fb(t,n,r)}function fb(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Yn(t,P.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(s.inlineContent)Yn(t,P.create(r,a+1,a+1+s.content.size));else if(B.isSelectable(s))Yn(t,B.create(r,a));else continue;return!0}}function Na(t){return $i(t)}const Ju=it?"metaKey":"ctrlKey";je.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Na(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&ab(n,t.input.lastClick)&&!n[Ju]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};let s=t.posAtCoords(No(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new pb(t,s,n,!!r)):(o=="doubleClick"?ub:hb)(t,s.pos,s.inside,n)?n.preventDefault():en(t,"pointer"))};class pb{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Ju],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let d=e.state.doc.resolve(n.pos);o=d.parent,s=d.depth?d.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof B&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&st&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),en(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Bt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(No(e))),this.updateAllowDefault(e),this.allowDefault||!n?en(this.view,"pointer"):db(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Be&&this.mightDrag&&!this.mightDrag.node.isAtom||Oe&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Yn(this.view,U.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):en(this.view,"pointer")}move(e){this.updateAllowDefault(e),en(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}je.touchstart=t=>{t.input.lastTouch=Date.now(),Na(t),en(t,"pointer")};je.touchmove=t=>{t.input.lastTouch=Date.now(),en(t,"pointer")};je.contextmenu=t=>Na(t);function Zu(t,e){return t.composing?!0:Be&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const mb=$t?5e3:-1;qe.compositionstart=qe.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof P&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Oe&&Mu&&gb(t)))t.markCursor=t.state.storedMarks||n.marks(),$i(t,!0),t.markCursor=null;else if($i(t,!e.selection.empty),st&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}Yu(t,mb)};function gb(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}qe.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Yu(t,20))};function Yu(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>$i(t),e))}function Xu(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=yb());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function bb(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=cg(e.focusNode,e.focusOffset),r=dg(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function yb(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function $i(t,e=!1){if(!($t&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Xu(t),e||t.docView&&t.docView.dirty){let n=Sa(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function kb(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Rr=Je&&nn<15||tr&&pg<604;je.copy=qe.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=Rr?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Ta(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):kb(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function wb(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function vb(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Lr(t,r.value,null,i,e):Lr(t,r.textContent,r.innerHTML,i,e)},50)}function Lr(t,e,n,r,i){let o=Vu(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,o||N.empty)))return!0;if(!o)return!1;let s=wb(o),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Qu(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}qe.paste=(t,e)=>{let n=e;if(t.composing&&!$t)return;let r=Rr?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Lr(t,Qu(r),r.getData("text/html"),i,n)?n.preventDefault():vb(t,n)};class eh{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const Eb=it?"altKey":"ctrlKey";function th(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[Eb]}je.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(No(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof B?i.to-1:i.to))){if(r&&r.mightDrag)s=B.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let u=t.docView.nearestDesc(n.target,!0);u&&u.node.type.spec.draggable&&u!=t.docView&&(s=B.create(t.state.doc,u.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:c,slice:d}=Ta(t,a);(!n.dataTransfer.files.length||!Oe||Tu>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Rr?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Rr||n.dataTransfer.setData("text/plain",c),t.dragging=new eh(d,th(t,n),s)};je.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};qe.dragover=qe.dragenter=(t,e)=>e.preventDefault();qe.drop=(t,e)=>{try{xb(t,e,t.dragging)}finally{t.dragging=null}};function xb(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(No(e));if(!r)return;let i=t.state.doc.resolve(r.pos),o=n&&n.slice;o?t.someProp("transformPasted",f=>{o=f(o,t,!1)}):o=Vu(t,Qu(e.dataTransfer),Rr?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&th(t,e));if(t.someProp("handleDrop",f=>f(t,e,o||N.empty,s))){e.preventDefault();return}if(!o)return;e.preventDefault();let a=o?ou(t.state.doc,i.pos,o):i.pos;a==null&&(a=i.pos);let l=t.state.tr;if(s){let{node:f}=n;f?f.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,u=l.doc;if(d?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(u))return;let h=l.doc.resolve(c);if(d&&B.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new B(h));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,m,g,b)=>f=b),l.setSelection(Ca(t,h,l.doc.resolve(f)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}je.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Bt(t)},20))};je.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};je.beforeinput=(t,e)=>{if(Oe&&$t&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,yn(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in qe)je[t]=qe[t];function Dr(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Pi{constructor(e,n){this.toDOM=e,this.spec=n||Tn,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new Te(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Pi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Dr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class on{constructor(e,n){this.attrs=e,this.spec=n||Tn}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new Te(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof on&&Dr(this.attrs,e.attrs)&&Dr(this.spec,e.spec)}static is(e){return e.type instanceof on}destroy(){}}class _a{constructor(e,n){this.attrs=e,this.spec=n||Tn}map(e,n,r,i){let o=e.mapResult(n.from+i,1);if(o.deleted)return null;let s=e.mapResult(n.to+i,-1);return s.deleted||s.pos<=o.pos?null:new Te(o.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),o;return i==n.from&&!(o=e.child(r)).isText&&i+o.nodeSize==n.to}eq(e){return this==e||e instanceof _a&&Dr(this.attrs,e.attrs)&&Dr(this.spec,e.spec)}destroy(){}}class Te{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Te(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Te(e,e,new Pi(n,r))}static inline(e,n,r,i){return new Te(e,n,new on(r,i))}static node(e,n,r,i){return new Te(e,n,new _a(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof on}get widget(){return this.type instanceof Pi}}const Wn=[],Tn={};class ie{constructor(e,n){this.local=e.length?e:Wn,this.children=n.length?n:Wn}static create(e,n){return n.length?Bi(n,e,0,Tn):He}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,o){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,i+a,o)}}map(e,n,r){return this==He||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Tn)}mapInner(e,n,r,i,o){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(s||(s=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?Sb(this.children,s||[],e,n,r,i,o):s?new ie(s.sort(Mn),Wn):He}add(e,n){return n.length?this==He?ie.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((a,l)=>{let c=l+r,d;if(d=rh(n,a,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<l;)o+=3;i[o]==l?i[o+2]=i[o+2].addInner(a,d,c+1):i.splice(o,0,l,l+a.nodeSize,Bi(d,a,c+1,Tn)),o+=3}});let s=nh(o?ih(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new ie(s.length?this.local.concat(s).sort(Mn):this.local,i||this.children)}remove(e){return e.length==0||this==He?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,a=r[o]+n,l=r[o+1]+n;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>a&&u.to<l&&(e[d]=null,(s||(s=[])).push(u));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,a+1);c!=He?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let a=0;a<i.length;a++)i[a].eq(s,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ie(i,r):He}forChild(e,n){if(this==He)return this;if(n.isLeaf)return ie.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let o=e+1,s=o+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>o&&l.type instanceof on){let c=Math.max(o,l.from)-o,d=Math.min(s,l.to)-o;c<d&&(i||(i=[])).push(l.copy(c,d))}}if(i){let a=new ie(i.sort(Mn),Wn);return r?new Gt([a,r]):a}return r||He}eq(e){if(this==e)return!0;if(!(e instanceof ie)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Oa(this.localsInner(e))}localsInner(e){if(this==He)return Wn;if(e.inlineContent||!this.local.some(on.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof on||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ie.empty=new ie([],[]);ie.removeOverlap=Oa;const He=ie.empty;class Gt{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Tn));return Gt.from(r)}forChild(e,n){if(n.isLeaf)return ie.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=He&&(o instanceof Gt?r=r.concat(o.members):r.push(o))}return Gt.from(r)}eq(e){if(!(e instanceof Gt)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let s=0;s<o.length;s++)n.push(o[s])}}return n?Oa(r?n:n.sort(Mn)):Wn}static from(e){switch(e.length){case 0:return He;case 1:return e[0];default:return new Gt(e.every(n=>n instanceof ie)?e:e.reduce((n,r)=>n.concat(r instanceof ie?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Sb(t,e,n,r,i,o,s){let a=t.slice();for(let c=0,d=o;c<n.maps.length;c++){let u=0;n.maps[c].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let b=0;b<a.length;b+=3){let k=a[b+1];if(k<0||h>k+d-u)continue;let w=a[b]+d-u;f>=w?a[b+1]=h<=w?-2:-1:h>=d&&g&&(a[b]+=g,a[b+1]+=g)}u+=g}),d=n.maps[c].map(d,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let d=n.map(t[c]+o),u=d-i;if(u<0||u>=r.content.size){l=!0;continue}let h=n.map(t[c+1]+o,-1),f=h-i,{index:p,offset:m}=r.content.findIndex(u),g=r.maybeChild(p);if(g&&m==u&&m+g.nodeSize==f){let b=a[c+2].mapInner(n,g,d+1,t[c]+o+1,s);b!=He?(a[c]=u,a[c+1]=f,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Cb(a,t,e,n,i,o,s),d=Bi(c,r,0,s);e=d.local;for(let u=0;u<a.length;u+=3)a[u+1]<0&&(a.splice(u,3),u-=3);for(let u=0,h=0;u<d.children.length;u+=3){let f=d.children[u];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,d.children[u],d.children[u+1],d.children[u+2])}}return new ie(e.sort(Mn),a)}function nh(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Te(i.from+e,i.to+e,i.type))}return n}function Cb(t,e,n,r,i,o,s){function a(l,c){for(let d=0;d<l.local.length;d++){let u=l.local[d].map(r,i,c);u?n.push(u):s.onRemove&&s.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+o+1);return n}function rh(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let o=0,s;o<t.length;o++)(s=t[o])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),t[o]=null);return i}function ih(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Bi(t,e,n,r){let i=[],o=!1;e.forEach((a,l)=>{let c=rh(t,a,l+n);if(c){o=!0;let d=Bi(c,a,n+l+1,r);d!=He&&i.push(l,l+a.nodeSize,d)}});let s=nh(o?ih(t):t,-n).sort(Mn);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new ie(s,i):He}function Mn(t,e){return t.from-e.from||t.to-e.to}function Oa(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==t&&(e=t.slice()),e[i]=o.copy(o.from,r.to),mc(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),mc(e,i,r.copy(o.from,r.to)));break}}}return e}function mc(t,e,n){for(;e<t.length&&Mn(n,t[e])>0;)e++;t.splice(e,0,n)}function as(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=He&&e.push(r)}),t.cursorWrapper&&e.push(ie.create(t.state.doc,[t.cursorWrapper.deco])),Gt.from(e)}const Tb={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Mb=Je&&nn<=11;class Ab{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Nb{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Ab,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Je&&nn<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Be&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Mb&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Tb)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(ac(this.view)){if(this.suppressingSelectionUpdates)return Bt(this.view);if(Je&&nn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&On(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=er(o))n.add(o);for(let o=e.anchorNode;o;o=er(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&ac(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(e.editable)for(let d=0;d<n.length;d++){let u=this.registerMutation(n[d],l);u&&(o=o<0?u.from:Math.min(u.from,o),s=s<0?u.to:Math.max(u.to,s),u.typeOver&&(a=!0))}if(st&&l.length){let d=l.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,h]=d;u.parentNode&&u.parentNode.parentNode==h.parentNode?h.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let h of d){let f=h.parentNode;f&&f.nodeName=="LI"&&(!u||Ib(e,u)!=f)&&h.remove()}}}else if((Oe||Be)&&l.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of l)if(d.nodeName=="BR"&&d.parentNode){let u=d.nextSibling;u&&u.nodeType==1&&u.contentEditable=="false"&&d.parentNode.removeChild(d)}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Mo(r)&&(c=Sa(e))&&c.eq(U.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Bt(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),_b(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Rb(e,l)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Bt(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];n.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(Je&&nn<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:h}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(o=h)}let s=i&&i.parentNode==e.target?$e(i)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=o&&o.parentNode==e.target?$e(o):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let gc=new WeakMap,bc=!1;function _b(t){if(!gc.has(t)&&(gc.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=st,bc)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."),bc=!0}}function yc(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return On(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function Ob(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return yc(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?yc(t,n):null}function Ib(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Rb(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let o of e)if(((n=o.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=o.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let a=s;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(o,a.firstChild),r==o&&t.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}function Lb(t,e,n){let{node:r,fromOffset:i,toOffset:o,from:s,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,d=l.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:l.anchorOffset}],Mo(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Oe&&t.input.lastKeyCode===8)for(let g=o;g>i;g--){let b=r.childNodes[g-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){o=g;break}if(!k||k.size)break}let u=t.state.doc,h=t.someProp("domParser")||tn.fromSchema(t.state.schema),f=u.resolve(s),p=null,m=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:o,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Db,context:f});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),p={anchor:g+s,head:b+s}}return{doc:m,sel:p,from:s,to:a}}function Db(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Be&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Be&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const $b=/^(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;function Pb(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let A=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,R=Sa(t,A);if(R&&!t.state.selection.eq(R)){if(Oe&&$t&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",ne=>ne(t,yn(13,"Enter"))))return;let F=t.state.tr.setSelection(R);A=="pointer"?F.setMeta("pointer",!0):A=="key"&&F.scrollIntoView(),o&&F.setMeta("composition",o),t.dispatch(F)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=Lb(t,e,n),d=t.state.doc,u=d.slice(c.from,c.to),h,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,f="end"):(h=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let p=Hb(u.content,c.doc.content,c.from,h,f);if(p&&t.input.domChangeCount++,(tr&&t.input.lastIOSEnter>Date.now()-225||$t)&&i.some(A=>A.nodeType==1&&!$b.test(A.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",A=>A(t,yn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof P&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let A=kc(t,t.state.doc,c.sel);if(A&&!A.eq(t.state.selection)){let R=t.state.tr.setSelection(A);o&&R.setMeta("composition",o),t.dispatch(R)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof P&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),Je&&nn<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),b=d.resolve(p.start),k=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA;if((tr&&t.input.lastIOSEnter>Date.now()-225&&(!k||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!k&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"","")))&&t.someProp("handleKeyDown",A=>A(t,yn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&zb(d,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",A=>A(t,yn(8,"Backspace")))){$t&&Oe&&t.domObserver.suppressSelectionUpdates();return}Oe&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),$t&&!k&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(A){return A(t,yn(13,"Enter"))})},20));let w=p.start,x=p.endA,v=A=>{let R=A||t.state.tr.replace(w,x,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let F=kc(t,R.doc,c.sel);F&&!(Oe&&t.composing&&F.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(F.head==w||F.head==R.mapping.map(x)-1)||Je&&F.empty&&F.head==w)&&R.setSelection(F)}return o&&R.setMeta("composition",o),R.scrollIntoView()},T;if(k)if(m.pos==g.pos){Je&&nn<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Bt(t),20));let A=v(t.state.tr.delete(w,x)),R=d.resolve(p.start).marksAcross(d.resolve(p.endA));R&&A.ensureMarks(R),t.dispatch(A)}else if(p.endA==p.endB&&(T=Bb(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let A=v(t.state.tr);T.type=="add"?A.addMark(w,x,T.mark):A.removeMark(w,x,T.mark),t.dispatch(A)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let A=m.parent.textBetween(m.parentOffset,g.parentOffset),R=()=>v(t.state.tr.insertText(A,w,x));t.someProp("handleTextInput",F=>F(t,w,x,A,R))||t.dispatch(R())}else t.dispatch(v());else t.dispatch(v())}function kc(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Ca(t,e.resolve(n.anchor),e.resolve(n.head))}function Bb(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,a,l;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<n.length;d++)o=n[d].removeFromSet(o);if(i.length==1&&o.length==0)a=i[0],s="add",l=d=>d.mark(a.addToSet(d.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(l(e.child(d)));if(S.from(c).eq(t))return{mark:a,type:s}}function zb(t,e,n,r,i){if(n-e<=i.pos-r.pos||ls(r,!0,!1)<i.pos)return!1;let o=t.resolve(e);if(!r.parent.isTextblock){let a=o.nodeAfter;return a!=null&&n==e+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=t.resolve(ls(o,!0,!0));return!s.parent.isTextblock||s.pos>n||ls(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function ls(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function Hb(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,o-Math.min(s,a));r-=s+l-o}if(s<o&&t.size<e.size){let l=r<=o&&r>=s?o-r:0;o-=l,o&&o<e.size&&wc(e.textBetween(o-1,o+1))&&(o+=l?1:-1),a=o+(a-s),s=o}else if(a<o){let l=r<=o&&r>=a?o-r:0;o-=l,o&&o<t.size&&wc(t.textBetween(o-1,o+1))&&(o+=l?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}function wc(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class oh{constructor(e,n){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 nb,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Cc),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=xc(this),Ec(this),this.nodeViews=Sc(this),this.docView=tc(this.state.doc,vc(this),as(this),this.dom,this),this.domObserver=new Nb(this,(r,i,o,s)=>Pb(this,r,i,o,s)),this.domObserver.start(),rb(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 n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Hs(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Cc),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Xu(this),s=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=Sc(this);Ub(f,this.nodeViews)&&(this.nodeViews=f,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Hs(this),this.editable=xc(this),Ec(this);let l=as(this),c=vc(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",u=o||!this.docView.matchesNode(e.doc,c,l);(u||!e.selection.eq(i.selection))&&(s=!0);let h=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&bg(this);if(s){this.domObserver.stop();let f=u&&(Je||Oe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Fb(i.selection,e.selection);if(u){let p=Oe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=bb(this)),(o||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=tc(e.doc,c,l,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Fg(this))?Bt(this,f):(Hu(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&yg(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof B){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Jl(this,n.getBoundingClientRect(),e)}else Jl(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 n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new eh(e.slice,e.move,i<0?void 0:B.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(i=n?n(a):a))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(Je){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&kg(this.dom),Bt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Sg(this,e)}coordsAtPos(e,n=1){return Iu(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return Ng(this,n||this.state,e)}pasteHTML(e,n){return Lr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Lr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ta(this,e)}destroy(){this.docView&&(ib(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],as(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ag())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return sb(this,e)}domSelectionRange(){let e=this.domSelection();return e?Be&&this.root.nodeType===11&&hg(this.dom.ownerDocument)==this.dom&&Ob(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}oh.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function vc(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Te.node(0,t.state.doc.content.size,e)]}function Ec(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Te.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function xc(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Fb(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Sc(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Ub(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function Cc(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var an={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:"'"},zi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Vb=typeof navigator<"u"&&/Mac/.test(navigator.platform),Wb=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Pe=0;Pe<10;Pe++)an[48+Pe]=an[96+Pe]=String(Pe);for(var Pe=1;Pe<=24;Pe++)an[Pe+111]="F"+Pe;for(var Pe=65;Pe<=90;Pe++)an[Pe]=String.fromCharCode(Pe+32),zi[Pe]=String.fromCharCode(Pe);for(var cs in an)zi.hasOwnProperty(cs)||(zi[cs]=an[cs]);function Kb(t){var e=Vb&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Wb&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?zi:an)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const jb=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),qb=typeof navigator<"u"&&/Win/.test(navigator.platform);function Gb(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))jb?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function Jb(t){let e=Object.create(null);for(let n in t)e[Gb(n)]=t[n];return e}function ds(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Zb(t){return new Q({props:{handleKeyDown:Ia(t)}})}function Ia(t){let e=Jb(t);return function(n,r){let i=Kb(r),o,s=e[ds(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[ds(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(qb&&r.ctrlKey&&r.altKey)&&(o=an[r.keyCode])&&o!=i){let a=e[ds(o,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var Yb=Object.defineProperty,Ra=(t,e)=>{for(var n in e)Yb(t,n,{get:e[n],enumerable:!0})};function _o(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var Oo=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([s,a])=>[s,(...c)=>{const d=a(...c)(o);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s=[],a=!!t,l=t||i.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(l),s.every(u=>u===!0)),d={...Object.fromEntries(Object.entries(n).map(([u,h])=>[u,(...p)=>{const m=this.buildProps(l,e),g=h(...p)(m);return s.push(g),d}])),run:c};return d}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,o=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s={tr:t,editor:r,view:o,state:_o({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)(s)]))}};return s}},sh={};Ra(sh,{blur:()=>Xb,clearContent:()=>Qb,clearNodes:()=>ey,command:()=>ty,createParagraphNear:()=>ny,cut:()=>ry,deleteCurrentNode:()=>iy,deleteNode:()=>oy,deleteRange:()=>sy,deleteSelection:()=>ay,enter:()=>ly,exitCode:()=>cy,extendMarkRange:()=>dy,first:()=>uy,focus:()=>fy,forEach:()=>py,insertContent:()=>my,insertContentAt:()=>yy,joinBackward:()=>vy,joinDown:()=>wy,joinForward:()=>Ey,joinItemBackward:()=>xy,joinItemForward:()=>Sy,joinTextblockBackward:()=>Cy,joinTextblockForward:()=>Ty,joinUp:()=>ky,keyboardShortcut:()=>Ay,lift:()=>Ny,liftEmptyBlock:()=>_y,liftListItem:()=>Oy,newlineInCode:()=>Iy,resetAttributes:()=>Ry,scrollIntoView:()=>Ly,selectAll:()=>Dy,selectNodeBackward:()=>$y,selectNodeForward:()=>Py,selectParentNode:()=>By,selectTextblockEnd:()=>zy,selectTextblockStart:()=>Hy,setContent:()=>Fy,setMark:()=>s0,setMeta:()=>a0,setNode:()=>l0,setNodeSelection:()=>c0,setTextDirection:()=>d0,setTextSelection:()=>u0,sinkListItem:()=>h0,splitBlock:()=>f0,splitListItem:()=>p0,toggleList:()=>m0,toggleMark:()=>g0,toggleNode:()=>b0,toggleWrap:()=>y0,undoInputRule:()=>k0,unsetAllMarks:()=>w0,unsetMark:()=>v0,unsetTextDirection:()=>E0,updateAttributes:()=>x0,wrapIn:()=>S0,wrapInList:()=>C0});var Xb=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),Qb=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),ey=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:s})=>{t.doc.nodesBetween(o.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:d}=e,u=c.resolve(d.map(l)),h=c.resolve(d.map(l+a.nodeSize)),f=u.blockRange(h);if(!f)return;const p=ar(f);if(a.type.isTextblock){const{defaultType:m}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(f.start,m)}(p||p===0)&&e.lift(f,p)})}),!0},ty=t=>e=>t(e),ny=()=>({state:t,dispatch:e})=>vu(t,e),ry=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new P(r.doc.resolve(Math.max(s-1,0)))),!0},iy=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const a=i.before(o),l=i.after(o);t.delete(a,l).scrollIntoView()}return!0}return!1};function Se(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var oy=t=>({tr:e,state:n,dispatch:r})=>{const i=Se(t,n.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const l=o.before(s),c=o.after(s);e.delete(l,c).scrollIntoView()}return!0}return!1},sy=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},ay=()=>({state:t,dispatch:e})=>ya(t,e),ly=()=>({commands:t})=>t.keyboardShortcut("Enter"),cy=()=>({state:t,dispatch:e})=>jm(t,e);function La(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Hi(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:La(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function ah(t,e,n={}){return t.find(r=>r.type===e&&Hi(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function Tc(t,e,n={}){return!!ah(t,e,n)}function nr(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e)||(n=n||((r=i.node.marks[0])==null?void 0:r.attrs),!ah([...i.node.marks],e,n)))return;let s=i.index,a=t.start()+i.offset,l=s+1,c=a+i.node.nodeSize;for(;s>0&&Tc([...t.parent.child(s-1).marks],e,n);)s-=1,a-=t.parent.child(s).nodeSize;for(;l<t.parent.childCount&&Tc([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function zt(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var dy=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const o=zt(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:d}=a;if(i){const u=nr(l,o,e);if(u&&u.from<=c&&u.to>=d){const h=P.create(s,u.from,u.to);n.setSelection(h)}}return!0},uy=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function lh(t){return t instanceof P}function vn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function ch(t,e=null){if(!e)return null;const n=U.atStart(t),r=U.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,o=r.to;return e==="all"?P.create(t,vn(0,i,o),vn(t.content.size,i,o)):P.create(t,vn(e,i,o),vn(e,i,o))}function Mc(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Fi(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function hy(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var fy=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(Fi()||Mc())&&r.dom.focus(),hy()&&!Fi()&&!Mc()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!lh(n.state.selection))return s(),!0;const a=ch(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},py=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),my=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),dh=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&dh(r)}return t};function si(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=(new window.DOMParser).parseFromString(e,"text/html").body;return dh(n)}function $r(t,e,n){if(t instanceof pt||t instanceof S)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return S.fromArray(t.map(a=>e.nodeFromJSON(a)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),$r("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,a="";const l=new Gd({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?tn.fromSchema(l).parseSlice(si(t),n.parseOptions):tn.fromSchema(l).parse(si(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=tn.fromSchema(e);return n.slice?o.parseSlice(si(t),n.parseOptions).content:o.parse(si(t),n.parseOptions)}return $r("",e,n)}function gy(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof _e||i instanceof Ie))return;const o=t.mapping.maps[r];let s=0;o.forEach((a,l,c,d)=>{s===0&&(s=d)}),t.setSelection(U.near(t.doc.resolve(s),n))}var by=t=>!("type"in t),yy=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=g=>{o.emit("contentError",{editor:o,error:g,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{$r(e,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{a=$r(e,o.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:o.options.enableContentCheck})}catch(g){return l(g),!1}let{from:d,to:u}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,f=!0;if((by(a)?a:[a]).forEach(g=>{g.check(),h=h?g.isText&&g.marks.length===0:!1,f=f?g.isBlock:!1}),d===u&&f){const{parent:g}=r.doc.resolve(d);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(d-=1,u+=1)}let m;if(h){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof S){let g="";e.forEach(b=>{b.text&&(g+=b.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,d,u)}else{m=a;const g=r.doc.resolve(d),b=g.node(),k=g.parentOffset===0,w=b.isText||b.isTextblock,x=b.content.size>0;k&&w&&x&&(d=Math.max(0,d-1)),r.replaceWith(d,u,m)}n.updateSelection&&gy(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:m})}return!0},ky=()=>({state:t,dispatch:e})=>Vm(t,e),wy=()=>({state:t,dispatch:e})=>Wm(t,e),vy=()=>({state:t,dispatch:e})=>pu(t,e),Ey=()=>({state:t,dispatch:e})=>yu(t,e),xy=()=>({state:t,dispatch:e,tr:n})=>{try{const r=So(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Sy=()=>({state:t,dispatch:e,tr:n})=>{try{const r=So(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Cy=()=>({state:t,dispatch:e})=>Fm(t,e),Ty=()=>({state:t,dispatch:e})=>Um(t,e);function uh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function My(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))Fi()||uh()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}var Ay=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const o=My(t).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l?.steps.forEach(c=>{const d=c.map(r.mapping);d&&i&&r.maybeStep(d)}),!0};function ln(t,e,n={}){const{from:r,to:i,empty:o}=t.selection,s=e?Se(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(u,h)=>{if(u.isText)return;const f=Math.max(r,h),p=Math.min(i,h+u.nodeSize);a.push({node:u,from:f,to:p})});const l=i-r,c=a.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>Hi(u.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((u,h)=>u+h.to-h.from,0)>=l}var Ny=(t,e={})=>({state:n,dispatch:r})=>{const i=Se(t,n.schema);return ln(n,i,e)?Km(n,r):!1},_y=()=>({state:t,dispatch:e})=>Eu(t,e),Oy=t=>({state:e,dispatch:n})=>{const r=Se(t,e.schema);return rg(r)(e,n)},Iy=()=>({state:t,dispatch:e})=>wu(t,e);function Io(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Ac(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var Ry=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=Io(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(o=Se(t,r.schema)),a==="mark"&&(s=zt(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,u)=>{o&&o===d.type&&(l=!0,i&&n.setNodeMarkup(u,void 0,Ac(d.attrs,e))),s&&d.marks.length&&d.marks.forEach(h=>{s===h.type&&(l=!0,i&&n.addMark(u,u+d.nodeSize,s.create(Ac(h.attrs,e))))})})}),l},Ly=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Dy=()=>({tr:t,dispatch:e})=>{if(e){const n=new tt(t.doc);t.setSelection(n)}return!0},$y=()=>({state:t,dispatch:e})=>gu(t,e),Py=()=>({state:t,dispatch:e})=>ku(t,e),By=()=>({state:t,dispatch:e})=>Jm(t,e),zy=()=>({state:t,dispatch:e})=>Xm(t,e),Hy=()=>({state:t,dispatch:e})=>Ym(t,e);function Fs(t,e,n={},r={}){return $r(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Fy=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{const{doc:l}=o;if(r.preserveWhitespace!=="full"){const c=Fs(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return s&&o.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return s&&o.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function hh(t,e){const n=zt(e,t.schema),{from:r,to:i,empty:o}=t.selection,s=[];o?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{s.push(...l.marks)});const a=s.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function fh(t,e){const n=new ga(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function Uy(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Us(t,e){const n=[];return t.descendants((r,i)=>{e(r)&&n.push({node:r,pos:i})}),n}function Vy(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function ph(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Ro(t){return e=>ph(e.$from,t)}function $(t,e,n){return t.config[e]===void 0&&t.parent?$(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?$(t.parent,e,n):null}):t.config[e]}function Da(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=$(e,"addExtensions",n);return r?[e,...Da(r())]:e}).flat(10)}function $a(t,e){const n=Bn.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function mh(t){return typeof t=="function"}function X(t,e=void 0,...n){return mh(t)?e?t.bind(e)(...n):t(...n):t}function Wy(t={}){return Object.keys(t).length===0&&t.constructor===Object}function rr(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function gh(t){const e=[],{nodeExtensions:n,markExtensions:r}=rr(t),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage,extensions:i},l=$(s,"addGlobalAttributes",a);if(!l)return;l().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([h,f])=>{e.push({type:u,name:h,attribute:{...o,...f}})})})})}),i.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},l=$(s,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([d,u])=>{const h={...o,...u};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:s.name,name:d,attribute:h})})}),e}function se(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const a=o?String(o).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(d=>!l.includes(d));r[i]=[...l,...c].join(" ")}else if(i==="style"){const a=o?o.split(";").map(d=>d.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;l.forEach(d=>{const[u,h]=d.split(":").map(f=>f.trim());c.set(u,h)}),a.forEach(d=>{const[u,h]=d.split(":").map(f=>f.trim());c.set(u,h)}),r[i]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ")}else r[i]=o}),r},{})}function Pr(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>se(n,r),{})}function Ky(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Nc(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(n):Ky(n.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function _c(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Wy(n)?!1:n!=null))}function Oc(t){var e,n;const r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function jy(t,e){var n;const r=gh(t),{nodeExtensions:i,markExtensions:o}=rr(t),s=(n=i.find(c=>$(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(i.map(c=>{const d=r.filter(b=>b.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((b,k)=>{const w=$(k,"extendNodeSchema",u);return{...b,...w?w(c):{}}},{}),f=_c({...h,content:X($(c,"content",u)),marks:X($(c,"marks",u)),group:X($(c,"group",u)),inline:X($(c,"inline",u)),atom:X($(c,"atom",u)),selectable:X($(c,"selectable",u)),draggable:X($(c,"draggable",u)),code:X($(c,"code",u)),whitespace:X($(c,"whitespace",u)),linebreakReplacement:X($(c,"linebreakReplacement",u)),defining:X($(c,"defining",u)),isolating:X($(c,"isolating",u)),attrs:Object.fromEntries(d.map(Oc))}),p=X($(c,"parseHTML",u));p&&(f.parseDOM=p.map(b=>Nc(b,d)));const m=$(c,"renderHTML",u);m&&(f.toDOM=b=>m({node:b,HTMLAttributes:Pr(b,d)}));const g=$(c,"renderText",u);return g&&(f.toText=g),[c.name,f]})),l=Object.fromEntries(o.map(c=>{const d=r.filter(g=>g.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((g,b)=>{const k=$(b,"extendMarkSchema",u);return{...g,...k?k(c):{}}},{}),f=_c({...h,inclusive:X($(c,"inclusive",u)),excludes:X($(c,"excludes",u)),group:X($(c,"group",u)),spanning:X($(c,"spanning",u)),code:X($(c,"code",u)),attrs:Object.fromEntries(d.map(Oc))}),p=X($(c,"parseHTML",u));p&&(f.parseDOM=p.map(g=>Nc(g,d)));const m=$(c,"renderHTML",u);return m&&(f.toDOM=g=>m({mark:g,HTMLAttributes:Pr(g,d)})),[c.name,f]}));return new Gd({topNode:s,nodes:a,marks:l})}function qy(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Ui(t){return t.sort((n,r)=>{const i=$(n,"priority")||100,o=$(r,"priority")||100;return i>o?-1:i<o?1:0})}function bh(t){const e=Ui(Da(t)),n=qy(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function yh(t,e,n){const{from:r,to:i}=e,{blockSeparator:o=`\n\n`,textSerializers:s={}}=n||{};let a="";return t.nodesBetween(r,i,(l,c,d,u)=>{var h;l.isBlock&&c>r&&(a+=o);const f=s?.[l.type.name];if(f)return d&&(a+=f({node:l,pos:c,parent:d,index:u,range:e})),!1;l.isText&&(a+=(h=l?.text)==null?void 0:h.slice(Math.max(r,c)-c,i-c))}),a}function Gy(t,e){const n={from:0,to:t.content.size};return yh(t,n,e)}function kh(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function Jy(t,e){const n=Se(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,a=>{o.push(a)});const s=o.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function wh(t,e){const n=Io(typeof e=="string"?e:e.name,t.schema);return n==="node"?Jy(t,e):n==="mark"?hh(t,e):{}}function Zy(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function Yy(t){const e=Zy(t);return e.length===1?e:e.filter((n,r)=>!e.filter((o,s)=>s!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function vh(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,o)=>{const s=[];if(i.ranges.length)i.forEach((a,l)=>{s.push({from:a,to:l})});else{const{from:a,to:l}=n[o];if(a===void 0||l===void 0)return;s.push({from:a,to:l})}s.forEach(({from:a,to:l})=>{const c=e.slice(o).map(a,-1),d=e.slice(o).map(l),u=e.invert().map(c,-1),h=e.invert().map(d);r.push({oldRange:{from:u,to:h},newRange:{from:c,to:d}})})}),Yy(r)}function Pa(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t),s=nr(o,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}var Xy=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let o=r,s=null;for(;o>0&&s===null;){const a=i.node(o);a?.type.name===e?s=a:o-=1}return[s,o]};function ai(t,e){return e.nodes[t]||e.marks[t]||null}function xi(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}var Qy=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,a)=>{var l,c;const d=((c=(l=i.type.spec).toText)==null?void 0:c.call(l,{node:i,pos:o,parent:s,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,r-o))}),n};function Vs(t,e,n={}){const{empty:r,ranges:i}=t.selection,o=e?zt(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>o?o.name===u.type.name:!0).find(u=>Hi(u.attrs,n,{strict:!1}));let s=0;const a=[];if(i.forEach(({$from:u,$to:h})=>{const f=u.pos,p=h.pos;t.doc.nodesBetween(f,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(f,g),k=Math.min(p,g+m.nodeSize),w=k-b;s+=w,a.push(...m.marks.map(x=>({mark:x,from:b,to:k})))})}),s===0)return!1;const l=a.filter(u=>o?o.name===u.mark.type.name:!0).filter(u=>Hi(u.mark.attrs,n,{strict:!1})).reduce((u,h)=>u+h.to-h.from,0),c=a.filter(u=>o?u.mark.type!==o&&u.mark.type.excludes(o):!0).reduce((u,h)=>u+h.to-h.from,0);return(l>0?l+c:l)>=s}function e0(t,e,n={}){if(!e)return ln(t,null,n)||Vs(t,null,n);const r=Io(e,t.schema);return r==="node"?ln(t,e,n):r==="mark"?Vs(t,e,n):!1}var t0=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const o=Ro(a=>a.type.name===e)(t.selection);if(!o)return!1;const s=t.doc.resolve(o.pos+1);return i.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},n0=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function Ic(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Rc(t,e){const{nodeExtensions:n}=rr(e),r=n.find(s=>s.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=X($(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Lo(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(o=>{i!==!1&&(Lo(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function Eh(t){return t instanceof B}var xh=class Sh{constructor(e){this.position=e}static fromJSON(e){return new Sh(e.position)}toJSON(){return{position:this.position}}};function r0(t,e){const n=e.mapping.mapResult(t.position);return{position:new xh(n.pos),mapResult:n}}function i0(t){return new xh(t)}function o0(t,e,n){var r;const{selection:i}=e;let o=null;if(lh(i)&&(o=i.$cursor),o){const a=(r=t.storedMarks)!=null?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(c=>c.type.excludes(n)))}const{ranges:s}=i;return s.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(d,u,h)=>{if(c)return!1;if(d.isInline){const f=!h||h.type.allowsMarkType(n),p=!!n.isInSet(d.marks)||!d.marks.some(m=>m.type.excludes(n));c=f&&p}return!c}),c})}var s0=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:s,ranges:a}=o,l=zt(t,r.schema);if(i)if(s){const c=hh(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(h,f)=>{const p=Math.max(f,d),m=Math.min(f+h.nodeSize,u);h.marks.find(b=>b.type===l)?h.marks.forEach(b=>{l===b.type&&n.addMark(p,m,l.create({...b.attrs,...e}))}):n.addMark(p,m,l.create(e))})});return o0(r,n,l)},a0=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),l0=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const o=Se(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>jl(o,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>jl(o,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},c0=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=vn(t,0,r.content.size),o=B.create(r,i);e.setSelection(o)}return!0},d0=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=r;let s,a;return typeof e=="number"?(s=e,a=e):e&&"from"in e&&"to"in e?(s=e.from,a=e.to):(s=o.from,a=o.to),i&&n.doc.nodesBetween(s,a,(l,c)=>{l.isText||n.setNodeMarkup(c,void 0,{...l.attrs,dir:t})}),!0},u0=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=P.atStart(r).from,a=P.atEnd(r).to,l=vn(i,s,a),c=vn(o,s,a),d=P.create(r,l,c);e.setSelection(d)}return!0},h0=t=>({state:e,dispatch:n})=>{const r=Se(t,e.schema);return sg(r)(e,n)};function Lc(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var f0=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:a,$to:l}=o,c=i.extensionManager.attributes,d=xi(c,a.node().type.name,a.node().attrs);if(o instanceof B&&o.node.isBlock)return!a.parentOffset||!Pt(s,a.pos)?!1:(r&&(t&&Lc(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:Uy(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=u&&h?[{type:h,attrs:d}]:void 0,p=Pt(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!p&&Pt(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:d}]:void 0),r){if(p&&(o instanceof P&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!u&&!a.parentOffset&&a.parent.type!==h)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&Lc(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},p0=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;const a=Se(t,r.schema),{$from:l,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;const h=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let b=S.empty;const k=l.index(-1)?1:l.index(-2)?2:3;for(let R=l.depth-k;R>=l.depth-3;R-=1)b=S.from(l.node(R).copy(b));const w=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,x={...xi(h,l.node().type.name,l.node().attrs),...e},v=((s=a.contentMatch.defaultType)==null?void 0:s.createAndFill(x))||void 0;b=b.append(S.from(a.createAndFill(null,v)||void 0));const T=l.before(l.depth-(k-1));n.replace(T,l.after(-w),new N(b,4-k,0));let A=-1;n.doc.nodesBetween(T,n.doc.content.size,(R,F)=>{if(A>-1)return!1;R.isTextblock&&R.content.size===0&&(A=F+1)}),A>-1&&n.setSelection(P.near(n.doc.resolve(A))),n.scrollIntoView()}return!0}const f=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...xi(h,u.type.name,u.attrs),...e},m={...xi(h,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const g=f?[{type:a,attrs:p},{type:f,attrs:m}]:[{type:a,attrs:p}];if(!Pt(n.doc,l.pos,2))return!1;if(i){const{selection:b,storedMarks:k}=r,{splittableMarks:w}=o.extensionManager,x=k||b.$to.parentOffset&&b.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!x||!i)return!0;const v=x.filter(T=>w.includes(T.type.name));n.ensureMarks(v)}return!0},us=(t,e)=>{const n=Ro(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&dn(t.doc,n.pos)&&t.join(n.pos),!0},hs=(t,e)=>{const n=Ro(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&dn(t.doc,r)&&t.join(r),!0},m0=(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=i.extensionManager,f=Se(t,s.schema),p=Se(e,s.schema),{selection:m,storedMarks:g}=s,{$from:b,$to:k}=m,w=b.blockRange(k),x=g||m.$to.parentOffset&&m.$from.marks();if(!w)return!1;const v=Ro(T=>Rc(T.type.name,u))(m);if(w.depth>=1&&v&&w.depth-v.depth<=1){if(v.node.type===f)return c.liftListItem(p);if(Rc(v.node.type.name,u)&&f.validContent(v.node.content)&&a)return l().command(()=>(o.setNodeMarkup(v.pos,f),!0)).command(()=>us(o,f)).command(()=>hs(o,f)).run()}return!n||!x||!a?l().command(()=>d().wrapInList(f,r)?!0:c.clearNodes()).wrapInList(f,r).command(()=>us(o,f)).command(()=>hs(o,f)).run():l().command(()=>{const T=d().wrapInList(f,r),A=x.filter(R=>h.includes(R.type.name));return o.ensureMarks(A),T?!0:c.clearNodes()}).wrapInList(f,r).command(()=>us(o,f)).command(()=>hs(o,f)).run()},g0=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,s=zt(t,r.schema);return Vs(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},b0=(t,e,n={})=>({state:r,commands:i})=>{const o=Se(t,r.schema),s=Se(e,r.schema),a=ln(r,o,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(s,l):i.setNode(o,{...l,...n})},y0=(t,e={})=>({state:n,commands:r})=>{const i=Se(t,n.schema);return ln(n,i,e)?r.lift(i):r.wrapIn(i,e)},k0=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let o;if(i.spec.isInputRules&&(o=i.getState(t))){if(e){const s=t.tr,a=o.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(o.text){const l=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,l))}else s.delete(o.from,o.to)}return!0}}return!1},w0=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},v0=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=zt(t,r.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&s){let{from:h,to:f}=a;const p=(o=c.marks().find(g=>g.type===l))==null?void 0:o.attrs,m=nr(c,l,p);m&&(h=m.from,f=m.to),n.removeMark(h,f,l)}else u.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,l)});return n.removeStoredMark(l),!0},E0=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let o,s;return typeof t=="number"?(o=t,s=t):t&&"from"in t&&"to"in t?(o=t.from,s=t.to):(o=i.from,s=i.to),r&&e.doc.nodesBetween(o,s,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},x0=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=Io(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(o=Se(t,r.schema)),a==="mark"&&(s=zt(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;let h,f,p,m;n.selection.empty?r.doc.nodesBetween(d,u,(g,b)=>{o&&o===g.type&&(l=!0,p=Math.max(b,d),m=Math.min(b+g.nodeSize,u),h=b,f=g)}):r.doc.nodesBetween(d,u,(g,b)=>{b<d&&o&&o===g.type&&(l=!0,p=Math.max(b,d),m=Math.min(b+g.nodeSize,u),h=b,f=g),b>=d&&b<=u&&(o&&o===g.type&&(l=!0,i&&n.setNodeMarkup(b,void 0,{...g.attrs,...e})),s&&g.marks.length&&g.marks.forEach(k=>{if(s===k.type&&(l=!0,i)){const w=Math.max(b,d),x=Math.min(b+g.nodeSize,u);n.addMark(w,x,s.create({...k.attrs,...e}))}}))}),f&&(h!==void 0&&i&&n.setNodeMarkup(h,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(g=>{s===g.type&&i&&n.addMark(p,m,s.create({...g.attrs,...e}))}))}),l},S0=(t,e={})=>({state:n,dispatch:r})=>{const i=Se(t,n.schema);return Qm(i,e)(n,r)},C0=(t,e={})=>({state:n,dispatch:r})=>{const i=Se(t,n.schema);return eg(i,e)(n,r)},T0=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Do=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},M0=(t,e)=>{if(La(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function li(t){var e;const{editor:n,from:r,to:i,text:o,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let d=!1;const u=Qy(c)+o;return s.forEach(h=>{if(d)return;const f=M0(u,h.find);if(!f)return;const p=l.state.tr,m=_o({state:l.state,transaction:p}),g={from:r-(f[0].length-o.length),to:i},{commands:b,chain:k,can:w}=new Oo({editor:n,state:m});h.handler({state:m,range:g,match:f,commands:b,chain:k,can:w})===null||!p.steps.length||(h.undoable&&p.setMeta(a,{transform:p,from:r,to:i,text:o}),l.dispatch(p),d=!0)}),d}function A0(t){const{editor:e,rules:n}=t,r=new Q({state:{init(){return null},apply(i,o,s){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=$a(S.from(d),s.schema);const{from:u}=l,h=u+d.length;li({editor:e,from:u,to:h,text:d,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,a){return li({editor:e,from:o,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&li({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?li({editor:e,from:s.pos,to:s.pos,text:`\n`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function N0(t){return Object.prototype.toString.call(t).slice(8,-1)}function ci(t){return N0(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Ch(t,e){const n={...t};return ci(t)&&ci(e)&&Object.keys(e).forEach(r=>{ci(e[r])&&ci(t[r])?n[r]=Ch(t[r],e[r]):n[r]=e[r]}),n}var Ba=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...X($(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...X($(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Ch(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},lt=class Th extends Ba{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new Th(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!!!s.find(c=>c?.type.name===n.name))return!1;const l=s.find(c=>c?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function _0(t){return typeof t=="number"}var O0=class{constructor(t){this.find=t.find,this.handler=t.handler}},I0=(t,e,n)=>{if(La(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function R0(t){const{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:c,can:d}=new Oo({editor:e,state:n}),u=[];return n.doc.nodesBetween(r,i,(f,p)=>{var m,g,b,k,w;if((g=(m=f.type)==null?void 0:m.spec)!=null&&g.code||!(f.isText||f.isTextblock||f.isInline))return;const x=(w=(k=(b=f.content)==null?void 0:b.size)!=null?k:f.nodeSize)!=null?w:0,v=Math.max(r,p),T=Math.min(i,p+x);if(v>=T)return;const A=f.isText?f.text||"":f.textBetween(v-p,T-p,void 0,"");I0(A,o.find,s).forEach(F=>{if(F.index===void 0)return;const ne=v+F.index+1,re=ne+F[0].length,ke={from:n.tr.mapping.map(ne),to:n.tr.mapping.map(re)},Ae=o.handler({state:n,range:ke,match:F,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});u.push(Ae)})}),u.every(f=>f!==null)}var di=null,L0=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function D0(t){const{editor:e,rules:n}=t;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:d,from:u,to:h,rule:f,pasteEvt:p})=>{const m=d.tr,g=_o({state:d,transaction:m});if(!(!R0({editor:e,state:g,from:Math.max(u-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(d=>new Q({view(u){const h=p=>{var m;r=(m=u.dom.parentElement)!=null&&m.contains(p.target)?u.dom.parentElement:null,r&&(di=e)},f=()=>{di&&(di=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(u,h)=>{if(o=r===u.dom.parentElement,a=h,!o){const f=di;f?.isEditable&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(u,h)=>{var f;const p=(f=h.clipboardData)==null?void 0:f.getData("text/html");return s=h,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(u,h,f)=>{const p=u[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!o,b=p.getMeta("applyPasteRules"),k=!!b;if(!m&&!g&&!k)return;if(k){let{text:v}=b;typeof v=="string"?v=v:v=$a(S.from(v),f.schema);const{from:T}=b,A=T+v.length,R=L0(v);return l({rule:d,state:f,from:T,to:{b:A},pasteEvt:R})}const w=h.doc.content.findDiffStart(f.doc.content),x=h.doc.content.findDiffEnd(f.doc.content);if(!(!_0(w)||!x||w===x.b))return l({rule:d,state:f,from:w,to:x,pasteEvt:s})}}))}var $o=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=bh(t),this.schema=jy(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ai(e.name,this.schema)},r=$(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Ui([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:ai(r.name,this.schema)},o=[],s=$(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&$(r,"exitable",i)&&(a.ArrowRight=()=>lt.handleExit({editor:t,mark:r})),s){const h=Object.fromEntries(Object.entries(s()).map(([f,p])=>[f,()=>p({editor:t})]));a={...a,...h}}const l=Zb(a);o.push(l);const c=$(r,"addInputRules",i);if(Ic(r,t.options.enableInputRules)&&c){const h=c();if(h&&h.length){const f=A0({editor:t,rules:h}),p=Array.isArray(f)?f:[f];o.push(...p)}}const d=$(r,"addPasteRules",i);if(Ic(r,t.options.enablePasteRules)&&d){const h=d();if(h&&h.length){const f=D0({editor:t,rules:h});o.push(...f)}}const u=$(r,"addProseMirrorPlugins",i);if(u){const h=u();o.push(...h)}return o})}get attributes(){return gh(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=rr(this.extensions);return Object.fromEntries(e.filter(n=>!!$(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Se(n.name,this.schema)},o=$(n,"addNodeView",i);if(!o)return[];const s=o();if(!s)return[];const a=(l,c,d,u,h)=>{const f=Pr(l,r);return s({node:l,view:c,getPos:d,decorations:u,innerDecorations:h,editor:t,extension:n,HTMLAttributes:f})};return[n.name,a]}))}dispatchTransaction(t){const{editor:e}=this;return Ui([...this.extensions].reverse()).reduceRight((r,i)=>{const o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:ai(i.name,this.schema)},s=$(i,"dispatchTransaction",o);return s?a=>{s.call(o,{transaction:a,next:r})}:r},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=rr(this.extensions);return Object.fromEntries(e.filter(n=>!!$(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:zt(n.name,this.schema)},o=$(n,"addMarkView",i);if(!o)return[];const s=(a,l,c)=>{const d=Pr(a,r);return o()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:d,updateAttributes:u=>{J0(a,t,u)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ai(e.name,this.schema)};e.type==="mark"&&((n=X($(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const i=$(e,"onBeforeCreate",r),o=$(e,"onCreate",r),s=$(e,"onUpdate",r),a=$(e,"onSelectionUpdate",r),l=$(e,"onTransaction",r),c=$(e,"onFocus",r),d=$(e,"onBlur",r),u=$(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u)})}};$o.resolve=bh;$o.sort=Ui;$o.flatten=Da;var $0={};Ra($0,{ClipboardTextSerializer:()=>Ah,Commands:()=>Nh,Delete:()=>_h,Drop:()=>Oh,Editable:()=>Ih,FocusEvents:()=>Lh,Keymap:()=>Dh,Paste:()=>$h,Tabindex:()=>Ph,TextDirection:()=>Bh,focusEventsPluginKey:()=>Rh});var te=class Mh extends Ba{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Mh(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Ah=te.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Q({key:new ae("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(d=>d.$from.pos)),a=Math.max(...o.map(d=>d.$to.pos)),l=kh(n);return yh(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Nh=te.create({name:"commands",addCommands(){return{...sh}}}),_h=te.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const o=()=>{var s,a,l,c;if((c=(l=(a=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;const d=fh(t.before,[t,...e]);vh(d).forEach(f=>{d.mapping.mapResult(f.oldRange.from).deletedAfter&&d.mapping.mapResult(f.oldRange.to).deletedBefore&&d.before.nodesBetween(f.oldRange.from,f.oldRange.to,(p,m)=>{const g=m+p.nodeSize-2,b=f.oldRange.from<=m&&g<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:g,newFrom:d.mapping.map(m),newTo:d.mapping.map(g),deletedRange:f.oldRange,newRange:f.newRange,partial:!b,editor:this.editor,transaction:t,combinedTransform:d})})});const h=d.mapping;d.steps.forEach((f,p)=>{var m,g;if(f instanceof ft){const b=h.slice(p).map(f.from,-1),k=h.slice(p).map(f.to),w=h.invert().map(b,-1),x=h.invert().map(k),v=(m=d.doc.nodeAt(b-1))==null?void 0:m.marks.some(A=>A.eq(f.mark)),T=(g=d.doc.nodeAt(k))==null?void 0:g.marks.some(A=>A.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:w,to:x},newRange:{from:b,to:k},partial:!!(T||v),editor:this.editor,transaction:t,combinedTransform:d})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(o,0):o()}}),Oh=te.create({name:"drop",addProseMirrorPlugins(){return[new Q({key:new ae("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),Ih=te.create({name:"editable",addProseMirrorPlugins(){return[new Q({key:new ae("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Rh=new ae("focusEvents"),Lh=te.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Q({key:Rh,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Dh=te.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:d,$anchor:u}=l,{pos:h,parent:f}=u,p=u.parent.isTextblock&&h>0?a.doc.resolve(h-1):u,m=p.parent.type.spec.isolating,g=u.pos-u.parentOffset,b=m&&p.parent.childCount===1?g===u.pos:U.atStart(c).from===h;return!d||!f.type.isTextblock||f.textContent.length||!b||b&&u.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Fi()||uh()?o:i},addProseMirrorPlugins(){return[new Q({key:new ae("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),i=t.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:a}=e.selection,l=U.atStart(e.doc).from,c=U.atEnd(e.doc).to;if(o||!(s===l&&a===c)||!Lo(n.doc))return;const h=n.tr,f=_o({state:n,transaction:h}),{commands:p}=new Oo({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),$h=te.create({name:"paste",addProseMirrorPlugins(){return[new Q({key:new ae("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Ph=te.create({name:"tabindex",addProseMirrorPlugins(){return[new Q({key:new ae("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Bh=te.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=rr(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Q({key:new ae("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),P0=class Kn{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Kn(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Kn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Kn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=this.pos+r+(o?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(s);if(!i&&a.depth<=this.depth)return;const l=new Kn(a,this.editor,i,i?n:null);i&&(l.actualDepth=this.depth+1),e.push(new Kn(a,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const o=i.node.attrs,s=Object.keys(n);for(let a=0;a<s.length;a+=1){const l=s[a];if(o[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(n);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(l=>n[l]===s.node.attrs[l])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},B0=`.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}`;function z0(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var H0=class extends T0{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:r0,createMappablePosition:i0},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:o})=>this.options.onDrop(r,i,o)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=ch(e,this.options.autofocus);this.editorState=Jn.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=z0(B0,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=mh(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const o=typeof i=="string"?`${i}$`:i.key;n=n.filter(s=>!s.key.startsWith(o))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[Ih,Ah.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Nh,Lh,Dh,Ph,Oh,$h,_h,Bh.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new $o(r,this)}createCommandManager(){this.commandManager=new Oo({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Fs(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Fs(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r;this.editorView=new oh(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const o=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(o),this.prependClass(),this.injectCSS();const s=this.view.dom;s.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const s=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=s?.getMeta("focus"),l=s?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||o.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return wh(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return e0(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return $a(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`\n\n`,textSerializers:n={}}=t||{};return Gy(this.state.doc,{blockSeparator:e,textSerializers:{...kh(this.schema),...n}})}get isEmpty(){return Lo(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new P0(e,this)}get $doc(){return this.$pos(0)}};function ir(t){return new Do({find:t.find,handler:({state:e,range:n,match:r})=>{const i=X(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],a=r[0];if(s){const l=a.search(/\S/),c=n.from+a.indexOf(s),d=c+s.length;if(Pa(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(m=>m===t.type&&m!==f.mark.type)).filter(f=>f.to>c).length)return null;d<n.to&&o.delete(d,n.to),c>n.from&&o.delete(n.from+l,c);const h=n.from+l+s.length;o.addMark(n.from+l,h,t.type.create(i||{})),o.removeStoredMark(t.type)}},undoable:t.undoable})}function F0(t){return new Do({find:t.find,handler:({state:e,range:n,match:r})=>{const i=X(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let d=s+c;d>a?d=a:a=d+r[1].length;const u=r[0][r[0].length-1];o.insertText(u,s+r[0].length-1),o.replaceWith(d,a,l)}else if(r[0]){const c=t.type.isInline?s:s-1;o.insert(c,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a))}o.scrollIntoView()},undoable:t.undoable})}function Ws(t){return new Do({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),o=X(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)},undoable:t.undoable})}function or(t){return new Do({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const o=X(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),c=l&&ma(l,t.type,o);if(!c)return null;if(s.wrap(l,c),t.keepMarks&&t.editor){const{selection:u,storedMarks:h}=e,{splittableMarks:f}=t.editor.extensionManager,p=h||u.$to.parentOffset&&u.$from.marks();if(p){const m=p.filter(g=>f.includes(g.type.name));s.ensureMarks(m)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,o).run()}const d=s.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&dn(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,d))&&s.join(n.from-1)},undoable:t.undoable})}function U0(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof B){const o=r.index();return r.parent.canReplaceWith(o,o+1,e)}let i=r.depth;for(;i>=0;){const o=r.index(i);if(r.node(i).contentMatchAt(o).matchType(e))return!0;i-=1}return!1}var V0={};Ra(V0,{createAtomBlockMarkdownSpec:()=>W0,createBlockMarkdownSpec:()=>K0,createInlineMarkdownSpec:()=>G0,parseAttributes:()=>za,parseIndentedBlocks:()=>Ks,renderNestedMarkdownContent:()=>Fa,serializeAttributes:()=>Ha});function za(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const c=i.map(d=>d.trim().slice(1));e.class=c.join(" ")}const o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(e.id=o[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,c,d])=>{var u;const h=parseInt(((u=d.match(/__QUOTED_(\d+)__/))==null?void 0:u[1])||"0",10),f=n[h];f&&(e[c]=f.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function Ha(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function W0(t){const{nodeName:e,name:n,parseAttributes:r=za,serializeAttributes:i=Ha,defaultAttributes:o={},requiredAttributes:s=[],allowedAttributes:a}=t,l=n||e,c=d=>{if(!a)return d;const u={};return a.forEach(h=>{h in d&&(u[h]=d[h])}),u};return{parseMarkdown:(d,u)=>{const h={...o,...d.attributes};return u.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(d){var u;const h=new RegExp(`^:::${l}(?:\\s|$)`,"m"),f=(u=d.match(h))==null?void 0:u.index;return f!==void 0?f:-1},tokenize(d,u,h){const f=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=d.match(f);if(!p)return;const m=p[1]||"",g=r(m);if(!s.find(k=>!(k in g)))return{type:e,raw:p[0],attributes:g}}},renderMarkdown:d=>{const u=c(d.attrs||{}),h=i(u),f=h?` {${h}}`:"";return`:::${l}${f} :::`}}}function K0(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=za,serializeAttributes:o=Ha,defaultAttributes:s={},content:a="block",allowedAttributes:l}=t,c=n||e,d=u=>{if(!l)return u;const h={};return l.forEach(f=>{f in u&&(h[f]=u[f])}),h};return{parseMarkdown:(u,h)=>{let f;if(r){const m=r(u);f=typeof m=="string"?[{type:"text",text:m}]:m}else a==="block"?f=h.parseChildren(u.tokens||[]):f=h.parseInline(u.tokens||[]);const p={...s,...u.attributes};return h.createNode(e,p,f)},markdownTokenizer:{name:e,level:"block",start(u){var h;const f=new RegExp(`^:::${c}`,"m"),p=(h=u.match(f))==null?void 0:h.index;return p!==void 0?p:-1},tokenize(u,h,f){var p;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=u.match(m);if(!g)return;const[b,k=""]=g,w=i(k);let x=1;const v=b.length;let T="";const A=/^:::([\w-]*)(\s.*)?/gm,R=u.slice(v);for(A.lastIndex=0;;){const F=A.exec(R);if(F===null)break;const ne=F.index,re=F[1];if(!((p=F[2])!=null&&p.endsWith(":::"))){if(re)x+=1;else if(x-=1,x===0){const ke=R.slice(0,ne);T=ke.trim();const Ae=u.slice(0,v+ne+F[0].length);let Z=[];if(T)if(a==="block")for(Z=f.blockTokens(ke),Z.forEach(J=>{J.text&&(!J.tokens||J.tokens.length===0)&&(J.tokens=f.inlineTokens(J.text))});Z.length>0;){const J=Z[Z.length-1];if(J.type==="paragraph"&&(!J.text||J.text.trim()===""))Z.pop();else break}else Z=f.inlineTokens(T);return{type:e,raw:Ae,attributes:w,content:T,tokens:Z}}}}}},renderMarkdown:(u,h)=>{const f=d(u.attrs||{}),p=o(f),m=p?` {${p}}`:"",g=h.renderChildren(u.content||[],`\n\n`);return`:::${c}${m}\n\n${g}\n\n:::`}}}function j0(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,o,s]=r;e[i]=o||s,r=n.exec(t)}return e}function q0(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function G0(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=j0,serializeAttributes:o=q0,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=t,c=n||e,d=h=>{if(!l)return h;const f={};return l.forEach(p=>{const m=typeof p=="string"?p:p.name,g=typeof p=="string"?void 0:p.skipIfDefault;if(m in h){const b=h[m];if(g!==void 0&&b===g)return;f[m]=b}}),f},u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,f)=>{const p={...s,...h.attributes};if(a)return f.createNode(e,p);const m=r?r(h):h.content||"";return m?f.createNode(e,p,[f.createTextNode(m)]):f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(h){const f=a?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),p=h.match(f),m=p?.index;return m!==void 0?m:-1},tokenize(h,f,p){const m=a?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),g=h.match(m);if(!g)return;let b="",k="";if(a){const[,x]=g;k=x}else{const[,x,v]=g;k=x,b=v||""}const w=i(k.trim());return{type:e,raw:g[0],content:b.trim(),attributes:w}}},renderMarkdown:h=>{let f="";r?f=r(h):h.content&&h.content.length>0&&(f=h.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const p=d(h.attrs||{}),m=o(p),g=m?` ${m}`:"";return a?`[${c}${g}]`:`[${c}${g}]${f}[/${c}]`}}}function Ks(t,e,n){var r,i,o,s;const a=t.split(`\n`),l=[];let c="",d=0;const u=e.baseIndentSize||2;for(;d<a.length;){const h=a[d],f=h.match(e.itemPattern);if(!f){if(l.length>0)break;if(h.trim()===""){d+=1,c=`${c}${h}\n`;continue}else return}const p=e.extractItemData(f),{indentLevel:m,mainContent:g}=p;c=`${c}${h}\n`;const b=[g];for(d+=1;d<a.length;){const v=a[d];if(v.trim()===""){const A=a.slice(d+1).findIndex(ne=>ne.trim()!=="");if(A===-1)break;if((((i=(r=a[d+1+A].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>m){b.push(v),c=`${c}${v}\n`,d+=1;continue}else break}if((((s=(o=v.match(/^(\s*)/))==null?void 0:o[1])==null?void 0:s.length)||0)>m)b.push(v),c=`${c}${v}\n`,d+=1;else break}let k;const w=b.slice(1);if(w.length>0){const v=w.map(T=>T.slice(m+u)).join(`\n`);v.trim()&&(e.customNestedParser?k=e.customNestedParser(v):k=n.blockTokens(v))}const x=e.createToken(p,k);l.push(x)}if(l.length!==0)return{items:l,raw:c}}function Fa(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[o,...s]=t.content,a=e.renderChildren([o]),l=[`${i}${a}`];return s&&s.length>0&&s.forEach(c=>{const d=e.renderChildren([c]);if(d){const u=d.split(`\n`).map(h=>h?e.indent(h):"").join(`\n`);l.push(u)}}),l.join(`\n`)}function J0(t,e,n={}){const{state:r}=e,{doc:i,tr:o}=r,s=t;i.descendants((a,l)=>{const c=o.mapping.map(l),d=o.mapping.map(l)+a.nodeSize;let u=null;if(a.marks.forEach(f=>{if(f!==s)return!1;u=f}),!u)return;let h=!1;if(Object.keys(n).forEach(f=>{n[f]!==u.attrs[f]&&(h=!0)}),h){const f=t.type.create({...t.attrs,...n});o.removeMark(c,d,t.type),o.addMark(c,d,f)}}),o.docChanged&&e.view.dispatch(o)}var ye=class zh extends Ba{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new zh(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Rn(t){return new O0({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const o=X(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const d=l.search(/\S/),u=n.from+l.indexOf(a),h=u+a.length;if(Pa(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>u).length)return null;h<n.to&&s.delete(h,n.to),u>n.from&&s.delete(n.from+d,u),c=n.from+d+a.length,s.addMark(n.from+d,c,t.type.create(o||{})),s.removeStoredMark(t.type)}}})}var Z0=/(^|[^`])`([^`]+)`(?!`)$/,Y0=/(^|[^`])`([^`]+)`(?!`)/g,Hh=lt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",se(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ir({find:Z0,type:this.type})]},addPasteRules(){return[Rn({find:Y0,type:this.type})]}}),X0=Hh,fs=4,Q0=/^```([a-z]+)?[\s\n]$/,ek=/^~~~([a-z]+)?[\s\n]$/,Fh=ye.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:fs,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const o=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",se(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`\n`):r=`\`\`\`${i}\n\n\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:fs,{state:r}=t,{selection:i}=r,{$from:o,empty:s}=i;if(o.parent.type!==this.type)return!1;const a=" ".repeat(n);return s?t.commands.insertContent(a):t.commands.command(({tr:l})=>{const{from:c,to:d}=i,f=r.doc.textBetween(c,d,`\n`,`\n`).split(`\n`).map(p=>a+p).join(`\n`);return l.replaceWith(c,d,r.schema.text(f)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:fs,{state:r}=t,{selection:i}=r,{$from:o,empty:s}=i;return o.parent.type!==this.type?!1:s?t.commands.command(({tr:a})=>{var l;const{pos:c}=o,d=o.start(),u=o.end(),f=r.doc.textBetween(d,u,`\n`,`\n`).split(`\n`);let p=0,m=0;const g=c-d;for(let T=0;T<f.length;T+=1){if(m+f[T].length>=g){p=T;break}m+=f[T].length+1}const k=((l=f[p].match(/^ */))==null?void 0:l[0])||"",w=Math.min(k.length,n);if(w===0)return!0;let x=d;for(let T=0;T<p;T+=1)x+=f[T].length+1;return a.delete(x,x+w),c-x<=w&&a.setSelection(P.create(a.doc,x)),!0}):t.commands.command(({tr:a})=>{const{from:l,to:c}=i,h=r.doc.textBetween(l,c,`\n`,`\n`).split(`\n`).map(f=>{var p;const m=((p=f.match(/^ */))==null?void 0:p[0])||"",g=Math.min(m.length,n);return f.slice(g)}).join(`\n`);return a.replaceWith(l,c,r.schema.text(h)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`\n\n`);return!o||!s?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:c})=>(c.setSelection(U.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[Ws({find:Q0,type:this.type,getAttributes:t=>({language:t[1]})}),Ws({find:ek,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Q({key:new ae("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i?.mode;if(!n||!o)return!1;const{tr:s,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`\n`));return s.replaceSelectionWith(this.type.create({language:o},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(P.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),tk=Fh;function nk(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ps,Dc;function rk(){if(Dc)return ps;Dc=1;function t(y){return y instanceof Map?y.clear=y.delete=y.set=function(){throw new Error("map is read-only")}:y instanceof Set&&(y.add=y.clear=y.delete=function(){throw new Error("set is read-only")}),Object.freeze(y),Object.getOwnPropertyNames(y).forEach(E=>{const _=y[E],W=typeof _;(W==="object"||W==="function")&&!Object.isFrozen(_)&&t(_)}),y}class e{constructor(E){E.data===void 0&&(E.data={}),this.data=E.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(y){return y.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(y,...E){const _=Object.create(null);for(const W in y)_[W]=y[W];return E.forEach(function(W){for(const ge in W)_[ge]=W[ge]}),_}const i="</span>",o=y=>!!y.scope,s=(y,{prefix:E})=>{if(y.startsWith("language:"))return y.replace("language:","language-");if(y.includes(".")){const _=y.split(".");return[`${E}${_.shift()}`,..._.map((W,ge)=>`${W}${"_".repeat(ge+1)}`)].join(" ")}return`${E}${y}`};class a{constructor(E,_){this.buffer="",this.classPrefix=_.classPrefix,E.walk(this)}addText(E){this.buffer+=n(E)}openNode(E){if(!o(E))return;const _=s(E.scope,{prefix:this.classPrefix});this.span(_)}closeNode(E){o(E)&&(this.buffer+=i)}value(){return this.buffer}span(E){this.buffer+=`<span class="${E}">`}}const l=(y={})=>{const E={children:[]};return Object.assign(E,y),E};class c{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(E){this.top.children.push(E)}openNode(E){const _=l({scope:E});this.add(_),this.stack.push(_)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(E){return this.constructor._walk(E,this.rootNode)}static _walk(E,_){return typeof _=="string"?E.addText(_):_.children&&(E.openNode(_),_.children.forEach(W=>this._walk(E,W)),E.closeNode(_)),E}static _collapse(E){typeof E!="string"&&E.children&&(E.children.every(_=>typeof _=="string")?E.children=[E.children.join("")]:E.children.forEach(_=>{c._collapse(_)}))}}class d extends c{constructor(E){super(),this.options=E}addText(E){E!==""&&this.add(E)}startScope(E){this.openNode(E)}endScope(){this.closeNode()}__addSublanguage(E,_){const W=E.root;_&&(W.scope=`language:${_}`),this.add(W)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function u(y){return y?typeof y=="string"?y:y.source:null}function h(y){return m("(?=",y,")")}function f(y){return m("(?:",y,")*")}function p(y){return m("(?:",y,")?")}function m(...y){return y.map(_=>u(_)).join("")}function g(y){const E=y[y.length-1];return typeof E=="object"&&E.constructor===Object?(y.splice(y.length-1,1),E):{}}function b(...y){return"("+(g(y).capture?"":"?:")+y.map(W=>u(W)).join("|")+")"}function k(y){return new RegExp(y.toString()+"|").exec("").length-1}function w(y,E){const _=y&&y.exec(E);return _&&_.index===0}const x=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function v(y,{joinWith:E}){let _=0;return y.map(W=>{_+=1;const ge=_;let be=u(W),L="";for(;be.length>0;){const I=x.exec(be);if(!I){L+=be;break}L+=be.substring(0,I.index),be=be.substring(I.index+I[0].length),I[0][0]==="\\"&&I[1]?L+="\\"+String(Number(I[1])+ge):(L+=I[0],I[0]==="("&&_++)}return L}).map(W=>`(${W})`).join(E)}const T=/\b\B/,A="[a-zA-Z]\\w*",R="[a-zA-Z_]\\w*",F="\\b\\d+(\\.\\d+)?",ne="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",re="\\b(0b[01]+)",ke="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Ae=(y={})=>{const E=/^#![ ]*\//;return y.binary&&(y.begin=m(E,/.*\b/,y.binary,/\b.*/)),r({scope:"meta",begin:E,end:/$/,relevance:0,"on:begin":(_,W)=>{_.index!==0&&W.ignoreMatch()}},y)},Z={begin:"\\\\[\\s\\S]",relevance:0},J={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Z]},we={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Z]},ct={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Y=function(y,E,_={}){const W=r({scope:"comment",begin:y,end:E,contains:[]},_);W.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const ge=b("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return W.contains.push({begin:m(/[ ]+/,"(",ge,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),W},We=Y("//","$"),Ye=Y("/\\*","\\*/"),dt=Y("#","$"),At={scope:"number",begin:F,relevance:0},fn={scope:"number",begin:ne,relevance:0},np={scope:"number",begin:re,relevance:0},rp={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Z,{begin:/\[/,end:/\]/,relevance:0,contains:[Z]}]},ip={scope:"title",begin:A,relevance:0},op={scope:"title",begin:R,relevance:0},sp={begin:"\\.\\s*"+R,relevance:0};var Zr=Object.freeze({__proto__:null,APOS_STRING_MODE:J,BACKSLASH_ESCAPE:Z,BINARY_NUMBER_MODE:np,BINARY_NUMBER_RE:re,COMMENT:Y,C_BLOCK_COMMENT_MODE:Ye,C_LINE_COMMENT_MODE:We,C_NUMBER_MODE:fn,C_NUMBER_RE:ne,END_SAME_AS_BEGIN:function(y){return Object.assign(y,{"on:begin":(E,_)=>{_.data._beginMatch=E[1]},"on:end":(E,_)=>{_.data._beginMatch!==E[1]&&_.ignoreMatch()}})},HASH_COMMENT_MODE:dt,IDENT_RE:A,MATCH_NOTHING_RE:T,METHOD_GUARD:sp,NUMBER_MODE:At,NUMBER_RE:F,PHRASAL_WORDS_MODE:ct,QUOTE_STRING_MODE:we,REGEXP_MODE:rp,RE_STARTERS_RE:ke,SHEBANG:Ae,TITLE_MODE:ip,UNDERSCORE_IDENT_RE:R,UNDERSCORE_TITLE_MODE:op});function ap(y,E){y.input[y.index-1]==="."&&E.ignoreMatch()}function lp(y,E){y.className!==void 0&&(y.scope=y.className,delete y.className)}function cp(y,E){E&&y.beginKeywords&&(y.begin="\\b("+y.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",y.__beforeBegin=ap,y.keywords=y.keywords||y.beginKeywords,delete y.beginKeywords,y.relevance===void 0&&(y.relevance=0))}function dp(y,E){Array.isArray(y.illegal)&&(y.illegal=b(...y.illegal))}function up(y,E){if(y.match){if(y.begin||y.end)throw new Error("begin & end are not supported with match");y.begin=y.match,delete y.match}}function hp(y,E){y.relevance===void 0&&(y.relevance=1)}const fp=(y,E)=>{if(!y.beforeMatch)return;if(y.starts)throw new Error("beforeMatch cannot be used with starts");const _=Object.assign({},y);Object.keys(y).forEach(W=>{delete y[W]}),y.keywords=_.keywords,y.begin=m(_.beforeMatch,h(_.begin)),y.starts={relevance:0,contains:[Object.assign(_,{endsParent:!0})]},y.relevance=0,delete _.beforeMatch},pp=["of","and","for","in","not","or","if","then","parent","list","value"],mp="keyword";function dl(y,E,_=mp){const W=Object.create(null);return typeof y=="string"?ge(_,y.split(" ")):Array.isArray(y)?ge(_,y):Object.keys(y).forEach(function(be){Object.assign(W,dl(y[be],E,be))}),W;function ge(be,L){E&&(L=L.map(I=>I.toLowerCase())),L.forEach(function(I){const V=I.split("|");W[V[0]]=[be,gp(V[0],V[1])]})}}function gp(y,E){return E?Number(E):bp(y)?0:1}function bp(y){return pp.includes(y.toLowerCase())}const ul={},pn=y=>{console.error(y)},hl=(y,...E)=>{console.log(`WARN: ${y}`,...E)},zn=(y,E)=>{ul[`${y}/${E}`]||(console.log(`Deprecated as of ${y}. ${E}`),ul[`${y}/${E}`]=!0)},Yr=new Error;function fl(y,E,{key:_}){let W=0;const ge=y[_],be={},L={};for(let I=1;I<=E.length;I++)L[I+W]=ge[I],be[I+W]=!0,W+=k(E[I-1]);y[_]=L,y[_]._emit=be,y[_]._multi=!0}function yp(y){if(Array.isArray(y.begin)){if(y.skip||y.excludeBegin||y.returnBegin)throw pn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Yr;if(typeof y.beginScope!="object"||y.beginScope===null)throw pn("beginScope must be object"),Yr;fl(y,y.begin,{key:"beginScope"}),y.begin=v(y.begin,{joinWith:""})}}function kp(y){if(Array.isArray(y.end)){if(y.skip||y.excludeEnd||y.returnEnd)throw pn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Yr;if(typeof y.endScope!="object"||y.endScope===null)throw pn("endScope must be object"),Yr;fl(y,y.end,{key:"endScope"}),y.end=v(y.end,{joinWith:""})}}function wp(y){y.scope&&typeof y.scope=="object"&&y.scope!==null&&(y.beginScope=y.scope,delete y.scope)}function vp(y){wp(y),typeof y.beginScope=="string"&&(y.beginScope={_wrap:y.beginScope}),typeof y.endScope=="string"&&(y.endScope={_wrap:y.endScope}),yp(y),kp(y)}function Ep(y){function E(L,I){return new RegExp(u(L),"m"+(y.case_insensitive?"i":"")+(y.unicodeRegex?"u":"")+(I?"g":""))}class _{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(I,V){V.position=this.position++,this.matchIndexes[this.matchAt]=V,this.regexes.push([V,I]),this.matchAt+=k(I)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const I=this.regexes.map(V=>V[1]);this.matcherRe=E(v(I,{joinWith:"|"}),!0),this.lastIndex=0}exec(I){this.matcherRe.lastIndex=this.lastIndex;const V=this.matcherRe.exec(I);if(!V)return null;const Ne=V.findIndex((cr,Vo)=>Vo>0&&cr!==void 0),ve=this.matchIndexes[Ne];return V.splice(0,Ne),Object.assign(V,ve)}}class W{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(I){if(this.multiRegexes[I])return this.multiRegexes[I];const V=new _;return this.rules.slice(I).forEach(([Ne,ve])=>V.addRule(Ne,ve)),V.compile(),this.multiRegexes[I]=V,V}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(I,V){this.rules.push([I,V]),V.type==="begin"&&this.count++}exec(I){const V=this.getMatcher(this.regexIndex);V.lastIndex=this.lastIndex;let Ne=V.exec(I);if(this.resumingScanAtSamePosition()&&!(Ne&&Ne.index===this.lastIndex)){const ve=this.getMatcher(0);ve.lastIndex=this.lastIndex+1,Ne=ve.exec(I)}return Ne&&(this.regexIndex+=Ne.position+1,this.regexIndex===this.count&&this.considerAll()),Ne}}function ge(L){const I=new W;return L.contains.forEach(V=>I.addRule(V.begin,{rule:V,type:"begin"})),L.terminatorEnd&&I.addRule(L.terminatorEnd,{type:"end"}),L.illegal&&I.addRule(L.illegal,{type:"illegal"}),I}function be(L,I){const V=L;if(L.isCompiled)return V;[lp,up,vp,fp].forEach(ve=>ve(L,I)),y.compilerExtensions.forEach(ve=>ve(L,I)),L.__beforeBegin=null,[cp,dp,hp].forEach(ve=>ve(L,I)),L.isCompiled=!0;let Ne=null;return typeof L.keywords=="object"&&L.keywords.$pattern&&(L.keywords=Object.assign({},L.keywords),Ne=L.keywords.$pattern,delete L.keywords.$pattern),Ne=Ne||/\w+/,L.keywords&&(L.keywords=dl(L.keywords,y.case_insensitive)),V.keywordPatternRe=E(Ne,!0),I&&(L.begin||(L.begin=/\B|\b/),V.beginRe=E(V.begin),!L.end&&!L.endsWithParent&&(L.end=/\B|\b/),L.end&&(V.endRe=E(V.end)),V.terminatorEnd=u(V.end)||"",L.endsWithParent&&I.terminatorEnd&&(V.terminatorEnd+=(L.end?"|":"")+I.terminatorEnd)),L.illegal&&(V.illegalRe=E(L.illegal)),L.contains||(L.contains=[]),L.contains=[].concat(...L.contains.map(function(ve){return xp(ve==="self"?L:ve)})),L.contains.forEach(function(ve){be(ve,V)}),L.starts&&be(L.starts,I),V.matcher=ge(V),V}if(y.compilerExtensions||(y.compilerExtensions=[]),y.contains&&y.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return y.classNameAliases=r(y.classNameAliases||{}),be(y)}function pl(y){return y?y.endsWithParent||pl(y.starts):!1}function xp(y){return y.variants&&!y.cachedVariants&&(y.cachedVariants=y.variants.map(function(E){return r(y,{variants:null},E)})),y.cachedVariants?y.cachedVariants:pl(y)?r(y,{starts:y.starts?r(y.starts):null}):Object.isFrozen(y)?r(y):y}var Sp="11.11.1";class Cp extends Error{constructor(E,_){super(E),this.name="HTMLInjectionError",this.html=_}}const Uo=n,ml=r,gl=Symbol("nomatch"),Tp=7,bl=function(y){const E=Object.create(null),_=Object.create(null),W=[];let ge=!0;const be="Could not find the language '{}', did you forget to load/include a language module?",L={disableAutodetect:!0,name:"Plain text",contains:[]};let I={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function V(M){return I.noHighlightRe.test(M)}function Ne(M){let z=M.className+" ";z+=M.parentNode?M.parentNode.className:"";const G=I.languageDetectRe.exec(z);if(G){const le=Ft(G[1]);return le||(hl(be.replace("{}",G[1])),hl("Falling back to no-highlight mode for this block.",M)),le?G[1]:"no-highlight"}return z.split(/\s+/).find(le=>V(le)||Ft(le))}function ve(M,z,G){let le="",Ce="";typeof z=="object"?(le=M,G=z.ignoreIllegals,Ce=z.language):(zn("10.7.0","highlight(lang, code, ...args) has been deprecated."),zn("10.7.0",`Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277`),Ce=M,le=z),G===void 0&&(G=!0);const ut={code:le,language:Ce};Qr("before:highlight",ut);const Ut=ut.result?ut.result:cr(ut.language,ut.code,G);return Ut.code=ut.code,Qr("after:highlight",Ut),Ut}function cr(M,z,G,le){const Ce=Object.create(null);function ut(O,D){return O.keywords[D]}function Ut(){if(!K.keywords){Le.addText(ce);return}let O=0;K.keywordPatternRe.lastIndex=0;let D=K.keywordPatternRe.exec(ce),q="";for(;D;){q+=ce.substring(O,D.index);const ee=yt.case_insensitive?D[0].toLowerCase():D[0],ze=ut(K,ee);if(ze){const[Nt,Vp]=ze;if(Le.addText(q),q="",Ce[ee]=(Ce[ee]||0)+1,Ce[ee]<=Tp&&(ni+=Vp),Nt.startsWith("_"))q+=D[0];else{const Wp=yt.classNameAliases[Nt]||Nt;bt(D[0],Wp)}}else q+=D[0];O=K.keywordPatternRe.lastIndex,D=K.keywordPatternRe.exec(ce)}q+=ce.substring(O),Le.addText(q)}function ei(){if(ce==="")return;let O=null;if(typeof K.subLanguage=="string"){if(!E[K.subLanguage]){Le.addText(ce);return}O=cr(K.subLanguage,ce,!0,Cl[K.subLanguage]),Cl[K.subLanguage]=O._top}else O=Wo(ce,K.subLanguage.length?K.subLanguage:null);K.relevance>0&&(ni+=O.relevance),Le.__addSublanguage(O._emitter,O.language)}function Xe(){K.subLanguage!=null?ei():Ut(),ce=""}function bt(O,D){O!==""&&(Le.startScope(D),Le.addText(O),Le.endScope())}function vl(O,D){let q=1;const ee=D.length-1;for(;q<=ee;){if(!O._emit[q]){q++;continue}const ze=yt.classNameAliases[O[q]]||O[q],Nt=D[q];ze?bt(Nt,ze):(ce=Nt,Ut(),ce=""),q++}}function El(O,D){return O.scope&&typeof O.scope=="string"&&Le.openNode(yt.classNameAliases[O.scope]||O.scope),O.beginScope&&(O.beginScope._wrap?(bt(ce,yt.classNameAliases[O.beginScope._wrap]||O.beginScope._wrap),ce=""):O.beginScope._multi&&(vl(O.beginScope,D),ce="")),K=Object.create(O,{parent:{value:K}}),K}function xl(O,D,q){let ee=w(O.endRe,q);if(ee){if(O["on:end"]){const ze=new e(O);O["on:end"](D,ze),ze.isMatchIgnored&&(ee=!1)}if(ee){for(;O.endsParent&&O.parent;)O=O.parent;return O}}if(O.endsWithParent)return xl(O.parent,D,q)}function Bp(O){return K.matcher.regexIndex===0?(ce+=O[0],1):(Go=!0,0)}function zp(O){const D=O[0],q=O.rule,ee=new e(q),ze=[q.__beforeBegin,q["on:begin"]];for(const Nt of ze)if(Nt&&(Nt(O,ee),ee.isMatchIgnored))return Bp(D);return q.skip?ce+=D:(q.excludeBegin&&(ce+=D),Xe(),!q.returnBegin&&!q.excludeBegin&&(ce=D)),El(q,O),q.returnBegin?0:D.length}function Hp(O){const D=O[0],q=z.substring(O.index),ee=xl(K,O,q);if(!ee)return gl;const ze=K;K.endScope&&K.endScope._wrap?(Xe(),bt(D,K.endScope._wrap)):K.endScope&&K.endScope._multi?(Xe(),vl(K.endScope,O)):ze.skip?ce+=D:(ze.returnEnd||ze.excludeEnd||(ce+=D),Xe(),ze.excludeEnd&&(ce=D));do{K.scope&&Le.closeNode(),!K.skip&&!K.subLanguage&&(ni+=K.relevance),K=K.parent}while(K!==ee.parent);return ee.starts&&El(ee.starts,O),ze.returnEnd?0:D.length}function Fp(){const O=[];for(let D=K;D!==yt;D=D.parent)D.scope&&O.unshift(D.scope);O.forEach(D=>Le.openNode(D))}let ti={};function Sl(O,D){const q=D&&D[0];if(ce+=O,q==null)return Xe(),0;if(ti.type==="begin"&&D.type==="end"&&ti.index===D.index&&q===""){if(ce+=z.slice(D.index,D.index+1),!ge){const ee=new Error(`0 width match regex (${M})`);throw ee.languageName=M,ee.badRule=ti.rule,ee}return 1}if(ti=D,D.type==="begin")return zp(D);if(D.type==="illegal"&&!G){const ee=new Error('Illegal lexeme "'+q+'" for mode "'+(K.scope||"<unnamed>")+'"');throw ee.mode=K,ee}else if(D.type==="end"){const ee=Hp(D);if(ee!==gl)return ee}if(D.type==="illegal"&&q==="")return ce+=`\n`,1;if(qo>1e5&&qo>D.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ce+=q,q.length}const yt=Ft(M);if(!yt)throw pn(be.replace("{}",M)),new Error('Unknown language: "'+M+'"');const Up=Ep(yt);let jo="",K=le||Up;const Cl={},Le=new I.__emitter(I);Fp();let ce="",ni=0,mn=0,qo=0,Go=!1;try{if(yt.__emitTokens)yt.__emitTokens(z,Le);else{for(K.matcher.considerAll();;){qo++,Go?Go=!1:K.matcher.considerAll(),K.matcher.lastIndex=mn;const O=K.matcher.exec(z);if(!O)break;const D=z.substring(mn,O.index),q=Sl(D,O);mn=O.index+q}Sl(z.substring(mn))}return Le.finalize(),jo=Le.toHTML(),{language:M,value:jo,relevance:ni,illegal:!1,_emitter:Le,_top:K}}catch(O){if(O.message&&O.message.includes("Illegal"))return{language:M,value:Uo(z),illegal:!0,relevance:0,_illegalBy:{message:O.message,index:mn,context:z.slice(mn-100,mn+100),mode:O.mode,resultSoFar:jo},_emitter:Le};if(ge)return{language:M,value:Uo(z),illegal:!1,relevance:0,errorRaised:O,_emitter:Le,_top:K};throw O}}function Vo(M){const z={value:Uo(M),illegal:!1,relevance:0,_top:L,_emitter:new I.__emitter(I)};return z._emitter.addText(M),z}function Wo(M,z){z=z||I.languages||Object.keys(E);const G=Vo(M),le=z.filter(Ft).filter(wl).map(Xe=>cr(Xe,M,!1));le.unshift(G);const Ce=le.sort((Xe,bt)=>{if(Xe.relevance!==bt.relevance)return bt.relevance-Xe.relevance;if(Xe.language&&bt.language){if(Ft(Xe.language).supersetOf===bt.language)return 1;if(Ft(bt.language).supersetOf===Xe.language)return-1}return 0}),[ut,Ut]=Ce,ei=ut;return ei.secondBest=Ut,ei}function Mp(M,z,G){const le=z&&_[z]||G;M.classList.add("hljs"),M.classList.add(`language-${le}`)}function Ko(M){let z=null;const G=Ne(M);if(V(G))return;if(Qr("before:highlightElement",{el:M,language:G}),M.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",M);return}if(M.children.length>0&&(I.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(M)),I.throwUnescapedHTML))throw new Cp("One of your code blocks includes unescaped HTML.",M.innerHTML);z=M;const le=z.textContent,Ce=G?ve(le,{language:G,ignoreIllegals:!0}):Wo(le);M.innerHTML=Ce.value,M.dataset.highlighted="yes",Mp(M,G,Ce.language),M.result={language:Ce.language,re:Ce.relevance,relevance:Ce.relevance},Ce.secondBest&&(M.secondBest={language:Ce.secondBest.language,relevance:Ce.secondBest.relevance}),Qr("after:highlightElement",{el:M,result:Ce,text:le})}function Ap(M){I=ml(I,M)}const Np=()=>{Xr(),zn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function _p(){Xr(),zn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let yl=!1;function Xr(){function M(){Xr()}if(document.readyState==="loading"){yl||window.addEventListener("DOMContentLoaded",M,!1),yl=!0;return}document.querySelectorAll(I.cssSelector).forEach(Ko)}function Op(M,z){let G=null;try{G=z(y)}catch(le){if(pn("Language definition for '{}' could not be registered.".replace("{}",M)),ge)pn(le);else throw le;G=L}G.name||(G.name=M),E[M]=G,G.rawDefinition=z.bind(null,y),G.aliases&&kl(G.aliases,{languageName:M})}function Ip(M){delete E[M];for(const z of Object.keys(_))_[z]===M&&delete _[z]}function Rp(){return Object.keys(E)}function Ft(M){return M=(M||"").toLowerCase(),E[M]||E[_[M]]}function kl(M,{languageName:z}){typeof M=="string"&&(M=[M]),M.forEach(G=>{_[G.toLowerCase()]=z})}function wl(M){const z=Ft(M);return z&&!z.disableAutodetect}function Lp(M){M["before:highlightBlock"]&&!M["before:highlightElement"]&&(M["before:highlightElement"]=z=>{M["before:highlightBlock"](Object.assign({block:z.el},z))}),M["after:highlightBlock"]&&!M["after:highlightElement"]&&(M["after:highlightElement"]=z=>{M["after:highlightBlock"](Object.assign({block:z.el},z))})}function Dp(M){Lp(M),W.push(M)}function $p(M){const z=W.indexOf(M);z!==-1&&W.splice(z,1)}function Qr(M,z){const G=M;W.forEach(function(le){le[G]&&le[G](z)})}function Pp(M){return zn("10.7.0","highlightBlock will be removed entirely in v12.0"),zn("10.7.0","Please use highlightElement now."),Ko(M)}Object.assign(y,{highlight:ve,highlightAuto:Wo,highlightAll:Xr,highlightElement:Ko,highlightBlock:Pp,configure:Ap,initHighlighting:Np,initHighlightingOnLoad:_p,registerLanguage:Op,unregisterLanguage:Ip,listLanguages:Rp,getLanguage:Ft,registerAliases:kl,autoDetection:wl,inherit:ml,addPlugin:Dp,removePlugin:$p}),y.debugMode=function(){ge=!1},y.safeMode=function(){ge=!0},y.versionString=Sp,y.regex={concat:m,lookahead:h,either:b,optional:p,anyNumberOfTimes:f};for(const M in Zr)typeof Zr[M]=="object"&&t(Zr[M]);return Object.assign(y,Zr),y},Hn=bl({});return Hn.newInstance=()=>bl({}),ps=Hn,Hn.HighlightJS=Hn,Hn.default=Hn,ps}var ik=rk();const Uh=nk(ik);function Vh(t,e=[]){return t.flatMap(n=>{const r=[...e,...n.properties?n.properties.className:[]];return n.children?Vh(n.children,r):{text:n.value,classes:r}})}function $c(t){return t.value||t.children||[]}function ok(t){return!!Uh.getLanguage(t)}function Pc({doc:t,name:e,lowlight:n,defaultLanguage:r}){const i=[];return Us(t,o=>o.type.name===e).forEach(o=>{var s;let a=o.pos+1;const l=o.node.attrs.language||r,c=n.listLanguages(),d=l&&(c.includes(l)||ok(l)||(s=n.registered)!=null&&s.call(n,l))?$c(n.highlight(l,o.node.textContent)):$c(n.highlightAuto(o.node.textContent));Vh(d).forEach(u=>{const h=a+u.text.length;if(u.classes.length){const f=Te.inline(a,h,{class:u.classes.join(" ")});i.push(f)}a=h})}),ie.create(t,i)}function sk(t){return typeof t=="function"}function ak({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(i=>sk(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new Q({key:new ae("lowlight"),state:{init:(i,{doc:o})=>Pc({doc:o,name:t,lowlight:e,defaultLanguage:n}),apply:(i,o,s,a)=>{const l=s.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,d=Us(s.doc,h=>h.type.name===t),u=Us(a.doc,h=>h.type.name===t);return i.docChanged&&([l,c].includes(t)||u.length!==d.length||i.steps.some(h=>h.from!==void 0&&h.to!==void 0&&d.some(f=>f.pos>=h.from&&f.pos+f.node.nodeSize<=h.to)))?Pc({doc:i.doc,name:t,lowlight:e,defaultLanguage:n}):o.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var lk=tk.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var t;return[...((t=this.parent)==null?void 0:t.call(this))||[],ak({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),ck=lk,Wh=ye.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`\n\n`):""}),dk=Wh,uk=Object.defineProperty,hk=(t,e)=>{for(var n in e)uk(t,n,{get:e[n],enumerable:!0})},fk="listItem",Bc="textStyle",zc=/^\s*([-+*])\s$/,Ua=ye.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",se(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`\n`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(fk,this.editor.getAttributes(Bc)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=or({find:zc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=or({find:zc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Bc),editor:this.editor})),[t]}}),Va=ye.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",se(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(i=>i.type==="paragraph"))n=e.parseChildren(t.tokens);else{const i=t.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(i.tokens)}],t.tokens.length>1){const s=t.tokens.slice(1),a=e.parseChildren(s);n.push(...a)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>Fa(t,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),pk={};hk(pk,{findListItemPos:()=>qr,getNextListDepth:()=>Wa,handleBackspace:()=>js,handleDelete:()=>qs,hasListBefore:()=>Kh,hasListItemAfter:()=>mk,hasListItemBefore:()=>jh,listItemHasSubList:()=>qh,nextListIsDeeper:()=>Gh,nextListIsHigher:()=>Jh});var qr=(t,e)=>{const{$from:n}=e.selection,r=Se(t,e.schema);let i=null,o=n.depth,s=n.pos,a=null;for(;o>0&&a===null;)i=n.node(o),i.type===r?a=o:(o-=1,s-=1);return a===null?null:{$pos:e.doc.resolve(s),depth:a}},Wa=(t,e)=>{const n=qr(t,e);if(!n)return!1;const[,r]=Xy(e,t,n.$pos.pos+4);return r},Kh=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),o=t.doc.resolve(i).node();return!(!o||!n.includes(o.type.name))},jh=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},qh=(t,e,n)=>{if(!n)return!1;const r=Se(t,e.schema);let i=!1;return n.descendants(o=>{o.type===r&&(i=!0)}),i},js=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!ln(t.state,e)&&Kh(t.state,e,n)){const{$anchor:a}=t.state.selection,l=t.state.doc.resolve(a.before()-1),c=[];l.node().descendants((h,f)=>{h.type.name===e&&c.push({node:h,pos:f})});const d=c.at(-1);if(!d)return!1;const u=t.state.doc.resolve(l.start()+d.pos+1);return t.chain().cut({from:a.start()-1,to:a.end()+1},u.end()).joinForward().run()}if(!ln(t.state,e)||!n0(t.state))return!1;const r=qr(e,t.state);if(!r)return!1;const o=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),s=qh(e,t.state,o);return jh(e,t.state)&&!s?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},Gh=(t,e)=>{const n=Wa(t,e),r=qr(t,e);return!r||!n?!1:n>r.depth},Jh=(t,e)=>{const n=Wa(t,e),r=qr(t,e);return!r||!n?!1:n<r.depth},qs=(t,e)=>{if(!ln(t.state,e)||!t0(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:Gh(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():Jh(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},mk=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},Zh=te.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&qs(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&qs(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&js(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&js(t,n,r)&&(e=!0)}),e}}}}),Hc=/^(\s*)(\d+)\.\s+(.*)$/,gk=/^\s/;function bk(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],o=i.match(Hc);if(!o)break;const[,s,a,l]=o,c=s.length;let d=l,u=n+1;const h=[i];for(;u<t.length;){const f=t[u];if(f.match(Hc))break;if(f.trim()==="")h.push(f),d+=`\n`,u+=1;else if(f.match(gk))h.push(f),d+=`\n${f.slice(c+2)}`,u+=1;else break}e.push({indent:c,number:parseInt(a,10),content:d.trim(),raw:h.join(`\n`)}),r=u,n=u}return[e,r]}function Yh(t,e,n){var r;const i=[];let o=0;for(;o<t.length;){const s=t[o];if(s.indent===e){const a=s.content.split(`\n`),l=((r=a[0])==null?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const d=a.slice(1).join(`\n`).trim();if(d){const f=n.blockTokens(d);c.push(...f)}let u=o+1;const h=[];for(;u<t.length&&t[u].indent>e;)h.push(t[u]),u+=1;if(h.length>0){const f=Math.min(...h.map(m=>m.indent)),p=Yh(h,f,n);c.push({type:"list",ordered:!0,start:h[0].number,items:p,raw:h.map(m=>m.raw).join(`\n`)})}i.push({type:"list_item",raw:s.raw,tokens:c}),o=u}else o+=1}return i}function yk(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const o=e.parseChildren([i]);r.push({type:"paragraph",content:o})}else{const o=e.parseChildren([i]);o.length>0&&r.push(...o)}}),{type:"listItem",content:r}})}var kk="listItem",Fc="textStyle",Uc=/^(\d+)\.\s$/,Ka=ye.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",se(this.options.HTMLAttributes,n),0]:["ol",se(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?yk(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`\n`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const i=t.split(`\n`),[o,s]=bk(i);if(o.length===0)return;const a=Yh(o,0,n);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=o[0])==null?void 0:r.number)||1,items:a,raw:i.slice(0,s).join(`\n`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(kk,this.editor.getAttributes(Fc)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=or({find:Uc,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=or({find:Uc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Fc)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),wk=/^\s*(\[([( |x])?\])\s$/,vk=ye.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",se(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Fa(t,e,i)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=u=>{var h,f;a.ariaLabel=((f=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:f.call(h,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};c(t),o.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:h}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const p=n();if(typeof p!="number")return!1;const m=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,{...m?.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,h)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,h])=>{i.setAttribute(u,h)}),i.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,o.append(a,s),i.append(o,l),Object.entries(e).forEach(([u,h])=>{i.setAttribute(u,h)});let d=new Set(Object.keys(e));return{dom:i,contentDOM:l,update:u=>{if(u.type!==this.type)return!1;i.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,c(u);const h=r.extensionManager.attributes,f=Pr(u,h),p=new Set(Object.keys(f)),m=this.options.HTMLAttributes;return d.forEach(g=>{p.has(g)||(g in m?i.setAttribute(g,m[g]):i.removeAttribute(g))}),Object.entries(f).forEach(([g,b])=>{b==null?g in m?i.setAttribute(g,m[g]):i.removeAttribute(g):i.setAttribute(g,b)}),d=p,!0}}}},addInputRules(){return[or({find:wk,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Ek=ye.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",se(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`\n`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=o=>{const s=Ks(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(o)},i=Ks(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,s)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:s}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});te.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(Ua.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Va.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Zh.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Ka.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(vk.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Ek.configure(this.options.taskList)),t}});var xk=lt.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",se(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),Sk=xk,Ck=lt.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",se(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),Tk=Ck,Mk=ye.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const r=t.getAttribute("colwidth"),i=r?r.split(",").map(o=>parseInt(o,10)):null;if(!i){const o=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),s=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(s&&s>-1&&o&&o[s]){const a=o[s].getAttribute("width");return a?[parseInt(a,10)]:null}}return i}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",se(this.options.HTMLAttributes,t),0]}}),Ak=ye.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",se(this.options.HTMLAttributes,t),0]}}),Nk=ye.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",se(this.options.HTMLAttributes,t),0]}});let Gs,Js;if(typeof WeakMap<"u"){let t=new WeakMap;Gs=e=>t.get(e),Js=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Gs=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Js=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var pe=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let o=r+1,s=i+1;for(let a=1;o<this.width&&this.map[e+a]==n;a++)o++;for(let a=1;s<this.height&&this.map[e+this.width*a]==n;a++)s++;return{left:r,top:i,right:o,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:o,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?o==0:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:o}=this.findCell(t),{left:s,right:a,top:l,bottom:c}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(o,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const o=r*this.width+i,s=this.map[o];n[s]||(n[s]=!0,!(i==t.left&&i&&this.map[o-1]==s||r==t.top&&r&&this.map[o-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const o=i+n.child(r).nodeSize;if(r==t){let s=e+t*this.width;const a=(t+1)*this.width;for(;s<a&&this.map[s]<i;)s++;return s==a?o-1:this.map[s]}i=o}}static get(t){return Gs(t)||Js(t,_k(t))}};function _k(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=Ok(t),n=t.childCount,r=[];let i=0,o=null;const s=[];for(let c=0,d=e*n;c<d;c++)r[c]=0;for(let c=0,d=0;c<n;c++){const u=t.child(c);d++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==u.childCount)break;const m=u.child(p),{colspan:g,rowspan:b,colwidth:k}=m.attrs;for(let w=0;w<b;w++){if(w+c>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:d,n:b-w});break}const x=i+w*e;for(let v=0;v<g;v++){r[x+v]==0?r[x+v]=d:(o||(o=[])).push({type:"collision",row:c,pos:d,n:g-v});const T=k&&k[v];if(T){const A=(x+v)%e*2,R=s[A];R==null||R!=T&&s[A+1]==1?(s[A]=T,s[A+1]=1):R==T&&s[A+1]++}}}i+=g,d+=m.nodeSize}const h=(c+1)*e;let f=0;for(;i<h;)r[i++]==0&&f++;f&&(o||(o=[])).push({type:"missing",row:c,n:f}),d++}(e===0||n===0)&&(o||(o=[])).push({type:"zero_sized"});const a=new pe(e,n,r,o);let l=!1;for(let c=0;!l&&c<s.length;c+=2)s[c]!=null&&s[c+1]<n&&(l=!0);return l&&Ik(a,s,t),a}function Ok(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let o=0;if(n)for(let s=0;s<r;s++){const a=t.child(s);for(let l=0;l<a.childCount;l++){const c=a.child(l);s+c.attrs.rowspan>r&&(o+=c.attrs.colspan)}}for(let s=0;s<i.childCount;s++){const a=i.child(s);o+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function Ik(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const o=t.map[i];if(r[o])continue;r[o]=!0;const s=n.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let a=null;const l=s.attrs;for(let c=0;c<l.colspan;c++){const d=e[(i+c)%t.width*2];d!=null&&(!l.colwidth||l.colwidth[c]!=d)&&((a||(a=Rk(l)))[c]=d)}a&&t.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a})}}function Rk(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Fe(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Jt=new ae("selectingCells");function Ln(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Lk(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function gt(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Po(t){const e=t.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;const n=Ln(e.$head)||Dk(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Dk(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Zs(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function $k(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function ja(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Xh(t,e,n){const r=t.node(-1),i=pe.get(r),o=t.start(-1),s=i.nextCell(t.pos-o,e,n);return s==null?null:t.node(0).resolve(o+s)}function Dn(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Qh(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function Pk(t,e,n){const r=Fe(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var de=class Rt extends U{constructor(e,n=e){const r=e.node(-1),i=pe.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,n.pos-o),a=e.node(0),l=i.cellsInRect(s).filter(d=>d!=n.pos-o);l.unshift(n.pos-o);const c=l.map(d=>{const u=r.nodeAt(d);if(!u)throw new RangeError(`No cell with offset ${d} found`);const h=o+d+1;return new du(a.resolve(h),a.resolve(h+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Zs(r)&&Zs(i)&&ja(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?Rt.rowSelection(r,i):o&&this.isColSelection()?Rt.colSelection(r,i):new Rt(r,i)}return P.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=pe.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let l=i.top;l<i.bottom;l++){const c=[];for(let d=l*n.width+i.left,u=i.left;u<i.right;u++,d++){const h=n.map[d];if(o[h])continue;o[h]=!0;const f=n.findCell(h);let p=e.nodeAt(h);if(!p)throw new RangeError(`No cell with offset ${h} found`);const m=i.left-f.left,g=f.right-i.right;if(m>0||g>0){let b=p.attrs;if(m>0&&(b=Dn(b,0,m)),g>0&&(b=Dn(b,b.colspan-g,g)),f.left<i.left){if(p=p.type.createAndFill(b),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else p=p.type.create(b,p.content)}if(f.top<i.top||f.bottom>i.bottom){const b={...p.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}c.push(p)}s.push(e.child(l).copy(S.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:s;return new N(S.from(a),1,1)}replace(e,n=N.empty){const r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){const{$from:a,$to:l}=i[s],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(l.pos),s?N.empty:n)}const o=U.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,n){this.replace(e,new N(S.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=pe.get(n),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)e(n.nodeAt(o[s]),i+o[s])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=pe.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(o+i.map[s.left])),a.bottom<i.height&&(n=l.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(o+i.map[a.left])),s.bottom<i.height&&(e=l.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new Rt(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=pe.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),o=n.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==n.width}eq(e){return e instanceof Rt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=pe.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(n=l.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(e=l.resolve(o+i.map[i.width*(s.top+1)-1]))),new Rt(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Rt(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Rt(e.resolve(n),e.resolve(r))}getBookmark(){return new Bk(this.$anchorCell.pos,this.$headCell.pos)}};de.prototype.visible=!1;U.jsonID("cell",de);var Bk=class ef{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ef(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&ja(n,r)?new de(n,r):U.near(r,1)}};function zk(t){if(!(t.selection instanceof de))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Te.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ie.create(t.doc,e)}function Hk({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let o=e.depth;o>=0&&!(e.before(o+1)>e.start(o));o--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function Fk({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const o=t.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let i=e.depth;i>0;i--){const o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return n!==r&&e.parentOffset===0}function Uk(t,e,n){const r=(e||t).selection,i=(e||t).doc;let o,s;if(r instanceof B&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=de.create(i,r.from);else if(s=="row"){const a=i.resolve(r.from+1);o=de.rowSelection(a,a)}else if(!n){const a=pe.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];o=de.create(i,l+1,c)}}else r instanceof P&&Hk(r)?o=P.create(i,r.from):r instanceof P&&Fk(r)&&(o=P.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}const Vk=new ae("fix-tables");function tf(t,e,n,r){const i=t.childCount,o=e.childCount;e:for(let s=0,a=0;s<o;s++){const l=e.child(s);for(let c=a,d=Math.min(i,s+3);c<d;c++)if(t.child(c)==l){a=c+1,n+=l.nodeSize;continue e}r(l,n),a<i&&t.child(a).sameMarkup(l)?tf(t.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function nf(t,e){let n;const r=(i,o)=>{i.type.spec.tableRole=="table"&&(n=Wk(t,i,o,n))};return e?e.doc!=t.doc&&tf(e.doc,t.doc,0,r):t.doc.descendants(r),n}function Wk(t,e,n,r){const i=pe.get(e);if(!i.problems)return r;r||(r=t.tr);const o=[];for(let l=0;l<i.height;l++)o.push(0);for(let l=0;l<i.problems.length;l++){const c=i.problems[l];if(c.type=="collision"){const d=e.nodeAt(c.pos);if(!d)continue;const u=d.attrs;for(let h=0;h<u.rowspan;h++)o[c.row+h]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Dn(u,u.colspan-c.n,c.n))}else if(c.type=="missing")o[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const d=r.mapping.map(n);r.delete(d,d+e.nodeSize)}}let s,a;for(let l=0;l<o.length;l++)o[l]&&(s==null&&(s=l),a=l);for(let l=0,c=n+1;l<i.height;l++){const d=e.child(l),u=c+d.nodeSize,h=o[l];if(h>0){let f="cell";d.firstChild&&(f=d.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<h;g++){const b=Fe(t.schema)[f].createAndFill();b&&p.push(b)}const m=(l==0||s==l-1)&&a==l?c+1:u-1;r.insert(r.mapping.map(m),p)}c=u}return r.setMeta(Vk,{fixTables:!0})}function Ct(t){const e=t.selection,n=Po(t),r=n.node(-1),i=n.start(-1),o=pe.get(r);return{...e instanceof de?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function rf(t,{map:e,tableStart:n,table:r},i){let o=i>0?-1:0;Pk(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s<e.height;s++){const a=s*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){const l=e.map[a],c=r.nodeAt(l);t.setNodeMarkup(t.mapping.map(n+l),null,Qh(c.attrs,i-e.colCount(l))),s+=c.attrs.rowspan-1}else{const l=o==null?Fe(r.type.schema).cell:r.nodeAt(e.map[a+o]).type,c=e.positionAt(s,i,r);t.insert(t.mapping.map(n+c),l.createAndFill())}}return t}function Kk(t,e){if(!gt(t))return!1;if(e){const n=Ct(t);e(rf(t.tr,n,n.left))}return!0}function jk(t,e){if(!gt(t))return!1;if(e){const n=Ct(t);e(rf(t.tr,n,n.right))}return!0}function qk(t,{map:e,table:n,tableStart:r},i){const o=t.mapping.maps.length;for(let s=0;s<e.height;){const a=s*e.width+i,l=e.map[a],c=n.nodeAt(l),d=c.attrs;if(i>0&&e.map[a-1]==l||i<e.width-1&&e.map[a+1]==l)t.setNodeMarkup(t.mapping.slice(o).map(r+l),null,Dn(d,i-e.colCount(l)));else{const u=t.mapping.slice(o).map(r+l);t.delete(u,u+c.nodeSize)}s+=d.rowspan}}function Gk(t,e){if(!gt(t))return!1;if(e){const n=Ct(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;qk(r,n,i),i!=n.left;i--){const o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw new RangeError("No table found");n.table=o,n.map=pe.get(o)}e(r)}return!0}function Jk(t,e,n){var r;const i=Fe(e.type.schema).header_cell;for(let o=0;o<t.width;o++)if(((r=e.nodeAt(t.map[o+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function of(t,{map:e,tableStart:n,table:r},i){let o=n;for(let c=0;c<i;c++)o+=r.child(c).nodeSize;const s=[];let a=i>0?-1:0;Jk(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let c=0,d=e.width*i;c<e.width;c++,d++)if(i>0&&i<e.height&&e.map[d]==e.map[d-e.width]){const u=e.map[d],h=r.nodeAt(u).attrs;t.setNodeMarkup(n+u,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{var l;const u=a==null?Fe(r.type.schema).cell:(l=r.nodeAt(e.map[d+a*e.width]))===null||l===void 0?void 0:l.type,h=u?.createAndFill();h&&s.push(h)}return t.insert(o,Fe(r.type.schema).row.create(null,s)),t}function Zk(t,e){if(!gt(t))return!1;if(e){const n=Ct(t);e(of(t.tr,n,n.top))}return!0}function Yk(t,e){if(!gt(t))return!1;if(e){const n=Ct(t);e(of(t.tr,n,n.bottom))}return!0}function Xk(t,{map:e,table:n,tableStart:r},i){let o=0;for(let c=0;c<i;c++)o+=n.child(c).nodeSize;const s=o+n.child(i).nodeSize,a=t.mapping.maps.length;t.delete(o+r,s+r);const l=new Set;for(let c=0,d=i*e.width;c<e.width;c++,d++){const u=e.map[d];if(!l.has(u)){if(l.add(u),i>0&&u==e.map[d-e.width]){const h=n.nodeAt(u).attrs;t.setNodeMarkup(t.mapping.slice(a).map(u+r),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<e.height&&u==e.map[d+e.width]){const h=n.nodeAt(u),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),m=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(a).map(r+m),p),c+=f.colspan-1}}}}function Qk(t,e){if(!gt(t))return!1;if(e){const n=Ct(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;Xk(r,n,i),i!=n.top;i--){const o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw new RangeError("No table found");n.table=o,n.map=pe.get(n.table)}e(r)}return!0}function Vc(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function ew({width:t,height:e,map:n},r){let i=r.top*t+r.left,o=i,s=(r.bottom-1)*t+r.left,a=i+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[o]==n[o-1]||r.right<t&&n[a]==n[a+1])return!0;o+=t,a+=t}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[s]==n[s+t])return!0;i++,s++}return!1}function Wc(t,e){const n=t.selection;if(!(n instanceof de)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Ct(t),{map:i}=r;if(ew(i,r))return!1;if(e){const o=t.tr,s={};let a=S.empty,l,c;for(let d=r.top;d<r.bottom;d++)for(let u=r.left;u<r.right;u++){const h=i.map[d*i.width+u],f=r.table.nodeAt(h);if(!(s[h]||!f))if(s[h]=!0,l==null)l=h,c=f;else{Vc(f)||(a=a.append(f.content));const p=o.mapping.map(h+r.tableStart);o.delete(p,p+f.nodeSize)}}if(l==null||c==null)return!0;if(o.setNodeMarkup(l+r.tableStart,null,{...Qh(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),a.size>0){const d=l+1+c.content.size,u=Vc(c)?l+1:d;o.replaceWith(u+r.tableStart,d+r.tableStart,a)}o.setSelection(new de(o.doc.resolve(l+r.tableStart))),e(o)}return!0}function Kc(t,e){const n=Fe(t.schema);return tw(({node:r})=>n[r.type.spec.tableRole])(t,e)}function tw(t){return(e,n)=>{const r=e.selection;let i,o;if(r instanceof de){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,o=r.$anchorCell.pos}else{var s;if(i=Lk(r.$from),!i)return!1;o=(s=Ln(r.$from))===null||s===void 0?void 0:s.pos}if(i==null||o==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let a=i.attrs;const l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const d=Ct(e),u=e.tr;for(let f=0;f<d.right-d.left;f++)l.push(c?{...a,colwidth:c&&c[f]?[c[f]]:null}:a);let h;for(let f=d.top;f<d.bottom;f++){let p=d.map.positionAt(f,d.left,d.table);f==d.top&&(p+=i.nodeSize);for(let m=d.left,g=0;m<d.right;m++,g++)m==d.left&&f==d.top||u.insert(h=u.mapping.map(p+d.tableStart,1),t({node:i,row:f,col:m}).createAndFill(l[g]))}u.setNodeMarkup(o,t({node:i,row:d.top,col:d.left}),l[0]),r instanceof de&&u.setSelection(new de(u.doc.resolve(r.$anchorCell.pos),h?u.doc.resolve(h):void 0)),n(u)}return!0}}function nw(t,e){return function(n,r){if(!gt(n))return!1;const i=Po(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const o=n.tr;n.selection instanceof de?n.selection.forEachCell((s,a)=>{s.attrs[t]!==e&&o.setNodeMarkup(a,null,{...s.attrs,[t]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(o)}return!0}}function rw(t){return function(e,n){if(!gt(e))return!1;if(n){const r=Fe(e.schema),i=Ct(e),o=e.tr,s=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=s.map(l=>i.table.nodeAt(l));for(let l=0;l<s.length;l++)a[l].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[l],r.cell,a[l].attrs);if(o.steps.length===0)for(let l=0;l<s.length;l++)o.setNodeMarkup(i.tableStart+s[l],r.header_cell,a[l].attrs);n(o)}return!0}}function jc(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const o=e.table.nodeAt(r[i]);if(o&&o.type!==n.header_cell)return!1}return!0}function Br(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?rw(t):function(n,r){if(!gt(n))return!1;if(r){const i=Fe(n.schema),o=Ct(n),s=n.tr,a=jc("row",o,i),l=jc("column",o,i),c=(t==="column"?a:t==="row"&&l)?1:0,d=t=="column"?{left:0,top:c,right:1,bottom:o.map.height}:t=="row"?{left:c,top:0,right:o.map.width,bottom:1}:o,u=t=="column"?l?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;o.map.cellsInRect(d).forEach(h=>{const f=h+o.tableStart,p=s.doc.nodeAt(f);p&&s.setNodeMarkup(f,u,p.attrs)}),r(s)}return!0}}Br("row",{useDeprecatedLogic:!0});Br("column",{useDeprecatedLogic:!0});const iw=Br("cell",{useDeprecatedLogic:!0});function ow(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const o=t.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const o=n.child(r);if(o.childCount)return i+1;i+=o.nodeSize}}return null}function qc(t){return function(e,n){if(!gt(e))return!1;const r=ow(Po(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(P.between(i,$k(i))).scrollIntoView())}return!0}}function sw(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function ui(t,e){const n=t.selection;if(!(n instanceof de))return!1;if(e){const r=t.tr,i=Fe(t.schema).cell.createAndFill().content;n.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new N(i,0,0))}),r.docChanged&&e(r)}return!0}function aw(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,a=[];if(o=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content;const d=l?0:Math.max(0,n-1),u=l<e.childCount-1?0:Math.max(0,r-1);(d||u)&&(c=Ys(Fe(s).row,new N(c,d,u)).content),a.push(c)}else if(o=="cell"||o=="header_cell")a.push(n||r?Ys(Fe(s).row,new N(e,n,r)).content:e);else return null;return lw(s,a)}function lw(t,e){const n=[];for(let i=0;i<e.length;i++){const o=e[i];for(let s=o.childCount-1;s>=0;s--){const{rowspan:a,colspan:l}=o.child(s).attrs;for(let c=i;c<i+a;c++)n[c]=(n[c]||0)+l}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(S.empty),n[i]<r){const o=Fe(t).cell.createAndFill(),s=[];for(let a=n[i];a<r;a++)s.push(o);e[i]=e[i].append(S.from(s))}return{height:e.length,width:r,rows:e}}function Ys(t,e){const n=t.createAndFill();return new ga(n).replace(0,n.content.size,e).doc}function cw({width:t,height:e,rows:n},r,i){if(t!=r){const o=[],s=[];for(let a=0;a<n.length;a++){const l=n[a],c=[];for(let d=o[a]||0,u=0;d<r;u++){let h=l.child(u%l.childCount);d+h.attrs.colspan>r&&(h=h.type.createChecked(Dn(h.attrs,h.attrs.colspan,d+h.attrs.colspan-r),h.content)),c.push(h),d+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)o[a+f]=(o[a+f]||0)+h.attrs.colspan}s.push(S.from(c))}n=s,t=r}if(e!=i){const o=[];for(let s=0,a=0;s<i;s++,a++){const l=[],c=n[a%e];for(let d=0;d<c.childCount;d++){let u=c.child(d);s+u.attrs.rowspan>i&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,i-u.attrs.rowspan)},u.content)),l.push(u)}o.push(S.from(l))}n=o,e=i}return{width:t,height:e,rows:n}}function dw(t,e,n,r,i,o,s){const a=t.doc.type.schema,l=Fe(a);let c,d;if(i>e.width)for(let u=0,h=0;u<e.height;u++){const f=n.child(u);h+=f.nodeSize;const p=[];let m;f.lastChild==null||f.lastChild.type==l.cell?m=c||(c=l.cell.createAndFill()):m=d||(d=l.header_cell.createAndFill());for(let g=e.width;g<i;g++)p.push(m);t.insert(t.mapping.slice(s).map(h-1+r),p)}if(o>e.height){const u=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const g=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==l.header_cell;u.push(g?d||(d=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const h=l.row.create(null,S.from(u)),f=[];for(let p=e.height;p<o;p++)f.push(h);t.insert(t.mapping.slice(s).map(r+n.nodeSize-2),f)}return!!(c||d)}function Gc(t,e,n,r,i,o,s,a){if(s==0||s==e.height)return!1;let l=!1;for(let c=i;c<o;c++){const d=s*e.width+c,u=e.map[d];if(e.map[d-e.width]==u){l=!0;const h=n.nodeAt(u),{top:f,left:p}=e.findCell(u);t.setNodeMarkup(t.mapping.slice(a).map(u+r),null,{...h.attrs,rowspan:s-f}),t.insert(t.mapping.slice(a).map(e.positionAt(s,p,n)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-s})),c+=h.attrs.colspan-1}}return l}function Jc(t,e,n,r,i,o,s,a){if(s==0||s==e.width)return!1;let l=!1;for(let c=i;c<o;c++){const d=c*e.width+s,u=e.map[d];if(e.map[d-1]==u){l=!0;const h=n.nodeAt(u),f=e.colCount(u),p=t.mapping.slice(a).map(u+r);t.setNodeMarkup(p,null,Dn(h.attrs,s-f,h.attrs.colspan-(s-f))),t.insert(p+h.nodeSize,h.type.createAndFill(Dn(h.attrs,0,s-f))),c+=h.attrs.rowspan-1}}return l}function Zc(t,e,n,r,i){let o=n?t.doc.nodeAt(n-1):t.doc;if(!o)throw new Error("No table found");let s=pe.get(o);const{top:a,left:l}=r,c=l+i.width,d=a+i.height,u=t.tr;let h=0;function f(){if(o=n?u.doc.nodeAt(n-1):u.doc,!o)throw new Error("No table found");s=pe.get(o),h=u.mapping.maps.length}dw(u,s,o,n,c,d,h)&&f(),Gc(u,s,o,n,l,c,a,h)&&f(),Gc(u,s,o,n,l,c,d,h)&&f(),Jc(u,s,o,n,a,d,l,h)&&f(),Jc(u,s,o,n,a,d,c,h)&&f();for(let p=a;p<d;p++){const m=s.positionAt(p,l,o),g=s.positionAt(p,c,o);u.replace(u.mapping.slice(h).map(m+n),u.mapping.slice(h).map(g+n),new N(i.rows[p-a],0,0))}f(),u.setSelection(new de(u.doc.resolve(n+s.positionAt(a,l,o)),u.doc.resolve(n+s.positionAt(d-1,c-1,o)))),e(u)}const uw=Ia({ArrowLeft:hi("horiz",-1),ArrowRight:hi("horiz",1),ArrowUp:hi("vert",-1),ArrowDown:hi("vert",1),"Shift-ArrowLeft":fi("horiz",-1),"Shift-ArrowRight":fi("horiz",1),"Shift-ArrowUp":fi("vert",-1),"Shift-ArrowDown":fi("vert",1),Backspace:ui,"Mod-Backspace":ui,Delete:ui,"Mod-Delete":ui});function Si(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function hi(t,e){return(n,r,i)=>{if(!i)return!1;const o=n.selection;if(o instanceof de)return Si(n,r,U.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;const s=sf(i,t,e);if(s==null)return!1;if(t=="horiz")return Si(n,r,U.near(n.doc.resolve(o.head+e),e));{const a=n.doc.resolve(s),l=Xh(a,t,e);let c;return l?c=U.near(l,1):e<0?c=U.near(n.doc.resolve(a.before(-1)),-1):c=U.near(n.doc.resolve(a.after(-1)),1),Si(n,r,c)}}}function fi(t,e){return(n,r,i)=>{if(!i)return!1;const o=n.selection;let s;if(o instanceof de)s=o;else{const l=sf(i,t,e);if(l==null)return!1;s=new de(n.doc.resolve(l))}const a=Xh(s.$headCell,t,e);return a?Si(n,r,new de(s.$anchorCell,a)):!1}}function hw(t,e){const n=t.state.doc,r=Ln(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new de(r))),!0):!1}function fw(t,e,n){if(!gt(t.state))return!1;let r=aw(n);const i=t.state.selection;if(i instanceof de){r||(r={width:1,height:1,rows:[S.from(Ys(Fe(t.state.schema).cell,n))]});const o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),a=pe.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=cw(r,a.right-a.left,a.bottom-a.top),Zc(t.state,t.dispatch,s,a,r),!0}else if(r){const o=Po(t.state),s=o.start(-1);return Zc(t.state,t.dispatch,s,pe.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function pw(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Yc(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof de)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Ln(t.state.selection.$anchor))!=null&&((n=ms(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(l,c){let d=ms(t,c);const u=Jt.getState(t.state)==null;if(!d||!ja(l,d))if(u)d=l;else return;const h=new de(l,d);if(u||!t.state.selection.eq(h)){const f=t.state.tr.setSelection(h);u&&f.setMeta(Jt,l.pos),t.dispatch(f)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),Jt.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Jt,-1))}function a(l){const c=l,d=Jt.getState(t.state);let u;if(d!=null)u=t.state.doc.resolve(d);else if(Yc(t,c.target)!=r&&(u=ms(t,e),!u))return s();u&&o(u,c)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a)}function sf(t,e,n){if(!(t.state.selection instanceof P))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const s=r.before(i),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?s:null}}return null}function Yc(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ms(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&Ln(t.state.doc.resolve(r))||Ln(t.state.doc.resolve(i))}var mw=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,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",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Xs(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Xs(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Xs(t,e,n,r,i,o){let s=0,a=!0,l=e.firstChild;const c=t.firstChild;if(c){for(let u=0,h=0;u<c.childCount;u++){const{colspan:f,colwidth:p}=c.child(u).attrs;for(let m=0;m<f;m++,h++){const g=i==h?o:p&&p[m],b=g?g+"px":"";if(s+=g||r,g||(a=!1),l)l.style.width!=b&&(l.style.width=b),l=l.nextSibling;else{const k=document.createElement("col");k.style.width=b,e.appendChild(k)}}}for(;l;){var d;const u=l.nextSibling;(d=l.parentNode)===null||d===void 0||d.removeChild(l),l=u}a?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}const et=new ae("tableColumnResizing");function gw({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=mw,lastColumnResizable:i=!0}={}){const o=new Q({key:et,state:{init(s,a){var l;const c=(l=o.spec)===null||l===void 0||(l=l.props)===null||l===void 0?void 0:l.nodeViews,d=Fe(a.schema).table.name;return r&&c&&(c[d]=(u,h)=>new r(u,n,h)),new bw(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{const a=et.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{yw(s,a,t,i)},mouseleave:s=>{kw(s)},mousedown:(s,a)=>{ww(s,a,e,n)}},decorations:s=>{const a=et.getState(s);if(a&&a.activeHandle>-1)return Cw(s,a.activeHandle)},nodeViews:{}}});return o}var bw=class Ci{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(et);if(r&&r.setHandle!=null)return new Ci(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Ci(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Zs(e.doc.resolve(i))||(i=-1),new Ci(i,n.dragging)}return n}};function yw(t,e,n,r){if(!t.editable)return;const i=et.getState(t.state);if(i&&!i.dragging){const o=Ew(e.target);let s=-1;if(o){const{left:a,right:l}=o.getBoundingClientRect();e.clientX-a<=n?s=Xc(t,e,"left",n):l-e.clientX<=n&&(s=Xc(t,e,"right",n))}if(s!=i.activeHandle){if(!r&&s!==-1){const a=t.state.doc.resolve(s),l=a.node(-1),c=pe.get(l),d=a.start(-1);if(c.colCount(a.pos-d)+a.nodeAfter.attrs.colspan-1==c.width-1)return}af(t,s)}}}function kw(t){if(!t.editable)return;const e=et.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&af(t,-1)}function ww(t,e,n,r){var i;if(!t.editable)return!1;const o=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,s=et.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const a=t.state.doc.nodeAt(s.activeHandle),l=vw(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(et,{setDragging:{startX:e.clientX,startWidth:l}}));function c(u){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",d);const h=et.getState(t.state);h?.dragging&&(xw(t,h.activeHandle,Qc(h.dragging,u,n)),t.dispatch(t.state.tr.setMeta(et,{setDragging:null})))}function d(u){if(!u.which)return c(u);const h=et.getState(t.state);if(h&&h.dragging){const f=Qc(h.dragging,u,n);ed(t,h.activeHandle,f,r)}}return ed(t,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",d),e.preventDefault(),!0}function vw(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=t.domAtPos(e);let s=o.node.childNodes[o.offset].offsetWidth,a=n;if(r)for(let l=0;l<n;l++)r[l]&&(s-=r[l],a--);return s/a}function Ew(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Xc(t,e,n,r){const i=n=="right"?-r:r,o=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!o)return-1;const{pos:s}=o,a=Ln(t.state.doc.resolve(s));if(!a)return-1;if(n=="right")return a.pos;const l=pe.get(a.node(-1)),c=a.start(-1),d=l.map.indexOf(a.pos-c);return d%l.width==0?-1:c+l.map[d-1]}function Qc(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function af(t,e){t.dispatch(t.state.tr.setMeta(et,{setHandle:e}))}function xw(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),o=pe.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let c=0;c<o.height;c++){const d=c*o.width+a;if(c&&o.map[d]==o.map[d-o.width])continue;const u=o.map[d],h=i.nodeAt(u).attrs,f=h.colspan==1?0:a-o.colCount(u);if(h.colwidth&&h.colwidth[f]==n)continue;const p=h.colwidth?h.colwidth.slice():Sw(h.colspan);p[f]=n,l.setNodeMarkup(s+u,null,{...h,colwidth:p})}l.docChanged&&t.dispatch(l)}function ed(t,e,n,r){const i=t.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),a=pe.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;let l=t.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&Xs(o,l.firstChild,l,r,a,n)}function Sw(t){return Array(t).fill(0)}function Cw(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return ie.empty;const o=pe.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<o.height;c++){const d=a+c*o.width;if((a==o.width-1||o.map[d]!=o.map[d+1])&&(c==0||o.map[d]!=o.map[d-o.width])){var l;const u=o.map[d],h=s+u+i.nodeAt(u).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((l=et.getState(t))===null||l===void 0)&&l.dragging&&n.push(Te.node(s+u,s+u+i.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),n.push(Te.widget(h,f))}}return ie.create(t.doc,n)}function Tw({allowTableNodeSelection:t=!1}={}){return new Q({key:Jt,state:{init(){return null},apply(e,n){const r=e.getMeta(Jt);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:o}=e.mapping.mapResult(n);return i?null:o}},props:{decorations:zk,handleDOMEvents:{mousedown:pw},createSelectionBetween(e){return Jt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:hw,handleKeyDown:uw,handlePaste:fw},appendTransaction(e,n,r){return Uk(r,nf(r,n),t)}})}function Qs(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function td(t,e,n,r,i,o){var s;let a=0,l=!0,c=e.firstChild;const d=t.firstChild;if(d!==null)for(let h=0,f=0;h<d.childCount;h+=1){const{colspan:p,colwidth:m}=d.child(h).attrs;for(let g=0;g<p;g+=1,f+=1){const b=i===f?o:m&&m[g],k=b?`${b}px`:"";if(a+=b||r,b||(l=!1),c){if(c.style.width!==k){const[w,x]=Qs(r,b);c.style.setProperty(w,x)}c=c.nextSibling}else{const w=document.createElement("col"),[x,v]=Qs(r,b);w.style.setProperty(x,v),e.appendChild(w)}}}for(;c;){const h=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=h}const u=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);l&&!u?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}var Mw=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),td(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,td(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function Aw(t,e,n,r){let i=0,o=!0;const s=[],a=t.firstChild;if(!a)return{};for(let u=0,h=0;u<a.childCount;u+=1){const{colspan:f,colwidth:p}=a.child(u).attrs;for(let m=0;m<f;m+=1,h+=1){const g=n===h?r:p&&p[m];i+=g||e,g||(o=!1);const[b,k]=Qs(e,g);s.push(["col",{style:`${b}: ${k}`}])}}const l=o?`${i}px`:"",c=o?"":`${i}px`;return{colgroup:["colgroup",{},...s],tableWidth:l,tableMinWidth:c}}function nd(t,e){return t.createAndFill()}function Nw(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function _w(t,e,n,r,i){const o=Nw(t),s=[],a=[];for(let c=0;c<n;c+=1){const d=nd(o.cell);if(d&&a.push(d),r){const u=nd(o.header_cell);u&&s.push(u)}}const l=[];for(let c=0;c<e;c+=1)l.push(o.row.createChecked(null,r&&c===0?s:a));return o.table.createChecked(null,l)}function Ow(t){return t instanceof de}var pi=({editor:t})=>{const{selection:e}=t.state;if(!Ow(e))return!1;let n=0;const r=ph(e.ranges[0].$from,o=>o.type.name==="table");return r?.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},Iw="";function Rw(t){return(t||"").replace(/\s+/g," ").trim()}function Lw(t,e,n={}){var r;const i=(r=n.cellLineSeparator)!=null?r:Iw;if(!t||!t.content||t.content.length===0)return"";const o=[];t.content.forEach(p=>{const m=[];p.content&&p.content.forEach(g=>{let b="";g.content&&Array.isArray(g.content)&&g.content.length>1?b=g.content.map(v=>e.renderChildren(v)).join(i):b=g.content?e.renderChildren(g.content):"";const k=Rw(b),w=g.type==="tableHeader";m.push({text:k,isHeader:w})}),o.push(m)});const s=o.reduce((p,m)=>Math.max(p,m.length),0);if(s===0)return"";const a=new Array(s).fill(0);o.forEach(p=>{var m;for(let g=0;g<s;g+=1){const k=(((m=p[g])==null?void 0:m.text)||"").length;k>a[g]&&(a[g]=k),a[g]<3&&(a[g]=3)}});const l=(p,m)=>p+" ".repeat(Math.max(0,m-p.length)),c=o[0],d=c.some(p=>p.isHeader);let u=`\n`;const h=new Array(s).fill(0).map((p,m)=>d&&c[m]&&c[m].text||"");return u+=`| ${h.map((p,m)=>l(p,a[m])).join(" | ")} |\n`,u+=`| ${a.map(p=>"-".repeat(Math.max(3,p))).join(" | ")} |\n`,(d?o.slice(1):o).forEach(p=>{u+=`| ${new Array(s).fill(0).map((m,g)=>l(p[g]&&p[g].text||"",a[g])).join(" | ")} |\n`}),u}var Dw=Lw,$w=ye.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Mw,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=Aw(t,this.options.cellMinWidth),o=e.style;function s(){return o||(r?`width: ${r}`:`min-width: ${i}`)}const a=["table",se(this.options.HTMLAttributes,e,{style:s()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},a]:a},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(i=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const i=[];r.forEach(o=>{i.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>Dw(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:o})=>{const s=_w(o.schema,t,e,n);if(i){const a=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(P.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Kk(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>jk(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Gk(t,e),addRowBefore:()=>({state:t,dispatch:e})=>Zk(t,e),addRowAfter:()=>({state:t,dispatch:e})=>Yk(t,e),deleteRow:()=>({state:t,dispatch:e})=>Qk(t,e),deleteTable:()=>({state:t,dispatch:e})=>sw(t,e),mergeCells:()=>({state:t,dispatch:e})=>Wc(t,e),splitCell:()=>({state:t,dispatch:e})=>Kc(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Br("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Br("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>iw(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Wc(t,e)?!0:Kc(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>nw(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>qc(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>qc(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&nf(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=de.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:pi,"Mod-Backspace":pi,Delete:pi,"Mod-Delete":pi}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[gw({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Tw({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:X($(t,"tableRole",e))}}}),Pw=te.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).some(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Bw=Pw,zw=20,lf=(t,e=0)=>{const n=[];return!t.children.length||e>zw||Array.from(t.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...lf(r,e+1))}),n},Hw=t=>{if(!t.children.length)return;const e=lf(t);e&&e.forEach(n=>{var r,i;const o=n.getAttribute("style"),s=(i=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:i.getAttribute("style");n.setAttribute("style",`${s};${o}`)})},cf=lt.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Hw(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",se(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(o=>!!o))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),Fw=te.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const o=r[i].split(":");if(o.length>=2){const s=o[0].trim().toLowerCase(),a=o.slice(1).join(":").trim();if(s==="background-color")return a.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),Uw=te.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const o=r[i].split(":");if(o.length>=2){const s=o[0].trim().toLowerCase(),a=o.slice(1).join(":").trim();if(s==="color")return a.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Vw=te.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Ww=te.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Kw=te.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});te.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(Fw.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(Uw.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(Vw.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(Ww.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(Kw.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(cf.configure(this.options.textStyle)),t}});var Vi=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},jw=/^\s*>\s$/,qw=ye.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Vi("blockquote",{...se(this.options.HTMLAttributes,t),children:Vi("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(i=>{const a=e.renderChildren([i]).split(`\n`).map(l=>l.trim()===""?n:`${n} ${l}`);r.push(a.join(`\n`))}),r.join(`\n${n}\n`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[or({find:jw,type:this.type})]}}),Gw=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Jw=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Zw=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Yw=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Xw=lt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Vi("strong",{...se(this.options.HTMLAttributes,t),children:Vi("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ir({find:Gw,type:this.type}),ir({find:Zw,type:this.type})]},addPasteRules(){return[Rn({find:Jw,type:this.type}),Rn({find:Yw,type:this.type})]}}),Qw=ye.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",se(this.options.HTMLAttributes,t)]},renderText(){return`\n`},renderMarkdown:()=>` \n`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,l=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&l&&s){const u=l.filter(h=>a.includes(h.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),ev=ye.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,se(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Ws({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),tv=ye.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",se(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!U0(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return Eh(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:o,tr:s,dispatch:a})=>{if(a){const{$to:l}=s.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?s.setSelection(P.create(s.doc,l.pos+1)):l.nodeAfter.isBlock?s.setSelection(B.create(s.doc,l.pos)):s.setSelection(P.create(s.doc,l.pos));else{const d=o.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,u=d?.create();u&&(s.insert(c,u),s.setSelection(P.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[F0({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),nv=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,rv=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,iv=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,ov=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,sv=lt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",se(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ir({find:nv,type:this.type}),ir({find:iv,type:this.type})]},addPasteRules(){return[Rn({find:rv,type:this.type}),Rn({find:ov,type:this.type})]}});const av="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",lv="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",ea="numeric",ta="ascii",na="alpha",vr="asciinumeric",gr="alphanumeric",ra="domain",df="emoji",cv="scheme",dv="slashscheme",gs="whitespace";function uv(t,e){return t in e||(e[t]=[]),e[t]}function En(t,e,n){e[ea]&&(e[vr]=!0,e[gr]=!0),e[ta]&&(e[vr]=!0,e[na]=!0),e[vr]&&(e[gr]=!0),e[na]&&(e[gr]=!0),e[gr]&&(e[ra]=!0),e[df]&&(e[ra]=!0);for(const r in e){const i=uv(r,n);i.indexOf(t)<0&&i.push(t)}}function hv(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Ge(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Ge.groups={};Ge.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(t))return o}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||Ge.groups;let i;return e&&e.j?i=e:(i=new Ge(e),n&&r&&En(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const o=t.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(t[s]);return i.tt(t[o-1],e,n,r)},tt(t,e,n,r){r=r||Ge.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const o=e;let s,a=i.go(t);if(a?(s=new Ge,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Ge,o){if(r)if(s.t&&typeof s.t=="string"){const l=Object.assign(hv(s.t,r),n);En(o,l,r)}else n&&En(o,n,r);s.t=o}return i.j[t]=s,s}};const j=(t,e,n,r,i)=>t.ta(e,n,r,i),he=(t,e,n,r,i)=>t.tr(e,n,r,i),rd=(t,e,n,r,i)=>t.ts(e,n,r,i),C=(t,e,n,r,i)=>t.tt(e,n,r,i),Lt="WORD",ia="UWORD",uf="ASCIINUMERICAL",hf="ALPHANUMERICAL",zr="LOCALHOST",oa="TLD",sa="UTLD",Ti="SCHEME",jn="SLASH_SCHEME",qa="NUM",aa="WS",Ga="NL",Er="OPENBRACE",xr="CLOSEBRACE",Wi="OPENBRACKET",Ki="CLOSEBRACKET",ji="OPENPAREN",qi="CLOSEPAREN",Gi="OPENANGLEBRACKET",Ji="CLOSEANGLEBRACKET",Zi="FULLWIDTHLEFTPAREN",Yi="FULLWIDTHRIGHTPAREN",Xi="LEFTCORNERBRACKET",Qi="RIGHTCORNERBRACKET",eo="LEFTWHITECORNERBRACKET",to="RIGHTWHITECORNERBRACKET",no="FULLWIDTHLESSTHAN",ro="FULLWIDTHGREATERTHAN",io="AMPERSAND",oo="APOSTROPHE",so="ASTERISK",jt="AT",ao="BACKSLASH",lo="BACKTICK",co="CARET",Zt="COLON",Ja="COMMA",uo="DOLLAR",kt="DOT",ho="EQUALS",Za="EXCLAMATION",rt="HYPHEN",Sr="PERCENT",fo="PIPE",po="PLUS",mo="POUND",Cr="QUERY",Ya="QUOTE",ff="FULLWIDTHMIDDLEDOT",Xa="SEMI",wt="SLASH",Tr="TILDE",go="UNDERSCORE",pf="EMOJI",bo="SYM";var mf=Object.freeze({__proto__:null,ALPHANUMERICAL:hf,AMPERSAND:io,APOSTROPHE:oo,ASCIINUMERICAL:uf,ASTERISK:so,AT:jt,BACKSLASH:ao,BACKTICK:lo,CARET:co,CLOSEANGLEBRACKET:Ji,CLOSEBRACE:xr,CLOSEBRACKET:Ki,CLOSEPAREN:qi,COLON:Zt,COMMA:Ja,DOLLAR:uo,DOT:kt,EMOJI:pf,EQUALS:ho,EXCLAMATION:Za,FULLWIDTHGREATERTHAN:ro,FULLWIDTHLEFTPAREN:Zi,FULLWIDTHLESSTHAN:no,FULLWIDTHMIDDLEDOT:ff,FULLWIDTHRIGHTPAREN:Yi,HYPHEN:rt,LEFTCORNERBRACKET:Xi,LEFTWHITECORNERBRACKET:eo,LOCALHOST:zr,NL:Ga,NUM:qa,OPENANGLEBRACKET:Gi,OPENBRACE:Er,OPENBRACKET:Wi,OPENPAREN:ji,PERCENT:Sr,PIPE:fo,PLUS:po,POUND:mo,QUERY:Cr,QUOTE:Ya,RIGHTCORNERBRACKET:Qi,RIGHTWHITECORNERBRACKET:to,SCHEME:Ti,SEMI:Xa,SLASH:wt,SLASH_SCHEME:jn,SYM:bo,TILDE:Tr,TLD:oa,UNDERSCORE:go,UTLD:sa,UWORD:ia,WORD:Lt,WS:aa});const Ot=/[a-z]/,ur=/\p{L}/u,bs=/\p{Emoji}/u,It=/\d/,ys=/\s/,id="\r",ks=`\n`,fv="️",pv="",ws="";let mi=null,gi=null;function mv(t=[]){const e={};Ge.groups=e;const n=new Ge;mi==null&&(mi=od(av)),gi==null&&(gi=od(lv)),C(n,"'",oo),C(n,"{",Er),C(n,"}",xr),C(n,"[",Wi),C(n,"]",Ki),C(n,"(",ji),C(n,")",qi),C(n,"<",Gi),C(n,">",Ji),C(n,"(",Zi),C(n,")",Yi),C(n,"「",Xi),C(n,"」",Qi),C(n,"『",eo),C(n,"』",to),C(n,"<",no),C(n,">",ro),C(n,"&",io),C(n,"*",so),C(n,"@",jt),C(n,"`",lo),C(n,"^",co),C(n,":",Zt),C(n,",",Ja),C(n,"$",uo),C(n,".",kt),C(n,"=",ho),C(n,"!",Za),C(n,"-",rt),C(n,"%",Sr),C(n,"|",fo),C(n,"+",po),C(n,"#",mo),C(n,"?",Cr),C(n,'"',Ya),C(n,"/",wt),C(n,";",Xa),C(n,"~",Tr),C(n,"_",go),C(n,"\\",ao),C(n,"・",ff);const r=he(n,It,qa,{[ea]:!0});he(r,It,r);const i=he(r,Ot,uf,{[vr]:!0}),o=he(r,ur,hf,{[gr]:!0}),s=he(n,Ot,Lt,{[ta]:!0});he(s,It,i),he(s,Ot,s),he(i,It,i),he(i,Ot,i);const a=he(n,ur,ia,{[na]:!0});he(a,Ot),he(a,It,o),he(a,ur,a),he(o,It,o),he(o,Ot),he(o,ur,o);const l=C(n,ks,Ga,{[gs]:!0}),c=C(n,id,aa,{[gs]:!0}),d=he(n,ys,aa,{[gs]:!0});C(n,ws,d),C(c,ks,l),C(c,ws,d),he(c,ys,d),C(d,id),C(d,ks),he(d,ys,d),C(d,ws,d);const u=he(n,bs,pf,{[df]:!0});C(u,"#"),he(u,bs,u),C(u,fv,u);const h=C(u,pv);C(h,"#"),he(h,bs,u);const f=[[Ot,s],[It,i]],p=[[Ot,null],[ur,a],[It,o]];for(let m=0;m<mi.length;m++)Vt(n,mi[m],oa,Lt,f);for(let m=0;m<gi.length;m++)Vt(n,gi[m],sa,ia,p);En(oa,{tld:!0,ascii:!0},e),En(sa,{utld:!0,alpha:!0},e),Vt(n,"file",Ti,Lt,f),Vt(n,"mailto",Ti,Lt,f),Vt(n,"http",jn,Lt,f),Vt(n,"https",jn,Lt,f),Vt(n,"ftp",jn,Lt,f),Vt(n,"ftps",jn,Lt,f),En(Ti,{scheme:!0,ascii:!0},e),En(jn,{slashscheme:!0,ascii:!0},e),t=t.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<t.length;m++){const g=t[m][0],k=t[m][1]?{[cv]:!0}:{[dv]:!0};g.indexOf("-")>=0?k[ra]=!0:Ot.test(g)?It.test(g)?k[vr]=!0:k[ta]=!0:k[ea]=!0,rd(n,g,g,k)}return rd(n,"localhost",zr,{ascii:!0}),n.jd=new Ge(bo),{start:n,tokens:Object.assign({groups:e},mf)}}function gf(t,e){const n=gv(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[];let o=0,s=0;for(;s<r;){let a=t,l=null,c=0,d=null,u=-1,h=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(u=0,h=0,d=a):u>=0&&(u+=n[s].length,h++),c+=n[s].length,o+=n[s].length,s++;o-=u,s-=h,c-=u,i.push({t:d.t,v:e.slice(o-c,o),s:o-c,e:o})}return i}function gv(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),o,s=i<55296||i>56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Vt(t,e,n,r,i){let o;const s=e.length;for(let a=0;a<s-1;a++){const l=e[a];t.j[l]?o=t.j[l]:(o=new Ge(r),o.jr=i.slice(),t.j[l]=o),t=o}return o=new Ge(n),o.jr=i.slice(),t.j[e[s-1]]=o,o}function od(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let o=0;for(;i.indexOf(t[r+o])>=0;)o++;if(o>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+o),10);s>0;s--)n.pop();r+=o}else n.push(t[r]),r++}return e}const Hr={defaultProtocol:"http",events:null,format:sd,formatHref:sd,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Qa(t,e=null){let n=Object.assign({},Hr);t&&(n=Object.assign(n,t instanceof Qa?t.o:t));const r=n.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}Qa.prototype={o:Hr,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:Hr[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function sd(t){return t}function bf(t,e){this.t="token",this.v=t,this.tk=e}bf.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Hr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),o=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),d=t.getObj("attributes",n,e),u=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),d&&Object.assign(s,d),{tagName:i,attributes:s,content:o,eventListeners:u}}};function Bo(t,e){class n extends bf{constructor(i,o){super(i,o),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const ad=Bo("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ld=Bo("text"),bv=Bo("nl"),bi=Bo("url",{isLink:!0,toHref(t=Hr.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==zr&&t[1].t===Zt}}),nt=t=>new Ge(t);function yv({groups:t}){const e=t.domain.concat([io,so,jt,ao,lo,co,uo,ho,rt,qa,Sr,fo,po,mo,wt,bo,Tr,go]),n=[oo,Zt,Ja,kt,Za,Sr,Cr,Ya,Xa,Gi,Ji,Er,xr,Ki,Wi,ji,qi,Zi,Yi,Xi,Qi,eo,to,no,ro],r=[io,oo,so,ao,lo,co,uo,ho,rt,Er,xr,Sr,fo,po,mo,Cr,wt,bo,Tr,go],i=nt(),o=C(i,Tr);j(o,r,o),j(o,t.domain,o);const s=nt(),a=nt(),l=nt();j(i,t.domain,s),j(i,t.scheme,a),j(i,t.slashscheme,l),j(s,r,o),j(s,t.domain,s);const c=C(s,jt);C(o,jt,c),C(a,jt,c),C(l,jt,c);const d=C(o,kt);j(d,r,o),j(d,t.domain,o);const u=nt();j(c,t.domain,u),j(u,t.domain,u);const h=C(u,kt);j(h,t.domain,u);const f=nt(ad);j(h,t.tld,f),j(h,t.utld,f),C(c,zr,f);const p=C(u,rt);C(p,rt,p),j(p,t.domain,u),j(f,t.domain,u),C(f,kt,h),C(f,rt,p);const m=C(f,Zt);j(m,t.numeric,ad);const g=C(s,rt),b=C(s,kt);C(g,rt,g),j(g,t.domain,s),j(b,r,o),j(b,t.domain,s);const k=nt(bi);j(b,t.tld,k),j(b,t.utld,k),j(k,t.domain,s),j(k,r,o),C(k,kt,b),C(k,rt,g),C(k,jt,c);const w=C(k,Zt),x=nt(bi);j(w,t.numeric,x);const v=nt(bi),T=nt();j(v,e,v),j(v,n,T),j(T,e,v),j(T,n,T),C(k,wt,v),C(x,wt,v);const A=C(a,Zt),R=C(l,Zt),F=C(R,wt),ne=C(F,wt);j(a,t.domain,s),C(a,kt,b),C(a,rt,g),j(l,t.domain,s),C(l,kt,b),C(l,rt,g),j(A,t.domain,v),C(A,wt,v),C(A,Cr,v),j(ne,t.domain,v),j(ne,e,v),C(ne,wt,v);const re=[[Er,xr],[Wi,Ki],[ji,qi],[Gi,Ji],[Zi,Yi],[Xi,Qi],[eo,to],[no,ro]];for(let ke=0;ke<re.length;ke++){const[Ae,Z]=re[ke],J=C(v,Ae);C(T,Ae,J),C(J,Z,v);const we=nt(bi);j(J,e,we);const ct=nt();j(J,n),j(we,e,we),j(we,n,ct),j(ct,e,we),j(ct,n,ct),C(we,Z,v),C(ct,Z,v)}return C(i,zr,k),C(i,Ga,bv),{start:i,tokens:mf}}function kv(t,e,n){let r=n.length,i=0,o=[],s=[];for(;i<r;){let a=t,l=null,c=null,d=0,u=null,h=-1;for(;i<r&&!(l=a.go(n[i].t));)s.push(n[i++]);for(;i<r&&(c=l||a.go(n[i].t));)l=null,a=c,a.accepts()?(h=0,u=a):h>=0&&h++,i++,d++;if(h<0)i-=d,i<r&&(s.push(n[i]),i++);else{s.length>0&&(o.push(vs(ld,e,s)),s=[]),i-=h,d-=h;const f=u.t,p=n.slice(i-d,i);o.push(vs(f,e,p))}}return s.length>0&&o.push(vs(ld,e,s)),o}function vs(t,e,n){const r=n[0].s,i=n[n.length-1].e,o=e.slice(r,i);return new t(o,n)}const wv=typeof console<"u"&&console&&console.warn||(()=>{}),vv="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ue={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Ev(){return Ge.groups={},ue.scanner=null,ue.parser=null,ue.tokenQueue=[],ue.pluginQueue=[],ue.customSchemes=[],ue.initialized=!1,ue}function cd(t,e=!1){if(ue.initialized&&wv(`linkifyjs: already initialized - will not register custom scheme "${t}" ${vv}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat`);ue.customSchemes.push([t,e])}function xv(){ue.scanner=mv(ue.customSchemes);for(let t=0;t<ue.tokenQueue.length;t++)ue.tokenQueue[t][1]({scanner:ue.scanner});ue.parser=yv(ue.scanner.tokens);for(let t=0;t<ue.pluginQueue.length;t++)ue.pluginQueue[t][1]({scanner:ue.scanner,parser:ue.parser});return ue.initialized=!0,ue}function el(t){return ue.initialized||xv(),kv(ue.parser.start,t,gf(ue.scanner.start,t))}el.scan=gf;function yf(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Qa(n),i=el(t),o=[];for(let s=0;s<i.length;s++){const a=i[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&o.push(a.toFormattedObject(r))}return o}var tl="[\0- -\u2029 ]",Sv=new RegExp(tl),Cv=new RegExp(`${tl}$`),Tv=new RegExp(tl,"g");function Mv(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Av(t){return new Q({key:new ae("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),o=e.some(c=>c.getMeta("preventAutolink"));if(!i||o)return;const{tr:s}=r,a=fh(n.doc,[...e]);if(vh(a).forEach(({newRange:c})=>{const d=Vy(r.doc,c,f=>f.isTextblock);let u,h;if(d.length>1)u=d[0],h=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){const f=r.doc.textBetween(c.from,c.to," "," ");if(!Cv.test(f))return;u=d[0],h=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&h){const f=h.split(Sv).filter(Boolean);if(f.length<=0)return!1;const p=f[f.length-1],m=u.pos+h.lastIndexOf(p);if(!p)return!1;const g=el(p).map(b=>b.toObject(t.defaultProtocol));if(!Mv(g))return!1;g.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{Pa(b.from,b.to,r.doc).some(k=>k.mark.type===t.type)||s.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function Nv(t){return new Q({key:new ae("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const l=r.target;if(!l)return!1;const c=t.editor.view.dom;s=l.closest("a"),s&&!c.contains(s)&&(s=null)}if(!s)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const l=wh(e.state,t.type.name),c=(i=s.href)!=null?i:l.href,d=(o=s.target)!=null?o:l.target;c&&(window.open(c,d),a=!0)}return a}}})}function _v(t){return new Q({key:new ae("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:o}=e,{selection:s}=o,{empty:a}=s;if(a)return!1;let l="";r.content.forEach(d=>{l+=d.textContent});const c=yf(l,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!c||i!==void 0&&!i(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function gn(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(Tv,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var kf=lt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){cd(t);return}cd(t.scheme,t.optionalSlashes)})},onDestroy(){Ev()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!gn(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!gn(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!gn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",se(this.options.HTMLAttributes,t),0]:["a",se(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const r=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${r})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!gn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!gn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Rn({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=yf(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!gn(s,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(o=>{this.options.shouldAutoLink(o.value)&&e.push({text:o.value,data:{href:o.href},index:o.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Av({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!gn(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Nv({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(_v({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Ov=kf,Iv=ye.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",se(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Rv=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Lv=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Dv=lt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",se(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ir({find:Rv,type:this.type})]},addPasteRules(){return[Rn({find:Lv,type:this.type})]}}),$v=ye.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Pv=lt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",se(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const o=i[2].trim();return{type:"underline",raw:i[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Bv(t={}){return new Q({view(e){return new zv(e,t)}})}class zv{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):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),n=!e.parent.inlineContent,r,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,a=o.height/i.offsetHeight;if(n){let u=e.nodeBefore,h=e.nodeAfter;if(u||h){let f=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(f){let p=f.getBoundingClientRect(),m=u?p.bottom:p.top;u&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;r={left:u.left-h,right:u.left+h,top:u.top,bottom:u.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=l.getBoundingClientRect(),h=u.width/l.offsetWidth,f=u.height/l.offsetHeight;c=u.left-l.scrollLeft*h,d=u.top-l.scrollTop*f}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=ou(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class fe extends U{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return fe.valid(r)?new fe(r):U.near(r)}content(){return N.empty}eq(e){return e instanceof fe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new fe(e.resolve(n.pos))}getBookmark(){return new nl(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Hv(e)||!Fv(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&fe.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){o=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let l=e.doc.resolve(i);if(fe.valid(l))return l}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!B.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let a=e.doc.resolve(i);if(fe.valid(a))return a}return null}}}fe.prototype.visible=!1;fe.findFrom=fe.findGapCursorFrom;U.jsonID("gapcursor",fe);class nl{constructor(e){this.pos=e}map(e){return new nl(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return fe.valid(n)?new fe(n):U.near(n)}}function wf(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Hv(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||wf(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Fv(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||wf(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Uv(){return new Q({props:{decorations:jv,createSelectionBetween(t,e,n){return e.pos==n.pos&&fe.valid(n)?new fe(n):null},handleClick:Wv,handleKeyDown:Vv,handleDOMEvents:{beforeinput:Kv}}})}const Vv=Ia({ArrowLeft:yi("horiz",-1),ArrowRight:yi("horiz",1),ArrowUp:yi("vert",-1),ArrowDown:yi("vert",1)});function yi(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof P){if(!o.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=fe.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new fe(c))),!0):!1}}function Wv(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!fe.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&B.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new fe(r))),!0)}function Kv(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof fe))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=S.empty;for(let s=r.length-1;s>=0;s--)i=S.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new N(i,0,0));return o.setSelection(P.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function jv(t){if(!(t.selection instanceof fe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ie.create(t.doc,[Te.widget(t.selection.head,e,{key:"gapcursor"})])}var yo=200,Re=function(){};Re.prototype.append=function(e){return e.length?(e=Re.from(e),!this.length&&e||e.length<yo&&this.leafAppend(e)||this.length<yo&&e.leafPrepend(this)||this.appendInner(e)):this};Re.prototype.prepend=function(e){return e.length?Re.from(e).append(this):this};Re.prototype.appendInner=function(e){return new qv(this,e)};Re.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Re.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Re.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Re.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Re.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},n,r),i};Re.from=function(e){return e instanceof Re?e:e&&e.length?new vf(e):Re.empty};var vf=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,a){for(var l=o;l<s;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,a){for(var l=o-1;l>=s;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=yo)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=yo)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Re);Re.empty=new vf([]);var qv=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.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,i,o,s){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(o,a),s)===!1||o>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,o)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(o,a)-a,s+a)===!1||o<a&&this.left.forEachInvertedInner(r,Math.min(i,a),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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}(Re);const Gv=500;class ht{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,a,l,c=[],d=[];return this.items.forEach((u,h)=>{if(!u.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,d.push(u);return}if(i){d.push(new vt(u.map));let f=u.step.map(i.slice(o)),p;f&&s.maybeStep(f).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new vt(p,void 0,void 0,c.length+d.length))),o--,p&&i.appendMap(p,o)}else s.maybeStep(u.step);if(u.selection)return a=i?u.selection.map(i.slice(o)):u.selection,l=new ht(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),h=new vt(e.mapping.maps[d],u,n),f;(f=l&&l.merge(h))&&(h=f,d?o.pop():a=a.slice(0,a.length-1)),o.push(h),n&&(s++,n=void 0),i||(l=h)}let c=s-r.depth;return c>Zv&&(a=Jv(a,c),s-=c),new ht(a.append(o),s)}remapping(e,n){let r=new Or;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new ht(this.items.append(e.map(n=>new vt(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=n;this.items.forEach(h=>{let f=o.getMirror(--l);if(f==null)return;s=Math.min(s,f);let p=o.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(o.slice(l+1,f));g&&a++,r.push(new vt(p,m,g))}else r.push(new vt(p))},i);let c=[];for(let h=n;h<s;h++)c.push(new vt(o.maps[h]));let d=this.items.slice(0,i).append(c).append(r),u=new ht(d,a);return u.emptyItemCount()>Gv&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let d=s.selection&&s.selection.map(n.slice(r));d&&o++;let u=new vt(c.invert(),l,d),h,f=i.length-1;(h=i.length&&i[f].merge(u))?i[f]=h:i.push(u)}}else s.map&&r--},this.items.length,0),new ht(Re.from(i.reverse()),o)}}ht.empty=new ht(Re.empty,0);function Jv(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class vt{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new vt(n.getMap().invert(),n,this.selection)}}}class qt{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const Zv=20;function Yv(t,e,n,r){let i=n.getMeta(An),o;if(i)return i.historyState;n.getMeta(eE)&&(t=new qt(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(An))return s.getMeta(An).redo?new qt(t.done.addTransform(n,void 0,r,Mi(e)),t.undone,dd(n.mapping.maps),t.prevTime,t.prevComposition):new qt(t.done,t.undone.addTransform(n,void 0,r,Mi(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Xv(n,t.prevRanges)),c=s?Es(t.prevRanges,n.mapping):dd(n.mapping.maps);return new qt(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Mi(e)),ht.empty,c,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new qt(t.done.rebased(n,o),t.undone.rebased(n,o),Es(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new qt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Es(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Xv(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0)}),n}function dd(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function Es(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}function Qv(t,e,n){let r=Mi(e),i=An.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),l=new qt(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(An,{redo:n,historyState:l})}let xs=!1,ud=null;function Mi(t){let e=t.plugins;if(ud!=e){xs=!1,ud=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){xs=!0;break}}return xs}const An=new ae("history"),eE=new ae("closeHistory");function tE(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Q({key:An,state:{init(){return new qt(ht.empty,ht.empty,null,0,-1)},apply(e,n,r){return Yv(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?xf:r=="historyRedo"?Sf:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function Ef(t,e){return(n,r)=>{let i=An.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=Qv(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}const xf=Ef(!1,!0),Sf=Ef(!0,!0);te.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Q({key:new ae("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit;if(i==null||i===0){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const s=o-i,a=0,l=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(a,l);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),o=this.storage.characters({node:e.doc});if(o<=r||i>r&&o>r&&o<=i)return!0;if(i>r&&o>r&&o>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=o-r,c=a-l,d=a;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var nE=te.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Bv(this.options)]}});te.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Q({key:new ae("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!n||!r)return ie.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(i>=c&&i<=c+l.nodeSize-1))return!1;s+=1});let a=0;return t.descendants((l,c)=>{if(l.isText||!(i>=c&&i<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&s-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";o.push(Te.node(c,c+l.nodeSize,{class:this.options.className}))}),ie.create(t,o)}}})]}});var rE=te.create({name:"gapCursor",addProseMirrorPlugins(){return[Uv()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=X($(t,"allowGapCursor",n)))!=null?e:null}}});te.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Q({key:new ae("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;const o=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,c=!s.isLeaf&&Lo(s);if((l||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);const u=Te.node(a,a+s.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});i.push(u)}return this.options.includeChildren}),ie.create(t,i)}}})]}});te.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Q({key:new ae("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Eh(n.selection)||t.view.dragging?null:ie.create(n.doc,[Te.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function hd({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var iE=te.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ae(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new Q({key:e,appendTransaction:(i,o,s)=>{const{doc:a,tr:l,schema:c}=s,d=e.getState(s),u=a.content.size,h=c.nodes[n];if(d)return l.insert(u,h.create())},state:{init:(i,o)=>{const s=o.tr.doc.lastChild;return!hd({node:s,types:r})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!hd({node:s,types:r})}}})]}}),oE=te.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>xf(t,e),redo:()=>({state:t,dispatch:e})=>Sf(t,e)}},addProseMirrorPlugins(){return[tE(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),sE=te.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(Xw.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(qw.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Ua.configure(this.options.bulletList)),this.options.code!==!1&&i.push(Hh.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(Fh.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(Wh.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(nE.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(rE.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(Qw.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(ev.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(oE.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(tv.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(sv.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Va.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Zh.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(kf.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Ka.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(Iv.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(Dv.configure(this.options.strike)),this.options.text!==!1&&i.push($v.configure(this.options.text)),this.options.underline!==!1&&i.push(Pv.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(iE.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),aE=sE;const Ai=globalThis,rl=Ai.ShadowRoot&&(Ai.ShadyCSS===void 0||Ai.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,il=Symbol(),fd=new WeakMap;let Cf=class{constructor(e,n,r){if(this._$cssResult$=!0,r!==il)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}get styleSheet(){let e=this.o;const n=this.t;if(rl&&e===void 0){const r=n!==void 0&&n.length===1;r&&(e=fd.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&fd.set(n,e))}return e}toString(){return this.cssText}};const Tf=t=>new Cf(typeof t=="string"?t:t+"",void 0,il),Tt=(t,...e)=>{const n=t.length===1?t[0]:e.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1],t[0]);return new Cf(n,t,il)},lE=(t,e)=>{if(rl)t.adoptedStyleSheets=e.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of e){const r=document.createElement("style"),i=Ai.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=n.cssText,t.appendChild(r)}},pd=rl?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let n="";for(const r of e.cssRules)n+=r.cssText;return Tf(n)})(t):t;const{is:cE,defineProperty:dE,getOwnPropertyDescriptor:uE,getOwnPropertyNames:hE,getOwnPropertySymbols:fE,getPrototypeOf:pE}=Object,zo=globalThis,md=zo.trustedTypes,mE=md?md.emptyScript:"",gE=zo.reactiveElementPolyfillSupport,Mr=(t,e)=>t,ko={toAttribute(t,e){switch(e){case Boolean:t=t?mE:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=t!==null;break;case Number:n=t===null?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch{n=null}}return n}},ol=(t,e)=>!cE(t,e),gd={attribute:!0,type:String,converter:ko,reflect:!1,useDefault:!1,hasChanged:ol};Symbol.metadata??=Symbol("metadata"),zo.litPropertyMetadata??=new WeakMap;let qn=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,n=gd){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(e,n),!n.noAccessor){const r=Symbol(),i=this.getPropertyDescriptor(e,r,n);i!==void 0&&dE(this.prototype,e,i)}}static getPropertyDescriptor(e,n,r){const{get:i,set:o}=uE(this.prototype,e)??{get(){return this[n]},set(s){this[n]=s}};return{get:i,set(s){const a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??gd}static _$Ei(){if(this.hasOwnProperty(Mr("elementProperties")))return;const e=pE(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Mr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Mr("properties"))){const n=this.properties,r=[...hE(n),...fE(n)];for(const i of r)this.createProperty(i,n[i])}const e=this[Symbol.metadata];if(e!==null){const n=litPropertyMetadata.get(e);if(n!==void 0)for(const[r,i]of n)this.elementProperties.set(r,i)}this._$Eh=new Map;for(const[n,r]of this.elementProperties){const i=this._$Eu(n,r);i!==void 0&&this._$Eh.set(i,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const n=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const i of r)n.unshift(pd(i))}else e!==void 0&&n.push(pd(e));return n}static _$Eu(e,n){const r=n.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,n=this.constructor.elementProperties;for(const r of n.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return lE(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,n,r){this._$AK(e,r)}_$ET(e,n){const r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){const o=(r.converter?.toAttribute!==void 0?r.converter:ko).toAttribute(n,r.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,n){const r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const o=r.getPropertyOptions(i),s=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ko;this._$Em=i;const a=s.fromAttribute(n,o.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,n,r,i=!1,o){if(e!==void 0){const s=this.constructor;if(i===!1&&(o=this[e]),r??=s.getPropertyOptions(e),!((r.hasChanged??ol)(o,n)||r.useDefault&&r.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,r))))return;this.C(e,n,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,n,{useDefault:r,reflect:i,wrapped:o},s){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??n??this[e]),o!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(n=void 0),this._$AL.set(e,n)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[i,o]of r){const{wrapped:s}=o,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,o,a)}}let e=!1;const n=this._$AL;try{e=this.shouldUpdate(n),e?(this.willUpdate(n),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(n)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(n)}willUpdate(e){}_$AE(e){this._$EO?.forEach(n=>n.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(n=>this._$ET(n,this[n])),this._$EM()}updated(e){}firstUpdated(e){}};qn.elementStyles=[],qn.shadowRootOptions={mode:"open"},qn[Mr("elementProperties")]=new Map,qn[Mr("finalized")]=new Map,gE?.({ReactiveElement:qn}),(zo.reactiveElementVersions??=[]).push("2.1.2");const sl=globalThis,bd=t=>t,wo=sl.trustedTypes,yd=wo?wo.createPolicy("lit-html",{createHTML:t=>t}):void 0,Mf="$lit$",Yt=`lit$${Math.random().toFixed(9).slice(2)}$`,Af="?"+Yt,bE=`<${Af}>`,$n=document,Fr=()=>$n.createComment(""),Ur=t=>t===null||typeof t!="object"&&typeof t!="function",al=Array.isArray,yE=t=>al(t)||typeof t?.[Symbol.iterator]=="function",Ss=`[ \t\n\f\r]`,hr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,kd=/-->/g,wd=/>/g,bn=RegExp(`>|${Ss}(?:([^\\s"'>=/]+)(${Ss}*=${Ss}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),vd=/'/g,Ed=/"/g,Nf=/^(?:script|style|textarea|title)$/i,kE=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),H=kE(1),Pn=Symbol.for("lit-noChange"),me=Symbol.for("lit-nothing"),xd=new WeakMap,xn=$n.createTreeWalker($n,129);function _f(t,e){if(!al(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return yd!==void 0?yd.createHTML(e):e}const wE=(t,e)=>{const n=t.length-1,r=[];let i,o=e===2?"<svg>":e===3?"<math>":"",s=hr;for(let a=0;a<n;a++){const l=t[a];let c,d,u=-1,h=0;for(;h<l.length&&(s.lastIndex=h,d=s.exec(l),d!==null);)h=s.lastIndex,s===hr?d[1]==="!--"?s=kd:d[1]!==void 0?s=wd:d[2]!==void 0?(Nf.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=bn):d[3]!==void 0&&(s=bn):s===bn?d[0]===">"?(s=i??hr,u=-1):d[1]===void 0?u=-2:(u=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?bn:d[3]==='"'?Ed:vd):s===Ed||s===vd?s=bn:s===kd||s===wd?s=hr:(s=bn,i=void 0);const f=s===bn&&t[a+1].startsWith("/>")?" ":"";o+=s===hr?l+bE:u>=0?(r.push(c),l.slice(0,u)+Mf+l.slice(u)+Yt+f):l+Yt+(u===-2?a:f)}return[_f(t,o+(t[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class Vr{constructor({strings:e,_$litType$:n},r){let i;this.parts=[];let o=0,s=0;const a=e.length-1,l=this.parts,[c,d]=wE(e,n);if(this.el=Vr.createElement(c,r),xn.currentNode=this.el.content,n===2||n===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=xn.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(Mf)){const h=d[s++],f=i.getAttribute(u).split(Yt),p=/([.?@])?(.*)/.exec(h);l.push({type:1,index:o,name:p[2],strings:f,ctor:p[1]==="."?EE:p[1]==="?"?xE:p[1]==="@"?SE:Ho}),i.removeAttribute(u)}else u.startsWith(Yt)&&(l.push({type:6,index:o}),i.removeAttribute(u));if(Nf.test(i.tagName)){const u=i.textContent.split(Yt),h=u.length-1;if(h>0){i.textContent=wo?wo.emptyScript:"";for(let f=0;f<h;f++)i.append(u[f],Fr()),xn.nextNode(),l.push({type:2,index:++o});i.append(u[h],Fr())}}}else if(i.nodeType===8)if(i.data===Af)l.push({type:2,index:o});else{let u=-1;for(;(u=i.data.indexOf(Yt,u+1))!==-1;)l.push({type:7,index:o}),u+=Yt.length-1}o++}}static createElement(e,n){const r=$n.createElement("template");return r.innerHTML=e,r}}function sr(t,e,n=t,r){if(e===Pn)return e;let i=r!==void 0?n._$Co?.[r]:n._$Cl;const o=Ur(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(t),i._$AT(t,n,r)),r!==void 0?(n._$Co??=[])[r]=i:n._$Cl=i),i!==void 0&&(e=sr(t,i._$AS(t,e.values),i,r)),e}class vE{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:n},parts:r}=this._$AD,i=(e?.creationScope??$n).importNode(n,!0);xn.currentNode=i;let o=xn.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Gr(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new CE(o,this,e)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(o=xn.nextNode(),s++)}return xn.currentNode=$n,i}p(e){let n=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,n),n+=r.strings.length-2):r._$AI(e[n])),n++}}class Gr{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,n,r,i){this.type=2,this._$AH=me,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&e?.nodeType===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=sr(this,e,n),Ur(e)?e===me||e==null||e===""?(this._$AH!==me&&this._$AR(),this._$AH=me):e!==this._$AH&&e!==Pn&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):yE(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==me&&Ur(this._$AH)?this._$AA.nextSibling.data=e:this.T($n.createTextNode(e)),this._$AH=e}$(e){const{values:n,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=Vr.createElement(_f(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(n);else{const o=new vE(i,this),s=o.u(this.options);o.p(n),this.T(s),this._$AH=o}}_$AC(e){let n=xd.get(e.strings);return n===void 0&&xd.set(e.strings,n=new Vr(e)),n}k(e){al(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let r,i=0;for(const o of e)i===n.length?n.push(r=new Gr(this.O(Fr()),this.O(Fr()),this,this.options)):r=n[i],r._$AI(o),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);e!==this._$AB;){const r=bd(e).nextSibling;bd(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class Ho{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,r,i,o){this.type=1,this._$AH=me,this._$AN=void 0,this.element=e,this.name=n,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=me}_$AI(e,n=this,r,i){const o=this.strings;let s=!1;if(o===void 0)e=sr(this,e,n,0),s=!Ur(e)||e!==this._$AH&&e!==Pn,s&&(this._$AH=e);else{const a=e;let l,c;for(e=o[0],l=0;l<o.length-1;l++)c=sr(this,a[r+l],n,l),c===Pn&&(c=this._$AH[l]),s||=!Ur(c)||c!==this._$AH[l],c===me?e=me:e!==me&&(e+=(c??"")+o[l+1]),this._$AH[l]=c}s&&!i&&this.j(e)}j(e){e===me?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class EE extends Ho{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===me?void 0:e}}class xE extends Ho{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==me)}}class SE extends Ho{constructor(e,n,r,i,o){super(e,n,r,i,o),this.type=5}_$AI(e,n=this){if((e=sr(this,e,n,0)??me)===Pn)return;const r=this._$AH,i=e===me&&r!==me||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,o=e!==me&&(r===me||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class CE{constructor(e,n,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=n,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){sr(this,e)}}const TE=sl.litHtmlPolyfillSupport;TE?.(Vr,Gr),(sl.litHtmlVersions??=[]).push("3.3.2");const Ke=(t,e,n)=>{const r=n?.renderBefore??e;let i=r._$litPart$;if(i===void 0){const o=n?.renderBefore??null;r._$litPart$=i=new Gr(e.insertBefore(Fr(),o),o,void 0,n??{})}return i._$AI(t),i};const ll=globalThis;let sn=class extends qn{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ke(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Pn}};sn._$litElement$=!0,sn.finalized=!0,ll.litElementHydrateSupport?.({LitElement:sn});const ME=ll.litElementPolyfillSupport;ME?.({LitElement:sn});(ll.litElementVersions??=[]).push("4.2.2");const Fo=t=>(e,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)};const AE={attribute:!0,type:String,converter:ko,reflect:!1,hasChanged:ol},NE=(t=AE,e,n)=>{const{kind:r,metadata:i}=n;let o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),r==="setter"&&((t=Object.create(t)).wrapped=!0),o.set(n.name,t),r==="accessor"){const{name:s}=n;return{set(a){const l=e.get.call(this);e.set.call(this,a),this.requestUpdate(s,l,t,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,t,a),a}}}if(r==="setter"){const{name:s}=n;return function(a){const l=this[s];e.call(this,a),this.requestUpdate(s,l,t,!0,a)}}throw Error("Unsupported decorator location: "+r)};function Me(t){return(e,n)=>typeof n=="object"?NE(t,e,n):((r,i,o)=>{const s=i.hasOwnProperty(o);return i.constructor.createProperty(o,r),s?Object.getOwnPropertyDescriptor(i,o):void 0})(t,e,n)}function Mt(t){return Me({...t,state:!0,attribute:!1})}const _E=(t,e,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(t,e,n),n);function Jr(t,e){return(n,r,i)=>{const o=s=>s.renderRoot?.querySelector(t)??null;return _E(n,r,{get(){return o(this)}})}}const OE=t=>t.strings===void 0;const Of={CHILD:2},If=t=>(...e)=>({_$litDirective$:t,values:e});class Rf{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,n,r){this._$Ct=e,this._$AM=n,this._$Ci=r}_$AS(e,n){return this.update(e,n)}update(e,n){return this.render(...n)}}const Ar=(t,e)=>{const n=t._$AN;if(n===void 0)return!1;for(const r of n)r._$AO?.(e,!1),Ar(r,e);return!0},vo=t=>{let e,n;do{if((e=t._$AM)===void 0)break;n=e._$AN,n.delete(t),t=e}while(n?.size===0)},Lf=t=>{for(let e;e=t._$AM;t=e){let n=e._$AN;if(n===void 0)e._$AN=n=new Set;else if(n.has(t))break;n.add(t),LE(e)}};function IE(t){this._$AN!==void 0?(vo(this),this._$AM=t,Lf(this)):this._$AM=t}function RE(t,e=!1,n=0){const r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let o=n;o<r.length;o++)Ar(r[o],!1),vo(r[o]);else r!=null&&(Ar(r,!1),vo(r));else Ar(this,t)}const LE=t=>{t.type==Of.CHILD&&(t._$AP??=RE,t._$AQ??=IE)};class DE extends Rf{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,n,r){super._$AT(e,n,r),Lf(this),this.isConnected=e._$AU}_$AO(e,n=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),n&&(Ar(this,e),vo(this))}setValue(e){if(OE(this._$Ct))this._$Ct._$AI(e,this);else{const n=[...this._$Ct._$AH];n[this._$Ci]=e,this._$Ct._$AI(n,this,0)}}disconnected(){}reconnected(){}}const Cs=new WeakMap,$E=If(class extends DE{render(t){return me}update(t,[e]){const n=e!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=e,this.ht=t.options?.host,this.rt(this.ct=t.element)),me}rt(t){if(this.isConnected||(t=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let n=Cs.get(e);n===void 0&&(n=new WeakMap,Cs.set(e,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,t),t!==void 0&&this.G.call(this.ht,t)}else this.G.value=t}get lt(){return typeof this.G=="function"?Cs.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function PE(t){const e=t.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},o=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,i]};i.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},d={match:/\\'/},u={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=t.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],g=["true","false"],b={match:/(\/[a-z._-]+)+/},k=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],w=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],x=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],v=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:g,built_in:[...k,...w,"set","shopt",...x,...v]},contains:[f,t.SHEBANG(),p,u,o,s,b,a,l,c,d,n]}}function BE(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},f=e.optional(i)+t.IDENT_RE+"\\s*\\(",g={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},b=[u,a,n,t.C_BLOCK_COMMENT_MODE,d,c],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:g,contains:b.concat([{begin:/\(/,end:/\)/,keywords:g,contains:b.concat(["self"]),relevance:0}]),relevance:0},w={begin:"("+s+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:f,returnBegin:!0,contains:[t.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,u]};return{name:"C",aliases:["h"],keywords:g,disableAutodetect:!0,illegal:"</",contains:[].concat(k,w,b,[u,{begin:t.IDENT_RE+"::",keywords:g},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:u,strings:c,keywords:g}}}function zE(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},f=e.optional(i)+t.IDENT_RE+"\\s*\\(",p=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],m=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],b=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],x={type:m,keyword:p,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},v={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},T=[v,u,a,n,t.C_BLOCK_COMMENT_MODE,d,c],A={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:x,contains:T.concat([{begin:/\(/,end:/\)/,keywords:x,contains:T.concat(["self"]),relevance:0}]),relevance:0},R={className:"function",begin:"("+s+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:x,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:x,relevance:0},{begin:f,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,u]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:x,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(A,R,v,T,[u,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:x,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:x},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function HE(t){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],o=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],s={keyword:i.concat(o),built_in:e,literal:r},a=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},u=t.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:s},f=t.inherit(h,{illegal:/\n/}),p={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,f]},m={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},g=t.inherit(m,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]});h.contains=[m,p,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.C_BLOCK_COMMENT_MODE],f.contains=[g,p,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const b={variants:[c,m,p,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},k={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},w=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",x={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:s,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"\x3c!--|--\x3e"},{begin:"</?",end:">"}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},b,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,k,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,k,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+w+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:s,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,k],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,relevance:0,contains:[b,l,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},x]}}const FE=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),UE=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],VE=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],WE=[...UE,...VE],KE=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),jE=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),qE=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),GE=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function JE(t){const e=t.regex,n=FE(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",o=/@-?\w[\w]*(-\w+)*/,s="[a-zA-Z-][a-zA-Z0-9_-]*",a=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+s,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+jE.join("|")+")"},{begin:":(:)?("+qE.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+GE.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:o},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:KE.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+WE.join("|")+")\\b"}]}}var Gn="[0-9](_*[0-9])*",ki=`\\.(${Gn})`,wi="[0-9a-fA-F](_*[0-9a-fA-F])*",Sd={className:"number",variants:[{begin:`(\\b(${Gn})((${ki})|\\.)?|(${ki}))[eE][+-]?(${Gn})[fFdD]?\\b`},{begin:`\\b(${Gn})((${ki})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${ki})[fFdD]?\\b`},{begin:`\\b(${Gn})[fFdD]\\b`},{begin:`\\b0[xX]((${wi})\\.?|(${wi})?\\.(${wi}))[pP][+-]?(${Gn})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${wi})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Df(t,e,n){return n===-1?"":t.replace(e,r=>Df(t,e,n-1))}function ZE(t){const e=t.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+Df("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},c={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[d,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[c,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,Sd,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},Sd,c]}}const Cd="[A-Za-z$_][0-9A-Za-z$_]*",YE=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],XE=["true","false","null","undefined","NaN","Infinity"],$f=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Pf=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Bf=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],QE=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ex=[].concat(Bf,$f,Pf);function tx(t){const e=t.regex,n=(Y,{after:We})=>{const Ye="</"+Y[0].slice(1);return Y.input.indexOf(Ye,We)!==-1},r=Cd,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Y,We)=>{const Ye=Y[0].length+Y.index,dt=Y.input[Ye];if(dt==="<"||dt===","){We.ignoreMatch();return}dt===">"&&(n(Y,{after:Ye})||We.ignoreMatch());let At;const fn=Y.input.substring(Ye);if(At=fn.match(/^\s*=/)){We.ignoreMatch();return}if((At=fn.match(/^\s+extends\s+/))&&At.index===0){We.ignoreMatch();return}}},a={$pattern:Cd,keyword:YE,literal:XE,built_in:ex,"variable.language":QE},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,h]},k={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},w=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,m,g,{match:/\$\d+/},u];h.contains=w.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(w)});const x=[].concat(k,h.contains),v=x.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(x)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:v},A={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},R={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...$f,...Pf]}},F={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},ne={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},re={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ke(Y){return e.concat("(?!",Y.join("|"),")")}const Ae={match:e.concat(/\b/,ke([...Bf,"super","import"].map(Y=>`${Y}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Z={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},J={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},we="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",ct={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(we)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:v,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),F,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,m,g,k,{match:/\$\d+/},u,R,{scope:"attr",match:r+e.lookahead(":"),relevance:0},ct,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,t.REGEXP_MODE,{className:"function",begin:we,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:v}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},ne,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[T,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Z,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},Ae,re,A,J,{match:/\$[(.]/}]}}function nx(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,i,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function rx(t){const e=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},s={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=t.inherit(c,{contains:[]}),h=t.inherit(d,{contains:[]});c.contains.push(h),d.contains.push(u);let f=[n,l];return[c,d,u,h].forEach(b=>{b.contains=b.contains.concat(f)}),f=f.concat(c,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},n,o,c,d,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},i,r,l,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function ix(t){const e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),o=e.concat(/[A-Z]+/,n),s={scope:"variable",match:"\\$+"+r},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=t.inherit(t.APOS_STRING_MODE,{illegal:null}),d=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(l)}),u={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(Z,J)=>{J.data._beginMatch=Z[1]||Z[2]},"on:end":(Z,J)=>{J.data._beginMatch!==Z[1]&&J.ignoreMatch()}},h=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[ \t\n]`,p={scope:"string",variants:[d,c,u,h]},m={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},g=["false","null","true"],b=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],k=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],x={keyword:b,literal:(Z=>{const J=[];return Z.forEach(we=>{J.push(we),we.toLowerCase()===we?J.push(we.toUpperCase()):J.push(we.toLowerCase())}),J})(g),built_in:k},v=Z=>Z.map(J=>J.replace(/\|\d+$/,"")),T={variants:[{match:[/new/,e.concat(f,"+"),e.concat("(?!",v(k).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},A=e.concat(r,"\\b(?!\\()"),R={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),A],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),A],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},F={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},ne={relevance:0,begin:/\(/,end:/\)/,keywords:x,contains:[F,s,R,t.C_BLOCK_COMMENT_MODE,p,m,T]},re={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",v(b).join("\\b|"),"|",v(k).join("\\b|"),"\\b)"),r,e.concat(f,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[ne]};ne.contains.push(re);const ke=[F,R,t.C_BLOCK_COMMENT_MODE,p,m,T],Ae={begin:e.concat(/#\[\s*\\?/,e.either(i,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...ke]},...ke,{scope:"meta",variants:[{match:i},{match:o}]}]};return{case_insensitive:!1,keywords:x,contains:[Ae,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},s,re,R,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},T,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:x,contains:["self",Ae,s,R,t.C_BLOCK_COMMENT_MODE,p,m]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},p,m]}}function ox(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function sx(t){const e=t.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},d={begin:/\{\{/,relevance:0},u={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l,d,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,d,c]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",f=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,p=`\\b|${r.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${f}))[eE][+-]?(${h})[jJ]?(?=${p})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${h})[jJ](?=${p})`}]},g={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,m,u,t.HASH_COMMENT_MODE]}]};return c.contains=[u,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},u,g,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,b,u]}]}}function ax(t){const e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),s={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[t.COMMENT("#","$",{contains:[a]}),t.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:s},u={className:"string",contains:[t.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,d]})]}]},h="[1-9](_?[0-9])*|0",f="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${f}))?([eE][+-]?(${f})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},m={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:s}]},T=[u,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:s},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[m]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[u,{begin:n}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:s},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);d.contains=T,m.contains=T;const ne=[{begin:/^\s*=>/,starts:{end:"$",contains:T}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:s,contains:T}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(ne).concat(c).concat(T)}}function lx(t){const e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),i=e.concat(n,t.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},s="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:d,keyword:a,literal:l,built_in:c},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+s},{begin:"\\b0o([0-7_]+)"+s},{begin:"\\b0x([A-Fa-f0-9_]+)"+s},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+s}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:c,type:d}},{className:"punctuation",begin:"->"},o]}}function cx(t){const e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},o=["true","false","unknown"],s=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],u=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=d,p=[...c,...l].filter(v=>!d.includes(v)),m={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},g={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},b={match:e.concat(/\b/,e.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function k(v){return e.concat(/\b/,e.either(...v.map(T=>T.replace(/\s+/,"\\s+"))),/\b/)}const w={scope:"keyword",match:k(h),relevance:0};function x(v,{exceptions:T,when:A}={}){const R=A;return T=T||[],v.map(F=>F.match(/\|\d+$/)||T.includes(F)?F:R(F)?`${F}|0`:F)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:x(p,{when:v=>v.length<3}),literal:o,type:a,built_in:u},contains:[{scope:"type",match:k(s)},w,b,m,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,g]}}const Eo="[A-Za-z$_][0-9A-Za-z$_]*",zf=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Hf=["true","false","null","undefined","NaN","Infinity"],Ff=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Uf=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Vf=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Wf=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Kf=[].concat(Vf,Ff,Uf);function dx(t){const e=t.regex,n=(Y,{after:We})=>{const Ye="</"+Y[0].slice(1);return Y.input.indexOf(Ye,We)!==-1},r=Eo,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Y,We)=>{const Ye=Y[0].length+Y.index,dt=Y.input[Ye];if(dt==="<"||dt===","){We.ignoreMatch();return}dt===">"&&(n(Y,{after:Ye})||We.ignoreMatch());let At;const fn=Y.input.substring(Ye);if(At=fn.match(/^\s*=/)){We.ignoreMatch();return}if((At=fn.match(/^\s+extends\s+/))&&At.index===0){We.ignoreMatch();return}}},a={$pattern:Eo,keyword:zf,literal:Hf,built_in:Kf,"variable.language":Wf},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,h]},k={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},w=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,m,g,{match:/\$\d+/},u];h.contains=w.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(w)});const x=[].concat(k,h.contains),v=x.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(x)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:v},A={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},R={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Ff,...Uf]}},F={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},ne={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},re={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ke(Y){return e.concat("(?!",Y.join("|"),")")}const Ae={match:e.concat(/\b/,ke([...Vf,"super","import"].map(Y=>`${Y}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Z={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},J={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},we="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",ct={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(we)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:v,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),F,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,p,m,g,k,{match:/\$\d+/},u,R,{scope:"attr",match:r+e.lookahead(":"),relevance:0},ct,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,t.REGEXP_MODE,{className:"function",begin:we,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:v}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},ne,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[T,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Z,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},Ae,re,A,J,{match:/\$[(.]/}]}}function ux(t){const e=t.regex,n=dx(t),r=Eo,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Eo,keyword:zf.concat(l),literal:Hf,built_in:Kf.concat(i),"variable.language":Wf},d={className:"meta",begin:"@"+r},u=(m,g,b)=>{const k=m.contains.findIndex(w=>w.label===g);if(k===-1)throw new Error("can not find mode to replace");m.contains.splice(k,1,b)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(m=>m.scope==="attr"),f=Object.assign({},h,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,f]),n.contains=n.contains.concat([d,o,s,f]),u(n,"shebang",t.SHEBANG()),u(n,"use_strict",a);const p=n.contains.find(m=>m.label==="func.def");return p.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function hx(t){const e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},o={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=t.inherit(o,{begin:/\(/,end:/\)/}),a=t.inherit(t.APOS_STRING_MODE,{className:"string"}),l=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[o,l,a,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[o,s,l,a]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function fx(t){const e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},o={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},s={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},a=t.inherit(s,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},p={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},m={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},g=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},h,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},p,m,o,s],b=[...g];return b.pop(),b.push(a),f.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:g}}const Td={},px="hljs-";function mx(t){const e=Uh.newInstance();return{highlight:n,highlightAuto:r,listLanguages:i,register:o,registerAlias:s,registered:a};function n(l,c,d){const u=d||Td,h=typeof u.prefix=="string"?u.prefix:px;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:gx,classPrefix:h});const f=e.highlight(c,{ignoreIllegals:!0,language:l});if(f.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:f.errorRaised});const p=f._emitter.root,m=p.data;return m.language=f.language,m.relevance=f.relevance,p}function r(l,c){const u=(c||Td).subset||i();let h=-1,f=0,p;for(;++h<u.length;){const m=u[h];if(!e.getLanguage(m))continue;const g=n(m,l,c);g.data&&g.data.relevance!==void 0&&g.data.relevance>f&&(f=g.data.relevance,p=g)}return p||{type:"root",children:[],data:{language:void 0,relevance:f}}}function i(){return e.listLanguages()}function o(l,c){if(typeof l=="string")e.registerLanguage(l,c);else{let d;for(d in l)Object.hasOwn(l,d)&&e.registerLanguage(d,l[d])}}function s(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let d;for(d in l)if(Object.hasOwn(l,d)){const u=l[d];e.registerAliases(typeof u=="string"?u:[...u],{languageName:d})}}}function a(l){return!!e.getLanguage(l)}}class gx{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const r=this.stack[this.stack.length-1],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(e){const n=this,r=e.split(".").map(function(s,a){return a?s+"_".repeat(a):n.options.classPrefix+s}),i=this.stack[this.stack.length-1],o={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(o),this.stack.push(o)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const jf=mx();jf.register({bash:PE,c:BE,cpp:zE,csharp:HE,css:JE,java:ZE,javascript:tx,json:nx,markdown:rx,plaintext:ox,php:ix,python:sx,ruby:ax,rust:lx,sql:cx,typescript:ux,xml:hx,yaml:fx});const bx=[{key:"bash",label:"Bash"},{key:"c",label:"C"},{key:"cpp",label:"C++"},{key:"csharp",label:"C#"},{key:"css",label:"CSS"},{key:"java",label:"Java"},{key:"javascript",label:"JavaScript"},{key:"json",label:"JSON"},{key:"markdown",label:"Markdown"},{key:"php",label:"PHP"},{key:"plaintext",label:"Plain Text"},{key:"python",label:"Python"},{key:"ruby",label:"Ruby"},{key:"rust",label:"Rust"},{key:"sql",label:"SQL"},{key:"typescript",label:"TypeScript"},{key:"xml",label:"XML"},{key:"yaml",label:"YAML"}];class yx{constructor(e,n,r,i,o){this.node=e,this.editor=n,this.getPos=r,this.dom=document.createElement("div"),this.dom.classList.add("code-block-wrapper"),this.dom.style.position="relative";const s=document.createElement("pre");e.attrs.language&&s.setAttribute("data-language",e.attrs.language),this.contentDOM=document.createElement("code"),e.attrs.language&&(this.contentDOM.className=`language-${e.attrs.language}`),s.appendChild(this.contentDOM),this.dom.appendChild(s),this.selectContainer=document.createElement("div"),this.selectContainer.classList.add("code-block-selector"),this.dom.appendChild(this.selectContainer),this.renderSelector(),this.setupSelectionTracking()}setupSelectionTracking(){this.selectionUpdateHandler=()=>{const e=this.getPos();if(e===void 0)return;const{from:n}=this.editor.state.selection,r=e,i=e+this.node.nodeSize;n>=r&&n<i?this.dom.classList.add("has-focus"):this.dom.classList.remove("has-focus")},this.editor.on("selectionUpdate",this.selectionUpdateHandler),this.editor.on("transaction",this.selectionUpdateHandler),this.selectionUpdateHandler()}renderSelector(){const e=this.node.attrs.language||"plaintext",n=H`
|
|
2
2
|
<select
|
|
3
3
|
@change=${r=>this.handleLanguageChange(r)}
|
|
4
4
|
style="
|
|
@@ -10,13 +10,13 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
10
10
|
cursor: pointer;
|
|
11
11
|
"
|
|
12
12
|
>
|
|
13
|
-
${
|
|
13
|
+
${bx.map(r=>H`<option value=${r.key} ?selected=${r.key===e}>
|
|
14
14
|
${r.label}
|
|
15
15
|
</option>`)}
|
|
16
16
|
</select>
|
|
17
|
-
`;
|
|
18
|
-
${
|
|
19
|
-
`,
|
|
17
|
+
`;Ke(n,this.selectContainer)}handleLanguageChange(e){const r=e.target.value,i=this.getPos();i!==void 0&&this.editor.chain().focus().command(({tr:o})=>(o.setNodeMarkup(i,void 0,{...this.node.attrs,language:r}),!0)).run()}update(e){if(e.type.name!=="codeBlock")return!1;this.node=e;const n=this.dom.querySelector("pre");return n&&(e.attrs.language?n.setAttribute("data-language",e.attrs.language):n.removeAttribute("data-language")),this.contentDOM&&(this.contentDOM.className="",e.attrs.language&&this.contentDOM.classList.add(`language-${e.attrs.language}`)),this.renderSelector(),!0}destroy(){this.selectionUpdateHandler&&(this.editor.off("selectionUpdate",this.selectionUpdateHandler),this.editor.off("transaction",this.selectionUpdateHandler)),this.dom.remove()}}const kx="pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#005cc5}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-comment,.hljs-code,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}",wx=kx.replace(/background:\s*#ffffff/g,"background: transparent").replace(/padding:\s*1em/g,"padding: 0").replace(/padding:\s*3px 5px/g,"padding: 0"),vx=Tt`
|
|
18
|
+
${Tf(wx)}
|
|
19
|
+
`,Ex=te.create({name:"focusClickHandler",addProseMirrorPlugins(){let t;return[new Q({key:new ae("focusClickHandler"),props:{handleDOMEvents:{focus:()=>(t=Date.now(),!1),blur:()=>(t=void 0,!1)},handleClick(e,n,r){if(t===void 0||Date.now()>t+100)return!1;const o=r.target.tagName.toLowerCase();if(["button","select","option","input","textarea"].includes(o))return!1;const a=e.state.tr.setSelection(P.create(e.state.doc,n));return e.dispatch(a),e.focus(),!0}}})]}});async function qf({service:t,initialValues:e,mode:n,i18n:r}){let i=e.html??"";const o=document.createElement("div");function s(){const u=H`
|
|
20
20
|
<label class="TpField">
|
|
21
21
|
<textarea
|
|
22
22
|
rows="8"
|
|
@@ -25,7 +25,7 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
25
25
|
@input=${h=>{i=h.target.value}}
|
|
26
26
|
></textarea>
|
|
27
27
|
</label>
|
|
28
|
-
`;
|
|
28
|
+
`;Ke(u,o)}s();async function a(){return new Promise(u=>{const h=document.createElement("div"),f=H`<p>${r.t("htmlSnippetNode.htmlSnippetDeletionConfirm")}</p>`;Ke(f,h);const p=t.createModalDialog({header:r.t("htmlSnippetNode.confirmDeletion"),content:h,footer:(()=>{const m=document.createElement("div"),g=H`
|
|
29
29
|
<button
|
|
30
30
|
class="secondary"
|
|
31
31
|
type="button"
|
|
@@ -40,8 +40,8 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
40
40
|
>
|
|
41
41
|
${r.t("validate")}
|
|
42
42
|
</button>
|
|
43
|
-
`;return
|
|
44
|
-
${
|
|
43
|
+
`;return Ke(g,m),m})()});p.show()})}const l=document.createElement("div"),c=H`
|
|
44
|
+
${n==="update"?H`
|
|
45
45
|
<button
|
|
46
46
|
class="danger outlined"
|
|
47
47
|
type="button"
|
|
@@ -59,11 +59,11 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
59
59
|
</button>
|
|
60
60
|
<button
|
|
61
61
|
type="button"
|
|
62
|
-
@click=${()=>{d.close({action:
|
|
62
|
+
@click=${()=>{d.close({action:n,values:{html:i}})}}
|
|
63
63
|
>
|
|
64
64
|
${r.t("validate")}
|
|
65
65
|
</button>
|
|
66
|
-
`;
|
|
66
|
+
`;Ke(c,l);const d=t.createModalDialog({header:r.t("htmlSnippetNode.htmlSnippet"),content:o,footer:l});return await d.open()}const xx=ye.create({name:"htmlSnippet",group:"block",atom:!0,draggable:!0,selectable:!1,addOptions(){return{service:void 0,i18n:void 0}},addAttributes(){return{html:{default:""}}},parseHTML(){return[{tag:'div[data-pa-node="htmlSnippet"]',getAttrs:t=>({html:t.dataset.html||""})}]},renderHTML({node:t}){return["div",{"data-pa-node":"htmlSnippet","data-html":t.attrs.html,role:"button",tabindex:"0",class:"HtmlSnippet"},"<HTML>"]},addNodeView(){return({node:t,editor:e,getPos:n})=>{const r=this.options.service,i=this.options.i18n;if(!r)throw new Error("HtmlSnippetNode: service not provided in options");if(!i)throw new Error("HtmlSnippetNode: i18n not provided in options");const o=document.createElement("div");o.className="HtmlSnippet",o.setAttribute("data-pa-node","htmlSnippet"),o.setAttribute("data-html",t.attrs.html),o.textContent="<HTML>",o.setAttribute("contenteditable","false"),o.setAttribute("role","button"),o.setAttribute("tabindex","0");async function s(){const l=n();if(typeof l!="number")return;const c=await qf({service:r,initialValues:t.attrs,mode:"update",i18n:i});if(!c){e.commands.setTextSelection(l+t.nodeSize),e.commands.focus();return}if(c.action==="remove")e.commands.deleteRange({from:l,to:l+t.nodeSize});else if(c.action==="update"&&c.values){const{view:d}=e;d.dispatch(d.state.tr.setNodeMarkup(l,void 0,{...t.attrs,...c.values})),e.commands.setTextSelection(l+t.nodeSize),e.commands.focus()}}const a=()=>{s().catch(l=>{r.logger.error("[HtmlSnippetNode] Error handling click:",l)})};return o.addEventListener("click",a),{dom:o,contentDOM:void 0,update:()=>!1,destroy:()=>{o.removeEventListener("click",a)}}}},addCommands(){return{insertHtmlSnippet:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}}}),Sx=Tt`
|
|
67
67
|
.HtmlSnippet {
|
|
68
68
|
border: 1px solid #ccc;
|
|
69
69
|
border-radius: 3px;
|
|
@@ -87,7 +87,7 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
87
87
|
padding: 8px 12px;
|
|
88
88
|
width: fit-content;
|
|
89
89
|
}
|
|
90
|
-
`,
|
|
90
|
+
`,Cx=ye.create({name:"internalLink",group:"inline",inline:!0,atom:!0,addOptions(){return{service:void 0,i18n:void 0,internalLinkPluginHook:void 0}},addAttributes(){return{documentId:{default:"",parseHTML:t=>t.dataset.documentId||"",renderHTML:t=>({"data-document-id":t.documentId})}}},parseHTML(){return[{tag:"span[data-internal-link]"}]},renderHTML({HTMLAttributes:t}){return["span",{...t,class:"InternalLink","data-internal-link":"true"}]},addCommands(){return{insertInternalLink:t=>({commands:e})=>e.insertContent({type:this.name,attrs:{documentId:t}})}},addProseMirrorPlugins(){const t=this.options.service,e=this.options.i18n,n=this.options.internalLinkPluginHook;if(!t||!e||!n)return[];function r(o,s,a){const{tr:l}=o.state,c=s+a;l.setSelection(P.create(l.doc,c)),o.dispatch(l),o.focus()}const i=async(o,s,a)=>{if(!a.target.classList.contains("InternalLink"))return!1;const{state:c}=o,d=c.doc.resolve(s),u=d.parent.type.name==="internalLink"?d.parent:d.nodeAfter;if(!u||u.type.name!=="internalLink")return!1;const h=u.attrs.documentId,f=await n.openDialog(h||"",{getLanguage:()=>t.language});let p=s;if(d.parent.type.name==="internalLink"&&(p=d.before()),!f)return r(o,p,u.nodeSize),!0;const{tr:m}=c;return f.documentId?(await Tx(o,p,u.nodeSize,f.documentId,n,t),r(o,p,u.nodeSize),!0):(m.delete(p,p+u.nodeSize),o.dispatch(m),!0)};return[new Q({key:new ae("internalLinkClickHandler"),props:{handleClick(o,s,a){return i(o,s,a),!1}}})]},onBeforeCreate(){const t=this.options.internalLinkPluginHook,e=this.options.service;if(!t||!e)return;const n=async r=>{const i=this.editor.view.dom.querySelectorAll("span[data-internal-link]");for(const o of i){const s=o.dataset.documentId;if(s&&!(r&&o.textContent))try{const a=await t.getDocumentTitle(s);a&&(o.textContent=a)}catch(a){e.logger.error("[InternalLinkNode] Error fetching title:",a)}}};this.editor.on("create",()=>{n(!1)}),this.editor.on("update",()=>{n(!0)})}});async function Tx(t,e,n,r,i,o){try{if(!await i.getDocumentTitle(r))return;const{tr:a,schema:l}=t.state;a.delete(e,e+n),a.insert(e,l.nodes.internalLink.create({documentId:r})),t.dispatch(a)}catch(s){o.logger.error("[InternalLinkNode] Error fetching title:",s)}}const Mx=Tt`
|
|
91
91
|
.InternalLink {
|
|
92
92
|
background-color: #e3f2fd;
|
|
93
93
|
border-bottom: 2px solid #2196f3;
|
|
@@ -99,13 +99,13 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
99
99
|
.InternalLink:hover {
|
|
100
100
|
background-color: #bbdefb;
|
|
101
101
|
}
|
|
102
|
-
`;class
|
|
102
|
+
`;class la extends Rf{constructor(e){if(super(e),this.it=me,e.type!==Of.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===me||e==null)return this._t=void 0,this.it=e;if(e===Pn)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const n=[e];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}la.directiveName="unsafeHTML",la.resultType=1;const Gf=If(la),Ax='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-external-link-icon lucide-external-link"><path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg>',Nx=["pdf","txt"];function Md(t,e){const n=e.match(/\.([^./?#]+)(?:[?#]|$)/);if(n){const a=n[1].toLowerCase();if(Nx.includes(a))return!0}if(e.startsWith("/"))return!1;const r=/^https?:\/\/([^/]+)/,i=e.match(r);if(!i)return!1;const[,o]=i;return o.split(":")[0]!==t}async function Jf({service:t,i18n:e,initialLabel:n="",initialHref:r="",initialTarget:i,mode:o}){let s=n,a=r,l=i==="_blank",c=o==="update";o==="insert"&&a&&!i&&(l=Md(t.fqdn,a));const d=document.createElement("div");function u(){const m=H`
|
|
103
103
|
<label class="TpField">
|
|
104
104
|
<span class="TpField-label">${e.t("linkDialog.label")}</span>
|
|
105
105
|
<input
|
|
106
106
|
type="text"
|
|
107
|
-
.value=${
|
|
108
|
-
@input=${g=>{
|
|
107
|
+
.value=${s}
|
|
108
|
+
@input=${g=>{s=g.target.value,u()}}
|
|
109
109
|
/>
|
|
110
110
|
</label>
|
|
111
111
|
|
|
@@ -115,10 +115,10 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
115
115
|
<input
|
|
116
116
|
type="text"
|
|
117
117
|
.value=${a}
|
|
118
|
-
@input=${g=>{a=g.target.value,!c&&a&&(l=
|
|
118
|
+
@input=${g=>{a=g.target.value,!c&&a&&(l=Md(t.fqdn,a)),u()}}
|
|
119
119
|
/>
|
|
120
120
|
</label>
|
|
121
|
-
${a?
|
|
121
|
+
${a?H`
|
|
122
122
|
<a
|
|
123
123
|
class="secondary outlined"
|
|
124
124
|
href=${a}
|
|
@@ -127,7 +127,7 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
127
127
|
title=${e.t("linkDialog.openLink")}
|
|
128
128
|
style="padding: 0.5rem; min-height: 35px; display: flex; align-items: center; justify-content: center;"
|
|
129
129
|
>
|
|
130
|
-
${
|
|
130
|
+
${Gf(Ax)}
|
|
131
131
|
</a>
|
|
132
132
|
`:""}
|
|
133
133
|
</div>
|
|
@@ -142,8 +142,8 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
142
142
|
/>
|
|
143
143
|
<span>${e.t("linkDialog.openInNewTab")}</span>
|
|
144
144
|
</label>
|
|
145
|
-
`;
|
|
146
|
-
${
|
|
145
|
+
`;Ke(m,d)}u();const h=document.createElement("div"),f=H`
|
|
146
|
+
${o==="update"?H`
|
|
147
147
|
<button
|
|
148
148
|
class="danger outlined"
|
|
149
149
|
type="button"
|
|
@@ -154,20 +154,20 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
154
154
|
`:""}
|
|
155
155
|
<button
|
|
156
156
|
type="button"
|
|
157
|
-
@click=${()=>{!
|
|
157
|
+
@click=${()=>{!s||!a||p.close({action:o,values:{label:s,href:a,target:l?"_blank":void 0}})}}
|
|
158
158
|
>
|
|
159
159
|
${e.t("linkDialog.validate")}
|
|
160
160
|
</button>
|
|
161
|
-
`;
|
|
161
|
+
`;Ke(f,h);const p=t.createModalDialog({header:o==="insert"?e.t("linkDialog.insertLink"):e.t("linkDialog.editLink"),content:d,footer:h});return await p.open()}const _x=Ov.extend({addOptions(){return{...this.parent?.(),service:void 0,i18n:void 0}},addAttributes(){return{href:{default:null,parseHTML:t=>t.getAttribute("href")},target:{default:null,parseHTML:t=>t.getAttribute("target"),renderHTML:t=>t.target?{target:t.target}:{}},rel:{default:null,parseHTML:()=>null,renderHTML:()=>({})},class:{default:null,parseHTML:()=>null,renderHTML:()=>({})}}},addProseMirrorPlugins(){const t=this.parent?.()||[],e=this.options.service,n=this.options.i18n;if(!e||!n)return t;const r=(o,s)=>{const{state:a}=o,l=a.doc.resolve(s),d=l.marks().find(m=>m.type.name==="link");if(!d)return!1;const u=nr(l,d.type);if(!u)return!1;const{from:h,to:f}=u;return!(f-h>1&&(s<=h||s>=f))},i=async(o,s,a)=>{if(!r(o,s))return!1;a.preventDefault(),a.stopPropagation();const{state:l}=o,c=l.doc.resolve(s),u=c.marks().find(k=>k.type.name==="link");if(!u)return!1;const h=nr(c,u.type);if(!h)return!1;const{from:f,to:p}=h,m=u.attrs.href,g=u.attrs.target,b=l.doc.textBetween(f,p,"");try{const k=await Jf({service:e,i18n:n,initialLabel:b,initialHref:m,initialTarget:g,mode:"update"});if(!k)return o.focus(),!0;const{tr:w}=l;if(k.action==="remove")w.removeMark(f,p,u.type);else if(k.action==="update"&&k.values){w.removeMark(f,p,u.type),k.values.label!==b&&w.replaceWith(f,p,l.schema.text(k.values.label));const x=f+k.values.label.length;w.addMark(f,x,u.type.create({href:k.values.href,target:k.values.target}))}return o.dispatch(w),o.focus(),!0}catch(k){return e.logger.error("[CustomLink] Error handling click:",k),o.focus(),!0}};return[...t,new Q({key:new ae("linkClickHandler"),props:{handleClick(o,s,a){return r(o,s)?(i(o,s,a),!0):!1}}})]}});function Zf(t,e){return t.chain().focus().insertContent({type:"media",attrs:e}).run()}function Ox(t,e,n,r,i,o){const s=e.clipboardData?.getData("text/plain");if(s&&o){const u=o.recognizeUrl(s);if(u)return e.preventDefault(),n?.chain().focus().insertPlatformVideo(u).run(),!0}const a=e.clipboardData?.items;if(!a)return!1;const l=[];for(const u of Array.from(a))if(u.type.startsWith("image/")){const h=u.getAsFile();h&&l.push(h)}if(l.length===0)return!1;e.preventDefault();const c=10,d=l.slice(0,c);return l.length>c&&r.showAlert(i.t("tooManyImages",{count:String(c)}),{severity:"warning",autoDismiss:!0}),Yf(d,n,r,i),!0}function Ix(t,e,n,r,i){const o=e.dataTransfer?.files;if(!o||o.length===0)return!1;const s=[];for(const u of Array.from(o))u.type.startsWith("image/")&&s.push(u);if(s.length===0)return!1;e.preventDefault();const a={left:e.clientX,top:e.clientY},l=t.posAtCoords(a);l&&n?.commands.setTextSelection(l.pos);const c=10,d=s.slice(0,c);return s.length>c&&r.showAlert(i.t("tooManyImages",{count:String(c)}),{severity:"warning",autoDismiss:!0}),Yf(d,n,r,i),!0}async function Yf(t,e,n,r){for(const i of t)await Rx(i,e,n,r)}async function Rx(t,e,n,r){if(!n.uploadMedia){n.logger.warn("uploadMedia not available"),n.showAlert(r.t("uploadNotAvailable"),{severity:"error",autoDismiss:!0});return}try{const i=await n.uploadMedia(t);if(!i||i.kind!=="image"){n.logger.error("Failed to upload image or not an image"),n.showAlert(r.t("imageUploadFailed"),{severity:"error",autoDismiss:!0});return}const o=n.themeConf.fTextImageResizeRules[0];if(!e){n.logger.error("Editor not initialized");return}Zf(e,{mediaId:i.mediaId,resizeRule:o,align:"center",zoomable:!0,href:void 0})}catch(i){n.logger.error("Error uploading image:",i),n.showAlert(r.t("imageUploadFailed"),{severity:"error"})}}function ca(t){const e=document.createElement("span");return e.className=t?.center?"TpSpinner center":"TpSpinner",e}async function Lx({service:t,fetchedOutput:e,initialValues:n,i18n:r}){const{mediaId:i}=n,{themeConf:o}=t;let s=n.resizeRule,a=n.align,l=n.zoomable,c=!!n.href,d=n.href??"",u;const h=o.fTextImageResizeRules.map((w,x)=>({resizeRule:w,label:r.t("mediaNode.variantLabel",{n:String(x+1)})})),f=[{align:"left",label:r.t("mediaNode.left")},{align:"center",label:r.t("mediaNode.center")},{align:"right",label:r.t("mediaNode.right")}],p=document.createElement("div");p.classList.add("_paForm");function m(){const w=H`
|
|
162
162
|
<div class="PaField">
|
|
163
163
|
<h2 class="PaField-label">${r.t("mediaNode.sizes")}</h2>
|
|
164
164
|
<div class="TpOption">
|
|
165
|
-
${h.map(x=>
|
|
165
|
+
${h.map(x=>H`
|
|
166
166
|
<button
|
|
167
167
|
type="button"
|
|
168
|
-
class="${x.resizeRule===
|
|
168
|
+
class="${x.resizeRule===s?"primary":"secondary outlined"}"
|
|
169
169
|
?disabled=${!i}
|
|
170
|
-
@click=${()=>{
|
|
170
|
+
@click=${()=>{s=x.resizeRule,m(),g()}}
|
|
171
171
|
>
|
|
172
172
|
${x.label} <small class="ml-1">(${x.resizeRule.replace("x","×")})</small>
|
|
173
173
|
</button>
|
|
@@ -178,7 +178,7 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
178
178
|
<div class="PaField">
|
|
179
179
|
<h2 class="PaField-label">${r.t("mediaNode.alignment")}</h2>
|
|
180
180
|
<div class="TpOption">
|
|
181
|
-
${f.map(x=>
|
|
181
|
+
${f.map(x=>H`
|
|
182
182
|
<button
|
|
183
183
|
type="button"
|
|
184
184
|
class="${x.align===a?"primary":"secondary outlined"}"
|
|
@@ -202,7 +202,7 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
202
202
|
/>
|
|
203
203
|
${r.t("mediaNode.link")}
|
|
204
204
|
</label>
|
|
205
|
-
${c?
|
|
205
|
+
${c?H`
|
|
206
206
|
<input
|
|
207
207
|
class="TpCheckbox-input"
|
|
208
208
|
type="text"
|
|
@@ -212,7 +212,7 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
212
212
|
`:""}
|
|
213
213
|
</div>
|
|
214
214
|
|
|
215
|
-
${c?"":
|
|
215
|
+
${c?"":H`
|
|
216
216
|
<label class="TpCheckbox">
|
|
217
217
|
<input
|
|
218
218
|
type="checkbox"
|
|
@@ -230,18 +230,18 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
230
230
|
<dl class="TpProp">
|
|
231
231
|
<dt>${r.t("mediaNode.caption")}:</dt>
|
|
232
232
|
<dd>
|
|
233
|
-
${u?u.source.attachedData?.[
|
|
233
|
+
${u?u.source.attachedData?.[t.language]?.caption??"-":ca()}
|
|
234
234
|
</dd>
|
|
235
235
|
</dl>
|
|
236
236
|
<dl class="TpProp">
|
|
237
237
|
<dt>${r.t("mediaNode.pixelRatio")}:</dt>
|
|
238
238
|
<dd>
|
|
239
|
-
${u?u.source.pixelRatio?`${u.source.pixelRatio}×`:r.t("auto"):
|
|
239
|
+
${u?u.source.pixelRatio?`${u.source.pixelRatio}×`:r.t("auto"):ca()}
|
|
240
240
|
</dd>
|
|
241
241
|
</dl>
|
|
242
242
|
</div>
|
|
243
243
|
</div>
|
|
244
|
-
`;
|
|
244
|
+
`;Ke(w,p)}async function g(){try{const w=await t.useAdminUiImage(i,{resizeRule:s});w&&(e.source=w.source,u=w,m())}catch(w){t.logger.error("Error fetching media:",w)}}m(),g();const b=document.createElement("div");b.classList.add("PaButtonBar","spaceBetween","_paForm"),Ke(H`
|
|
245
245
|
<button
|
|
246
246
|
type="button"
|
|
247
247
|
class="danger"
|
|
@@ -251,14 +251,14 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
251
251
|
</button>
|
|
252
252
|
<button
|
|
253
253
|
type="button"
|
|
254
|
-
?disabled=${!i||a===void 0||!
|
|
255
|
-
@click=${()=>{k.close({action:"update",values:{mediaId:i,align:a,resizeRule:
|
|
254
|
+
?disabled=${!i||a===void 0||!s}
|
|
255
|
+
@click=${()=>{k.close({action:"update",values:{mediaId:i,align:a,resizeRule:s,zoomable:l,href:c&&d.trim()||void 0}})}}
|
|
256
256
|
>
|
|
257
257
|
${r.t("validate")}
|
|
258
258
|
</button>
|
|
259
|
-
`,b);const k=
|
|
259
|
+
`,b);const k=t.createModalDialog({header:r.t("mediaNode.imageProperties"),content:p,footer:b});return await k.open()}async function Dx({service:t,i18n:e}){const n=document.createElement("div");Ke(H`
|
|
260
260
|
<p>${e.t("mediaNode.imageNoLongerExists")}</p>
|
|
261
|
-
`,
|
|
261
|
+
`,n);const r=document.createElement("div");r.classList.add("PaButtonBar","spaceBetween","_paForm"),Ke(H`
|
|
262
262
|
<button
|
|
263
263
|
type="button"
|
|
264
264
|
class="outlined"
|
|
@@ -273,7 +273,7 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
273
273
|
>
|
|
274
274
|
${e.t("remove")}
|
|
275
275
|
</button>
|
|
276
|
-
`,r);const i=
|
|
276
|
+
`,r);const i=t.createModalDialog({header:e.t("mediaNode.removedImage"),content:n,footer:r});return await i.open()}const $x=ye.create({name:"media",group:"block",atom:!0,draggable:!0,addOptions(){return{service:void 0,getLanguage:void 0,i18n:void 0}},addAttributes(){return{mediaId:{default:null},resizeRule:{default:null},align:{default:"center"},zoomable:{default:!1},href:{default:null}}},parseHTML(){return[{tag:'figure[data-pa-node="media"]',getAttrs:t=>{const e=t,n=e.dataset.mediaId,r=e.dataset.resize,i=e.dataset.zoomable==="1",o=e.dataset.href||null;let s="center";return e.classList.contains("left")?s="left":e.classList.contains("right")?s="right":e.classList.contains("center")&&(s="center"),{mediaId:n,resizeRule:r,align:s,zoomable:i,href:o}}}]},renderHTML({node:t}){return["figure",{"data-pa-node":"media","data-media-id":t.attrs.mediaId,"data-resize":t.attrs.resizeRule,...t.attrs.zoomable?{"data-zoomable":"1"}:{},"data-href":t.attrs.href||null,class:`MediaNode Fig ${Ad(t.attrs.align)}`}]},addNodeView(){return({node:t,editor:e,getPos:n})=>{const r=this.options.service,i=this.options.getLanguage,o=this.options.i18n;if(!r)throw new Error("MediaNode: service not provided in options");if(!o)throw new Error("MediaNode: i18n not provided in options");const s=document.createElement("figure");s.setAttribute("data-pa-node","media"),s.setAttribute("contenteditable","false");const a=ca({center:!0});s.appendChild(a);let l,c,d,u,h=!1;async function f(b){try{if(b.mediaId!==d||b.resizeRule!==u){d=b.mediaId,u=b.resizeRule;const k=await r.useAdminUiImage(b.mediaId,{resizeRule:b.resizeRule});if(!k){r.logger.warn(`Media ${b.mediaId} not found`),h=!0,s.contains(a)&&s.removeChild(a);const re=s.querySelector("img");re&&re.remove();const ke=s.querySelector("figcaption");ke&&ke.remove();const Ae=s.querySelector(".MediaNode-broken");Ae&&Ae.remove();const Z=Bx(b.resizeRule,o);s.appendChild(Z),l||(l=()=>{g().catch(J=>{r.logger.error("[MediaNode] Error handling broken media click:",J)})},s.addEventListener("click",l)),p(b);return}h=!1,c=k.source;const{source:w,variant:x}=k,v=s.querySelector("img");v&&v.remove();const T=s.querySelector(".MediaNode-broken");T&&T.remove();const A=document.createElement("img");A.className="Fig-media",A.src=x.url,A.width=x.width,A.height=x.height;const R=i?.()??r.language,F=w.attachedData?.[R]?.caption,ne=s.querySelector("figcaption");if(ne&&ne.remove(),F){const re=document.createElement("figcaption");re.className="Fig-caption",re.textContent=F,s.appendChild(re)}s.contains(a)&&s.removeChild(a),s.appendChild(A),l||(l=()=>{h?g().catch(re=>{r.logger.error("[MediaNode] Error handling broken media click:",re)}):c&&m(c).catch(re=>{r.logger.error("[MediaNode] Error handling media click:",re)})},s.addEventListener("click",l))}p(b)}catch(k){r.logger.error("[MediaNode] Error setting up media:",k),s.contains(a)&&s.removeChild(a)}}function p(b){s.className=`MediaNode Fig ${Ad(b.align)}`,s.setAttribute("data-media-id",b.mediaId),s.setAttribute("data-resize",b.resizeRule),b.zoomable?s.setAttribute("data-zoomable","1"):s.removeAttribute("data-zoomable"),b.href?s.setAttribute("data-href",b.href):s.removeAttribute("data-href");const k=s.querySelector(".MediaNode-flags");k&&k.remove(),c&&Px(s,c,b)}async function m(b){const k=n();if(typeof k!="number")return;const w=e.state.doc.nodeAt(k);if(!w)return;const x={source:b},v=await Lx({service:r,initialValues:w.attrs,fetchedOutput:x,i18n:o});if(v){if(v.action==="remove")e.commands.deleteRange({from:k,to:k+w.nodeSize});else if(v.action==="update"&&v.values){const{view:T}=e;T.dispatch(T.state.tr.setNodeMarkup(k,void 0,{...w.attrs,...v.values})),e.commands.focus()}}}async function g(){const b=n();if(typeof b!="number")return;const k=e.state.doc.nodeAt(b);if(!k)return;(await Dx({service:r,i18n:o}))?.action==="remove"&&e.commands.deleteRange({from:b,to:b+k.nodeSize})}return f(t.attrs),{dom:s,contentDOM:void 0,update:b=>b.type.name!=="media"?!1:(f(b.attrs),!0),destroy:()=>{l&&s.removeEventListener("click",l)}}}},addCommands(){return{insertMedia:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}}});function Ad(t){return t==="center"?"center":t==="left"?"left":t==="right"?"right":""}function Px(t,e,n){const r=document.createElement("div");if(r.classList.add("MediaNode-flags"),e.pixelRatio!==void 0){const i=document.createElement("span");i.classList.add("MediaNode-flag","Fig-flag--pixelRatio"),i.textContent=`${e.pixelRatio}×`,r.appendChild(i)}if(n.zoomable){const i=document.createElement("span");i.classList.add("MediaNode-flag"),i.innerHTML=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5">\n <circle cx="6.5" cy="6.5" r="5"/>\n <path d="m10.04 10.04 4.46 4.46"/>\n</svg>`,r.appendChild(i)}if(n.href){const i=document.createElement("span");i.classList.add("MediaNode-flag"),i.innerHTML=`<svg width="22" height="22" viewBox="0 0 16 16" fill="currentColor">\n <path d="M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1.002 1.002 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4.018 4.018 0 0 1-.128-1.287z"/>\n <path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243L6.586 4.672z"/>\n</svg>`,r.appendChild(i)}t.appendChild(r)}function Bx(t,e){const[n,r]=zx(t),i=document.createElement("div");return i.className="MediaNode-broken",i.style.width=`${n}px`,i.style.height=`${r}px`,i.innerHTML=`\n <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">\n <rect x="3" y="3" width="18" height="18" rx="2" />\n <path d="M9 9l6 6M15 9l-6 6" />\n </svg>\n <span>${e.t("mediaNode.removedImage")}</span>\n `,i}function zx(t){const e=t.match(/^x(\d+)x$/);if(e){const o=Number.parseInt(e[1],10);return[o,o]}const n=t.match(/^(\d+)x(\d+)$/);if(n)return[Number.parseInt(n[1],10),Number.parseInt(n[2],10)];const r=t.match(/^(\d+)x$/);if(r){const o=Number.parseInt(r[1],10);return[o,Math.round(o*2/3)]}const i=t.match(/^x(\d+)$/);if(i){const o=Number.parseInt(i[1],10);return[Math.round(o*2/3),o]}return[300,200]}const Hx=Tt`
|
|
277
277
|
.MediaNode {
|
|
278
278
|
cursor: default;
|
|
279
279
|
position: relative;
|
|
@@ -370,13 +370,13 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
370
370
|
opacity: .6;
|
|
371
371
|
text-align: center;
|
|
372
372
|
}
|
|
373
|
-
`;function
|
|
373
|
+
`;function Xf(t){return Fx(t)||cl(t)}function cl(t){return!!t.match(/^[a-zA-Z0-9. _-]+@[a-zA-Z0-9. -]+\.[a-zA-Z]{2,4}$/g)}function Fx(t){return!!t.match(/^(\+|00)[1-9][0-9 \-().]{7,32}$/)}function Ux(t){return Xf(t)?cl(t)?"mailto":"tel":"raw"}async function da({service:t,i18n:e,initialContent:n,initialAsALink:r,mode:i}){let o=n,s=r!=="raw";const a=document.createElement("div");function l(){const h=H`
|
|
374
374
|
<label class="TpField">
|
|
375
375
|
<span class="TpField-label">${e.t("obfuscateMark.content")}</span>
|
|
376
376
|
<input
|
|
377
377
|
type="text"
|
|
378
|
-
.value=${
|
|
379
|
-
@input=${f=>{
|
|
378
|
+
.value=${o}
|
|
379
|
+
@input=${f=>{o=f.target.value,Xf(o)?s=!0:s=!1,l()}}
|
|
380
380
|
/>
|
|
381
381
|
</label>
|
|
382
382
|
|
|
@@ -384,14 +384,14 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
384
384
|
<input
|
|
385
385
|
type="checkbox"
|
|
386
386
|
class="M2"
|
|
387
|
-
.checked=${
|
|
388
|
-
@change=${f=>{
|
|
387
|
+
.checked=${s}
|
|
388
|
+
@change=${f=>{s=f.target.checked,l()}}
|
|
389
389
|
style="width: auto; min-height: auto;"
|
|
390
390
|
/>
|
|
391
391
|
<span>${e.t("obfuscateMark.asALink")}</span>
|
|
392
392
|
</label>
|
|
393
|
-
`;
|
|
394
|
-
${i==="update"?
|
|
393
|
+
`;Ke(h,a)}l();const c=document.createElement("div"),d=H`
|
|
394
|
+
${i==="update"?H`
|
|
395
395
|
<button
|
|
396
396
|
class="danger outlined"
|
|
397
397
|
type="button"
|
|
@@ -402,11 +402,11 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
402
402
|
`:""}
|
|
403
403
|
<button
|
|
404
404
|
type="button"
|
|
405
|
-
@click=${()=>{const h=
|
|
405
|
+
@click=${()=>{const h=s?cl(o)?"mailto":"tel":"raw";u.close({action:i,values:{content:o,asALink:h}})}}
|
|
406
406
|
>
|
|
407
407
|
${e.t("obfuscateMark.done")}
|
|
408
408
|
</button>
|
|
409
|
-
`;
|
|
409
|
+
`;Ke(d,c);const u=t.createModalDialog({header:e.t("obfuscateMark.obfuscator"),content:a,footer:c});return await u.open()}const Vx=lt.create({name:"obfuscate",addOptions(){return{service:void 0,i18n:void 0}},addAttributes(){return{asALink:{default:"raw",parseHTML:t=>t.getAttribute("data-as-a-link")||"raw",renderHTML:t=>({"data-as-a-link":t.asALink})}}},parseHTML(){return[{tag:"span.Obfuscate",getAttrs:t=>({asALink:t.dataset.asALink||"raw"})}]},renderHTML({HTMLAttributes:t}){return["span",{...t,class:"Obfuscate"},0]},addCommands(){return{setObfuscate:t=>({commands:e})=>e.setMark(this.name,{asALink:t}),toggleObfuscate:()=>({commands:t})=>t.toggleMark(this.name),unsetObfuscate:()=>({commands:t})=>t.unsetMark(this.name)}},addProseMirrorPlugins(){const t=this.options.service,e=this.options.i18n;if(!t||!e)return[];const n=async(r,i,o)=>{const s=o.target;if(!s.classList.contains("Obfuscate"))return!1;const{state:a}=r,l=a.doc.resolve(i),d=l.marks().find(f=>f.type.name==="obfuscate");if(!d)return!1;const u=s.textContent||"",h=d.attrs.asALink;try{const f=await da({service:t,i18n:e,initialContent:u,initialAsALink:h,mode:"update"});if(!f)return!0;const p=nr(l,d.type);if(!p)return!0;const{from:m,to:g}=p,{tr:b}=a;return f.action==="remove"?b.removeMark(m,g,d.type):f.action==="update"&&f.values?.content&&(b.removeMark(m,g,d.type),b.replaceWith(m,g,a.schema.text(f.values.content)),b.addMark(m,m+f.values.content.length,d.type.create({asALink:f.values.asALink}))),r.dispatch(b),!0}catch(f){return t.logger.error("[ObfuscateMark] Error handling click:",f),!0}};return[new Q({key:new ae("obfuscateClickHandler"),props:{handleClick(r,i,o){return n(r,i,o),!1}}})]}}),Wx=Tt`
|
|
410
410
|
.Obfuscate {
|
|
411
411
|
background-color: #fff3cd;
|
|
412
412
|
padding: 2px 4px;
|
|
@@ -417,8 +417,8 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
417
417
|
.Obfuscate:hover {
|
|
418
418
|
background-color: #ffe69c;
|
|
419
419
|
}
|
|
420
|
-
`;function
|
|
421
|
-
${
|
|
420
|
+
`;function Kx(t,e){const{state:n}=t,{selection:r}=n,{$from:i}=r;if(!r.empty)return;const o=i.pos;if(o===0)return;const s=n.doc.textBetween(o-1,o);if(s!==" "&&s!==`\n`)return;const a=i.parent;if(a.type.name!=="paragraph"&&a.type.name!=="heading"||i.marks().some(b=>b.type.name==="link"))return;const c=a.textContent,d=i.parentOffset;let u=d-2;for(;u>0&&c[u-1]&&!/\s/.test(c[u-1]);)--u;const h=c.slice(u,d-1);if(!h)return;const f=e.recognizeUrl(h);if(!f)return;const m=i.start()+u,g=o;t.chain().deleteRange({from:m,to:g}).insertPlatformVideo(f).run()}const Qf='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube</title><path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"/></svg>';async function ep({service:t,i18n:e,mode:n,value:r,videoPluginHook:i}){let o=r;const s=document.createElement("div"),{element:a,dispose:l}=i.createComponent(r,{onChange(h){o=h},getLanguage:()=>t.language});s.appendChild(a);const c=document.createElement("div");c.style.display="flex",c.style.gap="8px",c.style.justifyContent="flex-end";function d(){const h=H`
|
|
421
|
+
${n==="update"?H`
|
|
422
422
|
<button
|
|
423
423
|
type="button"
|
|
424
424
|
class="outlined danger"
|
|
@@ -436,11 +436,11 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
436
436
|
</button>
|
|
437
437
|
<button
|
|
438
438
|
type="button"
|
|
439
|
-
@click=${()=>{l(),
|
|
439
|
+
@click=${()=>{l(),o===null?u.close({action:"remove"}):u.close({action:n,value:o})}}
|
|
440
440
|
>
|
|
441
441
|
${e.t("validate")}
|
|
442
442
|
</button>
|
|
443
|
-
`;
|
|
443
|
+
`;Ke(h,c)}d();const u=t.createModalDialog({header:e.t("platformVideo.videoDialog"),content:s,footer:c});return await u.open()}const jx=ye.create({name:"platformVideo",group:"block",atom:!0,draggable:!0,addOptions(){return{service:void 0,i18n:void 0,videoPluginHook:void 0}},addAttributes(){return{videoId:{default:""},platform:{default:"youtube"}}},parseHTML(){return[{tag:'div[data-pa-node="platformVideo"]',getAttrs:t=>{const e=t,n=e.dataset.videoId||"",r=e.dataset.platform||"youtube";return{videoId:n,platform:r}}}]},renderHTML({node:t}){return["div",{"data-pa-node":"platformVideo","data-video-id":t.attrs.videoId,"data-platform":t.attrs.platform,class:"PlatformVideo"},0]},addNodeView(){return({node:t,editor:e,getPos:n})=>{const r=this.options.service,i=this.options.i18n,o=this.options.videoPluginHook;if(!r)throw new Error("PlatformVideoNode: service not provided in options");if(!i)throw new Error("PlatformVideoNode: i18n not provided in options");if(!o)throw new Error("PlatformVideoNode: videoPluginHook not provided in options");const s=document.createElement("div");s.className="PlatformVideo",s.setAttribute("data-pa-node","platformVideo"),s.setAttribute("data-video-id",t.attrs.videoId),s.setAttribute("data-platform",t.attrs.platform),s.setAttribute("contenteditable","false");const a=o.getThumbnailUrl({videoId:t.attrs.videoId,platform:t.attrs.platform});s.style.backgroundImage=`url(${a})`;const l=document.createElement("div");l.className="PlatformVideo-playButton",l.innerHTML=Qf;const c=l.querySelector("svg");c&&(c.setAttribute("width","48"),c.setAttribute("height","48"),c.setAttribute("fill","white")),s.appendChild(l);async function d(){const h=await ep({service:r,i18n:i,mode:"update",value:{videoId:t.attrs.videoId,platform:t.attrs.platform},videoPluginHook:o});if(h)if(h.action==="remove"){const f=n();typeof f=="number"&&e.commands.deleteRange({from:f,to:f+t.nodeSize})}else h.action==="update"&&h.value&&typeof n()=="number"&&e.chain().updateAttributes(t.type.name,{videoId:h.value.videoId,platform:h.value.platform}).run()}const u=()=>{d().catch(h=>{r.logger.error("Error handling PlatformVideo click:",h)})};return s.addEventListener("click",u),{dom:s,contentDOM:void 0,update:()=>!1,destroy:()=>{s.removeEventListener("click",u)}}}},addCommands(){return{insertPlatformVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}}}),qx=Tt`
|
|
444
444
|
.PlatformVideo {
|
|
445
445
|
background-size: cover;
|
|
446
446
|
background-position: center;
|
|
@@ -470,10 +470,10 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
470
470
|
.PlatformVideo:hover .PlatformVideo-playButton {
|
|
471
471
|
background: rgba(0, 0, 0, 0.9);
|
|
472
472
|
}
|
|
473
|
-
`,
|
|
473
|
+
`,Gx=lt.create({name:"textSize",addAttributes(){return{value:{default:null,parseHTML:t=>t.classList.contains("text-size-small")?"small":t.classList.contains("text-size-large")?"large":t.classList.contains("text-size-huge")?"huge":null,renderHTML:t=>t.value?{class:`text-size-${t.value}`}:{}}}},keepOnSplit:!1,parseHTML(){return[{tag:"span.text-size-small"},{tag:"span.text-size-large"},{tag:"span.text-size-huge"}]},renderHTML({HTMLAttributes:t}){return["span",t,0]}});var Jx=Object.defineProperty,Zx=Object.getOwnPropertyDescriptor,hn=(t,e,n,r)=>{for(var i=r>1?void 0:r?Zx(e,n):e,o=t.length-1,s;o>=0;o--)(s=t[o])&&(i=(r?s(e,n,i):s(i))||i);return r&&i&&Jx(e,n,i),i};const Yx=dk.extend({content:"block*"}),Xx=Va.extend({content:"block*"});let St=class extends sn{firstUpdated(){const n=`calc(${this.service.fieldType.adminUi?.editorRows??26}rem + 79px)`;this.style.setProperty("--content-height",n);const r=this.shadowRoot?.querySelector(".tiptap-content");if(!r)return;const i=this.service.configuration.code??!1;this.editor=new H0({element:r,extensions:[Yx,Ex,aE.configure({document:!1,bulletList:!1,orderedList:!1,listItem:!1,heading:{levels:[2,3,4]},code:i?!1:void 0,codeBlock:i?!1:void 0,link:!1}),Ua,Ka,Xx,_x.configure({openOnClick:!1,service:this.service,i18n:this.i18n}),$w,Nk,Ak,Mk,Bw.configure({types:["heading","paragraph"]}),cf,Gx,Sk,Tk,...this.service.configuration.code?[X0,(()=>{const o=this.i18n;return ck.extend({addNodeView(){return({node:s,editor:a,getPos:l,decorations:c})=>new yx(s,a,l,c,o)}}).configure({lowlight:jf,defaultLanguage:"plaintext",languageClassPrefix:"language-",HTMLAttributes:{class:"code-block"}})})()]:[],$x.configure({service:this.service,getLanguage:()=>this.service.language,i18n:this.i18n}),xx.configure({service:this.service,i18n:this.i18n}),Vx.configure({service:this.service,i18n:this.i18n}),jx.configure({service:this.service,i18n:this.i18n,videoPluginHook:this.videoPluginHook}),Cx.configure({service:this.service,i18n:this.i18n,internalLinkPluginHook:this.internalLinkPluginHook})],content:this.initialContent,editable:!0,editorProps:{handlePaste:(o,s)=>Ox(o,s,this.editor,this.service,this.i18n,this.videoPluginHook),handleDrop:(o,s)=>Ix(o,s,this.editor,this.service,this.i18n)},onCreate:({editor:o})=>{if(o.view.updateState(o.view.state),o.state.doc.content.size>0){const s=o.state.tr,a=P.create(s.doc,1);s.setSelection(a).setMeta("addToHistory",!1),o.view.dispatch(s)}},onUpdate:({editor:o,transaction:s})=>{this.onChange&&this.onChange(o.getJSON()),this.toolbarRef?.refresh(),this.videoPluginHook&&s.docChanged&&Kx(o,this.videoPluginHook)},onSelectionUpdate:()=>{this.toolbarRef?.refresh()}})}disconnectedCallback(){super.disconnectedCallback(),this.editor?.destroy()}setContent(t){this.editor?.commands.setContent(t)}getJSON(){return this.editor?.getJSON()}updateLanguage(t){this.i18n.setLanguage(t),this.toolbarRef?.refresh()}insertMedia(t,e,n,r,i){this.editor&&this.editor.commands.insertMedia({mediaId:t,resizeRule:e,align:n,zoomable:r,href:i})}insertLink(t,e){this.editor&&this.editor.chain().focus().insertContent({type:"text",marks:[{type:"link",attrs:{href:e}}],text:t}).run()}async insertMediaFromGallery(t){if(t.kind==="file"){this.insertLink(t.originalName??t.url,t.url);return}if(t.kind==="image"){const e=this.service.themeConf.fTextImageResizeRules[0];if(!this.editor){this.service.logger.error("Editor not initialized");return}Zf(this.editor,{mediaId:t.mediaId,resizeRule:e,align:"center",zoomable:!0,href:void 0})}}handleContentClick(t){if(!this.editor)return;if(t.target.classList.contains("tiptap-content")){const n=this.editor.state.doc.content.size;this.editor.chain().focus().setTextSelection(n).run()}}render(){return H`
|
|
474
474
|
<div class="tiptap-container">
|
|
475
475
|
<tiptap-toolbar
|
|
476
|
-
${
|
|
476
|
+
${$E(t=>{this.toolbarRef=t})}
|
|
477
477
|
.editor=${this.editor}
|
|
478
478
|
.service=${this.service}
|
|
479
479
|
.i18n=${this.i18n}
|
|
@@ -482,14 +482,7 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
482
482
|
></tiptap-toolbar>
|
|
483
483
|
<div class="tiptap-content" @click=${this.handleContentClick}></div>
|
|
484
484
|
</div>
|
|
485
|
-
`}};
|
|
486
|
-
/* :host {
|
|
487
|
-
display: block;
|
|
488
|
-
background: var(--color-bg);
|
|
489
|
-
border: 1px solid var(--color-border);
|
|
490
|
-
border-radius: var(--radius);
|
|
491
|
-
} */
|
|
492
|
-
|
|
485
|
+
`}};St.styles=[Tt`
|
|
493
486
|
.tiptap-container {
|
|
494
487
|
display: flex;
|
|
495
488
|
flex-direction: column;
|
|
@@ -586,28 +579,28 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
586
579
|
white-space: normal;
|
|
587
580
|
z-index: 10;
|
|
588
581
|
}
|
|
589
|
-
`,
|
|
590
|
-
${
|
|
582
|
+
`,vx,Hx,Sx,Wx,qx,Mx];hn([Me({attribute:!1})],St.prototype,"service",2);hn([Me({attribute:!1})],St.prototype,"i18n",2);hn([Me({attribute:!1})],St.prototype,"videoPluginHook",2);hn([Me({attribute:!1})],St.prototype,"internalLinkPluginHook",2);hn([Me({attribute:!1})],St.prototype,"initialContent",2);hn([Me({attribute:!1})],St.prototype,"onChange",2);hn([Mt()],St.prototype,"editor",2);St=hn([Fo("tiptap-editor")],St);async function Qx(t,e,n){const r=await qf({service:e,initialValues:{html:""},mode:"insert",i18n:n});if(r&&r.action==="insert"&&r.values){const{from:i}=t.state.selection;t.chain().focus().insertHtmlSnippet(r.values).run();const o=i+1;t.state.doc.resolve(o).nodeAfter?t.commands.setTextSelection(o):t.chain().insertContentAt(o,"<p></p>").setTextSelection(o+1).run()}}async function eS(t,e,n){const{state:r}=t,{from:i}=r.selection,s=r.doc.resolve(i).nodeAfter;if(s?.type.name==="internalLink"&&s){const c=s.attrs.documentId,d=await n.openDialog(c||"",{getLanguage:()=>e.language});if(!d)return;d.documentId?t.chain().focus().deleteRange({from:i,to:i+s.nodeSize}).insertInternalLink(d.documentId).run():t.chain().focus().deleteRange({from:i,to:i+s.nodeSize}).run();return}const l=await n.openDialog("",{getLanguage:()=>e.language});!l||!l.documentId||t.chain().focus().deleteSelection().insertInternalLink(l.documentId).run()}async function tS(t,e,n){const{state:r}=t,{from:i,to:o,empty:s}=r.selection;if(s){e.showAlert("Please select text to obfuscate",{severity:"warning",autoDismiss:!0});return}if(t.isActive("obfuscate")){const c=r.selection.$from.marks().find(u=>u.type.name==="obfuscate"),d=r.doc.textBetween(i,o);if(c){const u=await da({service:e,i18n:n,initialContent:d,initialAsALink:c.attrs.asALink,mode:"update"});if(!u)return;u.action==="remove"?t.chain().focus().unsetObfuscate().run():u.action==="update"&&u.values&&t.chain().focus().deleteSelection().insertContent(u.values.content).setTextSelection({from:i,to:i+u.values.content.length}).setObfuscate(u.values.asALink).run()}}else{const l=r.doc.textBetween(i,o),c=Ux(l),d=await da({service:e,i18n:n,initialContent:l,initialAsALink:c,mode:"insert"});if(!d||d.action!=="insert"||!d.values)return;t.chain().focus().deleteSelection().insertContent(d.values.content).setTextSelection({from:i,to:i+d.values.content.length}).setObfuscate(d.values.asALink).run()}}async function nS(t,e,n,r){const i=await ep({service:e,i18n:n,mode:"insert",value:{videoId:"",platform:"youtube"},videoPluginHook:r});i&&i.action==="insert"&&i.value&&t.chain().focus().insertPlatformVideo(i.value).run()}var rS=Object.defineProperty,iS=Object.getOwnPropertyDescriptor,Ze=(t,e,n,r)=>{for(var i=r>1?void 0:r?iS(e,n):e,o=t.length-1,s;o>=0;o--)(s=t[o])&&(i=(r?s(e,n,i):s(i))||i);return r&&i&&rS(e,n,i),i};let Ue=class extends sn{constructor(){super(...arguments),this.options=[],this.buttonTooltip="",this.isOpen=!1,this.highlightedIndex=-1,this.highlightedSubmenuIndex=-1,this.openUpward=!1,this.submenuOpenLeft=!1,this.handleKeydown=t=>{if(!this.isOpen){(t.key==="Enter"||t.key===" "||t.key==="ArrowDown")&&(t.preventDefault(),this.openDropdown());return}if(this.openSubmenuId!==void 0)switch(t.key){case"ArrowDown":{t.preventDefault();const e=this.options[this.highlightedIndex]?.children??[];this.highlightedSubmenuIndex=(this.highlightedSubmenuIndex+1)%e.length;break}case"ArrowUp":{t.preventDefault();const e=this.options[this.highlightedIndex]?.children??[];this.highlightedSubmenuIndex=this.highlightedSubmenuIndex<=0?e.length-1:this.highlightedSubmenuIndex-1;break}case"ArrowLeft":t.preventDefault(),this.openSubmenuId=void 0,this.highlightedSubmenuIndex=-1;break;case"Enter":case" ":{t.preventDefault();const n=(this.options[this.highlightedIndex]?.children??[])[this.highlightedSubmenuIndex];n&&!n.disabled&&this.handleOptionClick(n);break}case"Escape":t.preventDefault(),this.closeDropdown(),this.buttonElement?.focus();break}else switch(t.key){case"ArrowDown":t.preventDefault(),this.highlightedIndex=(this.highlightedIndex+1)%this.options.length;break;case"ArrowUp":t.preventDefault(),this.highlightedIndex=this.highlightedIndex<=0?this.options.length-1:this.highlightedIndex-1;break;case"ArrowRight":{t.preventDefault();const e=this.options[this.highlightedIndex];e?.children&&e.children.length>0&&(this.openSubmenuId=e.id,this.highlightedSubmenuIndex=0);break}case"Enter":case" ":{t.preventDefault();const e=this.options[this.highlightedIndex];e&&(e.children&&e.children.length>0?(this.openSubmenuId=e.id,this.highlightedSubmenuIndex=0):e.disabled||this.handleOptionClick(e));break}case"Escape":t.preventDefault(),this.closeDropdown(),this.buttonElement?.focus();break}}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleKeydown),this.removeClickOutsideListener(),this.clearHoverTimeout()}toggleDropdown(){this.isOpen?this.closeDropdown():this.openDropdown()}openDropdown(){this.isOpen=!0,this.highlightedIndex=-1,this.openSubmenuId=void 0,this.updateComplete.then(()=>{this.updatePositioning(),this.addClickOutsideListener()})}closeDropdown(){this.isOpen=!1,this.highlightedIndex=-1,this.highlightedSubmenuIndex=-1,this.openSubmenuId=void 0,this.openUpward=!1,this.submenuOpenLeft=!1,this.removeClickOutsideListener(),this.clearHoverTimeout()}updatePositioning(){if(!this.buttonElement||!this.panelElement)return;const t=this.buttonElement.getBoundingClientRect(),e=this.panelElement.offsetHeight,r=window.innerHeight-t.bottom;this.openUpward=r<e&&t.top>e}updateSubmenuPositioning(t){if(!this.submenuElement)return;const e=t.getBoundingClientRect(),n=this.submenuElement.offsetWidth,i=window.innerWidth-e.right;this.submenuOpenLeft=i<n&&e.left>n}addClickOutsideListener(){this.clickOutsideHandler=t=>{t.composedPath().includes(this)||this.closeDropdown()},document.addEventListener("click",this.clickOutsideHandler,!0)}removeClickOutsideListener(){this.clickOutsideHandler&&(document.removeEventListener("click",this.clickOutsideHandler,!0),this.clickOutsideHandler=void 0)}clearHoverTimeout(){this.hoverTimeoutId!==void 0&&(window.clearTimeout(this.hoverTimeoutId),this.hoverTimeoutId=void 0)}handleOptionMouseEnter(t,e){this.highlightedIndex=e,t.children&&t.children.length>0?(this.clearHoverTimeout(),this.hoverTimeoutId=window.setTimeout(()=>{this.openSubmenuId=t.id,this.updateComplete.then(()=>{const n=this.panelElement?.querySelector(`.option[data-index="${e}"]`);n&&this.updateSubmenuPositioning(n)})},200)):this.openSubmenuId=void 0}handleOptionMouseLeave(){this.clearHoverTimeout()}handleSubmenuMouseEnter(t){this.highlightedSubmenuIndex=t}async handleOptionClick(t){t.disabled||(t.action&&await t.action(),this.closeDropdown())}renderOption(t,e,n=!1){const r=["option",t.active?"active":"",t.disabled?"disabled":"",t.children?"has-submenu":"",(n?this.highlightedSubmenuIndex:this.highlightedIndex)===e?"highlighted":""].filter(Boolean).join(" ");return H`
|
|
583
|
+
${t.separator==="before"?H`<div class="separator"></div>`:""}
|
|
591
584
|
<div
|
|
592
585
|
class=${r}
|
|
593
586
|
data-index=${e}
|
|
594
|
-
title=${
|
|
595
|
-
@click=${()=>{
|
|
596
|
-
@mouseenter=${()=>{
|
|
587
|
+
title=${t.tooltip??t.label}
|
|
588
|
+
@click=${()=>{t.children?(this.openSubmenuId=this.openSubmenuId===t.id?void 0:t.id,this.updateComplete.then(()=>{const i=this.panelElement?.querySelector(`.option[data-index="${e}"]`);i&&this.updateSubmenuPositioning(i)})):this.handleOptionClick(t)}}
|
|
589
|
+
@mouseenter=${()=>{n?this.handleSubmenuMouseEnter(e):this.handleOptionMouseEnter(t,e)}}
|
|
597
590
|
@mouseleave=${()=>this.handleOptionMouseLeave()}
|
|
598
591
|
>
|
|
599
|
-
${
|
|
600
|
-
${
|
|
592
|
+
${t.icon?t.icon:""}
|
|
593
|
+
${t.content?t.content:t.label}
|
|
601
594
|
</div>
|
|
602
|
-
${
|
|
603
|
-
`}renderSubmenu(
|
|
595
|
+
${t.separator==="after"?H`<div class="separator"></div>`:""}
|
|
596
|
+
`}renderSubmenu(t){return!t.children||t.children.length===0?"":H`
|
|
604
597
|
<div
|
|
605
598
|
class="submenu ${this.submenuOpenLeft?"open-left":""}"
|
|
606
599
|
@mouseenter=${()=>{this.clearHoverTimeout()}}
|
|
607
600
|
>
|
|
608
|
-
${
|
|
601
|
+
${t.children.map((e,n)=>this.renderOption(e,n,!0))}
|
|
609
602
|
</div>
|
|
610
|
-
`}render(){return
|
|
603
|
+
`}render(){return H`
|
|
611
604
|
<button
|
|
612
605
|
type="button"
|
|
613
606
|
role="combobox"
|
|
@@ -616,20 +609,20 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
616
609
|
title=${this.buttonTooltip}
|
|
617
610
|
@click=${this.toggleDropdown}
|
|
618
611
|
>
|
|
619
|
-
${this.buttonIcon??
|
|
612
|
+
${this.buttonIcon??H`<span>⋮</span>`}
|
|
620
613
|
</button>
|
|
621
614
|
|
|
622
|
-
${this.isOpen?
|
|
615
|
+
${this.isOpen?H`
|
|
623
616
|
<div class="panel ${this.openUpward?"upward":""}" role="listbox">
|
|
624
|
-
${this.options.map((
|
|
617
|
+
${this.options.map((t,e)=>H`
|
|
625
618
|
<div class="option-wrapper">
|
|
626
|
-
${this.renderOption(
|
|
627
|
-
${this.openSubmenuId===
|
|
619
|
+
${this.renderOption(t,e)}
|
|
620
|
+
${this.openSubmenuId===t.id?this.renderSubmenu(t):""}
|
|
628
621
|
</div>
|
|
629
622
|
`)}
|
|
630
623
|
</div>
|
|
631
624
|
`:""}
|
|
632
|
-
`}};
|
|
625
|
+
`}};Ue.styles=Tt`
|
|
633
626
|
:host {
|
|
634
627
|
position: relative;
|
|
635
628
|
display: inline-flex;
|
|
@@ -750,24 +743,24 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
750
743
|
padding-left: 16px;
|
|
751
744
|
}
|
|
752
745
|
}
|
|
753
|
-
`;
|
|
746
|
+
`;Ze([Me({attribute:!1})],Ue.prototype,"options",2);Ze([Me({attribute:!1})],Ue.prototype,"buttonIcon",2);Ze([Me({attribute:!1})],Ue.prototype,"buttonTooltip",2);Ze([Me({attribute:!1})],Ue.prototype,"i18n",2);Ze([Mt()],Ue.prototype,"isOpen",2);Ze([Mt()],Ue.prototype,"openSubmenuId",2);Ze([Mt()],Ue.prototype,"highlightedIndex",2);Ze([Mt()],Ue.prototype,"highlightedSubmenuIndex",2);Ze([Mt()],Ue.prototype,"openUpward",2);Ze([Mt()],Ue.prototype,"submenuOpenLeft",2);Ze([Jr("button")],Ue.prototype,"buttonElement",2);Ze([Jr(".panel")],Ue.prototype,"panelElement",2);Ze([Jr(".submenu")],Ue.prototype,"submenuElement",2);Ue=Ze([Fo("tiptap-nested-dropdown")],Ue);var oS=Object.defineProperty,sS=Object.getOwnPropertyDescriptor,Ht=(t,e,n,r)=>{for(var i=r>1?void 0:r?sS(e,n):e,o=t.length-1,s;o>=0;o--)(s=t[o])&&(i=(r?s(e,n,i):s(i))||i);return r&&i&&oS(e,n,i),i};let mt=class extends sn{constructor(){super(...arguments),this.options=[],this.value="",this.isOpen=!1,this.highlightedIndex=-1,this.openUpward=!1,this.handleKeydown=t=>{if(!this.isOpen){(t.key==="Enter"||t.key===" "||t.key==="ArrowDown")&&(t.preventDefault(),this.openDropdown());return}switch(t.key){case"ArrowDown":t.preventDefault(),this.highlightedIndex=(this.highlightedIndex+1)%this.options.length,this.scrollHighlightedIntoView();break;case"ArrowUp":t.preventDefault(),this.highlightedIndex=this.highlightedIndex<=0?this.options.length-1:this.highlightedIndex-1,this.scrollHighlightedIntoView();break;case"Enter":case" ":t.preventDefault(),this.highlightedIndex>=0&&this.highlightedIndex<this.options.length&&this.selectOption(this.options[this.highlightedIndex].value);break;case"Escape":t.preventDefault(),this.closeDropdown(),this.buttonElement?.focus();break}}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleKeydown),this.removeClickOutsideListener()}toggleDropdown(){this.isOpen?this.closeDropdown():this.openDropdown()}openDropdown(){this.isOpen=!0,this.highlightedIndex=this.options.findIndex(t=>t.value===this.value),this.updateComplete.then(()=>{this.updatePositioning(),this.addClickOutsideListener()})}closeDropdown(){this.isOpen=!1,this.highlightedIndex=-1,this.openUpward=!1,this.removeClickOutsideListener()}updatePositioning(){if(!this.buttonElement||!this.panelElement)return;const t=this.buttonElement.getBoundingClientRect(),e=this.panelElement.offsetHeight,r=window.innerHeight-t.bottom;this.openUpward=r<e&&t.top>e}addClickOutsideListener(){this.clickOutsideHandler=t=>{t.composedPath().includes(this)||this.closeDropdown()},document.addEventListener("click",this.clickOutsideHandler,!0)}removeClickOutsideListener(){this.clickOutsideHandler&&(document.removeEventListener("click",this.clickOutsideHandler,!0),this.clickOutsideHandler=void 0)}scrollHighlightedIntoView(){this.updateComplete.then(()=>{const t=this.panelElement?.querySelector(".option.highlighted");t&&t.scrollIntoView({block:"nearest"})})}selectOption(t){this.value=t,this.dispatchEvent(new CustomEvent("change",{detail:{value:t},bubbles:!0,composed:!0})),this.closeDropdown()}render(){const t=this.options.find(e=>e.value===this.value);return H`
|
|
754
747
|
<button
|
|
755
748
|
type="button"
|
|
756
749
|
role="combobox"
|
|
757
750
|
aria-expanded=${this.isOpen}
|
|
758
751
|
aria-haspopup="listbox"
|
|
759
|
-
title=${
|
|
752
|
+
title=${t?.tooltip??""}
|
|
760
753
|
@click=${this.toggleDropdown}
|
|
761
754
|
>
|
|
762
|
-
<span class="button-content">${
|
|
755
|
+
<span class="button-content">${t?.buttonContent??t?.content??H`<span>-</span>`}</span>
|
|
763
756
|
<span class="chevron"></span>
|
|
764
757
|
</button>
|
|
765
758
|
|
|
766
|
-
${this.isOpen?
|
|
759
|
+
${this.isOpen?H`
|
|
767
760
|
<div class="panel ${this.openUpward?"upward":""}" role="listbox">
|
|
768
|
-
${this.options.map((e,
|
|
761
|
+
${this.options.map((e,n)=>H`
|
|
769
762
|
<div
|
|
770
|
-
class="option ${e.value===this.value?"selected":""} ${
|
|
763
|
+
class="option ${e.value===this.value?"selected":""} ${n===this.highlightedIndex?"highlighted":""}"
|
|
771
764
|
role="option"
|
|
772
765
|
aria-selected=${e.value===this.value}
|
|
773
766
|
title=${e.tooltip}
|
|
@@ -778,7 +771,7 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
778
771
|
`)}
|
|
779
772
|
</div>
|
|
780
773
|
`:""}
|
|
781
|
-
`}};
|
|
774
|
+
`}};mt.styles=Tt`
|
|
782
775
|
:host {
|
|
783
776
|
position: relative;
|
|
784
777
|
display: inline-flex;
|
|
@@ -858,10 +851,10 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
858
851
|
display: block;
|
|
859
852
|
}
|
|
860
853
|
}
|
|
861
|
-
`;Lt([Se({attribute:!1})],ut.prototype,"options",2);Lt([Se()],ut.prototype,"value",2);Lt([Se({attribute:!1})],ut.prototype,"i18n",2);Lt([Et()],ut.prototype,"isOpen",2);Lt([Et()],ut.prototype,"highlightedIndex",2);Lt([Et()],ut.prototype,"openUpward",2);Lt([Br("button")],ut.prototype,"buttonElement",2);Lt([Br(".panel")],ut.prototype,"panelElement",2);ut=Lt([Ss("tiptap-styled-dropdown")],ut);const XE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8"/></svg>',QE='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6"></polyline><polyline points="8 6 2 12 8 18"></polyline></svg>',ex='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0z"/><path d="M8 12h8"/></svg>',tx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-ellipsis-vertical-icon lucide-ellipsis-vertical"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>',nx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21"/><path d="M22 21H7"/><path d="m5 11 9 9"/></svg>',rx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-symlink-icon lucide-file-symlink"><path d="m10 18 3-3-3-3"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M4 11V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7"/></svg>',ix='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" x2="10" y1="4" y2="4"/><line x1="14" x2="5" y1="20" y2="20"/><line x1="15" x2="9" y1="4" y2="20"/></svg>',sx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>',ox='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 12h11"/><path d="M10 18h11"/><path d="M10 6h11"/><path d="M4 10h2"/><path d="M4 6h1v4"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/></svg>',ax='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h.01"/><path d="M3 18h.01"/><path d="M3 6h.01"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M8 6h13"/></svg>',lx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>',cx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-quote-icon lucide-quote"><path d="M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/><path d="M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/></svg>',dx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/></svg>',ux='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2"></rect><path d="m10 10-2 2 2 2"></path><path d="m14 14 2-2-2-2"></path></svg>',hx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 4H9a3 3 0 0 0-2.83 4"/><path d="M14 12a4 4 0 0 1 0 8H6"/><line x1="4" x2="20" y1="12" y2="12"/></svg>',fx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18"/><path d="M6 18h12"/><path d="M3 6h18"/></svg>',px='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18"/><path d="M9 18h12"/><path d="M3 6h18"/></svg>',mx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18"/><path d="M3 18h12"/><path d="M3 6h18"/></svg>',gx='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/></svg>';function ke(n){return z`${Gh(n)}`}var bx=Object.defineProperty,yx=Object.getOwnPropertyDescriptor,Xn=(n,e,t,r)=>{for(var i=r>1?void 0:r?yx(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&bx(e,t,i),i};let en=class extends Yt{refresh(){this.requestUpdate()}toggleBold(){this.editor?.chain().focus().toggleBold().run()}toggleItalic(){this.editor?.chain().focus().toggleItalic().run()}toggleStrike(){this.editor?.chain().focus().toggleStrike().run()}setHeading(n){n===0?this.editor?.chain().focus().setParagraph().run():this.editor?.chain().focus().setHeading({level:n}).run()}toggleBulletList(){this.editor?.chain().focus().toggleBulletList().run()}toggleOrderedList(){this.editor?.chain().focus().toggleOrderedList().run()}toggleBlockquote(){this.editor?.chain().focus().toggleBlockquote().run()}async setLink(){if(!this.editor||!this.service||!this.i18n)return;const{state:n}=this.editor,{from:e,to:t}=n.selection,r=n.doc.textBetween(e,t,""),i=await Jh({service:this.service,i18n:this.i18n,initialLabel:r,mode:"insert"});!i||!i.values||(r&&r!==i.values.label?this.editor.chain().focus().deleteSelection().insertContent(i.values.label).setTextSelection({from:e,to:e+i.values.label.length}).setMark("link",{href:i.values.href,target:i.values.target}).setTextSelection(e+i.values.label.length).run():r?this.editor.chain().focus().setLink({href:i.values.href,target:i.values.target}).setTextSelection(t).run():this.editor.chain().focus().insertContent(i.values.label).setTextSelection({from:e,to:e+i.values.label.length}).setMark("link",{href:i.values.href,target:i.values.target}).setTextSelection(e+i.values.label.length).run())}setAlignment(n){n===""?this.editor?.chain().focus().unsetTextAlign().run():this.editor?.chain().focus().setTextAlign(n).run()}setTextSize(n){const e=this.editor;e&&(n===""?e.chain().focus().unsetMark("textSize").run():e.chain().focus().setMark("textSize",{value:n}).run())}undo(){this.editor?.chain().focus().undo().run()}redo(){this.editor?.chain().focus().redo().run()}clearFormatting(){this.editor?.chain().focus().clearNodes().unsetAllMarks().run()}toggleCode(){this.editor?.chain().focus().toggleCode().run()}toggleCodeBlock(){this.editor?.chain().focus().toggleCodeBlock().run()}async handleInsertHtmlSnippet(){!this.editor||!this.service||!this.i18n||await KE(this.editor,this.service,this.i18n)}async handleToggleObfuscate(){!this.editor||!this.service||!this.i18n||await jE(this.editor,this.service,this.i18n)}async handleInsertVideo(){if(!(!this.editor||!this.service||!this.i18n)){if(!this.videoPluginHook){this.service.showAlert(this.i18n?.t("warnings.videoPluginNotAvailable")??"Video plugin not available",{severity:"warning",autoDismiss:!0});return}await qE(this.editor,this.service,this.i18n,this.videoPluginHook)}}async handleToggleInternalLink(){if(!(!this.editor||!this.service||!this.i18n)){if(!this.internalLinkPluginHook){this.service.showAlert(this.i18n?.t("warnings.internalLinkPluginNotAvailable")??"Internal link plugin not available",{severity:"warning",autoDismiss:!0});return}await WE(this.editor,this.service,this.internalLinkPluginHook)}}render(){if(!this.editor)return z``;const n=[{value:"0",tooltip:this.i18n?.t("toolbar.paragraph")??"Paragraph",content:z`<span style="font-size: 1em; font-weight: normal;">${this.i18n?.t("toolbar.paragraph")??"Paragraph"}</span>`,buttonContent:z`<b>${this.i18n?.t("toolbar.paragraphShort")??"P"}</b>`},{value:"2",tooltip:this.i18n?.t("toolbar.heading2")??"Heading 2",content:z`<span style="font-size: 1.5em; font-weight: bold;">${this.i18n?.t("toolbar.heading2")??"Heading 2"}</span>`,buttonContent:z`<b>${this.i18n?.t("toolbar.heading2Short")??"H2"}</b>`},{value:"3",tooltip:this.i18n?.t("toolbar.heading3")??"Heading 3",content:z`<span style="font-size: 1.17em; font-weight: bold;">${this.i18n?.t("toolbar.heading3")??"Heading 3"}</span>`,buttonContent:z`<b>${this.i18n?.t("toolbar.heading3Short")??"H3"}</b>`},{value:"4",tooltip:this.i18n?.t("toolbar.heading4")??"Heading 4",content:z`<span style="font-size: 1em; font-weight: bold;">${this.i18n?.t("toolbar.heading4")??"Heading 4"}</span>`,buttonContent:z`<b>${this.i18n?.t("toolbar.heading4Short")??"H4"}</b>`}],e=this.editor.isActive("heading",{level:2})?"2":this.editor.isActive("heading",{level:3})?"3":this.editor.isActive("heading",{level:4})?"4":"0",t=[];t.push({id:"obfuscate",label:this.i18n?.t("toolbar.obfuscate")??"Obfuscate",icon:ke(lx),tooltip:this.i18n?.t("toolbar.obfuscate")??"Obfuscate",action:()=>this.handleToggleObfuscate(),active:this.editor.isActive("obfuscate"),separator:"after"}),this.service?.configuration?.code&&(t.push({id:"code-block",label:this.i18n?.t("toolbar.codeBlock")??"Code Block",icon:ke(ux),tooltip:this.i18n?.t("toolbar.codeBlock")??"Code Block",action:()=>this.toggleCodeBlock(),active:this.editor.isActive("codeBlock")}),t.push({id:"inline-code",label:this.i18n?.t("toolbar.code")??"Inline Code",icon:ke(QE),tooltip:this.i18n?.t("toolbar.code")??"Inline Code",action:()=>this.toggleCode(),active:this.editor.isActive("code"),separator:"after"})),t.push({id:"html-snippet",label:this.i18n?.t("htmlSnippetNode.insertHtmlSnippet")??"Insert HTML Snippet",icon:ke(ex),tooltip:this.i18n?.t("htmlSnippetNode.insertHtmlSnippet")??"Insert HTML Snippet",action:()=>this.handleInsertHtmlSnippet()}),this.videoPluginHook&&t.push({id:"video",label:this.i18n?.t("platformVideo.insertVideo")??"Insert Video",icon:ke(Qh),tooltip:this.i18n?.t("platformVideo.insertVideo")??"Insert Video",action:()=>this.handleInsertVideo()}),t.length>0&&(t[t.length-1].separator="after");const r=this.editor.isActive("textSize",{value:"small"})?"small":this.editor.isActive("textSize",{value:"large"})?"large":this.editor.isActive("textSize",{value:"huge"})?"huge":"";return t.push({id:"text-size",label:this.i18n?.t("toolbar.textSize")??"Text size",tooltip:this.i18n?.t("toolbar.textSize")??"Text size",children:[{id:"text-size-small",label:this.i18n?.t("toolbar.textSizeSmall")??"Small",content:z`<span style="font-size: 0.5625em;">${this.i18n?.t("toolbar.textSizeSmall")??"Small"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeSmall")??"Small",action:()=>this.setTextSize("small"),active:r==="small"},{id:"text-size-normal",label:this.i18n?.t("toolbar.textSizeNormal")??"Normal",content:z`<span style="font-size: 1em;">${this.i18n?.t("toolbar.textSizeNormal")??"Normal"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeNormal")??"Normal",action:()=>this.setTextSize(""),active:r===""},{id:"text-size-large",label:this.i18n?.t("toolbar.textSizeLarge")??"Large",content:z`<span style="font-size: 2em;">${this.i18n?.t("toolbar.textSizeLarge")??"Large"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeLarge")??"Large",action:()=>this.setTextSize("large"),active:r==="large"},{id:"text-size-huge",label:this.i18n?.t("toolbar.textSizeHuge")??"Huge",content:z`<span style="font-size: 4em;">${this.i18n?.t("toolbar.textSizeHuge")??"Huge"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeHuge")??"Huge",action:()=>this.setTextSize("huge"),active:r==="huge"}]}),t.push({id:"clear-formatting",label:this.i18n?.t("toolbar.clearFormatting")??"Clear Formatting",icon:ke(nx),tooltip:this.i18n?.t("toolbar.clearFormatting")??"Clear Formatting",action:()=>this.clearFormatting(),separator:"before"}),z`
|
|
854
|
+
`;Ht([Me({attribute:!1})],mt.prototype,"options",2);Ht([Me()],mt.prototype,"value",2);Ht([Me({attribute:!1})],mt.prototype,"i18n",2);Ht([Mt()],mt.prototype,"isOpen",2);Ht([Mt()],mt.prototype,"highlightedIndex",2);Ht([Mt()],mt.prototype,"openUpward",2);Ht([Jr("button")],mt.prototype,"buttonElement",2);Ht([Jr(".panel")],mt.prototype,"panelElement",2);mt=Ht([Fo("tiptap-styled-dropdown")],mt);const aS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8"/></svg>',lS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6"></polyline><polyline points="8 6 2 12 8 18"></polyline></svg>',cS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0z"/><path d="M8 12h8"/></svg>',dS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-ellipsis-vertical-icon lucide-ellipsis-vertical"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>',uS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21"/><path d="M22 21H7"/><path d="m5 11 9 9"/></svg>',hS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-symlink-icon lucide-file-symlink"><path d="m10 18 3-3-3-3"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M4 11V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7"/></svg>',fS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" x2="10" y1="4" y2="4"/><line x1="14" x2="5" y1="20" y2="20"/><line x1="15" x2="9" y1="4" y2="20"/></svg>',pS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>',mS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 12h11"/><path d="M10 18h11"/><path d="M10 6h11"/><path d="M4 10h2"/><path d="M4 6h1v4"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/></svg>',gS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h.01"/><path d="M3 18h.01"/><path d="M3 6h.01"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M8 6h13"/></svg>',bS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>',yS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-quote-icon lucide-quote"><path d="M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/><path d="M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/></svg>',kS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/></svg>',wS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2"></rect><path d="m10 10-2 2 2 2"></path><path d="m14 14 2-2-2-2"></path></svg>',vS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 4H9a3 3 0 0 0-2.83 4"/><path d="M14 12a4 4 0 0 1 0 8H6"/><line x1="4" x2="20" y1="12" y2="12"/></svg>',ES='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18"/><path d="M6 18h12"/><path d="M3 6h18"/></svg>',xS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18"/><path d="M9 18h12"/><path d="M3 6h18"/></svg>',SS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18"/><path d="M3 18h12"/><path d="M3 6h18"/></svg>',CS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/></svg>';function Ee(t){return H`${Gf(t)}`}var TS=Object.defineProperty,MS=Object.getOwnPropertyDescriptor,lr=(t,e,n,r)=>{for(var i=r>1?void 0:r?MS(e,n):e,o=t.length-1,s;o>=0;o--)(s=t[o])&&(i=(r?s(e,n,i):s(i))||i);return r&&i&&TS(e,n,i),i};let cn=class extends sn{refresh(){this.requestUpdate()}toggleBold(){this.editor?.chain().focus().toggleBold().run()}toggleItalic(){this.editor?.chain().focus().toggleItalic().run()}toggleStrike(){this.editor?.chain().focus().toggleStrike().run()}setHeading(t){t===0?this.editor?.chain().focus().setParagraph().run():this.editor?.chain().focus().setHeading({level:t}).run()}toggleBulletList(){this.editor?.chain().focus().toggleBulletList().run()}toggleOrderedList(){this.editor?.chain().focus().toggleOrderedList().run()}toggleBlockquote(){this.editor?.chain().focus().toggleBlockquote().run()}async setLink(){if(!this.editor||!this.service||!this.i18n)return;const{state:t}=this.editor,{from:e,to:n}=t.selection,r=t.doc.textBetween(e,n,""),i=await Jf({service:this.service,i18n:this.i18n,initialLabel:r,mode:"insert"});!i||!i.values||(r&&r!==i.values.label?this.editor.chain().focus().deleteSelection().insertContent(i.values.label).setTextSelection({from:e,to:e+i.values.label.length}).setMark("link",{href:i.values.href,target:i.values.target}).setTextSelection(e+i.values.label.length).run():r?this.editor.chain().focus().setLink({href:i.values.href,target:i.values.target}).setTextSelection(n).run():this.editor.chain().focus().insertContent(i.values.label).setTextSelection({from:e,to:e+i.values.label.length}).setMark("link",{href:i.values.href,target:i.values.target}).setTextSelection(e+i.values.label.length).run())}setAlignment(t){t===""?this.editor?.chain().focus().unsetTextAlign().run():this.editor?.chain().focus().setTextAlign(t).run()}setTextSize(t){const e=this.editor;e&&(t===""?e.chain().focus().unsetMark("textSize").run():e.chain().focus().setMark("textSize",{value:t}).run())}undo(){this.editor?.chain().focus().undo().run()}redo(){this.editor?.chain().focus().redo().run()}clearFormatting(){this.editor?.chain().focus().clearNodes().unsetAllMarks().run()}toggleCode(){this.editor?.chain().focus().toggleCode().run()}toggleCodeBlock(){this.editor?.chain().focus().toggleCodeBlock().run()}async handleInsertHtmlSnippet(){!this.editor||!this.service||!this.i18n||await Qx(this.editor,this.service,this.i18n)}async handleToggleObfuscate(){!this.editor||!this.service||!this.i18n||await tS(this.editor,this.service,this.i18n)}async handleInsertVideo(){if(!(!this.editor||!this.service||!this.i18n)){if(!this.videoPluginHook){this.service.showAlert(this.i18n?.t("warnings.videoPluginNotAvailable")??"Video plugin not available",{severity:"warning",autoDismiss:!0});return}await nS(this.editor,this.service,this.i18n,this.videoPluginHook)}}async handleToggleInternalLink(){if(!(!this.editor||!this.service||!this.i18n)){if(!this.internalLinkPluginHook){this.service.showAlert(this.i18n?.t("warnings.internalLinkPluginNotAvailable")??"Internal link plugin not available",{severity:"warning",autoDismiss:!0});return}await eS(this.editor,this.service,this.internalLinkPluginHook)}}render(){if(!this.editor)return H``;const t=[{value:"0",tooltip:this.i18n?.t("toolbar.paragraph")??"Paragraph",content:H`<span style="font-size: 1em; font-weight: normal;">${this.i18n?.t("toolbar.paragraph")??"Paragraph"}</span>`,buttonContent:H`<b>${this.i18n?.t("toolbar.paragraphShort")??"P"}</b>`},{value:"2",tooltip:this.i18n?.t("toolbar.heading2")??"Heading 2",content:H`<span style="font-size: 1.5em; font-weight: bold;">${this.i18n?.t("toolbar.heading2")??"Heading 2"}</span>`,buttonContent:H`<b>${this.i18n?.t("toolbar.heading2Short")??"H2"}</b>`},{value:"3",tooltip:this.i18n?.t("toolbar.heading3")??"Heading 3",content:H`<span style="font-size: 1.17em; font-weight: bold;">${this.i18n?.t("toolbar.heading3")??"Heading 3"}</span>`,buttonContent:H`<b>${this.i18n?.t("toolbar.heading3Short")??"H3"}</b>`},{value:"4",tooltip:this.i18n?.t("toolbar.heading4")??"Heading 4",content:H`<span style="font-size: 1em; font-weight: bold;">${this.i18n?.t("toolbar.heading4")??"Heading 4"}</span>`,buttonContent:H`<b>${this.i18n?.t("toolbar.heading4Short")??"H4"}</b>`}],e=this.editor.isActive("heading",{level:2})?"2":this.editor.isActive("heading",{level:3})?"3":this.editor.isActive("heading",{level:4})?"4":"0",n=[];n.push({id:"obfuscate",label:this.i18n?.t("toolbar.obfuscate")??"Obfuscate",icon:Ee(bS),tooltip:this.i18n?.t("toolbar.obfuscate")??"Obfuscate",action:()=>this.handleToggleObfuscate(),active:this.editor.isActive("obfuscate"),separator:"after"}),this.service?.configuration?.code&&(n.push({id:"code-block",label:this.i18n?.t("toolbar.codeBlock")??"Code Block",icon:Ee(wS),tooltip:this.i18n?.t("toolbar.codeBlock")??"Code Block",action:()=>this.toggleCodeBlock(),active:this.editor.isActive("codeBlock")}),n.push({id:"inline-code",label:this.i18n?.t("toolbar.code")??"Inline Code",icon:Ee(lS),tooltip:this.i18n?.t("toolbar.code")??"Inline Code",action:()=>this.toggleCode(),active:this.editor.isActive("code"),separator:"after"})),n.push({id:"html-snippet",label:this.i18n?.t("htmlSnippetNode.insertHtmlSnippet")??"Insert HTML Snippet",icon:Ee(cS),tooltip:this.i18n?.t("htmlSnippetNode.insertHtmlSnippet")??"Insert HTML Snippet",action:()=>this.handleInsertHtmlSnippet()}),this.videoPluginHook&&n.push({id:"video",label:this.i18n?.t("platformVideo.insertVideo")??"Insert Video",icon:Ee(Qf),tooltip:this.i18n?.t("platformVideo.insertVideo")??"Insert Video",action:()=>this.handleInsertVideo()}),n.length>0&&(n[n.length-1].separator="after");const r=this.editor.isActive("textSize",{value:"small"})?"small":this.editor.isActive("textSize",{value:"large"})?"large":this.editor.isActive("textSize",{value:"huge"})?"huge":"";return n.push({id:"text-size",label:this.i18n?.t("toolbar.textSize")??"Text size",tooltip:this.i18n?.t("toolbar.textSize")??"Text size",children:[{id:"text-size-small",label:this.i18n?.t("toolbar.textSizeSmall")??"Small",content:H`<span style="font-size: 0.5625em;">${this.i18n?.t("toolbar.textSizeSmall")??"Small"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeSmall")??"Small",action:()=>this.setTextSize("small"),active:r==="small"},{id:"text-size-normal",label:this.i18n?.t("toolbar.textSizeNormal")??"Normal",content:H`<span style="font-size: 1em;">${this.i18n?.t("toolbar.textSizeNormal")??"Normal"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeNormal")??"Normal",action:()=>this.setTextSize(""),active:r===""},{id:"text-size-large",label:this.i18n?.t("toolbar.textSizeLarge")??"Large",content:H`<span style="font-size: 2em;">${this.i18n?.t("toolbar.textSizeLarge")??"Large"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeLarge")??"Large",action:()=>this.setTextSize("large"),active:r==="large"},{id:"text-size-huge",label:this.i18n?.t("toolbar.textSizeHuge")??"Huge",content:H`<span style="font-size: 4em;">${this.i18n?.t("toolbar.textSizeHuge")??"Huge"}</span>`,tooltip:this.i18n?.t("toolbar.textSizeHuge")??"Huge",action:()=>this.setTextSize("huge"),active:r==="huge"}]}),n.push({id:"clear-formatting",label:this.i18n?.t("toolbar.clearFormatting")??"Clear Formatting",icon:Ee(uS),tooltip:this.i18n?.t("toolbar.clearFormatting")??"Clear Formatting",action:()=>this.clearFormatting(),separator:"before"}),H`
|
|
862
855
|
<div class="toolbar">
|
|
863
856
|
<tiptap-styled-dropdown
|
|
864
|
-
.options=${
|
|
857
|
+
.options=${t}
|
|
865
858
|
.value=${e}
|
|
866
859
|
.i18n=${this.i18n}
|
|
867
860
|
@change=${i=>this.setHeading(Number(i.detail.value))}
|
|
@@ -874,36 +867,36 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
874
867
|
class=${this.editor.isActive("bold")?"active":""}
|
|
875
868
|
title=${this.i18n?.t("toolbar.bold")??"Bold"}
|
|
876
869
|
>
|
|
877
|
-
${
|
|
870
|
+
${Ee(aS)}
|
|
878
871
|
</button>
|
|
879
872
|
<button
|
|
880
873
|
@click=${()=>this.toggleItalic()}
|
|
881
874
|
class=${this.editor.isActive("italic")?"active":""}
|
|
882
875
|
title=${this.i18n?.t("toolbar.italic")??"Italic"}
|
|
883
876
|
>
|
|
884
|
-
${
|
|
877
|
+
${Ee(fS)}
|
|
885
878
|
</button>
|
|
886
879
|
<button
|
|
887
880
|
@click=${()=>this.toggleStrike()}
|
|
888
881
|
class=${this.editor.isActive("strike")?"active":""}
|
|
889
882
|
title=${this.i18n?.t("toolbar.strikethrough")??"Strikethrough"}
|
|
890
883
|
>
|
|
891
|
-
${
|
|
884
|
+
${Ee(vS)}
|
|
892
885
|
</button>
|
|
893
886
|
<button
|
|
894
887
|
@click=${()=>this.setLink()}
|
|
895
888
|
class=${this.editor.isActive("link")?"active":""}
|
|
896
889
|
title=${this.i18n?.t("toolbar.link")??"Link"}
|
|
897
890
|
>
|
|
898
|
-
${
|
|
891
|
+
${Ee(pS)}
|
|
899
892
|
</button>
|
|
900
|
-
${this.internalLinkPluginHook?
|
|
893
|
+
${this.internalLinkPluginHook?H`
|
|
901
894
|
<button
|
|
902
895
|
@click=${()=>this.handleToggleInternalLink()}
|
|
903
896
|
class=${this.editor.isActive("internalLink")?"active":""}
|
|
904
897
|
title=${this.i18n?.t("internalLinkNode.insertInternalLink")??"Insert Internal Link"}
|
|
905
898
|
>
|
|
906
|
-
${
|
|
899
|
+
${Ee(hS)}
|
|
907
900
|
</button>
|
|
908
901
|
`:""}
|
|
909
902
|
|
|
@@ -914,27 +907,27 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
914
907
|
class=${this.editor.isActive("blockquote")?"active":""}
|
|
915
908
|
title=${this.i18n?.t("toolbar.blockquote")??"Blockquote"}
|
|
916
909
|
>
|
|
917
|
-
${
|
|
910
|
+
${Ee(yS)}
|
|
918
911
|
</button>
|
|
919
912
|
<button
|
|
920
913
|
@click=${()=>this.toggleBulletList()}
|
|
921
914
|
class=${this.editor.isActive("bulletList")?"active":""}
|
|
922
915
|
title=${this.i18n?.t("toolbar.bulletList")??"Bullet List"}
|
|
923
916
|
>
|
|
924
|
-
${
|
|
917
|
+
${Ee(gS)}
|
|
925
918
|
</button>
|
|
926
919
|
<button
|
|
927
920
|
@click=${()=>this.toggleOrderedList()}
|
|
928
921
|
class=${this.editor.isActive("orderedList")?"active":""}
|
|
929
922
|
title=${this.i18n?.t("toolbar.orderedList")??"Ordered List"}
|
|
930
923
|
>
|
|
931
|
-
${
|
|
924
|
+
${Ee(mS)}
|
|
932
925
|
</button>
|
|
933
926
|
|
|
934
927
|
<div class="separator"></div>
|
|
935
928
|
|
|
936
929
|
<tiptap-styled-dropdown
|
|
937
|
-
.options=${[{value:"",tooltip:this.i18n?.t("toolbar.alignmentDefault")??"Default",content:
|
|
930
|
+
.options=${[{value:"",tooltip:this.i18n?.t("toolbar.alignmentDefault")??"Default",content:Ee(SS)},{value:"center",tooltip:this.i18n?.t("toolbar.alignmentCenter")??"Center",content:Ee(ES)},{value:"right",tooltip:this.i18n?.t("toolbar.alignmentRight")??"Right",content:Ee(xS)}]}
|
|
938
931
|
.value=${this.editor.isActive({textAlign:"center"})?"center":this.editor.isActive({textAlign:"right"})?"right":""}
|
|
939
932
|
.i18n=${this.i18n}
|
|
940
933
|
@change=${i=>this.setAlignment(i.detail.value)}
|
|
@@ -942,17 +935,17 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
942
935
|
|
|
943
936
|
<div class="separator"></div>
|
|
944
937
|
|
|
945
|
-
<button @click=${()=>this.undo()} ?disabled=${!this.editor.can().undo()} title=${this.i18n?.t("toolbar.undo")??"Undo"}>${
|
|
946
|
-
<button @click=${()=>this.redo()} ?disabled=${!this.editor.can().redo()} title=${this.i18n?.t("toolbar.redo")??"Redo"}>${
|
|
938
|
+
<button @click=${()=>this.undo()} ?disabled=${!this.editor.can().undo()} title=${this.i18n?.t("toolbar.undo")??"Undo"}>${Ee(CS)}</button>
|
|
939
|
+
<button @click=${()=>this.redo()} ?disabled=${!this.editor.can().redo()} title=${this.i18n?.t("toolbar.redo")??"Redo"}>${Ee(kS)}</button>
|
|
947
940
|
|
|
948
941
|
<tiptap-nested-dropdown
|
|
949
|
-
.options=${
|
|
950
|
-
.buttonIcon=${
|
|
942
|
+
.options=${n}
|
|
943
|
+
.buttonIcon=${Ee(dS)}
|
|
951
944
|
.buttonTooltip=${this.i18n?.t("toolbar.more")??"More"}
|
|
952
945
|
.i18n=${this.i18n}
|
|
953
946
|
></tiptap-nested-dropdown>
|
|
954
947
|
</div>
|
|
955
|
-
`}};
|
|
948
|
+
`}};cn.styles=Tt`
|
|
956
949
|
:host {
|
|
957
950
|
display: block;
|
|
958
951
|
border-bottom: 1px solid #ccc;
|
|
@@ -1001,4 +994,4 @@ function Vc(n){return typeof n=="object"&&n!==null&&"j"in n}const jf={en:{en:"En
|
|
|
1001
994
|
height: 18px;
|
|
1002
995
|
display: block;
|
|
1003
996
|
}
|
|
1004
|
-
`;Xn([Se({attribute:!1})],en.prototype,"editor",2);Xn([Se({attribute:!1})],en.prototype,"service",2);Xn([Se({attribute:!1})],en.prototype,"i18n",2);Xn([Se({attribute:!1})],en.prototype,"videoPluginHook",2);Xn([Se({attribute:!1})],en.prototype,"internalLinkPluginHook",2);en=Xn([Ss("tiptap-toolbar")],en);function kx(){const n={videoPlugin:void 0,internalLinkPlugin:void 0};return{get videoPlugin(){return n.videoPlugin},get internalLinkPlugin(){return n.internalLinkPlugin},service:{registerVideoPlugin(e){if(n.videoPlugin)throw new Error("Video plugin already registered");n.videoPlugin=e},registerInternalLinkPlugin(e){if(n.internalLinkPlugin)throw new Error("Internal link plugin already registered");n.internalLinkPlugin=e}}}}const vx="Entfernen",Ex="Validieren",xx="Abbrechen",Sx="Bild",wx="auto",Tx="Bild wird hochgeladen…",Mx="Bild erfolgreich hochgeladen",Cx="Fehler beim Hochladen des Bildes",Ax="Upload-Funktion nicht verfügbar",Nx="Zu viele Bilder. Nur die ersten {{ count }} werden verarbeitet.",_x={htmlSnippet:"HTML-Snippet",insertHtmlSnippet:"HTML-Snippet einfügen",confirmDeletion:"Löschung bestätigen",htmlSnippetDeletionConfirm:"Sind Sie sicher, dass Sie dieses HTML-Snippet löschen möchten?"},Ox={obfuscate:"Verschleiern",obfuscator:"Verschleierer",content:"Inhalt",asALink:"Als Link",doNotObfuscate:"Nicht verschleiern",done:"Fertig"},Ix={imageProperties:"Bildeigenschaften",sizes:"Größen",variantLabel:"Größe {{ n }}",alignment:"Ausrichtung",left:"Links",center:"Zentriert",right:"Rechts",options:"Optionen",link:"Link",enableZoom:"Zoom aktivieren",mediaProperties:"Medieneigenschaften",caption:"Bildunterschrift",pixelRatio:"Pixelverhältnis"},Lx={insertVideo:"Video einfügen",videoDialog:"Video festlegen"},Rx={insertInternalLink:"Internen Link einfügen"},Dx={editLink:"Link bearbeiten",insertLink:"Link einfügen",label:"Beschriftung",url:"URL",openInNewTab:"In neuem Tab öffnen",openLink:"Link öffnen",removeLink:"Link entfernen",validate:"Validieren"},$x={paragraph:"Absatz",paragraphShort:"A",heading2:"Überschrift 2",heading2Short:"Ü2",heading3:"Überschrift 3",heading3Short:"Ü3",heading4:"Überschrift 4",heading4Short:"Ü4",bold:"Fett",italic:"Kursiv",strikethrough:"Durchgestrichen",obfuscate:"Verschleiern",blockquote:"Zitat",bulletList:"Aufzählungsliste",orderedList:"Nummerierte Liste",link:"Link",code:"Inline-Code",codeBlock:"Codeblock",alignmentDefault:"Standard",alignmentCenter:"Zentriert",alignmentRight:"Rechts",textSize:"Textgröße",textSizeSmall:"Klein",textSizeNormal:"Normal",textSizeLarge:"Groß",textSizeHuge:"Sehr groß",undo:"Rückgängig",redo:"Wiederholen",clearFormatting:"Formatierung löschen",more:"Mehr"},Px={videoPluginNotAvailable:"Video-Plugin nicht verfügbar",internalLinkPluginNotAvailable:"Interner-Link-Plugin nicht verfügbar"},Bx={remove:vx,validate:Ex,cancel:xx,delete:"Löschen",image:Sx,auto:wx,uploadingImage:Tx,imageUploadSuccess:Mx,imageUploadFailed:Cx,uploadNotAvailable:Ax,tooManyImages:Nx,htmlSnippetNode:_x,obfuscateMark:Ox,mediaNode:Ix,platformVideo:Lx,internalLinkNode:Rx,linkDialog:Dx,toolbar:$x,warnings:Px},zx="Remove",Hx="Validate",Fx="Cancel",Ux="Image",Vx="Auto",Kx="Uploading image…",Wx="Image uploaded successfully",jx="Failed to upload image",qx="Upload functionality not available",Gx="Too many images. Only the first {{ count }} will be processed.",Jx={htmlSnippet:"HTML Snippet",insertHtmlSnippet:"Insert HTML Snippet",confirmDeletion:"Confirm Deletion",htmlSnippetDeletionConfirm:"Are you sure you want to delete this HTML Snippet?"},Zx={obfuscate:"Obfuscate",obfuscator:"Obfuscator",content:"Content",asALink:"As a link",doNotObfuscate:"Do not obfuscate",done:"Done"},Yx={imageProperties:"Image Properties",removedImage:"Removed image",imageNoLongerExists:"This image no longer exists in the media library.",sizes:"Sizes",variantLabel:"Size {{ n }}",alignment:"Alignment",left:"Left",center:"Center",right:"Right",options:"Options",link:"Link",enableZoom:"Enable Zoom",mediaProperties:"Media Properties",caption:"Caption",pixelRatio:"Pixel Ratio"},Xx={insertVideo:"Insert Video",videoDialog:"Set a video"},Qx={insertInternalLink:"Insert Internal Link"},eS={editLink:"Edit Link",insertLink:"Insert Link",label:"Label",url:"URL",openInNewTab:"Open in new tab",openLink:"Open the link",removeLink:"Remove Link",validate:"Validate"},tS={paragraph:"Paragraph",paragraphShort:"P",heading2:"Heading 2",heading2Short:"H2",heading3:"Heading 3",heading3Short:"H3",heading4:"Heading 4",heading4Short:"H4",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",obfuscate:"Obfuscate",blockquote:"Blockquote",bulletList:"Bullet List",orderedList:"Ordered List",link:"Link",code:"Inline Code",codeBlock:"Code Block",alignmentDefault:"Default",alignmentCenter:"Center",alignmentRight:"Right",textSize:"Text size",textSizeSmall:"Small",textSizeNormal:"Normal",textSizeLarge:"Large",textSizeHuge:"Huge",undo:"Undo",redo:"Redo",clearFormatting:"Clear Formatting",more:"More"},nS={videoPluginNotAvailable:"Video plugin not available",internalLinkPluginNotAvailable:"Internal link plugin not available"},rS={remove:zx,validate:Hx,cancel:Fx,delete:"Delete",image:Ux,auto:Vx,uploadingImage:Kx,imageUploadSuccess:Wx,imageUploadFailed:jx,uploadNotAvailable:qx,tooManyImages:Gx,htmlSnippetNode:Jx,obfuscateMark:Zx,mediaNode:Yx,platformVideo:Xx,internalLinkNode:Qx,linkDialog:eS,toolbar:tS,warnings:nS},iS="Quitar",sS="Validar",oS="Cancelar",aS="Imagen",lS="auto",cS="Subiendo imagen…",dS="Imagen subida con éxito",uS="Error al subir la imagen",hS="Funcionalidad de carga no disponible",fS="Demasiadas imágenes. Solo se procesarán las primeras {{ count }}.",pS={htmlSnippet:"Fragmento HTML",insertHtmlSnippet:"Insertar fragmento HTML",confirmDeletion:"Confirmar eliminación",htmlSnippetDeletionConfirm:"¿Está seguro de que desea eliminar este fragmento HTML?"},mS={obfuscate:"Ofuscar",obfuscator:"Ofuscador",content:"Contenido",asALink:"Como enlace",doNotObfuscate:"No ofuscar",done:"Hecho"},gS={imageProperties:"Propiedades de la imagen",sizes:"Tamaños",variantLabel:"Tamaño {{ n }}",alignment:"Alineación",left:"Izquierda",center:"Centro",right:"Derecha",options:"Opciones",link:"Enlace",enableZoom:"Habilitar zoom",mediaProperties:"Propiedades del medio",caption:"Leyenda",pixelRatio:"Proporción de píxeles"},bS={insertVideo:"Insertar un video",videoDialog:"Configurar un video"},yS={insertInternalLink:"Insertar un enlace interno"},kS={editLink:"Editar enlace",insertLink:"Insertar enlace",label:"Etiqueta",url:"URL",openInNewTab:"Abrir en nueva pestaña",openLink:"Abrir el enlace",removeLink:"Eliminar enlace",validate:"Validar"},vS={paragraph:"Párrafo",paragraphShort:"P",heading2:"Título 2",heading2Short:"T2",heading3:"Título 3",heading3Short:"T3",heading4:"Título 4",heading4Short:"T4",bold:"Negrita",italic:"Cursiva",strikethrough:"Tachado",obfuscate:"Ofuscar",blockquote:"Cita",bulletList:"Lista con viñetas",orderedList:"Lista numerada",link:"Enlace",code:"Código en línea",codeBlock:"Bloque de código",alignmentDefault:"Predeterminado",alignmentCenter:"Centrar",alignmentRight:"A la derecha",textSize:"Tamaño del texto",textSizeSmall:"Pequeño",textSizeNormal:"Normal",textSizeLarge:"Grande",textSizeHuge:"Muy grande",undo:"Deshacer",redo:"Rehacer",clearFormatting:"Borrar formato",more:"Más"},ES={videoPluginNotAvailable:"Plugin de video no disponible",internalLinkPluginNotAvailable:"Plugin de enlace interno no disponible"},xS={remove:iS,validate:sS,cancel:oS,delete:"Eliminar",image:aS,auto:lS,uploadingImage:cS,imageUploadSuccess:dS,imageUploadFailed:uS,uploadNotAvailable:hS,tooManyImages:fS,htmlSnippetNode:pS,obfuscateMark:mS,mediaNode:gS,platformVideo:bS,internalLinkNode:yS,linkDialog:kS,toolbar:vS,warnings:ES},SS="Retirer",wS="Valider",TS="Annuler",MS="Image",CS="auto",AS="Téléchargement de l'image…",NS="Image téléchargée avec succès",_S="Échec du téléchargement de l'image",OS="Fonctionnalité de téléchargement non disponible",IS="Trop d'images. Seules les {{ count }} premières seront traitées.",LS={htmlSnippet:"Code HTML",insertHtmlSnippet:"Insérer du code HTML",confirmDeletion:"Confirmer la suppression",htmlSnippetDeletionConfirm:"Voulez-vous vraiment supprimer ce code HTML ?"},RS={obfuscate:"Obfusquer",obfusquator:"Obfusqueur",content:"Contenu",asALink:"En tant que lien",doNotObfuscate:"Ne pas obfusquer",done:"Terminé"},DS={imageProperties:"Propriétés de l'image",removedImage:"Image supprimée",imageNoLongerExists:"Cette image n'existe plus dans la médiathèque.",sizes:"Tailles",variantLabel:"Taille {{ n }}",alignment:"Alignement",left:"À gauche",center:"Centrer",right:"À droite",options:"Options",link:"Lien",enableZoom:"Activer le zoom",mediaProperties:"Propriétés du média",caption:"Légende",pixelRatio:"Pixel ratio"},$S={insertVideo:"Insérer une vidéo",videoDialog:"Définir une vidéo"},PS={insertInternalLink:"Insérer un lien interne"},BS={editLink:"Modifier le lien",insertLink:"Insérer un lien",label:"Libellé",url:"URL",openInNewTab:"Ouvrir dans un nouvel onglet",openLink:"Ouvrir le lien",removeLink:"Supprimer le lien",validate:"Valider"},zS={paragraph:"Paragraphe",paragraphShort:"P",heading2:"Titre 2",heading2Short:"T2",heading3:"Titre 3",heading3Short:"T3",heading4:"Titre 4",heading4Short:"T4",bold:"Gras",italic:"Italique",strikethrough:"Barré",obfuscate:"Obfusquer",blockquote:"Citation",bulletList:"Liste à puces",orderedList:"Liste numérotée",link:"Lien",code:"Code en ligne",codeBlock:"Bloc de code",alignmentDefault:"Par défaut",alignmentCenter:"Centrer",alignmentRight:"À droite",textSize:"Taille du texte",textSizeSmall:"Petit",textSizeNormal:"Normal",textSizeLarge:"Grand",textSizeHuge:"Très grand",undo:"Annuler",redo:"Rétablir",clearFormatting:"Effacer la mise en forme",more:"Plus"},HS={videoPluginNotAvailable:"Plugin vidéo non disponible",internalLinkPluginNotAvailable:"Plugin de lien interne non disponible"},FS={remove:SS,validate:wS,cancel:TS,delete:"Supprimer",image:MS,auto:CS,uploadingImage:AS,imageUploadSuccess:NS,imageUploadFailed:_S,uploadNotAvailable:OS,tooManyImages:IS,htmlSnippetNode:LS,obfuscateMark:RS,mediaNode:DS,platformVideo:$S,internalLinkNode:PS,linkDialog:BS,toolbar:zS,warnings:HS},US="Rimuovere",VS="Validare",KS="Annulla",WS="Immagine",jS="auto",qS="Caricamento immagine…",GS="Immagine caricata con successo",JS="Errore nel caricamento dell'immagine",ZS="Funzionalità di caricamento non disponibile",YS="Troppe immagini. Verranno elaborate solo le prime {{ count }}.",XS={htmlSnippet:"Frammento HTML",insertHtmlSnippet:"Inserisci frammento HTML",confirmDeletion:"Conferma eliminazione",htmlSnippetDeletionConfirm:"Sei sicuro di voler eliminare questo frammento HTML?"},QS={obfuscate:"Offuscare",obfuscator:"Offuscatore",content:"Contenuto",asALink:"Come link",doNotObfuscate:"Non offuscare",done:"Fatto"},ew={imageProperties:"Proprietà dell'immagine",sizes:"Dimensioni",variantLabel:"Dimensione {{ n }}",alignment:"Allineamento",left:"Sinistra",center:"Centro",right:"Destra",options:"Opzioni",link:"Link",enableZoom:"Abilita zoom",mediaProperties:"Proprietà del media",caption:"Didascalia",pixelRatio:"Rapporto pixel"},tw={insertVideo:"Inserisci un video",videoDialog:"Imposta un video"},nw={insertInternalLink:"Inserisci un link interno"},rw={editLink:"Modifica collegamento",insertLink:"Inserisci collegamento",label:"Etichetta",url:"URL",openInNewTab:"Apri in una nuova scheda",openLink:"Apri il collegamento",removeLink:"Rimuovi collegamento",validate:"Validare"},iw={paragraph:"Paragrafo",paragraphShort:"P",heading2:"Titolo 2",heading2Short:"T2",heading3:"Titolo 3",heading3Short:"T3",heading4:"Titolo 4",heading4Short:"T4",bold:"Grassetto",italic:"Corsivo",strikethrough:"Barrato",obfuscate:"Offuscare",blockquote:"Citazione",bulletList:"Elenco puntato",orderedList:"Elenco numerato",link:"Collegamento",code:"Codice in linea",codeBlock:"Blocco di codice",alignmentDefault:"Predefinito",alignmentCenter:"Centra",alignmentRight:"A destra",textSize:"Dimensione del testo",textSizeSmall:"Piccolo",textSizeNormal:"Normale",textSizeLarge:"Grande",textSizeHuge:"Molto grande",undo:"Annulla",redo:"Ripeti",clearFormatting:"Cancella formattazione",more:"Altro"},sw={videoPluginNotAvailable:"Plugin video non disponibile",internalLinkPluginNotAvailable:"Plugin link interno non disponibile"},ow={remove:US,validate:VS,cancel:KS,delete:"Elimina",image:WS,auto:jS,uploadingImage:qS,imageUploadSuccess:GS,imageUploadFailed:JS,uploadNotAvailable:ZS,tooManyImages:YS,htmlSnippetNode:XS,obfuscateMark:QS,mediaNode:ew,platformVideo:tw,internalLinkNode:nw,linkDialog:rw,toolbar:iw,warnings:sw},aw="Remover",lw="Validar",cw="Cancelar",dw="Imagem",uw="auto",hw="Enviando imagem…",fw="Imagem enviada com sucesso",pw="Falha ao enviar imagem",mw="Funcionalidade de envio não disponível",gw="Muitas imagens. Apenas as primeiras {{ count }} serão processadas.",bw={htmlSnippet:"Fragmento HTML",insertHtmlSnippet:"Inserir fragmento HTML",confirmDeletion:"Confirmar exclusão",htmlSnippetDeletionConfirm:"Tem certeza de que deseja excluir este fragmento HTML?"},yw={obfuscate:"Ofuscar",obfuscator:"Ofuscador",content:"Conteúdo",asALink:"Como link",doNotObfuscate:"Não ofuscar",done:"Concluído"},kw={imageProperties:"Propriedades da imagem",sizes:"Tamanhos",variantLabel:"Tamanho {{ n }}",alignment:"Alinhamento",left:"Esquerda",center:"Centro",right:"Direita",options:"Opções",link:"Link",enableZoom:"Ativar zoom",mediaProperties:"Propriedades da mídia",caption:"Legenda",pixelRatio:"Proporção de pixels"},vw={insertVideo:"Inserir um vídeo",videoDialog:"Definir um vídeo"},Ew={insertInternalLink:"Inserir um link interno"},xw={editLink:"Editar link",insertLink:"Inserir link",label:"Rótulo",url:"URL",openInNewTab:"Abrir em nova aba",openLink:"Abrir o link",removeLink:"Remover link",validate:"Validar"},Sw={paragraph:"Parágrafo",paragraphShort:"P",heading2:"Título 2",heading2Short:"T2",heading3:"Título 3",heading3Short:"T3",heading4:"Título 4",heading4Short:"T4",bold:"Negrito",italic:"Itálico",strikethrough:"Tachado",obfuscate:"Ofuscar",blockquote:"Citação",bulletList:"Lista com marcadores",orderedList:"Lista numerada",link:"Link",code:"Código em linha",codeBlock:"Bloco de código",alignmentDefault:"Padrão",alignmentCenter:"Centralizar",alignmentRight:"À direita",textSize:"Tamanho do texto",textSizeSmall:"Pequeno",textSizeNormal:"Normal",textSizeLarge:"Grande",textSizeHuge:"Muito grande",undo:"Desfazer",redo:"Refazer",clearFormatting:"Limpar formatação",more:"Mais"},ww={videoPluginNotAvailable:"Plugin de vídeo não disponível",internalLinkPluginNotAvailable:"Plugin de link interno não disponível"},Tw={remove:aw,validate:lw,cancel:cw,delete:"Excluir",image:dw,auto:uw,uploadingImage:hw,imageUploadSuccess:fw,imageUploadFailed:pw,uploadNotAvailable:mw,tooManyImages:gw,htmlSnippetNode:bw,obfuscateMark:yw,mediaNode:kw,platformVideo:vw,internalLinkNode:Ew,linkDialog:xw,toolbar:Sw,warnings:ww},Hc={en:rS,fr:FS,es:xS,de:Bx,it:ow,pt:Tw};class Mw{constructor(e){this._ctx={language:"",dict:{}},this.setLanguage(e)}setLanguage(e,t){const r=Object.keys(Hc),i=qf(e,{pluginLanguages:r,siteLanguages:t}),s=i,o={};tf(Hc[s],"",o),this._ctx={language:i,dict:o}}t(e,t){let r=this._ctx.dict[e]??e;if(t)for(const[i,s]of Object.entries(t))r=r.replace(new RegExp(`\\{\\{\\s*${i}\\s*\\}\\}`,"g"),String(s));return r}}function tf(n,e,t){for(const r in n){const i=n[r],s=e?`${e}.${r}`:r;i&&typeof i=="object"&&!Array.isArray(i)?tf(i,s,t):typeof i=="string"&&(t[s]=i)}}const Ho=kx(),Rw={init:Cw,create:Aw};function Cw(n){const e=`${n.pluginBaseUrl}/admin-ui-plugin.css`,t=document.createElement("link");t.rel="stylesheet",t.href=e,document.head.appendChild(t),n.registerHook("htmlEditorServiceProvider",()=>Ho.service)}function Aw(n){const{fieldType:e}=n;if(e.dataType!=="json")throw new Error(`field type '${e.name}' is incompatible with Tiptap plugin, needs data type 'json'`);if(n.initialValue!==void 0&&!Vc(n.initialValue))throw new Error(`field type '${e.name}' is incompatible, should be a json, got '${typeof n.initialValue}'`);let t=Fc(n.initialValue),r=n.language;const i=new Mw(r),s=document.createElement("tiptap-editor");return s.service=n,s.i18n=i,s.videoPluginHook=Ho.videoPlugin,s.internalLinkPluginHook=Ho.internalLinkPlugin,s.initialContent=t,s.onChange=o=>{Nw(o,t)?n.cancelModifiedValue():n.setModifiedValue(Uc(o)),t=o??void 0},{element:s,setValue:o=>{t=Fc(o),s.setContent(t)},setLanguage:o=>{r=o,i.setLanguage(o),s.updateLanguage(o)},getValue:()=>Uc(s.getJSON()),dispose:()=>{s.remove()},insertMedia:async o=>{await s.insertMediaFromGallery(o)}}}function Fc(n){if(n!==void 0)return Vc(n)&&typeof n.j=="object"&&n.j!==null&&"type"in n.j&&n.j.type==="doc"?n.j:void 0}function Uc(n){return Fo(n)?null:{j:n}}function Fo(n){if(!n||n.type!=="doc"||!n.content)return!0;const e=n.content.length;if(e===0)return!0;if(e>1)return!1;const t=n.content[0];return t.type!=="paragraph"?!1:!t.content||t.content.length===0}function Nw(n,e){const t=Fo(n),r=Fo(e);return t&&r?!0:t!==r?!1:JSON.stringify(n)===JSON.stringify(e)}export{Rw as default};
|
|
997
|
+
`;lr([Me({attribute:!1})],cn.prototype,"editor",2);lr([Me({attribute:!1})],cn.prototype,"service",2);lr([Me({attribute:!1})],cn.prototype,"i18n",2);lr([Me({attribute:!1})],cn.prototype,"videoPluginHook",2);lr([Me({attribute:!1})],cn.prototype,"internalLinkPluginHook",2);cn=lr([Fo("tiptap-toolbar")],cn);function AS(){const t={videoPlugin:void 0,internalLinkPlugin:void 0};return{get videoPlugin(){return t.videoPlugin},get internalLinkPlugin(){return t.internalLinkPlugin},service:{registerVideoPlugin(e){if(t.videoPlugin)throw new Error("Video plugin already registered");t.videoPlugin=e},registerInternalLinkPlugin(e){if(t.internalLinkPlugin)throw new Error("Internal link plugin already registered");t.internalLinkPlugin=e}}}}const NS="Entfernen",_S="Validieren",OS="Abbrechen",IS="Bild",RS="auto",LS="Bild wird hochgeladen…",DS="Bild erfolgreich hochgeladen",$S="Fehler beim Hochladen des Bildes",PS="Upload-Funktion nicht verfügbar",BS="Zu viele Bilder. Nur die ersten {{ count }} werden verarbeitet.",zS={htmlSnippet:"HTML-Snippet",insertHtmlSnippet:"HTML-Snippet einfügen",confirmDeletion:"Löschung bestätigen",htmlSnippetDeletionConfirm:"Sind Sie sicher, dass Sie dieses HTML-Snippet löschen möchten?"},HS={obfuscate:"Verschleiern",obfuscator:"Verschleierer",content:"Inhalt",asALink:"Als Link",doNotObfuscate:"Nicht verschleiern",done:"Fertig"},FS={imageProperties:"Bildeigenschaften",sizes:"Größen",variantLabel:"Größe {{ n }}",alignment:"Ausrichtung",left:"Links",center:"Zentriert",right:"Rechts",options:"Optionen",link:"Link",enableZoom:"Zoom aktivieren",mediaProperties:"Medieneigenschaften",caption:"Bildunterschrift",pixelRatio:"Pixelverhältnis"},US={insertVideo:"Video einfügen",videoDialog:"Video festlegen"},VS={insertInternalLink:"Internen Link einfügen"},WS={editLink:"Link bearbeiten",insertLink:"Link einfügen",label:"Beschriftung",url:"URL",openInNewTab:"In neuem Tab öffnen",openLink:"Link öffnen",removeLink:"Link entfernen",validate:"Validieren"},KS={paragraph:"Absatz",paragraphShort:"A",heading2:"Überschrift 2",heading2Short:"Ü2",heading3:"Überschrift 3",heading3Short:"Ü3",heading4:"Überschrift 4",heading4Short:"Ü4",bold:"Fett",italic:"Kursiv",strikethrough:"Durchgestrichen",obfuscate:"Verschleiern",blockquote:"Zitat",bulletList:"Aufzählungsliste",orderedList:"Nummerierte Liste",link:"Link",code:"Inline-Code",codeBlock:"Codeblock",alignmentDefault:"Standard",alignmentCenter:"Zentriert",alignmentRight:"Rechts",textSize:"Textgröße",textSizeSmall:"Klein",textSizeNormal:"Normal",textSizeLarge:"Groß",textSizeHuge:"Sehr groß",undo:"Rückgängig",redo:"Wiederholen",clearFormatting:"Formatierung löschen",more:"Mehr"},jS={videoPluginNotAvailable:"Video-Plugin nicht verfügbar",internalLinkPluginNotAvailable:"Interner-Link-Plugin nicht verfügbar"},qS={remove:NS,validate:_S,cancel:OS,delete:"Löschen",image:IS,auto:RS,uploadingImage:LS,imageUploadSuccess:DS,imageUploadFailed:$S,uploadNotAvailable:PS,tooManyImages:BS,htmlSnippetNode:zS,obfuscateMark:HS,mediaNode:FS,platformVideo:US,internalLinkNode:VS,linkDialog:WS,toolbar:KS,warnings:jS},GS="Remove",JS="Validate",ZS="Cancel",YS="Image",XS="Auto",QS="Uploading image…",e1="Image uploaded successfully",t1="Failed to upload image",n1="Upload functionality not available",r1="Too many images. Only the first {{ count }} will be processed.",i1={htmlSnippet:"HTML Snippet",insertHtmlSnippet:"Insert HTML Snippet",confirmDeletion:"Confirm Deletion",htmlSnippetDeletionConfirm:"Are you sure you want to delete this HTML Snippet?"},o1={obfuscate:"Obfuscate",obfuscator:"Obfuscator",content:"Content",asALink:"As a link",doNotObfuscate:"Do not obfuscate",done:"Done"},s1={imageProperties:"Image Properties",removedImage:"Removed image",imageNoLongerExists:"This image no longer exists in the media library.",sizes:"Sizes",variantLabel:"Size {{ n }}",alignment:"Alignment",left:"Left",center:"Center",right:"Right",options:"Options",link:"Link",enableZoom:"Enable Zoom",mediaProperties:"Media Properties",caption:"Caption",pixelRatio:"Pixel Ratio"},a1={insertVideo:"Insert Video",videoDialog:"Set a video"},l1={insertInternalLink:"Insert Internal Link"},c1={editLink:"Edit Link",insertLink:"Insert Link",label:"Label",url:"URL",openInNewTab:"Open in new tab",openLink:"Open the link",removeLink:"Remove Link",validate:"Validate"},d1={paragraph:"Paragraph",paragraphShort:"P",heading2:"Heading 2",heading2Short:"H2",heading3:"Heading 3",heading3Short:"H3",heading4:"Heading 4",heading4Short:"H4",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",obfuscate:"Obfuscate",blockquote:"Blockquote",bulletList:"Bullet List",orderedList:"Ordered List",link:"Link",code:"Inline Code",codeBlock:"Code Block",alignmentDefault:"Default",alignmentCenter:"Center",alignmentRight:"Right",textSize:"Text size",textSizeSmall:"Small",textSizeNormal:"Normal",textSizeLarge:"Large",textSizeHuge:"Huge",undo:"Undo",redo:"Redo",clearFormatting:"Clear Formatting",more:"More"},u1={videoPluginNotAvailable:"Video plugin not available",internalLinkPluginNotAvailable:"Internal link plugin not available"},h1={remove:GS,validate:JS,cancel:ZS,delete:"Delete",image:YS,auto:XS,uploadingImage:QS,imageUploadSuccess:e1,imageUploadFailed:t1,uploadNotAvailable:n1,tooManyImages:r1,htmlSnippetNode:i1,obfuscateMark:o1,mediaNode:s1,platformVideo:a1,internalLinkNode:l1,linkDialog:c1,toolbar:d1,warnings:u1},f1="Quitar",p1="Validar",m1="Cancelar",g1="Imagen",b1="auto",y1="Subiendo imagen…",k1="Imagen subida con éxito",w1="Error al subir la imagen",v1="Funcionalidad de carga no disponible",E1="Demasiadas imágenes. Solo se procesarán las primeras {{ count }}.",x1={htmlSnippet:"Fragmento HTML",insertHtmlSnippet:"Insertar fragmento HTML",confirmDeletion:"Confirmar eliminación",htmlSnippetDeletionConfirm:"¿Está seguro de que desea eliminar este fragmento HTML?"},S1={obfuscate:"Ofuscar",obfuscator:"Ofuscador",content:"Contenido",asALink:"Como enlace",doNotObfuscate:"No ofuscar",done:"Hecho"},C1={imageProperties:"Propiedades de la imagen",sizes:"Tamaños",variantLabel:"Tamaño {{ n }}",alignment:"Alineación",left:"Izquierda",center:"Centro",right:"Derecha",options:"Opciones",link:"Enlace",enableZoom:"Habilitar zoom",mediaProperties:"Propiedades del medio",caption:"Leyenda",pixelRatio:"Proporción de píxeles"},T1={insertVideo:"Insertar un video",videoDialog:"Configurar un video"},M1={insertInternalLink:"Insertar un enlace interno"},A1={editLink:"Editar enlace",insertLink:"Insertar enlace",label:"Etiqueta",url:"URL",openInNewTab:"Abrir en nueva pestaña",openLink:"Abrir el enlace",removeLink:"Eliminar enlace",validate:"Validar"},N1={paragraph:"Párrafo",paragraphShort:"P",heading2:"Título 2",heading2Short:"T2",heading3:"Título 3",heading3Short:"T3",heading4:"Título 4",heading4Short:"T4",bold:"Negrita",italic:"Cursiva",strikethrough:"Tachado",obfuscate:"Ofuscar",blockquote:"Cita",bulletList:"Lista con viñetas",orderedList:"Lista numerada",link:"Enlace",code:"Código en línea",codeBlock:"Bloque de código",alignmentDefault:"Predeterminado",alignmentCenter:"Centrar",alignmentRight:"A la derecha",textSize:"Tamaño del texto",textSizeSmall:"Pequeño",textSizeNormal:"Normal",textSizeLarge:"Grande",textSizeHuge:"Muy grande",undo:"Deshacer",redo:"Rehacer",clearFormatting:"Borrar formato",more:"Más"},_1={videoPluginNotAvailable:"Plugin de video no disponible",internalLinkPluginNotAvailable:"Plugin de enlace interno no disponible"},O1={remove:f1,validate:p1,cancel:m1,delete:"Eliminar",image:g1,auto:b1,uploadingImage:y1,imageUploadSuccess:k1,imageUploadFailed:w1,uploadNotAvailable:v1,tooManyImages:E1,htmlSnippetNode:x1,obfuscateMark:S1,mediaNode:C1,platformVideo:T1,internalLinkNode:M1,linkDialog:A1,toolbar:N1,warnings:_1},I1="Retirer",R1="Valider",L1="Annuler",D1="Image",$1="auto",P1="Téléchargement de l'image…",B1="Image téléchargée avec succès",z1="Échec du téléchargement de l'image",H1="Fonctionnalité de téléchargement non disponible",F1="Trop d'images. Seules les {{ count }} premières seront traitées.",U1={htmlSnippet:"Code HTML",insertHtmlSnippet:"Insérer du code HTML",confirmDeletion:"Confirmer la suppression",htmlSnippetDeletionConfirm:"Voulez-vous vraiment supprimer ce code HTML ?"},V1={obfuscate:"Obfusquer",obfusquator:"Obfusqueur",content:"Contenu",asALink:"En tant que lien",doNotObfuscate:"Ne pas obfusquer",done:"Terminé"},W1={imageProperties:"Propriétés de l'image",removedImage:"Image supprimée",imageNoLongerExists:"Cette image n'existe plus dans la médiathèque.",sizes:"Tailles",variantLabel:"Taille {{ n }}",alignment:"Alignement",left:"À gauche",center:"Centrer",right:"À droite",options:"Options",link:"Lien",enableZoom:"Activer le zoom",mediaProperties:"Propriétés du média",caption:"Légende",pixelRatio:"Pixel ratio"},K1={insertVideo:"Insérer une vidéo",videoDialog:"Définir une vidéo"},j1={insertInternalLink:"Insérer un lien interne"},q1={editLink:"Modifier le lien",insertLink:"Insérer un lien",label:"Libellé",url:"URL",openInNewTab:"Ouvrir dans un nouvel onglet",openLink:"Ouvrir le lien",removeLink:"Supprimer le lien",validate:"Valider"},G1={paragraph:"Paragraphe",paragraphShort:"P",heading2:"Titre 2",heading2Short:"T2",heading3:"Titre 3",heading3Short:"T3",heading4:"Titre 4",heading4Short:"T4",bold:"Gras",italic:"Italique",strikethrough:"Barré",obfuscate:"Obfusquer",blockquote:"Citation",bulletList:"Liste à puces",orderedList:"Liste numérotée",link:"Lien",code:"Code en ligne",codeBlock:"Bloc de code",alignmentDefault:"Par défaut",alignmentCenter:"Centrer",alignmentRight:"À droite",textSize:"Taille du texte",textSizeSmall:"Petit",textSizeNormal:"Normal",textSizeLarge:"Grand",textSizeHuge:"Très grand",undo:"Annuler",redo:"Rétablir",clearFormatting:"Effacer la mise en forme",more:"Plus"},J1={videoPluginNotAvailable:"Plugin vidéo non disponible",internalLinkPluginNotAvailable:"Plugin de lien interne non disponible"},Z1={remove:I1,validate:R1,cancel:L1,delete:"Supprimer",image:D1,auto:$1,uploadingImage:P1,imageUploadSuccess:B1,imageUploadFailed:z1,uploadNotAvailable:H1,tooManyImages:F1,htmlSnippetNode:U1,obfuscateMark:V1,mediaNode:W1,platformVideo:K1,internalLinkNode:j1,linkDialog:q1,toolbar:G1,warnings:J1},Y1="Rimuovere",X1="Validare",Q1="Annulla",eC="Immagine",tC="auto",nC="Caricamento immagine…",rC="Immagine caricata con successo",iC="Errore nel caricamento dell'immagine",oC="Funzionalità di caricamento non disponibile",sC="Troppe immagini. Verranno elaborate solo le prime {{ count }}.",aC={htmlSnippet:"Frammento HTML",insertHtmlSnippet:"Inserisci frammento HTML",confirmDeletion:"Conferma eliminazione",htmlSnippetDeletionConfirm:"Sei sicuro di voler eliminare questo frammento HTML?"},lC={obfuscate:"Offuscare",obfuscator:"Offuscatore",content:"Contenuto",asALink:"Come link",doNotObfuscate:"Non offuscare",done:"Fatto"},cC={imageProperties:"Proprietà dell'immagine",sizes:"Dimensioni",variantLabel:"Dimensione {{ n }}",alignment:"Allineamento",left:"Sinistra",center:"Centro",right:"Destra",options:"Opzioni",link:"Link",enableZoom:"Abilita zoom",mediaProperties:"Proprietà del media",caption:"Didascalia",pixelRatio:"Rapporto pixel"},dC={insertVideo:"Inserisci un video",videoDialog:"Imposta un video"},uC={insertInternalLink:"Inserisci un link interno"},hC={editLink:"Modifica collegamento",insertLink:"Inserisci collegamento",label:"Etichetta",url:"URL",openInNewTab:"Apri in una nuova scheda",openLink:"Apri il collegamento",removeLink:"Rimuovi collegamento",validate:"Validare"},fC={paragraph:"Paragrafo",paragraphShort:"P",heading2:"Titolo 2",heading2Short:"T2",heading3:"Titolo 3",heading3Short:"T3",heading4:"Titolo 4",heading4Short:"T4",bold:"Grassetto",italic:"Corsivo",strikethrough:"Barrato",obfuscate:"Offuscare",blockquote:"Citazione",bulletList:"Elenco puntato",orderedList:"Elenco numerato",link:"Collegamento",code:"Codice in linea",codeBlock:"Blocco di codice",alignmentDefault:"Predefinito",alignmentCenter:"Centra",alignmentRight:"A destra",textSize:"Dimensione del testo",textSizeSmall:"Piccolo",textSizeNormal:"Normale",textSizeLarge:"Grande",textSizeHuge:"Molto grande",undo:"Annulla",redo:"Ripeti",clearFormatting:"Cancella formattazione",more:"Altro"},pC={videoPluginNotAvailable:"Plugin video non disponibile",internalLinkPluginNotAvailable:"Plugin link interno non disponibile"},mC={remove:Y1,validate:X1,cancel:Q1,delete:"Elimina",image:eC,auto:tC,uploadingImage:nC,imageUploadSuccess:rC,imageUploadFailed:iC,uploadNotAvailable:oC,tooManyImages:sC,htmlSnippetNode:aC,obfuscateMark:lC,mediaNode:cC,platformVideo:dC,internalLinkNode:uC,linkDialog:hC,toolbar:fC,warnings:pC},gC="Remover",bC="Validar",yC="Cancelar",kC="Imagem",wC="auto",vC="Enviando imagem…",EC="Imagem enviada com sucesso",xC="Falha ao enviar imagem",SC="Funcionalidade de envio não disponível",CC="Muitas imagens. Apenas as primeiras {{ count }} serão processadas.",TC={htmlSnippet:"Fragmento HTML",insertHtmlSnippet:"Inserir fragmento HTML",confirmDeletion:"Confirmar exclusão",htmlSnippetDeletionConfirm:"Tem certeza de que deseja excluir este fragmento HTML?"},MC={obfuscate:"Ofuscar",obfuscator:"Ofuscador",content:"Conteúdo",asALink:"Como link",doNotObfuscate:"Não ofuscar",done:"Concluído"},AC={imageProperties:"Propriedades da imagem",sizes:"Tamanhos",variantLabel:"Tamanho {{ n }}",alignment:"Alinhamento",left:"Esquerda",center:"Centro",right:"Direita",options:"Opções",link:"Link",enableZoom:"Ativar zoom",mediaProperties:"Propriedades da mídia",caption:"Legenda",pixelRatio:"Proporção de pixels"},NC={insertVideo:"Inserir um vídeo",videoDialog:"Definir um vídeo"},_C={insertInternalLink:"Inserir um link interno"},OC={editLink:"Editar link",insertLink:"Inserir link",label:"Rótulo",url:"URL",openInNewTab:"Abrir em nova aba",openLink:"Abrir o link",removeLink:"Remover link",validate:"Validar"},IC={paragraph:"Parágrafo",paragraphShort:"P",heading2:"Título 2",heading2Short:"T2",heading3:"Título 3",heading3Short:"T3",heading4:"Título 4",heading4Short:"T4",bold:"Negrito",italic:"Itálico",strikethrough:"Tachado",obfuscate:"Ofuscar",blockquote:"Citação",bulletList:"Lista com marcadores",orderedList:"Lista numerada",link:"Link",code:"Código em linha",codeBlock:"Bloco de código",alignmentDefault:"Padrão",alignmentCenter:"Centralizar",alignmentRight:"À direita",textSize:"Tamanho do texto",textSizeSmall:"Pequeno",textSizeNormal:"Normal",textSizeLarge:"Grande",textSizeHuge:"Muito grande",undo:"Desfazer",redo:"Refazer",clearFormatting:"Limpar formatação",more:"Mais"},RC={videoPluginNotAvailable:"Plugin de vídeo não disponível",internalLinkPluginNotAvailable:"Plugin de link interno não disponível"},LC={remove:gC,validate:bC,cancel:yC,delete:"Excluir",image:kC,auto:wC,uploadingImage:vC,imageUploadSuccess:EC,imageUploadFailed:xC,uploadNotAvailable:SC,tooManyImages:CC,htmlSnippetNode:TC,obfuscateMark:MC,mediaNode:AC,platformVideo:NC,internalLinkNode:_C,linkDialog:OC,toolbar:IC,warnings:RC},Nd={en:h1,fr:Z1,es:O1,de:qS,it:mC,pt:LC};class DC{constructor(e){this._ctx={language:"",dict:{}},this.setLanguage(e)}setLanguage(e,n){const r=Object.keys(Nd),i=jp(e,{pluginLanguages:r,siteLanguages:n}),o=i,s={};tp(Nd[o],"",s),this._ctx={language:i,dict:s}}t(e,n){let r=this._ctx.dict[e]??e;if(n)for(const[i,o]of Object.entries(n))r=r.replace(new RegExp(`\\{\\{\\s*${i}\\s*\\}\\}`,"g"),String(o));return r}}function tp(t,e,n){for(const r in t){const i=t[r],o=e?`${e}.${r}`:r;i&&typeof i=="object"&&!Array.isArray(i)?tp(i,o,n):typeof i=="string"&&(n[o]=i)}}const ua=AS(),WC={init:$C,create:PC};function $C(t){const e=`${t.pluginBaseUrl}/admin-ui-plugin.css`,n=document.createElement("link");n.rel="stylesheet",n.href=e,document.head.appendChild(n),t.registerHook("htmlEditorServiceProvider",()=>ua.service)}function PC(t){const{fieldType:e}=t;if(e.dataType!=="json")throw new Error(`field type '${e.name}' is incompatible with Tiptap plugin, needs data type 'json'`);if(t.initialValue!==void 0&&!Id(t.initialValue))throw new Error(`field type '${e.name}' is incompatible, should be a json, got '${typeof t.initialValue}'`);let n=_d(t.initialValue),r=t.language;const i=new DC(r),o=document.createElement("tiptap-editor");return o.service=t,o.i18n=i,o.videoPluginHook=ua.videoPlugin,o.internalLinkPluginHook=ua.internalLinkPlugin,o.initialContent=n,o.onChange=s=>{BC(s,n)?t.cancelModifiedValue():t.setModifiedValue(Od(s)),n=s??void 0},{element:o,setValue:s=>{n=_d(s),o.setContent(n)},setLanguage:s=>{r=s,i.setLanguage(s),o.updateLanguage(s)},getValue:()=>Od(o.getJSON()),dispose:()=>{o.remove()},insertMedia:async s=>{await o.insertMediaFromGallery(s)}}}function _d(t){if(t!==void 0)return Id(t)&&typeof t.j=="object"&&t.j!==null&&"type"in t.j&&t.j.type==="doc"?t.j:void 0}function Od(t){return ha(t)?null:{j:t}}function ha(t){if(!t||t.type!=="doc"||!t.content)return!0;const e=t.content.length;if(e===0)return!0;if(e>1)return!1;const n=t.content[0];return n.type!=="paragraph"?!1:!n.content||n.content.length===0}function BC(t,e){const n=ha(t),r=ha(e);return n&&r?!0:n!==r?!1:JSON.stringify(t)===JSON.stringify(e)}export{WC as default};
|