reactjs-tiptap-editor 0.0.56 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.cts +62 -62
- package/lib/index.d.ts +62 -62
- package/lib/{locales-E7ejmU-m.js → locales-D6NQ9Tfs.js} +1 -1
- package/lib/{locales-CLNCJZPj.cjs → locales-DgiqaWhF.cjs} +1 -1
- package/lib/reactjs-tiptap-editor.cjs +1 -1
- package/lib/reactjs-tiptap-editor.js +2 -2
- package/lib/style.css +1 -1
- package/lib/tiptap-CRe0XXRC.cjs +116 -0
- package/lib/{tiptap-Mwj1-K_2.js → tiptap-CdsHMSoj.js} +1565 -1315
- package/lib/{utils-CJjl6DGr.js → utils-Bt41TDVm.js} +135 -135
- package/lib/utils-DByjaZDH.cjs +152 -0
- package/lib/vendor-BzT-edVs.cjs +20 -0
- package/lib/{vendor-BrYdTHr0.js → vendor-wdh2A0rt.js} +8692 -4151
- package/package.json +2 -3
- package/lib/tiptap-BFNxun5r.cjs +0 -116
- package/lib/utils-BO7sFdSV.cjs +0 -151
- package/lib/vendor-CKt2gBNV.cjs +0 -18
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";const Gy=require("react"),qy=require("react-dom");function fe(n){this.content=n}fe.prototype={constructor:fe,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 fe(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 fe(t)},addToStart:function(n,e){return new fe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new fe(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 fe(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=fe.from(n),n.size?new fe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=fe.from(n),n.size?new fe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=fe.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}};fe.from=function(n){if(n instanceof fe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new fe(e)};function Bd(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=Bd(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function zd(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=zd(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 Bd(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return zd(this,e,t,r)}findIndex(e,t=-1){if(e==0)return pi(0,e);if(e==this.size)return pi(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?pi(r+1,s):pi(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 Ps={index:0,offset:0};function pi(n,e){return Ps.index=n,Ps.offset=e,Ps}function eo(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(!eo(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!eo(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}class F{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&&eo(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 F.none;if(e instanceof F)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}}F.none=[];class to 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=jd(this.content,e+this.openStart,t);return r&&new v(r,this.openStart,this.openEnd)}removeBetween(e,t){return new v(Fd(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 Fd(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(Fd(o.content,e-i-1,t-i-1)))}function jd(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=jd(s.content,e-o-1,t);return l&&n.replaceChild(i,s.copy(l))}function Yy(n,e,t){if(t.openStart>n.depth)throw new to("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new to("Inconsistent open depths");return Vd(n,e,t,0)}function Vd(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=Vd(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 cn(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=Xy(t,n);return cn(o,Ud(n,s,l,e,r))}else return cn(o,no(n,e,r))}function Wd(n,e){if(!e.type.compatibleContent(n.type))throw new to("Cannot join "+e.type.name+" onto "+n.type.name)}function Ll(n,e,t){let r=n.node(t);return Wd(r,e.node(t)),r}function an(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 Er(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&&(an(n.nodeAfter,r),o++));for(let l=o;l<s;l++)an(i.child(l),r);e&&e.depth==t&&e.textOffset&&an(e.nodeBefore,r)}function cn(n,e){return n.type.checkContent(e),n.copy(e)}function Ud(n,e,t,r,i){let o=n.depth>i&&Ll(n,e,i+1),s=r.depth>i&&Ll(t,r,i+1),l=[];return Er(null,n,i,l),o&&s&&e.index(i)==t.index(i)?(Wd(o,s),an(cn(o,Ud(n,e,t,r,i+1)),l)):(o&&an(cn(o,no(n,e,i+1)),l),Er(e,t,i,l),s&&an(cn(s,no(t,r,i+1)),l)),Er(r,null,i,l),new b(l)}function no(n,e,t){let r=[];if(Er(null,n,t,r),n.depth>t){let i=Ll(n,e,t+1);an(cn(i,no(n,e,t+1)),r)}return Er(e,null,t,r),new b(r)}function Xy(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 zr{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 F.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 Fr(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 zr(t,r,o)}static resolveCached(e,t){let r=rf.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 rf.set(e,r=new Qy);let i=r.elts[r.i]=zr.resolve(e,t);return r.i=(r.i+1)%Zy,i}}class Qy{constructor(){this.elts=[],this.i=0}}const Zy=12,rf=new WeakMap;class Fr{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 eb=Object.create(null);class je{constructor(e,t,r,i=F.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&&eo(this.attrs,t||e.defaultAttrs||eb)&&F.sameSet(this.marks,r||F.none)}copy(e=null){return e==this.content?this:new je(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new je(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 Yy(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 zr.resolveCached(this,e)}resolveNoCache(e){return zr.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()+")"),Hd(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=F.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(!F.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}}je.prototype.text=void 0;class ro extends je{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):Hd(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 ro(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ro(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 Hd(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class gn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new tb(e,t);if(r.next==null)return gn.empty;let i=Jd(r);r.next&&r.err("Unexpected trailing text");let o=ab(lb(i));return cb(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 h=o(u,l.concat(f));if(h)return h}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let 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
|
+
`)}}gn.empty=new gn(!0);class tb{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 Jd(n){let e=[];do e.push(nb(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function nb(n){let e=[];do e.push(rb(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function rb(n){let e=sb(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=ib(n,e);else break;return e}function of(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function ib(n,e){let t=of(n),r=t;return n.eat(",")&&(n.next!="}"?r=of(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function ob(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 sb(n){if(n.eat("(")){let e=Jd(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=ob(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 lb(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 Kd(n,e){return e-n}function sf(n,e){let t=[];return r(e),t.sort(Kd);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 ab(n){let e=Object.create(null);return t(sf(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]);sf(n,a).forEach(f=>{c||i.push([l,c=[]]),c.indexOf(f)==-1&&c.push(f)})})});let o=e[r.join(",")]=new gn(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort(Kd);o.next.push({type:i[s][0],next:e[l.join(",")]||t(l)})}return o}}function cb(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 Gd(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 qd(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 Yd(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 Xd(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new ub(n,r,e[r]);return t}let lf=class Qd{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=Xd(e,r.attrs),this.defaultAttrs=Gd(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==gn.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:qd(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new je(this,this.computeAttrs(e),b.from(t),F.setFrom(r))}createChecked(e=null,t,r){return t=b.from(t),this.checkContent(t),new je(this,this.computeAttrs(e),t,F.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 je(this,e,t.append(o),F.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){Yd(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:F.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new Qd(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 fb(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 ub{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?fb(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class ds{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Xd(e,i.attrs),this.excluded=null;let o=Gd(this.attrs);this.instance=o?new F(this,o):null}create(e=null){return!e&&this.instance?this.instance:new F(this,qd(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new ds(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){Yd(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class hb{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=fe.from(e.nodes),t.marks=fe.from(e.marks||{}),this.nodes=lf.compile(this.spec.nodes,this),this.marks=ds.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]=gn.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?af(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==""?[]:af(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 lf){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 ro(r,r.defaultAttrs,e,F.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return je.fromJSON(this,e)}markFromJSON(e){return F.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function af(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 db(n){return n.tag!=null}function pb(n){return n.style!=null}let Ga=class Bl{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(db(i))this.tags.push(i);else if(pb(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 ff(this,t,!1);return r.addAll(e,F.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ff(this,t,!0);return r.addAll(e,F.none,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(yb(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=uf(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=uf(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Bl(e,Bl.schemaRules(e)))}};const Zd={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},gb={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ep={ol:!0,ul:!0},io=1,oo=2,Ar=4;function cf(n,e,t){return e!=null?(e?io:0)|(e==="full"?oo:0):n&&n.whitespace=="pre"?io|oo:t&~Ar}class gi{constructor(e,t,r,i,o,s){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=F.none,this.match=o||(s&Ar?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&io)){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}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Zd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ff{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let i=t.topNode,o,s=cf(null,t.preserveWhitespace,0)|(r?Ar:0);i?o=new gi(i.type,i.attrs,F.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new gi(null,null,F.none,!0,null,s):o=new gi(e.schema.topNodeType,null,F.none,!0,null,s),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top;if(i.options&oo||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i.options&io)i.options&oo?r=r.replace(/\r\n?/g,`
|
|
3
|
+
`):r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],s=e.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=e.nodeName.toLowerCase(),o;ep.hasOwnProperty(i)&&this.parser.normalizeLists&&mb(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));if(s?s.ignore:gb.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let l,a=this.top,c=this.needsBlock;if(Zd.hasOwnProperty(i))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),l=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);return}let f=s&&s.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),l&&this.sync(a),this.needsBlock=c}else{let l=this.readStyles(e,t);l&&this.addElementByRule(e,s,l,s.consuming===!1?o:void 0)}}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
|
+
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(o,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let o,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r)||this.leafFallback(e,r);else{let a=this.enter(s,t.attrs||null,r,t.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r)}o&&this.sync(l)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];s!=l;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,t);this.findAtPoint(e,o)}findPlace(e,t){let r,i;for(let o=this.open;o>=0;o--){let s=this.nodes[o],l=s.findWrapping(e);if(l&&(!r||r.length>l.length)&&(r=l,i=s,!l.length)||s.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)t=this.enterInner(r[o],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=F.none;for(let s of r.concat(e.marks))(i.type?i.type.allowsMarkType(s.type):hf(s.type,e.type))&&(o=s.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=cf(e,o,s.options);s.options&Ar&&s.content.length==0&&(l|=Ar);let a=F.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):hf(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new gi(e,t,a,i,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;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}}}function mb(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ep.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function yb(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function uf(n){let e={};for(let t in n)e[t]=n[t];return e}function hf(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}}class vn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=$s(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}=_i($s(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&&_i($s(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return _i(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new vn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=df(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return df(e.marks)}}function df(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function $s(n){return n.document||window.document}const pf=new WeakMap;function bb(n){let e=pf.get(n);return e===void 0&&pf.set(n,e=wb(n)),e}function wb(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 _i(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=bb(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 h=u.indexOf(" ");h>0?a.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):a.setAttribute(u,c[u])}}for(let u=f;u<e.length;u++){let h=e[u];if(h===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:d,contentDOM:p}=_i(n,h,t,r);if(a.appendChild(d),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const tp=65535,np=Math.pow(2,16);function Sb(n,e){return n+e*np}function gf(n){return n&tp}function vb(n){return(n-(n&tp))/np}const rp=1,ip=2,Pi=4,op=8;class zl{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&op)>0}get deletedBefore(){return(this.delInfo&(rp|Pi))>0}get deletedAfter(){return(this.delInfo&(ip|Pi))>0}get deletedAcross(){return(this.delInfo&Pi)>0}}class Te{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Te.empty)return Te.empty}recover(e){let t=0,r=gf(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+vb(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 h=c?e==a?-1:e==u?1:t:t,d=a+i+(h<0?0:f);if(r)return d;let p=e==(t<0?a:u)?null:Sb(l/3,e-a),g=e==a?ip:e==u?rp:Pi;return(t<0?e!=a:e!=u)&&(g|=op),new zl(d,g,p)}i+=f-c}return r?e+i:new zl(e+i,0,null)}touches(e,t){let r=0,i=gf(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 Te(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Te.empty:new Te(e<0?[0,-e,0]:[0,0,e])}}Te.empty=new Te([]);class zn{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 zn(this.maps,this.mirror,e,t)}copy(){return new zn(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 zn;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 zl(e,i,null)}}const Ls=Object.create(null);class we{getMap(){return Te.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ls[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ls)throw new RangeError("Duplicate use of step JSON ID "+e);return Ls[e]=t,t.prototype.jsonID=e,t}}class te{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new te(e,null)}static fail(e){return new te(null,e)}static fromReplace(e,t,r,i){try{return te.ok(e.replace(t,r,i))}catch(o){if(o instanceof to)return te.fail(o.message);throw o}}}function qa(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(qa(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return b.fromArray(r)}class Ft extends we{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(qa(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 te.fromReplace(e,this.from,this.to,o)}invert(){return new Xe(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 Ft(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ft&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ft(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"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 Ft(t.from,t.to,e.markFromJSON(t.mark))}}we.jsonID("addMark",Ft);class Xe extends we{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(qa(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return te.fromReplace(e,this.from,this.to,r)}invert(){return new Ft(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 Xe(t.pos,r.pos,this.mark)}merge(e){return e instanceof Xe&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Xe(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 Xe(t.from,t.to,e.markFromJSON(t.mark))}}we.jsonID("removeMark",Xe);class jt extends we{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return te.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return te.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 jt(this.pos,t.marks[i]);return new jt(this.pos,this.mark)}}return new Jn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new jt(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 jt(t.pos,e.markFromJSON(t.mark))}}we.jsonID("addNodeMark",jt);class Jn extends we{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return te.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return te.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 jt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Jn(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 Jn(t.pos,e.markFromJSON(t.mark))}}we.jsonID("removeNodeMark",Jn);class oe extends we{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Fl(e,this.from,this.to)?te.fail("Structure replace would overwrite content"):te.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Te([this.from,this.to-this.from,this.slice.size])}invert(e){return new oe(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 oe(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof oe)||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 oe(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 oe(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 oe(t.from,t.to,v.fromJSON(e,t.slice),!!t.structure)}}we.jsonID("replace",oe);class se extends we{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&&(Fl(e,this.from,this.gapFrom)||Fl(e,this.gapTo,this.to)))return te.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return te.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?te.fromReplace(e,this.from,this.to,r):te.fail("Content does not fit in gap")}getMap(){return new Te([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 se(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 se(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 se(t.from,t.to,t.gapFrom,t.gapTo,v.fromJSON(e,t.slice),t.insert,!!t.structure)}}we.jsonID("replaceAround",se);function Fl(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 Cb(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 h=Math.max(c,e),d=Math.min(c+a.nodeSize,t),p=r.addToSet(u);for(let g=0;g<u.length;g++)u[g].isInSet(p)||(s&&s.to==h&&s.mark.eq(u[g])?s.to=d:i.push(s=new Xe(h,d,u[g])));l&&l.to==h?l.to=d:o.push(l=new Ft(h,d,r))}}),i.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function xb(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 ds){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],h;for(let d=0;d<i.length;d++){let p=i[d];p.step==o-1&&u.eq(i[d].style)&&(h=p)}h?(h.to=c,h.step=o):i.push({style:u,from:Math.max(l,e),to:c,step:o})}}}),i.forEach(s=>n.step(new Xe(s.from,s.to,s.style)))}function sp(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 oe(l,f,v.empty));else{r=u;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||n.step(new Xe(l,f,c.marks[h]));if(i&&c.isText&&t.whitespace!="pre"){let h,d=/\r?\n|\r/g,p;for(;h=d.exec(c.text);)p||(p=new v(b.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new oe(l+h.index,l+h.index+h[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 kb(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function or(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||!kb(i,o,s))break}return null}function Ob(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,g=!1;p>t;p--)g||r.index(p)>0?(g=!0,f=b.from(r.node(p).copy(f)),u++):a--;let h=b.empty,d=0;for(let p=o,g=!1;p>t;p--)g||i.after(p+1)<i.end(p)?(g=!0,h=b.from(i.node(p).copy(h)),d++):c++;n.step(new se(a,c,s,l,new v(f.append(h),u,d),f.size-u,!0))}function Ya(n,e,t=null,r=n){let i=Eb(n,e),o=i&&Ab(r,e);return o?i.map(mf).concat({type:e,attrs:t}).concat(o.map(mf)):null}function mf(n){return{type:n,attrs:null}}function Eb(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 Ab(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 Tb(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 se(i,o,i,o,new v(r,0,0),t.length,!0))}function Mb(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)=>{let a=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,a)&&Db(n.doc,n.mapping.slice(o).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let d=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);d&&!p?c=!1:!d&&p&&(c=!0)}c===!1&&Ib(n,s,l,o),sp(n,n.mapping.slice(o).map(l,1),r,void 0,c===null);let f=n.mapping.slice(o),u=f.map(l,1),h=f.map(l+s.nodeSize,1);return n.step(new se(u,h,u+1,h-1,new v(b.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Nb(n,s,l,o),!1}})}function Nb(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 Ib(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 Db(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Rb(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 se(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new v(b.from(s),0,0),1,!0))}function Xa(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),h=i.index(c);if(u.type.spec.isolating)return!1;let d=u.content.cutByIndex(h,u.childCount),p=r&&r[f+1];p&&(d=d.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[f]||u;if(!u.canReplace(h+1,u.childCount)||!g.type.validContent(d))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 _b(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 oe(e,e,new v(o.append(s),t,t),!0))}function sr(n,e){let t=n.resolve(e),r=t.index();return lp(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function lp(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function Qa(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&&lp(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 Pb(n,e,t){let r=new oe(e-t,e+t,v.empty,!0);n.step(r)}function $b(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 ap(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 ps(n,e,t=e,r=v.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return cp(i,o,r)?new oe(e,t,r):new Lb(i,o,r).fit()}function cp(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Lb{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 se(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new oe(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=Bs(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=Bs(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=Bs(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new v(xr(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new v(xr(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 g=0;g<o.length;g++)this.openFrontierNode(o[g]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,f=[],{match:u,type:h}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)f.push(i.child(g));u=u.matchFragment(i)}let d=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let g=l.child(c),m=u.matchType(g.type);if(!m)break;c++,(c>1||a==0||g.content.size)&&(u=m,f.push(fp(g.mark(h.allowedMarks(g.marks)),c==1?a:0,c==l.childCount?d:-1)))}let p=c==l.childCount;p||(d=-1),this.placed=kr(this.placed,t,b.from(f)),this.frontier[t].match=u,p&&d<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,m=l;g<d;g++){let y=m.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),m=y.content}this.unplaced=p?e==0?v.empty:new v(xr(s.content,e-1,1),e-1,d<0?s.openEnd:e-1):new v(xr(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||!zs(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=zs(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],f=zs(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=kr(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=kr(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=kr(this.placed,this.frontier.length,t))}}function xr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(xr(n.firstChild.content,e-1,t)))}function kr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(kr(n.lastChild.content,e-1,t)))}function Bs(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function fp(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,fp(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 zs(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&&!Bb(t,o.content,s)?l:null}function Bb(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function zb(n){return n.spec.defining||n.spec.definingForContent}function Fb(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(cp(i,o,r))return n.step(new oe(e,t,r));let s=hp(i,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let h=i.depth,d=i.pos-1;h>0;h--,d--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(h)>-1?l=h:i.before(h)==d&&s.splice(1,0,-h)}let a=s.indexOf(l),c=[],f=r.openStart;for(let h=r.content,d=0;;d++){let p=h.firstChild;if(c.push(p),d==r.openStart)break;h=p.content}for(let h=f-1;h>=0;h--){let d=c[h],p=zb(d.type);if(p&&!d.sameMarkup(i.node(Math.abs(l)-1)))f=h;else if(p||!d.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let d=(h+f+1)%(r.openStart+1),p=c[d];if(p)for(let g=0;g<s.length;g++){let m=s[(g+a)%s.length],y=!0;m<0&&(y=!1,m=-m);let x=i.node(m-1),O=i.index(m-1);if(x.canReplaceWith(O,O,p.type,p.marks))return n.replace(i.before(m),y?o.after(m):t,new v(up(r.content,0,r.openStart,d),d,r.openEnd))}}let u=n.steps.length;for(let h=s.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>u));h--){let d=s[h];d<0||(e=i.before(d),t=o.after(d))}}function up(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(up(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 jb(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=$b(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new v(b.from(r),0,0))}function Vb(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=hp(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 hp(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 Fn extends we{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 te.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 te.fromReplace(e,this.pos,this.pos+1,new v(b.from(i),0,t.isLeaf?0:1))}getMap(){return Te.empty}invert(e){return new Fn(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 Fn(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 Fn(t.pos,t.attr,t.value)}}we.jsonID("attr",Fn);class jr extends we{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 te.ok(r)}getMap(){return Te.empty}invert(e){return new jr(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 jr(t.attr,t.value)}}we.jsonID("docAttr",jr);let Kn=class extends Error{};Kn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Kn.prototype=Object.create(Error.prototype);Kn.prototype.constructor=Kn;Kn.prototype.name="TransformError";class Za{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new zn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Kn(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=ps(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 Fb(this,e,t,r),this}replaceRangeWith(e,t,r){return jb(this,e,t,r),this}deleteRange(e,t){return Vb(this,e,t),this}lift(e,t){return Ob(this,e,t),this}join(e,t=1){return Pb(this,e,t),this}wrap(e,t){return Tb(this,e,t),this}setBlockType(e,t=e,r,i=null){return Mb(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Rb(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Fn(e,t,r)),this}setDocAttribute(e,t){return this.step(new jr(e,t)),this}addNodeMark(e,t){return this.step(new jt(e,t)),this}removeNodeMark(e,t){if(!(t instanceof F)){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 Jn(e,t)),this}split(e,t=1,r){return _b(this,e,t,r),this}addMark(e,t,r){return Cb(this,e,t,r),this}removeMark(e,t,r){return xb(this,e,t,r),this}clearIncompatible(e,t,r){return sp(this,e,t,r),this}}const Fs=Object.create(null);class I{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new ec(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&&wf(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),wf(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new L(e):Dn(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?Dn(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):Dn(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 Pe(e.node(0))}static atStart(e){return Dn(e,e,0,0,1)||new Pe(e)}static atEnd(e){return Dn(e,e,e.content.size,e.childCount,-1)||new Pe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Fs[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 Fs)throw new RangeError("Duplicate use of selection JSON ID "+e);return Fs[e]=t,t.prototype.jsonID=e,t}getBookmark(){return L.between(this.$anchor,this.$head).getBookmark()}}I.prototype.visible=!0;class ec{constructor(e,t){this.$from=e,this.$to=t}}let yf=!1;function bf(n){!yf&&!n.parent.inlineContent&&(yf=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class L extends I{constructor(e,t=e){bf(e),bf(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 I.near(r);let i=e.resolve(t.map(this.anchor));return new L(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 L&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new gs(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 L(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=I.findFrom(t,r,!0)||I.findFrom(t,-r,!0);if(o)t=o.$head;else return I.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(I.findFrom(e,-r,!0)||I.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new L(e,t)}}I.jsonID("text",L);class gs{constructor(e,t){this.anchor=e,this.head=t}map(e){return new gs(e.map(this.anchor),e.map(this.head))}resolve(e){return L.between(e.resolve(this.anchor),e.resolve(this.head))}}class T extends I{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?I.near(o):new T(o)}content(){return new v(b.from(this.node),0,0)}eq(e){return e instanceof T&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new tc(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new T(e.resolve(t.anchor))}static create(e,t){return new T(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}T.prototype.visible=!1;I.jsonID("node",T);class tc{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new gs(r,r):new tc(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&T.isSelectable(r)?new T(t):I.near(t)}}class Pe extends I{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=I.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Pe(e)}map(e){return new Pe(e)}eq(e){return e instanceof Pe}getBookmark(){return Wb}}I.jsonID("all",Pe);const Wb={map(){return this},resolve(n){return new Pe(n)}};function Dn(n,e,t,r,i,o=!1){if(e.inlineContent)return L.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&&T.isSelectable(l))return T.create(n,t-(i<0?l.nodeSize:0))}else{let a=Dn(n,l,t+i,i<0?l.childCount:0,i,o);if(a)return a}t+=l.nodeSize*i}return null}function wf(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof oe||i instanceof se))return;let o=n.mapping.maps[r],s;o.forEach((l,a,c,f)=>{s==null&&(s=f)}),n.setSelection(I.near(n.doc.resolve(s),t))}const Sf=1,mi=2,vf=4;let Ub=class extends Za{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|Sf)&~mi,this.storedMarks=null,this}get selectionSet(){return(this.updated&Sf)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=mi,this}ensureMarks(e){return F.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&mi)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~mi,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)||F.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(I.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|=vf,this}get scrolledIntoView(){return(this.updated&vf)>0}};function Cf(n,e){return!e||!n?n:n.bind(e)}class Or{constructor(e,t,r){this.name=e,this.init=Cf(t.init,r),this.apply=Cf(t.apply,r)}}const Hb=[new Or("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Or("selection",{init(n,e){return n.selection||I.atStart(e.doc)},apply(n){return n.selection}}),new Or("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Or("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class js{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Hb.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 Or(r.key,r.spec.state,r))})}}class Ln{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 Ln(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 Ub(this)}static create(e){let t=new js(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ln(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 js(this.schema,e.plugins),r=t.fields,i=new Ln(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 js(e.schema,e.plugins),o=new Ln(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=je.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=I.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 dp(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=dp(i,e,{})),t[r]=i}return t}class Cn{constructor(e){this.spec=e,this.props={},e.props&&dp(e.props,this,this.props),this.key=e.key?e.key.key:pp("plugin")}getState(e){return e[this.key]}}const Vs=Object.create(null);function pp(n){return n in Vs?n+"$"+ ++Vs[n]:(Vs[n]=0,n+"$")}class Ct{constructor(e="key"){this.key=pp(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ue=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Vr=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let jl=null;const gt=function(n,e,t){let r=jl||(jl=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Jb=function(){jl=null},mn=function(n,e,t,r){return t&&(xf(n,e,t,r,-1)||xf(n,e,t,r,1))},Kb=/^(img|br|input|textarea|hr)$/i;function xf(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Re(n))){let o=n.parentNode;if(!o||o.nodeType!=1||ai(n)||Kb.test(n.nodeName)||n.contentEditable=="false")return!1;e=ue(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?Re(n):0}else return!1}}function Re(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Gb(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=Re(n)}else if(n.parentNode&&!ai(n))e=ue(n),n=n.parentNode;else return null}}function qb(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&&!ai(n))e=ue(n)+1,n=n.parentNode;else return null}}function Yb(n,e,t){for(let r=e==0,i=e==Re(n);r||i;){if(n==t)return!0;let o=ue(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==Re(n)}}function ai(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 ms=function(n){return n.focusNode&&mn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function rn(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Xb(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Qb(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Re(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Re(r.startContainer),r.startOffset)}}}const et=typeof navigator<"u"?navigator:null,kf=typeof document<"u"?document:null,Qt=et&&et.userAgent||"",Vl=/Edge\/(\d+)/.exec(Qt),gp=/MSIE \d/.exec(Qt),Wl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qt),Ee=!!(gp||Wl||Vl),Ht=gp?document.documentMode:Wl?+Wl[1]:Vl?+Vl[1]:0,We=!Ee&&/gecko\/(\d+)/i.test(Qt);We&&+(/Firefox\/(\d+)/.exec(Qt)||[0,0])[1];const Ul=!Ee&&/Chrome\/(\d+)/.exec(Qt),ge=!!Ul,mp=Ul?+Ul[1]:0,ve=!Ee&&!!et&&/Apple Computer/.test(et.vendor),Gn=ve&&(/Mobile\/\w+/.test(Qt)||!!et&&et.maxTouchPoints>2),De=Gn||(et?/Mac/.test(et.platform):!1),Zb=et?/Win/.test(et.platform):!1,ze=/Android \d/.test(Qt),ci=!!kf&&"webkitFontSmoothing"in kf.documentElement.style,e0=ci?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function t0(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 ct(n,e){return typeof n=="number"?n:n[e]}function n0(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 Of(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=Vr(s)){if(s.nodeType!=1)continue;let l=s,a=l==o.body,c=a?t0(o):n0(l),f=0,u=0;if(e.top<c.top+ct(r,"top")?u=-(c.top-e.top+ct(i,"top")):e.bottom>c.bottom-ct(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+ct(i,"top")-c.top:e.bottom-c.bottom+ct(i,"bottom")),e.left<c.left+ct(r,"left")?f=-(c.left-e.left+ct(i,"left")):e.right>c.right-ct(r,"right")&&(f=e.right-c.right+ct(i,"right")),f||u)if(a)o.defaultView.scrollBy(f,u);else{let h=l.scrollLeft,d=l.scrollTop;u&&(l.scrollTop+=u),f&&(l.scrollLeft+=f);let p=l.scrollLeft-h,g=l.scrollTop-d;e={left:e.left-p,top:e.top-g,right:e.right-p,bottom:e.bottom-g}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function r0(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:yp(n.dom)}}function yp(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Vr(r));return e}function i0({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;bp(t,r==0?0:r-e)}function bp(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 An=null;function o0(n){if(n.setActive)return n.setActive();if(An)return n.focus(An);let e=yp(n);n.focus(An==null?{get preventScroll(){return An={preventScroll:!0},!0}}:void 0),An||(An=!1,bp(e,0))}function wp(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 h;if(f.nodeType==1)h=f.getClientRects();else if(f.nodeType==3)h=gt(f).getClientRects();else continue;for(let d=0;d<h.length;d++){let p=h[d];if(p.top<=s&&p.bottom>=l){s=Math.max(p.bottom,s),l=Math.min(p.top,l);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){t=f,r=g,i=g&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,f.nodeType==1&&g&&(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?s0(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:wp(t,i)}function s0(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=Nt(r,1);if(o.top!=o.bottom&&nc(e,o))return{node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function nc(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function l0(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function a0(n,e,t){let{node:r,offset:i}=wp(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 c0(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 Sp(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(nc(e,c))return Sp(s,e,c)}}if((o=(o+1)%r)==i)break}return n}function f0(n,e){let t=n.dom.ownerDocument,r,i=0,o=Qb(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(!nc(e,c)||(s=Sp(n.dom,e,c),!s))return null}if(ve)for(let c=s;r&&c;c=Vr(c))c.draggable&&(r=void 0);if(s=l0(s,e),r){if(We&&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;ci&&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=c0(n,r,i,e))}l==null&&(l=a0(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Ef(n){return n.top<n.bottom||n.left<n.right}function Nt(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Ef(r))return r}return Array.prototype.find.call(t,Ef)||n.getBoundingClientRect()}const u0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function vp(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=ci||We;if(r.nodeType==3)if(s&&(u0.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=Nt(gt(r,i,i),t);if(We&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Nt(gt(r,i-1,i-1),-1);if(c.top==a.top){let f=Nt(gt(r,i,i+1),-1);if(f.top!=a.top)return mr(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++,mr(Nt(gt(r,a,c),f),f<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==Re(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Ws(a.getBoundingClientRect(),!1)}if(o==null&&i<Re(r)){let a=r.childNodes[i];if(a.nodeType==1)return Ws(a.getBoundingClientRect(),!0)}return Ws(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==Re(r))){let a=r.childNodes[i-1],c=a.nodeType==3?gt(a,Re(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return mr(Nt(c,1),!1)}if(o==null&&i<Re(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?gt(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return mr(Nt(c,-1),!0)}return mr(Nt(r.nodeType==3?gt(r):r,-t),t>=0)}function mr(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 Ws(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 Cp(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 h0(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return Cp(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=vp(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=gt(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 d0=/[\u0590-\u08ac]/;function p0(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?!d0.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:s:Cp(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:f,anchorOffset:u}=n.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",t,"character");let d=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:g}=n.domSelectionRange(),m=p&&!d.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==g;try{l.collapse(f,u),a&&(a!=f||c!=u)&&l.extend&&l.extend(a,c)}catch{}return h!=null&&(l.caretBidiLevel=h),m}):r.pos==r.start()||r.pos==r.end()}let Af=null,Tf=null,Mf=!1;function g0(n,e,t){return Af==e&&Tf==t?Mf:(Af=e,Tf=t,Mf=t=="up"||t=="down"?h0(n,e,t):p0(n,e,t))}const $e=0,Nf=1,on=2,tt=3;class fi{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=$e,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>ue(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 kp){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 xp&&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?ue(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?ue(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 h=this.children[u-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=ue(h.dom)+1;break}e-=h.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=ue(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 h=0,d=0;h<this.children.length;h++){let p=this.children[h],g=d+p.size;if(o>d&&s<g)return p.setSelection(e-d-p.border,t-d-p.border,r,i);d=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.getSelection(),f=!1;if((We||ve)&&e==t){let{node:h,offset:d}=l;if(h.nodeType==3){if(f=!!(d&&h.nodeValue[d-1]==`
|
|
6
|
+
`),f&&d==h.nodeValue.length)for(let p=h,g;p;p=p.parentNode){if(g=p.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:ue(g)+1});break}let m=p.pmViewDesc;if(m&&m.node&&m.node.isBlock)break}}else{let p=h.childNodes[d-1];f=p&&(p.nodeName=="BR"||p.contentEditable=="false")}}if(We&&c.focusNode&&c.focusNode!=a.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||f&&ve)&&mn(l.node,l.offset,c.anchorNode,c.anchorOffset)&&mn(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 d=l;l=a,a=d}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}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?on:Nf,e==l&&t==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=tt:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?on:tt}r=s}this.dirty=on}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?on:Nf;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class xp extends fi{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==$e&&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 m0 extends fi{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 yn extends fi{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=vn.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new yn(e,t,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&tt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=tt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=$e){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=$e}}slice(e,t,r){let i=yn.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=Jl(o,t,s,r)),e>0&&(o=Jl(o,0,e,r));for(let l=0;l<o.length;l++)o[l].parent=i;return i.children=o,i}}class Jt extends fi{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}=vn.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 h=f;return f=Ap(f,r,t),c?a=new y0(e,t,r,i,f,u||null,h,c,o,s+1):t.isText?new ys(e,t,r,i,f,h,o):new Jt(e,t,r,i,f,u||null,h,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let 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==$e&&e.eq(this.node)&&so(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 w0(this,s&&s.node,e);C0(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?F.none:this.node.child(f).marks,r,e),a.placeWidget(c,e,i)},(c,f,u,h)=>{a.syncToMarks(c.marks,r,e);let d;a.findNodeMatch(c,f,u,h)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(d=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(c,f,u,d,e)||a.updateNextNode(c,f,u,e,h,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==on)&&(s&&this.protectLocalComposition(e,s),Op(this.contentDOM,this.children,e),Gn&&x0(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof L)||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=k0(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 m0(this,o,t,i);e.input.compositionNodes.push(s),this.children=Jl(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==tt||!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=$e}updateOuterDeco(e){if(so(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ep(this.dom,this.nodeDOM,Hl(this.outerDeco,this.node,t),Hl(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 If(n,e,t,r,i){Ap(r,e,n);let o=new Jt(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class ys extends Jt{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==tt||this.dirty!=$e&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=$e||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=$e,!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 ys(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=tt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class kp extends fi{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==$e&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class y0 extends Jt{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==tt)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 Op(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=Df(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(s instanceof yn){let a=r?r.previousSibling:n.lastChild;Op(s.contentDOM,s.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=Df(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const Tr=function(n){n&&(this.nodeName=n)};Tr.prototype=Object.create(null);const sn=[new Tr];function Hl(n,e,t){if(n.length==0)return sn;let r=t?sn[0]:new Tr,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new Tr(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&i.length==1&&i.push(r=new Tr(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 Ep(n,e,t,r){if(t==sn&&r==sn)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=sn[0]),i=a}b0(i,l||sn[0],s)}return i}function b0(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 Ap(n,e,t){return Ep(n,n,sn,Hl(e,t,n.nodeType!=1))}function so(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 Df(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class w0{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=S0(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=$e,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=yn.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==tt&&s.dom==s.contentDOM&&(s.dirty=on),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 Jt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=o)return!1;let f=a.dom,u,h=this.isLocked(f)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=tt&&so(t,a.outerDeco));if(!h&&a.update(e,t,r,i))return this.destroyBetween(this.index,l),a.dom!=f&&(this.changed=!0),this.index++,!0;if(!h&&(u=this.recreateWrapper(a,e,t,r,i,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=on,u.updateChildren(i,s+1),u.dirty=$e),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)||!so(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=Jt.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=Jt.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 xp(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 yn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof ys)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ve||ge)&&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 kp(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 S0(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 yn)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 v0(n,e){return n.type.side-e.type.side}function C0(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 m=i[s++];m.widget&&(f?(u||(u=[f])).push(m):f=m)}if(f)if(u){u.sort(v0);for(let m=0;m<u.length;m++)t(u[m],c,!!a)}else t(f,c,!!a);let h,d;if(a)d=-1,h=a,a=null;else if(c<n.childCount)d=c,h=n.child(c++);else break;for(let m=0;m<l.length;m++)l[m].to<=o&&l.splice(m--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let p=o+h.nodeSize;if(h.isText){let m=p;s<i.length&&i[s].from<m&&(m=i[s].from);for(let y=0;y<l.length;y++)l[y].to<m&&(m=l[y].to);m<p&&(a=h.cut(m-o),h=h.cut(0,m-o),p=m,d=-1)}else for(;s<i.length&&i[s].to<p;)s++;let g=h.isInline&&!h.isLeaf?l.filter(m=>!m.inline):l.slice();r(h,g,e.forChild(o,h),d),o=p}}function x0(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 k0(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 Jl(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 rc(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(ms(t)){for(a=s;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&T.isSelectable(u)&&i.parent&&!(u.isInline&&Yb(t.focusNode,t.focusOffset,i.dom))){let h=i.posBefore;c=new T(s==h?l:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=s,h=s;for(let d=0;d<t.rangeCount;d++){let p=t.getRangeAt(d);u=Math.min(u,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(u<0)return null;[a,s]=h==n.state.selection.anchor?[h,u]:[u,h],l=r.resolve(s)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let f=r.resolve(a);if(!c){let u=e=="pointer"||n.state.selection.head<l.pos&&!o?1:-1;c=ic(n,f,l,u)}return c}function Tp(n){return n.editable?n.hasFocus():Np(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function yt(n,e=!1){let t=n.state.selection;if(Mp(n,t),!!Tp(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ge){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&mn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)E0(n);else{let{anchor:r,head:i}=t,o,s;Rf&&!(t instanceof L)&&(t.$from.parent.inlineContent||(o=_f(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=_f(n,t.to))),n.docView.setSelection(r,i,n.root,e),Rf&&(o&&Pf(o),s&&Pf(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&O0(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Rf=ve||ge&&mp<63;function _f(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(ve&&i&&i.contentEditable=="false")return Us(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Us(i);if(o)return Us(o)}}function Us(n){return n.contentEditable="true",ve&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Pf(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function O0(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(()=>{(!Tp(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function E0(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,ue(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Ee&&Ht<=11&&(r.disabled=!0,r.disabled=!1)}function Mp(n,e){if(e instanceof T){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&($f(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else $f(n)}function $f(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function ic(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||L.between(e,t,r)}function Lf(n){return n.editable&&!n.hasFocus()?!1:Np(n)}function Np(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 A0(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return mn(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Kl(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&&I.findFrom(o,e)}function It(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Bf(n,e,t){let r=n.state.selection;if(r instanceof L)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 It(n,new L(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Kl(n.state,e);return i&&i instanceof T?It(n,i):!1}else if(!(De&&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?T.isSelectable(o)?It(n,new T(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):ci?It(n,new L(n.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof T&&r.node.isInline)return It(n,new L(e>0?r.$to:r.$from));{let i=Kl(n.state,e);return i?It(n,i):!1}}}function lo(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Mr(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Tn(n,e){return e<0?T0(n):M0(n)}function T0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(We&&t.nodeType==1&&r<lo(t)&&Mr(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Mr(l,-1))i=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Ip(t))break;{let l=t.previousSibling;for(;l&&Mr(l,-1);)i=t.parentNode,o=ue(l),l=l.previousSibling;if(l)t=l,r=lo(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?Gl(n,t,r):i&&Gl(n,i,o)}function M0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=lo(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(Mr(l,1))o=t,s=++r;else break}else{if(Ip(t))break;{let l=t.nextSibling;for(;l&&Mr(l,1);)o=l.parentNode,s=ue(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=lo(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&Gl(n,o,s)}function Ip(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function N0(n,e){for(;n&&e==n.childNodes.length&&!ai(n);)e=ue(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 I0(n,e){for(;n&&!e&&!ai(n);)e=ue(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 Gl(n,e,t){if(e.nodeType!=3){let o,s;(s=N0(e,t))?(e=s,t=0):(o=I0(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(ms(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&&yt(n)},50)}function zf(n,e){let t=n.state.doc.resolve(e);if(!(ge||Zb)&&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 Ff(n,e,t){let r=n.state.selection;if(r instanceof L&&!r.empty||t.indexOf("s")>-1||De&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Kl(n.state,e);if(s&&s instanceof T)return It(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Pe?I.near(s,e):I.findFrom(s,e);return l?It(n,l):!1}return!1}function jf(n,e){if(!(n.state.selection instanceof L))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 Vf(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function D0(n){if(!ve||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;Vf(n,r,"true"),setTimeout(()=>Vf(n,r,"false"),20)}return!1}function R0(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function _0(n,e){let t=e.keyCode,r=R0(e);if(t==8||De&&t==72&&r=="c")return jf(n,-1)||Tn(n,-1);if(t==46&&!e.shiftKey||De&&t==68&&r=="c")return jf(n,1)||Tn(n,1);if(t==13||t==27)return!0;if(t==37||De&&t==66&&r=="c"){let i=t==37?zf(n,n.state.selection.from)=="ltr"?-1:1:-1;return Bf(n,i,r)||Tn(n,i)}else if(t==39||De&&t==70&&r=="c"){let i=t==39?zf(n,n.state.selection.from)=="ltr"?1:-1:1;return Bf(n,i,r)||Tn(n,i)}else{if(t==38||De&&t==80&&r=="c")return Ff(n,-1,r)||Tn(n,-1);if(t==40||De&&t==78&&r=="c")return D0(n)||Ff(n,1,r)||Tn(n,1);if(r==(De?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Dp(n,e){n.someProp("transformCopied",d=>{e=d(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 d=r.firstChild;t.push(d.type.name,d.attrs!=d.type.defaultAttrs?d.attrs:null),r=d.content}let s=n.someProp("clipboardSerializer")||vn.fromSchema(n.state.schema),l=Bp(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,f,u=0;for(;c&&c.nodeType==1&&(f=Lp[c.nodeName.toLowerCase()]);){for(let d=f.length-1;d>=0;d--){let p=l.createElement(f[d]);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 h=n.someProp("clipboardTextSerializer",d=>d(e,n))||e.content.textBetween(0,e.content.size,`
|
|
7
|
+
|
|
8
|
+
`);return{dom:a,text:h,slice:e}}function Rp(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",h=>{e=h(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",h=>h(e,i,r,n));if(u)l=u;else{let h=i.marks(),{schema:d}=n.state,p=vn.fromSchema(d);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=s.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(d.text(g,h)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),s=B0(t),ci&&z0(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 h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Ga.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||f),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!P0.test(h.parentNode.nodeName)?{ignore:!0}:null}})),f)l=F0(Wf(l,+f[1],+f[2]),f[4]);else if(l=v.maxOpen($0(l.content,i),!0),l.openStart||l.openEnd){let u=0,h=0;for(let d=l.content.firstChild;u<l.openStart&&!d.type.spec.isolating;u++,d=d.firstChild);for(let d=l.content.lastChild;h<l.openEnd&&!d.type.spec.isolating;h++,d=d.lastChild);l=Wf(l,u,h)}return n.someProp("transformPasted",u=>{l=u(l,n)}),l}const P0=/^(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 $0(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&&Pp(a,o,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=$p(s[s.length-1],o.length));let f=_p(l,a);s.push(f),i=i.matchType(f.type),o=a}}),s)return b.from(s)}return n}function _p(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,b.from(n));return n}function Pp(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=Pp(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(_p(t,n,i+1))))}}function $p(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,$p(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(b.empty,!0);return n.copy(t.append(r))}function ql(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=ql(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 Wf(n,e,t){return e<n.openStart&&(n=new v(ql(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new v(ql(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Lp={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 Uf=null;function Bp(){return Uf||(Uf=document.implementation.createHTMLDocument("title"))}function L0(n){let e=window.trustedTypes;return e?e.createPolicy("detachedDocument",{createHTML:t=>t}).createHTML(n):n}function B0(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Bp().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Lp[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=L0(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function z0(n){let e=n.querySelectorAll(ge?"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 F0(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 Ce={},xe={},j0={touchstart:!0,touchmove:!0};class V0{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 W0(n){for(let e in Ce){let t=Ce[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{H0(n,r)&&!oc(n,r)&&(n.editable||!(r.type in xe))&&t(n,r)},j0[e]?{passive:!0}:void 0)}ve&&n.dom.addEventListener("input",()=>null),Yl(n)}function Vt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function U0(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 Yl(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>oc(n,r))})}function oc(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function H0(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 J0(n,e){!oc(n,e)&&Ce[e.type]&&(n.editable||!(e.type in xe))&&Ce[e.type](n,e)}xe.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Fp(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(ze&&ge&&t.keyCode==13)))if(n.domObserver.selectionChanged(n.domSelectionRange())?n.domObserver.flush():t.keyCode!=229&&n.domObserver.forceFlush(),Gn&&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,rn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||_0(n,t)?t.preventDefault():Vt(n,"key")};xe.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};xe.keypress=(n,e)=>{let t=e;if(Fp(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||De&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof L)||!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 bs(n){return{left:n.clientX,top:n.clientY}}function K0(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function sc(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 jn(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 G0(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&T.isSelectable(r)?(jn(n,new T(t)),!0):!1}function q0(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof T&&(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(T.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?(jn(n,T.create(n.state.doc,i)),!0):!1}function Y0(n,e,t,r,i){return sc(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?q0(n,t):G0(n,t))}function X0(n,e,t,r){return sc(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Q0(n,e,t,r){return sc(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Z0(n,t,r)}function Z0(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(jn(n,L.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)jn(n,L.create(r,l+1,l+1+s.content.size));else if(T.isSelectable(s))jn(n,T.create(r,l));else continue;return!0}}function lc(n){return ao(n)}const zp=De?"metaKey":"ctrlKey";Ce.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=lc(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&K0(t,n.input.lastClick)&&!t[zp]&&(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(bs(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new e1(n,s,t,!!r)):(o=="doubleClick"?X0:Q0)(n,s.pos,s.inside,t)?t.preventDefault():Vt(n,"pointer"))};class e1{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[zp],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 T&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&We&&!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)),Vt(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(()=>yt(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(bs(e))),this.updateAllowDefault(e),this.allowDefault||!t?Vt(this.view,"pointer"):Y0(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ve&&this.mightDrag&&!this.mightDrag.node.isAtom||ge&&!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)?(jn(this.view,I.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Vt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Vt(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)}}Ce.touchstart=n=>{n.input.lastTouch=Date.now(),lc(n),Vt(n,"pointer")};Ce.touchmove=n=>{n.input.lastTouch=Date.now(),Vt(n,"pointer")};Ce.contextmenu=n=>lc(n);function Fp(n,e){return n.composing?!0:ve&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const t1=ze?5e3:-1;xe.compositionstart=xe.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof L&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),ao(n,!0),n.markCursor=null;else if(ao(n,!e.selection.empty),We&&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}jp(n,t1)};xe.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++,jp(n,20))};function jp(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>ao(n),e))}function Vp(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=r1());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function n1(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Gb(e.focusNode,e.focusOffset),r=qb(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 r1(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function ao(n,e=!1){if(!(ze&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Vp(n),e||n.docView&&n.docView.dirty){let t=rc(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function i1(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 Wr=Ee&&Ht<15||Gn&&e0<604;Ce.copy=xe.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=Wr?null:t.clipboardData,s=r.content(),{dom:l,text:a}=Dp(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):i1(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function o1(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function s1(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?Ur(n,r.value,null,i,e):Ur(n,r.textContent,r.innerHTML,i,e)},50)}function Ur(n,e,t,r,i){let o=Rp(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=o1(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 Wp(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," "):""}xe.paste=(n,e)=>{let t=e;if(n.composing&&!ze)return;let r=Wr?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Ur(n,Wp(r),r.getData("text/html"),i,t)?t.preventDefault():s1(n,t)};class Up{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Hp=De?"altKey":"ctrlKey";Ce.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(bs(t)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof T?i.to-1:i.to))){if(r&&r.mightDrag)s=T.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=T.create(n.state.doc,u.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:f}=Dp(n,l);(!t.dataTransfer.files.length||!ge||mp>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Wr?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Wr||t.dataTransfer.setData("text/plain",c),n.dragging=new Up(f,!t[Hp],s)};Ce.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};xe.dragover=xe.dragenter=(n,e)=>e.preventDefault();xe.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(bs(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=Rp(n,Wp(t.dataTransfer),Wr?null:t.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&!t[Hp]);if(n.someProp("handleDrop",p=>p(n,t,s||v.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let a=s?ap(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,h=c.doc;if(u?c.replaceRangeWith(f,f,s.content.firstChild):c.replaceRange(f,f,s),c.doc.eq(h))return;let d=c.doc.resolve(f);if(u&&T.isSelectable(s.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new T(d));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,m,y,x)=>p=x),c.setSelection(ic(n,d,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};Ce.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())&&yt(n)},20))};Ce.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)};Ce.beforeinput=(n,e)=>{if(ge&&ze&&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,rn(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 xe)Ce[n]=xe[n];function Hr(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 co{constructor(e,t){this.toDOM=e,this.spec=t||fn,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 Se(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof co&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Hr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Kt{constructor(e,t){this.attrs=e,this.spec=t||fn}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 Se(o,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Kt&&Hr(this.attrs,e.attrs)&&Hr(this.spec,e.spec)}static is(e){return e.type instanceof Kt}destroy(){}}class ac{constructor(e,t){this.attrs=e,this.spec=t||fn}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 Se(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 ac&&Hr(this.attrs,e.attrs)&&Hr(this.spec,e.spec)}destroy(){}}class Se{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Se(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 Se(e,e,new co(t,r))}static inline(e,t,r,i){return new Se(e,t,new Kt(r,i))}static node(e,t,r,i){return new Se(e,t,new ac(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Kt}get widget(){return this.type instanceof co}}const Rn=[],fn={};class Y{constructor(e,t){this.local=e.length?e:Rn,this.children=t.length?t:Rn}static create(e,t){return t.length?fo(t,e,0,fn):pe}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==pe||e.maps.length==0?this:this.mapInner(e,t,0,0,r||fn)}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?l1(this.children,s||[],e,t,r,i,o):s?new Y(s.sort(un),Rn):pe}add(e,t){return t.length?this==pe?Y.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=Kp(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,fo(f,l,c+1,fn)),o+=3}});let s=Jp(o?Gp(t):t,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new Y(s.length?this.local.concat(s).sort(un):this.local,i||this.children)}remove(e){return e.length==0||this==pe?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!=pe?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 Y(i,r):pe}forChild(e,t){if(this==pe)return this;if(t.isLeaf)return Y.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 Kt){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 Y(i.sort(un),Rn);return r?new $t([l,r]):l}return r||pe}eq(e){if(this==e)return!0;if(!(e instanceof Y)||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 cc(this.localsInner(e))}localsInner(e){if(this==pe)return Rn;if(e.inlineContent||!this.local.some(Kt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Kt||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Y.empty=new Y([],[]);Y.removeOverlap=cc;const pe=Y.empty;class $t{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,fn));return $t.from(r)}forChild(e,t){if(t.isLeaf)return Y.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=pe&&(o instanceof $t?r=r.concat(o.members):r.push(o))}return $t.from(r)}eq(e){if(!(e instanceof $t)||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?cc(r?t:t.sort(un)):Rn}static from(e){switch(e.length){case 0:return pe;case 1:return e[0];default:return new $t(e.every(t=>t instanceof Y)?e:e.reduce((t,r)=>t.concat(r instanceof Y?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function l1(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((h,d,p,g)=>{let m=g-p-(d-h);for(let y=0;y<l.length;y+=3){let x=l[y+1];if(x<0||h>x+f-u)continue;let O=l[y]+f-u;d>=O?l[y+1]=h<=O?-2:-1:h>=f&&m&&(l[y]+=m,l[y+1]+=m)}u+=m}),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 h=t.map(n[c+1]+o,-1),d=h-i,{index:p,offset:g}=r.content.findIndex(u),m=r.maybeChild(p);if(m&&g==u&&g+m.nodeSize==d){let y=l[c+2].mapInner(t,m,f+1,n[c]+o+1,s);y!=pe?(l[c]=u,l[c+1]=d,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=a1(l,n,e,t,i,o,s),f=fo(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,h=0;u<f.children.length;u+=3){let d=f.children[u];for(;h<l.length&&l[h]<d;)h+=3;l.splice(h,0,f.children[u],f.children[u+1],f.children[u+2])}}return new Y(e.sort(un),l)}function Jp(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 Se(i.from+e,i.to+e,i.type))}return t}function a1(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 Kp(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 Gp(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function fo(n,e,t,r){let i=[],o=!1;e.forEach((l,a)=>{let c=Kp(n,l,a+t);if(c){o=!0;let f=fo(c,l,t+a+1,r);f!=pe&&i.push(a,a+l.nodeSize,f)}});let s=Jp(o?Gp(n):n,-t).sort(un);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 Y(s,i):pe}function un(n,e){return n.from-e.from||n.to-e.to}function cc(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),Hf(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),Hf(e,i,r.copy(o.from,r.to)));break}}}return e}function Hf(n,e,t){for(;e<n.length&&un(t,n[e])>0;)e++;n.splice(e,0,t)}function Hs(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=pe&&e.push(r)}),n.cursorWrapper&&e.push(Y.create(n.state.doc,[n.cursorWrapper.deco])),$t.from(e)}const c1={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},f1=Ee&&Ht<=11;class u1{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 h1{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new u1,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]);Ee&&Ht<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),f1&&(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,c1)),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(Lf(this.view)){if(this.suppressingSelectionUpdates)return yt(this.view);if(Ee&&Ht<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&mn(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=Vr(o))t.add(o);for(let o=e.anchorNode;o;o=Vr(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}selectionChanged(e){return!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Lf(this.view)&&!this.ignoreSelectionChange(e)}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.selectionChanged(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(We&&a.length){let f=a.filter(u=>u.nodeName=="BR");if(f.length==2){let[u,h]=f;u.parentNode&&u.parentNode.parentNode==h.parentNode?h.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let h of f){let d=h.parentNode;d&&d.nodeName=="LI"&&(!u||g1(e,u)!=d)&&h.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&&ms(r)&&(c=rc(e))&&c.eq(I.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,yt(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),d1(e)),this.handleDOMChange(o,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||yt(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(Ee&&Ht<=11&&e.addedNodes.length)for(let f=0;f<e.addedNodes.length;f++){let{previousSibling:u,nextSibling:h}=e.addedNodes[f];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(o=h)}let s=i&&i.parentNode==e.target?ue(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=o&&o.parentNode==e.target?ue(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 Jf=new WeakMap,Kf=!1;function d1(n){if(!Jf.has(n)&&(Jf.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=We,Kf)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."),Kf=!0}}function Gf(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return mn(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function p1(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Gf(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?Gf(n,t):null}function g1(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 m1(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}],ms(a)||c.push({node:a.focusNode,offset:a.focusOffset})),ge&&n.input.lastKeyCode===8)for(let m=o;m>i;m--){let y=r.childNodes[m-1],x=y.pmViewDesc;if(y.nodeName=="BR"&&!x){o=m;break}if(!x||x.size)break}let u=n.state.doc,h=n.someProp("domParser")||Ga.fromSchema(n.state.schema),d=u.resolve(s),p=null,g=h.parse(r,{topNode:d.parent,topMatch:d.parent.contentMatchAt(d.index()),topOpen:!0,from:i,to:o,preserveWhitespace:d.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:y1,context:d});if(c&&c[0].pos!=null){let m=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=m),p={anchor:m+s,head:y+s}}return{doc:g,sel:p,from:s,to:l}}function y1(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(ve&&/^(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||ve&&/^(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 b1=/^(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 w1(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let A=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,Z=rc(n,A);if(Z&&!n.state.selection.eq(Z)){if(ge&&ze&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",k=>k(n,rn(13,"Enter"))))return;let E=n.state.tr.setSelection(Z);A=="pointer"?E.setMeta("pointer",!0):A=="key"&&E.scrollIntoView(),o&&E.setMeta("composition",o),n.dispatch(E)}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=m1(n,e,t),f=n.state.doc,u=f.slice(c.from,c.to),h,d;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,d="end"):(h=n.state.selection.from,d="start"),n.input.lastKeyCode=null;let p=C1(u.content,c.doc.content,c.from,h,d);if(p&&n.input.domChangeCount++,(Gn&&n.input.lastIOSEnter>Date.now()-225||ze)&&i.some(A=>A.nodeType==1&&!b1.test(A.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",A=>A(n,rn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof L&&!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 A=qf(n,n.state.doc,c.sel);if(A&&!A.eq(n.state.selection)){let Z=n.state.tr.setSelection(A);o&&Z.setMeta("composition",o),n.dispatch(Z)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof L&&(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)),Ee&&Ht<=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 g=c.doc.resolveNoCache(p.start-c.from),m=c.doc.resolveNoCache(p.endB-c.from),y=f.resolve(p.start),x=g.sameParent(m)&&g.parent.inlineContent&&y.end()>=p.endA,O;if((Gn&&n.input.lastIOSEnter>Date.now()-225&&(!x||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!x&&g.pos<c.doc.content.size&&!g.sameParent(m)&&(O=I.findFrom(c.doc.resolve(g.pos+1),1,!0))&&O.head==m.pos)&&n.someProp("handleKeyDown",A=>A(n,rn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&v1(f,p.start,p.endA,g,m)&&n.someProp("handleKeyDown",A=>A(n,rn(8,"Backspace")))){ze&&ge&&n.domObserver.suppressSelectionUpdates();return}ge&&ze&&p.endB==p.start&&(n.input.lastAndroidDelete=Date.now()),ze&&!x&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,m=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(A){return A(n,rn(13,"Enter"))})},20));let N=p.start,M=p.endA,C,D,R;if(x){if(g.pos==m.pos)Ee&&Ht<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>yt(n),20)),C=n.state.tr.delete(N,M),D=f.resolve(p.start).marksAcross(f.resolve(p.endA));else if(p.endA==p.endB&&(R=S1(g.parent.content.cut(g.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start()))))C=n.state.tr,R.type=="add"?C.addMark(N,M,R.mark):C.removeMark(N,M,R.mark);else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let A=g.parent.textBetween(g.parentOffset,m.parentOffset);if(n.someProp("handleTextInput",Z=>Z(n,N,M,A)))return;C=n.state.tr.insertText(A,N,M)}}if(C||(C=n.state.tr.replace(N,M,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let A=qf(n,C.doc,c.sel);A&&!(ge&&ze&&n.composing&&A.empty&&(p.start!=p.endB||n.input.lastAndroidDelete<Date.now()-100)&&(A.head==N||A.head==C.mapping.map(M)-1)||Ee&&A.empty&&A.head==N)&&C.setSelection(A)}D&&C.ensureMarks(D),o&&C.setMeta("composition",o),n.dispatch(C.scrollIntoView())}function qf(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:ic(n,e.resolve(t.anchor),e.resolve(t.head))}function S1(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 v1(n,e,t,r,i){if(t-e<=i.pos-r.pos||Js(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(Js(o,!0,!0));return!s.parent.isTextblock||s.pos>t||Js(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Js(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 C1(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&&Yf(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&&Yf(n.textBetween(o-1,o+1))&&(o+=a?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}function Yf(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 x1{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 V0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(tu),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=Zf(this),Qf(this),this.nodeViews=eu(this),this.docView=If(this.state.doc,Xf(this),Hs(this),this.dom,this),this.domObserver=new h1(this,(r,i,o,s)=>w1(this,r,i,o,s)),this.domObserver.start(),W0(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&&Yl(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(tu),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&&(Vp(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 d=eu(this);O1(d,this.nodeViews)&&(this.nodeViews=d,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Yl(this),this.editable=Zf(this),Qf(this);let a=Hs(this),c=Xf(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 h=f=="preserve"&&s&&this.dom.style.overflowAnchor==null&&r0(this);if(s){this.domObserver.stop();let d=u&&(Ee||ge)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&k1(i.selection,e.selection);if(u){let p=ge?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=n1(this)),(o||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=If(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(d=!0)}d||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&A0(this))?yt(this,d):(Mp(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():h&&i0(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof T){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Of(this,t.getBoundingClientRect(),e)}else Of(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 Up(e.slice,e.move,i<0?void 0:T.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(Ee){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&&o0(this.dom),yt(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 f0(this,e)}coordsAtPos(e,t=1){return vp(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 g0(this,t||this.state,e)}pasteHTML(e,t){return Ur(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Ur(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(U0(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Hs(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Jb())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return J0(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?ve&&this.root.nodeType===11&&Xb(this.dom.ownerDocument)==this.dom&&p1(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Xf(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"),[Se.node(0,n.state.doc.content.size,e)]}function Qf(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:Se.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Zf(n){return!n.someProp("editable",e=>e(n.state)===!1)}function k1(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 eu(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 O1(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 tu(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 Gt={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:"'"},uo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},E1=typeof navigator<"u"&&/Mac/.test(navigator.platform),A1=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var he=0;he<10;he++)Gt[48+he]=Gt[96+he]=String(he);for(var he=1;he<=24;he++)Gt[he+111]="F"+he;for(var he=65;he<=90;he++)Gt[he]=String.fromCharCode(he+32),uo[he]=String.fromCharCode(he);for(var Ks in Gt)uo.hasOwnProperty(Ks)||(uo[Ks]=Gt[Ks]);function T1(n){var e=E1&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||A1&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?uo:Gt)[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 M1=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function N1(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))M1?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 I1(n){let e=Object.create(null);for(let t in n)e[N1(t)]=n[t];return e}function Gs(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 D1(n){return new Cn({props:{handleKeyDown:fc(n)}})}function fc(n){let e=I1(n);return function(t,r){let i=T1(r),o,s=e[Gs(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[Gs(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=Gt[r.keyCode])&&o!=i){let l=e[Gs(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const R1=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function qp(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const _1=(n,e,t)=>{let r=qp(n,t);if(!r)return!1;let i=uc(r);if(!i){let s=r.blockRange(),l=s&&or(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(Zp(n,i,e,-1))return!0;if(r.parent.content.size==0&&(qn(o,"end")||T.isSelectable(o)))for(let s=r.depth;;s--){let l=ps(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(qn(o,"end")?I.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):T.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},P1=(n,e,t)=>{let r=qp(n,t);if(!r)return!1;let i=uc(r);return i?Yp(n,i,e):!1},$1=(n,e,t)=>{let r=Xp(n,t);if(!r)return!1;let i=hc(r);return i?Yp(n,i,e):!1};function Yp(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=ps(n.doc,o,a,v.empty);if(!c||c.from!=o||c instanceof oe&&c.slice.size>=a-o)return!1;if(t){let f=n.tr.step(c);f.setSelection(L.create(f.doc,o)),t(f.scrollIntoView())}return!0}function qn(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 L1=(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=uc(r)}let s=o&&o.nodeBefore;return!s||!T.isSelectable(s)?!1:(e&&e(n.tr.setSelection(T.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function uc(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 Xp(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const B1=(n,e,t)=>{let r=Xp(n,t);if(!r)return!1;let i=hc(r);if(!i)return!1;let o=i.nodeAfter;if(Zp(n,i,e,1))return!0;if(r.parent.content.size==0&&(qn(o,"start")||T.isSelectable(o))){let s=ps(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(qn(o,"start")?I.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):T.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},z1=(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=hc(r)}let s=o&&o.nodeAfter;return!s||!T.isSelectable(s)?!1:(e&&e(n.tr.setSelection(T.create(n.doc,o.pos)).scrollIntoView()),!0)};function hc(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 F1=(n,e)=>{let t=n.selection,r=t instanceof T,i;if(r){if(t.node.isTextblock||!sr(n.doc,t.from))return!1;i=t.from}else if(i=Qa(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(T.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},j1=(n,e)=>{let t=n.selection,r;if(t instanceof T){if(t.node.isTextblock||!sr(n.doc,t.to))return!1;r=t.to}else if(r=Qa(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},V1=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&or(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},W1=(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 Qp(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 U1=(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=Qp(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(I.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},H1=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Pe||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Qp(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(L.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},J1=(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(Xa(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&or(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},K1=(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(T.create(n.doc,i))),!0)};function G1(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||sr(n.doc,e.pos))?!1:(t&&t(n.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function Zp(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,a=i.type.spec.isolating||o.type.spec.isolating;if(!a&&G1(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 d=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 g=n.tr.step(new se(e.pos-1,d,e.pos,d,new v(p,1,0),s.length,!0)),m=d+2*s.length;sr(g.doc,m)&&g.join(m),t(g.scrollIntoView())}return!0}let f=o.type.spec.isolating||r>0&&a?null:I.findFrom(e,1),u=f&&f.$from.blockRange(f.$to),h=u&&or(u);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(u,h).scrollIntoView()),!0;if(c&&qn(o,"start",!0)&&qn(i,"end")){let d=i,p=[];for(;p.push(d),!d.isTextblock;)d=d.lastChild;let g=o,m=1;for(;!g.isTextblock;g=g.firstChild)m++;if(d.canReplace(d.childCount,d.childCount,g.content)){if(t){let y=b.empty;for(let O=p.length-1;O>=0;O--)y=b.from(p[O].copy(y));let x=n.tr.step(new se(e.pos-p.length,e.pos+o.nodeSize,e.pos+m,e.pos+o.nodeSize-m,new v(y,p.length,0),0,!0));t(x.scrollIntoView())}return!0}}return!1}function eg(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(L.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const q1=eg(-1),Y1=eg(1);function X1(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=s&&Ya(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Q1(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 Z1(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 Fr(f,f,s.depth),s.endIndex<s.parent.childCount&&(s=new Fr(i,t.doc.resolve(o.end(s.depth)),s.depth)),l=!0}let c=Ya(a,n,e,s);return c?(r&&r(ew(t.tr,s,c,l,n).scrollIntoView()),!0):!1}}function ew(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 se(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,h=!0;f<u;f++,h=!1)!h&&Xa(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(f).nodeSize;return n}function tw(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?nw(e,t,n,o):rw(e,t,o):!0:!1}}function nw(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new se(o-1,s,o,s,new v(b.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Fr(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const l=or(r);if(l==null)return!1;i.lift(r,l);let a=i.mapping.map(o,-1)-1;return sr(i.doc,a)&&i.join(a),e(i.scrollIntoView()),!0}function rw(n,e,t){let r=n.tr,i=t.parent;for(let d=t.end,p=t.endIndex-1,g=t.startIndex;p>g;p--)d-=i.child(p).nodeSize,r.delete(d-1,d+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,h=u+s.nodeSize;return r.step(new se(u-(l?1:0),h+(a?1:0),u+1,h-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 iw(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),h=o.start,d=o.end;t(e.tr.step(new se(h-(c?3:1),d,h,d,u,1,!0)).scrollIntoView())}return!0}}function tg(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=tg(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function ow(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=tg(n))&&(r&&(r+=" "),r+=e);return r}const dc="-",sw=n=>{const e=aw(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:s=>{const l=s.split(dc);return l[0]===""&&l.length!==1&&l.shift(),ng(l,e)||lw(s)},getConflictingClassGroupIds:(s,l)=>{const a=t[s]||[];return l&&r[s]?[...a,...r[s]]:a}}},ng=(n,e)=>{var s;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),i=r?ng(n.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const o=n.join(dc);return(s=e.validators.find(({validator:l})=>l(o)))==null?void 0:s.classGroupId},nu=/^\[(.+)\]$/,lw=n=>{if(nu.test(n)){const e=nu.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},aw=n=>{const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return fw(Object.entries(n.classGroups),t).forEach(([o,s])=>{Xl(s,r,o,e)}),r},Xl=(n,e,t,r)=>{n.forEach(i=>{if(typeof i=="string"){const o=i===""?e:ru(e,i);o.classGroupId=t;return}if(typeof i=="function"){if(cw(i)){Xl(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([o,s])=>{Xl(s,ru(e,o),t,r)})})},ru=(n,e)=>{let t=n;return e.split(dc).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},cw=n=>n.isThemeGetter,fw=(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,uw=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)}}},rg="!",hw=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 m=0;m<l.length;m++){let y=l[m];if(c===0){if(y===i&&(r||l.slice(m,m+o)===e)){a.push(l.slice(f,m)),f=m+o;continue}if(y==="/"){u=m;continue}}y==="["?c++:y==="]"&&c--}const h=a.length===0?l:l.substring(f),d=h.startsWith(rg),p=d?h.substring(1):h,g=u&&u>f?u-f:void 0;return{modifiers:a,hasImportantModifier:d,baseClassName:p,maybePostfixModifierPosition:g}};return t?l=>t({className:l,parseClassName:s}):s},dw=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},pw=n=>({cache:uw(n.cacheSize),parseClassName:hw(n),...sw(n)}),gw=/\s+/,mw=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=[],s=n.trim().split(gw);let l="";for(let a=s.length-1;a>=0;a-=1){const c=s[a],{modifiers:f,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:d}=t(c);let p=!!d,g=r(p?h.substring(0,d):h);if(!g){if(!p){l=c+(l.length>0?" "+l:l);continue}if(g=r(h),!g){l=c+(l.length>0?" "+l:l);continue}p=!1}const m=dw(f).join(":"),y=u?m+rg:m,x=y+g;if(o.includes(x))continue;o.push(x);const O=i(g,p);for(let N=0;N<O.length;++N){const M=O[N];o.push(y+M)}l=c+(l.length>0?" "+l:l)}return l};function yw(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=ig(e))&&(r&&(r+=" "),r+=t);return r}const ig=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=ig(n[r]))&&(t&&(t+=" "),t+=e);return t};function bw(n,...e){let t,r,i,o=s;function s(a){const c=e.reduce((f,u)=>u(f),n());return t=pw(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=mw(a,t);return i(a,f),f}return function(){return o(yw.apply(null,arguments))}}const W=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},og=/^\[(?:([a-z-]+):)?(.+)\]$/i,ww=/^\d+\/\d+$/,Sw=new Set(["px","full","screen"]),vw=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Cw=/\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$/,xw=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,kw=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ow=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ft=n=>Vn(n)||Sw.has(n)||ww.test(n),At=n=>lr(n,"length",Rw),Vn=n=>!!n&&!Number.isNaN(Number(n)),qs=n=>lr(n,"number",Vn),yr=n=>!!n&&Number.isInteger(Number(n)),Ew=n=>n.endsWith("%")&&Vn(n.slice(0,-1)),_=n=>og.test(n),Tt=n=>vw.test(n),Aw=new Set(["length","size","percentage"]),Tw=n=>lr(n,Aw,sg),Mw=n=>lr(n,"position",sg),Nw=new Set(["image","url"]),Iw=n=>lr(n,Nw,Pw),Dw=n=>lr(n,"",_w),br=()=>!0,lr=(n,e,t)=>{const r=og.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1},Rw=n=>Cw.test(n)&&!xw.test(n),sg=()=>!1,_w=n=>kw.test(n),Pw=n=>Ow.test(n),$w=()=>{const n=W("colors"),e=W("spacing"),t=W("blur"),r=W("brightness"),i=W("borderColor"),o=W("borderRadius"),s=W("borderSpacing"),l=W("borderWidth"),a=W("contrast"),c=W("grayscale"),f=W("hueRotate"),u=W("invert"),h=W("gap"),d=W("gradientColorStops"),p=W("gradientColorStopPositions"),g=W("inset"),m=W("margin"),y=W("opacity"),x=W("padding"),O=W("saturate"),N=W("scale"),M=W("sepia"),C=W("skew"),D=W("space"),R=W("translate"),A=()=>["auto","contain","none"],Z=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto",_,e],k=()=>[_,e],$=()=>["",ft,At],w=()=>["auto",Vn,_],ee=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],z=()=>["solid","dashed","dotted","double","none"],j=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>["start","end","center","between","around","evenly","stretch"],G=()=>["","0",_],Et=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ne=()=>[Vn,_];return{cacheSize:500,separator:":",theme:{colors:[br],spacing:[ft,At],blur:["none","",Tt,_],brightness:ne(),borderColor:[n],borderRadius:["none","","full",Tt,_],borderSpacing:k(),borderWidth:$(),contrast:ne(),grayscale:G(),hueRotate:ne(),invert:G(),gap:k(),gradientColorStops:[n],gradientColorStopPositions:[Ew,At],inset:E(),margin:E(),opacity:ne(),padding:k(),saturate:ne(),scale:ne(),sepia:G(),skew:ne(),space:k(),translate:k()},classGroups:{aspect:[{aspect:["auto","square","video",_]}],container:["container"],columns:[{columns:[Tt]}],"break-after":[{"break-after":Et()}],"break-before":[{"break-before":Et()}],"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:[...ee(),_]}],overflow:[{overflow:Z()}],"overflow-x":[{"overflow-x":Z()}],"overflow-y":[{"overflow-y":Z()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",yr,_]}],basis:[{basis:E()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",_]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",yr,_]}],"grid-cols":[{"grid-cols":[br]}],"col-start-end":[{col:["auto",{span:["full",yr,_]},_]}],"col-start":[{"col-start":w()}],"col-end":[{"col-end":w()}],"grid-rows":[{"grid-rows":[br]}],"row-start-end":[{row:["auto",{span:[yr,_]},_]}],"row-start":[{"row-start":w()}],"row-end":[{"row-end":w()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",_]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",_]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...ce()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ce(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ce(),"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:[m]}],mx:[{mx:[m]}],my:[{my:[m]}],ms:[{ms:[m]}],me:[{me:[m]}],mt:[{mt:[m]}],mr:[{mr:[m]}],mb:[{mb:[m]}],ml:[{ml:[m]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",_,e]}],"min-w":[{"min-w":[_,e,"min","max","fit"]}],"max-w":[{"max-w":[_,e,"none","full","min","max","fit","prose",{screen:[Tt]},Tt]}],h:[{h:[_,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[_,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[_,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[_,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Tt,At]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",qs]}],"font-family":[{font:[br]}],"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",_]}],"line-clamp":[{"line-clamp":["none",Vn,qs]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ft,_]}],"list-image":[{"list-image":["none",_]}],"list-style-type":[{list:["none","disc","decimal",_]}],"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:[...z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ft,At]}],"underline-offset":[{"underline-offset":["auto",ft,_]}],"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:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_]}],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",_]}],"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:[...ee(),Mw]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Tw]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Iw]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[d]}],"gradient-via":[{via:[d]}],"gradient-to":[{to:[d]}],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:[...z(),"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:z()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[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:["",...z()]}],"outline-offset":[{"outline-offset":[ft,_]}],"outline-w":[{outline:[ft,At]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[ft,At]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",Tt,Dw]}],"shadow-color":[{shadow:[br]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...j(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":j()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",Tt,_]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[u]}],saturate:[{saturate:[O]}],sepia:[{sepia:[M]}],"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":[O]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"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",_]}],duration:[{duration:ne()}],ease:[{ease:["linear","in","out","in-out",_]}],delay:[{delay:ne()}],animate:[{animate:["none","spin","ping","pulse","bounce",_]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[N]}],"scale-x":[{"scale-x":[N]}],"scale-y":[{"scale-y":[N]}],rotate:[{rotate:[yr,_]}],"translate-x":[{"translate-x":[R]}],"translate-y":[{"translate-y":[R]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",_]}],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",_]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",_]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[ft,At,qs]}],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-s","border-color-e","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"]}}},Lw=bw($w);var Jr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function lg(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Bw(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 iu=Object.prototype.toString,ag=function(e){var t=iu.call(e),r=t==="[object Arguments]";return r||(r=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&iu.call(e.callee)==="[object Function]"),r},Ys,ou;function zw(){if(ou)return Ys;ou=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=ag,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(h){var d=h.constructor;return d&&d.prototype===h},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 h in window)try{if(!c["$"+h]&&e.call(window,h)&&window[h]!==null&&typeof window[h]=="object")try{a(window[h])}catch{return!0}}catch{return!0}return!1}(),u=function(h){if(typeof window>"u"||!f)return a(h);try{return a(h)}catch{return!1}};n=function(d){var p=d!==null&&typeof d=="object",g=t.call(d)==="[object Function]",m=r(d),y=p&&t.call(d)==="[object String]",x=[];if(!p&&!g&&!m)throw new TypeError("Object.keys called on a non-object");var O=s&&g;if(y&&d.length>0&&!e.call(d,0))for(var N=0;N<d.length;++N)x.push(String(N));if(m&&d.length>0)for(var M=0;M<d.length;++M)x.push(String(M));else for(var C in d)!(O&&C==="prototype")&&e.call(d,C)&&x.push(String(C));if(o)for(var D=u(d),R=0;R<l.length;++R)!(D&&l[R]==="constructor")&&e.call(d,l[R])&&x.push(l[R]);return x}}return Ys=n,Ys}var Fw=Array.prototype.slice,jw=ag,su=Object.keys,$i=su?function(e){return su(e)}:zw(),lu=Object.keys;$i.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 jw(r)?lu(Fw.call(r)):lu(r)})}else Object.keys=$i;return Object.keys||$i};var pc=$i,Vw=Error,Ww=EvalError,Uw=RangeError,Hw=ReferenceError,cg=SyntaxError,Zt=TypeError,Jw=URIError,ws=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},au=typeof Symbol<"u"&&Symbol,Kw=ws,gc=function(){return typeof au!="function"||typeof Symbol!="function"||typeof au("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Kw()},Xs={__proto__:null,foo:{}},Gw=Object,qw=function(){return{__proto__:Xs}.foo===Xs.foo&&!(Xs instanceof Gw)},Yw="Function.prototype.bind called on incompatible ",Xw=Object.prototype.toString,Qw=Math.max,Zw="[object Function]",cu=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},eS=function(e,t){for(var r=[],i=t,o=0;i<e.length;i+=1,o+=1)r[o]=e[i];return r},tS=function(n,e){for(var t="",r=0;r<n.length;r+=1)t+=n[r],r+1<n.length&&(t+=e);return t},nS=function(e){var t=this;if(typeof t!="function"||Xw.apply(t)!==Zw)throw new TypeError(Yw+t);for(var r=eS(arguments,1),i,o=function(){if(this instanceof i){var f=t.apply(this,cu(r,arguments));return Object(f)===f?f:this}return t.apply(e,cu(r,arguments))},s=Qw(0,t.length-r.length),l=[],a=0;a<s;a++)l[a]="$"+a;if(i=Function("binder","return function ("+tS(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},rS=nS,mc=Function.prototype.bind||rS,iS=Function.prototype.call,oS=Object.prototype.hasOwnProperty,sS=mc,fg=sS.call(iS,oS),B,lS=Vw,aS=Ww,cS=Uw,fS=Hw,Yn=cg,Wn=Zt,uS=Jw,ug=Function,Qs=function(n){try{return ug('"use strict"; return ('+n+").constructor;")()}catch{}},hn=Object.getOwnPropertyDescriptor;if(hn)try{hn({},"")}catch{hn=null}var Zs=function(){throw new Wn},hS=hn?function(){try{return arguments.callee,Zs}catch{try{return hn(arguments,"callee").get}catch{return Zs}}}():Zs,Mn=gc(),dS=qw(),re=Object.getPrototypeOf||(dS?function(n){return n.__proto__}:null),_n={},pS=typeof Uint8Array>"u"||!re?B:re(Uint8Array),dn={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?B:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?B:ArrayBuffer,"%ArrayIteratorPrototype%":Mn&&re?re([][Symbol.iterator]()):B,"%AsyncFromSyncIteratorPrototype%":B,"%AsyncFunction%":_n,"%AsyncGenerator%":_n,"%AsyncGeneratorFunction%":_n,"%AsyncIteratorPrototype%":_n,"%Atomics%":typeof Atomics>"u"?B:Atomics,"%BigInt%":typeof BigInt>"u"?B:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?B:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?B:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?B:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":lS,"%eval%":eval,"%EvalError%":aS,"%Float32Array%":typeof Float32Array>"u"?B:Float32Array,"%Float64Array%":typeof Float64Array>"u"?B:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?B:FinalizationRegistry,"%Function%":ug,"%GeneratorFunction%":_n,"%Int8Array%":typeof Int8Array>"u"?B:Int8Array,"%Int16Array%":typeof Int16Array>"u"?B:Int16Array,"%Int32Array%":typeof Int32Array>"u"?B:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Mn&&re?re(re([][Symbol.iterator]())):B,"%JSON%":typeof JSON=="object"?JSON:B,"%Map%":typeof Map>"u"?B:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Mn||!re?B:re(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?B:Promise,"%Proxy%":typeof Proxy>"u"?B:Proxy,"%RangeError%":cS,"%ReferenceError%":fS,"%Reflect%":typeof Reflect>"u"?B:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?B:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Mn||!re?B:re(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?B:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Mn&&re?re(""[Symbol.iterator]()):B,"%Symbol%":Mn?Symbol:B,"%SyntaxError%":Yn,"%ThrowTypeError%":hS,"%TypedArray%":pS,"%TypeError%":Wn,"%Uint8Array%":typeof Uint8Array>"u"?B:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?B:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?B:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?B:Uint32Array,"%URIError%":uS,"%WeakMap%":typeof WeakMap>"u"?B:WeakMap,"%WeakRef%":typeof WeakRef>"u"?B:WeakRef,"%WeakSet%":typeof WeakSet>"u"?B:WeakSet};if(re)try{null.error}catch(n){var gS=re(re(n));dn["%Error.prototype%"]=gS}var mS=function n(e){var t;if(e==="%AsyncFunction%")t=Qs("async function () {}");else if(e==="%GeneratorFunction%")t=Qs("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Qs("async function* () {}");else if(e==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&re&&(t=re(i.prototype))}return dn[e]=t,t},fu={__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"]},ui=mc,ho=fg,yS=ui.call(Function.call,Array.prototype.concat),bS=ui.call(Function.apply,Array.prototype.splice),uu=ui.call(Function.call,String.prototype.replace),po=ui.call(Function.call,String.prototype.slice),wS=ui.call(Function.call,RegExp.prototype.exec),SS=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,vS=/\\(\\)?/g,CS=function(e){var t=po(e,0,1),r=po(e,-1);if(t==="%"&&r!=="%")throw new Yn("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new Yn("invalid intrinsic syntax, expected opening `%`");var i=[];return uu(e,SS,function(o,s,l,a){i[i.length]=l?uu(a,vS,"$1"):s||o}),i},xS=function(e,t){var r=e,i;if(ho(fu,r)&&(i=fu[r],r="%"+i[0]+"%"),ho(dn,r)){var o=dn[r];if(o===_n&&(o=mS(r)),typeof o>"u"&&!t)throw new Wn("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new Yn("intrinsic "+e+" does not exist!")},it=function(e,t){if(typeof e!="string"||e.length===0)throw new Wn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Wn('"allowMissing" argument must be a boolean');if(wS(/^%?[^%]*%?$/,e)===null)throw new Yn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=CS(e),i=r.length>0?r[0]:"",o=xS("%"+i+"%",t),s=o.name,l=o.value,a=!1,c=o.alias;c&&(i=c[0],bS(r,yS([0,1],c)));for(var f=1,u=!0;f<r.length;f+=1){var h=r[f],d=po(h,0,1),p=po(h,-1);if((d==='"'||d==="'"||d==="`"||p==='"'||p==="'"||p==="`")&&d!==p)throw new Yn("property names with quotes must have matching quotes");if((h==="constructor"||!u)&&(a=!0),i+="."+h,s="%"+i+"%",ho(dn,s))l=dn[s];else if(l!=null){if(!(h in l)){if(!t)throw new Wn("base intrinsic for "+e+" exists, but the property is not available.");return}if(hn&&f+1>=r.length){var g=hn(l,h);u=!!g,u&&"get"in g&&!("originalValue"in g.get)?l=g.get:l=l[h]}else u=ho(l,h),l=l[h];u&&!a&&(dn[s]=l)}}return l},kS=it,Li=kS("%Object.defineProperty%",!0)||!1;if(Li)try{Li({},"a",{value:1})}catch{Li=!1}var yc=Li,OS=it,Bi=OS("%Object.getOwnPropertyDescriptor%",!0);if(Bi)try{Bi([],"length")}catch{Bi=null}var bc=Bi,hu=yc,ES=cg,Nn=Zt,du=bc,wc=function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Nn("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new Nn("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Nn("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Nn("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Nn("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Nn("`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=!!du&&du(e,t);if(hu)hu(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 ES("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Ql=yc,hg=function(){return!!Ql};hg.hasArrayLengthDefineBug=function(){if(!Ql)return null;try{return Ql([],"length",{value:1}).length!==1}catch{return!0}};var Sc=hg,AS=pc,TS=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",MS=Object.prototype.toString,NS=Array.prototype.concat,pu=wc,IS=function(n){return typeof n=="function"&&MS.call(n)==="[object Function]"},dg=Sc(),DS=function(n,e,t,r){if(e in n){if(r===!0){if(n[e]===t)return}else if(!IS(r)||!r())return}dg?pu(n,e,t,!0):pu(n,e,t)},pg=function(n,e){var t=arguments.length>2?arguments[2]:{},r=AS(e);TS&&(r=NS.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)DS(n,r[i],e[r[i]],t[r[i]])};pg.supportsDescriptors=!!dg;var xn=pg,gg={exports:{}},RS=it,gu=wc,_S=Sc(),mu=bc,yu=Zt,PS=RS("%Math.floor%"),$S=function(e,t){if(typeof e!="function")throw new yu("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||PS(t)!==t)throw new yu("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,o=!0;if("length"in e&&mu){var s=mu(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(o=!1)}return(i||o||!r)&&(_S?gu(e,"length",t,!0,!0):gu(e,"length",t)),e};(function(n){var e=mc,t=it,r=$S,i=Zt,o=t("%Function.prototype.apply%"),s=t("%Function.prototype.call%"),l=t("%Reflect.apply%",!0)||e.call(s,o),a=yc,c=t("%Math.max%");n.exports=function(h){if(typeof h!="function")throw new i("a function is required");var d=l(e,s,arguments);return r(d,1+c(0,h.length-(arguments.length-1)),!0)};var f=function(){return l(e,o,arguments)};a?a(n.exports,"apply",{value:f}):n.exports.apply=f})(gg);var ar=gg.exports,mg=it,yg=ar,LS=yg(mg("String.prototype.indexOf")),Le=function(e,t){var r=mg(e,!!t);return typeof r=="function"&&LS(e,".prototype.")>-1?yg(r):r},BS=pc,bg=ws(),wg=Le,bu=Object,zS=wg("Array.prototype.push"),wu=wg("Object.prototype.propertyIsEnumerable"),FS=bg?Object.getOwnPropertySymbols:null,Sg=function(e,t){if(e==null)throw new TypeError("target must be an object");var r=bu(e);if(arguments.length===1)return r;for(var i=1;i<arguments.length;++i){var o=bu(arguments[i]),s=BS(o),l=bg&&(Object.getOwnPropertySymbols||FS);if(l)for(var a=l(o),c=0;c<a.length;++c){var f=a[c];wu(o,f)&&zS(s,f)}for(var u=0;u<s.length;++u){var h=s[u];if(wu(o,h)){var d=o[h];r[h]=d}}}return r},el=Sg,jS=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},VS=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},vg=function(){return!Object.assign||jS()||VS()?el:Object.assign},WS=xn,US=vg,HS=function(){var e=US();return WS(Object,{assign:e},{assign:function(){return Object.assign!==e}}),e},JS=xn,KS=ar,GS=Sg,Cg=vg,qS=HS,YS=KS.apply(Cg()),xg=function(e,t){return YS(Object,arguments)};JS(xg,{getPolyfill:Cg,implementation:GS,shim:qS});var XS=xg,Kr=function(){return typeof(function(){}).name=="string"},Nr=Object.getOwnPropertyDescriptor;if(Nr)try{Nr([],"length")}catch{Nr=null}Kr.functionsHaveConfigurableNames=function(){if(!Kr()||!Nr)return!1;var e=Nr(function(){},"name");return!!e&&!!e.configurable};var QS=Function.prototype.bind;Kr.boundFunctionsHaveNames=function(){return Kr()&&typeof QS=="function"&&(function(){}).bind().name!==""};var ZS=Kr,Su=wc,ev=Sc(),tv=ZS.functionsHaveConfigurableNames(),nv=Zt,rv=function(e,t){if(typeof e!="function")throw new nv("`fn` is not a function");var r=arguments.length>2&&!!arguments[2];return(!r||tv)&&(ev?Su(e,"name",t,!0,!0):Su(e,"name",t)),e},iv=rv,ov=Zt,sv=Object,kg=iv(function(){if(this==null||this!==sv(this))throw new ov("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),lv=kg,av=xn.supportsDescriptors,cv=Object.getOwnPropertyDescriptor,Og=function(){if(av&&/a/mig.flags==="gim"){var e=cv(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 lv},fv=xn.supportsDescriptors,uv=Og,hv=Object.getOwnPropertyDescriptor,dv=Object.defineProperty,pv=TypeError,vu=Object.getPrototypeOf,gv=/a/,mv=function(){if(!fv||!vu)throw new pv("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=uv(),t=vu(gv),r=hv(t,"flags");return(!r||r.get!==e)&&dv(t,"flags",{configurable:!0,enumerable:!1,get:e}),e},yv=xn,bv=ar,wv=kg,Eg=Og,Sv=mv,Ag=bv(Eg());yv(Ag,{getPolyfill:Eg,implementation:wv,shim:Sv});var vv=Ag,zi={exports:{}},Cv=ws,kn=function(){return Cv()&&!!Symbol.toStringTag},xv=kn(),kv=Le,Zl=kv("Object.prototype.toString"),Ss=function(e){return xv&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:Zl(e)==="[object Arguments]"},Tg=function(e){return Ss(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Zl(e)!=="[object Array]"&&Zl(e.callee)==="[object Function]"},Ov=function(){return Ss(arguments)}();Ss.isLegacyArguments=Tg;var Mg=Ov?Ss:Tg;const Ev={},Av=Object.freeze(Object.defineProperty({__proto__:null,default:Ev},Symbol.toStringTag,{value:"Module"})),Tv=Bw(Av);var vc=typeof Map=="function"&&Map.prototype,tl=Object.getOwnPropertyDescriptor&&vc?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,go=vc&&tl&&typeof tl.get=="function"?tl.get:null,Cu=vc&&Map.prototype.forEach,Cc=typeof Set=="function"&&Set.prototype,nl=Object.getOwnPropertyDescriptor&&Cc?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,mo=Cc&&nl&&typeof nl.get=="function"?nl.get:null,xu=Cc&&Set.prototype.forEach,Mv=typeof WeakMap=="function"&&WeakMap.prototype,Ir=Mv?WeakMap.prototype.has:null,Nv=typeof WeakSet=="function"&&WeakSet.prototype,Dr=Nv?WeakSet.prototype.has:null,Iv=typeof WeakRef=="function"&&WeakRef.prototype,ku=Iv?WeakRef.prototype.deref:null,Dv=Boolean.prototype.valueOf,Rv=Object.prototype.toString,_v=Function.prototype.toString,Pv=String.prototype.match,xc=String.prototype.slice,Wt=String.prototype.replace,$v=String.prototype.toUpperCase,Ou=String.prototype.toLowerCase,Ng=RegExp.prototype.test,Eu=Array.prototype.concat,Ye=Array.prototype.join,Lv=Array.prototype.slice,Au=Math.floor,ea=typeof BigInt=="function"?BigInt.prototype.valueOf:null,rl=Object.getOwnPropertySymbols,ta=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Xn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ye=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Xn||!0)?Symbol.toStringTag:null,Ig=Object.prototype.propertyIsEnumerable,Tu=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Mu(n,e){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||Ng.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-Au(-n):Au(n);if(r!==n){var i=String(r),o=xc.call(e,i.length+1);return Wt.call(i,t,"$&_")+"."+Wt.call(Wt.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Wt.call(e,t,"$&_")}var na=Tv,Nu=na.custom,Iu=Rg(Nu)?Nu:null,Bv=function n(e,t,r,i){var o=t||{};if(Dt(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Dt(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=Dt(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(Dt(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(Dt(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 Pg(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var a=String(e);return l?Mu(e,a):a}if(typeof e=="bigint"){var c=String(e)+"n";return l?Mu(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 ra(e)?"[Array]":"[Object]";var u=nC(o,r);if(typeof i>"u")i=[];else if(_g(i,e)>=0)return"[Circular]";function h($,w,ee){if(w&&(i=Lv.call(i),i.push(w)),ee){var z={depth:o.depth};return Dt(o,"quoteStyle")&&(z.quoteStyle=o.quoteStyle),n($,z,r+1,i)}return n($,o,r+1,i)}if(typeof e=="function"&&!Du(e)){var d=Kv(e),p=yi(e,h);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(p.length>0?" { "+Ye.call(p,", ")+" }":"")}if(Rg(e)){var g=Xn?Wt.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):ta.call(e);return typeof e=="object"&&!Xn?wr(g):g}if(Zv(e)){for(var m="<"+Ou.call(String(e.nodeName)),y=e.attributes||[],x=0;x<y.length;x++)m+=" "+y[x].name+"="+Dg(zv(y[x].value),"double",o);return m+=">",e.childNodes&&e.childNodes.length&&(m+="..."),m+="</"+Ou.call(String(e.nodeName))+">",m}if(ra(e)){if(e.length===0)return"[]";var O=yi(e,h);return u&&!tC(O)?"["+ia(O,u)+"]":"[ "+Ye.call(O,", ")+" ]"}if(jv(e)){var N=yi(e,h);return!("cause"in Error.prototype)&&"cause"in e&&!Ig.call(e,"cause")?"{ ["+String(e)+"] "+Ye.call(Eu.call("[cause]: "+h(e.cause),N),", ")+" }":N.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Ye.call(N,", ")+" }"}if(typeof e=="object"&&s){if(Iu&&typeof e[Iu]=="function"&&na)return na(e,{depth:f-r});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Gv(e)){var M=[];return Cu&&Cu.call(e,function($,w){M.push(h(w,e,!0)+" => "+h($,e))}),Ru("Map",go.call(e),M,u)}if(Xv(e)){var C=[];return xu&&xu.call(e,function($){C.push(h($,e))}),Ru("Set",mo.call(e),C,u)}if(qv(e))return il("WeakMap");if(Qv(e))return il("WeakSet");if(Yv(e))return il("WeakRef");if(Wv(e))return wr(h(Number(e)));if(Hv(e))return wr(h(ea.call(e)));if(Uv(e))return wr(Dv.call(e));if(Vv(e))return wr(h(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof Jr<"u"&&e===Jr)return"{ [object globalThis] }";if(!Fv(e)&&!Du(e)){var D=yi(e,h),R=Tu?Tu(e)===Object.prototype:e instanceof Object||e.constructor===Object,A=e instanceof Object?"":"null prototype",Z=!R&&ye&&Object(e)===e&&ye in e?xc.call(en(e),8,-1):A?"Object":"",E=R||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",k=E+(Z||A?"["+Ye.call(Eu.call([],Z||[],A||[]),": ")+"] ":"");return D.length===0?k+"{}":u?k+"{"+ia(D,u)+"}":k+"{ "+Ye.call(D,", ")+" }"}return String(e)};function Dg(n,e,t){var r=(t.quoteStyle||e)==="double"?'"':"'";return r+n+r}function zv(n){return Wt.call(String(n),/"/g,""")}function ra(n){return en(n)==="[object Array]"&&(!ye||!(typeof n=="object"&&ye in n))}function Fv(n){return en(n)==="[object Date]"&&(!ye||!(typeof n=="object"&&ye in n))}function Du(n){return en(n)==="[object RegExp]"&&(!ye||!(typeof n=="object"&&ye in n))}function jv(n){return en(n)==="[object Error]"&&(!ye||!(typeof n=="object"&&ye in n))}function Vv(n){return en(n)==="[object String]"&&(!ye||!(typeof n=="object"&&ye in n))}function Wv(n){return en(n)==="[object Number]"&&(!ye||!(typeof n=="object"&&ye in n))}function Uv(n){return en(n)==="[object Boolean]"&&(!ye||!(typeof n=="object"&&ye in n))}function Rg(n){if(Xn)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!ta)return!1;try{return ta.call(n),!0}catch{}return!1}function Hv(n){if(!n||typeof n!="object"||!ea)return!1;try{return ea.call(n),!0}catch{}return!1}var Jv=Object.prototype.hasOwnProperty||function(n){return n in this};function Dt(n,e){return Jv.call(n,e)}function en(n){return Rv.call(n)}function Kv(n){if(n.name)return n.name;var e=Pv.call(_v.call(n),/^function\s*([\w$]+)/);return e?e[1]:null}function _g(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 Gv(n){if(!go||!n||typeof n!="object")return!1;try{go.call(n);try{mo.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function qv(n){if(!Ir||!n||typeof n!="object")return!1;try{Ir.call(n,Ir);try{Dr.call(n,Dr)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function Yv(n){if(!ku||!n||typeof n!="object")return!1;try{return ku.call(n),!0}catch{}return!1}function Xv(n){if(!mo||!n||typeof n!="object")return!1;try{mo.call(n);try{go.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function Qv(n){if(!Dr||!n||typeof n!="object")return!1;try{Dr.call(n,Dr);try{Ir.call(n,Ir)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function Zv(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function Pg(n,e){if(n.length>e.maxStringLength){var t=n.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return Pg(xc.call(n,0,e.maxStringLength),e)+r}var i=Wt.call(Wt.call(n,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,eC);return Dg(i,"single",e)}function eC(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":"")+$v.call(e.toString(16))}function wr(n){return"Object("+n+")"}function il(n){return n+" { ? }"}function Ru(n,e,t,r){var i=r?ia(t,r):Ye.call(t,", ");return n+" ("+e+") {"+i+"}"}function tC(n){for(var e=0;e<n.length;e++)if(_g(n[e],`
|
|
11
|
+
`)>=0)return!1;return!0}function nC(n,e){var t;if(n.indent===" ")t=" ";else if(typeof n.indent=="number"&&n.indent>0)t=Ye.call(Array(n.indent+1)," ");else return null;return{base:t,prev:Ye.call(Array(e+1),t)}}function ia(n,e){if(n.length===0)return"";var t=`
|
|
12
|
+
`+e.prev+e.base;return t+Ye.call(n,","+t)+`
|
|
13
|
+
`+e.prev}function yi(n,e){var t=ra(n),r=[];if(t){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=Dt(n,i)?e(n[i],n):""}var o=typeof rl=="function"?rl(n):[],s;if(Xn){s={};for(var l=0;l<o.length;l++)s["$"+o[l]]=o[l]}for(var a in n)Dt(n,a)&&(t&&String(Number(a))===a&&a<n.length||Xn&&s["$"+a]instanceof Symbol||(Ng.call(/[^\w$]/,a)?r.push(e(a,n)+": "+e(n[a],n)):r.push(a+": "+e(n[a],n))));if(typeof rl=="function")for(var c=0;c<o.length;c++)Ig.call(n,o[c])&&r.push("["+e(o[c])+"]: "+e(n[o[c]],n));return r}var $g=it,cr=Le,rC=Bv,iC=Zt,bi=$g("%WeakMap%",!0),wi=$g("%Map%",!0),oC=cr("WeakMap.prototype.get",!0),sC=cr("WeakMap.prototype.set",!0),lC=cr("WeakMap.prototype.has",!0),aC=cr("Map.prototype.get",!0),cC=cr("Map.prototype.set",!0),fC=cr("Map.prototype.has",!0),kc=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},uC=function(n,e){var t=kc(n,e);return t&&t.value},hC=function(n,e,t){var r=kc(n,e);r?r.value=t:n.next={key:e,next:n.next,value:t}},dC=function(n,e){return!!kc(n,e)},Lg=function(){var e,t,r,i={assert:function(o){if(!i.has(o))throw new iC("Side channel does not contain "+rC(o))},get:function(o){if(bi&&o&&(typeof o=="object"||typeof o=="function")){if(e)return oC(e,o)}else if(wi){if(t)return aC(t,o)}else if(r)return uC(r,o)},has:function(o){if(bi&&o&&(typeof o=="object"||typeof o=="function")){if(e)return lC(e,o)}else if(wi){if(t)return fC(t,o)}else if(r)return dC(r,o);return!1},set:function(o,s){bi&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new bi),sC(e,o,s)):wi?(t||(t=new wi),cC(t,o,s)):(r||(r={key:{},next:null}),hC(r,o,s))}};return i},pC=fg,Sr=Lg(),ut=Zt,Oc={assert:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new ut("`O` is not an object");if(typeof e!="string")throw new ut("`slot` must be a string");if(Sr.assert(n),!Oc.has(n,e))throw new ut("`"+e+"` is not present on `O`")},get:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new ut("`O` is not an object");if(typeof e!="string")throw new ut("`slot` must be a string");var t=Sr.get(n);return t&&t["$"+e]},has:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new ut("`O` is not an object");if(typeof e!="string")throw new ut("`slot` must be a string");var t=Sr.get(n);return!!t&&pC(t,"$"+e)},set:function(n,e,t){if(!n||typeof n!="object"&&typeof n!="function")throw new ut("`O` is not an object");if(typeof e!="string")throw new ut("`slot` must be a string");var r=Sr.get(n);r||(r={},Sr.set(n,r)),r["$"+e]=t}};Object.freeze&&Object.freeze(Oc);var gC=Oc,vr=gC,mC=SyntaxError,_u=typeof StopIteration=="object"?StopIteration:null,yC=function(e){if(!_u)throw new mC("this environment lacks StopIteration");vr.set(e,"[[Done]]",!1);var t={next:function(){var i=vr.get(this,"[[Iterator]]"),o=vr.get(i,"[[Done]]");try{return{done:o,value:o?void 0:i.next()}}catch(s){if(vr.set(i,"[[Done]]",!0),s!==_u)throw s;return{done:!0,value:void 0}}}};return vr.set(t,"[[Iterator]]",e),t},bC={}.toString,Bg=Array.isArray||function(n){return bC.call(n)=="[object Array]"},wC=String.prototype.valueOf,SC=function(e){try{return wC.call(e),!0}catch{return!1}},vC=Object.prototype.toString,CC="[object String]",xC=kn(),zg=function(e){return typeof e=="string"?!0:typeof e!="object"?!1:xC?SC(e):vC.call(e)===CC},Ec=typeof Map=="function"&&Map.prototype?Map:null,kC=typeof Set=="function"&&Set.prototype?Set:null,yo;Ec||(yo=function(e){return!1});var Fg=Ec?Map.prototype.has:null,Pu=kC?Set.prototype.has:null;!yo&&!Fg&&(yo=function(e){return!1});var jg=yo||function(e){if(!e||typeof e!="object")return!1;try{if(Fg.call(e),Pu)try{Pu.call(e)}catch{return!0}return e instanceof Ec}catch{}return!1},OC=typeof Map=="function"&&Map.prototype?Map:null,Ac=typeof Set=="function"&&Set.prototype?Set:null,bo;Ac||(bo=function(e){return!1});var $u=OC?Map.prototype.has:null,Vg=Ac?Set.prototype.has:null;!bo&&!Vg&&(bo=function(e){return!1});var Wg=bo||function(e){if(!e||typeof e!="object")return!1;try{if(Vg.call(e),$u)try{$u.call(e)}catch{return!0}return e instanceof Ac}catch{}return!1},Lu=Mg,Bu=yC;if(gc()||ws()){var ol=Symbol.iterator;zi.exports=function(e){if(e!=null&&typeof e[ol]<"u")return e[ol]();if(Lu(e))return Array.prototype[ol].call(e)}}else{var EC=Bg,AC=zg,zu=it,TC=zu("%Map%",!0),MC=zu("%Set%",!0),Be=Le,Fu=Be("Array.prototype.push"),ju=Be("String.prototype.charCodeAt"),NC=Be("String.prototype.slice"),IC=function(e,t){var r=e.length;if(t+1>=r)return t+1;var i=ju(e,t);if(i<55296||i>56319)return t+1;var o=ju(e,t+1);return o<56320||o>57343?t+1:t+2},sl=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}}}},Vu=function(e,t){if(EC(e)||Lu(e))return sl(e);if(AC(e)){var r=0;return{next:function(){var o=IC(e,r),s=NC(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(!TC&&!MC)zi.exports=function(e){if(e!=null)return Vu(e,!0)};else{var DC=jg,RC=Wg,Wu=Be("Map.prototype.forEach",!0),Uu=Be("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var Hu=Be("Map.prototype.iterator",!0),Ju=Be("Set.prototype.iterator",!0);var Ku=Be("Map.prototype.@@iterator",!0)||Be("Map.prototype._es6-shim iterator_",!0),Gu=Be("Set.prototype.@@iterator",!0)||Be("Set.prototype._es6-shim iterator_",!0),_C=function(e){if(DC(e)){if(Hu)return Bu(Hu(e));if(Ku)return Ku(e);if(Wu){var t=[];return Wu(e,function(i,o){Fu(t,[o,i])}),sl(t)}}if(RC(e)){if(Ju)return Bu(Ju(e));if(Gu)return Gu(e);if(Uu){var r=[];return Uu(e,function(i){Fu(r,i)}),sl(r)}}};zi.exports=function(e){return _C(e)||Vu(e)}}}var PC=zi.exports,qu=function(n){return n!==n},Ug=function(e,t){return e===0&&t===0?1/e===1/t:!!(e===t||qu(e)&&qu(t))},$C=Ug,Hg=function(){return typeof Object.is=="function"?Object.is:$C},LC=Hg,BC=xn,zC=function(){var e=LC();return BC(Object,{is:e},{is:function(){return Object.is!==e}}),e},FC=xn,jC=ar,VC=Ug,Jg=Hg,WC=zC,Kg=jC(Jg(),Object);FC(Kg,{getPolyfill:Jg,implementation:VC,shim:WC});var UC=Kg,HC=ar,Gg=Le,JC=it,oa=JC("%ArrayBuffer%",!0),Fi=Gg("ArrayBuffer.prototype.byteLength",!0),KC=Gg("Object.prototype.toString"),Yu=!!oa&&!Fi&&new oa(0).slice,Xu=!!Yu&&HC(Yu),qg=Fi||Xu?function(e){if(!e||typeof e!="object")return!1;try{return Fi?Fi(e):Xu(e,0),!0}catch{return!1}}:oa?function(e){return KC(e)==="[object ArrayBuffer]"}:function(e){return!1},GC=Date.prototype.getDay,qC=function(e){try{return GC.call(e),!0}catch{return!1}},YC=Object.prototype.toString,XC="[object Date]",QC=kn(),ZC=function(e){return typeof e!="object"||e===null?!1:QC?qC(e):YC.call(e)===XC},sa=Le,Yg=kn(),Xg,Qg,la,aa;if(Yg){Xg=sa("Object.prototype.hasOwnProperty"),Qg=sa("RegExp.prototype.exec"),la={};var ll=function(){throw la};aa={toString:ll,valueOf:ll},typeof Symbol.toPrimitive=="symbol"&&(aa[Symbol.toPrimitive]=ll)}var ex=sa("Object.prototype.toString"),tx=Object.getOwnPropertyDescriptor,nx="[object RegExp]",rx=Yg?function(e){if(!e||typeof e!="object")return!1;var t=tx(e,"lastIndex"),r=t&&Xg(t,"value");if(!r)return!1;try{Qg(e,aa)}catch(i){return i===la}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:ex(e)===nx},ix=Le,Qu=ix("SharedArrayBuffer.prototype.byteLength",!0),ox=Qu?function(e){if(!e||typeof e!="object")return!1;try{return Qu(e),!0}catch{return!1}}:function(e){return!1},sx=Number.prototype.toString,lx=function(e){try{return sx.call(e),!0}catch{return!1}},ax=Object.prototype.toString,cx="[object Number]",fx=kn(),ux=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:fx?lx(e):ax.call(e)===cx},Zg=Le,hx=Zg("Boolean.prototype.toString"),dx=Zg("Object.prototype.toString"),px=function(e){try{return hx(e),!0}catch{return!1}},gx="[object Boolean]",mx=kn(),yx=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:mx&&Symbol.toStringTag in e?px(e):dx(e)===gx},ca={exports:{}},bx=Object.prototype.toString,wx=gc();if(wx){var Sx=Symbol.prototype.toString,vx=/^Symbol\(.*\)$/,Cx=function(e){return typeof e.valueOf()!="symbol"?!1:vx.test(Sx.call(e))};ca.exports=function(e){if(typeof e=="symbol")return!0;if(bx.call(e)!=="[object Symbol]")return!1;try{return Cx(e)}catch{return!1}}}else ca.exports=function(e){return!1};var xx=ca.exports,fa={exports:{}},Zu=typeof BigInt<"u"&&BigInt,kx=function(){return typeof Zu=="function"&&typeof BigInt=="function"&&typeof Zu(42)=="bigint"&&typeof BigInt(42)=="bigint"},Ox=kx();if(Ox){var Ex=BigInt.prototype.valueOf,Ax=function(e){try{return Ex.call(e),!0}catch{}return!1};fa.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:Ax(e)}}else fa.exports=function(e){return!1};var Tx=fa.exports,Mx=zg,Nx=ux,Ix=yx,Dx=xx,Rx=Tx,_x=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(Mx(e))return"String";if(Nx(e))return"Number";if(Ix(e))return"Boolean";if(Dx(e))return"Symbol";if(Rx(e))return"BigInt"},wo=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,eh=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,So;wo||(So=function(e){return!1});var ua=wo?wo.prototype.has:null,al=eh?eh.prototype.has:null;!So&&!ua&&(So=function(e){return!1});var Px=So||function(e){if(!e||typeof e!="object")return!1;try{if(ua.call(e,ua),al)try{al.call(e,al)}catch{return!0}return e instanceof wo}catch{}return!1},ha={exports:{}},$x=it,em=Le,Lx=$x("%WeakSet%",!0),cl=em("WeakSet.prototype.has",!0);if(cl){var fl=em("WeakMap.prototype.has",!0);ha.exports=function(e){if(!e||typeof e!="object")return!1;try{if(cl(e,cl),fl)try{fl(e,fl)}catch{return!0}return e instanceof Lx}catch{}return!1}}else ha.exports=function(e){return!1};var Bx=ha.exports,zx=jg,Fx=Wg,jx=Px,Vx=Bx,Wx=function(e){if(e&&typeof e=="object"){if(zx(e))return"Map";if(Fx(e))return"Set";if(jx(e))return"WeakMap";if(Vx(e))return"WeakSet"}return!1},tm=Function.prototype.toString,Bn=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,da,ji;if(typeof Bn=="function"&&typeof Object.defineProperty=="function")try{da=Object.defineProperty({},"length",{get:function(){throw ji}}),ji={},Bn(function(){throw 42},null,da)}catch(n){n!==ji&&(Bn=null)}else Bn=null;var Ux=/^\s*class\b/,pa=function(e){try{var t=tm.call(e);return Ux.test(t)}catch{return!1}},ul=function(e){try{return pa(e)?!1:(tm.call(e),!0)}catch{return!1}},Vi=Object.prototype.toString,Hx="[object Object]",Jx="[object Function]",Kx="[object GeneratorFunction]",Gx="[object HTMLAllCollection]",qx="[object HTML document.all class]",Yx="[object HTMLCollection]",Xx=typeof Symbol=="function"&&!!Symbol.toStringTag,Qx=!(0 in[,]),ga=function(){return!1};if(typeof document=="object"){var Zx=document.all;Vi.call(Zx)===Vi.call(document.all)&&(ga=function(e){if((Qx||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=Vi.call(e);return(t===Gx||t===qx||t===Yx||t===Hx)&&e("")==null}catch{}return!1})}var ek=Bn?function(e){if(ga(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Bn(e,null,da)}catch(t){if(t!==ji)return!1}return!pa(e)&&ul(e)}:function(e){if(ga(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(Xx)return ul(e);if(pa(e))return!1;var t=Vi.call(e);return t!==Jx&&t!==Kx&&!/^\[object HTML/.test(t)?!1:ul(e)},tk=ek,nk=Object.prototype.toString,nm=Object.prototype.hasOwnProperty,rk=function(e,t,r){for(var i=0,o=e.length;i<o;i++)nm.call(e,i)&&(r==null?t(e[i],i,e):t.call(r,e[i],i,e))},ik=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)},ok=function(e,t,r){for(var i in e)nm.call(e,i)&&(r==null?t(e[i],i,e):t.call(r,e[i],i,e))},sk=function(e,t,r){if(!tk(t))throw new TypeError("iterator must be a function");var i;arguments.length>=3&&(i=r),nk.call(e)==="[object Array]"?rk(e,t,i):typeof e=="string"?ik(e,t,i):ok(e,t,i)},lk=sk,ak=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],hl=ak,ck=typeof globalThis>"u"?Jr:globalThis,fk=function(){for(var e=[],t=0;t<hl.length;t++)typeof ck[hl[t]]=="function"&&(e[e.length]=hl[t]);return e},vo=lk,uk=fk,th=ar,Tc=Le,Wi=bc,hk=Tc("Object.prototype.toString"),rm=kn(),nh=typeof globalThis>"u"?Jr:globalThis,ma=uk(),Mc=Tc("String.prototype.slice"),dl=Object.getPrototypeOf,dk=Tc("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},Co={__proto__:null};rm&&Wi&&dl?vo(ma,function(n){var e=new nh[n];if(Symbol.toStringTag in e){var t=dl(e),r=Wi(t,Symbol.toStringTag);if(!r){var i=dl(t);r=Wi(i,Symbol.toStringTag)}Co["$"+n]=th(r.get)}}):vo(ma,function(n){var e=new nh[n],t=e.slice||e.set;t&&(Co["$"+n]=th(t))});var pk=function(e){var t=!1;return vo(Co,function(r,i){if(!t)try{"$"+r(e)===i&&(t=Mc(i,1))}catch{}}),t},gk=function(e){var t=!1;return vo(Co,function(r,i){if(!t)try{r(e),t=Mc(i,1)}catch{}}),t},mk=function(e){if(!e||typeof e!="object")return!1;if(!rm){var t=Mc(hk(e),8,-1);return dk(ma,t)>-1?t:t!=="Object"?!1:gk(e)}return Wi?pk(e):null},yk=Le,rh=yk("ArrayBuffer.prototype.byteLength",!0),bk=qg,wk=function(e){return bk(e)?rh?rh(e):e.byteLength:NaN},im=XS,ot=Le,ih=vv,Sk=it,Qn=PC,vk=Lg,oh=UC,sh=Mg,lh=Bg,ah=qg,ch=ZC,fh=rx,uh=ox,hh=pc,dh=_x,ph=Wx,gh=mk,mh=wk,yh=ot("SharedArrayBuffer.prototype.byteLength",!0),bh=ot("Date.prototype.getTime"),pl=Object.getPrototypeOf,wh=ot("Object.prototype.toString"),xo=Sk("%Set%",!0),ya=ot("Map.prototype.has",!0),ko=ot("Map.prototype.get",!0),Sh=ot("Map.prototype.size",!0),Oo=ot("Set.prototype.add",!0),om=ot("Set.prototype.delete",!0),Eo=ot("Set.prototype.has",!0),Ui=ot("Set.prototype.size",!0);function vh(n,e,t,r){for(var i=Qn(n),o;(o=i.next())&&!o.done;)if(Ve(e,o.value,t,r))return om(n,o.value),!0;return!1}function sm(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 Ck(n,e,t,r,i,o){var s=sm(t);if(s!=null)return s;var l=ko(e,s),a=im({},i,{strict:!1});return typeof l>"u"&&!ya(e,s)||!Ve(r,l,a,o)?!1:!ya(n,s)&&Ve(r,l,a,o)}function xk(n,e,t){var r=sm(t);return r??(Eo(e,r)&&!Eo(n,r))}function Ch(n,e,t,r,i,o){for(var s=Qn(n),l,a;(l=s.next())&&!l.done;)if(a=l.value,Ve(t,a,i,o)&&Ve(r,ko(e,a),i,o))return om(n,a),!0;return!1}function Ve(n,e,t,r){var i=t||{};if(i.strict?oh(n,e):n===e)return!0;var o=dh(n),s=dh(e);if(o!==s)return!1;if(!n||!e||typeof n!="object"&&typeof e!="object")return i.strict?oh(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),Ek(n,e,i,r)}function xh(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 kk(n,e,t,r){if(Ui(n)!==Ui(e))return!1;for(var i=Qn(n),o=Qn(e),s,l,a;(s=i.next())&&!s.done;)if(s.value&&typeof s.value=="object")a||(a=new xo),Oo(a,s.value);else if(!Eo(e,s.value)){if(t.strict||!xk(n,e,s.value))return!1;a||(a=new xo),Oo(a,s.value)}if(a){for(;(l=o.next())&&!l.done;)if(l.value&&typeof l.value=="object"){if(!vh(a,l.value,t.strict,r))return!1}else if(!t.strict&&!Eo(n,l.value)&&!vh(a,l.value,t.strict,r))return!1;return Ui(a)===0}return!0}function Ok(n,e,t,r){if(Sh(n)!==Sh(e))return!1;for(var i=Qn(n),o=Qn(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 xo),Oo(a,c);else if(u=ko(e,c),typeof u>"u"&&!ya(e,c)||!Ve(f,u,t,r)){if(t.strict||!Ck(n,e,c,f,t,r))return!1;a||(a=new xo),Oo(a,c)}if(a){for(;(l=o.next())&&!l.done;)if(c=l.value[0],u=l.value[1],c&&typeof c=="object"){if(!Ch(a,n,c,u,t,r))return!1}else if(!t.strict&&(!n.has(c)||!Ve(ko(n,c),u,t,r))&&!Ch(a,n,c,u,im({},t,{strict:!1}),r))return!1;return Ui(a)===0}return!0}function Ek(n,e,t,r){var i,o;if(typeof n!=typeof e||n==null||e==null||wh(n)!==wh(e)||sh(n)!==sh(e))return!1;var s=lh(n),l=lh(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=fh(n),u=fh(e);if(f!==u||(f||u)&&(n.source!==e.source||ih(n)!==ih(e)))return!1;var h=ch(n),d=ch(e);if(h!==d||(h||d)&&bh(n)!==bh(e)||t.strict&&pl&&pl(n)!==pl(e))return!1;var p=gh(n),g=gh(e);if(p!==g)return!1;if(p||g){if(n.length!==e.length)return!1;for(i=0;i<n.length;i++)if(n[i]!==e[i])return!1;return!0}var m=xh(n),y=xh(e);if(m!==y)return!1;if(m||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=ah(n),O=ah(e);if(x!==O)return!1;if(x||O)return mh(n)!==mh(e)?!1:typeof Uint8Array=="function"&&Ve(new Uint8Array(n),new Uint8Array(e),t,r);var N=uh(n),M=uh(e);if(N!==M)return!1;if(N||M)return yh(n)!==yh(e)?!1:typeof Uint8Array=="function"&&Ve(new Uint8Array(n),new Uint8Array(e),t,r);if(typeof n!=typeof e)return!1;var C=hh(n),D=hh(e);if(C.length!==D.length)return!1;for(C.sort(),D.sort(),i=C.length-1;i>=0;i--)if(C[i]!=D[i])return!1;for(i=C.length-1;i>=0;i--)if(o=C[i],!Ve(n[o],e[o],t,r))return!1;var R=ph(n),A=ph(e);return R!==A?!1:R==="Set"||A==="Set"?kk(n,e,t,r):R==="Map"?Ok(n,e,t,r):!0}var Ak=function(e,t,r){return Ve(e,t,r,vk())};const Tk=lg(Ak);function lm(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=lm(n[e]))&&(r&&(r+=" "),r+=t);else for(e in n)n[e]&&(r&&(r+=" "),r+=e);return r}function Mk(){for(var n,e,t=0,r="";t<arguments.length;)(n=arguments[t++])&&(e=lm(n))&&(r&&(r+=" "),r+=e);return r}const kh=n=>typeof n=="boolean"?"".concat(n):n===0?"0":n,Oh=Mk,Nk=(n,e)=>t=>{var r;if((e==null?void 0:e.variants)==null)return Oh(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 h=kh(f)||kh(u);return i[c][h]}),l=t&&Object.entries(t).reduce((c,f)=>{let[u,h]=f;return h===void 0||(c[u]=h),c},{}),a=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,f)=>{let{class:u,className:h,...d}=f;return Object.entries(d).every(p=>{let[g,m]=p;return Array.isArray(m)?m.includes({...o,...l}[g]):{...o,...l}[g]===m})?[...c,u,h]:c},[]);return Oh(n,s,a,t==null?void 0:t.class,t==null?void 0:t.className)};var am={exports:{}};(function(n,e){(function(r,i){n.exports=i(Gy,qy)})(Jr,function(t,r){return function(i){var o={};function s(l){if(o[l])return o[l].exports;var a=o[l]={i:l,l:!1,exports:{}};return i[l].call(a.exports,a,a.exports,s),a.l=!0,a.exports}return s.m=i,s.c=o,s.d=function(l,a,c){s.o(l,a)||Object.defineProperty(l,a,{enumerable:!0,get:c})},s.r=function(l){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(l,"__esModule",{value:!0})},s.t=function(l,a){if(a&1&&(l=s(l)),a&8||a&4&&typeof l=="object"&&l&&l.__esModule)return l;var c=Object.create(null);if(s.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:l}),a&2&&typeof l!="string")for(var f in l)s.d(c,f,(function(u){return l[u]}).bind(null,f));return c},s.n=function(l){var a=l&&l.__esModule?function(){return l.default}:function(){return l};return s.d(a,"a",a),a},s.o=function(l,a){return Object.prototype.hasOwnProperty.call(l,a)},s.p="",s(s.s=4)}([function(i,o,s){i.exports=s(5)()},function(i,o){i.exports=t},function(i,o){i.exports=r},function(i,o){i.exports=function(s,l,a){var c=s.direction,f=s.value;switch(c){case"top":return a.top+f<l.top&&a.bottom>l.bottom&&a.left<l.left&&a.right>l.right;case"left":return a.left+f<l.left&&a.bottom>l.bottom&&a.top<l.top&&a.right>l.right;case"bottom":return a.bottom-f>l.bottom&&a.left<l.left&&a.right>l.right&&a.top<l.top;case"right":return a.right-f>l.right&&a.left<l.left&&a.top<l.top&&a.bottom>l.bottom}}},function(i,o,s){s.r(o),s.d(o,"default",function(){return Z});var l=s(1),a=s.n(l),c=s(2),f=s.n(c),u=s(0),h=s.n(u),d=s(3),p=s.n(d);function g(E){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?g=function($){return typeof $}:g=function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},g(E)}function m(E,k){if(!(E instanceof k))throw new TypeError("Cannot call a class as a function")}function y(E,k){for(var $=0;$<k.length;$++){var w=k[$];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(E,w.key,w)}}function x(E,k,$){return k&&y(E.prototype,k),E}function O(E,k){return k&&(g(k)==="object"||typeof k=="function")?k:M(E)}function N(E){return N=Object.setPrototypeOf?Object.getPrototypeOf:function($){return $.__proto__||Object.getPrototypeOf($)},N(E)}function M(E){if(E===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return E}function C(E,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function");E.prototype=Object.create(k&&k.prototype,{constructor:{value:E,writable:!0,configurable:!0}}),k&&D(E,k)}function D(E,k){return D=Object.setPrototypeOf||function(w,ee){return w.__proto__=ee,w},D(E,k)}function R(E,k,$){return k in E?Object.defineProperty(E,k,{value:$,enumerable:!0,configurable:!0,writable:!0}):E[k]=$,E}function A(E){return E.width===void 0&&(E.width=E.right-E.left),E.height===void 0&&(E.height=E.bottom-E.top),E}var Z=function(E){C(k,E);function k($){var w;return m(this,k),w=O(this,N(k).call(this,$)),R(M(w),"getContainer",function(){return w.props.containment||window}),R(M(w),"addEventListener",function(ee,z,j,ce){w.debounceCheck||(w.debounceCheck={});var G,Et,ne=function(){G=null,w.check()};ce>-1?Et=function(){G||(G=setTimeout(ne,ce||0))}:Et=function(){clearTimeout(G),G=setTimeout(ne,j||0)};var gr={target:ee,fn:Et,getLastTimeout:function(){return G}};ee.addEventListener(z,gr.fn),w.debounceCheck[z]=gr}),R(M(w),"startWatching",function(){w.debounceCheck||w.interval||(w.props.intervalCheck&&(w.interval=setInterval(w.check,w.props.intervalDelay)),w.props.scrollCheck&&w.addEventListener(w.getContainer(),"scroll",w.props.scrollDelay,w.props.scrollThrottle),w.props.resizeCheck&&w.addEventListener(window,"resize",w.props.resizeDelay,w.props.resizeThrottle),!w.props.delayedCall&&w.check())}),R(M(w),"stopWatching",function(){if(w.debounceCheck){for(var ee in w.debounceCheck)if(w.debounceCheck.hasOwnProperty(ee)){var z=w.debounceCheck[ee];clearTimeout(z.getLastTimeout()),z.target.removeEventListener(ee,z.fn),w.debounceCheck[ee]=null}}w.debounceCheck=null,w.interval&&(w.interval=clearInterval(w.interval))}),R(M(w),"check",function(){var ee=w.node,z,j;if(!ee)return w.state;if(z=A(w.roundRectDown(ee.getBoundingClientRect())),w.props.containment){var ce=w.props.containment.getBoundingClientRect();j={top:ce.top,left:ce.left,bottom:ce.bottom,right:ce.right}}else j={top:0,left:0,bottom:window.innerHeight||document.documentElement.clientHeight,right:window.innerWidth||document.documentElement.clientWidth};var G=w.props.offset||{},Et=g(G)==="object";Et&&(j.top+=G.top||0,j.left+=G.left||0,j.bottom-=G.bottom||0,j.right-=G.right||0);var ne={top:z.top>=j.top,left:z.left>=j.left,bottom:z.bottom<=j.bottom,right:z.right<=j.right},gr=z.height>0&&z.width>0,at=gr&&ne.top&&ne.left&&ne.bottom&&ne.right;if(gr&&w.props.partialVisibility){var Rs=z.top<=j.bottom&&z.bottom>=j.top&&z.left<=j.right&&z.right>=j.left;typeof w.props.partialVisibility=="string"&&(Rs=ne[w.props.partialVisibility]),at=w.props.minTopValue?Rs&&z.top<=j.bottom-w.props.minTopValue:Rs}typeof G.direction=="string"&&typeof G.value=="number"&&(console.warn("[notice] offset.direction and offset.value have been deprecated. They still work for now, but will be removed in next major version. Please upgrade to the new syntax: { %s: %d }",G.direction,G.value),at=p()(G,z,j));var _s=w.state;return w.state.isVisible!==at&&(_s={isVisible:at,visibilityRect:ne},w.setState(_s),w.props.onChange&&w.props.onChange(at)),_s}),w.state={isVisible:null,visibilityRect:{}},w}return x(k,[{key:"componentDidMount",value:function(){this.node=f.a.findDOMNode(this),this.props.active&&this.startWatching()}},{key:"componentWillUnmount",value:function(){this.stopWatching()}},{key:"componentDidUpdate",value:function(w){this.node=f.a.findDOMNode(this),this.props.active&&!w.active?(this.setState({isVisible:null,visibilityRect:{}}),this.startWatching()):this.props.active||this.stopWatching()}},{key:"roundRectDown",value:function(w){return{top:Math.floor(w.top),left:Math.floor(w.left),bottom:Math.floor(w.bottom),right:Math.floor(w.right)}}},{key:"render",value:function(){return this.props.children instanceof Function?this.props.children({isVisible:this.state.isVisible,visibilityRect:this.state.visibilityRect}):a.a.Children.only(this.props.children)}}]),k}(a.a.Component);R(Z,"defaultProps",{active:!0,partialVisibility:!1,minTopValue:0,scrollCheck:!1,scrollDelay:250,scrollThrottle:-1,resizeCheck:!1,resizeDelay:250,resizeThrottle:-1,intervalCheck:!0,intervalDelay:100,delayedCall:!1,offset:{},containment:null,children:a.a.createElement("span",null)}),R(Z,"propTypes",{onChange:h.a.func,active:h.a.bool,partialVisibility:h.a.oneOfType([h.a.bool,h.a.oneOf(["top","right","bottom","left"])]),delayedCall:h.a.bool,offset:h.a.oneOfType([h.a.shape({top:h.a.number,left:h.a.number,bottom:h.a.number,right:h.a.number}),h.a.shape({direction:h.a.oneOf(["top","right","bottom","left"]),value:h.a.number})]),scrollCheck:h.a.bool,scrollDelay:h.a.number,scrollThrottle:h.a.number,resizeCheck:h.a.bool,resizeDelay:h.a.number,resizeThrottle:h.a.number,intervalCheck:h.a.bool,intervalDelay:h.a.number,containment:typeof window<"u"?h.a.instanceOf(window.Element):h.a.any,children:h.a.oneOfType([h.a.element,h.a.func]),minTopValue:h.a.number})},function(i,o,s){var l=s(6);function a(){}function c(){}c.resetWarningCache=a,i.exports=function(){function f(d,p,g,m,y,x){if(x!==l){var O=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw O.name="Invariant Violation",O}}f.isRequired=f;function u(){return f}var h={array:f,bool:f,func:f,number:f,object:f,string:f,symbol:f,any:f,arrayOf:u,element:f,elementType:f,instanceOf:u,node:f,objectOf:u,oneOf:u,oneOfType:u,shape:u,exact:u,checkPropTypes:c,resetWarningCache:a};return h.PropTypes=h,h}},function(i,o,s){var l="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";i.exports=l}])})})(am);var Ik=am.exports;const Dk=lg(Ik),Si="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Rk=n=>{n=n.replace(/\r\n/g,`
|
|
14
|
+
`);let e=0,t="";for(;e<n.length;e++){const r=n.charCodeAt(e);r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t},_k=n=>{let e,t,r,i,o,s,l,a=0,c="";for(n=Rk(n);a<n.length;)e=n.charCodeAt(a++),t=n.charCodeAt(a++),r=n.charCodeAt(a++),i=e>>2,o=(3&e)<<4|t>>4,s=(15&t)<<2|r>>6,l=63&r,isNaN(t)?s=l=64:isNaN(r)&&(l=64),c=c+Si.charAt(i)+Si.charAt(o)+Si.charAt(s)+Si.charAt(l);return c},Pk=n=>typeof n=="string"?"string":typeof SVGElement<"u"&&n instanceof SVGElement?"element":void 0,cm=n=>"data:image/svg+xml;base64,"+_k(n),$k=n=>cm(new XMLSerializer().serializeToString(n)),Lk=n=>{switch(Pk(n)){case"string":return cm(n);case"element":return $k(n);default:return n}};var fm=typeof global=="object"&&global&&global.Object===Object&&global,Bk=typeof self=="object"&&self&&self.Object===Object&&self,st=fm||Bk||Function("return this")(),nt=st.Symbol,um=Object.prototype,zk=um.hasOwnProperty,Fk=um.toString,Cr=nt?nt.toStringTag:void 0;function jk(n){var e=zk.call(n,Cr),t=n[Cr];try{n[Cr]=void 0;var r=!0}catch{}var i=Fk.call(n);return r&&(e?n[Cr]=t:delete n[Cr]),i}var Vk=Object.prototype,Wk=Vk.toString;function Uk(n){return Wk.call(n)}var Hk="[object Null]",Jk="[object Undefined]",Eh=nt?nt.toStringTag:void 0;function tn(n){return n==null?n===void 0?Jk:Hk:Eh&&Eh in Object(n)?jk(n):Uk(n)}function wt(n){return n!=null&&typeof n=="object"}var Kk="[object Symbol]";function vs(n){return typeof n=="symbol"||wt(n)&&tn(n)==Kk}function hm(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 rt=Array.isArray,Gk=1/0,Ah=nt?nt.prototype:void 0,Th=Ah?Ah.toString:void 0;function Ao(n){if(typeof n=="string")return n;if(rt(n))return hm(n,Ao)+"";if(vs(n))return Th?Th.call(n):"";var e=n+"";return e=="0"&&1/n==-Gk?"-0":e}var qk=/\s/;function Yk(n){for(var e=n.length;e--&&qk.test(n.charAt(e)););return e}var Xk=/^\s+/;function Qk(n){return n&&n.slice(0,Yk(n)+1).replace(Xk,"")}function qt(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Mh=NaN,Zk=/^[-+]0x[0-9a-f]+$/i,eO=/^0b[01]+$/i,tO=/^0o[0-7]+$/i,nO=parseInt;function Un(n){if(typeof n=="number")return n;if(vs(n))return Mh;if(qt(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=qt(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=Qk(n);var t=eO.test(n);return t||tO.test(n)?nO(n.slice(2),t?2:8):Zk.test(n)?Mh:+n}var Nh=1/0,rO=17976931348623157e292;function iO(n){if(!n)return n===0?n:0;if(n=Un(n),n===Nh||n===-Nh){var e=n<0?-1:1;return e*rO}return n===n?n:0}function oO(n){var e=iO(n),t=e%1;return e===e?t?e-t:e:0}function Nc(n){return n}var sO="[object AsyncFunction]",lO="[object Function]",aO="[object GeneratorFunction]",cO="[object Proxy]";function dm(n){if(!qt(n))return!1;var e=tn(n);return e==lO||e==aO||e==sO||e==cO}var gl=st["__core-js_shared__"],Ih=function(){var n=/[^.]+$/.exec(gl&&gl.keys&&gl.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function fO(n){return!!Ih&&Ih in n}var uO=Function.prototype,hO=uO.toString;function On(n){if(n!=null){try{return hO.call(n)}catch{}try{return n+""}catch{}}return""}var dO=/[\\^$.*+?()[\]{}|]/g,pO=/^\[object .+?Constructor\]$/,gO=Function.prototype,mO=Object.prototype,yO=gO.toString,bO=mO.hasOwnProperty,wO=RegExp("^"+yO.call(bO).replace(dO,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function SO(n){if(!qt(n)||fO(n))return!1;var e=dm(n)?wO:pO;return e.test(On(n))}function vO(n,e){return n==null?void 0:n[e]}function En(n,e){var t=vO(n,e);return SO(t)?t:void 0}var ba=En(st,"WeakMap");function CO(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 xO=800,kO=16,OO=Date.now;function EO(n){var e=0,t=0;return function(){var r=OO(),i=kO-(r-t);if(t=r,i>0){if(++e>=xO)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function AO(n){return function(){return n}}var Dh=function(){try{var n=En(Object,"defineProperty");return n({},"",{}),n}catch{}}(),TO=Dh?function(n,e){return Dh(n,"toString",{configurable:!0,enumerable:!1,value:AO(e),writable:!0})}:Nc,MO=EO(TO);function NO(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 IO(n){return n!==n}function DO(n,e,t){for(var r=t-1,i=n.length;++r<i;)if(n[r]===e)return r;return-1}function RO(n,e,t){return e===e?DO(n,e,t):NO(n,IO,t)}function _O(n,e){var t=n==null?0:n.length;return!!t&&RO(n,e,0)>-1}var PO=9007199254740991,$O=/^(?:0|[1-9]\d*)$/;function pm(n,e){var t=typeof n;return e=e??PO,!!e&&(t=="number"||t!="symbol"&&$O.test(n))&&n>-1&&n%1==0&&n<e}function gm(n,e){return n===e||n!==n&&e!==e}var Rh=Math.max;function LO(n,e,t){return e=Rh(e===void 0?n.length-1:e,0),function(){for(var r=arguments,i=-1,o=Rh(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),CO(n,this,l)}}function BO(n,e){return MO(LO(n,e,Nc),n+"")}var zO=9007199254740991;function Ic(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=zO}function mm(n){return n!=null&&Ic(n.length)&&!dm(n)}var FO=Object.prototype;function jO(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||FO;return n===t}function VO(n,e){for(var t=-1,r=Array(n);++t<n;)r[t]=e(t);return r}var WO="[object Arguments]";function _h(n){return wt(n)&&tn(n)==WO}var ym=Object.prototype,UO=ym.hasOwnProperty,HO=ym.propertyIsEnumerable,Dc=_h(function(){return arguments}())?_h:function(n){return wt(n)&&UO.call(n,"callee")&&!HO.call(n,"callee")};function JO(){return!1}var bm=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ph=bm&&typeof module=="object"&&module&&!module.nodeType&&module,KO=Ph&&Ph.exports===bm,$h=KO?st.Buffer:void 0,GO=$h?$h.isBuffer:void 0,wa=GO||JO,qO="[object Arguments]",YO="[object Array]",XO="[object Boolean]",QO="[object Date]",ZO="[object Error]",eE="[object Function]",tE="[object Map]",nE="[object Number]",rE="[object Object]",iE="[object RegExp]",oE="[object Set]",sE="[object String]",lE="[object WeakMap]",aE="[object ArrayBuffer]",cE="[object DataView]",fE="[object Float32Array]",uE="[object Float64Array]",hE="[object Int8Array]",dE="[object Int16Array]",pE="[object Int32Array]",gE="[object Uint8Array]",mE="[object Uint8ClampedArray]",yE="[object Uint16Array]",bE="[object Uint32Array]",U={};U[fE]=U[uE]=U[hE]=U[dE]=U[pE]=U[gE]=U[mE]=U[yE]=U[bE]=!0;U[qO]=U[YO]=U[aE]=U[XO]=U[cE]=U[QO]=U[ZO]=U[eE]=U[tE]=U[nE]=U[rE]=U[iE]=U[oE]=U[sE]=U[lE]=!1;function wE(n){return wt(n)&&Ic(n.length)&&!!U[tn(n)]}function Rc(n){return function(e){return n(e)}}var wm=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Rr=wm&&typeof module=="object"&&module&&!module.nodeType&&module,SE=Rr&&Rr.exports===wm,ml=SE&&fm.process,To=function(){try{var n=Rr&&Rr.require&&Rr.require("util").types;return n||ml&&ml.binding&&ml.binding("util")}catch{}}(),Lh=To&&To.isTypedArray,Sm=Lh?Rc(Lh):wE,vE=Object.prototype,CE=vE.hasOwnProperty;function xE(n,e){var t=rt(n),r=!t&&Dc(n),i=!t&&!r&&wa(n),o=!t&&!r&&!i&&Sm(n),s=t||r||i||o,l=s?VO(n.length,String):[],a=l.length;for(var c in n)CE.call(n,c)&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||pm(c,a)))&&l.push(c);return l}function kE(n,e){return function(t){return n(e(t))}}var OE=kE(Object.keys,Object),EE=Object.prototype,AE=EE.hasOwnProperty;function TE(n){if(!jO(n))return OE(n);var e=[];for(var t in Object(n))AE.call(n,t)&&t!="constructor"&&e.push(t);return e}function vm(n){return mm(n)?xE(n):TE(n)}var ME=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,NE=/^\w*$/;function _c(n,e){if(rt(n))return!1;var t=typeof n;return t=="number"||t=="symbol"||t=="boolean"||n==null||vs(n)?!0:NE.test(n)||!ME.test(n)||e!=null&&n in Object(e)}var Gr=En(Object,"create");function IE(){this.__data__=Gr?Gr(null):{},this.size=0}function DE(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var RE="__lodash_hash_undefined__",_E=Object.prototype,PE=_E.hasOwnProperty;function $E(n){var e=this.__data__;if(Gr){var t=e[n];return t===RE?void 0:t}return PE.call(e,n)?e[n]:void 0}var LE=Object.prototype,BE=LE.hasOwnProperty;function zE(n){var e=this.__data__;return Gr?e[n]!==void 0:BE.call(e,n)}var FE="__lodash_hash_undefined__";function jE(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=Gr&&e===void 0?FE:e,this}function bn(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])}}bn.prototype.clear=IE;bn.prototype.delete=DE;bn.prototype.get=$E;bn.prototype.has=zE;bn.prototype.set=jE;function VE(){this.__data__=[],this.size=0}function Cs(n,e){for(var t=n.length;t--;)if(gm(n[t][0],e))return t;return-1}var WE=Array.prototype,UE=WE.splice;function HE(n){var e=this.__data__,t=Cs(e,n);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():UE.call(e,t,1),--this.size,!0}function JE(n){var e=this.__data__,t=Cs(e,n);return t<0?void 0:e[t][1]}function KE(n){return Cs(this.__data__,n)>-1}function GE(n,e){var t=this.__data__,r=Cs(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function xt(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])}}xt.prototype.clear=VE;xt.prototype.delete=HE;xt.prototype.get=JE;xt.prototype.has=KE;xt.prototype.set=GE;var qr=En(st,"Map");function qE(){this.size=0,this.__data__={hash:new bn,map:new(qr||xt),string:new bn}}function YE(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function xs(n,e){var t=n.__data__;return YE(e)?t[typeof e=="string"?"string":"hash"]:t.map}function XE(n){var e=xs(this,n).delete(n);return this.size-=e?1:0,e}function QE(n){return xs(this,n).get(n)}function ZE(n){return xs(this,n).has(n)}function eA(n,e){var t=xs(this,n),r=t.size;return t.set(n,e),this.size+=t.size==r?0:1,this}function kt(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])}}kt.prototype.clear=qE;kt.prototype.delete=XE;kt.prototype.get=QE;kt.prototype.has=ZE;kt.prototype.set=eA;var tA="Expected a function";function Pc(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new TypeError(tA);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(Pc.Cache||kt),t}Pc.Cache=kt;var nA=500;function rA(n){var e=Pc(n,function(r){return t.size===nA&&t.clear(),r}),t=e.cache;return e}var iA=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,oA=/\\(\\)?/g,sA=rA(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(iA,function(t,r,i,o){e.push(i?o.replace(oA,"$1"):r||t)}),e});function Sa(n){return n==null?"":Ao(n)}function Cm(n,e){return rt(n)?n:_c(n,e)?[n]:sA(Sa(n))}var lA=1/0;function ks(n){if(typeof n=="string"||vs(n))return n;var e=n+"";return e=="0"&&1/n==-lA?"-0":e}function xm(n,e){e=Cm(e,n);for(var t=0,r=e.length;n!=null&&t<r;)n=n[ks(e[t++])];return t&&t==r?n:void 0}function aA(n,e,t){var r=n==null?void 0:xm(n,e);return r===void 0?t:r}function km(n,e){for(var t=-1,r=e.length,i=n.length;++t<r;)n[i+t]=e[t];return n}var Bh=nt?nt.isConcatSpreadable:void 0;function cA(n){return rt(n)||Dc(n)||!!(Bh&&n&&n[Bh])}function fA(n,e,t,r,i){var o=-1,s=n.length;for(t||(t=cA),i||(i=[]);++o<s;){var l=n[o];t(l)&&km(i,l)}return i}function uA(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 hA(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:uA(n,e,t)}var dA="\\ud800-\\udfff",pA="\\u0300-\\u036f",gA="\\ufe20-\\ufe2f",mA="\\u20d0-\\u20ff",yA=pA+gA+mA,bA="\\ufe0e\\ufe0f",wA="\\u200d",SA=RegExp("["+wA+dA+yA+bA+"]");function $c(n){return SA.test(n)}function vA(n){return n.split("")}var Om="\\ud800-\\udfff",CA="\\u0300-\\u036f",xA="\\ufe20-\\ufe2f",kA="\\u20d0-\\u20ff",OA=CA+xA+kA,EA="\\ufe0e\\ufe0f",AA="["+Om+"]",va="["+OA+"]",Ca="\\ud83c[\\udffb-\\udfff]",TA="(?:"+va+"|"+Ca+")",Em="[^"+Om+"]",Am="(?:\\ud83c[\\udde6-\\uddff]){2}",Tm="[\\ud800-\\udbff][\\udc00-\\udfff]",MA="\\u200d",Mm=TA+"?",Nm="["+EA+"]?",NA="(?:"+MA+"(?:"+[Em,Am,Tm].join("|")+")"+Nm+Mm+")*",IA=Nm+Mm+NA,DA="(?:"+[Em+va+"?",va,Am,Tm,AA].join("|")+")",RA=RegExp(Ca+"(?="+Ca+")|"+DA+IA,"g");function _A(n){return n.match(RA)||[]}function PA(n){return $c(n)?_A(n):vA(n)}function $A(n,e,t){return n===n&&(t!==void 0&&(n=n<=t?n:t),e!==void 0&&(n=n>=e?n:e)),n}function LA(n,e,t){return t===void 0&&(t=e,e=void 0),t!==void 0&&(t=Un(t),t=t===t?t:0),e!==void 0&&(e=Un(e),e=e===e?e:0),$A(Un(n),e,t)}function BA(){this.__data__=new xt,this.size=0}function zA(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function FA(n){return this.__data__.get(n)}function jA(n){return this.__data__.has(n)}var VA=200;function WA(n,e){var t=this.__data__;if(t instanceof xt){var r=t.__data__;if(!qr||r.length<VA-1)return r.push([n,e]),this.size=++t.size,this;t=this.__data__=new kt(r)}return t.set(n,e),this.size=t.size,this}function bt(n){var e=this.__data__=new xt(n);this.size=e.size}bt.prototype.clear=BA;bt.prototype.delete=zA;bt.prototype.get=FA;bt.prototype.has=jA;bt.prototype.set=WA;function UA(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 HA(){return[]}var JA=Object.prototype,KA=JA.propertyIsEnumerable,zh=Object.getOwnPropertySymbols,GA=zh?function(n){return n==null?[]:(n=Object(n),UA(zh(n),function(e){return KA.call(n,e)}))}:HA;function qA(n,e,t){var r=e(n);return rt(n)?r:km(r,t(n))}function Fh(n){return qA(n,vm,GA)}var xa=En(st,"DataView"),ka=En(st,"Promise"),Oa=En(st,"Set"),jh="[object Map]",YA="[object Object]",Vh="[object Promise]",Wh="[object Set]",Uh="[object WeakMap]",Hh="[object DataView]",XA=On(xa),QA=On(qr),ZA=On(ka),eT=On(Oa),tT=On(ba),Rt=tn;(xa&&Rt(new xa(new ArrayBuffer(1)))!=Hh||qr&&Rt(new qr)!=jh||ka&&Rt(ka.resolve())!=Vh||Oa&&Rt(new Oa)!=Wh||ba&&Rt(new ba)!=Uh)&&(Rt=function(n){var e=tn(n),t=e==YA?n.constructor:void 0,r=t?On(t):"";if(r)switch(r){case XA:return Hh;case QA:return jh;case ZA:return Vh;case eT:return Wh;case tT:return Uh}return e});var Jh=st.Uint8Array,nT="__lodash_hash_undefined__";function rT(n){return this.__data__.set(n,nT),this}function iT(n){return this.__data__.has(n)}function Yr(n){var e=-1,t=n==null?0:n.length;for(this.__data__=new kt;++e<t;)this.add(n[e])}Yr.prototype.add=Yr.prototype.push=rT;Yr.prototype.has=iT;function oT(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 Im(n,e){return n.has(e)}var sT=1,lT=2;function Dm(n,e,t,r,i,o){var s=t&sT,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,h=!0,d=t&lT?new Yr:void 0;for(o.set(n,e),o.set(e,n);++u<l;){var p=n[u],g=e[u];if(r)var m=s?r(g,p,u,e,n,o):r(p,g,u,n,e,o);if(m!==void 0){if(m)continue;h=!1;break}if(d){if(!oT(e,function(y,x){if(!Im(d,x)&&(p===y||i(p,y,t,r,o)))return d.push(x)})){h=!1;break}}else if(!(p===g||i(p,g,t,r,o))){h=!1;break}}return o.delete(n),o.delete(e),h}function aT(n){var e=-1,t=Array(n.size);return n.forEach(function(r,i){t[++e]=[i,r]}),t}function cT(n){var e=-1,t=Array(n.size);return n.forEach(function(r){t[++e]=r}),t}var fT=1,uT=2,hT="[object Boolean]",dT="[object Date]",pT="[object Error]",gT="[object Map]",mT="[object Number]",yT="[object RegExp]",bT="[object Set]",wT="[object String]",ST="[object Symbol]",vT="[object ArrayBuffer]",CT="[object DataView]",Kh=nt?nt.prototype:void 0,yl=Kh?Kh.valueOf:void 0;function xT(n,e,t,r,i,o,s){switch(t){case CT:if(n.byteLength!=e.byteLength||n.byteOffset!=e.byteOffset)return!1;n=n.buffer,e=e.buffer;case vT:return!(n.byteLength!=e.byteLength||!o(new Jh(n),new Jh(e)));case hT:case dT:case mT:return gm(+n,+e);case pT:return n.name==e.name&&n.message==e.message;case yT:case wT:return n==e+"";case gT:var l=aT;case bT:var a=r&fT;if(l||(l=cT),n.size!=e.size&&!a)return!1;var c=s.get(n);if(c)return c==e;r|=uT,s.set(n,e);var f=Dm(l(n),l(e),r,i,o,s);return s.delete(n),f;case ST:if(yl)return yl.call(n)==yl.call(e)}return!1}var kT=1,OT=Object.prototype,ET=OT.hasOwnProperty;function AT(n,e,t,r,i,o){var s=t&kT,l=Fh(n),a=l.length,c=Fh(e),f=c.length;if(a!=f&&!s)return!1;for(var u=a;u--;){var h=l[u];if(!(s?h in e:ET.call(e,h)))return!1}var d=o.get(n),p=o.get(e);if(d&&p)return d==e&&p==n;var g=!0;o.set(n,e),o.set(e,n);for(var m=s;++u<a;){h=l[u];var y=n[h],x=e[h];if(r)var O=s?r(x,y,h,e,n,o):r(y,x,h,n,e,o);if(!(O===void 0?y===x||i(y,x,t,r,o):O)){g=!1;break}m||(m=h=="constructor")}if(g&&!m){var N=n.constructor,M=e.constructor;N!=M&&"constructor"in n&&"constructor"in e&&!(typeof N=="function"&&N instanceof N&&typeof M=="function"&&M instanceof M)&&(g=!1)}return o.delete(n),o.delete(e),g}var TT=1,Gh="[object Arguments]",qh="[object Array]",vi="[object Object]",MT=Object.prototype,Yh=MT.hasOwnProperty;function NT(n,e,t,r,i,o){var s=rt(n),l=rt(e),a=s?qh:Rt(n),c=l?qh:Rt(e);a=a==Gh?vi:a,c=c==Gh?vi:c;var f=a==vi,u=c==vi,h=a==c;if(h&&wa(n)){if(!wa(e))return!1;s=!0,f=!1}if(h&&!f)return o||(o=new bt),s||Sm(n)?Dm(n,e,t,r,i,o):xT(n,e,a,t,r,i,o);if(!(t&TT)){var d=f&&Yh.call(n,"__wrapped__"),p=u&&Yh.call(e,"__wrapped__");if(d||p){var g=d?n.value():n,m=p?e.value():e;return o||(o=new bt),i(g,m,t,r,o)}}return h?(o||(o=new bt),AT(n,e,t,r,i,o)):!1}function Lc(n,e,t,r,i){return n===e?!0:n==null||e==null||!wt(n)&&!wt(e)?n!==n&&e!==e:NT(n,e,t,r,Lc,i)}var IT=1,DT=2;function RT(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 bt,u;if(!(u===void 0?Lc(c,a,IT|DT,r,f):u))return!1}}return!0}function Rm(n){return n===n&&!qt(n)}function _T(n){for(var e=vm(n),t=e.length;t--;){var r=e[t],i=n[r];e[t]=[r,i,Rm(i)]}return e}function _m(n,e){return function(t){return t==null?!1:t[n]===e&&(e!==void 0||n in Object(t))}}function PT(n){var e=_T(n);return e.length==1&&e[0][2]?_m(e[0][0],e[0][1]):function(t){return t===n||RT(t,n,e)}}function $T(n,e){return n!=null&&e in Object(n)}function LT(n,e,t){e=Cm(e,n);for(var r=-1,i=e.length,o=!1;++r<i;){var s=ks(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&&Ic(i)&&pm(s,i)&&(rt(n)||Dc(n)))}function BT(n,e){return n!=null&<(n,e,$T)}var zT=1,FT=2;function jT(n,e){return _c(n)&&Rm(e)?_m(ks(n),e):function(t){var r=aA(t,n);return r===void 0&&r===e?BT(t,n):Lc(e,r,zT|FT)}}function Pm(n){return function(e){return e==null?void 0:e[n]}}function VT(n){return function(e){return xm(e,n)}}function WT(n){return _c(n)?Pm(ks(n)):VT(n)}function UT(n){return typeof n=="function"?n:n==null?Nc:typeof n=="object"?rt(n)?jT(n[0],n[1]):PT(n):WT(n)}var bl=function(){return st.Date.now()},HT="Expected a function",JT=Math.max,KT=Math.min;function $m(n,e,t){var r,i,o,s,l,a,c=0,f=!1,u=!1,h=!0;if(typeof n!="function")throw new TypeError(HT);e=Un(e)||0,qt(t)&&(f=!!t.leading,u="maxWait"in t,o=u?JT(Un(t.maxWait)||0,e):o,h="trailing"in t?!!t.trailing:h);function d(C){var D=r,R=i;return r=i=void 0,c=C,s=n.apply(R,D),s}function p(C){return c=C,l=setTimeout(y,e),f?d(C):s}function g(C){var D=C-a,R=C-c,A=e-D;return u?KT(A,o-R):A}function m(C){var D=C-a,R=C-c;return a===void 0||D>=e||D<0||u&&R>=o}function y(){var C=bl();if(m(C))return x(C);l=setTimeout(y,g(C))}function x(C){return l=void 0,h&&r?d(C):(r=i=void 0,s)}function O(){l!==void 0&&clearTimeout(l),c=0,r=a=i=l=void 0}function N(){return l===void 0?s:x(bl())}function M(){var C=bl(),D=m(C);if(r=arguments,i=this,a=C,D){if(l===void 0)return p(a);if(u)return clearTimeout(l),l=setTimeout(y,e),d(a)}return l===void 0&&(l=setTimeout(y,e)),s}return M.cancel=O,M.flush=N,M}function wl(n){return wt(n)&&mm(n)}var GT=200;function qT(n,e,t,r){var i=-1,o=_O,s=!0,l=n.length,a=[],c=e.length;if(!l)return a;t&&(e=hm(e,Rc(t))),e.length>=GT&&(o=Im,s=!1,e=new Yr(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 h=c;h--;)if(e[h]===u)continue e;a.push(f)}else o(e,u,r)||a.push(f)}return a}function YT(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}var XT=BO(function(n,e){var t=YT(e);return wl(t)&&(t=void 0),wl(n)?qT(n,fA(e,1,wl),UT(t)):[]}),QT="[object Number]";function ZT(n){return typeof n=="number"||wt(n)&&tn(n)==QT}var eM="[object RegExp]";function tM(n){return wt(n)&&tn(n)==eM}var Xh=To&&To.isRegExp,nM=Xh?Rc(Xh):tM,rM=Pm("length"),Lm="\\ud800-\\udfff",iM="\\u0300-\\u036f",oM="\\ufe20-\\ufe2f",sM="\\u20d0-\\u20ff",lM=iM+oM+sM,aM="\\ufe0e\\ufe0f",cM="["+Lm+"]",Ea="["+lM+"]",Aa="\\ud83c[\\udffb-\\udfff]",fM="(?:"+Ea+"|"+Aa+")",Bm="[^"+Lm+"]",zm="(?:\\ud83c[\\udde6-\\uddff]){2}",Fm="[\\ud800-\\udbff][\\udc00-\\udfff]",uM="\\u200d",jm=fM+"?",Vm="["+aM+"]?",hM="(?:"+uM+"(?:"+[Bm,zm,Fm].join("|")+")"+Vm+jm+")*",dM=Vm+jm+hM,pM="(?:"+[Bm+Ea+"?",Ea,zm,Fm,cM].join("|")+")",Qh=RegExp(Aa+"(?="+Aa+")|"+pM+dM,"g");function gM(n){for(var e=Qh.lastIndex=0;Qh.test(n);)++e;return e}function mM(n){return $c(n)?gM(n):rM(n)}var yM="Expected a function";function bM(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(yM);return qt(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),$m(n,e,{leading:r,maxWait:e,trailing:i})}var wM=30,SM="...",vM=/\w*$/;function CM(n,e){var t=wM,r=SM;if(qt(e)){var i="separator"in e?e.separator:i;t="length"in e?oO(e.length):t,r="omission"in e?Ao(e.omission):r}n=Sa(n);var o=n.length;if($c(n)){var s=PA(n);o=s.length}if(t>=o)return n;var l=t-mM(r);if(l<1)return r;var a=s?hA(s,0,l).join(""):n.slice(0,l);if(i===void 0)return a+r;if(s&&(l+=a.length-l),nM(i)){if(n.slice(l).search(i)){var c,f=a;for(i.global||(i=RegExp(i.source,Sa(vM.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(Ao(i),l)!=l){var h=a.lastIndexOf(i);h>-1&&(a=a.slice(0,h))}return a+r}const Qe=()=>new Map,Ta=n=>{const e=Qe();return n.forEach((t,r)=>{e.set(r,t)}),e},fr=(n,e,t)=>{let r=n.get(e);return r===void 0&&n.set(e,r=t()),r},xM=(n,e)=>{const t=[];for(const[r,i]of n)t.push(e(i,r));return t},kM=(n,e)=>{for(const[t,r]of n)if(e(r,t))return!0;return!1},Zn=()=>new Set,Sl=n=>n[n.length-1],er=Array.from,OM=Array.isArray;class EM{constructor(){this._observers=Qe()}on(e,t){return fr(this._observers,e,Zn).add(t),t}once(e,t){const r=(...i)=>{this.off(e,r),t(...i)};this.on(e,r)}off(e,t){const r=this._observers.get(e);r!==void 0&&(r.delete(t),r.size===0&&this._observers.delete(e))}emit(e,t){return er((this._observers.get(e)||Qe()).values()).forEach(r=>r(...t))}destroy(){this._observers=Qe()}}const wn=Math.floor,Hi=Math.abs,Wm=(n,e)=>n<e?n:e,ur=(n,e)=>n>e?n:e,AM=n=>n!==0?n<0:1/n<0,Zh=1,ed=2,vl=4,Cl=8,TM=32,Um=64,Mo=128,MM=31,td=63,_r=127,NM=2147483647,IM=Number.isInteger||(n=>typeof n=="number"&&isFinite(n)&&wn(n)===n),DM=n=>n.toLowerCase(),RM=/^\s*/g,_M=n=>n.replace(RM,""),PM=/([A-Z])/g,nd=(n,e)=>_M(n.replace(PM,t=>`${e}${DM(t)}`)),$M=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;i<t;i++)r[i]=e.codePointAt(i);return r},Xr=typeof TextEncoder<"u"?new TextEncoder:null,LM=n=>Xr.encode(n),BM=Xr?LM:$M;let xl=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});xl&&xl.decode(new Uint8Array).length===1&&(xl=null);class hi{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Bc=()=>new hi,zM=n=>{let e=n.cpos;for(let t=0;t<n.bufs.length;t++)e+=n.bufs[t].length;return e},mt=n=>{const e=new Uint8Array(zM(n));let t=0;for(let r=0;r<n.bufs.length;r++){const i=n.bufs[r];e.set(i,t),t+=i.length}return e.set(new Uint8Array(n.cbuf.buffer,0,n.cpos),t),e},FM=(n,e)=>{const t=n.cbuf.length;t-n.cpos<e&&(n.bufs.push(new Uint8Array(n.cbuf.buffer,0,n.cpos)),n.cbuf=new Uint8Array(ur(t,e)*2),n.cpos=0)},ie=(n,e)=>{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},Ma=ie,V=(n,e)=>{for(;e>_r;)ie(n,Mo|_r&e),e=wn(e/128);ie(n,_r&e)},zc=(n,e)=>{const t=AM(e);for(t&&(e=-e),ie(n,(e>td?Mo:0)|(t?Um:0)|td&e),e=wn(e/64);e>0;)ie(n,(e>_r?Mo:0)|_r&e),e=wn(e/128)},Na=new Uint8Array(3e4),jM=Na.length/3,VM=(n,e)=>{if(e.length<jM){const t=Xr.encodeInto(e,Na).written||0;V(n,t);for(let r=0;r<t;r++)ie(n,Na[r])}else Ae(n,BM(e))},WM=(n,e)=>{const t=unescape(encodeURIComponent(e)),r=t.length;V(n,r);for(let i=0;i<r;i++)ie(n,t.codePointAt(i))},Hn=Xr&&Xr.encodeInto?VM:WM,Fc=(n,e)=>{const t=n.cbuf.length,r=n.cpos,i=Wm(t-r,e.length),o=e.length-i;n.cbuf.set(e.subarray(0,i),r),n.cpos+=i,o>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(ur(t*2,o)),n.cbuf.set(e.subarray(i)),n.cpos=o)},Ae=(n,e)=>{V(n,e.byteLength),Fc(n,e)},jc=(n,e)=>{FM(n,e);const t=new DataView(n.cbuf.buffer,n.cpos,e);return n.cpos+=e,t},UM=(n,e)=>jc(n,4).setFloat32(0,e,!1),HM=(n,e)=>jc(n,8).setFloat64(0,e,!1),JM=(n,e)=>jc(n,8).setBigInt64(0,e,!1),rd=new DataView(new ArrayBuffer(4)),KM=n=>(rd.setFloat32(0,n),rd.getFloat32(0)===n),Qr=(n,e)=>{switch(typeof e){case"string":ie(n,119),Hn(n,e);break;case"number":IM(e)&&Hi(e)<=NM?(ie(n,125),zc(n,e)):KM(e)?(ie(n,124),UM(n,e)):(ie(n,123),HM(n,e));break;case"bigint":ie(n,122),JM(n,e);break;case"object":if(e===null)ie(n,126);else if(OM(e)){ie(n,117),V(n,e.length);for(let t=0;t<e.length;t++)Qr(n,e[t])}else if(e instanceof Uint8Array)ie(n,116),Ae(n,e);else{ie(n,118);const t=Object.keys(e);V(n,t.length);for(let r=0;r<t.length;r++){const i=t[r];Hn(n,i),Qr(n,e[i])}}break;case"boolean":ie(n,e?120:121);break;default:ie(n,127)}};class id extends hi{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&V(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const od=n=>{n.count>0&&(zc(n.encoder,n.count===1?n.s:-n.s),n.count>1&&V(n.encoder,n.count-2))};class Ji{constructor(){this.encoder=new hi,this.s=0,this.count=0}write(e){this.s===e?this.count++:(od(this),this.count=1,this.s=e)}toUint8Array(){return od(this),mt(this.encoder)}}const sd=n=>{if(n.count>0){const e=n.diff*2+(n.count===1?0:1);zc(n.encoder,e),n.count>1&&V(n.encoder,n.count-2)}};class kl{constructor(){this.encoder=new hi,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(sd(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return sd(this),mt(this.encoder)}}class GM{constructor(){this.sarr=[],this.s="",this.lensE=new Ji}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new hi;return this.sarr.push(this.s),this.s="",Hn(e,this.sarr.join("")),Fc(e,this.lensE.toUint8Array()),mt(e)}}const tr=n=>new Error(n),Ze=()=>{throw tr("Method unimplemented")},Yt=()=>{throw tr("Unexpected case")},qM=crypto.getRandomValues.bind(crypto),Hm=()=>qM(new Uint32Array(1))[0],YM="10000000-1000-4000-8000"+-1e11,XM=()=>YM.replace(/[018]/g,n=>(n^Hm()&15>>n/4).toString(16)),ld=n=>new Promise(n);Promise.all.bind(Promise);const ad=n=>n===void 0?null:n;class QM{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let Jm=new QM,ZM=!0;try{typeof localStorage<"u"&&localStorage&&(Jm=localStorage,ZM=!1)}catch{}const eN=Jm,tN=Object.assign,nN=Object.keys,rN=(n,e)=>{for(const t in n)e(n[t],t)},cd=n=>nN(n).length,iN=n=>{for(const e in n)return!1;return!0},oN=(n,e)=>{for(const t in n)if(!e(n[t],t))return!1;return!0},sN=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),lN=(n,e)=>n===e||cd(n)===cd(e)&&oN(n,(t,r)=>(t!==void 0||sN(e,r))&&e[r]===t),aN=Object.freeze,Km=n=>{for(const e in n){const t=n[e];(typeof t=="object"||typeof t=="function")&&Km(n[e])}return aN(n)},Vc=(n,e,t=0)=>{try{for(;t<n.length;t++)n[t](...e)}finally{t<n.length&&Vc(n,e,t+1)}},cN=(n,e)=>e.includes(n),Zr=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";let He;const fN=()=>{if(He===void 0)if(Zr){He=Qe();const n=process.argv;let e=null;for(let t=0;t<n.length;t++){const r=n[t];r[0]==="-"?(e!==null&&He.set(e,""),e=r):e!==null&&(He.set(e,r),e=null)}e!==null&&He.set(e,"")}else typeof location=="object"?(He=Qe(),(location.search||"?").slice(1).split("&").forEach(n=>{if(n.length!==0){const[e,t]=n.split("=");He.set(`--${nd(e,"-")}`,t),He.set(`-${nd(e,"-")}`,t)}})):He=Qe();return He},Ia=n=>fN().has(n),No=n=>ad(Zr?process.env[n.toUpperCase().replaceAll("-","_")]:eN.getItem(n)),Gm=n=>Ia("--"+n)||No(n)!==null;Gm("production");const uN=Zr&&cN(process.env.FORCE_COLOR,["true","1","2"]),hN=uN||!Ia("--no-colors")&&!Gm("no-color")&&(!Zr||process.stdout.isTTY)&&(!Zr||Ia("--color")||No("COLORTERM")!==null||(No("TERM")||"").includes("color"));class dN{constructor(e,t){this.left=e,this.right=t}}const ht=(n,e)=>new dN(n,e);typeof DOMParser<"u"&&new DOMParser;const pN=n=>xM(n,(e,t)=>`${t}:${e};`).join(""),Ot=Symbol,qm=Ot(),Ym=Ot(),gN=Ot(),mN=Ot(),yN=Ot(),Xm=Ot(),bN=Ot(),Wc=Ot(),wN=Ot(),SN=n=>{var i;n.length===1&&((i=n[0])==null?void 0:i.constructor)===Function&&(n=n[0]());const e=[],t=[];let r=0;for(;r<n.length;r++){const o=n[r];if(o===void 0)break;if(o.constructor===String||o.constructor===Number)e.push(o);else if(o.constructor===Object)break}for(r>0&&t.push(e.join(""));r<n.length;r++){const o=n[r];o instanceof Symbol||t.push(o)}return t},vN={[qm]:ht("font-weight","bold"),[Ym]:ht("font-weight","normal"),[gN]:ht("color","blue"),[yN]:ht("color","green"),[mN]:ht("color","grey"),[Xm]:ht("color","red"),[bN]:ht("color","purple"),[Wc]:ht("color","orange"),[wN]:ht("color","black")},CN=n=>{var s;n.length===1&&((s=n[0])==null?void 0:s.constructor)===Function&&(n=n[0]());const e=[],t=[],r=Qe();let i=[],o=0;for(;o<n.length;o++){const l=n[o],a=vN[l];if(a!==void 0)r.set(a.left,a.right);else{if(l===void 0)break;if(l.constructor===String||l.constructor===Number){const c=pN(r);o>0||c.length>0?(e.push("%c"+l),t.push(c)):e.push(l)}else break}}for(o>0&&(i=t,i.unshift(e.join("")));o<n.length;o++){const l=n[o];l instanceof Symbol||i.push(l)}return i},Qm=hN?CN:SN,xN=(...n)=>{console.log(...Qm(n)),Zm.forEach(e=>e.print(n))},kN=(...n)=>{console.warn(...Qm(n)),n.unshift(Wc),Zm.forEach(e=>e.print(n))},Zm=Zn(),ey=n=>({[Symbol.iterator](){return this},next:n}),ON=(n,e)=>ey(()=>{let t;do t=n.next();while(!t.done&&!e(t.value));return t}),Ol=(n,e)=>ey(()=>{const{done:t,value:r}=n.next();return{done:t,value:t?void 0:e(r)}});class EN{constructor(e,t){this.clock=e,this.len=t}}class AN{constructor(){this.clients=new Map}}const ty=(n,e,t)=>e.clients.forEach((r,i)=>{const o=n.doc.store.clients.get(i);for(let s=0;s<r.length;s++){const l=r[s];ay(n,o,l.clock,l.len,t)}}),TN=(n,e)=>{let t=0,r=n.length-1;for(;t<=r;){const i=wn((t+r)/2),o=n[i],s=o.clock;if(s<=e){if(e<s+o.len)return i;t=i+1}else r=i-1}return null},ny=(n,e)=>{const t=n.clients.get(e.client);return t!==void 0&&TN(t,e.clock)!==null},ry=n=>{n.clients.forEach(e=>{e.sort((i,o)=>i.clock-o.clock);let t,r;for(t=1,r=1;t<e.length;t++){const i=e[r-1],o=e[t];i.clock+i.len>=o.clock?i.len=ur(i.len,o.clock+o.len-i.clock):(r<t&&(e[r]=o),r++)}e.length=r})},iy=(n,e,t,r)=>{fr(n.clients,e,()=>[]).push(new EN(t,r))},MN=(n,e)=>{V(n.restEncoder,e.clients.size),er(e.clients.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{n.resetDsCurVal(),V(n.restEncoder,t);const i=r.length;V(n.restEncoder,i);for(let o=0;o<i;o++){const s=r[o];n.writeDsClock(s.clock),n.writeDsLen(s.len)}})},oy=Hm;class di extends EM{constructor({guid:e=XM(),collectionid:t=null,gc:r=!0,gcFilter:i=()=>!0,meta:o=null,autoLoad:s=!1,shouldLoad:l=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=oy(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new BN,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=l,this.autoLoad=s,this.meta=o,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=ld(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const a=()=>ld(c=>{const f=u=>{(u===void 0||u===!0)&&(this.off("sync",f),c())};this.on("sync",f)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=a()}load(){const e=this._item;e!==null&&!this.shouldLoad&&H(e.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(er(this.subdocs).map(e=>e.guid))}transact(e,t=null){return H(this,e,t)}get(e,t=de){const r=fr(this.share,e,()=>{const o=new t;return o._integrate(this,null),o}),i=r.constructor;if(t!==de&&i!==t)if(i===de){const o=new t;o._map=r._map,r._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=o}),o._start=r._start;for(let s=o._start;s!==null;s=s.right)s.parent=o;return o._length=r._length,this.share.set(e,o),o._integrate(this,null),o}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Pr)}getText(e=""){return this.get(e,ri)}getMap(e=""){return this.get(e,_o)}getXmlElement(e=""){return this.get(e,ii)}getXmlFragment(e=""){return this.get(e,nr)}toJSON(){const e={};return this.share.forEach((t,r)=>{e[r]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,er(this.subdocs).forEach(t=>t.destroy());const e=this._item;if(e!==null){this._item=null;const t=e.content;t.doc=new di({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,H(e.parent.doc,r=>{const i=t.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class NN{constructor(){this.restEncoder=Bc()}toUint8Array(){return mt(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){V(this.restEncoder,e)}writeDsLen(e){V(this.restEncoder,e)}}class IN extends NN{writeLeftID(e){V(this.restEncoder,e.client),V(this.restEncoder,e.clock)}writeRightID(e){V(this.restEncoder,e.client),V(this.restEncoder,e.clock)}writeClient(e){V(this.restEncoder,e)}writeInfo(e){Ma(this.restEncoder,e)}writeString(e){Hn(this.restEncoder,e)}writeParentInfo(e){V(this.restEncoder,e?1:0)}writeTypeRef(e){V(this.restEncoder,e)}writeLen(e){V(this.restEncoder,e)}writeAny(e){Qr(this.restEncoder,e)}writeBuf(e){Ae(this.restEncoder,e)}writeJSON(e){Hn(this.restEncoder,JSON.stringify(e))}writeKey(e){Hn(this.restEncoder,e)}}class DN{constructor(){this.restEncoder=Bc(),this.dsCurrVal=0}toUint8Array(){return mt(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,V(this.restEncoder,t)}writeDsLen(e){e===0&&Yt(),V(this.restEncoder,e-1),this.dsCurrVal+=e}}class RN extends DN{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new kl,this.clientEncoder=new Ji,this.leftClockEncoder=new kl,this.rightClockEncoder=new kl,this.infoEncoder=new id(Ma),this.stringEncoder=new GM,this.parentInfoEncoder=new id(Ma),this.typeRefEncoder=new Ji,this.lenEncoder=new Ji}toUint8Array(){const e=Bc();return V(e,0),Ae(e,this.keyClockEncoder.toUint8Array()),Ae(e,this.clientEncoder.toUint8Array()),Ae(e,this.leftClockEncoder.toUint8Array()),Ae(e,this.rightClockEncoder.toUint8Array()),Ae(e,mt(this.infoEncoder)),Ae(e,this.stringEncoder.toUint8Array()),Ae(e,mt(this.parentInfoEncoder)),Ae(e,this.typeRefEncoder.toUint8Array()),Ae(e,this.lenEncoder.toUint8Array()),Fc(e,mt(this.restEncoder)),mt(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Qr(this.restEncoder,e)}writeBuf(e){Ae(this.restEncoder,e)}writeJSON(e){Qr(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}}const _N=(n,e,t,r)=>{r=ur(r,e[0].id.clock);const i=St(e,r);V(n.restEncoder,e.length-i),n.writeClient(t),V(n.restEncoder,r);const o=e[i];o.write(n,r-o.id.clock);for(let s=i+1;s<e.length;s++)e[s].write(n,0)},PN=(n,e,t)=>{const r=new Map;t.forEach((i,o)=>{Oe(e,o)>i&&r.set(o,i)}),Uc(e).forEach((i,o)=>{t.has(o)||r.set(o,0)}),V(n.restEncoder,r.size),er(r.entries()).sort((i,o)=>o[0]-i[0]).forEach(([i,o])=>{_N(n,e.clients.get(i),i,o)})},$N=(n,e)=>PN(n,e.doc.store,e.beforeState);class LN{constructor(){this.l=[]}}const fd=()=>new LN,ud=(n,e)=>n.l.push(e),hd=(n,e)=>{const t=n.l,r=t.length;n.l=t.filter(i=>e!==i),r===n.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},sy=(n,e,t)=>Vc(n.l,[e,t]);class Ki{constructor(e,t){this.client=e,this.clock=t}}const Ci=(n,e)=>n===e||n!==null&&e!==null&&n.client===e.client&&n.clock===e.clock,J=(n,e)=>new Ki(n,e),ei=n=>{for(const[e,t]of n.doc.share.entries())if(t===n)return e;throw Yt()};class Io{constructor(e,t,r,i=0){this.type=e,this.tname=t,this.item=r,this.assoc=i}}const xi=(n,e,t)=>{let r=null,i=null;return n._item===null?i=ei(n):r=J(n._item.id.client,n._item.id.clock),new Io(r,i,e,t)},El=(n,e,t=0)=>{let r=n._start;if(t<0){if(e===0)return xi(n,null,t);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return xi(n,J(r.id.client,r.id.clock+e),t);e-=r.length}if(r.right===null&&t<0)return xi(n,r.lastId,t);r=r.right}return xi(n,null,t)},Pn=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&(e.sv.get(n.id.client)||0)>n.id.clock&&!ny(e.ds,n.id),Da=(n,e)=>{const t=fr(n.meta,Da,Zn),r=n.doc.store;t.has(e)||(e.sv.forEach((i,o)=>{i<Oe(r,o)&&Xt(n,J(o,i))}),ty(n,e.ds,i=>{}),t.add(e))};class BN{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Uc=n=>{const e=new Map;return n.clients.forEach((t,r)=>{const i=t[t.length-1];e.set(r,i.id.clock+i.length)}),e},Oe=(n,e)=>{const t=n.clients.get(e);if(t===void 0)return 0;const r=t[t.length-1];return r.id.clock+r.length},ly=(n,e)=>{let t=n.clients.get(e.id.client);if(t===void 0)t=[],n.clients.set(e.id.client,t);else{const r=t[t.length-1];if(r.id.clock+r.length!==e.id.clock)throw Yt()}t.push(e)},St=(n,e)=>{let t=0,r=n.length-1,i=n[r],o=i.id.clock;if(o===e)return r;let s=wn(e/(o+i.length-1)*r);for(;t<=r;){if(i=n[s],o=i.id.clock,o<=e){if(e<o+i.length)return s;t=s+1}else r=s-1;s=wn((t+r)/2)}throw Yt()},zN=(n,e)=>{const t=n.clients.get(e.client);return t[St(t,e.clock)]},Al=zN,Ra=(n,e,t)=>{const r=St(e,t),i=e[r];return i.id.clock<t&&i instanceof Me?(e.splice(r+1,0,Ey(n,i,t-i.id.clock)),r+1):r},Xt=(n,e)=>{const t=n.doc.store.clients.get(e.client);return t[Ra(n,t,e.clock)]},dd=(n,e,t)=>{const r=e.clients.get(t.client),i=St(r,t.clock),o=r[i];return t.clock!==o.id.clock+o.length-1&&o.constructor!==Lt&&r.splice(i+1,0,Ey(n,o,t.clock-o.id.clock+1)),o},FN=(n,e,t)=>{const r=n.clients.get(e.id.client);r[St(r,e.id.clock)]=t},ay=(n,e,t,r,i)=>{if(r===0)return;const o=t+r;let s=Ra(n,e,t),l;do l=e[s++],o<l.id.clock+l.length&&Ra(n,e,o),i(l);while(s<e.length&&e[s].id.clock<o)};class jN{constructor(e,t,r){this.doc=e,this.deleteSet=new AN,this.beforeState=Uc(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const pd=(n,e)=>e.deleteSet.clients.size===0&&!kM(e.afterState,(t,r)=>e.beforeState.get(r)!==t)?!1:(ry(e.deleteSet),$N(n,e),MN(n,e.deleteSet),!0),gd=(n,e,t)=>{const r=e._item;(r===null||r.id.clock<(n.beforeState.get(r.id.client)||0)&&!r.deleted)&&fr(n.changed,e,Zn).add(t)},Gi=(n,e)=>{let t=n[e],r=n[e-1],i=e;for(;i>0;t=r,r=n[--i-1]){if(r.deleted===t.deleted&&r.constructor===t.constructor&&r.mergeWith(t)){t instanceof Me&&t.parentSub!==null&&t.parent._map.get(t.parentSub)===t&&t.parent._map.set(t.parentSub,r);continue}break}const o=e-i;return o&&n.splice(e+1-o,o),o},VN=(n,e,t)=>{for(const[r,i]of n.clients.entries()){const o=e.clients.get(r);for(let s=i.length-1;s>=0;s--){const l=i[s],a=l.clock+l.len;for(let c=St(o,l.clock),f=o[c];c<o.length&&f.id.clock<a;f=o[++c]){const u=o[c];if(l.clock+l.len<=u.id.clock)break;u instanceof Me&&u.deleted&&!u.keep&&t(u)&&u.gc(e,!1)}}}},WN=(n,e)=>{n.clients.forEach((t,r)=>{const i=e.clients.get(r);for(let o=t.length-1;o>=0;o--){const s=t[o],l=Wm(i.length-1,1+St(i,s.clock+s.len-1));for(let a=l,c=i[a];a>0&&c.id.clock>=s.clock;c=i[a])a-=1+Gi(i,a)}})},cy=(n,e)=>{if(e<n.length){const t=n[e],r=t.doc,i=r.store,o=t.deleteSet,s=t._mergeStructs;try{ry(o),t.afterState=Uc(t.doc.store),r.emit("beforeObserverCalls",[t,r]);const l=[];t.changed.forEach((a,c)=>l.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(t,a)})),l.push(()=>{t.changedParentTypes.forEach((a,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(a=a.filter(f=>f.target._item===null||!f.target._item.deleted),a.forEach(f=>{f.currentTarget=c,f._path=null}),a.sort((f,u)=>f.path.length-u.path.length),sy(c._dEH,a,t))})}),l.push(()=>r.emit("afterTransaction",[t,r])),Vc(l,[]),t._needFormattingCleanup&&tI(t)}finally{r.gc&&VN(o,i,r.gcFilter),WN(o,i),t.afterState.forEach((f,u)=>{const h=t.beforeState.get(u)||0;if(h!==f){const d=i.clients.get(u),p=ur(St(d,h),1);for(let g=d.length-1;g>=p;)g-=1+Gi(d,g)}});for(let f=s.length-1;f>=0;f--){const{client:u,clock:h}=s[f].id,d=i.clients.get(u),p=St(d,h);p+1<d.length&&Gi(d,p+1)>1||p>0&&Gi(d,p)}if(!t.local&&t.afterState.get(r.clientID)!==t.beforeState.get(r.clientID)&&(xN(Wc,qm,"[yjs] ",Ym,Xm,"Changed the client-id because another client seems to be using it."),r.clientID=oy()),r.emit("afterTransactionCleanup",[t,r]),r._observers.has("update")){const f=new IN;pd(f,t)&&r.emit("update",[f.toUint8Array(),t.origin,r,t])}if(r._observers.has("updateV2")){const f=new RN;pd(f,t)&&r.emit("updateV2",[f.toUint8Array(),t.origin,r,t])}const{subdocsAdded:l,subdocsLoaded:a,subdocsRemoved:c}=t;(l.size>0||c.size>0||a.size>0)&&(l.forEach(f=>{f.clientID=r.clientID,f.collectionid==null&&(f.collectionid=r.collectionid),r.subdocs.add(f)}),c.forEach(f=>r.subdocs.delete(f)),r.emit("subdocs",[{loaded:a,added:l,removed:c},r,t]),c.forEach(f=>f.destroy())),n.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,n])):cy(n,e+1)}}},H=(n,e,t=null,r=!0)=>{const i=n._transactionCleanups;let o=!1,s=null;n._transaction===null&&(o=!0,n._transaction=new jN(n,t,r),i.push(n._transaction),i.length===1&&n.emit("beforeAllTransactions",[n]),n.emit("beforeTransaction",[n._transaction,n]));try{s=e(n._transaction)}finally{if(o){const l=n._transaction===i[0];n._transaction=null,l&&cy(i,0)}}return s},md="You must not compute changes after the event-handler fired.";class Os{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=UN(this.currentTarget,this.target))}deletes(e){return ny(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw tr(md);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(i=>{if(i!==null){const o=t._map.get(i);let s,l;if(this.adds(o)){let a=o.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(o))if(a!==null&&this.deletes(a))s="delete",l=Sl(a.content.getContent());else return;else a!==null&&this.deletes(a)?(s="update",l=Sl(a.content.getContent())):(s="add",l=void 0)}else if(this.deletes(o))s="delete",l=Sl(o.content.getContent());else return;e.set(i,{action:s,oldValue:l})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw tr(md);const t=this.target,r=Zn(),i=Zn(),o=[];if(e={added:r,deleted:i,delta:o,keys:this.keys},this.transaction.changed.get(t).has(null)){let l=null;const a=()=>{l&&o.push(l)};for(let c=t._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((l===null||l.delete===void 0)&&(a(),l={delete:0}),l.delete+=c.length,i.add(c)):this.adds(c)?((l===null||l.insert===void 0)&&(a(),l={insert:[]}),l.insert=l.insert.concat(c.content.getContent()),r.add(c)):((l===null||l.retain===void 0)&&(a(),l={retain:0}),l.retain+=c.length);l!==null&&l.retain===void 0&&a()}this._changes=e}return e}}const UN=(n,e)=>{const t=[];for(;e._item!==null&&e!==n;){if(e._item.parentSub!==null)t.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;t.unshift(r)}e=e._item.parent}return t},me=()=>{kN("Invalid access: Add Yjs type to a document before reading data.")},fy=80;let Hc=0;class HN{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Hc++}}const JN=n=>{n.timestamp=Hc++},uy=(n,e,t)=>{n.p.marker=!1,n.p=e,e.marker=!0,n.index=t,n.timestamp=Hc++},KN=(n,e,t)=>{if(n.length>=fy){const r=n.reduce((i,o)=>i.timestamp<o.timestamp?i:o);return uy(r,e,t),r}else{const r=new HN(e,t);return n.push(r),r}},Es=(n,e)=>{if(n._start===null||e===0||n._searchMarker===null)return null;const t=n._searchMarker.length===0?null:n._searchMarker.reduce((o,s)=>Hi(e-o.index)<Hi(e-s.index)?o:s);let r=n._start,i=0;for(t!==null&&(r=t.p,i=t.index,JN(t));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return t!==null&&Hi(t.index-i)<r.parent.length/fy?(uy(t,r,i),t):KN(n._searchMarker,r,i)},ti=(n,e,t)=>{for(let r=n.length-1;r>=0;r--){const i=n[r];if(t>0){let o=i.p;for(o.marker=!1;o&&(o.deleted||!o.countable);)o=o.left,o&&!o.deleted&&o.countable&&(i.index-=o.length);if(o===null||o.marker===!0){n.splice(r,1);continue}i.p=o,o.marker=!0}(e<i.index||t>0&&e===i.index)&&(i.index=ur(e,i.index+t))}},As=(n,e,t)=>{const r=n,i=e.changedParentTypes;for(;fr(i,n,()=>[]).push(t),n._item!==null;)n=n._item.parent;sy(r._eH,t,e)};class de{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=fd(),this._dEH=fd(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw Ze()}clone(){throw Ze()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){ud(this._eH,e)}observeDeep(e){ud(this._dEH,e)}unobserve(e){hd(this._eH,e)}unobserveDeep(e){hd(this._dEH,e)}toJSON(){}}const hy=(n,e,t)=>{n.doc??me(),e<0&&(e=n._length+e),t<0&&(t=n._length+t);let r=t-e;const i=[];let o=n._start;for(;o!==null&&r>0;){if(o.countable&&!o.deleted){const s=o.content.getContent();if(s.length<=e)e-=s.length;else{for(let l=e;l<s.length&&r>0;l++)i.push(s[l]),r--;e=0}}o=o.right}return i},dy=n=>{n.doc??me();const e=[];let t=n._start;for(;t!==null;){if(t.countable&&!t.deleted){const r=t.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}t=t.right}return e},ni=(n,e)=>{let t=0,r=n._start;for(n.doc??me();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let o=0;o<i.length;o++)e(i[o],t++,n)}r=r.right}},py=(n,e)=>{const t=[];return ni(n,(r,i)=>{t.push(e(r,i,n))}),t},GN=n=>{let e=n._start,t=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(t===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};t=e.content.getContent(),r=0,e=e.right}const i=t[r++];return t.length<=r&&(t=null),{done:!1,value:i}}}},gy=(n,e)=>{n.doc??me();const t=Es(n,e);let r=n._start;for(t!==null&&(r=t.p,e-=t.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},Do=(n,e,t,r)=>{let i=t;const o=n.doc,s=o.clientID,l=o.store,a=t===null?e._start:t.right;let c=[];const f=()=>{c.length>0&&(i=new Me(J(s,Oe(l,s)),i,i&&i.lastId,a,a&&a.id,e,null,new rr(c)),i.integrate(n,0),c=[])};r.forEach(u=>{if(u===null)c.push(u);else switch(u.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(u);break;default:switch(f(),u.constructor){case Uint8Array:case ArrayBuffer:i=new Me(J(s,Oe(l,s)),i,i&&i.lastId,a,a&&a.id,e,null,new Ts(new Uint8Array(u))),i.integrate(n,0);break;case di:i=new Me(J(s,Oe(l,s)),i,i&&i.lastId,a,a&&a.id,e,null,new Ms(u)),i.integrate(n,0);break;default:if(u instanceof de)i=new Me(J(s,Oe(l,s)),i,i&&i.lastId,a,a&&a.id,e,null,new nn(u)),i.integrate(n,0);else throw new Error("Unexpected content type in insert operation")}}}),f()},my=()=>tr("Length exceeded!"),yy=(n,e,t,r)=>{if(t>e._length)throw my();if(t===0)return e._searchMarker&&ti(e._searchMarker,t,r.length),Do(n,e,null,r);const i=t,o=Es(e,t);let s=e._start;for(o!==null&&(s=o.p,t-=o.index,t===0&&(s=s.prev,t+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(t<=s.length){t<s.length&&Xt(n,J(s.id.client,s.id.clock+t));break}t-=s.length}return e._searchMarker&&ti(e._searchMarker,i,r.length),Do(n,e,s,r)},qN=(n,e,t)=>{let i=(e._searchMarker||[]).reduce((o,s)=>s.index>o.index?s:o,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return Do(n,e,i,t)},by=(n,e,t,r)=>{if(r===0)return;const i=t,o=r,s=Es(e,t);let l=e._start;for(s!==null&&(l=s.p,t-=s.index);l!==null&&t>0;l=l.right)!l.deleted&&l.countable&&(t<l.length&&Xt(n,J(l.id.client,l.id.clock+t)),t-=l.length);for(;r>0&&l!==null;)l.deleted||(r<l.length&&Xt(n,J(l.id.client,l.id.clock+r)),l.delete(n),r-=l.length),l=l.right;if(r>0)throw my();e._searchMarker&&ti(e._searchMarker,i,-o+r)},Ro=(n,e,t)=>{const r=e._map.get(t);r!==void 0&&r.delete(n)},Jc=(n,e,t,r)=>{const i=e._map.get(t)||null,o=n.doc,s=o.clientID;let l;if(r==null)l=new rr([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:l=new rr([r]);break;case Uint8Array:l=new Ts(r);break;case di:l=new Ms(r);break;default:if(r instanceof de)l=new nn(r);else throw new Error("Unexpected content type")}new Me(J(s,Oe(o.store,s)),i,i&&i.lastId,null,null,e,t,l).integrate(n,0)},Kc=(n,e)=>{n.doc??me();const t=n._map.get(e);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},wy=n=>{const e={};return n.doc??me(),n._map.forEach((t,r)=>{t.deleted||(e[r]=t.content.getContent()[t.length-1])}),e},Sy=(n,e)=>{n.doc??me();const t=n._map.get(e);return t!==void 0&&!t.deleted},YN=(n,e)=>{const t={};return n._map.forEach((r,i)=>{let o=r;for(;o!==null&&(!e.sv.has(o.id.client)||o.id.clock>=(e.sv.get(o.id.client)||0));)o=o.left;o!==null&&Pn(o,e)&&(t[i]=o.content.getContent()[o.length-1])}),t},ki=n=>(n.doc??me(),ON(n._map.entries(),e=>!e[1].deleted));class XN extends Os{}class Pr extends de{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const t=new Pr;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Pr}clone(){const e=new Pr;return e.insert(0,this.toArray().map(t=>t instanceof de?t.clone():t)),e}get length(){return this.doc??me(),this._length}_callObserver(e,t){super._callObserver(e,t),As(this,e,new XN(this,e))}insert(e,t){this.doc!==null?H(this.doc,r=>{yy(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){this.doc!==null?H(this.doc,t=>{qN(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc!==null?H(this.doc,r=>{by(r,this,e,t)}):this._prelimContent.splice(e,t)}get(e){return gy(this,e)}toArray(){return dy(this)}slice(e=0,t=this.length){return hy(this,e,t)}toJSON(){return this.map(e=>e instanceof de?e.toJSON():e)}map(e){return py(this,e)}forEach(e){ni(this,e)}[Symbol.iterator](){return GN(this)}_write(e){e.writeTypeRef(lI)}}class QN extends Os{constructor(e,t,r){super(e,t),this.keysChanged=r}}class _o extends de{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new _o}clone(){const e=new _o;return this.forEach((t,r)=>{e.set(r,t instanceof de?t.clone():t)}),e}_callObserver(e,t){As(this,e,new QN(this,e,t))}toJSON(){this.doc??me();const e={};return this._map.forEach((t,r)=>{if(!t.deleted){const i=t.content.getContent()[t.length-1];e[r]=i instanceof de?i.toJSON():i}}),e}get size(){return[...ki(this)].length}keys(){return Ol(ki(this),e=>e[0])}values(){return Ol(ki(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Ol(ki(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??me(),this._map.forEach((t,r)=>{t.deleted||e(t.content.getContent()[t.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?H(this.doc,t=>{Ro(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return this.doc!==null?H(this.doc,r=>{Jc(r,this,e,t)}):this._prelimContent.set(e,t),t}get(e){return Kc(this,e)}has(e){return Sy(this,e)}clear(){this.doc!==null?H(this.doc,e=>{this.forEach(function(t,r,i){Ro(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(aI)}}const Ut=(n,e)=>n===e||typeof n=="object"&&typeof e=="object"&&n&&e&&lN(n,e);class _a{constructor(e,t,r,i){this.left=e,this.right=t,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&Yt(),this.right.content.constructor){case ae:this.right.deleted||hr(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const yd=(n,e,t)=>{for(;e.right!==null&&t>0;){switch(e.right.content.constructor){case ae:e.right.deleted||hr(e.currentAttributes,e.right.content);break;default:e.right.deleted||(t<e.right.length&&Xt(n,J(e.right.id.client,e.right.id.clock+t)),e.index+=e.right.length,t-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},Oi=(n,e,t,r)=>{const i=new Map,o=r?Es(e,t):null;if(o){const s=new _a(o.p.left,o.p,o.index,i);return yd(n,s,t-o.index)}else{const s=new _a(null,e._start,0,i);return yd(n,s,t)}},vy=(n,e,t,r)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===ae&&Ut(r.get(t.right.content.key),t.right.content.value));)t.right.deleted||r.delete(t.right.content.key),t.forward();const i=n.doc,o=i.clientID;r.forEach((s,l)=>{const a=t.left,c=t.right,f=new Me(J(o,Oe(i.store,o)),a,a&&a.lastId,c,c&&c.id,e,null,new ae(l,s));f.integrate(n,0),t.right=f,t.forward()})},hr=(n,e)=>{const{key:t,value:r}=e;r===null?n.delete(t):n.set(t,r)},Cy=(n,e)=>{for(;n.right!==null;){if(!(n.right.deleted||n.right.content.constructor===ae&&Ut(e[n.right.content.key]??null,n.right.content.value)))break;n.forward()}},xy=(n,e,t,r)=>{const i=n.doc,o=i.clientID,s=new Map;for(const l in r){const a=r[l],c=t.currentAttributes.get(l)??null;if(!Ut(c,a)){s.set(l,c);const{left:f,right:u}=t;t.right=new Me(J(o,Oe(i.store,o)),f,f&&f.lastId,u,u&&u.id,e,null,new ae(l,a)),t.right.integrate(n,0),t.forward()}}return s},Tl=(n,e,t,r,i)=>{t.currentAttributes.forEach((h,d)=>{i[d]===void 0&&(i[d]=null)});const o=n.doc,s=o.clientID;Cy(t,i);const l=xy(n,e,t,i),a=r.constructor===String?new vt(r):r instanceof de?new nn(r):new dr(r);let{left:c,right:f,index:u}=t;e._searchMarker&&ti(e._searchMarker,t.index,a.getLength()),f=new Me(J(s,Oe(o.store,s)),c,c&&c.lastId,f,f&&f.id,e,null,a),f.integrate(n,0),t.right=f,t.index=u,t.forward(),vy(n,e,t,l)},bd=(n,e,t,r,i)=>{const o=n.doc,s=o.clientID;Cy(t,i);const l=xy(n,e,t,i);e:for(;t.right!==null&&(r>0||l.size>0&&(t.right.deleted||t.right.content.constructor===ae));){if(!t.right.deleted)switch(t.right.content.constructor){case ae:{const{key:a,value:c}=t.right.content,f=i[a];if(f!==void 0){if(Ut(f,c))l.delete(a);else{if(r===0)break e;l.set(a,c)}t.right.delete(n)}else t.currentAttributes.set(a,c);break}default:r<t.right.length&&Xt(n,J(t.right.id.client,t.right.id.clock+r)),r-=t.right.length;break}t.forward()}if(r>0){let a="";for(;r>0;r--)a+=`
|
|
15
|
+
`;t.right=new Me(J(s,Oe(o.store,s)),t.left,t.left&&t.left.lastId,t.right,t.right&&t.right.id,e,null,new vt(a)),t.right.integrate(n,0),t.forward()}vy(n,e,t,l)},ky=(n,e,t,r,i)=>{let o=e;const s=Qe();for(;o&&(!o.countable||o.deleted);){if(!o.deleted&&o.content.constructor===ae){const c=o.content;s.set(c.key,c)}o=o.right}let l=0,a=!1;for(;e!==o;){if(t===e&&(a=!0),!e.deleted){const c=e.content;switch(c.constructor){case ae:{const{key:f,value:u}=c,h=r.get(f)??null;(s.get(f)!==c||h===u)&&(e.delete(n),l++,!a&&(i.get(f)??null)===u&&h!==u&&(h===null?i.delete(f):i.set(f,h))),!a&&!e.deleted&&hr(i,c);break}}}e=e.right}return l},ZN=(n,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const t=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===ae){const r=e.content.key;t.has(r)?e.delete(n):t.add(r)}e=e.left}},eI=n=>{let e=0;return H(n.doc,t=>{let r=n._start,i=n._start,o=Qe();const s=Ta(o);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case ae:hr(s,i.content);break;default:e+=ky(t,r,i,o,s),o=Ta(s),r=i;break}i=i.right}}),e},tI=n=>{const e=new Set,t=n.doc;for(const[r,i]of n.afterState.entries()){const o=n.beforeState.get(r)||0;i!==o&&ay(n,t.store.clients.get(r),o,i,s=>{!s.deleted&&s.content.constructor===ae&&s.constructor!==Lt&&e.add(s.parent)})}H(t,r=>{ty(n,n.deleteSet,i=>{if(i instanceof Lt||!i.parent._hasFormatting||e.has(i.parent))return;const o=i.parent;i.content.constructor===ae?e.add(o):ZN(r,i)});for(const i of e)eI(i)})},wd=(n,e,t)=>{const r=t,i=Ta(e.currentAttributes),o=e.right;for(;t>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case nn:case dr:case vt:t<e.right.length&&Xt(n,J(e.right.id.client,e.right.id.clock+t)),t-=e.right.length,e.right.delete(n);break}e.forward()}o&&ky(n,o,e.right,i,e.currentAttributes);const s=(e.left||e.right).parent;return s._searchMarker&&ti(s._searchMarker,e.index,-r+t),e};class nI extends Os{constructor(e,t,r){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,t=[];H(e,r=>{const i=new Map,o=new Map;let s=this.target._start,l=null;const a={};let c="",f=0,u=0;const h=()=>{if(l!==null){let d=null;switch(l){case"delete":u>0&&(d={delete:u}),u=0;break;case"insert":(typeof c=="object"||c.length>0)&&(d={insert:c},i.size>0&&(d.attributes={},i.forEach((p,g)=>{p!==null&&(d.attributes[g]=p)}))),c="";break;case"retain":f>0&&(d={retain:f},iN(a)||(d.attributes=tN({},a))),f=0;break}d&&t.push(d),l=null}};for(;s!==null;){switch(s.content.constructor){case nn:case dr:this.adds(s)?this.deletes(s)||(h(),l="insert",c=s.content.getContent()[0],h()):this.deletes(s)?(l!=="delete"&&(h(),l="delete"),u+=1):s.deleted||(l!=="retain"&&(h(),l="retain"),f+=1);break;case vt:this.adds(s)?this.deletes(s)||(l!=="insert"&&(h(),l="insert"),c+=s.content.str):this.deletes(s)?(l!=="delete"&&(h(),l="delete"),u+=s.length):s.deleted||(l!=="retain"&&(h(),l="retain"),f+=s.length);break;case ae:{const{key:d,value:p}=s.content;if(this.adds(s)){if(!this.deletes(s)){const g=i.get(d)??null;Ut(g,p)?p!==null&&s.delete(r):(l==="retain"&&h(),Ut(p,o.get(d)??null)?delete a[d]:a[d]=p)}}else if(this.deletes(s)){o.set(d,p);const g=i.get(d)??null;Ut(g,p)||(l==="retain"&&h(),a[d]=g)}else if(!s.deleted){o.set(d,p);const g=a[d];g!==void 0&&(Ut(g,p)?g!==null&&s.delete(r):(l==="retain"&&h(),p===null?delete a[d]:a[d]=p))}s.deleted||(l==="insert"&&h(),hr(i,s.content));break}}s=s.right}for(h();t.length>0;){const d=t[t.length-1];if(d.retain!==void 0&&d.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}}class ri extends de{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??me(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new ri}clone(){const e=new ri;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);const r=new nI(this,e,t);As(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??me();let e="",t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===vt&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc!==null?H(this.doc,r=>{const i=new _a(null,this._start,0,new Map);for(let o=0;o<e.length;o++){const s=e[o];if(s.insert!==void 0){const l=!t&&typeof s.insert=="string"&&o===e.length-1&&i.right===null&&s.insert.slice(-1)===`
|
|
16
|
+
`?s.insert.slice(0,-1):s.insert;(typeof l!="string"||l.length>0)&&Tl(r,this,i,l,s.attributes||{})}else s.retain!==void 0?bd(r,this,i,s.retain,s.attributes||{}):s.delete!==void 0&&wd(r,i,s.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,t,r){this.doc??me();const i=[],o=new Map,s=this.doc;let l="",a=this._start;function c(){if(l.length>0){const u={};let h=!1;o.forEach((p,g)=>{h=!0,u[g]=p});const d={insert:l};h&&(d.attributes=u),i.push(d),l=""}}const f=()=>{for(;a!==null;){if(Pn(a,e)||t!==void 0&&Pn(a,t))switch(a.content.constructor){case vt:{const u=o.get("ychange");e!==void 0&&!Pn(a,e)?(u===void 0||u.user!==a.id.client||u.type!=="removed")&&(c(),o.set("ychange",r?r("removed",a.id):{type:"removed"})):t!==void 0&&!Pn(a,t)?(u===void 0||u.user!==a.id.client||u.type!=="added")&&(c(),o.set("ychange",r?r("added",a.id):{type:"added"})):u!==void 0&&(c(),o.delete("ychange")),l+=a.content.str;break}case nn:case dr:{c();const u={insert:a.content.getContent()[0]};if(o.size>0){const h={};u.attributes=h,o.forEach((d,p)=>{h[p]=d})}i.push(u);break}case ae:Pn(a,e)&&(c(),hr(o,a.content));break}a=a.right}c()};return e||t?H(s,u=>{e&&Da(u,e),t&&Da(u,t),f()},"cleanup"):f(),i}insert(e,t,r){if(t.length<=0)return;const i=this.doc;i!==null?H(i,o=>{const s=Oi(o,this,e,!r);r||(r={},s.currentAttributes.forEach((l,a)=>{r[a]=l})),Tl(o,this,s,t,r)}):this._pending.push(()=>this.insert(e,t,r))}insertEmbed(e,t,r){const i=this.doc;i!==null?H(i,o=>{const s=Oi(o,this,e,!r);Tl(o,this,s,t,r||{})}):this._pending.push(()=>this.insertEmbed(e,t,r||{}))}delete(e,t){if(t===0)return;const r=this.doc;r!==null?H(r,i=>{wd(i,Oi(i,this,e,!0),t)}):this._pending.push(()=>this.delete(e,t))}format(e,t,r){if(t===0)return;const i=this.doc;i!==null?H(i,o=>{const s=Oi(o,this,e,!1);s.right!==null&&bd(o,this,s,t,r)}):this._pending.push(()=>this.format(e,t,r))}removeAttribute(e){this.doc!==null?H(this.doc,t=>{Ro(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){this.doc!==null?H(this.doc,r=>{Jc(r,this,e,t)}):this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return Kc(this,e)}getAttributes(){return wy(this)}_write(e){e.writeTypeRef(cI)}}class Ml{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??me()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===ii||t.constructor===nr)&&t._start!==null)e=t._start;else for(;e!==null;)if(e.right!==null){e=e.right;break}else e.parent===this._root?e=null:e=e.parent._item;while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class nr extends de{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new nr}clone(){const e=new nr;return e.insert(0,this.toArray().map(t=>t instanceof de?t.clone():t)),e}get length(){return this.doc??me(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new Ml(this,e)}querySelector(e){e=e.toUpperCase();const r=new Ml(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),er(new Ml(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){As(this,e,new rI(this,t,e))}toString(){return py(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),ni(this,o=>{i.insertBefore(o.toDOM(e,t,r),null)}),i}insert(e,t){this.doc!==null?H(this.doc,r=>{yy(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(this.doc!==null)H(this.doc,r=>{const i=e&&e instanceof de?e._item:e;Do(r,this,i,t)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(o=>o===e)+1;if(i===0&&e!==null)throw tr("Reference item not found");r.splice(i,0,...t)}}delete(e,t=1){this.doc!==null?H(this.doc,r=>{by(r,this,e,t)}):this._prelimContent.splice(e,t)}toArray(){return dy(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return gy(this,e)}slice(e=0,t=this.length){return hy(this,e,t)}forEach(e){ni(this,e)}_write(e){e.writeTypeRef(uI)}}class ii extends nr{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new ii(this.nodeName)}clone(){const e=new ii(this.nodeName),t=this.getAttributes();return rN(t,(r,i)=>{typeof r=="string"&&e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof de?r.clone():r)),e}toString(){const e=this.getAttributes(),t=[],r=[];for(const l in e)r.push(l);r.sort();const i=r.length;for(let l=0;l<i;l++){const a=r[l];t.push(a+'="'+e[a]+'"')}const o=this.nodeName.toLocaleLowerCase(),s=t.length>0?" "+t.join(" "):"";return`<${o}${s}>${super.toString()}</${o}>`}removeAttribute(e){this.doc!==null?H(this.doc,t=>{Ro(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){this.doc!==null?H(this.doc,r=>{Jc(r,this,e,t)}):this._prelimAttrs.set(e,t)}getAttribute(e){return Kc(this,e)}hasAttribute(e){return Sy(this,e)}getAttributes(e){return e?YN(this,e):wy(this)}toDOM(e=document,t={},r){const i=e.createElement(this.nodeName),o=this.getAttributes();for(const s in o){const l=o[s];typeof l=="string"&&i.setAttribute(s,l)}return ni(this,s=>{i.appendChild(s.toDOM(e,t,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(fI),e.writeKey(this.nodeName)}}class rI extends Os{constructor(e,t,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class oi extends ri{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new oi}clone(){const e=new oi;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const t=[];for(const i in e.attributes){const o=[];for(const s in e.attributes[i])o.push({key:s,value:e.attributes[i][s]});o.sort((s,l)=>s.key<l.key?-1:1),t.push({nodeName:i,attrs:o})}t.sort((i,o)=>i.nodeName<o.nodeName?-1:1);let r="";for(let i=0;i<t.length;i++){const o=t[i];r+=`<${o.nodeName}`;for(let s=0;s<o.attrs.length;s++){const l=o.attrs[s];r+=` ${l.key}="${l.value}"`}r+=">"}r+=e.insert;for(let i=t.length-1;i>=0;i--)r+=`</${t[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(hI)}}class Oy{constructor(e,t){this.id=e,this.length=t}get deleted(){throw Ze()}mergeWith(e){return!1}write(e,t,r){throw Ze()}integrate(e,t){throw Ze()}}const iI=0;class Lt extends Oy{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),ly(e.doc.store,this)}write(e,t){e.writeInfo(iI),e.writeLen(this.length-t)}getMissing(e,t){return null}}class Ts{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Ts(this.content)}splice(e){throw Ze()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}class Po{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Po(this.len)}splice(e){const t=new Po(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){iy(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}const oI=(n,e)=>new di({guid:n,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Ms{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Ms(oI(this.doc.guid,this.opts))}splice(e){throw Ze()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}class dr{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new dr(this.embed)}splice(e){throw Ze()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}class ae{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new ae(this.key,this.value)}splice(e){throw Ze()}mergeWith(e){return!1}integrate(e,t){const r=t.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const sI=No("node_env")==="development";class rr{constructor(e){this.arr=e,sI&&Km(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new rr(this.arr)}splice(e){const t=new rr(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const r=this.arr.length;e.writeLen(r-t);for(let i=t;i<r;i++){const o=this.arr[i];e.writeAny(o)}}getRef(){return 8}}class vt{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new vt(this.str)}splice(e){const t=new vt(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}}const lI=0,aI=1,cI=2,fI=3,uI=4,hI=6;class nn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new nn(this.type._copy())}splice(e){throw Ze()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}const Ey=(n,e,t)=>{const{client:r,clock:i}=e.id,o=new Me(J(r,i+t),e,J(r,i+t-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(t));return e.deleted&&o.markDeleted(),e.keep&&(o.keep=!0),e.redone!==null&&(o.redone=J(e.redone.client,e.redone.clock+t)),e.right=o,o.right!==null&&(o.right.left=o),n._mergeStructs.push(o),o.parentSub!==null&&o.right===null&&o.parent._map.set(o.parentSub,o),e.length=t,o};let Me=class Pa extends Oy{constructor(e,t,r,i,o,s,l,a){super(e,a.getLength()),this.origin=r,this.left=t,this.right=i,this.rightOrigin=o,this.parent=s,this.parentSub=l,this.redone=null,this.content=a,this.info=this.content.isCountable()?ed:0}set marker(e){(this.info&Cl)>0!==e&&(this.info^=Cl)}get marker(){return(this.info&Cl)>0}get keep(){return(this.info&Zh)>0}set keep(e){this.keep!==e&&(this.info^=Zh)}get countable(){return(this.info&ed)>0}get deleted(){return(this.info&vl)>0}set deleted(e){this.deleted!==e&&(this.info^=vl)}markDeleted(){this.info|=vl}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Oe(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Oe(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Ki&&this.id.client!==this.parent.client&&this.parent.clock>=Oe(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=dd(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Xt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Lt||this.right&&this.right.constructor===Lt)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Pa&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===Pa&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Ki){const r=Al(t,this.parent);r.constructor===Lt?this.parent=null:this.parent=r.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=dd(e,e.doc.store,J(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const o=new Set,s=new Set;for(;i!==null&&i!==this.right;){if(s.add(i),o.add(i),Ci(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,o.clear();else if(Ci(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&s.has(Al(e.doc.store,i.origin)))o.has(Al(e.doc.store,i.origin))||(r=i,o.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),ly(e.doc.store,this),this.content.integrate(e,this),gd(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Lt(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:J(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Ci(e.origin,this.lastId)&&this.right===e&&Ci(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const t=this.parent._searchMarker;return t&&t.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),iy(e.deleteSet,this.id.client,this.id.clock,this.length),gd(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw Yt();this.content.gc(e),t?FN(e,this,new Lt(this.id,this.length)):this.content=new Po(this.length)}write(e,t){const r=t>0?J(this.id.client,this.id.clock+t-1):this.origin,i=this.rightOrigin,o=this.parentSub,s=this.content.getRef()&MM|(r===null?0:Mo)|(i===null?0:Um)|(o===null?0:TM);if(e.writeInfo(s),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const l=this.parent;if(l._item!==void 0){const a=l._item;if(a===null){const c=ei(l);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else l.constructor===String?(e.writeParentInfo(!0),e.writeString(l)):l.constructor===Ki?(e.writeParentInfo(!1),e.writeLeftID(l)):Yt();o!==null&&e.writeString(o)}this.content.write(e,t)}};const Ay=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},Ty="__ $YJS$ __";Ay[Ty]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");Ay[Ty]=!0;const dI=new Ct("y-sync");new Ct("y-undo");new Ct("yjs-cursor");const pI=(n,e,t)=>{if(n===0)return El(e,0,-1);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof oi){if(r._length>=n)return El(r,n,-1);if(n-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,n--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(t.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&n<i)r=r._first.content.type,n--;else{if(n===1&&r._length===0&&i>1)return new Io(r._item===null?null:r._item.id,r._item===null?ei(r):null,null);if(n-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(n===0)return r=r._item===null?r:r._item.parent,new Io(r._item===null?null:r._item.id,r._item===null?ei(r):null,null);do r=r._item.parent,n--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw Yt();if(n===0&&r.constructor!==oi&&r!==e)return gI(r._item.parent,r._item)}return El(e,e._length,-1)},gI=(n,e)=>{let t=null,r=null;return n._item===null?r=ei(n):t=J(n._item.id.client,n._item.id.clock),new Io(t,r,e.id)},mI="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",yI="ελ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",ir=(n,e)=>{for(const t in e)n[t]=e[t];return n},$a="numeric",La="ascii",Ba="alpha",qi="asciinumeric",Ei="alphanumeric",za="domain",My="emoji",bI="scheme",wI="slashscheme",Sd="whitespace";function SI(n,e){return n in e||(e[n]=[]),e[n]}function ln(n,e,t){e[$a]&&(e[qi]=!0,e[Ei]=!0),e[La]&&(e[qi]=!0,e[Ba]=!0),e[qi]&&(e[Ei]=!0),e[Ba]&&(e[Ei]=!0),e[Ei]&&(e[za]=!0),e[My]&&(e[za]=!0);for(const r in e){const i=SI(r,t);i.indexOf(n)<0&&i.push(n)}}function vI(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function ke(n){n===void 0&&(n=null),this.j={},this.jr=[],this.jd=null,this.t=n}ke.groups={};ke.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||ke.groups;let i;return e&&e.j?i=e:(i=new ke(e),t&&r&&ln(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||ke.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 ke,ir(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new ke,o){if(r)if(s.t&&typeof s.t=="string"){const a=ir(vI(s.t,r),t);ln(o,a,r)}else t&&ln(o,t,r);s.t=o}return i.j[n]=s,s}};const P=(n,e,t,r,i)=>n.ta(e,t,r,i),Ne=(n,e,t,r,i)=>n.tr(e,t,r,i),vd=(n,e,t,r,i)=>n.ts(e,t,r,i),S=(n,e,t,r,i)=>n.tt(e,t,r,i),dt="WORD",Fa="UWORD",si="LOCALHOST",ja="TLD",Va="UTLD",Yi="SCHEME",$n="SLASH_SCHEME",Gc="NUM",Ny="WS",qc="NL",$r="OPENBRACE",Lr="CLOSEBRACE",$o="OPENBRACKET",Lo="CLOSEBRACKET",Bo="OPENPAREN",zo="CLOSEPAREN",Fo="OPENANGLEBRACKET",jo="CLOSEANGLEBRACKET",Vo="FULLWIDTHLEFTPAREN",Wo="FULLWIDTHRIGHTPAREN",Uo="LEFTCORNERBRACKET",Ho="RIGHTCORNERBRACKET",Jo="LEFTWHITECORNERBRACKET",Ko="RIGHTWHITECORNERBRACKET",Go="FULLWIDTHLESSTHAN",qo="FULLWIDTHGREATERTHAN",Yo="AMPERSAND",Xo="APOSTROPHE",Qo="ASTERISK",_t="AT",Zo="BACKSLASH",es="BACKTICK",ts="CARET",Bt="COLON",Yc="COMMA",ns="DOLLAR",Je="DOT",rs="EQUALS",Xc="EXCLAMATION",Ke="HYPHEN",is="PERCENT",ss="PIPE",ls="PLUS",as="POUND",cs="QUERY",Qc="QUOTE",Zc="SEMI",Ge="SLASH",Br="TILDE",fs="UNDERSCORE",Iy="EMOJI",us="SYM";var Dy=Object.freeze({__proto__:null,WORD:dt,UWORD:Fa,LOCALHOST:si,TLD:ja,UTLD:Va,SCHEME:Yi,SLASH_SCHEME:$n,NUM:Gc,WS:Ny,NL:qc,OPENBRACE:$r,CLOSEBRACE:Lr,OPENBRACKET:$o,CLOSEBRACKET:Lo,OPENPAREN:Bo,CLOSEPAREN:zo,OPENANGLEBRACKET:Fo,CLOSEANGLEBRACKET:jo,FULLWIDTHLEFTPAREN:Vo,FULLWIDTHRIGHTPAREN:Wo,LEFTCORNERBRACKET:Uo,RIGHTCORNERBRACKET:Ho,LEFTWHITECORNERBRACKET:Jo,RIGHTWHITECORNERBRACKET:Ko,FULLWIDTHLESSTHAN:Go,FULLWIDTHGREATERTHAN:qo,AMPERSAND:Yo,APOSTROPHE:Xo,ASTERISK:Qo,AT:_t,BACKSLASH:Zo,BACKTICK:es,CARET:ts,COLON:Bt,COMMA:Yc,DOLLAR:ns,DOT:Je,EQUALS:rs,EXCLAMATION:Xc,HYPHEN:Ke,PERCENT:is,PIPE:ss,PLUS:ls,POUND:as,QUERY:cs,QUOTE:Qc,SEMI:Zc,SLASH:Ge,TILDE:Br,UNDERSCORE:fs,EMOJI:Iy,SYM:us});const In=/[a-z]/,Nl=new RegExp("\\p{L}","u"),Il=new RegExp("\\p{Emoji}","u"),Dl=/\d/,Cd=/\s/,xd=`
|
|
17
|
+
`,CI="️",xI="";let Ai=null,Ti=null;function kI(n){n===void 0&&(n=[]);const e={};ke.groups=e;const t=new ke;Ai==null&&(Ai=kd(mI)),Ti==null&&(Ti=kd(yI)),S(t,"'",Xo),S(t,"{",$r),S(t,"}",Lr),S(t,"[",$o),S(t,"]",Lo),S(t,"(",Bo),S(t,")",zo),S(t,"<",Fo),S(t,">",jo),S(t,"(",Vo),S(t,")",Wo),S(t,"「",Uo),S(t,"」",Ho),S(t,"『",Jo),S(t,"』",Ko),S(t,"<",Go),S(t,">",qo),S(t,"&",Yo),S(t,"*",Qo),S(t,"@",_t),S(t,"`",es),S(t,"^",ts),S(t,":",Bt),S(t,",",Yc),S(t,"$",ns),S(t,".",Je),S(t,"=",rs),S(t,"!",Xc),S(t,"-",Ke),S(t,"%",is),S(t,"|",ss),S(t,"+",ls),S(t,"#",as),S(t,"?",cs),S(t,'"',Qc),S(t,"/",Ge),S(t,";",Zc),S(t,"~",Br),S(t,"_",fs),S(t,"\\",Zo);const r=Ne(t,Dl,Gc,{[$a]:!0});Ne(r,Dl,r);const i=Ne(t,In,dt,{[La]:!0});Ne(i,In,i);const o=Ne(t,Nl,Fa,{[Ba]:!0});Ne(o,In),Ne(o,Nl,o);const s=Ne(t,Cd,Ny,{[Sd]:!0});S(t,xd,qc,{[Sd]:!0}),S(s,xd),Ne(s,Cd,s);const l=Ne(t,Il,Iy,{[My]:!0});Ne(l,Il,l),S(l,CI,l);const a=S(l,xI);Ne(a,Il,l);const c=[[In,i]],f=[[In,null],[Nl,o]];for(let u=0;u<Ai.length;u++)Mt(t,Ai[u],ja,dt,c);for(let u=0;u<Ti.length;u++)Mt(t,Ti[u],Va,Fa,f);ln(ja,{tld:!0,ascii:!0},e),ln(Va,{utld:!0,alpha:!0},e),Mt(t,"file",Yi,dt,c),Mt(t,"mailto",Yi,dt,c),Mt(t,"http",$n,dt,c),Mt(t,"https",$n,dt,c),Mt(t,"ftp",$n,dt,c),Mt(t,"ftps",$n,dt,c),ln(Yi,{scheme:!0,ascii:!0},e),ln($n,{slashscheme:!0,ascii:!0},e),n=n.sort((u,h)=>u[0]>h[0]?1:-1);for(let u=0;u<n.length;u++){const h=n[u][0],p=n[u][1]?{[bI]:!0}:{[wI]:!0};h.indexOf("-")>=0?p[za]=!0:In.test(h)?Dl.test(h)?p[qi]=!0:p[La]=!0:p[$a]=!0,vd(t,h,h,p)}return vd(t,"localhost",si,{ascii:!0}),t.jd=new ke(us),{start:t,tokens:ir({groups:e},Dy)}}function OI(n,e){const t=EI(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,h=-1;for(;s<r&&(a=l.go(t[s]));)l=a,l.accepts()?(u=0,h=0,f=l):u>=0&&(u+=t[s].length,h++),c+=t[s].length,o+=t[s].length,s++;o-=u,s-=h,c-=u,i.push({t:f.t,v:e.slice(o-c,o),s:o-c,e:o})}return i}function EI(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 Mt(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 ke(r),o.jr=i.slice(),n.j[a]=o),n=o}return o=new ke(t),o.jr=i.slice(),n.j[e[s-1]]=o,o}function kd(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 li={defaultProtocol:"http",events:null,format:Od,formatHref:Od,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ef(n,e){e===void 0&&(e=null);let t=ir({},li);n&&(t=ir(t,n instanceof ef?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}ef.prototype={o:li,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]:li[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 Od(n){return n}function Ry(n,e){this.t="token",this.v=n,this.tk=e}Ry.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=li.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&&ir(s,f),{tagName:i,attributes:s,content:o,eventListeners:u}}};function Ns(n,e){class t extends Ry{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 Ed=Ns("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ad=Ns("text"),AI=Ns("nl"),Mi=Ns("url",{isLink:!0,toHref(n){return n===void 0&&(n=li.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==si&&n[1].t===Bt}}),Ie=n=>new ke(n);function TI(n){let{groups:e}=n;const t=e.domain.concat([Yo,Qo,_t,Zo,es,ts,ns,rs,Ke,Gc,is,ss,ls,as,Ge,us,Br,fs]),r=[Xo,Bt,Yc,Je,Xc,cs,Qc,Zc,Fo,jo,$r,Lr,Lo,$o,Bo,zo,Vo,Wo,Uo,Ho,Jo,Ko,Go,qo],i=[Yo,Xo,Qo,Zo,es,ts,ns,rs,Ke,$r,Lr,is,ss,ls,as,cs,Ge,us,Br,fs],o=Ie(),s=S(o,Br);P(s,i,s),P(s,e.domain,s);const l=Ie(),a=Ie(),c=Ie();P(o,e.domain,l),P(o,e.scheme,a),P(o,e.slashscheme,c),P(l,i,s),P(l,e.domain,l);const f=S(l,_t);S(s,_t,f),S(a,_t,f),S(c,_t,f);const u=S(s,Je);P(u,i,s),P(u,e.domain,s);const h=Ie();P(f,e.domain,h),P(h,e.domain,h);const d=S(h,Je);P(d,e.domain,h);const p=Ie(Ed);P(d,e.tld,p),P(d,e.utld,p),S(f,si,p);const g=S(h,Ke);P(g,e.domain,h),P(p,e.domain,h),S(p,Je,d),S(p,Ke,g);const m=S(p,Bt);P(m,e.numeric,Ed);const y=S(l,Ke),x=S(l,Je);P(y,e.domain,l),P(x,i,s),P(x,e.domain,l);const O=Ie(Mi);P(x,e.tld,O),P(x,e.utld,O),P(O,e.domain,l),P(O,i,s),S(O,Je,x),S(O,Ke,y),S(O,_t,f);const N=S(O,Bt),M=Ie(Mi);P(N,e.numeric,M);const C=Ie(Mi),D=Ie();P(C,t,C),P(C,r,D),P(D,t,C),P(D,r,D),S(O,Ge,C),S(M,Ge,C);const R=S(a,Bt),A=S(c,Bt),Z=S(A,Ge),E=S(Z,Ge);P(a,e.domain,l),S(a,Je,x),S(a,Ke,y),P(c,e.domain,l),S(c,Je,x),S(c,Ke,y),P(R,e.domain,C),S(R,Ge,C),P(E,e.domain,C),P(E,t,C),S(E,Ge,C);const k=[[$r,Lr],[$o,Lo],[Bo,zo],[Fo,jo],[Vo,Wo],[Uo,Ho],[Jo,Ko],[Go,qo]];for(let $=0;$<k.length;$++){const[w,ee]=k[$],z=S(C,w);S(D,w,z),S(z,ee,C);const j=Ie(Mi);P(z,t,j);const ce=Ie();P(z,r),P(j,t,j),P(j,r,ce),P(ce,t,j),P(ce,r,ce),S(j,ee,C),S(ce,ee,C)}return S(o,si,O),S(o,qc,AI),{start:o,tokens:Dy}}function MI(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,h=-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()?(h=0,u=l):h>=0&&h++,i++,f++;if(h<0)i-=f,i<r&&(s.push(t[i]),i++);else{s.length>0&&(o.push(Rl(Ad,e,s)),s=[]),i-=h,f-=h;const d=u.t,p=t.slice(i-f,i);o.push(Rl(d,e,p))}}return s.length>0&&o.push(Rl(Ad,e,s)),o}function Rl(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 NI=typeof console<"u"&&console&&console.warn||(()=>{}),II="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",q={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function DI(){ke.groups={},q.scanner=null,q.parser=null,q.tokenQueue=[],q.pluginQueue=[],q.customSchemes=[],q.initialized=!1}function RI(n,e){if(e===void 0&&(e=!1),q.initialized&&NI(`linkifyjs: already initialized - will not register custom scheme "${n}" ${II}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
|
18
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
19
|
+
2. Cannot start or end with "-"
|
|
20
|
+
3. "-" cannot repeat`);q.customSchemes.push([n,e])}function _I(){q.scanner=kI(q.customSchemes);for(let n=0;n<q.tokenQueue.length;n++)q.tokenQueue[n][1]({scanner:q.scanner});q.parser=TI(q.scanner.tokens);for(let n=0;n<q.pluginQueue.length;n++)q.pluginQueue[n][1]({scanner:q.scanner,parser:q.parser});q.initialized=!0}function _y(n){return q.initialized||_I(),MI(q.parser.start,n,OI(q.scanner.start,n))}function PI(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 ef(t),i=_y(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 hs=200,le=function(){};le.prototype.append=function(e){return e.length?(e=le.from(e),!this.length&&e||e.length<hs&&this.leafAppend(e)||this.length<hs&&e.leafPrepend(this)||this.appendInner(e)):this};le.prototype.prepend=function(e){return e.length?le.from(e).append(this):this};le.prototype.appendInner=function(e){return new $I(this,e)};le.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?le.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};le.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};le.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)};le.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};le.from=function(e){return e instanceof le?e:e&&e.length?new Py(e):le.empty};var Py=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<=hs)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=hs)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}(le);le.empty=new Py([]);var $I=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}(le);const LI=500;class Fe{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,h)=>{if(!u.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,f.push(u);return}if(i){f.push(new qe(u.map));let d=u.step.map(i.slice(o)),p;d&&s.maybeStep(d).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new qe(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 Fe(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]),h=new qe(e.mapping.maps[f],u,t),d;(d=a&&a.merge(h))&&(h=d,f?o.pop():l=l.slice(0,l.length-1)),o.push(h),t&&(s++,t=void 0),i||(a=h)}let c=s-r.depth;return c>zI&&(l=BI(l,c),s-=c),new Fe(l.append(o),s)}remapping(e,t){let r=new zn;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 Fe(this.items.append(e.map(t=>new qe(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(h=>{h.selection&&l--},i);let a=t;this.items.forEach(h=>{let d=o.getMirror(--a);if(d==null)return;s=Math.min(s,d);let p=o.maps[d];if(h.step){let g=e.steps[d].invert(e.docs[d]),m=h.selection&&h.selection.map(o.slice(a+1,d));m&&l++,r.push(new qe(p,g,m))}else r.push(new qe(p))},i);let c=[];for(let h=t;h<s;h++)c.push(new qe(o.maps[h]));let f=this.items.slice(0,i).append(c).append(r),u=new Fe(f,l);return u.emptyItemCount()>LI&&(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 qe(c.invert(),a,f),h,d=i.length-1;(h=i.length&&i[d].merge(u))?i[d]=h:i.push(u)}}else s.map&&r--},this.items.length,0),new Fe(le.from(i.reverse()),o)}}Fe.empty=new Fe(le.empty,0);function BI(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class qe{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 qe(t.getMap().invert(),t,this.selection)}}}class Pt{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const zI=20;function FI(n,e,t,r){let i=t.getMeta(pn),o;if(i)return i.historyState;t.getMeta(WI)&&(n=new Pt(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(pn))return s.getMeta(pn).redo?new Pt(n.done.addTransform(t,void 0,r,Xi(e)),n.undone,Td(t.mapping.maps),n.prevTime,n.prevComposition):new Pt(n.done,n.undone.addTransform(t,void 0,r,Xi(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||!jI(t,n.prevRanges)),c=s?_l(n.prevRanges,t.mapping):Td(t.mapping.maps);return new Pt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Xi(e)),Fe.empty,c,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new Pt(n.done.rebased(t,o),n.undone.rebased(t,o),_l(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Pt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),_l(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function jI(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 Td(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 _l(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 VI(n,e,t){let r=Xi(e),i=pn.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 Pt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(pn,{redo:t,historyState:a})}let Pl=!1,Md=null;function Xi(n){let e=n.plugins;if(Md!=e){Pl=!1,Md=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Pl=!0;break}}return Pl}const pn=new Ct("history"),WI=new Ct("closeHistory");function UI(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Cn({key:pn,state:{init(){return new Pt(Fe.empty,Fe.empty,null,0,-1)},apply(e,t,r){return FI(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?Ly:r=="historyRedo"?By:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function $y(n,e){return(t,r)=>{let i=pn.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=VI(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const Ly=$y(!1,!0),By=$y(!0,!0);function HI(n={}){return new Cn({view(e){return new JI(e,n)}})}class JI{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=ap(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 X extends I{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return X.valid(r)?new X(r):I.near(r)}content(){return v.empty}eq(e){return e instanceof X&&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 X(e.resolve(t.pos))}getBookmark(){return new tf(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!KI(e)||!GI(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&&X.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(X.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!T.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(X.valid(l))return l}return null}}}X.prototype.visible=!1;X.findFrom=X.findGapCursorFrom;I.jsonID("gapcursor",X);class tf{constructor(e){this.pos=e}map(e){return new tf(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return X.valid(t)?new X(t):I.near(t)}}function KI(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 GI(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 qI(){return new Cn({props:{decorations:ZI,createSelectionBetween(n,e,t){return e.pos==t.pos&&X.valid(t)?new X(t):null},handleClick:XI,handleKeyDown:YI,handleDOMEvents:{beforeinput:QI}}})}const YI=fc({ArrowLeft:Ni("horiz",-1),ArrowRight:Ni("horiz",1),ArrowUp:Ni("vert",-1),ArrowDown:Ni("vert",1)});function Ni(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 L){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=X.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new X(c))),!0):!1}}function XI(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!X.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&T.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new X(r))),!0)}function QI(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof X))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(L.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function ZI(n){if(!(n.selection instanceof X))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Y.create(n.doc,[Se.widget(n.selection.head,e,{key:"gapcursor"})])}var Wa,Ua;if(typeof WeakMap<"u"){let n=new WeakMap;Wa=e=>n.get(e),Ua=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;Wa=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},Ua=(r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i)}var Q=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 Wa(n)||Ua(n,eD(n))}};function eD(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=tD(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 g=u.child(p),{colspan:m,rowspan:y,colwidth:x}=g.attrs;for(let O=0;O<y;O++){if(O+c>=t){(o||(o=[])).push({type:"overlong_rowspan",pos:f,n:y-O});break}const N=i+O*e;for(let M=0;M<m;M++){r[N+M]==0?r[N+M]=f:(o||(o=[])).push({type:"collision",row:c,pos:f,n:m-M});const C=x&&x[M];if(C){const D=(N+M)%e*2,R=s[D];R==null||R!=C&&s[D+1]==1?(s[D]=C,s[D+1]=1):R==C&&s[D+1]++}}}i+=m,f+=g.nodeSize}const h=(c+1)*e;let d=0;for(;i<h;)r[i++]==0&&d++;d&&(o||(o=[])).push({type:"missing",row:c,n:d}),f++}const l=new Q(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&&nD(l,s,n),l}function tD(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 nD(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=rD(a)))[c]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:l})}}function rD(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function be(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 zt=new Ct("selectingCells");function pr(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 iD(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 Ue(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 Is(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=pr(e.$head)||oD(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function oD(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 Ha(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function sD(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function nf(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function zy(n,e,t){const r=n.node(-1),i=Q.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 Sn(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 Fy(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 lD(n,e,t){const r=be(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 K=class pt extends I{constructor(e,t=e){const r=e.node(-1),i=Q.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 h=o+f+1;return new ec(l.resolve(h),l.resolve(h+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(Ha(r)&&Ha(i)&&nf(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?pt.rowSelection(r,i):o&&this.isColSelection()?pt.colSelection(r,i):new pt(r,i)}return L.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=Q.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 h=t.map[f];if(o[h])continue;o[h]=!0;const d=t.findCell(h);let p=e.nodeAt(h);if(!p)throw RangeError(`No cell with offset ${h} found`);const g=i.left-d.left,m=d.right-i.right;if(g>0||m>0){let y=p.attrs;if(g>0&&(y=Sn(y,0,g)),m>0&&(y=Sn(y,y.colspan-m,m)),d.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(d.top<i.top||d.bottom>i.bottom){const y={...p.attrs,rowspan:Math.min(d.bottom,i.bottom)-Math.max(d.top,i.top)};d.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=I.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=Q.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=Q.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 pt(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=Q.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 pt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=Q.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 pt(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new pt(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new pt(e.resolve(t),e.resolve(r))}getBookmark(){return new aD(this.$anchorCell.pos,this.$headCell.pos)}};K.prototype.visible=!1;I.jsonID("cell",K);var aD=class jy{constructor(e,t){this.anchor=e,this.head=t}map(e){return new jy(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&&nf(t,r)?new K(t,r):I.near(r,1)}};function cD(n){if(!(n.selection instanceof K))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(Se.node(r,r+t.nodeSize,{class:"selectedCell"}))}),Y.create(n.doc,e)}function fD({$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 uD({$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 hD(n,e,t){const r=(e||n).selection,i=(e||n).doc;let o,s;if(r instanceof T&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=K.create(i,r.from);else if(s=="row"){const l=i.resolve(r.from+1);o=K.rowSelection(l,l)}else if(!t){const l=Q.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];o=K.create(i,a+1,c)}}else r instanceof L&&fD(r)?o=L.create(i,r.from):r instanceof L&&uD(r)&&(o=L.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=n.tr)).setSelection(o),e}var dD=new Ct("fix-tables");function Vy(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)?Vy(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function Wy(n,e){let t;const r=(i,o)=>{i.type.spec.tableRole=="table"&&(t=pD(n,i,o,t))};return e?e.doc!=n.doc&&Vy(e.doc,n.doc,0,r):n.doc.descendants(r),t}function pD(n,e,t,r){const i=Q.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 h=0;h<u.rowspan;h++)o[c.row+h]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,Sn(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,h=o[a];if(h>0){let d="cell";f.firstChild&&(d=f.firstChild.type.spec.tableRole);const p=[];for(let m=0;m<h;m++){const y=be(n.schema)[d].createAndFill();y&&p.push(y)}const g=(a==0||s==a-1)&&l==a?c+1:u-1;r.insert(r.mapping.map(g),p)}c=u}return r.setMeta(dD,{fixTables:!0})}function gD(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=Ja(be(s).row,new v(c,f,u)).content),l.push(c)}else if(o=="cell"||o=="header_cell")l.push(t||r?Ja(be(s).row,new v(e,t,r)).content:e);else return null;return mD(s,l)}function mD(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=be(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 Ja(n,e){const t=n.createAndFill();return new Za(t).replace(0,t.content.size,e).doc}function yD({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 h=a.child(u%a.childCount);f+h.attrs.colspan>r&&(h=h.type.createChecked(Sn(h.attrs,h.attrs.colspan,f+h.attrs.colspan-r),h.content)),c.push(h),f+=h.attrs.colspan;for(let d=1;d<h.attrs.rowspan;d++)o[l+d]=(o[l+d]||0)+h.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 bD(n,e,t,r,i,o,s){const l=n.doc.type.schema,a=be(l);let c,f;if(i>e.width)for(let u=0,h=0;u<e.height;u++){const d=t.child(u);h+=d.nodeSize;const p=[];let g;d.lastChild==null||d.lastChild.type==a.cell?g=c||(c=a.cell.createAndFill()):g=f||(f=a.header_cell.createAndFill());for(let m=e.width;m<i;m++)p.push(g);n.insert(n.mapping.slice(s).map(h-1+r),p)}if(o>e.height){const u=[];for(let p=0,g=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const m=p>=e.width?!1:t.nodeAt(e.map[g+p]).type==a.header_cell;u.push(m?f||(f=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const h=a.row.create(null,b.from(u)),d=[];for(let p=e.height;p<o;p++)d.push(h);n.insert(n.mapping.slice(s).map(r+t.nodeSize-2),d)}return!!(c||f)}function Nd(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 h=t.nodeAt(u),{top:d,left:p}=e.findCell(u);n.setNodeMarkup(n.mapping.slice(l).map(u+r),null,{...h.attrs,rowspan:s-d}),n.insert(n.mapping.slice(l).map(e.positionAt(s,p,t)),h.type.createAndFill({...h.attrs,rowspan:d+h.attrs.rowspan-s})),c+=h.attrs.colspan-1}}return a}function Id(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 h=t.nodeAt(u),d=e.colCount(u),p=n.mapping.slice(l).map(u+r);n.setNodeMarkup(p,null,Sn(h.attrs,s-d,h.attrs.colspan-(s-d))),n.insert(p+h.nodeSize,h.type.createAndFill(Sn(h.attrs,0,s-d))),c+=h.attrs.rowspan-1}}return a}function Dd(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=Q.get(o);const{top:l,left:a}=r,c=a+i.width,f=l+i.height,u=n.tr;let h=0;function d(){if(o=t?u.doc.nodeAt(t-1):u.doc,!o)throw new Error("No table found");s=Q.get(o),h=u.mapping.maps.length}bD(u,s,o,t,c,f,h)&&d(),Nd(u,s,o,t,a,c,l,h)&&d(),Nd(u,s,o,t,a,c,f,h)&&d(),Id(u,s,o,t,l,f,a,h)&&d(),Id(u,s,o,t,l,f,c,h)&&d();for(let p=l;p<f;p++){const g=s.positionAt(p,a,o),m=s.positionAt(p,c,o);u.replace(u.mapping.slice(h).map(g+t),u.mapping.slice(h).map(m+t),new v(i.rows[p-l],0,0))}d(),u.setSelection(new K(u.doc.resolve(t+s.positionAt(l,a,o)),u.doc.resolve(t+s.positionAt(f-1,c-1,o)))),e(u)}var wD=fc({ArrowLeft:Ii("horiz",-1),ArrowRight:Ii("horiz",1),ArrowUp:Ii("vert",-1),ArrowDown:Ii("vert",1),"Shift-ArrowLeft":Di("horiz",-1),"Shift-ArrowRight":Di("horiz",1),"Shift-ArrowUp":Di("vert",-1),"Shift-ArrowDown":Di("vert",1),Backspace:Ri,"Mod-Backspace":Ri,Delete:Ri,"Mod-Delete":Ri});function Qi(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Ii(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;if(o instanceof K)return Qi(t,r,I.near(o.$headCell,e));if(n!="horiz"&&!o.empty)return!1;const s=Uy(i,n,e);if(s==null)return!1;if(n=="horiz")return Qi(t,r,I.near(t.doc.resolve(o.head+e),e));{const l=t.doc.resolve(s),a=zy(l,n,e);let c;return a?c=I.near(a,1):e<0?c=I.near(t.doc.resolve(l.before(-1)),-1):c=I.near(t.doc.resolve(l.after(-1)),1),Qi(t,r,c)}}}function Di(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;let s;if(o instanceof K)s=o;else{const a=Uy(i,n,e);if(a==null)return!1;s=new K(t.doc.resolve(a))}const l=zy(s.$headCell,n,e);return l?Qi(t,r,new K(s.$anchorCell,l)):!1}}function Ri(n,e){const t=n.selection;if(!(t instanceof K))return!1;if(e){const r=n.tr,i=be(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 SD(n,e){const t=n.state.doc,r=pr(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new K(r))),!0):!1}function vD(n,e,t){if(!Ue(n.state))return!1;let r=gD(t);const i=n.state.selection;if(i instanceof K){r||(r={width:1,height:1,rows:[b.from(Ja(be(n.state.schema).cell,t))]});const o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),l=Q.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=yD(r,l.right-l.left,l.bottom-l.top),Dd(n.state,n.dispatch,s,l,r),!0}else if(r){const o=Is(n.state),s=o.start(-1);return Dd(n.state,n.dispatch,s,Q.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function CD(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=Rd(n,e.target);let i;if(e.shiftKey&&n.state.selection instanceof K)o(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=pr(n.state.selection.$anchor))!=null&&((t=$l(n,e))==null?void 0:t.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(a,c){let f=$l(n,c);const u=zt.getState(n.state)==null;if(!f||!nf(a,f))if(u)f=a;else return;const h=new K(a,f);if(u||!n.state.selection.eq(h)){const d=n.state.tr.setSelection(h);u&&d.setMeta(zt,a.pos),n.dispatch(d)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),zt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(zt,-1))}function l(a){const c=a,f=zt.getState(n.state);let u;if(f!=null)u=n.state.doc.resolve(f);else if(Rd(n,c.target)!=r&&(u=$l(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 Uy(n,e,t){if(!(n.state.selection instanceof L))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 Rd(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function $l(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?pr(n.state.doc.resolve(t.pos)):null}var xD=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")),Ka(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,Ka(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Ka(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,h=0;u<f.childCount;u++){const{colspan:d,colwidth:p}=f.child(u).attrs;for(let g=0;g<d;g++,h++){const m=i==h?o:p&&p[g],y=m?m+"px":"";l+=m||r,m||(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 _e=new Ct("tableColumnResizing");function kD({handleWidth:n=5,cellMinWidth:e=25,View:t=xD,lastColumnResizable:r=!0}={}){const i=new Cn({key:_e,state:{init(o,s){var l,a;const c=(a=(l=i.spec)==null?void 0:l.props)==null?void 0:a.nodeViews,f=be(s.schema).table.name;return t&&c&&(c[f]=(u,h)=>new t(u,e,h)),new OD(-1,!1)},apply(o,s){return s.apply(o)}},props:{attributes:o=>{const s=_e.getState(o);return s&&s.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,s)=>{ED(o,s,n,e,r)},mouseleave:o=>{AD(o)},mousedown:(o,s)=>{TD(o,s,e)}},decorations:o=>{const s=_e.getState(o);if(s&&s.activeHandle>-1)return _D(o,s.activeHandle)},nodeViews:{}}});return i}var OD=class Zi{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(_e);if(r&&r.setHandle!=null)return new Zi(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Zi(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return Ha(e.doc.resolve(i))||(i=-1),new Zi(i,t.dragging)}return t}};function ED(n,e,t,r,i){const o=_e.getState(n.state);if(o&&!o.dragging){const s=ND(e.target);let l=-1;if(s){const{left:a,right:c}=s.getBoundingClientRect();e.clientX-a<=t?l=_d(n,e,"left",t):c-e.clientX<=t&&(l=_d(n,e,"right",t))}if(l!=o.activeHandle){if(!i&&l!==-1){const a=n.state.doc.resolve(l),c=a.node(-1),f=Q.get(c),u=a.start(-1);if(f.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==f.width-1)return}Hy(n,l)}}}function AD(n){const e=_e.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Hy(n,-1)}function TD(n,e,t){var r;const i=(r=n.dom.ownerDocument.defaultView)!=null?r:window,o=_e.getState(n.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const s=n.state.doc.nodeAt(o.activeHandle),l=MD(n,o.activeHandle,s.attrs);n.dispatch(n.state.tr.setMeta(_e,{setDragging:{startX:e.clientX,startWidth:l}}));function a(f){i.removeEventListener("mouseup",a),i.removeEventListener("mousemove",c);const u=_e.getState(n.state);u!=null&&u.dragging&&(ID(n,u.activeHandle,Pd(u.dragging,f,t)),n.dispatch(n.state.tr.setMeta(_e,{setDragging:null})))}function c(f){if(!f.which)return a(f);const u=_e.getState(n.state);if(u&&u.dragging){const h=Pd(u.dragging,f,t);DD(n,u.activeHandle,h,t)}}return i.addEventListener("mouseup",a),i.addEventListener("mousemove",c),e.preventDefault(),!0}function MD(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 ND(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function _d(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=pr(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=Q.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 Pd(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function Hy(n,e){n.dispatch(n.state.tr.setMeta(_e,{setHandle:e}))}function ID(n,e,t){const r=n.state.doc.resolve(e),i=r.node(-1),o=Q.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],h=i.nodeAt(u).attrs,d=h.colspan==1?0:l-o.colCount(u);if(h.colwidth&&h.colwidth[d]==t)continue;const p=h.colwidth?h.colwidth.slice():RD(h.colspan);p[d]=t,a.setNodeMarkup(s+u,null,{...h,colwidth:p})}a.docChanged&&n.dispatch(a)}function DD(n,e,t,r){const i=n.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),l=Q.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&&Ka(o,a.firstChild,a,r,l,t)}function RD(n){return Array(n).fill(0)}function _D(n,e){const t=[],r=n.doc.resolve(e),i=r.node(-1);if(!i)return Y.empty;const o=Q.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,h=document.createElement("div");h.className="column-resize-handle",t.push(Se.widget(u,h))}}return Y.create(n.doc,t)}function lt(n){const e=n.selection,t=Is(n),r=t.node(-1),i=t.start(-1),o=Q.get(r);return{...e instanceof K?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(t.pos-i),tableStart:i,map:o,table:r}}function Jy(n,{map:e,tableStart:t,table:r},i){let o=i>0?-1:0;lD(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,Fy(c.attrs,i-e.colCount(a))),s+=c.attrs.rowspan-1}else{const a=o==null?be(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 PD(n,e){if(!Ue(n))return!1;if(e){const t=lt(n);e(Jy(n.tr,t,t.left))}return!0}function $D(n,e){if(!Ue(n))return!1;if(e){const t=lt(n);e(Jy(n.tr,t,t.right))}return!0}function LD(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,Sn(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 BD(n,e){if(!Ue(n))return!1;if(e){const t=lt(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let i=t.right-1;LD(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=Q.get(o)}e(r)}return!0}function zD(n,e,t){var r;const i=be(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 Ky(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;zD(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],h=r.nodeAt(u).attrs;n.setNodeMarkup(t+u,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{const u=a==null?be(r.type.schema).cell:(o=r.nodeAt(e.map[f+a*e.width]))==null?void 0:o.type,h=u==null?void 0:u.createAndFill();h&&l.push(h)}return n.insert(s,be(r.type.schema).row.create(null,l)),n}function FD(n,e){if(!Ue(n))return!1;if(e){const t=lt(n);e(Ky(n.tr,t,t.top))}return!0}function jD(n,e){if(!Ue(n))return!1;if(e){const t=lt(n);e(Ky(n.tr,t,t.bottom))}return!0}function VD(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 h=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(l).map(u+r),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<e.height&&u==e.map[f+e.width]){const h=t.nodeAt(u),d=h.attrs,p=h.type.create({...d,rowspan:h.attrs.rowspan-1},h.content),g=e.positionAt(i+1,c,t);n.insert(n.mapping.slice(l).map(r+g),p),c+=d.colspan-1}}}}function WD(n,e){if(!Ue(n))return!1;if(e){const t=lt(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let i=t.bottom-1;VD(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=Q.get(t.table)}e(r)}return!0}function $d(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function UD({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 HD(n,e){const t=n.selection;if(!(t instanceof K)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=lt(n),{map:i}=r;if(UD(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 h=i.map[f*i.width+u],d=r.table.nodeAt(h);if(!(s[h]||!d))if(s[h]=!0,a==null)a=h,c=d;else{$d(d)||(l=l.append(d.content));const p=o.mapping.map(h+r.tableStart);o.delete(p,p+d.nodeSize)}}if(a==null||c==null)return!0;if(o.setNodeMarkup(a+r.tableStart,null,{...Fy(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=$d(c)?a+1:f;o.replaceWith(u+r.tableStart,f+r.tableStart,l)}o.setSelection(new K(o.doc.resolve(a+r.tableStart))),e(o)}return!0}function JD(n,e){const t=be(n.schema);return KD(({node:r})=>t[r.type.spec.tableRole])(n,e)}function KD(n){return(e,t)=>{var r;const i=e.selection;let o,s;if(i instanceof K){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;o=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos}else{if(o=iD(i.$from),!o)return!1;s=(r=pr(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=lt(e),u=e.tr;for(let d=0;d<f.right-f.left;d++)a.push(c?{...l,colwidth:c&&c[d]?[c[d]]:null}:l);let h;for(let d=f.top;d<f.bottom;d++){let p=f.map.positionAt(d,f.left,f.table);d==f.top&&(p+=o.nodeSize);for(let g=f.left,m=0;g<f.right;g++,m++)g==f.left&&d==f.top||u.insert(h=u.mapping.map(p+f.tableStart,1),n({node:o,row:d,col:g}).createAndFill(a[m]))}u.setNodeMarkup(s,n({node:o,row:f.top,col:f.left}),a[0]),i instanceof K&&u.setSelection(new K(u.doc.resolve(i.$anchorCell.pos),h?u.doc.resolve(h):void 0)),t(u)}return!0}}function GD(n,e){return function(t,r){if(!Ue(t))return!1;const i=Is(t);if(i.nodeAfter.attrs[n]===e)return!1;if(r){const o=t.tr;t.selection instanceof K?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 qD(n){return function(e,t){if(!Ue(e))return!1;if(t){const r=be(e.schema),i=lt(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 Ld(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 Ds(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?qD(n):function(t,r){if(!Ue(t))return!1;if(r){const i=be(t.schema),o=lt(t),s=t.tr,l=Ld("row",o,i),a=Ld("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,h=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;o.map.cellsInRect(u).forEach(d=>{const p=d+o.tableStart,g=s.doc.nodeAt(p);g&&s.setNodeMarkup(p,h,g.attrs)}),r(s)}return!0}}Ds("row",{useDeprecatedLogic:!0});Ds("column",{useDeprecatedLogic:!0});var YD=Ds("cell",{useDeprecatedLogic:!0});function XD(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 QD(n){return function(e,t){if(!Ue(e))return!1;const r=XD(Is(e),n);if(r==null)return!1;if(t){const i=e.doc.resolve(r);t(e.tr.setSelection(L.between(i,sD(i))).scrollIntoView())}return!0}}function ZD(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 eR({allowTableNodeSelection:n=!1}={}){return new Cn({key:zt,state:{init(){return null},apply(e,t){const r=e.getMeta(zt);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:cD,handleDOMEvents:{mousedown:CD},createSelectionBetween(e){return zt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:SD,handleKeyDown:wD,handlePaste:vD},appendTransaction(e,t,r){return hD(r,Wy(r,t),n)}})}exports.AllSelection=Pe;exports.CellSelection=K;exports.DOMParser=Ga;exports.DOMSerializer=vn;exports.Decoration=Se;exports.DecorationSet=Y;exports.EditorState=Ln;exports.EditorView=x1;exports.Fragment=b;exports.Node=je;exports.NodeRange=Fr;exports.NodeSelection=T;exports.Plugin=Cn;exports.PluginKey=Ct;exports.ReplaceAroundStep=se;exports.ReplaceStep=oe;exports.Schema=hb;exports.Selection=I;exports.SelectionRange=ec;exports.Slice=v;exports.TextSelection=L;exports.Transform=Za;exports.VisibilitySensor=Dk;exports.absolutePositionToRelativePosition=pI;exports.addColumnAfter=$D;exports.addColumnBefore=PD;exports.addRowAfter=jD;exports.addRowBefore=FD;exports.canJoin=sr;exports.canSplit=Xa;exports.clamp=LA;exports.clsx=ow;exports.columnResizing=kD;exports.createParagraphNear=H1;exports.cva=Nk;exports.debounce=$m;exports.deepEqual=Tk;exports.deleteColumn=BD;exports.deleteRow=WD;exports.deleteSelection=R1;exports.deleteTable=ZD;exports.differenceBy=XT;exports.dropCursor=HI;exports.exitCode=U1;exports.find=PI;exports.findWrapping=Ya;exports.fixTables=Wy;exports.gapCursor=qI;exports.goToNextCell=QD;exports.history=UI;exports.i=Lk;exports.isNumber=ZT;exports.joinBackward=_1;exports.joinDown=j1;exports.joinForward=B1;exports.joinPoint=Qa;exports.joinTextblockBackward=P1;exports.joinTextblockForward=$1;exports.joinUp=F1;exports.keymap=D1;exports.lift=V1;exports.liftEmptyBlock=J1;exports.liftListItem=tw;exports.liftTarget=or;exports.mergeCells=HD;exports.newlineInCode=W1;exports.redo=By;exports.registerCustomProtocol=RI;exports.reset=DI;exports.selectNodeBackward=L1;exports.selectNodeForward=z1;exports.selectParentNode=K1;exports.selectTextblockEnd=Y1;exports.selectTextblockStart=q1;exports.setBlockType=Q1;exports.setCellAttr=GD;exports.sinkListItem=iw;exports.splitCell=JD;exports.tableEditing=eR;exports.throttle=bM;exports.toggleHeader=Ds;exports.toggleHeaderCell=YD;exports.tokenize=_y;exports.truncate=CM;exports.twMerge=Lw;exports.undo=Ly;exports.wrapIn=X1;exports.wrapInList=Z1;exports.ySyncPluginKey=dI;
|