reactjs-tiptap-editor 0.0.28 → 0.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ "use strict";function Y(n){this.content=n}Y.prototype={constructor:Y,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),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new Y(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Y(t)},addToStart:function(n,e){return new Y([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Y(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new Y(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=Y.from(n),n.size?new Y(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Y.from(n),n.size?new Y(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Y.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}};Y.from=function(n){if(n instanceof Y)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Y(e)};function wu(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),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)t++;return t}if(i.content.size||o.content.size){let s=wu(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function xu(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let s=n.child(--i),l=e.child(--o),a=s.nodeSize;if(s==l){t-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let c=0,f=Math.min(s.text.length,l.text.length);for(;c<f&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(s.content.size||l.content.size){let c=xu(s.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class b{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,o){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,i+l,o||null,s)!==!1&&a.content.size){let f=l+1;a.nodesBetween(Math.max(0,e-f),Math.min(a.content.size,t-f),r,i+f)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new b(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 o=0,s=0;s<t;o++){let l=this.content[o],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),i+=l.nodeSize),s=a}return new b(r,i)}cutByIndex(e,t){return e==t?b.empty:e==0&&t==this.content.length?this:new b(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new b(i,o)}addToStart(e){return new b([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new b(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 wu(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return xu(this,e,t,r)}findIndex(e,t=-1){if(e==0)return gr(0,e);if(e==this.size)return gr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||t>0?gr(r+1,s):gr(r,i);i=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 b.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new b(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return b.empty;let t,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)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new b(t||e,r)}static from(e){if(!e)return b.empty;if(e instanceof b)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new b([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}b.empty=new b([],0);const po={index:0,offset:0};function gr(n,e){return po.index=n,po.offset=e,po}function Kr(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(!Kr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Kr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}class B{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,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))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}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&&Kr(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 B.none;if(e instanceof B)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}}B.none=[];class qr extends Error{}class v{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=ku(this.content,e+this.openStart,t);return r&&new v(r,this.openStart,this.openEnd)}removeBetween(e,t){return new v(Cu(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 v.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 v(b.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new v(e,r,i)}}v.empty=new v(b.empty,0,0);function Cu(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(i==e||o.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Cu(o.content,e-i-1,t-i-1)))}function ku(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),s=n.maybeChild(i);if(o==e||s.isText)return n.cut(0,e).append(t).append(n.cut(e));let l=ku(s.content,e-o-1,t);return l&&n.replaceChild(i,s.copy(l))}function Wp(n,e,t){if(t.openStart>n.depth)throw new qr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new qr("Inconsistent open depths");return Ou(n,e,t,0)}function Ou(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let s=Ou(n,e,t,r+1);return o.copy(o.content.replaceChild(i,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,l=s.content;return $t(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=Hp(t,n);return $t(o,Tu(n,s,l,e,r))}else return $t(o,Gr(n,e,r))}function Au(n,e){if(!e.type.compatibleContent(n.type))throw new qr("Cannot join "+e.type.name+" onto "+n.type.name)}function ls(n,e,t){let r=n.node(t);return Au(r,e.node(t)),r}function Pt(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 Wn(n,e,t,r){let i=(e||n).node(t),o=0,s=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Pt(n.nodeAfter,r),o++));for(let l=o;l<s;l++)Pt(i.child(l),r);e&&e.depth==t&&e.textOffset&&Pt(e.nodeBefore,r)}function $t(n,e){return n.type.checkContent(e),n.copy(e)}function Tu(n,e,t,r,i){let o=n.depth>i&&ls(n,e,i+1),s=r.depth>i&&ls(t,r,i+1),l=[];return Wn(null,n,i,l),o&&s&&e.index(i)==t.index(i)?(Au(o,s),Pt($t(o,Tu(n,e,t,r,i+1)),l)):(o&&Pt($t(o,Gr(n,e,i+1)),l),Wn(e,t,i,l),s&&Pt($t(s,Gr(t,r,i+1)),l)),Wn(r,null,i,l),new b(l)}function Gr(n,e,t){let r=[];if(Wn(null,n,t,r),n.depth>t){let i=ls(n,e,t+1);Pt($t(i,Gr(n,e,t+1)),r)}return Wn(e,null,t,r),new b(r)}function Hp(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(b.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class er{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 o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return B.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}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 t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.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 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 Yr(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,o=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(o),c=o-a;if(r.push(s,l,i+a),!c||(s=s.child(l),s.isText))break;o=c-1,i+=a+1}return new er(t,r,o)}static resolveCached(e,t){let r=aa.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==t)return s}else aa.set(e,r=new Up);let i=r.elts[r.i]=er.resolve(e,t);return r.i=(r.i+1)%Jp,i}}class Up{constructor(){this.elts=[],this.i=0}}const Jp=12,aa=new WeakMap;class Yr{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 Kp=Object.create(null);class Oe{constructor(e,t,r,i=B.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||b.empty}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&&Kr(this.attrs,t||e.defaultAttrs||Kp)&&B.sameSet(this.marks,r||B.none)}copy(e=null){return e==this.content?this:new Oe(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Oe(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 v.empty;let i=this.resolve(e),o=this.resolve(t),s=r?0:i.sharedDepth(t),l=i.start(s),c=i.node(s).content.cut(i.pos-l,o.pos-l);return new v(c,i.depth-s,o.depth-s)}replace(e,t,r){return Wp(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 er.resolveCached(this,e)}resolveNoCache(e){return er.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,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()+")"),Eu(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=b.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=B.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(!B.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=b.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}}Oe.prototype.text=void 0;class Xr extends Oe{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):Eu(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 Xr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Xr(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 Eu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class _t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new qp(e,t);if(r.next==null)return _t.empty;let i=Mu(r);r.next&&r.err("Unexpected trailing text");let o=tm(em(i));return nm(o,r),o}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 o=t;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: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 o(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return b.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:f,next:u}=s.next[c];if(!(f.isText||f.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let d=o(u,l.concat(f));if(d)return d}}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 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(),o=i.match;if(o.matchType(e)){let s=[];for(let l=i;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:l,next:a}=o.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let 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 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(`
2
+ `)}}_t.empty=new _t(!0);class qp{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 Mu(n){let e=[];do e.push(Gp(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Gp(n){let e=[];do e.push(Yp(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Yp(n){let e=Zp(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=Xp(n,e);else break;return e}function ca(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Xp(n,e){let t=ca(n),r=t;return n.eat(",")&&(n.next!="}"?r=ca(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Qp(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let s=t[o];s.groups.indexOf(e)>-1&&i.push(s)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Zp(n){if(n.eat("(")){let e=Mu(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=Qp(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 em(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function i(s,l){s.forEach(a=>a.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=o(s.exprs[a],l);if(a==s.exprs.length-1)return c;i(c,l=t())}else if(s.type=="star"){let a=t();return r(l,a),i(o(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return i(o(s.expr,l),a),i(o(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let f=t();i(o(s.expr,a),f),a=f}if(s.max==-1)i(o(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let f=t();r(a,f),i(o(s.expr,a),f),a=f}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Nu(n,e){return e-n}function fa(n,e){let t=[];return r(e),t.sort(Nu);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let s=0;s<o.length;s++){let{term:l,to:a}=o[s];!l&&t.indexOf(a)==-1&&r(a)}}}function tm(n){let e=Object.create(null);return t(fa(n,0));function t(r){let i=[];r.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let f=0;f<i.length;f++)i[f][0]==l&&(c=i[f][1]);fa(n,a).forEach(f=>{c||i.push([l,c=[]]),c.indexOf(f)==-1&&c.push(f)})})});let o=e[r.join(",")]=new _t(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort(Nu);o.next.push({type:i[s][0],next:e[l.join(",")]||t(l)})}return o}}function nm(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,s=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];s.push(a.name),o&&!(a.isText||a.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 Ru(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 Iu(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function Du(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 o=n[i];o.validate&&o.validate(e[i])}}function Pu(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new im(n,r,e[r]);return t}let ua=class $u{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=Pu(e,r.attrs),this.defaultAttrs=Ru(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==_t.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}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:Iu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Oe(this,this.computeAttrs(e),b.from(t),B.setFrom(r))}createChecked(e=null,t,r){return t=b.from(t),this.checkContent(t),new Oe(this,this.computeAttrs(e),t,B.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=b.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(b.empty,!0);return o?new Oe(this,e,t.append(o),B.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){Du(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:B.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new $u(o,t,s));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 o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function rm(n,e,t){let r=t.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 ${n}, got ${o}`)}}class im{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?rm(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Qi{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Pu(e,i.attrs),this.excluded=null;let o=Ru(this.attrs);this.instance=o?new B(this,o):null}create(e=null){return!e&&this.instance?this.instance:new B(this,Iu(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Qi(o,i++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Du(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class om{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=Y.from(e.nodes),t.marks=Y.from(e.marks||{}),this.nodes=ua.compile(this.spec.nodes,this),this.marks=Qi.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||"",l=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=_t.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=l=="_"?null:l?da(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:da(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),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 ua){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 Xr(r,r.defaultAttrs,e,B.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Oe.fromJSON(this,e)}markFromJSON(e){return B.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function da(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],s=o;if(o)t.push(o);else for(let l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function sm(n){return n.tag!=null}function lm(n){return n.style!=null}class gn{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(sm(i))this.tags.push(i);else if(lm(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,t={}){let r=new pa(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new pa(this,t,!0);return r.addAll(e,t.from,t.to),v.maxOpen(r.finish())}matchTag(e,t,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||t.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<o)break}t.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=ma(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=ma(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new gn(e,gn.schemaRules(e)))}}const Bu={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},am={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},zu={ol:!0,ul:!0},Qr=1,Zr=2,Hn=4;function ha(n,e,t){return e!=null?(e?Qr:0)|(e==="full"?Zr:0):n&&n.whitespace=="pre"?Qr|Zr:t&~Hn}class yr{constructor(e,t,r,i,o,s,l){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=l,this.content=[],this.activeMarks=B.none,this.stashMarks=[],this.match=s||(l&Hn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(b.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&Qr)){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 t=b.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(b.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;t<r.length;t++){let i=r[t];(this.type?this.type.allowsMarkType(i.type):um(i.type,e))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Bu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class pa{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let i=t.topNode,o,s=ha(null,t.preserveWhitespace,0)|(r?Hn:0);i?o=new yr(i.type,i.attrs,B.none,B.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new yr(null,null,B.none,B.none,!0,null,s):o=new yr(e.schema.topNodeType,null,B.none,B.none,!0,null,s),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,t){let r=e.style;if(!r||!r.length)return t();let i=this.readStyles(e.style);if(!i)return;let[o,s]=i,l=this.top;for(let a=0;a<s.length;a++)this.removePendingMark(s[a],l);for(let a=0;a<o.length;a++)this.addPendingMark(o[a]);t();for(let a=0;a<o.length;a++)this.removePendingMark(o[a],l);for(let a=0;a<s.length;a++)this.addPendingMark(s[a])}addTextNode(e){let t=e.nodeValue,r=this.top;if(r.options&Zr||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(r.options&Qr)r.options&Zr?t=t.replace(/\r\n?/g,`
3
+ `):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],o=e.previousSibling;(!i||o&&o.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let r=e.nodeName.toLowerCase(),i;zu.hasOwnProperty(r)&&this.parser.normalizeLists&&cm(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,t));if(o?o.ignore:am.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);let s,l=this.top,a=this.needsBlock;if(Bu.hasOwnProperty(r))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),s=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}o&&o.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),s&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,o,o.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
+ `))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=B.none,r=B.none;if(e.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=e.getPropertyValue(o);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(o,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(c=>{a.clearMark(c)&&(r=c.addToSet(r))}):t=this.parser.schema.marks[a.mark].create(a.attrs).addToSet(t),a.consuming===!1)l=a;else break}}return[t,r]}addElementByRule(e,t,r){let i,o,s;t.node?(o=this.parser.schema.nodes[t.node],o.isLeaf?this.insertNode(o.create(t.attrs))||this.leafFallback(e):i=this.enter(o,t.attrs||null,t.preserveWhitespace)):(s=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(s));let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}i&&this.sync(l)&&this.open--,s&&this.removePendingMark(s,l)}addAll(e,t,r){let i=t||0;for(let o=t?e.childNodes[t]:e.firstChild,s=r==null?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let o=this.nodes[i],s=o.findWrapping(e);if(s&&(!t||t.length>s.length)&&(t=s,r=o,!s.length)||o.solid)break}if(!t)return!1;this.sync(r);for(let i=0;i<t.length;i++)this.enterInner(t[i],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let r=t.activeMarks;for(let i=0;i<e.marks.length;i++)(!t.type||t.type.allowsMarkType(e.marks[i].type))&&(r=e.marks[i].addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r){let i=this.findPlace(e.create(t));return i&&this.enterInner(e,t,!0,r),i}enterInner(e,t=null,r=!1,i){this.closeExtra();let o=this.top;o.applyPending(e),o.match=o.match&&o.match.matchType(e);let s=ha(e,i,o.options);o.options&Hn&&o.content.length==0&&(s|=Hn),this.nodes.push(new yr(e,t,o.activeMarks,o.pendingMarks,r,null,s)),this.open++}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;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),o=-(r?r.depth+1:0)+(i?0:1),s=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=o;a--)if(s(l-1,a))return!0;return!1}else{let f=a>0||a==0&&i?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!f||f.name!=c&&f.groups.indexOf(c)==-1)return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=dm(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let s=i.popFromStashMark(e);s&&i.type&&i.type.allowsMarkType(s.type)&&(i.activeMarks=s.addToSet(i.activeMarks))}if(i==t)break}}}function cm(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&zu.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function fm(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ma(n){let e={};for(let t in n)e[t]=n[t];return e}function um(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],s=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:f}=l.edge(a);if(c==e||o.indexOf(f)<0&&s(f))return!0}};if(s(i.contentMatch))return!0}}function dm(n,e){for(let t=0;t<e.length;t++)if(n.eq(e[t]))return e[t]}class Jt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=mo(t).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let l=0,a=0;for(;l<o.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(o[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)i=o.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],f=this.serializeMark(c,s.isInline,t);f&&(o.push([c,i]),i.appendChild(f.dom),i=f.contentDOM||f.dom)}}i.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=Rr(mo(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 o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&Rr(mo(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return Rr(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Jt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ga(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return ga(e.marks)}}function ga(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function mo(n){return n.document||window.document}const ya=new WeakMap;function hm(n){let e=ya.get(n);return e===void 0&&ya.set(n,e=pm(n)),e}function pm(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 Rr(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],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=hm(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&&(t=i.slice(0,s),i=i.slice(s+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),c=e[1],f=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){f=2;for(let u in c)if(c[u]!=null){let d=u.indexOf(" ");d>0?a.setAttributeNS(u.slice(0,d),u.slice(d+1),c[u]):a.setAttribute(u,c[u])}}for(let u=f;u<e.length;u++){let d=e[u];if(d===0){if(u<e.length-1||u>f)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Rr(n,d,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Lu=65535,Fu=Math.pow(2,16);function mm(n,e){return n+e*Fu}function ba(n){return n&Lu}function gm(n){return(n-(n&Lu))/Fu}const ju=1,_u=2,Ir=4,Vu=8;class as{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Vu)>0}get deletedBefore(){return(this.delInfo&(ju|Ir))>0}get deletedAfter(){return(this.delInfo&(_u|Ir))>0}get deletedAcross(){return(this.delInfo&Ir)>0}}class de{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&de.empty)return de.empty}recover(e){let t=0,r=ba(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+gm(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,o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+o],f=this.ranges[l+s],u=a+c;if(e<=u){let d=c?e==a?-1:e==u?1:t:t,h=a+i+(d<0?0:f);if(r)return h;let p=e==(t<0?a:u)?null:mm(l/3,e-a),m=e==a?_u:e==u?ju:Ir;return(t<0?e!=a:e!=u)&&(m|=Vu),new as(h,m,p)}i+=f-c}return r?e+i:new as(e+i,0,null)}touches(e,t){let r=0,i=ba(t),o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+o],f=a+c;if(e<=f&&l==i*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],l=s-(this.inverted?o:0),a=s+(this.inverted?0:o),c=this.ranges[i+t],f=this.ranges[i+r];e(l,l+c,a,a+f),o+=f-c}}invert(){return new de(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?de.empty:new de(e<0?[0,-e,0]:[0,0,e])}}de.empty=new de([]);class fn{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new fn(this.maps,this.mirror,e,t)}copy(){return new fn(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){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 fn;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 o=this.from;o<this.to;o++){let s=this.maps[o],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this.maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new as(e,i,null)}}const go=Object.create(null);class re{getMap(){return de.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=go[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 go)throw new RangeError("Duplicate use of step JSON ID "+e);return go[e]=t,t.prototype.jsonID=e,t}}class H{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new H(e,null)}static fail(e){return new H(null,e)}static fromReplace(e,t,r,i){try{return H.ok(e.replace(t,r,i))}catch(o){if(o instanceof qr)return H.fail(o.message);throw o}}}function fl(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(fl(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return b.fromArray(r)}class yt extends re{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new v(fl(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),t.openStart,t.openEnd);return H.fromReplace(e,this.from,this.to,o)}invert(){return new $e(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 yt(t.pos,r.pos,this.mark)}merge(e){return e instanceof yt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yt(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 yt(t.from,t.to,e.markFromJSON(t.mark))}}re.jsonID("addMark",yt);class $e extends re{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new v(fl(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return H.fromReplace(e,this.from,this.to,r)}invert(){return new yt(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 $e(t.pos,r.pos,this.mark)}merge(e){return e instanceof $e&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new $e(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 $e(t.from,t.to,e.markFromJSON(t.mark))}}re.jsonID("removeMark",$e);class bt extends re{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return H.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return H.fromReplace(e,this.pos,this.pos+1,new v(b.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 bt(this.pos,t.marks[i]);return new bt(this.pos,this.mark)}}return new yn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new bt(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 bt(t.pos,e.markFromJSON(t.mark))}}re.jsonID("addNodeMark",bt);class yn extends re{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return H.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return H.fromReplace(e,this.pos,this.pos+1,new v(b.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new bt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new yn(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 yn(t.pos,e.markFromJSON(t.mark))}}re.jsonID("removeNodeMark",yn);class J extends re{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&cs(e,this.from,this.to)?H.fail("Structure replace would overwrite content"):H.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new de([this.from,this.to-this.from,this.slice.size])}invert(e){return new J(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 J(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof J)||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?v.empty:new v(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new J(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?v.empty:new v(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new J(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 J(t.from,t.to,v.fromJSON(e,t.slice),!!t.structure)}}re.jsonID("replace",J);class K extends re{constructor(e,t,r,i,o,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=l}apply(e){if(this.structure&&(cs(e,this.from,this.gapFrom)||cs(e,this.gapTo,this.to)))return H.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return H.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?H.fromReplace(e,this.from,this.to,r):H.fail("Content does not fit in gap")}getMap(){return new de([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 K(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),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new K(t.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,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 K(t.from,t.to,t.gapFrom,t.gapTo,v.fromJSON(e,t.slice),t.insert,!!t.structure)}}re.jsonID("replaceAround",K);function cs(n,e,t){let r=n.resolve(e),i=t-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(n,e,t,r){let i=[],o=[],s,l;n.doc.nodesBetween(e,t,(a,c,f)=>{if(!a.isInline)return;let u=a.marks;if(!r.isInSet(u)&&f.type.allowsMarkType(r.type)){let d=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(p)||(s&&s.to==d&&s.mark.eq(u[m])?s.to=h:i.push(s=new $e(d,h,u[m])));l&&l.to==d?l.to=h:o.push(l=new yt(d,h,r))}}),i.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function bm(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;o++;let a=null;if(r instanceof Qi){let c=s.marks,f;for(;f=r.isInSet(c);)(a||(a=[])).push(f),c=f.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,t);for(let f=0;f<a.length;f++){let u=a[f],d;for(let h=0;h<i.length;h++){let p=i[h];p.step==o-1&&u.eq(i[h].style)&&(d=p)}d?(d.to=c,d.step=o):i.push({style:u,from:Math.max(l,e),to:c,step:o})}}}),i.forEach(s=>n.step(new $e(s.from,s.to,s.style)))}function Wu(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),f=l+c.nodeSize,u=r.matchType(c.type);if(!u)s.push(new J(l,f,v.empty));else{r=u;for(let d=0;d<c.marks.length;d++)t.allowsMarkType(c.marks[d].type)||n.step(new $e(l,f,c.marks[d]));if(i&&c.isText&&t.whitespace!="pre"){let d,h=/\r?\n|\r/g,p;for(;d=h.exec(c.text);)p||(p=new v(b.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new J(l+d.index,l+d.index+d[0].length,p))}}l=f}if(!r.validEnd){let a=r.fillBefore(b.empty,!0);n.replace(l,l,new v(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function Sm(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function On(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),s=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,s,t))return r;if(r==0||i.type.spec.isolating||!Sm(i,o,s))break}return null}function vm(n,e,t){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),l=i.after(o+1),a=s,c=l,f=b.empty,u=0;for(let p=o,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,f=b.from(r.node(p).copy(f)),u++):a--;let d=b.empty,h=0;for(let p=o,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,d=b.from(i.node(p).copy(d)),h++):c++;n.step(new K(a,c,s,l,new v(f.append(d),u,h),f.size-u,!0))}function ul(n,e,t=null,r=n){let i=wm(n,e),o=i&&xm(r,e);return o?i.map(Sa).concat({type:e,attrs:t}).concat(o.map(Sa)):null}function Sa(n){return{type:n,attrs:null}}function wm(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return t.canReplaceWith(r,i,s)?o:null}function xm(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:s}function Cm(n,e,t){let r=b.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let l=t[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=b.from(t[s].type.create(t[s].attrs,r))}let i=e.start,o=e.end;n.step(new K(i,o,i,o,new v(r,0,0),t.length,!0))}function km(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{if(s.isTextblock&&!s.hasMarkup(r,i)&&Tm(n.doc,n.mapping.slice(o).map(l),r)){let a=null;if(r.schema.linebreakReplacement){let d=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);d&&!h?a=!1:!d&&h&&(a=!0)}a===!1&&Am(n,s,l,o),Wu(n,n.mapping.slice(o).map(l,1),r,void 0,a===null);let c=n.mapping.slice(o),f=c.map(l,1),u=c.map(l+s.nodeSize,1);return n.step(new K(f,u,f+1,u-1,new v(b.from(r.create(i,null,s.marks)),0,0),1,!0)),a===!0&&Om(n,s,l,o),!1}})}function Om(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+o+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Am(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+o);n.replaceWith(s,s+1,e.type.schema.text(`
5
+ `))}})}function Tm(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Em(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let s=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,s);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new K(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new v(b.from(s),0,0),1,!0))}function dl(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,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,f=t-2;c>o;c--,f--){let u=i.node(c),d=i.index(c);if(u.type.spec.isolating)return!1;let h=u.content.cutByIndex(d,u.childCount),p=r&&r[f+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[f]||u;if(!u.canReplace(d+1,u.childCount)||!m.type.validContent(h))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function Mm(n,e,t=1,r){let i=n.doc.resolve(e),o=b.empty,s=b.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){o=b.from(i.node(l).copy(o));let f=r&&r[c];s=b.from(f?f.type.create(f.attrs,s):i.node(l).copy(s))}n.step(new J(e,e,new v(o.append(s),t,t),!0))}function An(n,e){let t=n.resolve(e),r=t.index();return Hu(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Hu(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function hl(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,s,l=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):t>0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&Hu(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Nm(n,e,t){let r=new J(e-t,e+t,v.empty,!0);n.step(r)}function Rm(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 o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))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,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function Uu(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),f=!1;if(o==1)f=c.canReplace(a,a,i);else{let u=c.contentMatchAt(a).findWrapping(i.firstChild.type);f=u&&c.canReplaceWith(a,a,u[0])}if(f)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Zi(n,e,t=e,r=v.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return Ju(i,o,r)?new J(e,t,r):new Im(i,o,r).fit()}function Ju(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Im{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=b.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=b.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 o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let a=new v(o,s,l);return e>-1?new K(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new J(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=yo(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],f,u=null;if(t==1&&(s?c.matchType(s.type)||(u=c.fillBefore(b.from(s),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:u};if(t==2&&s&&(f=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:f};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=yo(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new v(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=yo(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new v(jn(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new v(jn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[m]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,f=[],{match:u,type:d}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)f.push(i.child(m));u=u.matchFragment(i)}let h=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let m=l.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(u=g,f.push(Ku(m.mark(d.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=_n(this.placed,t,b.from(f)),this.frontier[t].match=u,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<h;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?v.empty:new v(jn(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new v(jn(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!bo(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],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=bo(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],f=bo(e,l,c,a,!0);if(!f||f.childCount)continue e}return{depth:t,fit:s,move:o?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=_n(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.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,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=_n(this.placed,this.depth,b.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(b.empty,!0);t.childCount&&(this.placed=_n(this.placed,this.frontier.length,t))}}function jn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(jn(n.firstChild.content,e-1,t)))}function _n(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(_n(n.lastChild.content,e-1,t)))}function yo(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Ku(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Ku(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(b.empty,!0)))),n.copy(r)}function bo(n,e,t,r,i){let o=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==o.childCount&&!t.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!Dm(t,o.content,s)?l:null}function Dm(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Pm(n){return n.spec.defining||n.spec.definingForContent}function $m(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(Ju(i,o,r))return n.step(new J(e,t,r));let s=Gu(i,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let d=i.depth,h=i.pos-1;d>0;d--,h--){let p=i.node(d).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(d)>-1?l=d:i.before(d)==h&&s.splice(1,0,-d)}let a=s.indexOf(l),c=[],f=r.openStart;for(let d=r.content,h=0;;h++){let p=d.firstChild;if(c.push(p),h==r.openStart)break;d=p.content}for(let d=f-1;d>=0;d--){let h=c[d],p=Pm(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))f=d;else if(p||!h.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let h=(d+f+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m<s.length;m++){let g=s[(m+a)%s.length],y=!0;g<0&&(y=!1,g=-g);let x=i.node(g-1),k=i.index(g-1);if(x.canReplaceWith(k,k,p.type,p.marks))return n.replace(i.before(g),y?o.after(g):t,new v(qu(r.content,0,r.openStart,h),h,r.openEnd))}}let u=n.steps.length;for(let d=s.length-1;d>=0&&(n.replace(e,t,r),!(n.steps.length>u));d--){let h=s[d];h<0||(e=i.before(h),t=o.after(h))}}function qu(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(qu(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(b.empty,!0))}return n}function Bm(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Rm(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new v(b.from(r),0,0))}function zm(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=Gu(r,i);for(let s=0;s<o.length;s++){let l=o[s],a=s==o.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&i.end(s)-t!=i.depth-s)return n.delete(r.before(s),t);n.delete(e,t)}function Gu(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<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;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class un extends re{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return H.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return H.fromReplace(e,this.pos,this.pos+1,new v(b.from(i),0,t.isLeaf?0:1))}getMap(){return de.empty}invert(e){return new un(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 un(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 un(t.pos,t.attr,t.value)}}re.jsonID("attr",un);class tr extends re{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 H.ok(r)}getMap(){return de.empty}invert(e){return new tr(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 tr(t.attr,t.value)}}re.jsonID("docAttr",tr);let bn=class extends Error{};bn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};bn.prototype=Object.create(Error.prototype);bn.prototype.constructor=bn;bn.prototype.name="TransformError";class pl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new fn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new bn(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=v.empty){let i=Zi(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new v(b.from(r),0,0))}delete(e,t){return this.replace(e,t,v.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return $m(this,e,t,r),this}replaceRangeWith(e,t,r){return Bm(this,e,t,r),this}deleteRange(e,t){return zm(this,e,t),this}lift(e,t){return vm(this,e,t),this}join(e,t=1){return Nm(this,e,t),this}wrap(e,t){return Cm(this,e,t),this}setBlockType(e,t=e,r,i=null){return km(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Em(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new un(e,t,r)),this}setDocAttribute(e,t){return this.step(new tr(e,t)),this}addNodeMark(e,t){return this.step(new bt(e,t)),this}removeNodeMark(e,t){if(!(t instanceof B)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new yn(e,t)),this}split(e,t=1,r){return Mm(this,e,t,r),this}addMark(e,t,r){return ym(this,e,t,r),this}removeMark(e,t,r){return bm(this,e,t,r),this}clearIncompatible(e,t,r){return Wu(this,e,t,r),this}}const So=Object.create(null);class A{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Yu(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=v.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],f=e.mapping.slice(o);e.replaceRange(f.map(a.pos),f.map(c.pos),l?v.empty:t),l==0&&xa(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:l}=i[o],a=e.mapping.slice(r),c=a.map(s.pos),f=a.map(l.pos);o?e.deleteRange(c,f):(e.replaceRangeWith(c,f,t),xa(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new R(e):rn(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=t<0?rn(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):rn(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Se(e.node(0))}static atStart(e){return rn(e,e,0,0,1)||new Se(e)}static atEnd(e){return rn(e,e,e.content.size,e.childCount,-1)||new Se(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=So[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 So)throw new RangeError("Duplicate use of selection JSON ID "+e);return So[e]=t,t.prototype.jsonID=e,t}getBookmark(){return R.between(this.$anchor,this.$head).getBookmark()}}A.prototype.visible=!0;class Yu{constructor(e,t){this.$from=e,this.$to=t}}let va=!1;function wa(n){!va&&!n.parent.inlineContent&&(va=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class R extends A{constructor(e,t=e){wa(e),wa(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 A.near(r);let i=e.resolve(t.map(this.anchor));return new R(i.parent.inlineContent?i:r,r)}replace(e,t=v.empty){if(super.replace(e,t),t==v.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof R&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new eo(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 R(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 o=A.findFrom(t,r,!0)||A.findFrom(t,-r,!0);if(o)t=o.$head;else return A.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(A.findFrom(e,-r,!0)||A.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new R(e,t)}}A.jsonID("text",R);class eo{constructor(e,t){this.anchor=e,this.head=t}map(e){return new eo(e.map(this.anchor),e.map(this.head))}resolve(e){return R.between(e.resolve(this.anchor),e.resolve(this.head))}}class C extends A{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),o=e.resolve(i);return r?A.near(o):new C(o)}content(){return new v(b.from(this.node),0,0)}eq(e){return e instanceof C&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ml(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new C(e.resolve(t.anchor))}static create(e,t){return new C(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}C.prototype.visible=!1;A.jsonID("node",C);class ml{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new eo(r,r):new ml(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&C.isSelectable(r)?new C(t):A.near(t)}}class Se extends A{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=v.empty){if(t==v.empty){e.delete(0,e.doc.content.size);let r=A.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Se(e)}map(e){return new Se(e)}eq(e){return e instanceof Se}getBookmark(){return Lm}}A.jsonID("all",Se);const Lm={map(){return this},resolve(n){return new Se(n)}};function rn(n,e,t,r,i,o=!1){if(e.inlineContent)return R.create(n,t);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&C.isSelectable(l))return C.create(n,t-(i<0?l.nodeSize:0))}else{let a=rn(n,l,t+i,i<0?l.childCount:0,i,o);if(a)return a}t+=l.nodeSize*i}return null}function xa(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof J||i instanceof K))return;let o=n.mapping.maps[r],s;o.forEach((l,a,c,f)=>{s==null&&(s=f)}),n.setSelection(A.near(n.doc.resolve(s),t))}const Ca=1,br=2,ka=4;class Fm extends pl{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|Ca)&~br,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ca)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=br,this}ensureMarks(e){return B.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&br)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~br,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)||B.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),r=r??t,!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(t);o=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,o)),this.selection.empty||this.setSelection(A.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|=ka,this}get scrolledIntoView(){return(this.updated&ka)>0}}function Oa(n,e){return!e||!n?n:n.bind(e)}class Vn{constructor(e,t,r){this.name=e,this.init=Oa(t.init,r),this.apply=Oa(t.apply,r)}}const jm=[new Vn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Vn("selection",{init(n,e){return n.selection||A.atStart(e.doc)},apply(n){return n.selection}}),new Vn("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Vn("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class vo{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=jm.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 Vn(r.key,r.spec.state,r))})}}class an{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 o=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=i?i[s].n:0,c=i?i[s].state:this,f=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(f&&r.filterTransaction(f,s)){if(f.setMeta("appendedTransaction",e),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<s?{state:r,n:t.length}:{state:this,n:0})}t.push(f),r=r.applyInner(f),o=!0}i&&(i[s]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new an(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new Fm(this)}static create(e){let t=new vo(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new an(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 vo(this.schema,e.plugins),r=t.fields,i=new an(t);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 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],o=i.spec.state;o&&o.toJSON&&(t[r]=o.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 vo(e.schema,e.plugins),o=new an(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Oe.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=A.fromJSON(o.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){o[s.name]=c.fromJSON.call(a,e,t[l],o);return}}o[s.name]=s.init(e,o)}}),o}}function Xu(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Xu(i,e,{})),t[r]=i}return t}class Kt{constructor(e){this.spec=e,this.props={},e.props&&Xu(e.props,this,this.props),this.key=e.key?e.key.key:Qu("plugin")}getState(e){return e[this.key]}}const wo=Object.create(null);function Qu(n){return n in wo?n+"$"+ ++wo[n]:(wo[n]=0,n+"$")}class Tn{constructor(e="key"){this.key=Qu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const X=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},nr=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let fs=null;const Qe=function(n,e,t){let r=fs||(fs=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},_m=function(){fs=null},Vt=function(n,e,t,r){return t&&(Aa(n,e,t,r,-1)||Aa(n,e,t,r,1))},Vm=/^(img|br|input|textarea|hr)$/i;function Aa(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Pe(n))){let o=n.parentNode;if(!o||o.nodeType!=1||dr(n)||Vm.test(n.nodeName)||n.contentEditable=="false")return!1;e=X(n)+(i<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?Pe(n):0}else return!1}}function Pe(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Wm(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=Pe(n)}else if(n.parentNode&&!dr(n))e=X(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&&!dr(n))e=X(n)+1,n=n.parentNode;else return null}}function Um(n,e,t){for(let r=e==0,i=e==Pe(n);r||i;){if(n==t)return!0;let o=X(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==Pe(n)}}function dr(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 to=function(n){return n.focusNode&&Vt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Nt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Jm(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Km(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:r.startOffset}}}const Be=typeof navigator<"u"?navigator:null,Ta=typeof document<"u"?document:null,At=Be&&Be.userAgent||"",us=/Edge\/(\d+)/.exec(At),Zu=/MSIE \d/.exec(At),ds=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(At),fe=!!(Zu||ds||us),wt=Zu?document.documentMode:ds?+ds[1]:us?+us[1]:0,Te=!fe&&/gecko\/(\d+)/i.test(At);Te&&+(/Firefox\/(\d+)/.exec(At)||[0,0])[1];const hs=!fe&&/Chrome\/(\d+)/.exec(At),ee=!!hs,ed=hs?+hs[1]:0,oe=!fe&&!!Be&&/Apple Computer/.test(Be.vendor),Sn=oe&&(/Mobile\/\w+/.test(At)||!!Be&&Be.maxTouchPoints>2),ye=Sn||(Be?/Mac/.test(Be.platform):!1),qm=Be?/Win/.test(Be.platform):!1,Ce=/Android \d/.test(At),hr=!!Ta&&"webkitFontSmoothing"in Ta.documentElement.style,Gm=hr?+(/\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 Ke(n,e){return typeof n=="number"?n:n[e]}function Xm(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 Ea(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=t||n.dom;s;s=nr(s)){if(s.nodeType!=1)continue;let l=s,a=l==o.body,c=a?Ym(o):Xm(l),f=0,u=0;if(e.top<c.top+Ke(r,"top")?u=-(c.top-e.top+Ke(i,"top")):e.bottom>c.bottom-Ke(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+Ke(i,"top")-c.top:e.bottom-c.bottom+Ke(i,"bottom")),e.left<c.left+Ke(r,"left")?f=-(c.left-e.left+Ke(i,"left")):e.right>c.right-Ke(r,"right")&&(f=e.right-c.right+Ke(i,"right")),f||u)if(a)o.defaultView.scrollBy(f,u);else{let d=l.scrollLeft,h=l.scrollTop;u&&(l.scrollTop+=u),f&&(l.scrollLeft+=f);let p=l.scrollLeft-d,m=l.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function Qm(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(o,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:td(n.dom)}}function td(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=nr(r));return e}function Zm({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;nd(t,r==0?0:r-e)}function nd(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:o}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Qt=null;function eg(n){if(n.setActive)return n.setActive();if(Qt)return n.focus(Qt);let e=td(n);n.focus(Qt==null?{get preventScroll(){return Qt={preventScroll:!0},!0}}:void 0),Qt||(Qt=!1,nd(e,0))}function rd(n,e){let t,r=2e8,i,o=0,s=e.top,l=e.top,a,c;for(let f=n.firstChild,u=0;f;f=f.nextSibling,u++){let d;if(f.nodeType==1)d=f.getClientRects();else if(f.nodeType==3)d=Qe(f).getClientRects();else continue;for(let h=0;h<d.length;h++){let p=d[h];if(p.top<=s&&p.bottom>=l){s=Math.max(p.bottom,s),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){t=f,r=m,i=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,f.nodeType==1&&m&&(o=u+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=f,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)&&(o=u+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?tg(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:rd(t,i)}function tg(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 o=at(r,1);if(o.top!=o.bottom&&gl(e,o))return{node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function gl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function ng(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function rg(n,e,t){let{node:r,offset:i}=rd(e,t),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,i,o)}function ig(n,e,t,r){let i=-1;for(let o=e,s=!1;o!=n.dom;){let l=n.docView.nearestDesc(o,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!s&&a.left>r.left||a.top>r.top?i=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),s=!0),!l.contentDOM&&i<0&&!l.node.isText)return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}o=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function id(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)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(gl(e,c))return id(s,e,c)}}if((o=(o+1)%r)==i)break}return n}function og(n,e){let t=n.dom.ownerDocument,r,i=0,o=Km(t,e.left,e.top);o&&({node:r,offset:i}=o);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=n.dom.getBoundingClientRect();if(!gl(e,c)||(s=id(n.dom,e,c),!s))return null}if(oe)for(let c=s;r&&c;c=nr(c))c.draggable&&(r=void 0);if(s=ng(s,e),r){if(Te&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let f=r.childNodes[i],u;f.nodeName=="IMG"&&(u=f.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&i++}let c;hr&&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?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=ig(n,r,i,e))}l==null&&(l=rg(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Ma(n){return n.top<n.bottom||n.left<n.right}function at(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Ma(r))return r}return Array.prototype.find.call(t,Ma)||n.getBoundingClientRect()}const sg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function od(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=hr||Te;if(r.nodeType==3)if(s&&(sg.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=at(Qe(r,i,i),t);if(Te&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=at(Qe(r,i-1,i-1),-1);if(c.top==a.top){let f=at(Qe(r,i,i+1),-1);if(f.top!=a.top)return Dn(f,f.left<c.left)}}return a}else{let a=i,c=i,f=t<0?1:-1;return t<0&&!i?(c++,f=-1):t>=0&&i==r.nodeValue.length?(a--,f=1):t<0?a--:c++,Dn(at(Qe(r,a,c),f),f<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==Pe(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return xo(a.getBoundingClientRect(),!1)}if(o==null&&i<Pe(r)){let a=r.childNodes[i];if(a.nodeType==1)return xo(a.getBoundingClientRect(),!0)}return xo(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==Pe(r))){let a=r.childNodes[i-1],c=a.nodeType==3?Qe(a,Pe(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Dn(at(c,1),!1)}if(o==null&&i<Pe(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?Qe(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return Dn(at(c,-1),!0)}return Dn(at(r.nodeType==3?Qe(r):r,-t),t>=0)}function Dn(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 xo(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 sd(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 lg(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return sd(n,e,()=>{let{node:o}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=od(n,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Qe(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let f=a[c];if(f.bottom>f.top+1&&(t=="up"?s.top-f.top>(f.bottom-s.top)*2:f.bottom-s.bottom>(s.bottom-f.top)*2))return!1}}return!0})}const ag=/[\u0590-\u08ac]/;function cg(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=n.domSelection();return l?!ag.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:s:sd(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:f,anchorOffset:u}=n.domSelectionRange(),d=l.caretBidiLevel;l.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(f,u),a&&(a!=f||c!=u)&&l.extend&&l.extend(a,c)}catch{}return d!=null&&(l.caretBidiLevel=d),g}):r.pos==r.start()||r.pos==r.end()}let Na=null,Ra=null,Ia=!1;function fg(n,e,t){return Na==e&&Ra==t?Ia:(Na=e,Ra=t,Ia=t=="up"||t=="down"?lg(n,e,t):cg(n,e,t))}const ve=0,Da=1,Rt=2,ze=3;class pr{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=ve,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 o,s;if(e==this.contentDOM)o=e.childNodes[t-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[t];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=t>X(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 o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&t==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,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!t||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 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 o=this.getDesc(i);if(o)return o.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,t){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],l=o+s.size;if(l>e||s instanceof ad){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof ld&&o.side>=0;r--);if(t<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&t&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,t):{node:this.contentDOM,offset:o?X(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,t):{node:this.contentDOM,offset:o?X(o.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,o=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(i==-1&&e<=c){let f=s+a.border;if(e>=f&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,f);e=s;for(let u=l;u>0;u--){let d=this.children[u-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=X(d.dom)+1;break}e-=d.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let f=l+1;f<this.children.length;f++){let u=this.children[f];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){o=X(u.dom);break}t+=u.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:o}}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 o=Math.min(e,t),s=Math.max(e,t);for(let d=0,h=0;d<this.children.length;d++){let p=this.children[d],m=h+p.size;if(o>h&&s<m)return p.setSelection(e-h-p.border,t-h-p.border,r,i);h=m}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.getSelection(),f=!1;if((Te||oe)&&e==t){let{node:d,offset:h}=l;if(d.nodeType==3){if(f=!!(h&&d.nodeValue[h-1]==`
6
+ `),f&&h==d.nodeValue.length)for(let p=d,m;p;p=p.parentNode){if(m=p.nextSibling){m.nodeName=="BR"&&(l=a={node:m.parentNode,offset:X(m)+1});break}let g=p.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let p=d.childNodes[h-1];f=p&&(p.nodeName=="BR"||p.contentEditable=="false")}}if(Te&&c.focusNode&&c.focusNode!=a.node&&c.focusNode.nodeType==1){let d=c.focusNode.childNodes[c.focusOffset];d&&d.contentEditable=="false"&&(i=!0)}if(!(i||f&&oe)&&Vt(l.node,l.offset,c.anchorNode,c.anchorOffset)&&Vt(a.node,a.offset,c.focusNode,c.focusOffset))return;let u=!1;if((c.extend||e==t)&&!f){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),u=!0}catch{}}if(!u){if(e>t){let h=l;l=a,a=h}let d=document.createRange();d.setEnd(a.node,a.offset),d.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(d)}}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 o=this.children[i],s=r+o.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let l=r+o.border,a=s-o.border;if(e>=l&&t<=a){this.dirty=e==r||t==s?Rt:Da,e==l&&t==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=ze:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Rt:ze}r=s}this.dirty=Rt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Rt:Da;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class ld extends pr{constructor(e,t,r,i){let o,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!t.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return this.dirty==ve&&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 side(){return this.widget.type.side}}class ug extends pr{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 Wt extends pr{constructor(e,t,r,i){super(e,[],r,i),this.mark=t}static create(e,t,r,i){let o=i.nodeViews[t.type.name],s=o&&o(t,i,r);return(!s||!s.dom)&&(s=Jt.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Wt(e,t,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&ze||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ze&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ve){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=ve}}slice(e,t,r){let i=Wt.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=gs(o,t,s,r)),e>0&&(o=gs(o,0,e,r));for(let l=0;l<o.length;l++)o[l].parent=i;return i.children=o,i}}class xt extends pr{constructor(e,t,r,i,o,s,l,a,c){super(e,[],o,s),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,o,s){let l=o.nodeViews[t.type.name],a,c=l&&l(t,o,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,i),f=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!f)f=document.createTextNode(t.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:u}=Jt.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),t.type.spec.draggable&&(f.draggable=!0));let d=f;return f=ud(f,r,t),c?a=new dg(e,t,r,i,f,u||null,d,c,o,s+1):t.isText?new no(e,t,r,i,f,d,o):new xt(e,t,r,i,f,u||null,d,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 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=()=>b.empty)}return e}matchesNode(e,t,r){return this.dirty==ve&&e.eq(this.node)&&ms(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,o=e.composing?this.localCompositionInfo(e,t):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new pg(this,s&&s.node,e);yg(this.node,this.innerDeco,(c,f,u)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!u&&a.syncToMarks(f==this.node.childCount?B.none:this.node.child(f).marks,r,e),a.placeWidget(c,e,i)},(c,f,u,d)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,f,u,d)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(h=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(c,f,u,h,e)||a.updateNextNode(c,f,u,e,d,i)||a.addNode(c,f,u,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Rt)&&(s&&this.protectLocalComposition(e,s),cd(this.contentDOM,this.children,e),Sn&&bg(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof R)||r<t||i>t+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,l=Sg(this.node.content,s,r-t,i-t);return l<0?null:{node:o,pos:l,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let o=t;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 ug(this,o,t,i);e.input.compositionNodes.push(s),this.children=gs(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==ze||!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=ve}updateOuterDeco(e){if(ms(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=fd(this.dom,this.nodeDOM,ps(this.outerDeco,this.node,t),ps(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.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Pa(n,e,t,r,i){ud(r,e,n);let o=new xt(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class no extends xt{constructor(e,t,r,i,o,s,l){super(e,t,r,i,o,null,s,l,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==ze||this.dirty!=ve&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=ve||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=ve,!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),o=document.createTextNode(i.text);return new no(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=ze)}get domAtom(){return!1}isText(e){return this.node.text==e}}class ad extends pr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ve&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class dg extends xt{constructor(e,t,r,i,o,s,l,a,c,f){super(e,t,r,i,o,s,l,c,f),this.spec=a}update(e,t,r,i){if(this.dirty==ze)return!1;if(this.spec.update){let o=this.spec.update(e,t,r);return o&&this.updateInner(e,t,r,i),o}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):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 cd(n,e,t){let r=n.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=s.dom;if(l.parentNode==n){for(;l!=r;)r=$a(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(s instanceof Wt){let a=r?r.previousSibling:n.lastChild;cd(s.contentDOM,s.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=$a(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const Un=function(n){n&&(this.nodeName=n)};Un.prototype=Object.create(null);const It=[new Un];function ps(n,e,t){if(n.length==0)return It;let r=t?It[0]:new Un,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new Un(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&i.length==1&&i.push(r=new Un(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return i}function fd(n,e,t,r){if(t==It&&r==It)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],l=t[o];if(o){let a;l&&l.nodeName==s.nodeName&&i!=n&&(a=i.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=It[0]),i=a}hg(i,l||It[0],s)}return i}function hg(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 o=0;o<r.length;o++)i.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&n.classList.add(i[o]);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 ud(n,e,t){return fd(n,n,It,ps(e,t,n.nodeType!=1))}function ms(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 $a(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class pg{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=mg(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,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=ve,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[o])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=Wt.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,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,t,r))o=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){o=l;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,t,r,i,o){let s=this.top.children[i];return s.dirty==ze&&s.dom==s.contentDOM&&(s.dirty=Rt),s.update(e,t,r,o)?(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,o,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof xt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=o)return!1;let f=a.dom,u,d=this.isLocked(f)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=ze&&ms(t,a.outerDeco));if(!d&&a.update(e,t,r,i))return this.destroyBetween(this.index,l),a.dom!=f&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(a,e,t,r,i,s)))return this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Rt,u.updateChildren(i,s+1),u.dirty=ve),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,o,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content))return null;let l=xt.create(this.top,t,r,i,o,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,i,o){let s=xt.create(this.top,e,t,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),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 o=new ld(this.top,e,t,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Wt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof no)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((oe||ee)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new ad(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 mg(n,e){let t=e,r=t.children.length,i=n.childCount,o=new Map,s=[];e:for(;i>0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof Wt)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function gg(n,e){return n.type.side-e.type.side}function yg(n,e,t,r){let i=e.locals(n),o=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let f=n.child(c);r(f,i,e.forChild(o,f),c),o+=f.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let f,u;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(f?(u||(u=[f])).push(g):f=g)}if(f)if(u){u.sort(gg);for(let g=0;g<u.length;g++)t(u[g],c,!!a)}else t(f,c,!!a);let d,h;if(a)h=-1,d=a,a=null;else if(c<n.childCount)h=c,d=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=o&&l.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let p=o+d.nodeSize;if(d.isText){let g=p;s<i.length&&i[s].from<g&&(g=i[s].from);for(let y=0;y<l.length;y++)l[y].to<g&&(g=l[y].to);g<p&&(a=d.cut(g-o),d=d.cut(0,g-o),p=g,h=-1)}else for(;s<i.length&&i[s].to<p;)s++;let m=d.isInline&&!d.isLeaf?l.filter(g=>!g.inline):l.slice();r(d,m,e.forChild(o,d),h),o=p}}function bg(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 Sg(n,e,t,r){for(let i=0,o=0;i<n.childCount&&o<=r;){let s=n.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<n.childCount;){let c=n.child(i++);if(o+=c.nodeSize,!c.isText)break;a+=c.text}if(o>=t){if(o>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function gs(n,e,t,r,i){let o=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],c=l,f=l+=a.size;c>=t||f<=e?o.push(a):(c<e&&o.push(a.slice(0,e-c,r)),i&&(o.push(i),i=void 0),f>t&&o.push(a.slice(t-c,a.size,r)))}return o}function yl(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(to(t)){for(a=l;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&C.isSelectable(f)&&i.parent&&!(f.isInline&&Um(t.focusNode,t.focusOffset,i.dom))){let u=i.posBefore;c=new C(s==u?l:r.resolve(u))}}else{let f=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(f<0)return null;a=r.resolve(f)}if(!c){let f=e=="pointer"||n.state.selection.head<l.pos&&!o?1:-1;c=bl(n,a,l,f)}return c}function dd(n){return n.editable?n.hasFocus():pd(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Ze(n,e=!1){let t=n.state.selection;if(hd(n,t),!!dd(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ee){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Vt(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)wg(n);else{let{anchor:r,head:i}=t,o,s;Ba&&!(t instanceof R)&&(t.$from.parent.inlineContent||(o=za(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=za(n,t.to))),n.docView.setSelection(r,i,n.root,e),Ba&&(o&&La(o),s&&La(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&vg(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Ba=oe||ee&&ed<63;function za(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(oe&&i&&i.contentEditable=="false")return Co(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Co(i);if(o)return Co(o)}}function Co(n){return n.contentEditable="true",oe&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function La(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function vg(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(()=>{(!dd(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function wg(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,X(r)+1):t.setStart(r,0);let o=n.state.selection;if(o.empty)t.collapse(!0);else{let s=n.domAtPos(o.to);t.setEnd(s.node,s.offset)}e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&fe&&wt<=11&&(r.disabled=!0,r.disabled=!1)}function hd(n,e){if(e instanceof C){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Fa(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Fa(n)}function Fa(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function bl(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||R.between(e,t,r)}function ja(n){return n.editable&&!n.hasFocus()?!1:pd(n)}function pd(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 xg(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Vt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function ys(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&A.findFrom(o,e)}function ct(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function _a(n,e,t){let r=n.state.selection;if(r instanceof R)if(t.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=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return ct(n,new R(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=ys(n.state,e);return i&&i instanceof C?ct(n,i):!1}else if(!(ye&&t.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 l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?C.isSelectable(o)?ct(n,new C(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):hr?ct(n,new R(n.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof C&&r.node.isInline)return ct(n,new R(e>0?r.$to:r.$from));{let i=ys(n.state,e);return i?ct(n,i):!1}}}function ei(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Jn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Zt(n,e){return e<0?Cg(n):kg(n)}function Cg(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(Te&&t.nodeType==1&&r<ei(t)&&Jn(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Jn(l,-1))i=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(md(t))break;{let l=t.previousSibling;for(;l&&Jn(l,-1);)i=t.parentNode,o=X(l),l=l.previousSibling;if(l)t=l,r=ei(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?bs(n,t,r):i&&bs(n,i,o)}function kg(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=ei(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(Jn(l,1))o=t,s=++r;else break}else{if(md(t))break;{let l=t.nextSibling;for(;l&&Jn(l,1);)o=l.parentNode,s=X(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=ei(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&bs(n,o,s)}function md(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Og(n,e){for(;n&&e==n.childNodes.length&&!dr(n);)e=X(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 Ag(n,e){for(;n&&!e&&!dr(n);)e=X(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 bs(n,e,t){if(e.nodeType!=3){let o,s;(s=Og(e,t))?(e=s,t=0):(o=Ag(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(to(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Ze(n)},50)}function Va(n,e){let t=n.state.doc.resolve(e);if(!(ee||qm)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.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<t.end()){let o=n.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(n.dom).direction=="rtl"?"rtl":"ltr"}function Wa(n,e,t){let r=n.state.selection;if(r instanceof R&&!r.empty||t.indexOf("s")>-1||ye&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=ys(n.state,e);if(s&&s instanceof C)return ct(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Se?A.near(s,e):A.findFrom(s,e);return l?ct(n,l):!1}return!1}function Ha(n,e){if(!(n.state.selection instanceof R))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 o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return e<0?s.delete(t.pos-o.nodeSize,t.pos):s.delete(t.pos,t.pos+o.nodeSize),n.dispatch(s),!0}return!1}function Ua(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Tg(n){if(!oe||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;Ua(n,r,"true"),setTimeout(()=>Ua(n,r,"false"),20)}return!1}function Eg(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Mg(n,e){let t=e.keyCode,r=Eg(e);if(t==8||ye&&t==72&&r=="c")return Ha(n,-1)||Zt(n,-1);if(t==46&&!e.shiftKey||ye&&t==68&&r=="c")return Ha(n,1)||Zt(n,1);if(t==13||t==27)return!0;if(t==37||ye&&t==66&&r=="c"){let i=t==37?Va(n,n.state.selection.from)=="ltr"?-1:1:-1;return _a(n,i,r)||Zt(n,i)}else if(t==39||ye&&t==70&&r=="c"){let i=t==39?Va(n,n.state.selection.from)=="ltr"?1:-1:1;return _a(n,i,r)||Zt(n,i)}else{if(t==38||ye&&t==80&&r=="c")return Wa(n,-1,r)||Zt(n,-1);if(t==40||ye&&t==78&&r=="c")return Tg(n)||Wa(n,1,r)||Zt(n,1);if(r==(ye?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function gd(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=n.someProp("clipboardSerializer")||Jt.fromSchema(n.state.schema),l=xd(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,f,u=0;for(;c&&c.nodeType==1&&(f=wd[c.nodeName.toLowerCase()]);){for(let h=f.length-1;h>=0;h--){let p=l.createElement(f[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),u++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(t)}`);let d=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
7
+
8
+ `);return{dom:a,text:d,slice:e}}function yd(n,e,t,r,i){let o=i.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=e&&(r||o||!t);if(a){if(n.someProp("transformPastedText",d=>{e=d(e,o||r,n)}),o)return e?new v(b.from(n.state.schema.text(e.replace(/\r\n?/g,`
9
+ `))),0,0):v.empty;let u=n.someProp("clipboardTextParser",d=>d(e,i,r,n));if(u)l=u;else{let d=i.marks(),{schema:h}=n.state,p=Jt.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,d)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),s=Ig(t),hr&&Dg(s);let c=s&&s.querySelector("[data-pm-slice]"),f=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let u=+f[3];u>0;u--){let d=s.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;s=d}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||gn.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||f),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!Ng.test(d.parentNode.nodeName)?{ignore:!0}:null}})),f)l=Pg(Ja(l,+f[1],+f[2]),f[4]);else if(l=v.maxOpen(Rg(l.content,i),!0),l.openStart||l.openEnd){let u=0,d=0;for(let h=l.content.firstChild;u<l.openStart&&!h.type.spec.isolating;u++,h=h.firstChild);for(let h=l.content.lastChild;d<l.openEnd&&!h.type.spec.isolating;d++,h=h.lastChild);l=Ja(l,u,d)}return n.someProp("transformPasted",u=>{l=u(l,n)}),l}const Ng=/^(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 Rg(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)),o,s=[];if(n.forEach(l=>{if(!s)return;let a=i.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&o.length&&Sd(a,o,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=vd(s[s.length-1],o.length));let f=bd(l,a);s.push(f),i=i.matchType(f.type),o=a}}),s)return b.from(s)}return n}function bd(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,b.from(n));return n}function Sd(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=Sd(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(b.from(bd(t,n,i+1))))}}function vd(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,vd(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(b.empty,!0);return n.copy(t.append(r))}function Ss(n,e,t,r,i,o){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(o=0),i<r-1&&(l=Ss(l,e,t,r,i+1,o)),i>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(b.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function Ja(n,e,t){return e<n.openStart&&(n=new v(Ss(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new v(Ss(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const wd={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 Ka=null;function xd(){return Ka||(Ka=document.implementation.createHTMLDocument("title"))}function Ig(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=xd().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&wd[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=n,i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function Dg(n){let e=n.querySelectorAll(ee?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function Pg(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:o,openEnd:s}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=b.from(a.create(r[l+1],i)),o++,s++}return new v(i,o,s)}const se={},le={},$g={touchstart:!0,touchmove:!0};class Bg{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=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 zg(n){for(let e in se){let t=se[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Fg(n,r)&&!Sl(n,r)&&(n.editable||!(r.type in le))&&t(n,r)},$g[e]?{passive:!0}:void 0)}oe&&n.dom.addEventListener("input",()=>null),vs(n)}function St(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Lg(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 vs(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Sl(n,r))})}function Sl(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Fg(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 jg(n,e){!Sl(n,e)&&se[e.type]&&(n.editable||!(e.type in le))&&se[e.type](n,e)}le.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!kd(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ce&&ee&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Sn&&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,Nt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Mg(n,t)?t.preventDefault():St(n,"key")};le.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};le.keypress=(n,e)=>{let t=e;if(kd(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||ye&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof R)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function ro(n){return{left:n.clientX,top:n.clientY}}function _g(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function vl(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(n.someProp(e,l=>s>o.depth?l(n,t,o.nodeAfter,o.before(s),i,!0):l(n,t,o.node(s),o.before(s),i,!1)))return!0;return!1}function dn(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 Vg(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&C.isSelectable(r)?(dn(n,new C(t)),!0):!1}function Wg(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof C&&(r=t.node);let o=n.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(C.isSelectable(l)){r&&t.$from.depth>0&&s>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(s);break}}return i!=null?(dn(n,C.create(n.state.doc,i)),!0):!1}function Hg(n,e,t,r,i){return vl(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?Wg(n,t):Vg(n,t))}function Ug(n,e,t,r){return vl(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Jg(n,e,t,r){return vl(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Kg(n,t,r)}function Kg(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(dn(n,R.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),l=i.before(o);if(s.inlineContent)dn(n,R.create(r,l+1,l+1+s.content.size));else if(C.isSelectable(s))dn(n,C.create(r,l));else continue;return!0}}function wl(n){return ti(n)}const Cd=ye?"metaKey":"ctrlKey";se.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=wl(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&_g(t,n.input.lastClick)&&!t[Cd]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o};let s=n.posAtCoords(ro(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new qg(n,s,t,!!r)):(o=="doubleClick"?Ug:Jg)(n,s.pos,s.inside,t)?t.preventDefault():St(n,"pointer"))};class qg{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[Cd],this.allowDefault=r.shiftKey;let o,s;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),s=t.inside;else{let f=e.state.doc.resolve(t.pos);o=f.parent,s=f.depth?f.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof C&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Te&&!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)),St(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(()=>Ze(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(ro(e))),this.updateAllowDefault(e),this.allowDefault||!t?St(this.view,"pointer"):Hg(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||oe&&this.mightDrag&&!this.mightDrag.node.isAtom||ee&&!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)?(dn(this.view,A.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):St(this.view,"pointer")}move(e){this.updateAllowDefault(e),St(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)}}se.touchstart=n=>{n.input.lastTouch=Date.now(),wl(n),St(n,"pointer")};se.touchmove=n=>{n.input.lastTouch=Date.now(),St(n,"pointer")};se.contextmenu=n=>wl(n);function kd(n,e){return n.composing?!0:oe&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Gg=Ce?5e3:-1;le.compositionstart=le.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof R&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),ti(n,!0),n.markCursor=null;else if(ti(n),Te&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.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 l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}n.input.composing=!0}Od(n,Gg)};le.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++,Od(n,20))};function Od(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>ti(n),e))}function Ad(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Xg());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Yg(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Wm(e.focusNode,e.focusOffset),r=Hm(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,o=n.domObserver.lastChangedTextNode;if(t==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function Xg(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function ti(n,e=!1){if(!(Ce&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Ad(n),e||n.docView&&n.docView.dirty){let t=yl(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):n.updateState(n.state),!0}return!1}}function Qg(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 rr=fe&&wt<15||Sn&&Gm<604;se.copy=le.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=rr?null:t.clipboardData,s=r.content(),{dom:l,text:a}=gd(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):Qg(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Zg(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function ey(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?ir(n,r.value,null,i,e):ir(n,r.textContent,r.innerHTML,i,e)},50)}function ir(n,e,t,r,i){let o=yd(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,o||v.empty)))return!0;if(!o)return!1;let s=Zg(o),l=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(o);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Td(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," "):""}le.paste=(n,e)=>{let t=e;if(n.composing&&!Ce)return;let r=rr?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&ir(n,Td(r),r.getData("text/html"),i,t)?t.preventDefault():ey(n,t)};class Ed{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Md=ye?"altKey":"ctrlKey";se.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(ro(t)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof C?i.to-1:i.to))){if(r&&r.mightDrag)s=C.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&&(s=C.create(n.state.doc,u.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:f}=gd(n,l);(!t.dataTransfer.files.length||!ee||ed>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(rr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",rr||t.dataTransfer.setData("text/plain",c),n.dragging=new Ed(f,!t[Md],s)};se.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};le.dragover=le.dragenter=(n,e)=>e.preventDefault();le.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(ro(t));if(!i)return;let o=n.state.doc.resolve(i.pos),s=r&&r.slice;s?n.someProp("transformPasted",p=>{s=p(s,n)}):s=yd(n,Td(t.dataTransfer),rr?null:t.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&!t[Md]);if(n.someProp("handleDrop",p=>p(n,t,s||v.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let a=s?Uu(n.state.doc,o.pos,s):o.pos;a==null&&(a=o.pos);let c=n.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let f=c.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(f,f,s.content.firstChild):c.replaceRange(f,f,s),c.doc.eq(d))return;let h=c.doc.resolve(f);if(u&&C.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new C(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,x)=>p=x),c.setSelection(bl(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};se.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())&&Ze(n)},20))};se.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)};se.beforeinput=(n,e)=>{if(ee&&Ce&&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",o=>o(n,Nt(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 le)se[n]=le[n];function or(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 ni{constructor(e,t){this.toDOM=e,this.spec=t||Bt,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:s}=e.mapResult(t.from+i,this.side<0?-1:1);return s?null:new ie(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ni&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&or(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ct{constructor(e,t){this.attrs=e,this.spec=t||Bt}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new ie(o,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Ct&&or(this.attrs,e.attrs)&&or(this.spec,e.spec)}static is(e){return e.type instanceof Ct}destroy(){}}class xl{constructor(e,t){this.attrs=e,this.spec=t||Bt}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let s=e.mapResult(t.to+i,-1);return s.deleted||s.pos<=o.pos?null:new ie(o.pos-r,s.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof xl&&or(this.attrs,e.attrs)&&or(this.spec,e.spec)}destroy(){}}class ie{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new ie(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 ie(e,e,new ni(t,r))}static inline(e,t,r,i){return new ie(e,t,new Ct(r,i))}static node(e,t,r,i){return new ie(e,t,new xl(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ct}get widget(){return this.type instanceof ni}}const on=[],Bt={};class _{constructor(e,t){this.local=e.length?e:on,this.children=t.length?t:on}static create(e,t){return t.length?ri(t,e,0,Bt):Z}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,r,i+l,o)}}map(e,t,r){return this==Z||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Bt)}mapInner(e,t,r,i,o){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(t,a)?(s||(s=[])).push(a):o.onRemove&&o.onRemove(this.local[l].spec)}return this.children.length?ty(this.children,s||[],e,t,r,i,o):s?new _(s.sort(zt),on):Z}add(e,t){return t.length?this==Z?_.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((l,a)=>{let c=a+r,f;if(f=Rd(t,l,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<a;)o+=3;i[o]==a?i[o+2]=i[o+2].addInner(l,f,c+1):i.splice(o,0,a,a+l.nodeSize,ri(f,l,c+1,Bt)),o+=3}});let s=Nd(o?Id(t):t,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new _(s.length?this.local.concat(s).sort(zt):this.local,i||this.children)}remove(e){return e.length==0||this==Z?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,l=r[o]+t,a=r[o+1]+t;for(let f=0,u;f<e.length;f++)(u=e[f])&&u.from>l&&u.to<a&&(e[f]=null,(s||(s=[])).push(u));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,l+1);c!=Z?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 l=0;l<i.length;l++)i[l].eq(s,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new _(i,r):Z}forChild(e,t){if(this==Z)return this;if(t.isLeaf)return _.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let o=e+1,s=o+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>o&&a.type instanceof Ct){let c=Math.max(o,a.from)-o,f=Math.min(s,a.to)-o;c<f&&(i||(i=[])).push(a.copy(c,f))}}if(i){let l=new _(i.sort(zt),on);return r?new pt([l,r]):l}return r||Z}eq(e){if(this==e)return!0;if(!(e instanceof _)||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 Cl(this.localsInner(e))}localsInner(e){if(this==Z)return on;if(e.inlineContent||!this.local.some(Ct.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Ct||t.push(this.local[r]);return t}}_.empty=new _([],[]);_.removeOverlap=Cl;const Z=_.empty;class pt{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Bt));return pt.from(r)}forChild(e,t){if(t.isLeaf)return _.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=Z&&(o instanceof pt?r=r.concat(o.members):r.push(o))}return pt.from(r)}eq(e){if(!(e instanceof pt)||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 o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let s=0;s<o.length;s++)t.push(o[s])}}return t?Cl(r?t:t.sort(zt)):on}static from(e){switch(e.length){case 0:return Z;case 1:return e[0];default:return new pt(e.every(t=>t instanceof _)?e:e.reduce((t,r)=>t.concat(r instanceof _?r:r.members),[]))}}}function ty(n,e,t,r,i,o,s){let l=n.slice();for(let c=0,f=o;c<t.maps.length;c++){let u=0;t.maps[c].forEach((d,h,p,m)=>{let g=m-p-(h-d);for(let y=0;y<l.length;y+=3){let x=l[y+1];if(x<0||d>x+f-u)continue;let k=l[y]+f-u;h>=k?l[y+1]=d<=k?-2:-1:d>=f&&g&&(l[y]+=g,l[y+1]+=g)}u+=g}),f=t.maps[c].map(f,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let f=t.map(n[c]+o),u=f-i;if(u<0||u>=r.content.size){a=!0;continue}let d=t.map(n[c+1]+o,-1),h=d-i,{index:p,offset:m}=r.content.findIndex(u),g=r.maybeChild(p);if(g&&m==u&&m+g.nodeSize==h){let y=l[c+2].mapInner(t,g,f+1,n[c]+o+1,s);y!=Z?(l[c]=u,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=ny(l,n,e,t,i,o,s),f=ri(c,r,0,s);e=f.local;for(let u=0;u<l.length;u+=3)l[u+1]<0&&(l.splice(u,3),u-=3);for(let u=0,d=0;u<f.children.length;u+=3){let h=f.children[u];for(;d<l.length&&l[d]<h;)d+=3;l.splice(d,0,f.children[u],f.children[u+1],f.children[u+2])}}return new _(e.sort(zt),l)}function Nd(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 ie(i.from+e,i.to+e,i.type))}return t}function ny(n,e,t,r,i,o,s){function l(a,c){for(let f=0;f<a.local.length;f++){let u=a.local[f].map(r,i,c);u?t.push(u):s.onRemove&&s.onRemove(a.local[f].spec)}for(let f=0;f<a.children.length;f+=3)l(a.children[f+2],a.children[f]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+o+1);return t}function Rd(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,s;o<n.length;o++)(s=n[o])&&s.from>t&&s.to<r&&((i||(i=[])).push(s),n[o]=null);return i}function Id(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ri(n,e,t,r){let i=[],o=!1;e.forEach((l,a)=>{let c=Rd(n,l,a+t);if(c){o=!0;let f=ri(c,l,t+a+1,r);f!=Z&&i.push(a,a+l.nodeSize,f)}});let s=Nd(o?Id(n):n,-t).sort(zt);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||i.length?new _(s,i):Z}function zt(n,e){return n.from-e.from||n.to-e.to}function Cl(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 o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),qa(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),qa(e,i,r.copy(o.from,r.to)));break}}}return e}function qa(n,e,t){for(;e<n.length&&zt(t,n[e])>0;)e++;n.splice(e,0,t)}function ko(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Z&&e.push(r)}),n.cursorWrapper&&e.push(_.create(n.state.doc,[n.cursorWrapper.deco])),pt.from(e)}const ry={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},iy=fe&&wt<=11;class oy{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 sy{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new oy,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]);fe&&wt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),iy&&(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,ry)),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(ja(this.view)){if(this.suppressingSelectionUpdates)return Ze(this.view);if(fe&&wt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Vt(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 o=e.focusNode;o;o=nr(o))t.add(o);for(let o=e.anchorNode;o;o=nr(o))if(t.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 t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&ja(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,a=[];if(e.editable)for(let f=0;f<t.length;f++){let u=this.registerMutation(t[f],a);u&&(o=o<0?u.from:Math.min(u.from,o),s=s<0?u.to:Math.max(u.to,s),u.typeOver&&(l=!0))}if(Te&&a.length){let f=a.filter(u=>u.nodeName=="BR");if(f.length==2){let[u,d]=f;u.parentNode&&u.parentNode.parentNode==d.parentNode?d.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let d of f){let h=d.parentNode;h&&h.nodeName=="LI"&&(!u||cy(e,u)!=h)&&d.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&to(r)&&(c=yl(e))&&c.eq(A.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ze(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),ly(e)),this.handleDOMChange(o,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ze(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 f=0;f<e.addedNodes.length;f++){let u=e.addedNodes[f];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,o=e.nextSibling;if(fe&&wt<=11&&e.addedNodes.length)for(let f=0;f<e.addedNodes.length;f++){let{previousSibling:u,nextSibling:d}=e.addedNodes[f];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u),(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d)}let s=i&&i.parentNode==e.target?X(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=o&&o.parentNode==e.target?X(o):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,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 Ga=new WeakMap,Ya=!1;function ly(n){if(!Ga.has(n)&&(Ga.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Te,Ya)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."),Ya=!0}}function Xa(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return Vt(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function ay(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Xa(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?Xa(n,t):null}function cy(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 fy(n,e,t){let{node:r,fromOffset:i,toOffset:o,from:s,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),c,f=a.anchorNode;if(f&&n.dom.contains(f.nodeType==1?f:f.parentNode)&&(c=[{node:f,offset:a.anchorOffset}],to(a)||c.push({node:a.focusNode,offset:a.focusOffset})),ee&&n.input.lastKeyCode===8)for(let g=o;g>i;g--){let y=r.childNodes[g-1],x=y.pmViewDesc;if(y.nodeName=="BR"&&!x){o=g;break}if(!x||x.size)break}let u=n.state.doc,d=n.someProp("domParser")||gn.fromSchema(n.state.schema),h=u.resolve(s),p=null,m=d.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:o,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:uy,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+s,head:y+s}}return{doc:m,sel:p,from:s,to:l}}function uy(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(oe&&/^(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||oe&&/^(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 dy=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function hy(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let O=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,G=yl(n,O);if(G&&!n.state.selection.eq(G)){if(ee&&Ce&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",$=>$(n,Nt(13,"Enter"))))return;let ae=n.state.tr.setSelection(G);O=="pointer"?ae.setMeta("pointer",!0):O=="key"&&ae.scrollIntoView(),o&&ae.setMeta("composition",o),n.dispatch(ae)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=fy(n,e,t),f=n.state.doc,u=f.slice(c.from,c.to),d,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(d=n.state.selection.to,h="end"):(d=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let p=gy(u.content,c.doc.content,c.from,d,h);if((Sn&&n.input.lastIOSEnter>Date.now()-225||Ce)&&i.some(O=>O.nodeType==1&&!dy.test(O.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",O=>O(n,Nt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof R&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let O=Qa(n,n.state.doc,c.sel);if(O&&!O.eq(n.state.selection)){let G=n.state.tr.setSelection(O);o&&G.setMeta("composition",o),n.dispatch(G)}}return}n.input.domChangeCount++,n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof R&&(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)),fe&&wt<=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),y=f.resolve(p.start),x=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA,k;if((Sn&&n.input.lastIOSEnter>Date.now()-225&&(!x||i.some(O=>O.nodeName=="DIV"||O.nodeName=="P"))||!x&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(k=A.findFrom(c.doc.resolve(m.pos+1),1,!0))&&k.head==g.pos)&&n.someProp("handleKeyDown",O=>O(n,Nt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&my(f,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",O=>O(n,Nt(8,"Backspace")))){Ce&&ee&&n.domObserver.suppressSelectionUpdates();return}ee&&Ce&&p.endB==p.start&&(n.input.lastAndroidDelete=Date.now()),Ce&&!x&&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(O){return O(n,Nt(13,"Enter"))})},20));let M=p.start,T=p.endA,w,I,P;if(x){if(m.pos==g.pos)fe&&wt<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ze(n),20)),w=n.state.tr.delete(M,T),I=f.resolve(p.start).marksAcross(f.resolve(p.endA));else if(p.endA==p.endB&&(P=py(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start()))))w=n.state.tr,P.type=="add"?w.addMark(M,T,P.mark):w.removeMark(M,T,P.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let O=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",G=>G(n,M,T,O)))return;w=n.state.tr.insertText(O,M,T)}}if(w||(w=n.state.tr.replace(M,T,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let O=Qa(n,w.doc,c.sel);O&&!(ee&&Ce&&n.composing&&O.empty&&(p.start!=p.endB||n.input.lastAndroidDelete<Date.now()-100)&&(O.head==M||O.head==w.mapping.map(T)-1)||fe&&O.empty&&O.head==M)&&w.setSelection(O)}I&&w.ensureMarks(I),o&&w.setMeta("composition",o),n.dispatch(w.scrollIntoView())}function Qa(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:bl(n,e.resolve(t.anchor),e.resolve(t.head))}function py(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,o=r,s,l,a;for(let f=0;f<r.length;f++)i=r[f].removeFromSet(i);for(let f=0;f<t.length;f++)o=t[f].removeFromSet(o);if(i.length==1&&o.length==0)l=i[0],s="add",a=f=>f.mark(l.addToSet(f.marks));else if(i.length==0&&o.length==1)l=o[0],s="remove",a=f=>f.mark(l.removeFromSet(f.marks));else return null;let c=[];for(let f=0;f<e.childCount;f++)c.push(a(e.child(f)));if(b.from(c).eq(n))return{mark:l,type:s}}function my(n,e,t,r,i){if(t-e<=i.pos-r.pos||Oo(r,!0,!1)<i.pos)return!1;let o=n.resolve(e);if(!r.parent.isTextblock){let l=o.nodeAfter;return l!=null&&t==e+l.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=n.resolve(Oo(o,!0,!0));return!s.parent.isTextblock||s.pos>t||Oo(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Oo(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 o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function gy(n,e,t,r,i){let o=n.findDiffStart(e,t);if(o==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,o-Math.min(s,l));r-=s+a-o}if(s<o&&n.size<e.size){let a=r<=o&&r>=s?o-r:0;o-=a,o&&o<e.size&&Za(e.textBetween(o-1,o+1))&&(o+=a?1:-1),l=o+(l-s),s=o}else if(l<o){let a=r<=o&&r>=l?o-r:0;o-=a,o&&o<n.size&&Za(n.textBetween(o-1,o+1))&&(o+=a?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}function Za(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 yy{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 Bg,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(ic),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=nc(this),tc(this),this.nodeViews=rc(this),this.docView=Pa(this.state.doc,ec(this),ko(this),this.dom,this),this.domObserver=new sy(this,(r,i,o,s)=>hy(this,r,i,o,s)),this.domObserver.start(),zg(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&&vs(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ic),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,o=!1,s=!1;e.storedMarks&&this.composing&&(Ad(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=rc(this);Sy(h,this.nodeViews)&&(this.nodeViews=h,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&vs(this),this.editable=nc(this),tc(this);let a=ko(this),c=ec(this),f=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,a);(u||!e.selection.eq(i.selection))&&(s=!0);let d=f=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Qm(this);if(s){this.domObserver.stop();let h=u&&(fe||ee)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&by(i.selection,e.selection);if(u){let p=ee?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Yg(this)),(o||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Pa(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&xg(this))?Ze(this,h):(hd(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),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():d&&Zm(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof C){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Ea(this,t.getBoundingClientRect(),e)}else Ea(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 o=r.from+(this.state.doc.content.size-t.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Ed(e.slice,e.move,i<0?void 0:C.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 s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(i=t?t(l):l))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let l=o[s].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(fe){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&&eg(this.dom),Ze(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 og(this,e)}coordsAtPos(e,t=1){return od(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 fg(this,t||this.state,e)}pasteHTML(e,t){return ir(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return ir(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Lg(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ko(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,_m())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return jg(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?oe&&this.root.nodeType===11&&Jm(this.dom.ownerDocument)==this.dom&&ay(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function ec(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"),[ie.node(0,n.state.doc.content.size,e)]}function tc(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:ie.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function nc(n){return!n.someProp("editable",e=>e(n.state)===!1)}function by(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 rc(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 Sy(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 ic(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 kt={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:"'"},ii={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},vy=typeof navigator<"u"&&/Mac/.test(navigator.platform),wy=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Q=0;Q<10;Q++)kt[48+Q]=kt[96+Q]=String(Q);for(var Q=1;Q<=24;Q++)kt[Q+111]="F"+Q;for(var Q=65;Q<=90;Q++)kt[Q]=String.fromCharCode(Q+32),ii[Q]=String.fromCharCode(Q);for(var Ao in kt)ii.hasOwnProperty(Ao)||(ii[Ao]=kt[Ao]);function xy(n){var e=vy&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||wy&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ii:kt)[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 Cy=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function ky(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))Cy?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),s&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function Oy(n){let e=Object.create(null);for(let t in n)e[ky(t)]=n[t];return e}function To(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 Ay(n){return new Kt({props:{handleKeyDown:kl(n)}})}function kl(n){let e=Oy(n);return function(t,r){let i=xy(r),o,s=e[To(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[To(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=kt[r.keyCode])&&o!=i){let l=e[To(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const Ty=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Dd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Ey=(n,e,t)=>{let r=Dd(n,t);if(!r)return!1;let i=Ol(r);if(!i){let s=r.blockRange(),l=s&&On(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(zd(n,i,e,-1))return!0;if(r.parent.content.size==0&&(vn(o,"end")||C.isSelectable(o)))for(let s=r.depth;;s--){let l=Zi(n.doc,r.before(s),r.after(s),v.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(vn(o,"end")?A.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):C.create(a.doc,i.pos-o.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},My=(n,e,t)=>{let r=Dd(n,t);if(!r)return!1;let i=Ol(r);return i?Pd(n,i,e):!1},Ny=(n,e,t)=>{let r=$d(n,t);if(!r)return!1;let i=Al(r);return i?Pd(n,i,e):!1};function Pd(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let f=i.lastChild;if(!f)return!1;i=f}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let f=l.firstChild;if(!f)return!1;l=f}let c=Zi(n.doc,o,a,v.empty);if(!c||c.from!=o||c instanceof J&&c.slice.size>=a-o)return!1;if(t){let f=n.tr.step(c);f.setSelection(R.create(f.doc,o)),t(f.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 Ry=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=Ol(r)}let s=o&&o.nodeBefore;return!s||!C.isSelectable(s)?!1:(e&&e(n.tr.setSelection(C.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Ol(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 $d(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Iy=(n,e,t)=>{let r=$d(n,t);if(!r)return!1;let i=Al(r);if(!i)return!1;let o=i.nodeAfter;if(zd(n,i,e,1))return!0;if(r.parent.content.size==0&&(vn(o,"start")||C.isSelectable(o))){let s=Zi(n.doc,r.before(),r.after(),v.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(vn(o,"start")?A.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):C.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},Dy=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=Al(r)}let s=o&&o.nodeAfter;return!s||!C.isSelectable(s)?!1:(e&&e(n.tr.setSelection(C.create(n.doc,o.pos)).scrollIntoView()),!0)};function Al(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 Py=(n,e)=>{let t=n.selection,r=t instanceof C,i;if(r){if(t.node.isTextblock||!An(n.doc,t.from))return!1;i=t.from}else if(i=hl(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(C.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},$y=(n,e)=>{let t=n.selection,r;if(t instanceof C){if(t.node.isTextblock||!An(n.doc,t.to))return!1;r=t.to}else if(r=hl(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},By=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&On(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},zy=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
10
+ `).scrollIntoView()),!0)};function Bd(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 Ly=(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),o=t.indexAfter(-1),s=Bd(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(A.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Fy=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Se||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Bd(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,l=n.tr.insert(s,o.createAndFill());l.setSelection(R.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},jy=(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 o=t.before();if(dl(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&On(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},_y=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(C.create(n.doc,i))),!0)};function Vy(n,e,t){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)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||An(n.doc,e.pos))?!1:(t&&t(n.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function zd(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,a=i.type.spec.isolating||o.type.spec.isolating;if(!a&&Vy(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&l.matchType(s[0]||o.type).validEnd){if(t){let h=e.pos+o.nodeSize,p=b.empty;for(let y=s.length-1;y>=0;y--)p=b.from(s[y].create(null,p));p=b.from(i.copy(p));let m=n.tr.step(new K(e.pos-1,h,e.pos,h,new v(p,1,0),s.length,!0)),g=h+2*s.length;An(m.doc,g)&&m.join(g),t(m.scrollIntoView())}return!0}let f=o.type.spec.isolating||r>0&&a?null:A.findFrom(e,1),u=f&&f.$from.blockRange(f.$to),d=u&&On(u);if(d!=null&&d>=e.depth)return t&&t(n.tr.lift(u,d).scrollIntoView()),!0;if(c&&vn(o,"start",!0)&&vn(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=o,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(t){let y=b.empty;for(let k=p.length-1;k>=0;k--)y=b.from(p[k].copy(y));let x=n.tr.step(new K(e.pos-p.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new v(y,p.length,0),0,!0));t(x.scrollIntoView())}return!0}}return!1}function Ld(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(R.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const Wy=Ld(-1),Hy=Ld(1);function Uy(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=s&&ul(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Jy(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[o];t.doc.nodesBetween(s,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let f=t.doc.resolve(c),u=f.index();i=f.parent.canReplaceWith(u,u+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];o.setBlockType(l,a,n,e)}r(o.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Ky(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&i.node(s.depth-1).type.compatibleContent(n)&&s.startIndex==0){if(i.index(s.depth-1)==0)return!1;let f=t.doc.resolve(s.start-2);a=new Yr(f,f,s.depth),s.endIndex<s.parent.childCount&&(s=new Yr(i,t.doc.resolve(o.end(s.depth)),s.depth)),l=!0}let c=ul(a,n,e,s);return c?(r&&r(qy(t.tr,s,c,l,n).scrollIntoView()),!0):!1}}function qy(n,e,t,r,i){let o=b.empty;for(let f=t.length-1;f>=0;f--)o=b.from(t[f].type.create(t[f].attrs,o));n.step(new K(e.start-(r?2:0),e.end,e.start,e.end,new v(o,0,0),t.length,!0));let s=0;for(let f=0;f<t.length;f++)t[f].type==i&&(s=f+1);let l=t.length-s,a=e.start+t.length-(r?2:0),c=e.parent;for(let f=e.startIndex,u=e.endIndex,d=!0;f<u;f++,d=!1)!d&&dl(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(f).nodeSize;return n}function Gy(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?Yy(e,t,n,o):Xy(e,t,o):!0:!1}}function Yy(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new K(o-1,s,o,s,new v(b.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Yr(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const l=On(r);if(l==null)return!1;i.lift(r,l);let a=i.mapping.map(o,-1)-1;return An(i.doc,a)&&i.join(a),e(i.scrollIntoView()),!0}function Xy(n,e,t){let r=n.tr,i=t.parent;for(let h=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let o=r.doc.resolve(t.start),s=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=o.node(-1),f=o.index(-1);if(!c.canReplace(f+(l?0:1),f+1,s.content.append(a?b.empty:b.from(i))))return!1;let u=o.pos,d=u+s.nodeSize;return r.step(new K(u-(l?1:0),d+(a?1:0),u+1,d-1,new v((l?b.empty:b.from(i.copy(b.empty))).append(a?b.empty:b.from(i.copy(b.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Qy(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,f=b.from(c?n.create():null),u=new v(b.from(n.create(null,b.from(l.type.create(null,f)))),c?3:1,0),d=o.start,h=o.end;t(e.tr.step(new K(d-(c?3:1),h,d,h,u,1,!0)).scrollIntoView())}return!0}}function Fd(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=Fd(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function Zy(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=Fd(n))&&(r&&(r+=" "),r+=e);return r}const Tl="-",e0=n=>{const e=n0(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:s=>{const l=s.split(Tl);return l[0]===""&&l.length!==1&&l.shift(),jd(l,e)||t0(s)},getConflictingClassGroupIds:(s,l)=>{const a=t[s]||[];return l&&r[s]?[...a,...r[s]]:a}}},jd=(n,e)=>{var s;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),i=r?jd(n.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const o=n.join(Tl);return(s=e.validators.find(({validator:l})=>l(o)))==null?void 0:s.classGroupId},oc=/^\[(.+)\]$/,t0=n=>{if(oc.test(n)){const e=oc.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},n0=n=>{const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return i0(Object.entries(n.classGroups),t).forEach(([o,s])=>{ws(s,r,o,e)}),r},ws=(n,e,t,r)=>{n.forEach(i=>{if(typeof i=="string"){const o=i===""?e:sc(e,i);o.classGroupId=t;return}if(typeof i=="function"){if(r0(i)){ws(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([o,s])=>{ws(s,sc(e,o),t,r)})})},sc=(n,e)=>{let t=n;return e.split(Tl).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},r0=n=>n.isThemeGetter,i0=(n,e)=>e?n.map(([t,r])=>{const i=r.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,l])=>[e+s,l])):o);return[t,i]}):n,o0=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;const i=(o,s)=>{t.set(o,s),e++,e>n&&(e=0,r=t,t=new Map)};return{get(o){let s=t.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){t.has(o)?t.set(o,s):i(o,s)}}},_d="!",s0=n=>{const{separator:e,experimentalParseClassName:t}=n,r=e.length===1,i=e[0],o=e.length,s=l=>{const a=[];let c=0,f=0,u;for(let g=0;g<l.length;g++){let y=l[g];if(c===0){if(y===i&&(r||l.slice(g,g+o)===e)){a.push(l.slice(f,g)),f=g+o;continue}if(y==="/"){u=g;continue}}y==="["?c++:y==="]"&&c--}const d=a.length===0?l:l.substring(f),h=d.startsWith(_d),p=h?d.substring(1):d,m=u&&u>f?u-f:void 0;return{modifiers:a,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};return t?l=>t({className:l,parseClassName:s}):s},l0=n=>{if(n.length<=1)return n;const e=[];let t=[];return n.forEach(r=>{r[0]==="["?(e.push(...t.sort(),r),t=[]):t.push(r)}),e.push(...t.sort()),e},a0=n=>({cache:o0(n.cacheSize),parseClassName:s0(n),...e0(n)}),c0=/\s+/,f0=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=[],s=n.trim().split(c0);let l="";for(let a=s.length-1;a>=0;a-=1){const c=s[a],{modifiers:f,hasImportantModifier:u,baseClassName:d,maybePostfixModifierPosition:h}=t(c);let p=!!h,m=r(p?d.substring(0,h):d);if(!m){if(!p){l=c+(l.length>0?" "+l:l);continue}if(m=r(d),!m){l=c+(l.length>0?" "+l:l);continue}p=!1}const g=l0(f).join(":"),y=u?g+_d:g,x=y+m;if(o.includes(x))continue;o.push(x);const k=i(m,p);for(let M=0;M<k.length;++M){const T=k[M];o.push(y+T)}l=c+(l.length>0?" "+l:l)}return l};function u0(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=Vd(e))&&(r&&(r+=" "),r+=t);return r}const Vd=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=Vd(n[r]))&&(t&&(t+=" "),t+=e);return t};function d0(n,...e){let t,r,i,o=s;function s(a){const c=e.reduce((f,u)=>u(f),n());return t=a0(c),r=t.cache.get,i=t.cache.set,o=l,l(a)}function l(a){const c=r(a);if(c)return c;const f=f0(a,t);return i(a,f),f}return function(){return o(u0.apply(null,arguments))}}const z=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},Wd=/^\[(?:([a-z-]+):)?(.+)\]$/i,h0=/^\d+\/\d+$/,p0=new Set(["px","full","screen"]),m0=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,g0=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,y0=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,b0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,S0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qe=n=>hn(n)||p0.has(n)||h0.test(n),ot=n=>En(n,"length",T0),hn=n=>!!n&&!Number.isNaN(Number(n)),Eo=n=>En(n,"number",hn),Pn=n=>!!n&&Number.isInteger(Number(n)),v0=n=>n.endsWith("%")&&hn(n.slice(0,-1)),E=n=>Wd.test(n),st=n=>m0.test(n),w0=new Set(["length","size","percentage"]),x0=n=>En(n,w0,Hd),C0=n=>En(n,"position",Hd),k0=new Set(["image","url"]),O0=n=>En(n,k0,M0),A0=n=>En(n,"",E0),$n=()=>!0,En=(n,e,t)=>{const r=Wd.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1},T0=n=>g0.test(n)&&!y0.test(n),Hd=()=>!1,E0=n=>b0.test(n),M0=n=>S0.test(n),N0=()=>{const n=z("colors"),e=z("spacing"),t=z("blur"),r=z("brightness"),i=z("borderColor"),o=z("borderRadius"),s=z("borderSpacing"),l=z("borderWidth"),a=z("contrast"),c=z("grayscale"),f=z("hueRotate"),u=z("invert"),d=z("gap"),h=z("gradientColorStops"),p=z("gradientColorStopPositions"),m=z("inset"),g=z("margin"),y=z("opacity"),x=z("padding"),k=z("saturate"),M=z("scale"),T=z("sepia"),w=z("skew"),I=z("space"),P=z("translate"),O=()=>["auto","contain","none"],G=()=>["auto","hidden","clip","visible","scroll"],ae=()=>["auto",E,e],$=()=>[E,e],ue=()=>["",qe,ot],he=()=>["auto",hn,E],it=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],pe=()=>["solid","dashed","dotted","double","none"],He=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ue=()=>["start","end","center","between","around","evenly","stretch"],In=()=>["","0",E],la=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Je=()=>[hn,E];return{cacheSize:500,separator:":",theme:{colors:[$n],spacing:[qe,ot],blur:["none","",st,E],brightness:Je(),borderColor:[n],borderRadius:["none","","full",st,E],borderSpacing:$(),borderWidth:ue(),contrast:Je(),grayscale:In(),hueRotate:Je(),invert:In(),gap:$(),gradientColorStops:[n],gradientColorStopPositions:[v0,ot],inset:ae(),margin:ae(),opacity:Je(),padding:$(),saturate:Je(),scale:Je(),sepia:In(),skew:Je(),space:$(),translate:$()},classGroups:{aspect:[{aspect:["auto","square","video",E]}],container:["container"],columns:[{columns:[st]}],"break-after":[{"break-after":la()}],"break-before":[{"break-before":la()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...it(),E]}],overflow:[{overflow:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Pn,E]}],basis:[{basis:ae()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",E]}],grow:[{grow:In()}],shrink:[{shrink:In()}],order:[{order:["first","last","none",Pn,E]}],"grid-cols":[{"grid-cols":[$n]}],"col-start-end":[{col:["auto",{span:["full",Pn,E]},E]}],"col-start":[{"col-start":he()}],"col-end":[{"col-end":he()}],"grid-rows":[{"grid-rows":[$n]}],"row-start-end":[{row:["auto",{span:[Pn,E]},E]}],"row-start":[{"row-start":he()}],"row-end":[{"row-end":he()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",E]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",E]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...Ue()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Ue(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Ue(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[I]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[I]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",E,e]}],"min-w":[{"min-w":[E,e,"min","max","fit"]}],"max-w":[{"max-w":[E,e,"none","full","min","max","fit","prose",{screen:[st]},st]}],h:[{h:[E,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[E,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[E,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[E,e,"auto","min","max","fit"]}],"font-size":[{text:["base",st,ot]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Eo]}],"font-family":[{font:[$n]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",E]}],"line-clamp":[{"line-clamp":["none",hn,Eo]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",qe,E]}],"list-image":[{"list-image":["none",E]}],"list-style-type":[{list:["none","disc","decimal",E]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...pe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",qe,ot]}],"underline-offset":[{"underline-offset":["auto",qe,E]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",E]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",E]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...it(),C0]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",x0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},O0]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...pe(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:pe()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...pe()]}],"outline-offset":[{"outline-offset":[qe,E]}],"outline-w":[{outline:[qe,ot]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[qe,ot]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",st,A0]}],"shadow-color":[{shadow:[$n]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...He(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":He()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",st,E]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[u]}],saturate:[{saturate:[k]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[k]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",E]}],duration:[{duration:Je()}],ease:[{ease:["linear","in","out","in-out",E]}],delay:[{delay:Je()}],animate:[{animate:["none","spin","ping","pulse","bounce",E]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[M]}],"scale-x":[{"scale-x":[M]}],"scale-y":[{"scale-y":[M]}],rotate:[{rotate:[Pn,E]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[w]}],"skew-y":[{"skew-y":[w]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",E]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",E]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",E]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[qe,ot,Eo]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},R0=d0(N0);var oi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function I0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function D0(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var lc=Object.prototype.toString,Ud=function(e){var t=lc.call(e),r=t==="[object Arguments]";return r||(r=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&lc.call(e.callee)==="[object Function]"),r},Mo,ac;function P0(){if(ac)return Mo;ac=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Ud,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),s=i.call(function(){},"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],a=function(d){var h=d.constructor;return h&&h.prototype===d},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if(typeof window>"u")return!1;for(var d in window)try{if(!c["$"+d]&&e.call(window,d)&&window[d]!==null&&typeof window[d]=="object")try{a(window[d])}catch{return!0}}catch{return!0}return!1}(),u=function(d){if(typeof window>"u"||!f)return a(d);try{return a(d)}catch{return!1}};n=function(h){var p=h!==null&&typeof h=="object",m=t.call(h)==="[object Function]",g=r(h),y=p&&t.call(h)==="[object String]",x=[];if(!p&&!m&&!g)throw new TypeError("Object.keys called on a non-object");var k=s&&m;if(y&&h.length>0&&!e.call(h,0))for(var M=0;M<h.length;++M)x.push(String(M));if(g&&h.length>0)for(var T=0;T<h.length;++T)x.push(String(T));else for(var w in h)!(k&&w==="prototype")&&e.call(h,w)&&x.push(String(w));if(o)for(var I=u(h),P=0;P<l.length;++P)!(I&&l[P]==="constructor")&&e.call(h,l[P])&&x.push(l[P]);return x}}return Mo=n,Mo}var $0=Array.prototype.slice,B0=Ud,cc=Object.keys,Dr=cc?function(e){return cc(e)}:P0(),fc=Object.keys;Dr.shim=function(){if(Object.keys){var e=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);e||(Object.keys=function(r){return B0(r)?fc($0.call(r)):fc(r)})}else Object.keys=Dr;return Object.keys||Dr};var El=Dr,z0=Error,L0=EvalError,F0=RangeError,j0=ReferenceError,Jd=SyntaxError,Tt=TypeError,_0=URIError,io=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),r=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,t);if(s.value!==i||s.enumerable!==!0)return!1}return!0},uc=typeof Symbol<"u"&&Symbol,V0=io,Ml=function(){return typeof uc!="function"||typeof Symbol!="function"||typeof uc("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:V0()},No={__proto__:null,foo:{}},W0=Object,H0=function(){return{__proto__:No}.foo===No.foo&&!(No instanceof W0)},U0="Function.prototype.bind called on incompatible ",J0=Object.prototype.toString,K0=Math.max,q0="[object Function]",dc=function(e,t){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var o=0;o<t.length;o+=1)r[o+e.length]=t[o];return r},G0=function(e,t){for(var r=[],i=t,o=0;i<e.length;i+=1,o+=1)r[o]=e[i];return r},Y0=function(n,e){for(var t="",r=0;r<n.length;r+=1)t+=n[r],r+1<n.length&&(t+=e);return t},X0=function(e){var t=this;if(typeof t!="function"||J0.apply(t)!==q0)throw new TypeError(U0+t);for(var r=G0(arguments,1),i,o=function(){if(this instanceof i){var f=t.apply(this,dc(r,arguments));return Object(f)===f?f:this}return t.apply(e,dc(r,arguments))},s=K0(0,t.length-r.length),l=[],a=0;a<s;a++)l[a]="$"+a;if(i=Function("binder","return function ("+Y0(l,",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var c=function(){};c.prototype=t.prototype,i.prototype=new c,c.prototype=null}return i},Q0=X0,Nl=Function.prototype.bind||Q0,Z0=Function.prototype.call,eb=Object.prototype.hasOwnProperty,tb=Nl,Kd=tb.call(Z0,eb),D,nb=z0,rb=L0,ib=F0,ob=j0,wn=Jd,pn=Tt,sb=_0,qd=Function,Ro=function(n){try{return qd('"use strict"; return ('+n+").constructor;")()}catch{}},Lt=Object.getOwnPropertyDescriptor;if(Lt)try{Lt({},"")}catch{Lt=null}var Io=function(){throw new pn},lb=Lt?function(){try{return arguments.callee,Io}catch{try{return Lt(arguments,"callee").get}catch{return Io}}}():Io,en=Ml(),ab=H0(),U=Object.getPrototypeOf||(ab?function(n){return n.__proto__}:null),sn={},cb=typeof Uint8Array>"u"||!U?D:U(Uint8Array),Ft={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?D:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?D:ArrayBuffer,"%ArrayIteratorPrototype%":en&&U?U([][Symbol.iterator]()):D,"%AsyncFromSyncIteratorPrototype%":D,"%AsyncFunction%":sn,"%AsyncGenerator%":sn,"%AsyncGeneratorFunction%":sn,"%AsyncIteratorPrototype%":sn,"%Atomics%":typeof Atomics>"u"?D:Atomics,"%BigInt%":typeof BigInt>"u"?D:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?D:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?D:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?D:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":nb,"%eval%":eval,"%EvalError%":rb,"%Float32Array%":typeof Float32Array>"u"?D:Float32Array,"%Float64Array%":typeof Float64Array>"u"?D:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?D:FinalizationRegistry,"%Function%":qd,"%GeneratorFunction%":sn,"%Int8Array%":typeof Int8Array>"u"?D:Int8Array,"%Int16Array%":typeof Int16Array>"u"?D:Int16Array,"%Int32Array%":typeof Int32Array>"u"?D:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":en&&U?U(U([][Symbol.iterator]())):D,"%JSON%":typeof JSON=="object"?JSON:D,"%Map%":typeof Map>"u"?D:Map,"%MapIteratorPrototype%":typeof Map>"u"||!en||!U?D:U(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?D:Promise,"%Proxy%":typeof Proxy>"u"?D:Proxy,"%RangeError%":ib,"%ReferenceError%":ob,"%Reflect%":typeof Reflect>"u"?D:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?D:Set,"%SetIteratorPrototype%":typeof Set>"u"||!en||!U?D:U(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?D:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":en&&U?U(""[Symbol.iterator]()):D,"%Symbol%":en?Symbol:D,"%SyntaxError%":wn,"%ThrowTypeError%":lb,"%TypedArray%":cb,"%TypeError%":pn,"%Uint8Array%":typeof Uint8Array>"u"?D:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?D:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?D:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?D:Uint32Array,"%URIError%":sb,"%WeakMap%":typeof WeakMap>"u"?D:WeakMap,"%WeakRef%":typeof WeakRef>"u"?D:WeakRef,"%WeakSet%":typeof WeakSet>"u"?D:WeakSet};if(U)try{null.error}catch(n){var fb=U(U(n));Ft["%Error.prototype%"]=fb}var ub=function n(e){var t;if(e==="%AsyncFunction%")t=Ro("async function () {}");else if(e==="%GeneratorFunction%")t=Ro("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Ro("async function* () {}");else if(e==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&U&&(t=U(i.prototype))}return Ft[e]=t,t},hc={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},mr=Nl,si=Kd,db=mr.call(Function.call,Array.prototype.concat),hb=mr.call(Function.apply,Array.prototype.splice),pc=mr.call(Function.call,String.prototype.replace),li=mr.call(Function.call,String.prototype.slice),pb=mr.call(Function.call,RegExp.prototype.exec),mb=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,gb=/\\(\\)?/g,yb=function(e){var t=li(e,0,1),r=li(e,-1);if(t==="%"&&r!=="%")throw new wn("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new wn("invalid intrinsic syntax, expected opening `%`");var i=[];return pc(e,mb,function(o,s,l,a){i[i.length]=l?pc(a,gb,"$1"):s||o}),i},bb=function(e,t){var r=e,i;if(si(hc,r)&&(i=hc[r],r="%"+i[0]+"%"),si(Ft,r)){var o=Ft[r];if(o===sn&&(o=ub(r)),typeof o>"u"&&!t)throw new pn("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new wn("intrinsic "+e+" does not exist!")},je=function(e,t){if(typeof e!="string"||e.length===0)throw new pn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new pn('"allowMissing" argument must be a boolean');if(pb(/^%?[^%]*%?$/,e)===null)throw new wn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=yb(e),i=r.length>0?r[0]:"",o=bb("%"+i+"%",t),s=o.name,l=o.value,a=!1,c=o.alias;c&&(i=c[0],hb(r,db([0,1],c)));for(var f=1,u=!0;f<r.length;f+=1){var d=r[f],h=li(d,0,1),p=li(d,-1);if((h==='"'||h==="'"||h==="`"||p==='"'||p==="'"||p==="`")&&h!==p)throw new wn("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(a=!0),i+="."+d,s="%"+i+"%",si(Ft,s))l=Ft[s];else if(l!=null){if(!(d in l)){if(!t)throw new pn("base intrinsic for "+e+" exists, but the property is not available.");return}if(Lt&&f+1>=r.length){var m=Lt(l,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?l=m.get:l=l[d]}else u=si(l,d),l=l[d];u&&!a&&(Ft[s]=l)}}return l},Sb=je,Pr=Sb("%Object.defineProperty%",!0)||!1;if(Pr)try{Pr({},"a",{value:1})}catch{Pr=!1}var Rl=Pr,vb=je,$r=vb("%Object.getOwnPropertyDescriptor%",!0);if($r)try{$r([],"length")}catch{$r=null}var Il=$r,mc=Rl,wb=Jd,tn=Tt,gc=Il,Dl=function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new tn("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new tn("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new tn("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new tn("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new tn("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new tn("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,a=!!gc&&gc(e,t);if(mc)mc(e,t,{configurable:s===null&&a?a.configurable:!s,enumerable:i===null&&a?a.enumerable:!i,value:r,writable:o===null&&a?a.writable:!o});else if(l||!i&&!o&&!s)e[t]=r;else throw new wb("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},xs=Rl,Gd=function(){return!!xs};Gd.hasArrayLengthDefineBug=function(){if(!xs)return null;try{return xs([],"length",{value:1}).length!==1}catch{return!0}};var Pl=Gd,xb=El,Cb=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",kb=Object.prototype.toString,Ob=Array.prototype.concat,yc=Dl,Ab=function(n){return typeof n=="function"&&kb.call(n)==="[object Function]"},Yd=Pl(),Tb=function(n,e,t,r){if(e in n){if(r===!0){if(n[e]===t)return}else if(!Ab(r)||!r())return}Yd?yc(n,e,t,!0):yc(n,e,t)},Xd=function(n,e){var t=arguments.length>2?arguments[2]:{},r=xb(e);Cb&&(r=Ob.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)Tb(n,r[i],e[r[i]],t[r[i]])};Xd.supportsDescriptors=!!Yd;var qt=Xd,Qd={exports:{}},Eb=je,bc=Dl,Mb=Pl(),Sc=Il,vc=Tt,Nb=Eb("%Math.floor%"),Rb=function(e,t){if(typeof e!="function")throw new vc("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||Nb(t)!==t)throw new vc("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,o=!0;if("length"in e&&Sc){var s=Sc(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(o=!1)}return(i||o||!r)&&(Mb?bc(e,"length",t,!0,!0):bc(e,"length",t)),e};(function(n){var e=Nl,t=je,r=Rb,i=Tt,o=t("%Function.prototype.apply%"),s=t("%Function.prototype.call%"),l=t("%Reflect.apply%",!0)||e.call(s,o),a=Rl,c=t("%Math.max%");n.exports=function(d){if(typeof d!="function")throw new i("a function is required");var h=l(e,s,arguments);return r(h,1+c(0,d.length-(arguments.length-1)),!0)};var f=function(){return l(e,o,arguments)};a?a(n.exports,"apply",{value:f}):n.exports.apply=f})(Qd);var Mn=Qd.exports,Zd=je,eh=Mn,Ib=eh(Zd("String.prototype.indexOf")),we=function(e,t){var r=Zd(e,!!t);return typeof r=="function"&&Ib(e,".prototype.")>-1?eh(r):r},Db=El,th=io(),nh=we,wc=Object,Pb=nh("Array.prototype.push"),xc=nh("Object.prototype.propertyIsEnumerable"),$b=th?Object.getOwnPropertySymbols:null,rh=function(e,t){if(e==null)throw new TypeError("target must be an object");var r=wc(e);if(arguments.length===1)return r;for(var i=1;i<arguments.length;++i){var o=wc(arguments[i]),s=Db(o),l=th&&(Object.getOwnPropertySymbols||$b);if(l)for(var a=l(o),c=0;c<a.length;++c){var f=a[c];xc(o,f)&&Pb(s,f)}for(var u=0;u<s.length;++u){var d=s[u];if(xc(o,d)){var h=o[d];r[d]=h}}}return r},Do=rh,Bb=function(){if(!Object.assign)return!1;for(var n="abcdefghijklmnopqrst",e=n.split(""),t={},r=0;r<e.length;++r)t[e[r]]=e[r];var i=Object.assign({},t),o="";for(var s in i)o+=s;return n!==o},zb=function(){if(!Object.assign||!Object.preventExtensions)return!1;var n=Object.preventExtensions({1:2});try{Object.assign(n,"xy")}catch{return n[1]==="y"}return!1},ih=function(){return!Object.assign||Bb()||zb()?Do:Object.assign},Lb=qt,Fb=ih,jb=function(){var e=Fb();return Lb(Object,{assign:e},{assign:function(){return Object.assign!==e}}),e},_b=qt,Vb=Mn,Wb=rh,oh=ih,Hb=jb,Ub=Vb.apply(oh()),sh=function(e,t){return Ub(Object,arguments)};_b(sh,{getPolyfill:oh,implementation:Wb,shim:Hb});var Jb=sh,sr=function(){return typeof(function(){}).name=="string"},Kn=Object.getOwnPropertyDescriptor;if(Kn)try{Kn([],"length")}catch{Kn=null}sr.functionsHaveConfigurableNames=function(){if(!sr()||!Kn)return!1;var e=Kn(function(){},"name");return!!e&&!!e.configurable};var Kb=Function.prototype.bind;sr.boundFunctionsHaveNames=function(){return sr()&&typeof Kb=="function"&&(function(){}).bind().name!==""};var qb=sr,Cc=Dl,Gb=Pl(),Yb=qb.functionsHaveConfigurableNames(),Xb=Tt,Qb=function(e,t){if(typeof e!="function")throw new Xb("`fn` is not a function");var r=arguments.length>2&&!!arguments[2];return(!r||Yb)&&(Gb?Cc(e,"name",t,!0,!0):Cc(e,"name",t)),e},Zb=Qb,e1=Tt,t1=Object,lh=Zb(function(){if(this==null||this!==t1(this))throw new e1("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0),n1=lh,r1=qt.supportsDescriptors,i1=Object.getOwnPropertyDescriptor,ah=function(){if(r1&&/a/mig.flags==="gim"){var e=i1(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var t="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){t+="d"}}),Object.defineProperty(r,"sticky",{get:function(){t+="y"}}),t==="dy")return e.get}}return n1},o1=qt.supportsDescriptors,s1=ah,l1=Object.getOwnPropertyDescriptor,a1=Object.defineProperty,c1=TypeError,kc=Object.getPrototypeOf,f1=/a/,u1=function(){if(!o1||!kc)throw new c1("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=s1(),t=kc(f1),r=l1(t,"flags");return(!r||r.get!==e)&&a1(t,"flags",{configurable:!0,enumerable:!1,get:e}),e},d1=qt,h1=Mn,p1=lh,ch=ah,m1=u1,fh=h1(ch());d1(fh,{getPolyfill:ch,implementation:p1,shim:m1});var g1=fh,Br={exports:{}},y1=io,Gt=function(){return y1()&&!!Symbol.toStringTag},b1=Gt(),S1=we,Cs=S1("Object.prototype.toString"),oo=function(e){return b1&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:Cs(e)==="[object Arguments]"},uh=function(e){return oo(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Cs(e)!=="[object Array]"&&Cs(e.callee)==="[object Function]"},v1=function(){return oo(arguments)}();oo.isLegacyArguments=uh;var dh=v1?oo:uh;const w1={},x1=Object.freeze(Object.defineProperty({__proto__:null,default:w1},Symbol.toStringTag,{value:"Module"})),C1=D0(x1);var $l=typeof Map=="function"&&Map.prototype,Po=Object.getOwnPropertyDescriptor&&$l?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ai=$l&&Po&&typeof Po.get=="function"?Po.get:null,Oc=$l&&Map.prototype.forEach,Bl=typeof Set=="function"&&Set.prototype,$o=Object.getOwnPropertyDescriptor&&Bl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ci=Bl&&$o&&typeof $o.get=="function"?$o.get:null,Ac=Bl&&Set.prototype.forEach,k1=typeof WeakMap=="function"&&WeakMap.prototype,qn=k1?WeakMap.prototype.has:null,O1=typeof WeakSet=="function"&&WeakSet.prototype,Gn=O1?WeakSet.prototype.has:null,A1=typeof WeakRef=="function"&&WeakRef.prototype,Tc=A1?WeakRef.prototype.deref:null,T1=Boolean.prototype.valueOf,E1=Object.prototype.toString,M1=Function.prototype.toString,N1=String.prototype.match,zl=String.prototype.slice,vt=String.prototype.replace,R1=String.prototype.toUpperCase,Ec=String.prototype.toLowerCase,hh=RegExp.prototype.test,Mc=Array.prototype.concat,De=Array.prototype.join,I1=Array.prototype.slice,Nc=Math.floor,ks=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Bo=Object.getOwnPropertySymbols,Os=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,xn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",te=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===xn||!0)?Symbol.toStringTag:null,ph=Object.prototype.propertyIsEnumerable,Rc=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Ic(n,e){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||hh.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-Nc(-n):Nc(n);if(r!==n){var i=String(r),o=zl.call(e,i.length+1);return vt.call(i,t,"$&_")+"."+vt.call(vt.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return vt.call(e,t,"$&_")}var As=C1,Dc=As.custom,Pc=gh(Dc)?Dc:null,D1=function n(e,t,r,i){var o=t||{};if(ft(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ft(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=ft(o,"customInspect")?o.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ft(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ft(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return bh(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var a=String(e);return l?Ic(e,a):a}if(typeof e=="bigint"){var c=String(e)+"n";return l?Ic(e,c):c}var f=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=f&&f>0&&typeof e=="object")return Ts(e)?"[Array]":"[Object]";var u=X1(o,r);if(typeof i>"u")i=[];else if(yh(i,e)>=0)return"[Circular]";function d(ue,he,it){if(he&&(i=I1.call(i),i.push(he)),it){var pe={depth:o.depth};return ft(o,"quoteStyle")&&(pe.quoteStyle=o.quoteStyle),n(ue,pe,r+1,i)}return n(ue,o,r+1,i)}if(typeof e=="function"&&!$c(e)){var h=V1(e),p=Sr(e,d);return"[Function"+(h?": "+h:" (anonymous)")+"]"+(p.length>0?" { "+De.call(p,", ")+" }":"")}if(gh(e)){var m=xn?vt.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Os.call(e);return typeof e=="object"&&!xn?Bn(m):m}if(q1(e)){for(var g="<"+Ec.call(String(e.nodeName)),y=e.attributes||[],x=0;x<y.length;x++)g+=" "+y[x].name+"="+mh(P1(y[x].value),"double",o);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="</"+Ec.call(String(e.nodeName))+">",g}if(Ts(e)){if(e.length===0)return"[]";var k=Sr(e,d);return u&&!Y1(k)?"["+Es(k,u)+"]":"[ "+De.call(k,", ")+" ]"}if(B1(e)){var M=Sr(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!ph.call(e,"cause")?"{ ["+String(e)+"] "+De.call(Mc.call("[cause]: "+d(e.cause),M),", ")+" }":M.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+De.call(M,", ")+" }"}if(typeof e=="object"&&s){if(Pc&&typeof e[Pc]=="function"&&As)return As(e,{depth:f-r});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(W1(e)){var T=[];return Oc&&Oc.call(e,function(ue,he){T.push(d(he,e,!0)+" => "+d(ue,e))}),Bc("Map",ai.call(e),T,u)}if(J1(e)){var w=[];return Ac&&Ac.call(e,function(ue){w.push(d(ue,e))}),Bc("Set",ci.call(e),w,u)}if(H1(e))return zo("WeakMap");if(K1(e))return zo("WeakSet");if(U1(e))return zo("WeakRef");if(L1(e))return Bn(d(Number(e)));if(j1(e))return Bn(d(ks.call(e)));if(F1(e))return Bn(T1.call(e));if(z1(e))return Bn(d(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof oi<"u"&&e===oi)return"{ [object globalThis] }";if(!$1(e)&&!$c(e)){var I=Sr(e,d),P=Rc?Rc(e)===Object.prototype:e instanceof Object||e.constructor===Object,O=e instanceof Object?"":"null prototype",G=!P&&te&&Object(e)===e&&te in e?zl.call(Et(e),8,-1):O?"Object":"",ae=P||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",$=ae+(G||O?"["+De.call(Mc.call([],G||[],O||[]),": ")+"] ":"");return I.length===0?$+"{}":u?$+"{"+Es(I,u)+"}":$+"{ "+De.call(I,", ")+" }"}return String(e)};function mh(n,e,t){var r=(t.quoteStyle||e)==="double"?'"':"'";return r+n+r}function P1(n){return vt.call(String(n),/"/g,"&quot;")}function Ts(n){return Et(n)==="[object Array]"&&(!te||!(typeof n=="object"&&te in n))}function $1(n){return Et(n)==="[object Date]"&&(!te||!(typeof n=="object"&&te in n))}function $c(n){return Et(n)==="[object RegExp]"&&(!te||!(typeof n=="object"&&te in n))}function B1(n){return Et(n)==="[object Error]"&&(!te||!(typeof n=="object"&&te in n))}function z1(n){return Et(n)==="[object String]"&&(!te||!(typeof n=="object"&&te in n))}function L1(n){return Et(n)==="[object Number]"&&(!te||!(typeof n=="object"&&te in n))}function F1(n){return Et(n)==="[object Boolean]"&&(!te||!(typeof n=="object"&&te in n))}function gh(n){if(xn)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!Os)return!1;try{return Os.call(n),!0}catch{}return!1}function j1(n){if(!n||typeof n!="object"||!ks)return!1;try{return ks.call(n),!0}catch{}return!1}var _1=Object.prototype.hasOwnProperty||function(n){return n in this};function ft(n,e){return _1.call(n,e)}function Et(n){return E1.call(n)}function V1(n){if(n.name)return n.name;var e=N1.call(M1.call(n),/^function\s*([\w$]+)/);return e?e[1]:null}function yh(n,e){if(n.indexOf)return n.indexOf(e);for(var t=0,r=n.length;t<r;t++)if(n[t]===e)return t;return-1}function W1(n){if(!ai||!n||typeof n!="object")return!1;try{ai.call(n);try{ci.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function H1(n){if(!qn||!n||typeof n!="object")return!1;try{qn.call(n,qn);try{Gn.call(n,Gn)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function U1(n){if(!Tc||!n||typeof n!="object")return!1;try{return Tc.call(n),!0}catch{}return!1}function J1(n){if(!ci||!n||typeof n!="object")return!1;try{ci.call(n);try{ai.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function K1(n){if(!Gn||!n||typeof n!="object")return!1;try{Gn.call(n,Gn);try{qn.call(n,qn)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function q1(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function bh(n,e){if(n.length>e.maxStringLength){var t=n.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return bh(zl.call(n,0,e.maxStringLength),e)+r}var i=vt.call(vt.call(n,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,G1);return mh(i,"single",e)}function G1(n){var e=n.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+R1.call(e.toString(16))}function Bn(n){return"Object("+n+")"}function zo(n){return n+" { ? }"}function Bc(n,e,t,r){var i=r?Es(t,r):De.call(t,", ");return n+" ("+e+") {"+i+"}"}function Y1(n){for(var e=0;e<n.length;e++)if(yh(n[e],`
11
+ `)>=0)return!1;return!0}function X1(n,e){var t;if(n.indent===" ")t=" ";else if(typeof n.indent=="number"&&n.indent>0)t=De.call(Array(n.indent+1)," ");else return null;return{base:t,prev:De.call(Array(e+1),t)}}function Es(n,e){if(n.length===0)return"";var t=`
12
+ `+e.prev+e.base;return t+De.call(n,","+t)+`
13
+ `+e.prev}function Sr(n,e){var t=Ts(n),r=[];if(t){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=ft(n,i)?e(n[i],n):""}var o=typeof Bo=="function"?Bo(n):[],s;if(xn){s={};for(var l=0;l<o.length;l++)s["$"+o[l]]=o[l]}for(var a in n)ft(n,a)&&(t&&String(Number(a))===a&&a<n.length||xn&&s["$"+a]instanceof Symbol||(hh.call(/[^\w$]/,a)?r.push(e(a,n)+": "+e(n[a],n)):r.push(a+": "+e(n[a],n))));if(typeof Bo=="function")for(var c=0;c<o.length;c++)ph.call(n,o[c])&&r.push("["+e(o[c])+"]: "+e(n[o[c]],n));return r}var Sh=je,Nn=we,Q1=D1,Z1=Tt,vr=Sh("%WeakMap%",!0),wr=Sh("%Map%",!0),eS=Nn("WeakMap.prototype.get",!0),tS=Nn("WeakMap.prototype.set",!0),nS=Nn("WeakMap.prototype.has",!0),rS=Nn("Map.prototype.get",!0),iS=Nn("Map.prototype.set",!0),oS=Nn("Map.prototype.has",!0),Ll=function(n,e){for(var t=n,r;(r=t.next)!==null;t=r)if(r.key===e)return t.next=r.next,r.next=n.next,n.next=r,r},sS=function(n,e){var t=Ll(n,e);return t&&t.value},lS=function(n,e,t){var r=Ll(n,e);r?r.value=t:n.next={key:e,next:n.next,value:t}},aS=function(n,e){return!!Ll(n,e)},vh=function(){var e,t,r,i={assert:function(o){if(!i.has(o))throw new Z1("Side channel does not contain "+Q1(o))},get:function(o){if(vr&&o&&(typeof o=="object"||typeof o=="function")){if(e)return eS(e,o)}else if(wr){if(t)return rS(t,o)}else if(r)return sS(r,o)},has:function(o){if(vr&&o&&(typeof o=="object"||typeof o=="function")){if(e)return nS(e,o)}else if(wr){if(t)return oS(t,o)}else if(r)return aS(r,o);return!1},set:function(o,s){vr&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new vr),tS(e,o,s)):wr?(t||(t=new wr),iS(t,o,s)):(r||(r={key:{},next:null}),lS(r,o,s))}};return i},cS=Kd,zn=vh(),Ge=Tt,Fl={assert:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Ge("`O` is not an object");if(typeof e!="string")throw new Ge("`slot` must be a string");if(zn.assert(n),!Fl.has(n,e))throw new Ge("`"+e+"` is not present on `O`")},get:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Ge("`O` is not an object");if(typeof e!="string")throw new Ge("`slot` must be a string");var t=zn.get(n);return t&&t["$"+e]},has:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Ge("`O` is not an object");if(typeof e!="string")throw new Ge("`slot` must be a string");var t=zn.get(n);return!!t&&cS(t,"$"+e)},set:function(n,e,t){if(!n||typeof n!="object"&&typeof n!="function")throw new Ge("`O` is not an object");if(typeof e!="string")throw new Ge("`slot` must be a string");var r=zn.get(n);r||(r={},zn.set(n,r)),r["$"+e]=t}};Object.freeze&&Object.freeze(Fl);var fS=Fl,Ln=fS,uS=SyntaxError,zc=typeof StopIteration=="object"?StopIteration:null,dS=function(e){if(!zc)throw new uS("this environment lacks StopIteration");Ln.set(e,"[[Done]]",!1);var t={next:function(){var i=Ln.get(this,"[[Iterator]]"),o=Ln.get(i,"[[Done]]");try{return{done:o,value:o?void 0:i.next()}}catch(s){if(Ln.set(i,"[[Done]]",!0),s!==zc)throw s;return{done:!0,value:void 0}}}};return Ln.set(t,"[[Iterator]]",e),t},hS={}.toString,wh=Array.isArray||function(n){return hS.call(n)=="[object Array]"},pS=String.prototype.valueOf,mS=function(e){try{return pS.call(e),!0}catch{return!1}},gS=Object.prototype.toString,yS="[object String]",bS=Gt(),xh=function(e){return typeof e=="string"?!0:typeof e!="object"?!1:bS?mS(e):gS.call(e)===yS},jl=typeof Map=="function"&&Map.prototype?Map:null,SS=typeof Set=="function"&&Set.prototype?Set:null,fi;jl||(fi=function(e){return!1});var Ch=jl?Map.prototype.has:null,Lc=SS?Set.prototype.has:null;!fi&&!Ch&&(fi=function(e){return!1});var kh=fi||function(e){if(!e||typeof e!="object")return!1;try{if(Ch.call(e),Lc)try{Lc.call(e)}catch{return!0}return e instanceof jl}catch{}return!1},vS=typeof Map=="function"&&Map.prototype?Map:null,_l=typeof Set=="function"&&Set.prototype?Set:null,ui;_l||(ui=function(e){return!1});var Fc=vS?Map.prototype.has:null,Oh=_l?Set.prototype.has:null;!ui&&!Oh&&(ui=function(e){return!1});var Ah=ui||function(e){if(!e||typeof e!="object")return!1;try{if(Oh.call(e),Fc)try{Fc.call(e)}catch{return!0}return e instanceof _l}catch{}return!1},jc=dh,_c=dS;if(Ml()||io()){var Lo=Symbol.iterator;Br.exports=function(e){if(e!=null&&typeof e[Lo]<"u")return e[Lo]();if(jc(e))return Array.prototype[Lo].call(e)}}else{var wS=wh,xS=xh,Vc=je,CS=Vc("%Map%",!0),kS=Vc("%Set%",!0),xe=we,Wc=xe("Array.prototype.push"),Hc=xe("String.prototype.charCodeAt"),OS=xe("String.prototype.slice"),AS=function(e,t){var r=e.length;if(t+1>=r)return t+1;var i=Hc(e,t);if(i<55296||i>56319)return t+1;var o=Hc(e,t+1);return o<56320||o>57343?t+1:t+2},Fo=function(e){var t=0;return{next:function(){var i=t>=e.length,o;return i||(o=e[t],t+=1),{done:i,value:o}}}},Uc=function(e,t){if(wS(e)||jc(e))return Fo(e);if(xS(e)){var r=0;return{next:function(){var o=AS(e,r),s=OS(e,r,o);return r=o,{done:o>e.length,value:s}}}}if(t&&typeof e["_es6-shim iterator_"]<"u")return e["_es6-shim iterator_"]()};if(!CS&&!kS)Br.exports=function(e){if(e!=null)return Uc(e,!0)};else{var TS=kh,ES=Ah,Jc=xe("Map.prototype.forEach",!0),Kc=xe("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var qc=xe("Map.prototype.iterator",!0),Gc=xe("Set.prototype.iterator",!0);var Yc=xe("Map.prototype.@@iterator",!0)||xe("Map.prototype._es6-shim iterator_",!0),Xc=xe("Set.prototype.@@iterator",!0)||xe("Set.prototype._es6-shim iterator_",!0),MS=function(e){if(TS(e)){if(qc)return _c(qc(e));if(Yc)return Yc(e);if(Jc){var t=[];return Jc(e,function(i,o){Wc(t,[o,i])}),Fo(t)}}if(ES(e)){if(Gc)return _c(Gc(e));if(Xc)return Xc(e);if(Kc){var r=[];return Kc(e,function(i){Wc(r,i)}),Fo(r)}}};Br.exports=function(e){return MS(e)||Uc(e)}}}var NS=Br.exports,Qc=function(n){return n!==n},Th=function(e,t){return e===0&&t===0?1/e===1/t:!!(e===t||Qc(e)&&Qc(t))},RS=Th,Eh=function(){return typeof Object.is=="function"?Object.is:RS},IS=Eh,DS=qt,PS=function(){var e=IS();return DS(Object,{is:e},{is:function(){return Object.is!==e}}),e},$S=qt,BS=Mn,zS=Th,Mh=Eh,LS=PS,Nh=BS(Mh(),Object);$S(Nh,{getPolyfill:Mh,implementation:zS,shim:LS});var FS=Nh,jS=Mn,Rh=we,_S=je,Ms=_S("%ArrayBuffer%",!0),zr=Rh("ArrayBuffer.prototype.byteLength",!0),VS=Rh("Object.prototype.toString"),Zc=!!Ms&&!zr&&new Ms(0).slice,ef=!!Zc&&jS(Zc),Ih=zr||ef?function(e){if(!e||typeof e!="object")return!1;try{return zr?zr(e):ef(e,0),!0}catch{return!1}}:Ms?function(e){return VS(e)==="[object ArrayBuffer]"}:function(e){return!1},WS=Date.prototype.getDay,HS=function(e){try{return WS.call(e),!0}catch{return!1}},US=Object.prototype.toString,JS="[object Date]",KS=Gt(),qS=function(e){return typeof e!="object"||e===null?!1:KS?HS(e):US.call(e)===JS},Ns=we,Dh=Gt(),Ph,$h,Rs,Is;if(Dh){Ph=Ns("Object.prototype.hasOwnProperty"),$h=Ns("RegExp.prototype.exec"),Rs={};var jo=function(){throw Rs};Is={toString:jo,valueOf:jo},typeof Symbol.toPrimitive=="symbol"&&(Is[Symbol.toPrimitive]=jo)}var GS=Ns("Object.prototype.toString"),YS=Object.getOwnPropertyDescriptor,XS="[object RegExp]",QS=Dh?function(e){if(!e||typeof e!="object")return!1;var t=YS(e,"lastIndex"),r=t&&Ph(t,"value");if(!r)return!1;try{$h(e,Is)}catch(i){return i===Rs}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:GS(e)===XS},ZS=we,tf=ZS("SharedArrayBuffer.prototype.byteLength",!0),ev=tf?function(e){if(!e||typeof e!="object")return!1;try{return tf(e),!0}catch{return!1}}:function(e){return!1},tv=Number.prototype.toString,nv=function(e){try{return tv.call(e),!0}catch{return!1}},rv=Object.prototype.toString,iv="[object Number]",ov=Gt(),sv=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:ov?nv(e):rv.call(e)===iv},Bh=we,lv=Bh("Boolean.prototype.toString"),av=Bh("Object.prototype.toString"),cv=function(e){try{return lv(e),!0}catch{return!1}},fv="[object Boolean]",uv=Gt(),dv=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:uv&&Symbol.toStringTag in e?cv(e):av(e)===fv},Ds={exports:{}},hv=Object.prototype.toString,pv=Ml();if(pv){var mv=Symbol.prototype.toString,gv=/^Symbol\(.*\)$/,yv=function(e){return typeof e.valueOf()!="symbol"?!1:gv.test(mv.call(e))};Ds.exports=function(e){if(typeof e=="symbol")return!0;if(hv.call(e)!=="[object Symbol]")return!1;try{return yv(e)}catch{return!1}}}else Ds.exports=function(e){return!1};var bv=Ds.exports,Ps={exports:{}},nf=typeof BigInt<"u"&&BigInt,Sv=function(){return typeof nf=="function"&&typeof BigInt=="function"&&typeof nf(42)=="bigint"&&typeof BigInt(42)=="bigint"},vv=Sv();if(vv){var wv=BigInt.prototype.valueOf,xv=function(e){try{return wv.call(e),!0}catch{}return!1};Ps.exports=function(e){return e===null||typeof e>"u"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:xv(e)}}else Ps.exports=function(e){return!1};var Cv=Ps.exports,kv=xh,Ov=sv,Av=dv,Tv=bv,Ev=Cv,Mv=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(kv(e))return"String";if(Ov(e))return"Number";if(Av(e))return"Boolean";if(Tv(e))return"Symbol";if(Ev(e))return"BigInt"},di=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,rf=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,hi;di||(hi=function(e){return!1});var $s=di?di.prototype.has:null,_o=rf?rf.prototype.has:null;!hi&&!$s&&(hi=function(e){return!1});var Nv=hi||function(e){if(!e||typeof e!="object")return!1;try{if($s.call(e,$s),_o)try{_o.call(e,_o)}catch{return!0}return e instanceof di}catch{}return!1},Bs={exports:{}},Rv=je,zh=we,Iv=Rv("%WeakSet%",!0),Vo=zh("WeakSet.prototype.has",!0);if(Vo){var Wo=zh("WeakMap.prototype.has",!0);Bs.exports=function(e){if(!e||typeof e!="object")return!1;try{if(Vo(e,Vo),Wo)try{Wo(e,Wo)}catch{return!0}return e instanceof Iv}catch{}return!1}}else Bs.exports=function(e){return!1};var Dv=Bs.exports,Pv=kh,$v=Ah,Bv=Nv,zv=Dv,Lv=function(e){if(e&&typeof e=="object"){if(Pv(e))return"Map";if($v(e))return"Set";if(Bv(e))return"WeakMap";if(zv(e))return"WeakSet"}return!1},Lh=Function.prototype.toString,cn=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,zs,Lr;if(typeof cn=="function"&&typeof Object.defineProperty=="function")try{zs=Object.defineProperty({},"length",{get:function(){throw Lr}}),Lr={},cn(function(){throw 42},null,zs)}catch(n){n!==Lr&&(cn=null)}else cn=null;var Fv=/^\s*class\b/,Ls=function(e){try{var t=Lh.call(e);return Fv.test(t)}catch{return!1}},Ho=function(e){try{return Ls(e)?!1:(Lh.call(e),!0)}catch{return!1}},Fr=Object.prototype.toString,jv="[object Object]",_v="[object Function]",Vv="[object GeneratorFunction]",Wv="[object HTMLAllCollection]",Hv="[object HTML document.all class]",Uv="[object HTMLCollection]",Jv=typeof Symbol=="function"&&!!Symbol.toStringTag,Kv=!(0 in[,]),Fs=function(){return!1};if(typeof document=="object"){var qv=document.all;Fr.call(qv)===Fr.call(document.all)&&(Fs=function(e){if((Kv||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=Fr.call(e);return(t===Wv||t===Hv||t===Uv||t===jv)&&e("")==null}catch{}return!1})}var Gv=cn?function(e){if(Fs(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{cn(e,null,zs)}catch(t){if(t!==Lr)return!1}return!Ls(e)&&Ho(e)}:function(e){if(Fs(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(Jv)return Ho(e);if(Ls(e))return!1;var t=Fr.call(e);return t!==_v&&t!==Vv&&!/^\[object HTML/.test(t)?!1:Ho(e)},Yv=Gv,Xv=Object.prototype.toString,Fh=Object.prototype.hasOwnProperty,Qv=function(e,t,r){for(var i=0,o=e.length;i<o;i++)Fh.call(e,i)&&(r==null?t(e[i],i,e):t.call(r,e[i],i,e))},Zv=function(e,t,r){for(var i=0,o=e.length;i<o;i++)r==null?t(e.charAt(i),i,e):t.call(r,e.charAt(i),i,e)},ew=function(e,t,r){for(var i in e)Fh.call(e,i)&&(r==null?t(e[i],i,e):t.call(r,e[i],i,e))},tw=function(e,t,r){if(!Yv(t))throw new TypeError("iterator must be a function");var i;arguments.length>=3&&(i=r),Xv.call(e)==="[object Array]"?Qv(e,t,i):typeof e=="string"?Zv(e,t,i):ew(e,t,i)},nw=tw,rw=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Uo=rw,iw=typeof globalThis>"u"?oi:globalThis,ow=function(){for(var e=[],t=0;t<Uo.length;t++)typeof iw[Uo[t]]=="function"&&(e[e.length]=Uo[t]);return e},pi=nw,sw=ow,of=Mn,Vl=we,jr=Il,lw=Vl("Object.prototype.toString"),jh=Gt(),sf=typeof globalThis>"u"?oi:globalThis,js=sw(),Wl=Vl("String.prototype.slice"),Jo=Object.getPrototypeOf,aw=Vl("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},mi={__proto__:null};jh&&jr&&Jo?pi(js,function(n){var e=new sf[n];if(Symbol.toStringTag in e){var t=Jo(e),r=jr(t,Symbol.toStringTag);if(!r){var i=Jo(t);r=jr(i,Symbol.toStringTag)}mi["$"+n]=of(r.get)}}):pi(js,function(n){var e=new sf[n],t=e.slice||e.set;t&&(mi["$"+n]=of(t))});var cw=function(e){var t=!1;return pi(mi,function(r,i){if(!t)try{"$"+r(e)===i&&(t=Wl(i,1))}catch{}}),t},fw=function(e){var t=!1;return pi(mi,function(r,i){if(!t)try{r(e),t=Wl(i,1)}catch{}}),t},uw=function(e){if(!e||typeof e!="object")return!1;if(!jh){var t=Wl(lw(e),8,-1);return aw(js,t)>-1?t:t!=="Object"?!1:fw(e)}return jr?cw(e):null},dw=we,lf=dw("ArrayBuffer.prototype.byteLength",!0),hw=Ih,pw=function(e){return hw(e)?lf?lf(e):e.byteLength:NaN},_h=Jb,_e=we,af=g1,mw=je,Cn=NS,gw=vh,cf=FS,ff=dh,uf=wh,df=Ih,hf=qS,pf=QS,mf=ev,gf=El,yf=Mv,bf=Lv,Sf=uw,vf=pw,wf=_e("SharedArrayBuffer.prototype.byteLength",!0),xf=_e("Date.prototype.getTime"),Ko=Object.getPrototypeOf,Cf=_e("Object.prototype.toString"),gi=mw("%Set%",!0),_s=_e("Map.prototype.has",!0),yi=_e("Map.prototype.get",!0),kf=_e("Map.prototype.size",!0),bi=_e("Set.prototype.add",!0),Vh=_e("Set.prototype.delete",!0),Si=_e("Set.prototype.has",!0),_r=_e("Set.prototype.size",!0);function Of(n,e,t,r){for(var i=Cn(n),o;(o=i.next())&&!o.done;)if(Ae(e,o.value,t,r))return Vh(n,o.value),!0;return!1}function Wh(n){if(typeof n>"u")return null;if(typeof n!="object")return typeof n=="symbol"?!1:typeof n=="string"||typeof n=="number"?+n==+n:!0}function yw(n,e,t,r,i,o){var s=Wh(t);if(s!=null)return s;var l=yi(e,s),a=_h({},i,{strict:!1});return typeof l>"u"&&!_s(e,s)||!Ae(r,l,a,o)?!1:!_s(n,s)&&Ae(r,l,a,o)}function bw(n,e,t){var r=Wh(t);return r??(Si(e,r)&&!Si(n,r))}function Af(n,e,t,r,i,o){for(var s=Cn(n),l,a;(l=s.next())&&!l.done;)if(a=l.value,Ae(t,a,i,o)&&Ae(r,yi(e,a),i,o))return Vh(n,a),!0;return!1}function Ae(n,e,t,r){var i=t||{};if(i.strict?cf(n,e):n===e)return!0;var o=yf(n),s=yf(e);if(o!==s)return!1;if(!n||!e||typeof n!="object"&&typeof e!="object")return i.strict?cf(n,e):n==e;var l=r.has(n),a=r.has(e),c;if(l&&a){if(r.get(n)===r.get(e))return!0}else c={};return l||r.set(n,c),a||r.set(e,c),ww(n,e,i,r)}function Tf(n){return!n||typeof n!="object"||typeof n.length!="number"||typeof n.copy!="function"||typeof n.slice!="function"||n.length>0&&typeof n[0]!="number"?!1:!!(n.constructor&&n.constructor.isBuffer&&n.constructor.isBuffer(n))}function Sw(n,e,t,r){if(_r(n)!==_r(e))return!1;for(var i=Cn(n),o=Cn(e),s,l,a;(s=i.next())&&!s.done;)if(s.value&&typeof s.value=="object")a||(a=new gi),bi(a,s.value);else if(!Si(e,s.value)){if(t.strict||!bw(n,e,s.value))return!1;a||(a=new gi),bi(a,s.value)}if(a){for(;(l=o.next())&&!l.done;)if(l.value&&typeof l.value=="object"){if(!Of(a,l.value,t.strict,r))return!1}else if(!t.strict&&!Si(n,l.value)&&!Of(a,l.value,t.strict,r))return!1;return _r(a)===0}return!0}function vw(n,e,t,r){if(kf(n)!==kf(e))return!1;for(var i=Cn(n),o=Cn(e),s,l,a,c,f,u;(s=i.next())&&!s.done;)if(c=s.value[0],f=s.value[1],c&&typeof c=="object")a||(a=new gi),bi(a,c);else if(u=yi(e,c),typeof u>"u"&&!_s(e,c)||!Ae(f,u,t,r)){if(t.strict||!yw(n,e,c,f,t,r))return!1;a||(a=new gi),bi(a,c)}if(a){for(;(l=o.next())&&!l.done;)if(c=l.value[0],u=l.value[1],c&&typeof c=="object"){if(!Af(a,n,c,u,t,r))return!1}else if(!t.strict&&(!n.has(c)||!Ae(yi(n,c),u,t,r))&&!Af(a,n,c,u,_h({},t,{strict:!1}),r))return!1;return _r(a)===0}return!0}function ww(n,e,t,r){var i,o;if(typeof n!=typeof e||n==null||e==null||Cf(n)!==Cf(e)||ff(n)!==ff(e))return!1;var s=uf(n),l=uf(e);if(s!==l)return!1;var a=n instanceof Error,c=e instanceof Error;if(a!==c||(a||c)&&(n.name!==e.name||n.message!==e.message))return!1;var f=pf(n),u=pf(e);if(f!==u||(f||u)&&(n.source!==e.source||af(n)!==af(e)))return!1;var d=hf(n),h=hf(e);if(d!==h||(d||h)&&xf(n)!==xf(e)||t.strict&&Ko&&Ko(n)!==Ko(e))return!1;var p=Sf(n),m=Sf(e);if(p!==m)return!1;if(p||m){if(n.length!==e.length)return!1;for(i=0;i<n.length;i++)if(n[i]!==e[i])return!1;return!0}var g=Tf(n),y=Tf(e);if(g!==y)return!1;if(g||y){if(n.length!==e.length)return!1;for(i=0;i<n.length;i++)if(n[i]!==e[i])return!1;return!0}var x=df(n),k=df(e);if(x!==k)return!1;if(x||k)return vf(n)!==vf(e)?!1:typeof Uint8Array=="function"&&Ae(new Uint8Array(n),new Uint8Array(e),t,r);var M=mf(n),T=mf(e);if(M!==T)return!1;if(M||T)return wf(n)!==wf(e)?!1:typeof Uint8Array=="function"&&Ae(new Uint8Array(n),new Uint8Array(e),t,r);if(typeof n!=typeof e)return!1;var w=gf(n),I=gf(e);if(w.length!==I.length)return!1;for(w.sort(),I.sort(),i=w.length-1;i>=0;i--)if(w[i]!=I[i])return!1;for(i=w.length-1;i>=0;i--)if(o=w[i],!Ae(n[o],e[o],t,r))return!1;var P=bf(n),O=bf(e);return P!==O?!1:P==="Set"||O==="Set"?Sw(n,e,t,r):P==="Map"?vw(n,e,t,r):!0}var xw=function(e,t,r){return Ae(e,t,r,gw())};const Cw=I0(xw);function Hh(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n))for(e=0;e<n.length;e++)n[e]&&(t=Hh(n[e]))&&(r&&(r+=" "),r+=t);else for(e in n)n[e]&&(r&&(r+=" "),r+=e);return r}function kw(){for(var n,e,t=0,r="";t<arguments.length;)(n=arguments[t++])&&(e=Hh(n))&&(r&&(r+=" "),r+=e);return r}const Ef=n=>typeof n=="boolean"?"".concat(n):n===0?"0":n,Mf=kw,Ow=(n,e)=>t=>{var r;if((e==null?void 0:e.variants)==null)return Mf(n,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:i,defaultVariants:o}=e,s=Object.keys(i).map(c=>{const f=t==null?void 0:t[c],u=o==null?void 0:o[c];if(f===null)return null;const d=Ef(f)||Ef(u);return i[c][d]}),l=t&&Object.entries(t).reduce((c,f)=>{let[u,d]=f;return d===void 0||(c[u]=d),c},{}),a=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,f)=>{let{class:u,className:d,...h}=f;return Object.entries(h).every(p=>{let[m,g]=p;return Array.isArray(g)?g.includes({...o,...l}[m]):{...o,...l}[m]===g})?[...c,u,d]:c},[]);return Mf(n,s,a,t==null?void 0:t.class,t==null?void 0:t.className)};var Uh=typeof global=="object"&&global&&global.Object===Object&&global,Aw=typeof self=="object"&&self&&self.Object===Object&&self,Ve=Uh||Aw||Function("return this")(),Le=Ve.Symbol,Jh=Object.prototype,Tw=Jh.hasOwnProperty,Ew=Jh.toString,Fn=Le?Le.toStringTag:void 0;function Mw(n){var e=Tw.call(n,Fn),t=n[Fn];try{n[Fn]=void 0;var r=!0}catch{}var i=Ew.call(n);return r&&(e?n[Fn]=t:delete n[Fn]),i}var Nw=Object.prototype,Rw=Nw.toString;function Iw(n){return Rw.call(n)}var Dw="[object Null]",Pw="[object Undefined]",Nf=Le?Le.toStringTag:void 0;function Mt(n){return n==null?n===void 0?Pw:Dw:Nf&&Nf in Object(n)?Mw(n):Iw(n)}function tt(n){return n!=null&&typeof n=="object"}var $w="[object Symbol]";function so(n){return typeof n=="symbol"||tt(n)&&Mt(n)==$w}function Kh(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t<r;)i[t]=e(n[t],t,n);return i}var Fe=Array.isArray,Bw=1/0,Rf=Le?Le.prototype:void 0,If=Rf?Rf.toString:void 0;function vi(n){if(typeof n=="string")return n;if(Fe(n))return Kh(n,vi)+"";if(so(n))return If?If.call(n):"";var e=n+"";return e=="0"&&1/n==-Bw?"-0":e}var zw=/\s/;function Lw(n){for(var e=n.length;e--&&zw.test(n.charAt(e)););return e}var Fw=/^\s+/;function jw(n){return n&&n.slice(0,Lw(n)+1).replace(Fw,"")}function Ot(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Df=NaN,_w=/^[-+]0x[0-9a-f]+$/i,Vw=/^0b[01]+$/i,Ww=/^0o[0-7]+$/i,Hw=parseInt;function mn(n){if(typeof n=="number")return n;if(so(n))return Df;if(Ot(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Ot(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=jw(n);var t=Vw.test(n);return t||Ww.test(n)?Hw(n.slice(2),t?2:8):_w.test(n)?Df:+n}var Pf=1/0,Uw=17976931348623157e292;function Jw(n){if(!n)return n===0?n:0;if(n=mn(n),n===Pf||n===-Pf){var e=n<0?-1:1;return e*Uw}return n===n?n:0}function Kw(n){var e=Jw(n),t=e%1;return e===e?t?e-t:e:0}function Hl(n){return n}var qw="[object AsyncFunction]",Gw="[object Function]",Yw="[object GeneratorFunction]",Xw="[object Proxy]";function qh(n){if(!Ot(n))return!1;var e=Mt(n);return e==Gw||e==Yw||e==qw||e==Xw}var qo=Ve["__core-js_shared__"],$f=function(){var n=/[^.]+$/.exec(qo&&qo.keys&&qo.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function Qw(n){return!!$f&&$f in n}var Zw=Function.prototype,ex=Zw.toString;function Yt(n){if(n!=null){try{return ex.call(n)}catch{}try{return n+""}catch{}}return""}var tx=/[\\^$.*+?()[\]{}|]/g,nx=/^\[object .+?Constructor\]$/,rx=Function.prototype,ix=Object.prototype,ox=rx.toString,sx=ix.hasOwnProperty,lx=RegExp("^"+ox.call(sx).replace(tx,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ax(n){if(!Ot(n)||Qw(n))return!1;var e=qh(n)?lx:nx;return e.test(Yt(n))}function cx(n,e){return n==null?void 0:n[e]}function Xt(n,e){var t=cx(n,e);return ax(t)?t:void 0}var Vs=Xt(Ve,"WeakMap");function fx(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}var ux=800,dx=16,hx=Date.now;function px(n){var e=0,t=0;return function(){var r=hx(),i=dx-(r-t);if(t=r,i>0){if(++e>=ux)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function mx(n){return function(){return n}}var Bf=function(){try{var n=Xt(Object,"defineProperty");return n({},"",{}),n}catch{}}(),gx=Bf?function(n,e){return Bf(n,"toString",{configurable:!0,enumerable:!1,value:mx(e),writable:!0})}:Hl,yx=px(gx);function bx(n,e,t,r){for(var i=n.length,o=t+-1;++o<i;)if(e(n[o],o,n))return o;return-1}function Sx(n){return n!==n}function vx(n,e,t){for(var r=t-1,i=n.length;++r<i;)if(n[r]===e)return r;return-1}function wx(n,e,t){return e===e?vx(n,e,t):bx(n,Sx,t)}function xx(n,e){var t=n==null?0:n.length;return!!t&&wx(n,e,0)>-1}var Cx=9007199254740991,kx=/^(?:0|[1-9]\d*)$/;function Gh(n,e){var t=typeof n;return e=e??Cx,!!e&&(t=="number"||t!="symbol"&&kx.test(n))&&n>-1&&n%1==0&&n<e}function Yh(n,e){return n===e||n!==n&&e!==e}var zf=Math.max;function Ox(n,e,t){return e=zf(e===void 0?n.length-1:e,0),function(){for(var r=arguments,i=-1,o=zf(r.length-e,0),s=Array(o);++i<o;)s[i]=r[e+i];i=-1;for(var l=Array(e+1);++i<e;)l[i]=r[i];return l[e]=t(s),fx(n,this,l)}}function Ax(n,e){return yx(Ox(n,e,Hl),n+"")}var Tx=9007199254740991;function Ul(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=Tx}function Xh(n){return n!=null&&Ul(n.length)&&!qh(n)}var Ex=Object.prototype;function Mx(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||Ex;return n===t}function Nx(n,e){for(var t=-1,r=Array(n);++t<n;)r[t]=e(t);return r}var Rx="[object Arguments]";function Lf(n){return tt(n)&&Mt(n)==Rx}var Qh=Object.prototype,Ix=Qh.hasOwnProperty,Dx=Qh.propertyIsEnumerable,Jl=Lf(function(){return arguments}())?Lf:function(n){return tt(n)&&Ix.call(n,"callee")&&!Dx.call(n,"callee")};function Px(){return!1}var Zh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ff=Zh&&typeof module=="object"&&module&&!module.nodeType&&module,$x=Ff&&Ff.exports===Zh,jf=$x?Ve.Buffer:void 0,Bx=jf?jf.isBuffer:void 0,Ws=Bx||Px,zx="[object Arguments]",Lx="[object Array]",Fx="[object Boolean]",jx="[object Date]",_x="[object Error]",Vx="[object Function]",Wx="[object Map]",Hx="[object Number]",Ux="[object Object]",Jx="[object RegExp]",Kx="[object Set]",qx="[object String]",Gx="[object WeakMap]",Yx="[object ArrayBuffer]",Xx="[object DataView]",Qx="[object Float32Array]",Zx="[object Float64Array]",eC="[object Int8Array]",tC="[object Int16Array]",nC="[object Int32Array]",rC="[object Uint8Array]",iC="[object Uint8ClampedArray]",oC="[object Uint16Array]",sC="[object Uint32Array]",L={};L[Qx]=L[Zx]=L[eC]=L[tC]=L[nC]=L[rC]=L[iC]=L[oC]=L[sC]=!0;L[zx]=L[Lx]=L[Yx]=L[Fx]=L[Xx]=L[jx]=L[_x]=L[Vx]=L[Wx]=L[Hx]=L[Ux]=L[Jx]=L[Kx]=L[qx]=L[Gx]=!1;function lC(n){return tt(n)&&Ul(n.length)&&!!L[Mt(n)]}function Kl(n){return function(e){return n(e)}}var ep=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Yn=ep&&typeof module=="object"&&module&&!module.nodeType&&module,aC=Yn&&Yn.exports===ep,Go=aC&&Uh.process,wi=function(){try{var n=Yn&&Yn.require&&Yn.require("util").types;return n||Go&&Go.binding&&Go.binding("util")}catch{}}(),_f=wi&&wi.isTypedArray,tp=_f?Kl(_f):lC,cC=Object.prototype,fC=cC.hasOwnProperty;function uC(n,e){var t=Fe(n),r=!t&&Jl(n),i=!t&&!r&&Ws(n),o=!t&&!r&&!i&&tp(n),s=t||r||i||o,l=s?Nx(n.length,String):[],a=l.length;for(var c in n)fC.call(n,c)&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Gh(c,a)))&&l.push(c);return l}function dC(n,e){return function(t){return n(e(t))}}var hC=dC(Object.keys,Object),pC=Object.prototype,mC=pC.hasOwnProperty;function gC(n){if(!Mx(n))return hC(n);var e=[];for(var t in Object(n))mC.call(n,t)&&t!="constructor"&&e.push(t);return e}function np(n){return Xh(n)?uC(n):gC(n)}var yC=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bC=/^\w*$/;function ql(n,e){if(Fe(n))return!1;var t=typeof n;return t=="number"||t=="symbol"||t=="boolean"||n==null||so(n)?!0:bC.test(n)||!yC.test(n)||e!=null&&n in Object(e)}var lr=Xt(Object,"create");function SC(){this.__data__=lr?lr(null):{},this.size=0}function vC(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var wC="__lodash_hash_undefined__",xC=Object.prototype,CC=xC.hasOwnProperty;function kC(n){var e=this.__data__;if(lr){var t=e[n];return t===wC?void 0:t}return CC.call(e,n)?e[n]:void 0}var OC=Object.prototype,AC=OC.hasOwnProperty;function TC(n){var e=this.__data__;return lr?e[n]!==void 0:AC.call(e,n)}var EC="__lodash_hash_undefined__";function MC(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=lr&&e===void 0?EC:e,this}function Ht(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}Ht.prototype.clear=SC;Ht.prototype.delete=vC;Ht.prototype.get=kC;Ht.prototype.has=TC;Ht.prototype.set=MC;function NC(){this.__data__=[],this.size=0}function lo(n,e){for(var t=n.length;t--;)if(Yh(n[t][0],e))return t;return-1}var RC=Array.prototype,IC=RC.splice;function DC(n){var e=this.__data__,t=lo(e,n);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():IC.call(e,t,1),--this.size,!0}function PC(n){var e=this.__data__,t=lo(e,n);return t<0?void 0:e[t][1]}function $C(n){return lo(this.__data__,n)>-1}function BC(n,e){var t=this.__data__,r=lo(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function nt(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}nt.prototype.clear=NC;nt.prototype.delete=DC;nt.prototype.get=PC;nt.prototype.has=$C;nt.prototype.set=BC;var ar=Xt(Ve,"Map");function zC(){this.size=0,this.__data__={hash:new Ht,map:new(ar||nt),string:new Ht}}function LC(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function ao(n,e){var t=n.__data__;return LC(e)?t[typeof e=="string"?"string":"hash"]:t.map}function FC(n){var e=ao(this,n).delete(n);return this.size-=e?1:0,e}function jC(n){return ao(this,n).get(n)}function _C(n){return ao(this,n).has(n)}function VC(n,e){var t=ao(this,n),r=t.size;return t.set(n,e),this.size+=t.size==r?0:1,this}function rt(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}rt.prototype.clear=zC;rt.prototype.delete=FC;rt.prototype.get=jC;rt.prototype.has=_C;rt.prototype.set=VC;var WC="Expected a function";function Gl(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new TypeError(WC);var t=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=t.cache;if(o.has(i))return o.get(i);var s=n.apply(this,r);return t.cache=o.set(i,s)||o,s};return t.cache=new(Gl.Cache||rt),t}Gl.Cache=rt;var HC=500;function UC(n){var e=Gl(n,function(r){return t.size===HC&&t.clear(),r}),t=e.cache;return e}var JC=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,KC=/\\(\\)?/g,qC=UC(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(JC,function(t,r,i,o){e.push(i?o.replace(KC,"$1"):r||t)}),e});function Hs(n){return n==null?"":vi(n)}function rp(n,e){return Fe(n)?n:ql(n,e)?[n]:qC(Hs(n))}var GC=1/0;function co(n){if(typeof n=="string"||so(n))return n;var e=n+"";return e=="0"&&1/n==-GC?"-0":e}function ip(n,e){e=rp(e,n);for(var t=0,r=e.length;n!=null&&t<r;)n=n[co(e[t++])];return t&&t==r?n:void 0}function YC(n,e,t){var r=n==null?void 0:ip(n,e);return r===void 0?t:r}function op(n,e){for(var t=-1,r=e.length,i=n.length;++t<r;)n[i+t]=e[t];return n}var Vf=Le?Le.isConcatSpreadable:void 0;function XC(n){return Fe(n)||Jl(n)||!!(Vf&&n&&n[Vf])}function QC(n,e,t,r,i){var o=-1,s=n.length;for(t||(t=XC),i||(i=[]);++o<s;){var l=n[o];t(l)&&op(i,l)}return i}function ZC(n,e,t){var r=-1,i=n.length;e<0&&(e=-e>i?0:i+e),t=t>i?i:t,t<0&&(t+=i),i=e>t?0:t-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=n[r+e];return o}function ek(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:ZC(n,e,t)}var tk="\\ud800-\\udfff",nk="\\u0300-\\u036f",rk="\\ufe20-\\ufe2f",ik="\\u20d0-\\u20ff",ok=nk+rk+ik,sk="\\ufe0e\\ufe0f",lk="\\u200d",ak=RegExp("["+lk+tk+ok+sk+"]");function Yl(n){return ak.test(n)}function ck(n){return n.split("")}var sp="\\ud800-\\udfff",fk="\\u0300-\\u036f",uk="\\ufe20-\\ufe2f",dk="\\u20d0-\\u20ff",hk=fk+uk+dk,pk="\\ufe0e\\ufe0f",mk="["+sp+"]",Us="["+hk+"]",Js="\\ud83c[\\udffb-\\udfff]",gk="(?:"+Us+"|"+Js+")",lp="[^"+sp+"]",ap="(?:\\ud83c[\\udde6-\\uddff]){2}",cp="[\\ud800-\\udbff][\\udc00-\\udfff]",yk="\\u200d",fp=gk+"?",up="["+pk+"]?",bk="(?:"+yk+"(?:"+[lp,ap,cp].join("|")+")"+up+fp+")*",Sk=up+fp+bk,vk="(?:"+[lp+Us+"?",Us,ap,cp,mk].join("|")+")",wk=RegExp(Js+"(?="+Js+")|"+vk+Sk,"g");function xk(n){return n.match(wk)||[]}function Ck(n){return Yl(n)?xk(n):ck(n)}function kk(n,e,t){return n===n&&(t!==void 0&&(n=n<=t?n:t),e!==void 0&&(n=n>=e?n:e)),n}function Ok(n,e,t){return t===void 0&&(t=e,e=void 0),t!==void 0&&(t=mn(t),t=t===t?t:0),e!==void 0&&(e=mn(e),e=e===e?e:0),kk(mn(n),e,t)}function Ak(){this.__data__=new nt,this.size=0}function Tk(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function Ek(n){return this.__data__.get(n)}function Mk(n){return this.__data__.has(n)}var Nk=200;function Rk(n,e){var t=this.__data__;if(t instanceof nt){var r=t.__data__;if(!ar||r.length<Nk-1)return r.push([n,e]),this.size=++t.size,this;t=this.__data__=new rt(r)}return t.set(n,e),this.size=t.size,this}function et(n){var e=this.__data__=new nt(n);this.size=e.size}et.prototype.clear=Ak;et.prototype.delete=Tk;et.prototype.get=Ek;et.prototype.has=Mk;et.prototype.set=Rk;function Ik(n,e){for(var t=-1,r=n==null?0:n.length,i=0,o=[];++t<r;){var s=n[t];e(s,t,n)&&(o[i++]=s)}return o}function Dk(){return[]}var Pk=Object.prototype,$k=Pk.propertyIsEnumerable,Wf=Object.getOwnPropertySymbols,Bk=Wf?function(n){return n==null?[]:(n=Object(n),Ik(Wf(n),function(e){return $k.call(n,e)}))}:Dk;function zk(n,e,t){var r=e(n);return Fe(n)?r:op(r,t(n))}function Hf(n){return zk(n,np,Bk)}var Ks=Xt(Ve,"DataView"),qs=Xt(Ve,"Promise"),Gs=Xt(Ve,"Set"),Uf="[object Map]",Lk="[object Object]",Jf="[object Promise]",Kf="[object Set]",qf="[object WeakMap]",Gf="[object DataView]",Fk=Yt(Ks),jk=Yt(ar),_k=Yt(qs),Vk=Yt(Gs),Wk=Yt(Vs),ut=Mt;(Ks&&ut(new Ks(new ArrayBuffer(1)))!=Gf||ar&&ut(new ar)!=Uf||qs&&ut(qs.resolve())!=Jf||Gs&&ut(new Gs)!=Kf||Vs&&ut(new Vs)!=qf)&&(ut=function(n){var e=Mt(n),t=e==Lk?n.constructor:void 0,r=t?Yt(t):"";if(r)switch(r){case Fk:return Gf;case jk:return Uf;case _k:return Jf;case Vk:return Kf;case Wk:return qf}return e});var Yf=Ve.Uint8Array,Hk="__lodash_hash_undefined__";function Uk(n){return this.__data__.set(n,Hk),this}function Jk(n){return this.__data__.has(n)}function cr(n){var e=-1,t=n==null?0:n.length;for(this.__data__=new rt;++e<t;)this.add(n[e])}cr.prototype.add=cr.prototype.push=Uk;cr.prototype.has=Jk;function Kk(n,e){for(var t=-1,r=n==null?0:n.length;++t<r;)if(e(n[t],t,n))return!0;return!1}function dp(n,e){return n.has(e)}var qk=1,Gk=2;function hp(n,e,t,r,i,o){var s=t&qk,l=n.length,a=e.length;if(l!=a&&!(s&&a>l))return!1;var c=o.get(n),f=o.get(e);if(c&&f)return c==e&&f==n;var u=-1,d=!0,h=t&Gk?new cr:void 0;for(o.set(n,e),o.set(e,n);++u<l;){var p=n[u],m=e[u];if(r)var g=s?r(m,p,u,e,n,o):r(p,m,u,n,e,o);if(g!==void 0){if(g)continue;d=!1;break}if(h){if(!Kk(e,function(y,x){if(!dp(h,x)&&(p===y||i(p,y,t,r,o)))return h.push(x)})){d=!1;break}}else if(!(p===m||i(p,m,t,r,o))){d=!1;break}}return o.delete(n),o.delete(e),d}function Yk(n){var e=-1,t=Array(n.size);return n.forEach(function(r,i){t[++e]=[i,r]}),t}function Xk(n){var e=-1,t=Array(n.size);return n.forEach(function(r){t[++e]=r}),t}var Qk=1,Zk=2,eO="[object Boolean]",tO="[object Date]",nO="[object Error]",rO="[object Map]",iO="[object Number]",oO="[object RegExp]",sO="[object Set]",lO="[object String]",aO="[object Symbol]",cO="[object ArrayBuffer]",fO="[object DataView]",Xf=Le?Le.prototype:void 0,Yo=Xf?Xf.valueOf:void 0;function uO(n,e,t,r,i,o,s){switch(t){case fO:if(n.byteLength!=e.byteLength||n.byteOffset!=e.byteOffset)return!1;n=n.buffer,e=e.buffer;case cO:return!(n.byteLength!=e.byteLength||!o(new Yf(n),new Yf(e)));case eO:case tO:case iO:return Yh(+n,+e);case nO:return n.name==e.name&&n.message==e.message;case oO:case lO:return n==e+"";case rO:var l=Yk;case sO:var a=r&Qk;if(l||(l=Xk),n.size!=e.size&&!a)return!1;var c=s.get(n);if(c)return c==e;r|=Zk,s.set(n,e);var f=hp(l(n),l(e),r,i,o,s);return s.delete(n),f;case aO:if(Yo)return Yo.call(n)==Yo.call(e)}return!1}var dO=1,hO=Object.prototype,pO=hO.hasOwnProperty;function mO(n,e,t,r,i,o){var s=t&dO,l=Hf(n),a=l.length,c=Hf(e),f=c.length;if(a!=f&&!s)return!1;for(var u=a;u--;){var d=l[u];if(!(s?d in e:pO.call(e,d)))return!1}var h=o.get(n),p=o.get(e);if(h&&p)return h==e&&p==n;var m=!0;o.set(n,e),o.set(e,n);for(var g=s;++u<a;){d=l[u];var y=n[d],x=e[d];if(r)var k=s?r(x,y,d,e,n,o):r(y,x,d,n,e,o);if(!(k===void 0?y===x||i(y,x,t,r,o):k)){m=!1;break}g||(g=d=="constructor")}if(m&&!g){var M=n.constructor,T=e.constructor;M!=T&&"constructor"in n&&"constructor"in e&&!(typeof M=="function"&&M instanceof M&&typeof T=="function"&&T instanceof T)&&(m=!1)}return o.delete(n),o.delete(e),m}var gO=1,Qf="[object Arguments]",Zf="[object Array]",xr="[object Object]",yO=Object.prototype,eu=yO.hasOwnProperty;function bO(n,e,t,r,i,o){var s=Fe(n),l=Fe(e),a=s?Zf:ut(n),c=l?Zf:ut(e);a=a==Qf?xr:a,c=c==Qf?xr:c;var f=a==xr,u=c==xr,d=a==c;if(d&&Ws(n)){if(!Ws(e))return!1;s=!0,f=!1}if(d&&!f)return o||(o=new et),s||tp(n)?hp(n,e,t,r,i,o):uO(n,e,a,t,r,i,o);if(!(t&gO)){var h=f&&eu.call(n,"__wrapped__"),p=u&&eu.call(e,"__wrapped__");if(h||p){var m=h?n.value():n,g=p?e.value():e;return o||(o=new et),i(m,g,t,r,o)}}return d?(o||(o=new et),mO(n,e,t,r,i,o)):!1}function Xl(n,e,t,r,i){return n===e?!0:n==null||e==null||!tt(n)&&!tt(e)?n!==n&&e!==e:bO(n,e,t,r,Xl,i)}var SO=1,vO=2;function wO(n,e,t,r){var i=t.length,o=i;if(n==null)return!o;for(n=Object(n);i--;){var s=t[i];if(s[2]?s[1]!==n[s[0]]:!(s[0]in n))return!1}for(;++i<o;){s=t[i];var l=s[0],a=n[l],c=s[1];if(s[2]){if(a===void 0&&!(l in n))return!1}else{var f=new et,u;if(!(u===void 0?Xl(c,a,SO|vO,r,f):u))return!1}}return!0}function pp(n){return n===n&&!Ot(n)}function xO(n){for(var e=np(n),t=e.length;t--;){var r=e[t],i=n[r];e[t]=[r,i,pp(i)]}return e}function mp(n,e){return function(t){return t==null?!1:t[n]===e&&(e!==void 0||n in Object(t))}}function CO(n){var e=xO(n);return e.length==1&&e[0][2]?mp(e[0][0],e[0][1]):function(t){return t===n||wO(t,n,e)}}function kO(n,e){return n!=null&&e in Object(n)}function OO(n,e,t){e=rp(e,n);for(var r=-1,i=e.length,o=!1;++r<i;){var s=co(e[r]);if(!(o=n!=null&&t(n,s)))break;n=n[s]}return o||++r!=i?o:(i=n==null?0:n.length,!!i&&Ul(i)&&Gh(s,i)&&(Fe(n)||Jl(n)))}function AO(n,e){return n!=null&&OO(n,e,kO)}var TO=1,EO=2;function MO(n,e){return ql(n)&&pp(e)?mp(co(n),e):function(t){var r=YC(t,n);return r===void 0&&r===e?AO(t,n):Xl(e,r,TO|EO)}}function gp(n){return function(e){return e==null?void 0:e[n]}}function NO(n){return function(e){return ip(e,n)}}function RO(n){return ql(n)?gp(co(n)):NO(n)}function IO(n){return typeof n=="function"?n:n==null?Hl:typeof n=="object"?Fe(n)?MO(n[0],n[1]):CO(n):RO(n)}var Xo=function(){return Ve.Date.now()},DO="Expected a function",PO=Math.max,$O=Math.min;function yp(n,e,t){var r,i,o,s,l,a,c=0,f=!1,u=!1,d=!0;if(typeof n!="function")throw new TypeError(DO);e=mn(e)||0,Ot(t)&&(f=!!t.leading,u="maxWait"in t,o=u?PO(mn(t.maxWait)||0,e):o,d="trailing"in t?!!t.trailing:d);function h(w){var I=r,P=i;return r=i=void 0,c=w,s=n.apply(P,I),s}function p(w){return c=w,l=setTimeout(y,e),f?h(w):s}function m(w){var I=w-a,P=w-c,O=e-I;return u?$O(O,o-P):O}function g(w){var I=w-a,P=w-c;return a===void 0||I>=e||I<0||u&&P>=o}function y(){var w=Xo();if(g(w))return x(w);l=setTimeout(y,m(w))}function x(w){return l=void 0,d&&r?h(w):(r=i=void 0,s)}function k(){l!==void 0&&clearTimeout(l),c=0,r=a=i=l=void 0}function M(){return l===void 0?s:x(Xo())}function T(){var w=Xo(),I=g(w);if(r=arguments,i=this,a=w,I){if(l===void 0)return p(a);if(u)return clearTimeout(l),l=setTimeout(y,e),h(a)}return l===void 0&&(l=setTimeout(y,e)),s}return T.cancel=k,T.flush=M,T}function Qo(n){return tt(n)&&Xh(n)}var BO=200;function zO(n,e,t,r){var i=-1,o=xx,s=!0,l=n.length,a=[],c=e.length;if(!l)return a;t&&(e=Kh(e,Kl(t))),e.length>=BO&&(o=dp,s=!1,e=new cr(e));e:for(;++i<l;){var f=n[i],u=t==null?f:t(f);if(f=f!==0?f:0,s&&u===u){for(var d=c;d--;)if(e[d]===u)continue e;a.push(f)}else o(e,u,r)||a.push(f)}return a}function LO(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}var FO=Ax(function(n,e){var t=LO(e);return Qo(t)&&(t=void 0),Qo(n)?zO(n,QC(e,1,Qo),IO(t)):[]}),jO="[object Number]";function _O(n){return typeof n=="number"||tt(n)&&Mt(n)==jO}var VO="[object RegExp]";function WO(n){return tt(n)&&Mt(n)==VO}var tu=wi&&wi.isRegExp,HO=tu?Kl(tu):WO,UO=gp("length"),bp="\\ud800-\\udfff",JO="\\u0300-\\u036f",KO="\\ufe20-\\ufe2f",qO="\\u20d0-\\u20ff",GO=JO+KO+qO,YO="\\ufe0e\\ufe0f",XO="["+bp+"]",Ys="["+GO+"]",Xs="\\ud83c[\\udffb-\\udfff]",QO="(?:"+Ys+"|"+Xs+")",Sp="[^"+bp+"]",vp="(?:\\ud83c[\\udde6-\\uddff]){2}",wp="[\\ud800-\\udbff][\\udc00-\\udfff]",ZO="\\u200d",xp=QO+"?",Cp="["+YO+"]?",eA="(?:"+ZO+"(?:"+[Sp,vp,wp].join("|")+")"+Cp+xp+")*",tA=Cp+xp+eA,nA="(?:"+[Sp+Ys+"?",Ys,vp,wp,XO].join("|")+")",nu=RegExp(Xs+"(?="+Xs+")|"+nA+tA,"g");function rA(n){for(var e=nu.lastIndex=0;nu.test(n);)++e;return e}function iA(n){return Yl(n)?rA(n):UO(n)}var oA="Expected a function";function sA(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(oA);return Ot(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),yp(n,e,{leading:r,maxWait:e,trailing:i})}var lA=30,aA="...",cA=/\w*$/;function fA(n,e){var t=lA,r=aA;if(Ot(e)){var i="separator"in e?e.separator:i;t="length"in e?Kw(e.length):t,r="omission"in e?vi(e.omission):r}n=Hs(n);var o=n.length;if(Yl(n)){var s=Ck(n);o=s.length}if(t>=o)return n;var l=t-iA(r);if(l<1)return r;var a=s?ek(s,0,l).join(""):n.slice(0,l);if(i===void 0)return a+r;if(s&&(l+=a.length-l),HO(i)){if(n.slice(l).search(i)){var c,f=a;for(i.global||(i=RegExp(i.source,Hs(cA.exec(i))+"g")),i.lastIndex=0;c=i.exec(f);)var u=c.index;a=a.slice(0,u===void 0?l:u)}}else if(n.indexOf(vi(i),l)!=l){var d=a.lastIndexOf(i);d>-1&&(a=a.slice(0,d))}return a+r}const uA="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",dA="ελ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",kn=(n,e)=>{for(const t in e)n[t]=e[t];return n},Qs="numeric",Zs="ascii",el="alpha",Vr="asciinumeric",Cr="alphanumeric",tl="domain",kp="emoji",hA="scheme",pA="slashscheme",ru="whitespace";function mA(n,e){return n in e||(e[n]=[]),e[n]}function Dt(n,e,t){e[Qs]&&(e[Vr]=!0,e[Cr]=!0),e[Zs]&&(e[Vr]=!0,e[el]=!0),e[Vr]&&(e[Cr]=!0),e[el]&&(e[Cr]=!0),e[Cr]&&(e[tl]=!0),e[kp]&&(e[tl]=!0);for(const r in e){const i=mA(r,t);i.indexOf(n)<0&&i.push(n)}}function gA(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function ce(n){n===void 0&&(n=null),this.j={},this.jr=[],this.jd=null,this.t=n}ce.groups={};ce.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],o=e.jr[r][1];if(o&&i.test(n))return o}return e.jd},has(n,e){return e===void 0&&(e=!1),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||ce.groups;let i;return e&&e.j?i=e:(i=new ce(e),t&&r&&Dt(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const o=n.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(n[s]);return i.tt(n[o-1],e,t,r)},tt(n,e,t,r){r=r||ce.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const o=e;let s,l=i.go(n);if(l?(s=new ce,kn(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new ce,o){if(r)if(s.t&&typeof s.t=="string"){const a=kn(gA(s.t,r),t);Dt(o,a,r)}else t&&Dt(o,t,r);s.t=o}return i.j[n]=s,s}};const N=(n,e,t,r,i)=>n.ta(e,t,r,i),me=(n,e,t,r,i)=>n.tr(e,t,r,i),iu=(n,e,t,r,i)=>n.ts(e,t,r,i),S=(n,e,t,r,i)=>n.tt(e,t,r,i),Ye="WORD",nl="UWORD",fr="LOCALHOST",rl="TLD",il="UTLD",Wr="SCHEME",ln="SLASH_SCHEME",Ql="NUM",Op="WS",Zl="NL",Xn="OPENBRACE",Qn="CLOSEBRACE",xi="OPENBRACKET",Ci="CLOSEBRACKET",ki="OPENPAREN",Oi="CLOSEPAREN",Ai="OPENANGLEBRACKET",Ti="CLOSEANGLEBRACKET",Ei="FULLWIDTHLEFTPAREN",Mi="FULLWIDTHRIGHTPAREN",Ni="LEFTCORNERBRACKET",Ri="RIGHTCORNERBRACKET",Ii="LEFTWHITECORNERBRACKET",Di="RIGHTWHITECORNERBRACKET",Pi="FULLWIDTHLESSTHAN",$i="FULLWIDTHGREATERTHAN",Bi="AMPERSAND",zi="APOSTROPHE",Li="ASTERISK",dt="AT",Fi="BACKSLASH",ji="BACKTICK",_i="CARET",mt="COLON",ea="COMMA",Vi="DOLLAR",Me="DOT",Wi="EQUALS",ta="EXCLAMATION",Ne="HYPHEN",Hi="PERCENT",Ui="PIPE",Ji="PLUS",Ki="POUND",qi="QUERY",na="QUOTE",ra="SEMI",Re="SLASH",Zn="TILDE",Gi="UNDERSCORE",Ap="EMOJI",Yi="SYM";var Tp=Object.freeze({__proto__:null,WORD:Ye,UWORD:nl,LOCALHOST:fr,TLD:rl,UTLD:il,SCHEME:Wr,SLASH_SCHEME:ln,NUM:Ql,WS:Op,NL:Zl,OPENBRACE:Xn,CLOSEBRACE:Qn,OPENBRACKET:xi,CLOSEBRACKET:Ci,OPENPAREN:ki,CLOSEPAREN:Oi,OPENANGLEBRACKET:Ai,CLOSEANGLEBRACKET:Ti,FULLWIDTHLEFTPAREN:Ei,FULLWIDTHRIGHTPAREN:Mi,LEFTCORNERBRACKET:Ni,RIGHTCORNERBRACKET:Ri,LEFTWHITECORNERBRACKET:Ii,RIGHTWHITECORNERBRACKET:Di,FULLWIDTHLESSTHAN:Pi,FULLWIDTHGREATERTHAN:$i,AMPERSAND:Bi,APOSTROPHE:zi,ASTERISK:Li,AT:dt,BACKSLASH:Fi,BACKTICK:ji,CARET:_i,COLON:mt,COMMA:ea,DOLLAR:Vi,DOT:Me,EQUALS:Wi,EXCLAMATION:ta,HYPHEN:Ne,PERCENT:Hi,PIPE:Ui,PLUS:Ji,POUND:Ki,QUERY:qi,QUOTE:na,SEMI:ra,SLASH:Re,TILDE:Zn,UNDERSCORE:Gi,EMOJI:Ap,SYM:Yi});const nn=/[a-z]/,Zo=new RegExp("\\p{L}","u"),es=new RegExp("\\p{Emoji}","u"),ts=/\d/,ou=/\s/,su=`
14
+ `,yA="️",bA="‍";let kr=null,Or=null;function SA(n){n===void 0&&(n=[]);const e={};ce.groups=e;const t=new ce;kr==null&&(kr=lu(uA)),Or==null&&(Or=lu(dA)),S(t,"'",zi),S(t,"{",Xn),S(t,"}",Qn),S(t,"[",xi),S(t,"]",Ci),S(t,"(",ki),S(t,")",Oi),S(t,"<",Ai),S(t,">",Ti),S(t,"(",Ei),S(t,")",Mi),S(t,"「",Ni),S(t,"」",Ri),S(t,"『",Ii),S(t,"』",Di),S(t,"<",Pi),S(t,">",$i),S(t,"&",Bi),S(t,"*",Li),S(t,"@",dt),S(t,"`",ji),S(t,"^",_i),S(t,":",mt),S(t,",",ea),S(t,"$",Vi),S(t,".",Me),S(t,"=",Wi),S(t,"!",ta),S(t,"-",Ne),S(t,"%",Hi),S(t,"|",Ui),S(t,"+",Ji),S(t,"#",Ki),S(t,"?",qi),S(t,'"',na),S(t,"/",Re),S(t,";",ra),S(t,"~",Zn),S(t,"_",Gi),S(t,"\\",Fi);const r=me(t,ts,Ql,{[Qs]:!0});me(r,ts,r);const i=me(t,nn,Ye,{[Zs]:!0});me(i,nn,i);const o=me(t,Zo,nl,{[el]:!0});me(o,nn),me(o,Zo,o);const s=me(t,ou,Op,{[ru]:!0});S(t,su,Zl,{[ru]:!0}),S(s,su),me(s,ou,s);const l=me(t,es,Ap,{[kp]:!0});me(l,es,l),S(l,yA,l);const a=S(l,bA);me(a,es,l);const c=[[nn,i]],f=[[nn,null],[Zo,o]];for(let u=0;u<kr.length;u++)lt(t,kr[u],rl,Ye,c);for(let u=0;u<Or.length;u++)lt(t,Or[u],il,nl,f);Dt(rl,{tld:!0,ascii:!0},e),Dt(il,{utld:!0,alpha:!0},e),lt(t,"file",Wr,Ye,c),lt(t,"mailto",Wr,Ye,c),lt(t,"http",ln,Ye,c),lt(t,"https",ln,Ye,c),lt(t,"ftp",ln,Ye,c),lt(t,"ftps",ln,Ye,c),Dt(Wr,{scheme:!0,ascii:!0},e),Dt(ln,{slashscheme:!0,ascii:!0},e),n=n.sort((u,d)=>u[0]>d[0]?1:-1);for(let u=0;u<n.length;u++){const d=n[u][0],p=n[u][1]?{[hA]:!0}:{[pA]:!0};d.indexOf("-")>=0?p[tl]=!0:nn.test(d)?ts.test(d)?p[Vr]=!0:p[Zs]=!0:p[Qs]=!0,iu(t,d,d,p)}return iu(t,"localhost",fr,{ascii:!0}),t.jd=new ce(Yi),{start:t,tokens:kn({groups:e},Tp)}}function vA(n,e){const t=wA(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let o=0,s=0;for(;s<r;){let l=n,a=null,c=0,f=null,u=-1,d=-1;for(;s<r&&(a=l.go(t[s]));)l=a,l.accepts()?(u=0,d=0,f=l):u>=0&&(u+=t[s].length,d++),c+=t[s].length,o+=t[s].length,s++;o-=u,s-=d,c-=u,i.push({t:f.t,v:e.slice(o-c,o),s:o-c,e:o})}return i}function wA(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),o,s=i<55296||i>56319||r+1===t||(o=n.charCodeAt(r+1))<56320||o>57343?n[r]:n.slice(r,r+2);e.push(s),r+=s.length}return e}function lt(n,e,t,r,i){let o;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];n.j[a]?o=n.j[a]:(o=new ce(r),o.jr=i.slice(),n.j[a]=o),n=o}return o=new ce(t),o.jr=i.slice(),n.j[e[s-1]]=o,o}function lu(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let o=0;for(;i.indexOf(n[r+o])>=0;)o++;if(o>0){e.push(t.join(""));for(let s=parseInt(n.substring(r,r+o),10);s>0;s--)t.pop();r+=o}else t.push(n[r]),r++}return e}const ur={defaultProtocol:"http",events:null,format:au,formatHref:au,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ia(n,e){e===void 0&&(e=null);let t=kn({},ur);n&&(t=kn(t,n instanceof ia?n.o:n));const r=t.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}ia.prototype={o:ur,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]:ur[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 au(n){return n}function Ep(n,e){this.t="token",this.v=n,this.tk=e}Ep.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){return n===void 0&&(n=ur.defaultProtocol),{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),o=this.toFormattedString(n),s={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),f=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),f&&kn(s,f),{tagName:i,attributes:s,content:o,eventListeners:u}}};function fo(n,e){class t extends Ep{constructor(i,o){super(i,o),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const cu=fo("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),fu=fo("text"),xA=fo("nl"),Ar=fo("url",{isLink:!0,toHref(n){return n===void 0&&(n=ur.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==fr&&n[1].t===mt}}),ge=n=>new ce(n);function CA(n){let{groups:e}=n;const t=e.domain.concat([Bi,Li,dt,Fi,ji,_i,Vi,Wi,Ne,Ql,Hi,Ui,Ji,Ki,Re,Yi,Zn,Gi]),r=[zi,mt,ea,Me,ta,qi,na,ra,Ai,Ti,Xn,Qn,Ci,xi,ki,Oi,Ei,Mi,Ni,Ri,Ii,Di,Pi,$i],i=[Bi,zi,Li,Fi,ji,_i,Vi,Wi,Ne,Xn,Qn,Hi,Ui,Ji,Ki,qi,Re,Yi,Zn,Gi],o=ge(),s=S(o,Zn);N(s,i,s),N(s,e.domain,s);const l=ge(),a=ge(),c=ge();N(o,e.domain,l),N(o,e.scheme,a),N(o,e.slashscheme,c),N(l,i,s),N(l,e.domain,l);const f=S(l,dt);S(s,dt,f),S(a,dt,f),S(c,dt,f);const u=S(s,Me);N(u,i,s),N(u,e.domain,s);const d=ge();N(f,e.domain,d),N(d,e.domain,d);const h=S(d,Me);N(h,e.domain,d);const p=ge(cu);N(h,e.tld,p),N(h,e.utld,p),S(f,fr,p);const m=S(d,Ne);N(m,e.domain,d),N(p,e.domain,d),S(p,Me,h),S(p,Ne,m);const g=S(p,mt);N(g,e.numeric,cu);const y=S(l,Ne),x=S(l,Me);N(y,e.domain,l),N(x,i,s),N(x,e.domain,l);const k=ge(Ar);N(x,e.tld,k),N(x,e.utld,k),N(k,e.domain,l),N(k,i,s),S(k,Me,x),S(k,Ne,y),S(k,dt,f);const M=S(k,mt),T=ge(Ar);N(M,e.numeric,T);const w=ge(Ar),I=ge();N(w,t,w),N(w,r,I),N(I,t,w),N(I,r,I),S(k,Re,w),S(T,Re,w);const P=S(a,mt),O=S(c,mt),G=S(O,Re),ae=S(G,Re);N(a,e.domain,l),S(a,Me,x),S(a,Ne,y),N(c,e.domain,l),S(c,Me,x),S(c,Ne,y),N(P,e.domain,w),S(P,Re,w),N(ae,e.domain,w),N(ae,t,w),S(ae,Re,w);const $=[[Xn,Qn],[xi,Ci],[ki,Oi],[Ai,Ti],[Ei,Mi],[Ni,Ri],[Ii,Di],[Pi,$i]];for(let ue=0;ue<$.length;ue++){const[he,it]=$[ue],pe=S(w,he);S(I,he,pe),S(pe,it,w);const He=ge(Ar);N(pe,t,He);const Ue=ge();N(pe,r),N(He,t,He),N(He,r,Ue),N(Ue,t,He),N(Ue,r,Ue),S(He,it,w),S(Ue,it,w)}return S(o,fr,k),S(o,Zl,xA),{start:o,tokens:Tp}}function kA(n,e,t){let r=t.length,i=0,o=[],s=[];for(;i<r;){let l=n,a=null,c=null,f=0,u=null,d=-1;for(;i<r&&!(a=l.go(t[i].t));)s.push(t[i++]);for(;i<r&&(c=a||l.go(t[i].t));)a=null,l=c,l.accepts()?(d=0,u=l):d>=0&&d++,i++,f++;if(d<0)i-=f,i<r&&(s.push(t[i]),i++);else{s.length>0&&(o.push(ns(fu,e,s)),s=[]),i-=d,f-=d;const h=u.t,p=t.slice(i-f,i);o.push(ns(h,e,p))}}return s.length>0&&o.push(ns(fu,e,s)),o}function ns(n,e,t){const r=t[0].s,i=t[t.length-1].e,o=e.slice(r,i);return new n(o,t)}const OA=typeof console<"u"&&console&&console.warn||(()=>{}),AA="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",j={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function TA(){ce.groups={},j.scanner=null,j.parser=null,j.tokenQueue=[],j.pluginQueue=[],j.customSchemes=[],j.initialized=!1}function EA(n,e){if(e===void 0&&(e=!1),j.initialized&&OA(`linkifyjs: already initialized - will not register custom scheme "${n}" ${AA}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
15
+ 1. Must only contain digits, lowercase ASCII letters or "-"
16
+ 2. Cannot start or end with "-"
17
+ 3. "-" cannot repeat`);j.customSchemes.push([n,e])}function MA(){j.scanner=SA(j.customSchemes);for(let n=0;n<j.tokenQueue.length;n++)j.tokenQueue[n][1]({scanner:j.scanner});j.parser=CA(j.scanner.tokens);for(let n=0;n<j.pluginQueue.length;n++)j.pluginQueue[n][1]({scanner:j.scanner,parser:j.parser});j.initialized=!0}function Mp(n){return j.initialized||MA(),kA(j.parser.start,n,vA(j.scanner.start,n))}function NA(n,e,t){if(e===void 0&&(e=null),t===void 0&&(t=null),e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new ia(t),i=Mp(n),o=[];for(let s=0;s<i.length;s++){const l=i[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&o.push(l.toFormattedObject(r))}return o}var Xi=200,q=function(){};q.prototype.append=function(e){return e.length?(e=q.from(e),!this.length&&e||e.length<Xi&&this.leafAppend(e)||this.length<Xi&&e.leafPrepend(this)||this.appendInner(e)):this};q.prototype.prepend=function(e){return e.length?q.from(e).append(this):this};q.prototype.appendInner=function(e){return new RA(this,e)};q.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?q.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};q.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};q.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)};q.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,r),i};q.from=function(e){return e instanceof q?e:e&&e.length?new Np(e):q.empty};var Np=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,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,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Xi)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Xi)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}(q);q.empty=new Np([]);var RA=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,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),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}(q);const IA=500;class ke{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,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,c=[],f=[];return this.items.forEach((u,d)=>{if(!u.step){i||(i=this.remapping(r,d+1),o=i.maps.length),o--,f.push(u);return}if(i){f.push(new Ie(u.map));let h=u.step.map(i.slice(o)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new Ie(p,void 0,void 0,c.length+f.length))),o--,p&&i.appendMap(p,o)}else s.maybeStep(u.step);if(u.selection)return l=i?u.selection.map(i.slice(o)):u.selection,a=new ke(this.items.slice(0,r).append(f.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let f=0;f<e.steps.length;f++){let u=e.steps[f].invert(e.docs[f]),d=new Ie(e.mapping.maps[f],u,t),h;(h=a&&a.merge(d))&&(d=h,f?o.pop():l=l.slice(0,l.length-1)),o.push(d),t&&(s++,t=void 0),i||(a=d)}let c=s-r.depth;return c>PA&&(l=DA(l,c),s-=c),new ke(l.append(o),s)}remapping(e,t){let r=new fn;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,t),r}addMaps(e){return this.eventCount==0?this:new ke(this.items.append(e.map(t=>new Ie(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(d=>{d.selection&&l--},i);let a=t;this.items.forEach(d=>{let h=o.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=o.maps[h];if(d.step){let m=e.steps[h].invert(e.docs[h]),g=d.selection&&d.selection.map(o.slice(a+1,h));g&&l++,r.push(new Ie(p,m,g))}else r.push(new Ie(p))},i);let c=[];for(let d=t;d<s;d++)c.push(new Ie(o.maps[d]));let f=this.items.slice(0,i).append(c).append(r),u=new ke(f,l);return u.emptyItemCount()>IA&&(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=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let f=s.selection&&s.selection.map(t.slice(r));f&&o++;let u=new Ie(c.invert(),a,f),d,h=i.length-1;(d=i.length&&i[h].merge(u))?i[h]=d:i.push(u)}}else s.map&&r--},this.items.length,0),new ke(q.from(i.reverse()),o)}}ke.empty=new ke(q.empty,0);function DA(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class Ie{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 Ie(t.getMap().invert(),t,this.selection)}}}class ht{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const PA=20;function $A(n,e,t,r){let i=t.getMeta(jt),o;if(i)return i.historyState;t.getMeta(LA)&&(n=new ht(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(jt))return s.getMeta(jt).redo?new ht(n.done.addTransform(t,void 0,r,Hr(e)),n.undone,uu(t.mapping.maps),n.prevTime,n.prevComposition):new ht(n.done,n.undone.addTransform(t,void 0,r,Hr(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!BA(t,n.prevRanges)),c=s?rs(n.prevRanges,t.mapping):uu(t.mapping.maps);return new ht(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Hr(e)),ke.empty,c,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new ht(n.done.rebased(t,o),n.undone.rebased(t,o),rs(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new ht(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),rs(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function BA(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function uu(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,s)=>e.push(o,s));return e}function rs(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function zA(n,e,t){let r=Hr(e),i=jt.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),a=new ht(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(jt,{redo:t,historyState:a})}let is=!1,du=null;function Hr(n){let e=n.plugins;if(du!=e){is=!1,du=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){is=!0;break}}return is}const jt=new Tn("history"),LA=new Tn("closeHistory");function FA(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Kt({key:jt,state:{init(){return new ht(ke.empty,ke.empty,null,0,-1)},apply(e,t,r){return $A(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?Ip:r=="historyRedo"?Dp:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function Rp(n,e){return(t,r)=>{let i=jt.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=zA(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const Ip=Rp(!1,!0),Dp=Rp(!0,!0);function jA(n={}){return new Kt({view(e){return new _A(e,n)}})}class _A{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 o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}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;if(t){let l=e.nodeBefore,a=e.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let f=c.getBoundingClientRect(),u=l?f.bottom:f.top;l&&a&&(u=(u+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:f.left,right:f.right,top:u-this.width/2,bottom:u+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.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 o,s;if(!i||i==document.body&&getComputedStyle(i).position=="static")o=-pageXOffset,s=-pageYOffset;else{let l=i.getBoundingClientRect();o=l.left-i.scrollLeft,s=l.top-i.scrollTop}this.element.style.left=r.left-o+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"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,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Uu(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}class V extends A{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return V.valid(r)?new V(r):A.near(r)}content(){return v.empty}eq(e){return e instanceof V&&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 V(e.resolve(t.pos))}getBookmark(){return new oa(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!VA(e)||!WA(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&&V.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(V.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!C.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),r=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(V.valid(l))return l}return null}}}V.prototype.visible=!1;V.findFrom=V.findGapCursorFrom;A.jsonID("gapcursor",V);class oa{constructor(e){this.pos=e}map(e){return new oa(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return V.valid(t)?new V(t):A.near(t)}}function VA(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||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function WA(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||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function HA(){return new Kt({props:{decorations:qA,createSelectionBetween(n,e,t){return e.pos==t.pos&&V.valid(t)?new V(t):null},handleClick:JA,handleKeyDown:UA,handleDOMEvents:{beforeinput:KA}}})}const UA=kl({ArrowLeft:Tr("horiz",-1),ArrowRight:Tr("horiz",1),ArrowUp:Tr("vert",-1),ArrowDown:Tr("vert",1)});function Tr(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof R){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=V.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new V(c))),!0):!1}}function JA(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!V.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&C.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new V(r))),!0)}function KA(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof V))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=b.empty;for(let s=r.length-1;s>=0;s--)i=b.from(r[s].createAndFill(null,i));let o=n.state.tr.replace(t.pos,t.pos,new v(i,0,0));return o.setSelection(R.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function qA(n){if(!(n.selection instanceof V))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",_.create(n.doc,[ie.widget(n.selection.head,e,{key:"gapcursor"})])}var ol,sl;if(typeof WeakMap<"u"){let n=new WeakMap;ol=e=>n.get(e),sl=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;ol=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},sl=(r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i)}var W=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,i=e/this.width|0;let o=r+1,s=i+1;for(let l=1;o<this.width&&this.map[e+l]==t;l++)o++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:r,top:i,right:o,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:i,top:o,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?r==0:i==this.width)?null:this.map[o*this.width+(t<0?r-1:i)]:(t<0?o==0:s==this.height)?null:this.map[r+this.width*(t<0?o-1:s)]}rectBetween(n,e){const{left:t,right:r,top:i,bottom:o}=this.findCell(n),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(o,c)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let i=n.left;i<n.right;i++){const o=r*this.width+i,s=this.map[o];t[s]||(t[s]=!0,!(i==n.left&&i&&this.map[o-1]==s||r==n.top&&r&&this.map[o-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let r=0,i=0;;r++){const o=i+t.child(r).nodeSize;if(r==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<i;)s++;return s==l?o-1:this.map[s]}i=o}}static get(n){return ol(n)||sl(n,GA(n))}};function GA(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=YA(n),t=n.childCount,r=[];let i=0,o=null;const s=[];for(let c=0,f=e*t;c<f;c++)r[c]=0;for(let c=0,f=0;c<t;c++){const u=n.child(c);f++;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:y,colwidth:x}=m.attrs;for(let k=0;k<y;k++){if(k+c>=t){(o||(o=[])).push({type:"overlong_rowspan",pos:f,n:y-k});break}const M=i+k*e;for(let T=0;T<g;T++){r[M+T]==0?r[M+T]=f:(o||(o=[])).push({type:"collision",row:c,pos:f,n:g-T});const w=x&&x[T];if(w){const I=(M+T)%e*2,P=s[I];P==null||P!=w&&s[I+1]==1?(s[I]=w,s[I+1]=1):P==w&&s[I+1]++}}}i+=g,f+=m.nodeSize}const d=(c+1)*e;let h=0;for(;i<d;)r[i++]==0&&h++;h&&(o||(o=[])).push({type:"missing",row:c,n:h}),f++}const l=new W(e,t,r,o);let a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<t&&(a=!0);return a&&XA(l,s,n),l}function YA(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const i=n.child(r);let o=0;if(t)for(let s=0;s<r;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const c=l.child(a);s+c.attrs.rowspan>r&&(o+=c.attrs.colspan)}}for(let s=0;s<i.childCount;s++){const l=i.child(s);o+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function XA(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i<n.map.length;i++){const o=n.map[i];if(r[o])continue;r[o]=!0;const s=t.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let l=null;const a=s.attrs;for(let c=0;c<a.colspan;c++){const f=(i+c)%n.width,u=e[f*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=QA(a)))[c]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:l})}}function QA(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function ne(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var gt=new Tn("selectingCells");function Rn(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function ZA(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function Ee(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function uo(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Rn(e.$head)||eT(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function eT(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function ll(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function tT(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function sa(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Pp(n,e,t){const r=n.node(-1),i=W.get(r),o=n.start(-1),s=i.nextCell(n.pos-o,e,t);return s==null?null:n.node(0).resolve(o+s)}function Ut(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function $p(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<t;i++)r.colwidth.splice(e,0,0)}return r}function nT(n,e,t){const r=ne(e.type.schema).header_cell;for(let i=0;i<n.height;i++)if(e.nodeAt(n.map[t+i*n.width]).type!=r)return!1;return!0}var F=class Xe extends A{constructor(e,t=e){const r=e.node(-1),i=W.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,t.pos-o),l=e.node(0),a=i.cellsInRect(s).filter(f=>f!=t.pos-o);a.unshift(t.pos-o);const c=a.map(f=>{const u=r.nodeAt(f);if(!u)throw RangeError(`No cell with offset ${f} found`);const d=o+f+1;return new Yu(l.resolve(d),l.resolve(d+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(ll(r)&&ll(i)&&sa(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?Xe.rowSelection(r,i):o&&this.isColSelection()?Xe.colSelection(r,i):new Xe(r,i)}return R.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=W.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let f=a*t.width+i.left,u=i.left;u<i.right;u++,f++){const d=t.map[f];if(o[d])continue;o[d]=!0;const h=t.findCell(d);let p=e.nodeAt(d);if(!p)throw RangeError(`No cell with offset ${d} found`);const m=i.left-h.left,g=h.right-i.right;if(m>0||g>0){let y=p.attrs;if(m>0&&(y=Ut(y,0,m)),g>0&&(y=Ut(y,y.colspan-g,g)),h.left<i.left){if(p=p.type.createAndFill(y),!p)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else p=p.type.create(y,p.content)}if(h.top<i.top||h.bottom>i.bottom){const y={...p.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?p=p.type.createAndFill(y):p=p.type.create(y,p.content)}c.push(p)}s.push(e.child(a).copy(b.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new v(b.from(l),1,1)}replace(e,t=v.empty){const r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){const{$from:l,$to:a}=i[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?v.empty:t)}const o=A.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new v(b.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=W.get(t),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(t.nodeAt(o[s]),i+o[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),i=W.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(t.pos-o),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(o+i.map[s.left])),l.bottom<i.height&&(t=a.resolve(o+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(o+i.map[l.left])),s.bottom<i.height&&(e=a.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new Xe(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=W.get(e),r=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-r),o=t.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,l=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof Xe&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=W.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(t.pos-o),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(o+i.map[s.top*i.width])),l.right<i.width&&(t=a.resolve(o+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(o+i.map[l.top*i.width])),s.right<i.width&&(e=a.resolve(o+i.map[i.width*(s.top+1)-1]))),new Xe(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Xe(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new Xe(e.resolve(t),e.resolve(r))}getBookmark(){return new rT(this.$anchorCell.pos,this.$headCell.pos)}};F.prototype.visible=!1;A.jsonID("cell",F);var rT=class Bp{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Bp(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&sa(t,r)?new F(t,r):A.near(r,1)}};function iT(n){if(!(n.selection instanceof F))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(ie.node(r,r+t.nodeSize,{class:"selectedCell"}))}),_.create(n.doc,e)}function oT({$from:n,$to:e}){if(n.pos==e.pos||n.pos<n.pos-6)return!1;let t=n.pos,r=e.pos,i=n.depth;for(;i>=0&&!(n.after(i+1)<n.end(i));i--,t++);for(let o=e.depth;o>=0&&!(e.before(o+1)>e.start(o));o--,r--);return t==r&&/row|table/.test(n.node(i).type.spec.tableRole)}function sT({$from:n,$to:e}){let t,r;for(let i=n.depth;i>0;i--){const o=n.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){t=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 t!==r&&e.parentOffset===0}function lT(n,e,t){const r=(e||n).selection,i=(e||n).doc;let o,s;if(r instanceof C&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=F.create(i,r.from);else if(s=="row"){const l=i.resolve(r.from+1);o=F.rowSelection(l,l)}else if(!t){const l=W.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];o=F.create(i,a+1,c)}}else r instanceof R&&oT(r)?o=R.create(i,r.from):r instanceof R&&sT(r)&&(o=R.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=n.tr)).setSelection(o),e}var aT=new Tn("fix-tables");function zp(n,e,t,r){const i=n.childCount,o=e.childCount;e:for(let s=0,l=0;s<o;s++){const a=e.child(s);for(let c=l,f=Math.min(i,s+3);c<f;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}r(a,t),l<i&&n.child(l).sameMarkup(a)?zp(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function Lp(n,e){let t;const r=(i,o)=>{i.type.spec.tableRole=="table"&&(t=cT(n,i,o,t))};return e?e.doc!=n.doc&&zp(e.doc,n.doc,0,r):n.doc.descendants(r),t}function cT(n,e,t,r){const i=W.get(e);if(!i.problems)return r;r||(r=n.tr);const o=[];for(let a=0;a<i.height;a++)o.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const f=e.nodeAt(c.pos);if(!f)continue;const u=f.attrs;for(let d=0;d<u.rowspan;d++)o[c.row+d]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,Ut(u,u.colspan-c.n,c.n))}else if(c.type=="missing")o[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...f.attrs,rowspan:f.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...f.attrs,colwidth:c.colwidth})}}let s,l;for(let a=0;a<o.length;a++)o[a]&&(s==null&&(s=a),l=a);for(let a=0,c=t+1;a<i.height;a++){const f=e.child(a),u=c+f.nodeSize,d=o[a];if(d>0){let h="cell";f.firstChild&&(h=f.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<d;g++){const y=ne(n.schema)[h].createAndFill();y&&p.push(y)}const m=(a==0||s==a-1)&&l==a?c+1:u-1;r.insert(r.mapping.map(m),p)}c=u}return r.setMeta(aT,{fixTables:!0})}function fT(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,l=[];if(o=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const f=a?0:Math.max(0,t-1),u=a<e.childCount-1?0:Math.max(0,r-1);(f||u)&&(c=al(ne(s).row,new v(c,f,u)).content),l.push(c)}else if(o=="cell"||o=="header_cell")l.push(t||r?al(ne(s).row,new v(e,t,r)).content:e);else return null;return uT(s,l)}function uT(n,e){const t=[];for(let i=0;i<e.length;i++){const o=e[i];for(let s=o.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=o.child(s).attrs;for(let c=i;c<i+l;c++)t[c]=(t[c]||0)+a}}let r=0;for(let i=0;i<t.length;i++)r=Math.max(r,t[i]);for(let i=0;i<t.length;i++)if(i>=e.length&&e.push(b.empty),t[i]<r){const o=ne(n).cell.createAndFill(),s=[];for(let l=t[i];l<r;l++)s.push(o);e[i]=e[i].append(b.from(s))}return{height:e.length,width:r,rows:e}}function al(n,e){const t=n.createAndFill();return new pl(t).replace(0,t.content.size,e).doc}function dT({width:n,height:e,rows:t},r,i){if(n!=r){const o=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let f=o[l]||0,u=0;f<r;u++){let d=a.child(u%a.childCount);f+d.attrs.colspan>r&&(d=d.type.createChecked(Ut(d.attrs,d.attrs.colspan,f+d.attrs.colspan-r),d.content)),c.push(d),f+=d.attrs.colspan;for(let h=1;h<d.attrs.rowspan;h++)o[l+h]=(o[l+h]||0)+d.attrs.colspan}s.push(b.from(c))}t=s,n=r}if(e!=i){const o=[];for(let s=0,l=0;s<i;s++,l++){const a=[],c=t[l%e];for(let f=0;f<c.childCount;f++){let u=c.child(f);s+u.attrs.rowspan>i&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,i-u.attrs.rowspan)},u.content)),a.push(u)}o.push(b.from(a))}t=o,e=i}return{width:n,height:e,rows:t}}function hT(n,e,t,r,i,o,s){const l=n.doc.type.schema,a=ne(l);let c,f;if(i>e.width)for(let u=0,d=0;u<e.height;u++){const h=t.child(u);d+=h.nodeSize;const p=[];let m;h.lastChild==null||h.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=f||(f=a.header_cell.createAndFill());for(let g=e.width;g<i;g++)p.push(m);n.insert(n.mapping.slice(s).map(d-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:t.nodeAt(e.map[m+p]).type==a.header_cell;u.push(g?f||(f=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const d=a.row.create(null,b.from(u)),h=[];for(let p=e.height;p<o;p++)h.push(d);n.insert(n.mapping.slice(s).map(r+t.nodeSize-2),h)}return!!(c||f)}function hu(n,e,t,r,i,o,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=i;c<o;c++){const f=s*e.width+c,u=e.map[f];if(e.map[f-e.width]==u){a=!0;const d=t.nodeAt(u),{top:h,left:p}=e.findCell(u);n.setNodeMarkup(n.mapping.slice(l).map(u+r),null,{...d.attrs,rowspan:s-h}),n.insert(n.mapping.slice(l).map(e.positionAt(s,p,t)),d.type.createAndFill({...d.attrs,rowspan:h+d.attrs.rowspan-s})),c+=d.attrs.colspan-1}}return a}function pu(n,e,t,r,i,o,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=i;c<o;c++){const f=c*e.width+s,u=e.map[f];if(e.map[f-1]==u){a=!0;const d=t.nodeAt(u),h=e.colCount(u),p=n.mapping.slice(l).map(u+r);n.setNodeMarkup(p,null,Ut(d.attrs,s-h,d.attrs.colspan-(s-h))),n.insert(p+d.nodeSize,d.type.createAndFill(Ut(d.attrs,0,s-h))),c+=d.attrs.rowspan-1}}return a}function mu(n,e,t,r,i){let o=t?n.doc.nodeAt(t-1):n.doc;if(!o)throw new Error("No table found");let s=W.get(o);const{top:l,left:a}=r,c=a+i.width,f=l+i.height,u=n.tr;let d=0;function h(){if(o=t?u.doc.nodeAt(t-1):u.doc,!o)throw new Error("No table found");s=W.get(o),d=u.mapping.maps.length}hT(u,s,o,t,c,f,d)&&h(),hu(u,s,o,t,a,c,l,d)&&h(),hu(u,s,o,t,a,c,f,d)&&h(),pu(u,s,o,t,l,f,a,d)&&h(),pu(u,s,o,t,l,f,c,d)&&h();for(let p=l;p<f;p++){const m=s.positionAt(p,a,o),g=s.positionAt(p,c,o);u.replace(u.mapping.slice(d).map(m+t),u.mapping.slice(d).map(g+t),new v(i.rows[p-l],0,0))}h(),u.setSelection(new F(u.doc.resolve(t+s.positionAt(l,a,o)),u.doc.resolve(t+s.positionAt(f-1,c-1,o)))),e(u)}var pT=kl({ArrowLeft:Er("horiz",-1),ArrowRight:Er("horiz",1),ArrowUp:Er("vert",-1),ArrowDown:Er("vert",1),"Shift-ArrowLeft":Mr("horiz",-1),"Shift-ArrowRight":Mr("horiz",1),"Shift-ArrowUp":Mr("vert",-1),"Shift-ArrowDown":Mr("vert",1),Backspace:Nr,"Mod-Backspace":Nr,Delete:Nr,"Mod-Delete":Nr});function Ur(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Er(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;if(o instanceof F)return Ur(t,r,A.near(o.$headCell,e));if(n!="horiz"&&!o.empty)return!1;const s=Fp(i,n,e);if(s==null)return!1;if(n=="horiz")return Ur(t,r,A.near(t.doc.resolve(o.head+e),e));{const l=t.doc.resolve(s),a=Pp(l,n,e);let c;return a?c=A.near(a,1):e<0?c=A.near(t.doc.resolve(l.before(-1)),-1):c=A.near(t.doc.resolve(l.after(-1)),1),Ur(t,r,c)}}}function Mr(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;let s;if(o instanceof F)s=o;else{const a=Fp(i,n,e);if(a==null)return!1;s=new F(t.doc.resolve(a))}const l=Pp(s.$headCell,n,e);return l?Ur(t,r,new F(s.$anchorCell,l)):!1}}function Nr(n,e){const t=n.selection;if(!(t instanceof F))return!1;if(e){const r=n.tr,i=ne(n.schema).cell.createAndFill().content;t.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new v(i,0,0))}),r.docChanged&&e(r)}return!0}function mT(n,e){const t=n.state.doc,r=Rn(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new F(r))),!0):!1}function gT(n,e,t){if(!Ee(n.state))return!1;let r=fT(t);const i=n.state.selection;if(i instanceof F){r||(r={width:1,height:1,rows:[b.from(al(ne(n.state.schema).cell,t))]});const o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),l=W.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=dT(r,l.right-l.left,l.bottom-l.top),mu(n.state,n.dispatch,s,l,r),!0}else if(r){const o=uo(n.state),s=o.start(-1);return mu(n.state,n.dispatch,s,W.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function yT(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=gu(n,e.target);let i;if(e.shiftKey&&n.state.selection instanceof F)o(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Rn(n.state.selection.$anchor))!=null&&((t=ss(n,e))==null?void 0:t.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(a,c){let f=ss(n,c);const u=gt.getState(n.state)==null;if(!f||!sa(a,f))if(u)f=a;else return;const d=new F(a,f);if(u||!n.state.selection.eq(d)){const h=n.state.tr.setSelection(d);u&&h.setMeta(gt,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),gt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(gt,-1))}function l(a){const c=a,f=gt.getState(n.state);let u;if(f!=null)u=n.state.doc.resolve(f);else if(gu(n,c.target)!=r&&(u=ss(n,e),!u))return s();u&&o(u,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function Fp(n,e,t){if(!(n.state.selection instanceof R))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const l=r.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function gu(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ss(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?Rn(n.state.doc.resolve(t.pos)):null}var bT=class{constructor(n,e){this.node=n,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),cl(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,cl(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function cl(n,e,t,r,i,o){var s;let l=0,a=!0,c=e.firstChild;const f=n.firstChild;if(f){for(let u=0,d=0;u<f.childCount;u++){const{colspan:h,colwidth:p}=f.child(u).attrs;for(let m=0;m<h;m++,d++){const g=i==d?o:p&&p[m],y=g?g+"px":"";l+=g||r,g||(a=!1),c?(c.style.width!=y&&(c.style.width=y),c=c.nextSibling):e.appendChild(document.createElement("col")).style.width=y}}for(;c;){const u=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=u}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var be=new Tn("tableColumnResizing");function ST({handleWidth:n=5,cellMinWidth:e=25,View:t=bT,lastColumnResizable:r=!0}={}){const i=new Kt({key:be,state:{init(o,s){var l,a;const c=(a=(l=i.spec)==null?void 0:l.props)==null?void 0:a.nodeViews,f=ne(s.schema).table.name;return t&&c&&(c[f]=(u,d)=>new t(u,e,d)),new vT(-1,!1)},apply(o,s){return s.apply(o)}},props:{attributes:o=>{const s=be.getState(o);return s&&s.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,s)=>{wT(o,s,n,e,r)},mouseleave:o=>{xT(o)},mousedown:(o,s)=>{CT(o,s,e)}},decorations:o=>{const s=be.getState(o);if(s&&s.activeHandle>-1)return MT(o,s.activeHandle)},nodeViews:{}}});return i}var vT=class Jr{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(be);if(r&&r.setHandle!=null)return new Jr(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Jr(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return ll(e.doc.resolve(i))||(i=-1),new Jr(i,t.dragging)}return t}};function wT(n,e,t,r,i){const o=be.getState(n.state);if(o&&!o.dragging){const s=OT(e.target);let l=-1;if(s){const{left:a,right:c}=s.getBoundingClientRect();e.clientX-a<=t?l=yu(n,e,"left",t):c-e.clientX<=t&&(l=yu(n,e,"right",t))}if(l!=o.activeHandle){if(!i&&l!==-1){const a=n.state.doc.resolve(l),c=a.node(-1),f=W.get(c),u=a.start(-1);if(f.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==f.width-1)return}jp(n,l)}}}function xT(n){const e=be.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&jp(n,-1)}function CT(n,e,t){var r;const i=(r=n.dom.ownerDocument.defaultView)!=null?r:window,o=be.getState(n.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const s=n.state.doc.nodeAt(o.activeHandle),l=kT(n,o.activeHandle,s.attrs);n.dispatch(n.state.tr.setMeta(be,{setDragging:{startX:e.clientX,startWidth:l}}));function a(f){i.removeEventListener("mouseup",a),i.removeEventListener("mousemove",c);const u=be.getState(n.state);u!=null&&u.dragging&&(AT(n,u.activeHandle,bu(u.dragging,f,t)),n.dispatch(n.state.tr.setMeta(be,{setDragging:null})))}function c(f){if(!f.which)return a(f);const u=be.getState(n.state);if(u&&u.dragging){const d=bu(u.dragging,f,t);TT(n,u.activeHandle,d,t)}}return i.addEventListener("mouseup",a),i.addEventListener("mousemove",c),e.preventDefault(),!0}function kT(n,e,{colspan:t,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=n.domAtPos(e);let l=o.node.childNodes[o.offset].offsetWidth,a=t;if(r)for(let c=0;c<t;c++)r[c]&&(l-=r[c],a--);return l/a}function OT(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function yu(n,e,t,r){const i=t=="right"?-r:r,o=n.posAtCoords({left:e.clientX+i,top:e.clientY});if(!o)return-1;const{pos:s}=o,l=Rn(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=W.get(l.node(-1)),c=l.start(-1),f=a.map.indexOf(l.pos-c);return f%a.width==0?-1:c+a.map[f-1]}function bu(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function jp(n,e){n.dispatch(n.state.tr.setMeta(be,{setHandle:e}))}function AT(n,e,t){const r=n.state.doc.resolve(e),i=r.node(-1),o=W.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<o.height;c++){const f=c*o.width+l;if(c&&o.map[f]==o.map[f-o.width])continue;const u=o.map[f],d=i.nodeAt(u).attrs,h=d.colspan==1?0:l-o.colCount(u);if(d.colwidth&&d.colwidth[h]==t)continue;const p=d.colwidth?d.colwidth.slice():ET(d.colspan);p[h]=t,a.setNodeMarkup(s+u,null,{...d,colwidth:p})}a.docChanged&&n.dispatch(a)}function TT(n,e,t,r){const i=n.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),l=W.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;let a=n.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&cl(o,a.firstChild,a,r,l,t)}function ET(n){return Array(n).fill(0)}function MT(n,e){const t=[],r=n.doc.resolve(e),i=r.node(-1);if(!i)return _.empty;const o=W.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let a=0;a<o.height;a++){const c=l+a*o.width;if((l==o.width-1||o.map[c]!=o.map[c+1])&&(a==0||o.map[c]!=o.map[c-o.width])){const f=o.map[c],u=s+f+i.nodeAt(f).nodeSize-1,d=document.createElement("div");d.className="column-resize-handle",t.push(ie.widget(u,d))}}return _.create(n.doc,t)}function We(n){const e=n.selection,t=uo(n),r=t.node(-1),i=t.start(-1),o=W.get(r);return{...e instanceof F?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(t.pos-i),tableStart:i,map:o,table:r}}function _p(n,{map:e,tableStart:t,table:r},i){let o=i>0?-1:0;nT(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,$p(c.attrs,i-e.colCount(a))),s+=c.attrs.rowspan-1}else{const a=o==null?ne(r.type.schema).cell:r.nodeAt(e.map[l+o]).type,c=e.positionAt(s,i,r);n.insert(n.mapping.map(t+c),a.createAndFill())}}return n}function NT(n,e){if(!Ee(n))return!1;if(e){const t=We(n);e(_p(n.tr,t,t.left))}return!0}function RT(n,e){if(!Ee(n))return!1;if(e){const t=We(n);e(_p(n.tr,t,t.right))}return!0}function IT(n,{map:e,table:t,tableStart:r},i){const o=n.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+i,a=e.map[l],c=t.nodeAt(a),f=c.attrs;if(i>0&&e.map[l-1]==a||i<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(o).map(r+a),null,Ut(f,i-e.colCount(a)));else{const u=n.mapping.slice(o).map(r+a);n.delete(u,u+c.nodeSize)}s+=f.rowspan}}function DT(n,e){if(!Ee(n))return!1;if(e){const t=We(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let i=t.right-1;IT(r,t,i),i!=t.left;i--){const o=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!o)throw RangeError("No table found");t.table=o,t.map=W.get(o)}e(r)}return!0}function PT(n,e,t){var r;const i=ne(e.type.schema).header_cell;for(let o=0;o<n.width;o++)if(((r=e.nodeAt(n.map[o+t*n.width]))==null?void 0:r.type)!=i)return!1;return!0}function Vp(n,{map:e,tableStart:t,table:r},i){var o;let s=t;for(let c=0;c<i;c++)s+=r.child(c).nodeSize;const l=[];let a=i>0?-1:0;PT(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let c=0,f=e.width*i;c<e.width;c++,f++)if(i>0&&i<e.height&&e.map[f]==e.map[f-e.width]){const u=e.map[f],d=r.nodeAt(u).attrs;n.setNodeMarkup(t+u,null,{...d,rowspan:d.rowspan+1}),c+=d.colspan-1}else{const u=a==null?ne(r.type.schema).cell:(o=r.nodeAt(e.map[f+a*e.width]))==null?void 0:o.type,d=u==null?void 0:u.createAndFill();d&&l.push(d)}return n.insert(s,ne(r.type.schema).row.create(null,l)),n}function $T(n,e){if(!Ee(n))return!1;if(e){const t=We(n);e(Vp(n.tr,t,t.top))}return!0}function BT(n,e){if(!Ee(n))return!1;if(e){const t=We(n);e(Vp(n.tr,t,t.bottom))}return!0}function zT(n,{map:e,table:t,tableStart:r},i){let o=0;for(let c=0;c<i;c++)o+=t.child(c).nodeSize;const s=o+t.child(i).nodeSize,l=n.mapping.maps.length;n.delete(o+r,s+r);const a=new Set;for(let c=0,f=i*e.width;c<e.width;c++,f++){const u=e.map[f];if(!a.has(u)){if(a.add(u),i>0&&u==e.map[f-e.width]){const d=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(l).map(u+r),null,{...d,rowspan:d.rowspan-1}),c+=d.colspan-1}else if(i<e.height&&u==e.map[f+e.width]){const d=t.nodeAt(u),h=d.attrs,p=d.type.create({...h,rowspan:d.attrs.rowspan-1},d.content),m=e.positionAt(i+1,c,t);n.insert(n.mapping.slice(l).map(r+m),p),c+=h.colspan-1}}}}function LT(n,e){if(!Ee(n))return!1;if(e){const t=We(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let i=t.bottom-1;zT(r,t,i),i!=t.top;i--){const o=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!o)throw RangeError("No table found");t.table=o,t.map=W.get(t.table)}e(r)}return!0}function Su(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function FT({width:n,height:e,map:t},r){let i=r.top*n+r.left,o=i,s=(r.bottom-1)*n+r.left,l=i+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&t[o]==t[o-1]||r.right<n&&t[l]==t[l+1])return!0;o+=n,l+=n}for(let a=r.left;a<r.right;a++){if(r.top>0&&t[i]==t[i-n]||r.bottom<e&&t[s]==t[s+n])return!0;i++,s++}return!1}function jT(n,e){const t=n.selection;if(!(t instanceof F)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=We(n),{map:i}=r;if(FT(i,r))return!1;if(e){const o=n.tr,s={};let l=b.empty,a,c;for(let f=r.top;f<r.bottom;f++)for(let u=r.left;u<r.right;u++){const d=i.map[f*i.width+u],h=r.table.nodeAt(d);if(!(s[d]||!h))if(s[d]=!0,a==null)a=d,c=h;else{Su(h)||(l=l.append(h.content));const p=o.mapping.map(d+r.tableStart);o.delete(p,p+h.nodeSize)}}if(a==null||c==null)return!0;if(o.setNodeMarkup(a+r.tableStart,null,{...$p(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const f=a+1+c.content.size,u=Su(c)?a+1:f;o.replaceWith(u+r.tableStart,f+r.tableStart,l)}o.setSelection(new F(o.doc.resolve(a+r.tableStart))),e(o)}return!0}function _T(n,e){const t=ne(n.schema);return VT(({node:r})=>t[r.type.spec.tableRole])(n,e)}function VT(n){return(e,t)=>{var r;const i=e.selection;let o,s;if(i instanceof F){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;o=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos}else{if(o=ZA(i.$from),!o)return!1;s=(r=Rn(i.$from))==null?void 0:r.pos}if(o==null||s==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(t){let l=o.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const f=We(e),u=e.tr;for(let h=0;h<f.right-f.left;h++)a.push(c?{...l,colwidth:c&&c[h]?[c[h]]:null}:l);let d;for(let h=f.top;h<f.bottom;h++){let p=f.map.positionAt(h,f.left,f.table);h==f.top&&(p+=o.nodeSize);for(let m=f.left,g=0;m<f.right;m++,g++)m==f.left&&h==f.top||u.insert(d=u.mapping.map(p+f.tableStart,1),n({node:o,row:h,col:m}).createAndFill(a[g]))}u.setNodeMarkup(s,n({node:o,row:f.top,col:f.left}),a[0]),i instanceof F&&u.setSelection(new F(u.doc.resolve(i.$anchorCell.pos),d?u.doc.resolve(d):void 0)),t(u)}return!0}}function WT(n,e){return function(t,r){if(!Ee(t))return!1;const i=uo(t);if(i.nodeAfter.attrs[n]===e)return!1;if(r){const o=t.tr;t.selection instanceof F?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&o.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[n]:e}),r(o)}return!0}}function HT(n){return function(e,t){if(!Ee(e))return!1;if(t){const r=ne(e.schema),i=We(e),o=e.tr,s=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=s.map(a=>i.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[a],r.cell,l[a].attrs);if(o.steps.length==0)for(let a=0;a<s.length;a++)o.setNodeMarkup(i.tableStart+s[a],r.header_cell,l[a].attrs);t(o)}return!0}}function vu(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const o=e.table.nodeAt(r[i]);if(o&&o.type!==t.header_cell)return!1}return!0}function ho(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?HT(n):function(t,r){if(!Ee(t))return!1;if(r){const i=ne(t.schema),o=We(t),s=t.tr,l=vu("row",o,i),a=vu("column",o,i),f=(n==="column"?l:n==="row"?a:!1)?1:0,u=n=="column"?{left:0,top:f,right:1,bottom:o.map.height}:n=="row"?{left:f,top:0,right:o.map.width,bottom:1}:o,d=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;o.map.cellsInRect(u).forEach(h=>{const p=h+o.tableStart,m=s.doc.nodeAt(p);m&&s.setNodeMarkup(p,d,m.attrs)}),r(s)}return!0}}ho("row",{useDeprecatedLogic:!0});ho("column",{useDeprecatedLogic:!0});var UT=ho("cell",{useDeprecatedLogic:!0});function JT(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,i=n.before();r>=0;r--){const o=n.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),i=n.after();r<t.childCount;r++){const o=t.child(r);if(o.childCount)return i+1;i+=o.nodeSize}}return null}function KT(n){return function(e,t){if(!Ee(e))return!1;const r=JT(uo(e),n);if(r==null)return!1;if(t){const i=e.doc.resolve(r);t(e.tr.setSelection(R.between(i,tT(i))).scrollIntoView())}return!0}}function qT(n,e){const t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function GT({allowTableNodeSelection:n=!1}={}){return new Kt({key:gt,state:{init(){return null},apply(e,t){const r=e.getMeta(gt);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:i,pos:o}=e.mapping.mapResult(t);return i?null:o}},props:{decorations:iT,handleDOMEvents:{mousedown:yT},createSelectionBetween(e){return gt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:mT,handleKeyDown:pT,handlePaste:gT},appendTransaction(e,t,r){return lT(r,Lp(r,t),n)}})}exports.AllSelection=Se;exports.CellSelection=F;exports.DOMParser=gn;exports.DOMSerializer=Jt;exports.Decoration=ie;exports.DecorationSet=_;exports.EditorState=an;exports.EditorView=yy;exports.Fragment=b;exports.Node=Oe;exports.NodeSelection=C;exports.Plugin=Kt;exports.PluginKey=Tn;exports.ReplaceAroundStep=K;exports.ReplaceStep=J;exports.Schema=om;exports.Selection=A;exports.Slice=v;exports.TextSelection=R;exports.Transform=pl;exports.addColumnAfter=RT;exports.addColumnBefore=NT;exports.addRowAfter=BT;exports.addRowBefore=$T;exports.canJoin=An;exports.canSplit=dl;exports.clamp=Ok;exports.clsx=Zy;exports.columnResizing=ST;exports.createParagraphNear=Fy;exports.cva=Ow;exports.debounce=yp;exports.deepEqual=Cw;exports.deleteColumn=DT;exports.deleteRow=LT;exports.deleteSelection=Ty;exports.deleteTable=qT;exports.differenceBy=FO;exports.dropCursor=jA;exports.exitCode=Ly;exports.find=NA;exports.findWrapping=ul;exports.fixTables=Lp;exports.gapCursor=HA;exports.goToNextCell=KT;exports.history=FA;exports.isNumber=_O;exports.joinBackward=Ey;exports.joinDown=$y;exports.joinForward=Iy;exports.joinPoint=hl;exports.joinTextblockBackward=My;exports.joinTextblockForward=Ny;exports.joinUp=Py;exports.keymap=Ay;exports.lift=By;exports.liftEmptyBlock=jy;exports.liftListItem=Gy;exports.liftTarget=On;exports.mergeCells=jT;exports.newlineInCode=zy;exports.redo=Dp;exports.registerCustomProtocol=EA;exports.reset=TA;exports.selectNodeBackward=Ry;exports.selectNodeForward=Dy;exports.selectParentNode=_y;exports.selectTextblockEnd=Hy;exports.selectTextblockStart=Wy;exports.setBlockType=Jy;exports.setCellAttr=WT;exports.sinkListItem=Qy;exports.splitCell=_T;exports.tableEditing=GT;exports.throttle=sA;exports.toggleHeader=ho;exports.toggleHeaderCell=UT;exports.tokenize=Mp;exports.truncate=fA;exports.twMerge=R0;exports.undo=Ip;exports.wrapIn=Uy;exports.wrapInList=Ky;