react-tiptap-base-editor 1.2.2 → 1.3.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/dist/index.cjs CHANGED
@@ -14,19 +14,19 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var nu;function A0(){return nu||(nu=1,process.env.NODE_ENV!=="production"&&(function(){function t(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}function e(h,p){u||o.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=p();if(!d){var v=p();i(m,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}v=s({inst:{value:m,getSnapshot:p}});var b=v[0].inst,C=v[1];return a(function(){b.value=m,b.getSnapshot=p,n(b)&&C({inst:b})},[h,m,p]),l(function(){return n(b)&&C({inst:b}),h(function(){n(b)&&C({inst:b})})},[h]),c(m),m}function n(h){var p=h.getSnapshot;h=h.value;try{var m=p();return!i(h,m)}catch{return!0}}function r(h,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=j,i=typeof Object.is=="function"?Object.is:t,s=o.useState,l=o.useEffect,a=o.useLayoutEffect,c=o.useDebugValue,u=!1,d=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;ws.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),ws}var ru;function ma(){return ru||(ru=1,process.env.NODE_ENV==="production"?uo.exports=T0():uo.exports=A0()),uo.exports}var kf=ma();function Se(t){this.content=t}Se.prototype={constructor:Se,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Se(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Se(n)},addToStart:function(t,e){return new Se([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Se(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new Se(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Se.from(t),t.size?new Se(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Se.from(t),t.size?new Se(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Se.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Se.from=function(t){if(t instanceof Se)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Se(e)};function Ef(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=Ef(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function Mf(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=0,u=Math.min(s.text.length,l.text.length);for(;c<u&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||l.content.size){let c=Mf(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class A{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new A(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),o+=l.nodeSize),s=a}return new A(r,o)}cutByIndex(e,n){return e==n?A.empty:e==0&&n==this.content.length?this:new A(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new A(o,i)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return Ef(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Mf(this,e,n,r)}findIndex(e){if(e==0)return fo(0,e);if(e==this.size)return fo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?fo(n+1,i):fo(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return A.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new A(n||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const Ss={index:0,offset:0};function fo(t,e){return Ss.index=t,Ss.offset=e,Ss}function zo(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!zo(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!zo(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ne=class Cl{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&zo(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Cl.none;if(e instanceof Cl)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};ne.none=[];class Uo extends Error{}class D{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Af(this.content,e+this.openStart,n);return r&&new D(r,this.openStart,this.openEnd)}removeBetween(e,n){return new D(Tf(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return D.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new D(A.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new D(e,r,o)}}D.empty=new D(A.empty,0,0);function Tf(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(o==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Tf(i.content,e-o-1,n-o-1)))}function Af(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Af(s.content,e-i-1,n,s);return l&&t.replaceChild(o,s.copy(l))}function R0(t,e,n){if(n.openStart>t.depth)throw new Uo("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Uo("Inconsistent open depths");return Rf(t,e,n,0)}function Rf(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=Rf(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return wn(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=O0(n,t);return wn(i,Nf(t,s,l,e,r))}else return wn(i,Wo(t,e,r))}function Of(t,e){if(!e.type.compatibleContent(t.type))throw new Uo("Cannot join "+e.type.name+" onto "+t.type.name)}function xl(t,e,n){let r=t.node(n);return Of(r,e.node(n)),r}function xn(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function xr(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(xn(t.nodeAfter,r),i++));for(let l=i;l<s;l++)xn(o.child(l),r);e&&e.depth==n&&e.textOffset&&xn(e.nodeBefore,r)}function wn(t,e){return t.type.checkContent(e),t.copy(e)}function Nf(t,e,n,r,o){let i=t.depth>o&&xl(t,e,o+1),s=r.depth>o&&xl(n,r,o+1),l=[];return xr(null,t,o,l),i&&s&&e.index(o)==n.index(o)?(Of(i,s),xn(wn(i,Nf(t,e,n,r,o+1)),l)):(i&&xn(wn(i,Wo(t,e,o+1)),l),xr(e,n,o,l),s&&xn(wn(s,Wo(n,r,o+1)),l)),xr(r,null,o,l),new A(l)}function Wo(t,e,n){let r=[];if(xr(null,t,n,r),t.depth>n){let o=xl(t,e,n+1);xn(wn(o,Wo(t,e,n+1)),r)}return xr(e,null,n,r),new A(r)}function O0(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(A.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class Nr{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ne.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Ko(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new Nr(n,r,i)}static resolveCached(e,n){let r=ou.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else ou.set(e,r=new N0);let o=r.elts[r.i]=Nr.resolve(e,n);return r.i=(r.i+1)%I0,o}}class N0{constructor(){this.elts=[],this.i=0}}const I0=12,ou=new WeakMap;class Ko{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const L0=Object.create(null);let Xt=class wl{constructor(e,n,r,o=ne.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&zo(this.attrs,n||e.defaultAttrs||L0)&&ne.sameSet(this.marks,r||ne.none)}copy(e=null){return e==this.content?this:new wl(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new wl(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return D.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new D(c,o.depth-s,i.depth-s)}replace(e,n,r){return R0(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Nr.resolveCached(this,e)}resolveNoCache(e){return Nr.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),If(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=A.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ne.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ne.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=A.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};Xt.prototype.text=void 0;class qo extends Xt{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):If(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new qo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new qo(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function If(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Mn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new D0(e,n);if(r.next==null)return Mn.empty;let o=Lf(r);r.next&&r.err("Unexpected trailing text");let i=$0(F0(o));return V0(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return A.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),n[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 n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
18
- `)}}Mn.empty=new Mn(!0);class D0{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Lf(t){let e=[];do e.push(P0(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function P0(t){let e=[];do e.push(j0(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function j0(t){let e=H0(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=B0(t,e);else break;return e}function iu(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function B0(t,e){let n=iu(t),r=n;return t.eat(",")&&(t.next!="}"?r=iu(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function _0(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function H0(t){if(t.eat("(")){let e=Lf(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=_0(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function F0(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,a),u),a=u}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=n();r(a,u),o(i(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Df(t,e){return e-t}function su(t,e){let n=[];return r(e),n.sort(Df);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&n.indexOf(a)==-1&&r(a)}}}function $0(t){let e=Object.create(null);return n(su(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);su(t,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new Mn(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(Df);i.next.push({type:o[s][0],next:e[l.join(",")]||n(l)})}return i}}function V0(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Pf(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function jf(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function Bf(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let i=t[o];i.validate&&i.validate(e[o])}}function _f(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new U0(t,r,e[r]);return n}let lu=class Hf{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=_f(e,r.attrs),this.defaultAttrs=Pf(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==Mn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:jf(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Xt(this,this.computeAttrs(e),A.from(n),ne.setFrom(r))}createChecked(e=null,n,r){return n=A.from(n),this.checkContent(n),new Xt(this,this.computeAttrs(e),n,ne.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=A.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(A.empty,!0);return i?new Xt(this,e,n.append(i),ne.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Bf(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:ne.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new Hf(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function z0(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class U0{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?z0(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Fi{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=_f(e,o.attrs),this.excluded=null;let i=Pf(this.attrs);this.instance=i?new ne(this,i):null}create(e=null){return!e&&this.instance?this.instance:new ne(this,jf(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new Fi(i,o++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Bf(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Ff{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Se.from(e.nodes),n.marks=Se.from(e.marks||{}),this.nodes=lu.compile(this.spec.nodes,this),this.marks=Fi.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=Mn.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?au(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:au(this,s.split(" "))}this.nodeFromJSON=o=>Xt.fromJSON(this,o),this.markFromJSON=o=>ne.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof lu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new qo(r,r.defaultAttrs,e,ne.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function au(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let l in t.marks){let a=t.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function W0(t){return t.tag!=null}function K0(t){return t.style!=null}class Qt{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(W0(o))this.tags.push(o);else if(K0(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new uu(this,n,!1);return r.addAll(e,ne.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new uu(this,n,!0);return r.addAll(e,ne.none,n.from,n.to),D.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(J0(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=du(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=du(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Qt(e,Qt.schemaRules(e)))}}const $f={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},q0={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Vf={ol:!0,ul:!0},Ir=1,Sl=2,wr=4;function cu(t,e,n){return e!=null?(e?Ir:0)|(e==="full"?Sl:0):t&&t.whitespace=="pre"?Ir|Sl:n&~wr}class ho{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=ne.none,this.match=i||(s&wr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(A.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ir)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=A.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(A.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!$f.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class uu{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=cu(null,n.preserveWhitespace,0)|(r?wr:0);o?i=new ho(o.type,o.attrs,ne.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new ho(null,null,ne.none,!0,null,s):i=new ho(e.schema.topNodeType,null,ne.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,i=o.options&Sl?"full":this.localPreserveWS||(o.options&Ir)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
17
+ */var nu;function A0(){return nu||(nu=1,process.env.NODE_ENV!=="production"&&(function(){function t(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}function e(h,p){u||o.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=p();if(!d){var v=p();i(m,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}v=s({inst:{value:m,getSnapshot:p}});var b=v[0].inst,C=v[1];return a(function(){b.value=m,b.getSnapshot=p,n(b)&&C({inst:b})},[h,m,p]),l(function(){return n(b)&&C({inst:b}),h(function(){n(b)&&C({inst:b})})},[h]),c(m),m}function n(h){var p=h.getSnapshot;h=h.value;try{var m=p();return!i(h,m)}catch{return!0}}function r(h,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=j,i=typeof Object.is=="function"?Object.is:t,s=o.useState,l=o.useEffect,a=o.useLayoutEffect,c=o.useDebugValue,u=!1,d=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;ws.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),ws}var ru;function ma(){return ru||(ru=1,process.env.NODE_ENV==="production"?uo.exports=T0():uo.exports=A0()),uo.exports}var kf=ma();function Se(t){this.content=t}Se.prototype={constructor:Se,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Se(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Se(n)},addToStart:function(t,e){return new Se([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Se(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new Se(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Se.from(t),t.size?new Se(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Se.from(t),t.size?new Se(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Se.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Se.from=function(t){if(t instanceof Se)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Se(e)};function Ef(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=Ef(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function Mf(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=0,u=Math.min(s.text.length,l.text.length);for(;c<u&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||l.content.size){let c=Mf(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class A{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new A(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),o+=l.nodeSize),s=a}return new A(r,o)}cutByIndex(e,n){return e==n?A.empty:e==0&&n==this.content.length?this:new A(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new A(o,i)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return Ef(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Mf(this,e,n,r)}findIndex(e){if(e==0)return fo(0,e);if(e==this.size)return fo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?fo(n+1,i):fo(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return A.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new A(n||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const Ss={index:0,offset:0};function fo(t,e){return Ss.index=t,Ss.offset=e,Ss}function zo(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!zo(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!zo(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ne=class Cl{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&zo(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Cl.none;if(e instanceof Cl)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};ne.none=[];class Uo extends Error{}class D{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Af(this.content,e+this.openStart,n);return r&&new D(r,this.openStart,this.openEnd)}removeBetween(e,n){return new D(Tf(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return D.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new D(A.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new D(e,r,o)}}D.empty=new D(A.empty,0,0);function Tf(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(o==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Tf(i.content,e-o-1,n-o-1)))}function Af(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Af(s.content,e-i-1,n,s);return l&&t.replaceChild(o,s.copy(l))}function R0(t,e,n){if(n.openStart>t.depth)throw new Uo("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Uo("Inconsistent open depths");return Rf(t,e,n,0)}function Rf(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=Rf(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return wn(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=O0(n,t);return wn(i,Nf(t,s,l,e,r))}else return wn(i,Wo(t,e,r))}function Of(t,e){if(!e.type.compatibleContent(t.type))throw new Uo("Cannot join "+e.type.name+" onto "+t.type.name)}function xl(t,e,n){let r=t.node(n);return Of(r,e.node(n)),r}function xn(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function xr(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(xn(t.nodeAfter,r),i++));for(let l=i;l<s;l++)xn(o.child(l),r);e&&e.depth==n&&e.textOffset&&xn(e.nodeBefore,r)}function wn(t,e){return t.type.checkContent(e),t.copy(e)}function Nf(t,e,n,r,o){let i=t.depth>o&&xl(t,e,o+1),s=r.depth>o&&xl(n,r,o+1),l=[];return xr(null,t,o,l),i&&s&&e.index(o)==n.index(o)?(Of(i,s),xn(wn(i,Nf(t,e,n,r,o+1)),l)):(i&&xn(wn(i,Wo(t,e,o+1)),l),xr(e,n,o,l),s&&xn(wn(s,Wo(n,r,o+1)),l)),xr(r,null,o,l),new A(l)}function Wo(t,e,n){let r=[];if(xr(null,t,n,r),t.depth>n){let o=xl(t,e,n+1);xn(wn(o,Wo(t,e,n+1)),r)}return xr(e,null,n,r),new A(r)}function O0(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(A.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class Nr{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ne.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Ko(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new Nr(n,r,i)}static resolveCached(e,n){let r=ou.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else ou.set(e,r=new N0);let o=r.elts[r.i]=Nr.resolve(e,n);return r.i=(r.i+1)%I0,o}}class N0{constructor(){this.elts=[],this.i=0}}const I0=12,ou=new WeakMap;class Ko{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const L0=Object.create(null);let Yt=class wl{constructor(e,n,r,o=ne.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&zo(this.attrs,n||e.defaultAttrs||L0)&&ne.sameSet(this.marks,r||ne.none)}copy(e=null){return e==this.content?this:new wl(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new wl(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return D.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new D(c,o.depth-s,i.depth-s)}replace(e,n,r){return R0(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Nr.resolveCached(this,e)}resolveNoCache(e){return Nr.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),If(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=A.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ne.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ne.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=A.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};Yt.prototype.text=void 0;class qo extends Yt{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):If(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new qo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new qo(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function If(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Mn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new D0(e,n);if(r.next==null)return Mn.empty;let o=Lf(r);r.next&&r.err("Unexpected trailing text");let i=$0(F0(o));return V0(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return A.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),n[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 n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
18
+ `)}}Mn.empty=new Mn(!0);class D0{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Lf(t){let e=[];do e.push(P0(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function P0(t){let e=[];do e.push(j0(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function j0(t){let e=H0(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=B0(t,e);else break;return e}function iu(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function B0(t,e){let n=iu(t),r=n;return t.eat(",")&&(t.next!="}"?r=iu(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function _0(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function H0(t){if(t.eat("(")){let e=Lf(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=_0(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function F0(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,a),u),a=u}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=n();r(a,u),o(i(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Df(t,e){return e-t}function su(t,e){let n=[];return r(e),n.sort(Df);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&n.indexOf(a)==-1&&r(a)}}}function $0(t){let e=Object.create(null);return n(su(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);su(t,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new Mn(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(Df);i.next.push({type:o[s][0],next:e[l.join(",")]||n(l)})}return i}}function V0(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Pf(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function jf(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function Bf(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let i=t[o];i.validate&&i.validate(e[o])}}function _f(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new U0(t,r,e[r]);return n}let lu=class Hf{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=_f(e,r.attrs),this.defaultAttrs=Pf(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==Mn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:jf(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Yt(this,this.computeAttrs(e),A.from(n),ne.setFrom(r))}createChecked(e=null,n,r){return n=A.from(n),this.checkContent(n),new Yt(this,this.computeAttrs(e),n,ne.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=A.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(A.empty,!0);return i?new Yt(this,e,n.append(i),ne.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Bf(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:ne.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new Hf(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function z0(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class U0{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?z0(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Fi{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=_f(e,o.attrs),this.excluded=null;let i=Pf(this.attrs);this.instance=i?new ne(this,i):null}create(e=null){return!e&&this.instance?this.instance:new ne(this,jf(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new Fi(i,o++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Bf(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Ff{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Se.from(e.nodes),n.marks=Se.from(e.marks||{}),this.nodes=lu.compile(this.spec.nodes,this),this.marks=Fi.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=Mn.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?au(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:au(this,s.split(" "))}this.nodeFromJSON=o=>Yt.fromJSON(this,o),this.markFromJSON=o=>ne.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof lu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new qo(r,r.defaultAttrs,e,ne.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function au(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let l in t.marks){let a=t.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function W0(t){return t.tag!=null}function K0(t){return t.style!=null}class Xt{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(W0(o))this.tags.push(o);else if(K0(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new uu(this,n,!1);return r.addAll(e,ne.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new uu(this,n,!0);return r.addAll(e,ne.none,n.from,n.to),D.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(J0(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=du(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=du(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Xt(e,Xt.schemaRules(e)))}}const $f={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},q0={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Vf={ol:!0,ul:!0},Ir=1,Sl=2,wr=4;function cu(t,e,n){return e!=null?(e?Ir:0)|(e==="full"?Sl:0):t&&t.whitespace=="pre"?Ir|Sl:n&~wr}class ho{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=ne.none,this.match=i||(s&wr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(A.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ir)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=A.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(A.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!$f.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class uu{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=cu(null,n.preserveWhitespace,0)|(r?wr:0);o?i=new ho(o.type,o.attrs,ne.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new ho(null,null,ne.none,!0,null,s):i=new ho(e.schema.topNodeType,null,ne.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,i=o.options&Sl?"full":this.localPreserveWS||(o.options&Ir)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
19
19
  `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(s.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=o.content[o.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Vf.hasOwnProperty(s)&&this.parser.normalizeLists&&G0(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:q0.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if($f.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
20
- `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],c=a.findWrapping(e);if(c&&(!o||o.length>c.length+l)&&(o=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=ne.none;for(let l of o.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):fu(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=cu(e,i,s.options);s.options&wr&&s.content.length==0&&(l|=wr);let a=ne.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):fu(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new ho(e,n,a,o,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Ir)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function G0(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Vf.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function J0(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function du(t){let e={};for(let n in t)e[n]=t[n];return e}function fu(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}class Ln{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=ks(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=Lo(ks(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Lo(ks(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Lo(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ln(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=hu(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return hu(e.marks)}}function hu(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ks(t){return t.document||window.document}const pu=new WeakMap;function Z0(t){let e=pu.get(t);return e===void 0&&pu.set(t,e=Y0(t)),e}function Y0(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function Lo(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Z0(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let l,a=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Lo(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const zf=65535,Uf=Math.pow(2,16);function X0(t,e){return t+e*Uf}function mu(t){return t&zf}function Q0(t){return(t-(t&zf))/Uf}const Wf=1,Kf=2,Do=4,qf=8;class kl{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&qf)>0}get deletedBefore(){return(this.delInfo&(Wf|Do))>0}get deletedAfter(){return(this.delInfo&(Kf|Do))>0}get deletedAcross(){return(this.delInfo&Do)>0}}class Ve{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ve.empty)return Ve.empty}recover(e){let n=0,r=mu(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+Q0(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,h=a+o+(f<0?0:u);if(r)return h;let p=e==(n<0?a:d)?null:X0(l/3,e-a),m=e==a?Kf:e==d?Wf:Do;return(n<0?e!=a:e!=d)&&(m|=qf),new kl(h,m,p)}o+=u-c}return r?e+o:new kl(e+o,0,null)}touches(e,n){let r=0,o=mu(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new Ve(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ve.empty:new Ve(e<0?[0,-e,0]:[0,0,e])}}Ve.empty=new Ve([]);class Lr{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Lr(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new Lr;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new kl(e,o,null)}}const Es=Object.create(null);class Ne{getMap(){return Ve.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Es[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Es)throw new RangeError("Duplicate use of step JSON ID "+e);return Es[e]=n,n.prototype.jsonID=e,n}}class pe{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new pe(e,null)}static fail(e){return new pe(null,e)}static fromReplace(e,n,r,o){try{return pe.ok(e.replace(n,r,o))}catch(i){if(i instanceof Uo)return pe.fail(i.message);throw i}}}function ga(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(ga(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return A.fromArray(r)}class Jt extends Ne{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new D(ga(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return pe.fromReplace(e,this.from,this.to,i)}invert(){return new rt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Jt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Jt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Jt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Jt(n.from,n.to,e.markFromJSON(n.mark))}}Ne.jsonID("addMark",Jt);class rt extends Ne{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new D(ga(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return pe.fromReplace(e,this.from,this.to,r)}invert(){return new Jt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new rt(n.pos,r.pos,this.mark)}merge(e){return e instanceof rt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new rt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new rt(n.from,n.to,e.markFromJSON(n.mark))}}Ne.jsonID("removeMark",rt);class Zt extends Ne{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return pe.fromReplace(e,this.pos,this.pos+1,new D(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Zt(this.pos,n.marks[o]);return new Zt(this.pos,this.mark)}}return new Tn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Zt(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Zt(n.pos,e.markFromJSON(n.mark))}}Ne.jsonID("addNodeMark",Zt);class Tn extends Ne{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return pe.fromReplace(e,this.pos,this.pos+1,new D(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Zt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Tn(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Tn(n.pos,e.markFromJSON(n.mark))}}Ne.jsonID("removeNodeMark",Tn);class ve extends Ne{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&El(e,this.from,this.to)?pe.fail("Structure replace would overwrite content"):pe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ve([this.from,this.to-this.from,this.slice.size])}invert(e){return new ve(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new ve(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ve)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?D.empty:new D(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ve(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?D.empty:new D(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ve(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ve(n.from,n.to,D.fromJSON(e,n.slice),!!n.structure)}}Ne.jsonID("replace",ve);class be extends Ne{constructor(e,n,r,o,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(El(e,this.from,this.gapFrom)||El(e,this.gapTo,this.to)))return pe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return pe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?pe.fromReplace(e,this.from,this.to,r):pe.fail("Content does not fit in gap")}getMap(){return new Ve([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new be(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new be(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new be(n.from,n.to,n.gapFrom,n.gapTo,D.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ne.jsonID("replaceAround",be);function El(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function e2(t,e,n,r){let o=[],i=[],s,l;t.doc.nodesBetween(e,n,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(s&&s.to==f&&s.mark.eq(d[m])?s.to=h:o.push(s=new rt(f,h,d[m])));l&&l.to==f?l.to=h:i.push(l=new Jt(f,h,r))}}),o.forEach(a=>t.step(a)),i.forEach(a=>t.step(a))}function t2(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(r instanceof Fi){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==i-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>t.step(new rt(s.from,s.to,s.style)))}function ya(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new ve(l,u,D.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new rt(l,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new D(A.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new ve(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(A.empty,!0);t.replace(l,l,new D(a,0,0))}for(let a=s.length-1;a>=0;a--)t.step(s[a])}function n2(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function ar(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let o=t.$from.node(r),i=t.$from.index(r),s=t.$to.indexAfter(r);if(r<t.depth&&o.canReplace(i,s,n))return r;if(r==0||o.type.spec.isolating||!n2(o,i,s))break}return null}function r2(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,u=A.empty,d=0;for(let p=i,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=A.from(r.node(p).copy(u)),d++):a--;let f=A.empty,h=0;for(let p=i,m=!1;p>n;p--)m||o.after(p+1)<o.end(p)?(m=!0,f=A.from(o.node(p).copy(f)),h++):c++;t.step(new be(a,c,s,l,new D(u.append(f),d,h),u.size-d,!0))}function va(t,e,n=null,r=t){let o=o2(t,e),i=o&&i2(r,e);return i?o.map(gu).concat({type:e,attrs:n}).concat(i.map(gu)):null}function gu(t){return{type:t,attrs:null}}function o2(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function i2(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:s}function s2(t,e,n){let r=A.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let l=n[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=A.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new be(o,i,o,i,new D(r,0,0),n.length,!0))}function l2(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,a)&&a2(t.doc,t.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Jf(t,s,l,i),ya(t,t.mapping.slice(i).map(l,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(l,1),f=u.map(l+s.nodeSize,1);return t.step(new be(d,f,d+1,f-1,new D(A.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Gf(t,s,l,i),!1}})}function Gf(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Jf(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
21
- `))}})}function a2(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function c2(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new be(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new D(A.from(s),0,0),1,!0))}function Ot(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function u2(t,e,n=1,r){let o=t.doc.resolve(e),i=A.empty,s=A.empty;for(let l=o.depth,a=o.depth-n,c=n-1;l>a;l--,c--){i=A.from(o.node(l).copy(i));let u=r&&r[c];s=A.from(u?u.type.create(u.attrs,s):o.node(l).copy(s))}t.step(new ve(e,e,new D(i.append(s),n,n),!0))}function dn(t,e){let n=t.resolve(e),r=n.index();return Zf(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function d2(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function Zf(t,e){return!!(t&&e&&!t.isLeaf&&d2(t,e))}function $i(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,l=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&Zf(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function f2(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Jf(t,u.node(),u.before(),l)}s.inlineContent&&ya(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new ve(c,a.map(e+n,-1),D.empty,!0)),r===!0){let u=t.doc.resolve(c);Gf(t,u.node(),u.before(),t.steps.length)}return t}function h2(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function Yf(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(a,a,o);else{let d=c.contentMatchAt(a).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Vi(t,e,n=e,r=D.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return Xf(o,i,r)?new ve(e,n,r):new p2(o,i,r).fit()}function Xf(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class p2{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=A.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=A.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new D(i,s,l);return e>-1?new be(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new ve(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Ms(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(A.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Ms(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new D(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Ms(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new D(gr(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new D(gr(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let h=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let m=l.child(c),v=d.matchType(m.type);if(!v)break;c++,(c>1||a==0||m.content.size)&&(d=v,u.push(Qf(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=yr(this.placed,n,A.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,v=l;m<h;m++){let b=v.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),v=b.content}this.unplaced=p?e==0?D.empty:new D(gr(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new D(gr(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Ts(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Ts(e,n,o,r,i);if(s){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Ts(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=yr(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=yr(this.placed,this.depth,A.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(A.empty,!0);n.childCount&&(this.placed=yr(this.placed,this.frontier.length,n))}}function gr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(gr(t.firstChild.content,e-1,n)))}function yr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(yr(t.lastChild.content,e-1,n)))}function Ms(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Qf(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Qf(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(A.empty,!0)))),t.copy(r)}function Ts(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!m2(n,i.content,s)?l:null}function m2(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function g2(t){return t.spec.defining||t.spec.definingForContent}function y2(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(Xf(o,i,r))return t.step(new ve(e,n,r));let s=th(o,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let f=o.depth,h=o.pos-1;f>0;f--,h--){let p=o.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(f)>-1?l=f:o.before(f)==h&&s.splice(1,0,-f)}let a=s.indexOf(l),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=g2(h.type);if(p&&!h.sameMarkup(o.node(Math.abs(l)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m<s.length;m++){let v=s[(m+a)%s.length],b=!0;v<0&&(b=!1,v=-v);let C=o.node(v-1),x=o.index(v-1);if(C.canReplaceWith(x,x,p.type,p.marks))return t.replace(o.before(v),b?i.after(v):n,new D(eh(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=s[f];h<0||(e=o.before(h),n=i.after(h))}}function eh(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(eh(i.content,e+1,n,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(A.empty,!0))}return t}function v2(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=h2(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new D(A.from(r),0,0))}function b2(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=th(r,o);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return t.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function th(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}class Yn extends Ne{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return pe.fromReplace(e,this.pos,this.pos+1,new D(A.from(o),0,n.isLeaf?0:1))}getMap(){return Ve.empty}invert(e){return new Yn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Yn(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Yn(n.pos,n.attr,n.value)}}Ne.jsonID("attr",Yn);class Dr extends Ne{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return pe.ok(r)}getMap(){return Ve.empty}invert(e){return new Dr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Dr(n.attr,n.value)}}Ne.jsonID("docAttr",Dr);let tr=class extends Error{};tr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};tr.prototype=Object.create(Error.prototype);tr.prototype.constructor=tr;tr.prototype.name="TransformError";class nh{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Lr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new tr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=D.empty){let o=Vi(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new D(A.from(r),0,0))}delete(e,n){return this.replace(e,n,D.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return y2(this,e,n,r),this}replaceRangeWith(e,n,r){return v2(this,e,n,r),this}deleteRange(e,n){return b2(this,e,n),this}lift(e,n){return r2(this,e,n),this}join(e,n=1){return f2(this,e,n),this}wrap(e,n){return s2(this,e,n),this}setBlockType(e,n=e,r,o=null){return l2(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return c2(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Yn(e,n,r)),this}setDocAttribute(e,n){return this.step(new Dr(e,n)),this}addNodeMark(e,n){return this.step(new Zt(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof ne)n.isInSet(r.marks)&&this.step(new Tn(e,n));else{let o=r.marks,i,s=[];for(;i=n.isInSet(o);)s.push(new Tn(e,i)),o=i.removeFromSet(o);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,n=1,r){return u2(this,e,n,r),this}addMark(e,n,r){return e2(this,e,n,r),this}removeMark(e,n,r){return t2(this,e,n,r),this}clearIncompatible(e,n,r){return ya(this,e,n,r),this}}const As=Object.create(null);let q=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new C2(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=D.empty){let r=n.content.lastChild,o=null;for(let l=0;l<n.openEnd;l++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?D.empty:n),l==0&&bu(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:l}=o[i],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),bu(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new V(e):Un(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?Un(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Un(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new ze(e.node(0))}static atStart(e){return Un(e,e,0,0,1)||new ze(e)}static atEnd(e){return Un(e,e,e.content.size,e.childCount,-1)||new ze(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=As[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in As)throw new RangeError("Duplicate use of selection JSON ID "+e);return As[e]=n,n.prototype.jsonID=e,n}getBookmark(){return V.between(this.$anchor,this.$head).getBookmark()}};q.prototype.visible=!0;class C2{constructor(e,n){this.$from=e,this.$to=n}}let yu=!1;function vu(t){!yu&&!t.parent.inlineContent&&(yu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class V extends q{constructor(e,n=e){vu(e),vu(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return q.near(r);let o=e.resolve(n.map(this.anchor));return new V(o.parent.inlineContent?o:r,r)}replace(e,n=D.empty){if(super.replace(e,n),n==D.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof V&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new zi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new V(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=q.findFrom(n,r,!0)||q.findFrom(n,-r,!0);if(i)n=i.$head;else return q.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(q.findFrom(e,-r,!0)||q.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new V(e,n)}}q.jsonID("text",V);class zi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new zi(e.map(this.anchor),e.map(this.head))}resolve(e){return V.between(e.resolve(this.anchor),e.resolve(this.head))}}class B extends q{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?q.near(i):new B(i)}content(){return new D(A.from(this.node),0,0)}eq(e){return e instanceof B&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ba(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new B(e.resolve(n.anchor))}static create(e,n){return new B(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}B.prototype.visible=!1;q.jsonID("node",B);class ba{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new zi(r,r):new ba(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&B.isSelectable(r)?new B(n):q.near(n)}}class ze extends q{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=D.empty){if(n==D.empty){e.delete(0,e.doc.content.size);let r=q.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ze(e)}map(e){return new ze(e)}eq(e){return e instanceof ze}getBookmark(){return x2}}q.jsonID("all",ze);const x2={map(){return this},resolve(t){return new ze(t)}};function Un(t,e,n,r,o,i=!1){if(e.inlineContent)return V.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&B.isSelectable(l))return B.create(t,n-(o<0?l.nodeSize:0))}else{let a=Un(t,l,n+o,o<0?l.childCount:0,o,i);if(a)return a}n+=l.nodeSize*o}return null}function bu(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof ve||o instanceof be))return;let i=t.mapping.maps[r],s;i.forEach((l,a,c,u)=>{s==null&&(s=u)}),t.setSelection(q.near(t.doc.resolve(s),n))}const Cu=1,po=2,xu=4;class w2 extends nh{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|Cu)&~po,this.storedMarks=null,this}get selectionSet(){return(this.updated&Cu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=po,this}ensureMarks(e){return ne.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&po)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~po,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ne.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(q.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=xu,this}get scrolledIntoView(){return(this.updated&xu)>0}}function wu(t,e){return!e||!t?t:t.bind(e)}class vr{constructor(e,n,r){this.name=e,this.init=wu(n.init,r),this.apply=wu(n.apply,r)}}const S2=[new vr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new vr("selection",{init(t,e){return t.selection||q.atStart(e.doc)},apply(t){return t.selection}}),new vr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new vr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Rs{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=S2.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new vr(r.key,r.spec.state,r))})}}class Jn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,c=o?o[s].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Jn(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new w2(this)}static create(e){let n=new Rs(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Jn(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new Rs(this.schema,e.plugins),r=n.fields,o=new Jn(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Rs(e.schema,e.plugins),i=new Jn(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=Xt.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=q.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.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(n,l)){i[s.name]=c.fromJSON.call(a,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function rh(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=rh(o,e,{})),n[r]=o}return n}class ce{constructor(e){this.spec=e,this.props={},e.props&&rh(e.props,this,this.props),this.key=e.key?e.key.key:oh("plugin")}getState(e){return e[this.key]}}const Os=Object.create(null);function oh(t){return t in Os?t+"$"+ ++Os[t]:(Os[t]=0,t+"$")}class ye{constructor(e="key"){this.key=oh(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ca=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function ih(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const sh=(t,e,n)=>{let r=ih(t,n);if(!r)return!1;let o=xa(r);if(!o){let s=r.blockRange(),l=s&&ar(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(mh(t,o,e,-1))return!0;if(r.parent.content.size==0&&(nr(i,"end")||B.isSelectable(i)))for(let s=r.depth;;s--){let l=Vi(t.doc,r.before(s),r.after(s),D.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(nr(i,"end")?q.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):B.create(a.doc,o.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},k2=(t,e,n)=>{let r=ih(t,n);if(!r)return!1;let o=xa(r);return o?lh(t,o,e):!1},E2=(t,e,n)=>{let r=ch(t,n);if(!r)return!1;let o=wa(r);return o?lh(t,o,e):!1};function lh(t,e,n){let r=e.nodeBefore,o=r,i=e.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=Vi(t.doc,i,a,D.empty);if(!c||c.from!=i||c instanceof ve&&c.slice.size>=a-i)return!1;if(n){let u=t.tr.step(c);u.setSelection(V.create(u.doc,i)),n(u.scrollIntoView())}return!0}function nr(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const ah=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=xa(r)}let s=i&&i.nodeBefore;return!s||!B.isSelectable(s)?!1:(e&&e(t.tr.setSelection(B.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function xa(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function ch(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const uh=(t,e,n)=>{let r=ch(t,n);if(!r)return!1;let o=wa(r);if(!o)return!1;let i=o.nodeAfter;if(mh(t,o,e,1))return!0;if(r.parent.content.size==0&&(nr(i,"start")||B.isSelectable(i))){let s=Vi(t.doc,r.before(),r.after(),D.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(nr(i,"start")?q.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):B.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},dh=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=wa(r)}let s=i&&i.nodeAfter;return!s||!B.isSelectable(s)?!1:(e&&e(t.tr.setSelection(B.create(t.doc,i.pos)).scrollIntoView()),!0)};function wa(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const M2=(t,e)=>{let n=t.selection,r=n instanceof B,o;if(r){if(n.node.isTextblock||!dn(t.doc,n.from))return!1;o=n.from}else if(o=$i(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(B.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},T2=(t,e)=>{let n=t.selection,r;if(n instanceof B){if(n.node.isTextblock||!dn(t.doc,n.to))return!1;r=n.to}else if(r=$i(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},A2=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),i=o&&ar(o);return i==null?!1:(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},fh=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
22
- `).scrollIntoView()),!0)};function Sa(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const R2=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Sa(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,s.createAndFill());a.setSelection(q.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},hh=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof ze||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Sa(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(V.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},ph=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Ot(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&ar(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function O2(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof B&&e.selection.node.isBlock)return!r.parentOffset||!Ot(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=Sa(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),i.unshift(a&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof V||e.selection instanceof ze)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Ot(u.doc,d,i.length,i);if(f||(i[0]=l?{type:l}:null,f=Ot(u.doc,d,i.length,i)),!f)return!1;if(u.split(d,i.length,i),!a&&c&&r.node(s).type!=l){let h=u.mapping.map(r.before(s)),p=u.doc.resolve(h);l&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(s)),l)}return n&&n(u.scrollIntoView()),!0}}const N2=O2(),I2=(t,e)=>{let{$from:n,to:r}=t.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),e&&e(t.tr.setSelection(B.create(t.doc,o))),!0)};function L2(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||dn(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function mh(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&L2(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,p=A.empty;for(let b=s.length-1;b>=0;b--)p=A.from(s[b].create(null,p));p=A.from(o.copy(p));let m=t.tr.step(new be(e.pos-1,h,e.pos,h,new D(p,1,0),s.length,!0)),v=m.doc.resolve(h+2*s.length);v.nodeAfter&&v.nodeAfter.type==o.type&&dn(m.doc,v.pos)&&m.join(v.pos),n(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&a?null:q.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&ar(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&nr(i,"start",!0)&&nr(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=i,v=1;for(;!m.isTextblock;m=m.firstChild)v++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let b=A.empty;for(let x=p.length-1;x>=0;x--)b=A.from(p[x].copy(b));let C=t.tr.step(new be(e.pos-p.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new D(b,p.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function gh(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(V.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}const D2=gh(-1),P2=gh(1);function j2(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),l=s&&va(s,t,e);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Su(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[s];i.setBlockType(l,a,t,e)}r(i.scrollIntoView())}return!0}}function ka(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}ka(Ca,sh,ah);ka(Ca,uh,dh);ka(fh,hh,ph,N2);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function B2(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let l=r?n.tr:null;return _2(l,s,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function _2(t,e,n,r=null){let o=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new Ko(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Ko(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let l=va(i,n,r,e);return l?(t&&H2(t,e,l,o,n),!0):!1}function H2(t,e,n,r,o){let i=A.empty;for(let u=n.length-1;u>=0;u--)i=A.from(n[u].type.create(n[u].attrs,i));t.step(new be(e.start-(r?2:0),e.end,e.start,e.end,new D(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let l=n.length-s,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Ot(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function F2(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?$2(e,n,t,i):V2(e,n,i):!0:!1}}function $2(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new be(i-1,s,i,s,new D(A.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ko(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const l=ar(r);if(l==null)return!1;o.lift(r,l);let a=o.doc.resolve(o.mapping.map(i,-1)-1);return dn(o.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&o.join(a.pos),e(o.scrollIntoView()),!0}function V2(t,e,n){let r=t.tr,o=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)h-=o.child(p).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?A.empty:A.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new be(d-(l?1:0),f+(a?1:0),d+1,f-1,new D((l?A.empty:A.from(o.copy(A.empty))).append(a?A.empty:A.from(o.copy(A.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function z2(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=A.from(c?t.create():null),d=new D(A.from(t.create(null,A.from(l.type.create(null,u)))),c?3:1,0),f=i.start,h=i.end;n(e.tr.step(new be(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const ke=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},rr=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Ml=null;const kt=function(t,e,n){let r=Ml||(Ml=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},U2=function(){Ml=null},An=function(t,e,n,r){return n&&(ku(t,e,n,r,-1)||ku(t,e,n,r,1))},W2=/^(img|br|input|textarea|hr)$/i;function ku(t,e,n,r,o){for(var i;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Ye(t))){let s=t.parentNode;if(!s||s.nodeType!=1||Zr(t)||W2.test(t.nodeName)||t.contentEditable=="false")return!1;e=ke(t)+(o<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(o<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=o;else return!1;else t=s,e=o<0?Ye(t):0}else return!1}}function Ye(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function K2(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ye(t)}else if(t.parentNode&&!Zr(t))e=ke(t),t=t.parentNode;else return null}}function q2(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Zr(t))e=ke(t)+1,t=t.parentNode;else return null}}function G2(t,e,n){for(let r=e==0,o=e==Ye(t);r||o;){if(t==n)return!0;let i=ke(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==Ye(t)}}function Zr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Ui=function(t){return t.focusNode&&An(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function gn(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function J2(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Z2(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ye(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ye(r.startContainer),r.startOffset)}}}const ht=typeof navigator<"u"?navigator:null,Eu=typeof document<"u"?document:null,fn=ht&&ht.userAgent||"",Tl=/Edge\/(\d+)/.exec(fn),yh=/MSIE \d/.exec(fn),Al=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fn),He=!!(yh||Al||Tl),en=yh?document.documentMode:Al?+Al[1]:Tl?+Tl[1]:0,Xe=!He&&/gecko\/(\d+)/i.test(fn);Xe&&+(/Firefox\/(\d+)/.exec(fn)||[0,0])[1];const Rl=!He&&/Chrome\/(\d+)/.exec(fn),Re=!!Rl,vh=Rl?+Rl[1]:0,Le=!He&&!!ht&&/Apple Computer/.test(ht.vendor),or=Le&&(/Mobile\/\w+/.test(fn)||!!ht&&ht.maxTouchPoints>2),Ze=or||(ht?/Mac/.test(ht.platform):!1),Y2=ht?/Win/.test(ht.platform):!1,At=/Android \d/.test(fn),Yr=!!Eu&&"webkitFontSmoothing"in Eu.documentElement.style,X2=Yr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Q2(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Ct(t,e){return typeof t=="number"?t:t[e]}function ey(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Mu(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=rr(s);continue}let l=s,a=l==i.body,c=a?Q2(i):ey(l),u=0,d=0;if(e.top<c.top+Ct(r,"top")?d=-(c.top-e.top+Ct(o,"top")):e.bottom>c.bottom-Ct(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Ct(o,"top")-c.top:e.bottom-c.bottom+Ct(o,"bottom")),e.left<c.left+Ct(r,"left")?u=-(c.left-e.left+Ct(o,"left")):e.right>c.right-Ct(r,"right")&&(u=e.right-c.right+Ct(o,"right")),u||d)if(a)i.defaultView.scrollBy(u,d);else{let h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let m=l.scrollLeft-h,v=l.scrollTop-p;e={left:e.left-m,top:e.top-v,right:e.right-m,bottom:e.bottom-v}}let f=a?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:rr(s)}}function ty(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(i,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:bh(t.dom)}}function bh(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=rr(r));return e}function ny({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Ch(n,r==0?0:r-e)}function Ch(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Hn=null;function ry(t){if(t.setActive)return t.setActive();if(Hn)return t.focus(Hn);let e=bh(t);t.focus(Hn==null?{get preventScroll(){return Hn={preventScroll:!0},!0}}:void 0),Hn||(Hn=!1,Ch(e,0))}function xh(t,e){let n,r=2e8,o,i=0,s=e.top,l=e.top,a,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=kt(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=s&&p.bottom>=l){s=Math.max(p.bottom,s),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=u,r=m,o=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(i=d+(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=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=d+1)}}return!n&&a&&(n=a,o=c,r=0),n&&n.nodeType==3?oy(n,o):!n||r&&n.nodeType==1?{node:t,offset:i}:xh(n,o)}function oy(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let i=Vt(r,1);if(i.top!=i.bottom&&Ea(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function Ea(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function iy(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function sy(t,e,n){let{node:r,offset:o}=xh(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function ly(t,e,n,r){let o=-1;for(let i=e,s=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),s=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function wh(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=t.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Ea(e,c))return wh(s,e,c)}}if((i=(i+1)%r)==o)break}return t}function ay(t,e){let n=t.dom.ownerDocument,r,o=0,i=Z2(n,e.left,e.top);i&&({node:r,offset:o}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!Ea(e,c)||(s=wh(t.dom,e,c),!s))return null}if(Le)for(let c=s;r&&c;c=rr(c))c.draggable&&(r=void 0);if(s=iy(s,e),r){if(Xe&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;Yr&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=ly(t,r,o,e))}l==null&&(l=sy(t,s,e));let a=t.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Tu(t){return t.top<t.bottom||t.left<t.right}function Vt(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Tu(r))return r}return Array.prototype.find.call(n,Tu)||t.getBoundingClientRect()}const cy=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Sh(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=Yr||Xe;if(r.nodeType==3)if(s&&(cy.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=Vt(kt(r,o,o),n);if(Xe&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Vt(kt(r,o-1,o-1),-1);if(c.top==a.top){let u=Vt(kt(r,o,o+1),-1);if(u.top!=a.top)return pr(u,u.left<c.left)}}return a}else{let a=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(a--,u=1):n<0?a--:c++,pr(Vt(kt(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==Ye(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return Ns(a.getBoundingClientRect(),!1)}if(i==null&&o<Ye(r)){let a=r.childNodes[o];if(a.nodeType==1)return Ns(a.getBoundingClientRect(),!0)}return Ns(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==Ye(r))){let a=r.childNodes[o-1],c=a.nodeType==3?kt(a,Ye(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return pr(Vt(c,1),!1)}if(i==null&&o<Ye(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?kt(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return pr(Vt(c,-1),!0)}return pr(Vt(r.nodeType==3?kt(r):r,-n),n>=0)}function pr(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Ns(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function kh(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function uy(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return kh(t,e,()=>{let{node:i}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=Sh(t,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=kt(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const dy=/[\u0590-\u08ac]/;function fy(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=t.domSelection();return l?!dy.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:kh(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),v=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),v}):r.pos==r.start()||r.pos==r.end()}let Au=null,Ru=null,Ou=!1;function hy(t,e,n){return Au==e&&Ru==n?Ou:(Au=e,Ru=n,Ou=n=="up"||n=="down"?uy(t,e,n):fy(t,e,n))}const Qe=0,Nu=1,yn=2,pt=3;class Xr{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Qe,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>ke(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let l=o.children[s];if(l.size){o=l;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>e||s instanceof Mh){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Eh&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?ke(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?ke(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(o==-1&&e<=c){let u=s+a.border;if(e>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,u);e=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=ke(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=ke(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],v=p+m.size;if(i>p&&s<v)return m.setSelection(e-p-m.border,n-p-m.border,r,o);p=v}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Xe||Le)&&e==n){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
23
- `),d&&p==h.nodeValue.length)for(let m=h,v;m;m=m.parentNode){if(v=m.nextSibling){v.nodeName=="BR"&&(l=a={node:v.parentNode,offset:ke(v)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Xe&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||d&&Le)&&An(l.node,l.offset,u.anchorNode,u.anchorOffset)&&An(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&Xe)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let p=l;l=a,a=p}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,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let l=r+i.border,a=s-i.border;if(e>=l&&n<=a){this.dirty=e==r||n==s?yn:Nu,e==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=pt:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?yn:pt}r=s}this.dirty=yn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?yn:Nu;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Eh extends Xr{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.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=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Qe&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class py extends Xr{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Rn extends Xr{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=Ln.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Rn(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&pt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=pt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Qe){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Qe}}slice(e,n,r){let o=Rn.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Nl(i,n,s,r)),e>0&&(i=Nl(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class tn extends Xr{constructor(e,n,r,o,i,s,l,a,c){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,n,r,o,i,s){let l=i.nodeViews[n.type.name],a,c=l&&l(n,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Ln.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Rh(u,r,n),c?a=new my(e,n,r,o,u,d||null,f,c,i,s+1):n.isText?new Wi(e,n,r,o,u,f,i):new tn(e,n,r,o,u,d||null,f,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>A.empty)}return e}matchesNode(e,n,r){return this.dirty==Qe&&e.eq(this.node)&&Go(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new yy(this,s&&s.node,e);Cy(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?ne.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,o)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(h=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(c,u,d,h,e)||a.updateNextNode(c,u,d,e,f,o)||a.addNode(c,u,d,e,o),o+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==yn)&&(s&&this.protectLocalComposition(e,s),Th(this.contentDOM,this.children,e),or&&xy(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof V)||r<n||o>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=wy(this.node.content,s,r-n,o-n);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new py(this,i,n,o);e.input.compositionNodes.push(s),this.children=Nl(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==pt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Qe}updateOuterDeco(e){if(Go(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ah(this.dom,this.nodeDOM,Ol(this.outerDeco,this.node,n),Ol(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Iu(t,e,n,r,o){Rh(r,e,t);let i=new tn(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Wi extends tn{constructor(e,n,r,o,i,s,l){super(e,n,r,o,i,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,n,r,o){return this.dirty==pt||this.dirty!=Qe&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Qe||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Qe,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),i=document.createTextNode(o.text);return new Wi(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=pt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Mh extends Xr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Qe&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class my extends tn{constructor(e,n,r,o,i,s,l,a,c,u){super(e,n,r,o,i,s,l,c,u),this.spec=a}update(e,n,r,o){if(this.dirty==pt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}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 Th(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){for(;l!=r;)r=Lu(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(l,r);if(s instanceof Rn){let a=r?r.previousSibling:t.lastChild;Th(s.contentDOM,s.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=Lu(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const Sr=function(t){t&&(this.nodeName=t)};Sr.prototype=Object.create(null);const vn=[new Sr];function Ol(t,e,n){if(t.length==0)return vn;let r=n?vn[0]:new Sr,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new Sr(s.nodeName));for(let l in s){let a=s[l];a!=null&&(n&&o.length==1&&o.push(r=new Sr(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return o}function Ah(t,e,n,r){if(n==vn&&r==vn)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],l=n[i];if(i){let a;l&&l.nodeName==s.nodeName&&o!=t&&(a=o.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=vn[0]),o=a}gy(o,l||vn[0],s)}return o}function gy(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.add(o[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function Rh(t,e,n){return Ah(t,t,vn,Ol(e,n,t.nodeType!=1))}function Go(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Lu(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class yy{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=vy(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=Qe,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<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[i])&&!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=Rn.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,o,i){let s=this.top.children[o];return s.dirty==pt&&s.dom==s.contentDOM&&(s.dirty=yn),s.update(e,n,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof tn){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=pt&&Go(n,a.outerDeco));if(!f&&a.update(e,n,r,o))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,o,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=yn,d.updateChildren(o,s+1),d.dirty=Qe),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Go(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=tn.create(this.top,n,r,o,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,o,i){let s=tn.create(this.top,e,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new Eh(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Rn;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Wi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Le||Re)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new Mh(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function vy(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];e:for(;o>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof Rn)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(o-1))break;--o,i.set(l,o),s.push(l)}}return{index:o,matched:i,matches:s.reverse()}}function by(t,e){return t.type.side-e.type.side}function Cy(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,o,e.forChild(i,u),c),i+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let v=o[s++];v.widget&&(u?(d||(d=[u])).push(v):u=v)}if(u)if(d){d.sort(by);for(let v=0;v<d.length;v++)n(d[v],c,!!a)}else n(u,c,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let v=0;v<l.length;v++)l[v].to<=i&&l.splice(v--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let p=i+f.nodeSize;if(f.isText){let v=p;s<o.length&&o[s].from<v&&(v=o[s].from);for(let b=0;b<l.length;b++)l[b].to<v&&(v=l[b].to);v<p&&(a=f.cut(v-i),f=f.cut(0,v-i),p=v,h=-1)}else for(;s<o.length&&o[s].to<p;)s++;let m=f.isInline&&!f.isLeaf?l.filter(v=>!v.inline):l.slice();r(f,m,e.forChild(i,f),h),i=p}}function xy(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function wy(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<t.childCount;){let c=t.child(o++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=n){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Nl(t,e,n,r,o){let i=[];for(let s=0,l=0;s<t.length;s++){let a=t[s],c=l,u=l+=a.size;c>=n||u<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(a.slice(n-c,a.size,r)))}return i}function Ma(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(Ui(n)){for(a=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&B.isSelectable(d)&&o.parent&&!(d.isInline&&G2(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new B(s==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,s]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(s)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;c=Ta(t,u,l,d)}return c}function Oh(t){return t.editable?t.hasFocus():Ih(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Nt(t,e=!1){let n=t.state.selection;if(Nh(t,n),!!Oh(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Re){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&An(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)ky(t);else{let{anchor:r,head:o}=n,i,s;Du&&!(n instanceof V)&&(n.$from.parent.inlineContent||(i=Pu(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Pu(t,n.to))),t.docView.setSelection(r,o,t,e),Du&&(i&&ju(i),s&&ju(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Sy(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Du=Le||Re&&vh<63;function Pu(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Le&&o&&o.contentEditable=="false")return Is(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return Is(o);if(i)return Is(i)}}function Is(t){return t.contentEditable="true",Le&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function ju(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Sy(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Oh(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function ky(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,ke(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&He&&en<=11&&(n.disabled=!0,n.disabled=!1)}function Nh(t,e){if(e instanceof B){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Bu(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Bu(t)}function Bu(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Ta(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||V.between(e,n,r)}function _u(t){return t.editable&&!t.hasFocus()?!1:Ih(t)}function Ih(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Ey(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return An(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Il(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&q.findFrom(i,e)}function Ut(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Hu(t,e,n){let r=t.state.selection;if(r instanceof V)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return Ut(t,new V(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=Il(t.state,e);return o&&o instanceof B?Ut(t,o):!1}else if(!(Ze&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?B.isSelectable(i)?Ut(t,new B(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):Yr?Ut(t,new V(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof B&&r.node.isInline)return Ut(t,new V(e>0?r.$to:r.$from));{let o=Il(t.state,e);return o?Ut(t,o):!1}}}function Jo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function kr(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Fn(t,e){return e<0?My(t):Ty(t)}function My(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(Xe&&n.nodeType==1&&r<Jo(n)&&kr(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(kr(l,-1))o=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(Lh(n))break;{let l=n.previousSibling;for(;l&&kr(l,-1);)o=n.parentNode,i=ke(l),l=l.previousSibling;if(l)n=l,r=Jo(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Ll(t,n,r):o&&Ll(t,o,i)}function Ty(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=Jo(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let l=n.childNodes[r];if(kr(l,1))i=n,s=++r;else break}else{if(Lh(n))break;{let l=n.nextSibling;for(;l&&kr(l,1);)i=l.parentNode,s=ke(l)+1,l=l.nextSibling;if(l)n=l,r=0,o=Jo(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&Ll(t,i,s)}function Lh(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Ay(t,e){for(;t&&e==t.childNodes.length&&!Zr(t);)e=ke(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Ry(t,e){for(;t&&!e&&!Zr(t);)e=ke(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Ll(t,e,n){if(e.nodeType!=3){let i,s;(s=Ay(e,n))?(e=s,n=0):(i=Ry(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Ui(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&Nt(t)},50)}function Fu(t,e){let n=t.state.doc.resolve(e);if(!(Re||Y2)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function $u(t,e,n){let r=t.state.selection;if(r instanceof V&&!r.empty||n.indexOf("s")>-1||Ze&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Il(t.state,e);if(s&&s instanceof B)return Ut(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,l=r instanceof ze?q.near(s,e):q.findFrom(s,e);return l?Ut(t,l):!1}return!1}function Vu(t,e){if(!(t.state.selection instanceof V))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function zu(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Oy(t){if(!Le||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;zu(t,r,"true"),setTimeout(()=>zu(t,r,"false"),20)}return!1}function Ny(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Iy(t,e){let n=e.keyCode,r=Ny(e);if(n==8||Ze&&n==72&&r=="c")return Vu(t,-1)||Fn(t,-1);if(n==46&&!e.shiftKey||Ze&&n==68&&r=="c")return Vu(t,1)||Fn(t,1);if(n==13||n==27)return!0;if(n==37||Ze&&n==66&&r=="c"){let o=n==37?Fu(t,t.state.selection.from)=="ltr"?-1:1:-1;return Hu(t,o,r)||Fn(t,o)}else if(n==39||Ze&&n==70&&r=="c"){let o=n==39?Fu(t,t.state.selection.from)=="ltr"?1:-1:1;return Hu(t,o,r)||Fn(t,o)}else{if(n==38||Ze&&n==80&&r=="c")return $u(t,-1,r)||Fn(t,-1);if(n==40||Ze&&n==78&&r=="c")return Oy(t)||$u(t,1,r)||Fn(t,1);if(r==(Ze?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Aa(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=t.someProp("clipboardSerializer")||Ln.fromSchema(t.state.schema),l=Hh(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=_h[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
20
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],c=a.findWrapping(e);if(c&&(!o||o.length>c.length+l)&&(o=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=ne.none;for(let l of o.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):fu(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=cu(e,i,s.options);s.options&wr&&s.content.length==0&&(l|=wr);let a=ne.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):fu(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new ho(e,n,a,o,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Ir)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function G0(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Vf.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function J0(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function du(t){let e={};for(let n in t)e[n]=t[n];return e}function fu(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}class Ln{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=ks(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=Lo(ks(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Lo(ks(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Lo(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ln(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=hu(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return hu(e.marks)}}function hu(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ks(t){return t.document||window.document}const pu=new WeakMap;function Z0(t){let e=pu.get(t);return e===void 0&&pu.set(t,e=Y0(t)),e}function Y0(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function Lo(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Z0(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let l,a=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Lo(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const zf=65535,Uf=Math.pow(2,16);function X0(t,e){return t+e*Uf}function mu(t){return t&zf}function Q0(t){return(t-(t&zf))/Uf}const Wf=1,Kf=2,Do=4,qf=8;class kl{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&qf)>0}get deletedBefore(){return(this.delInfo&(Wf|Do))>0}get deletedAfter(){return(this.delInfo&(Kf|Do))>0}get deletedAcross(){return(this.delInfo&Do)>0}}class Ve{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ve.empty)return Ve.empty}recover(e){let n=0,r=mu(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+Q0(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,h=a+o+(f<0?0:u);if(r)return h;let p=e==(n<0?a:d)?null:X0(l/3,e-a),m=e==a?Kf:e==d?Wf:Do;return(n<0?e!=a:e!=d)&&(m|=qf),new kl(h,m,p)}o+=u-c}return r?e+o:new kl(e+o,0,null)}touches(e,n){let r=0,o=mu(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new Ve(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ve.empty:new Ve(e<0?[0,-e,0]:[0,0,e])}}Ve.empty=new Ve([]);class Lr{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Lr(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new Lr;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new kl(e,o,null)}}const Es=Object.create(null);class Ne{getMap(){return Ve.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Es[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Es)throw new RangeError("Duplicate use of step JSON ID "+e);return Es[e]=n,n.prototype.jsonID=e,n}}class pe{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new pe(e,null)}static fail(e){return new pe(null,e)}static fromReplace(e,n,r,o){try{return pe.ok(e.replace(n,r,o))}catch(i){if(i instanceof Uo)return pe.fail(i.message);throw i}}}function ga(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(ga(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return A.fromArray(r)}class Gt extends Ne{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new D(ga(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return pe.fromReplace(e,this.from,this.to,i)}invert(){return new rt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Gt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Gt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Gt(n.from,n.to,e.markFromJSON(n.mark))}}Ne.jsonID("addMark",Gt);class rt extends Ne{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new D(ga(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return pe.fromReplace(e,this.from,this.to,r)}invert(){return new Gt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new rt(n.pos,r.pos,this.mark)}merge(e){return e instanceof rt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new rt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new rt(n.from,n.to,e.markFromJSON(n.mark))}}Ne.jsonID("removeMark",rt);class Jt extends Ne{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return pe.fromReplace(e,this.pos,this.pos+1,new D(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Jt(this.pos,n.marks[o]);return new Jt(this.pos,this.mark)}}return new Tn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Jt(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Jt(n.pos,e.markFromJSON(n.mark))}}Ne.jsonID("addNodeMark",Jt);class Tn extends Ne{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return pe.fromReplace(e,this.pos,this.pos+1,new D(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Jt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Tn(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Tn(n.pos,e.markFromJSON(n.mark))}}Ne.jsonID("removeNodeMark",Tn);class ve extends Ne{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&El(e,this.from,this.to)?pe.fail("Structure replace would overwrite content"):pe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ve([this.from,this.to-this.from,this.slice.size])}invert(e){return new ve(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new ve(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ve)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?D.empty:new D(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ve(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?D.empty:new D(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ve(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ve(n.from,n.to,D.fromJSON(e,n.slice),!!n.structure)}}Ne.jsonID("replace",ve);class be extends Ne{constructor(e,n,r,o,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(El(e,this.from,this.gapFrom)||El(e,this.gapTo,this.to)))return pe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return pe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?pe.fromReplace(e,this.from,this.to,r):pe.fail("Content does not fit in gap")}getMap(){return new Ve([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new be(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new be(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new be(n.from,n.to,n.gapFrom,n.gapTo,D.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ne.jsonID("replaceAround",be);function El(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function e2(t,e,n,r){let o=[],i=[],s,l;t.doc.nodesBetween(e,n,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(s&&s.to==f&&s.mark.eq(d[m])?s.to=h:o.push(s=new rt(f,h,d[m])));l&&l.to==f?l.to=h:i.push(l=new Gt(f,h,r))}}),o.forEach(a=>t.step(a)),i.forEach(a=>t.step(a))}function t2(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(r instanceof Fi){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==i-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>t.step(new rt(s.from,s.to,s.style)))}function ya(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new ve(l,u,D.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new rt(l,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new D(A.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new ve(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(A.empty,!0);t.replace(l,l,new D(a,0,0))}for(let a=s.length-1;a>=0;a--)t.step(s[a])}function n2(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function ar(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let o=t.$from.node(r),i=t.$from.index(r),s=t.$to.indexAfter(r);if(r<t.depth&&o.canReplace(i,s,n))return r;if(r==0||o.type.spec.isolating||!n2(o,i,s))break}return null}function r2(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,u=A.empty,d=0;for(let p=i,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=A.from(r.node(p).copy(u)),d++):a--;let f=A.empty,h=0;for(let p=i,m=!1;p>n;p--)m||o.after(p+1)<o.end(p)?(m=!0,f=A.from(o.node(p).copy(f)),h++):c++;t.step(new be(a,c,s,l,new D(u.append(f),d,h),u.size-d,!0))}function va(t,e,n=null,r=t){let o=o2(t,e),i=o&&i2(r,e);return i?o.map(gu).concat({type:e,attrs:n}).concat(i.map(gu)):null}function gu(t){return{type:t,attrs:null}}function o2(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function i2(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:s}function s2(t,e,n){let r=A.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let l=n[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=A.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new be(o,i,o,i,new D(r,0,0),n.length,!0))}function l2(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,a)&&a2(t.doc,t.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Jf(t,s,l,i),ya(t,t.mapping.slice(i).map(l,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(l,1),f=u.map(l+s.nodeSize,1);return t.step(new be(d,f,d+1,f-1,new D(A.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Gf(t,s,l,i),!1}})}function Gf(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Jf(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
21
+ `))}})}function a2(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function c2(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new be(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new D(A.from(s),0,0),1,!0))}function Tt(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function u2(t,e,n=1,r){let o=t.doc.resolve(e),i=A.empty,s=A.empty;for(let l=o.depth,a=o.depth-n,c=n-1;l>a;l--,c--){i=A.from(o.node(l).copy(i));let u=r&&r[c];s=A.from(u?u.type.create(u.attrs,s):o.node(l).copy(s))}t.step(new ve(e,e,new D(i.append(s),n,n),!0))}function un(t,e){let n=t.resolve(e),r=n.index();return Zf(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function d2(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function Zf(t,e){return!!(t&&e&&!t.isLeaf&&d2(t,e))}function $i(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,l=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&Zf(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function f2(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Jf(t,u.node(),u.before(),l)}s.inlineContent&&ya(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new ve(c,a.map(e+n,-1),D.empty,!0)),r===!0){let u=t.doc.resolve(c);Gf(t,u.node(),u.before(),t.steps.length)}return t}function h2(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function Yf(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(a,a,o);else{let d=c.contentMatchAt(a).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Vi(t,e,n=e,r=D.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return Xf(o,i,r)?new ve(e,n,r):new p2(o,i,r).fit()}function Xf(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class p2{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=A.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=A.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new D(i,s,l);return e>-1?new be(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new ve(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Ms(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(A.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Ms(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new D(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Ms(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new D(gr(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new D(gr(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let h=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let m=l.child(c),v=d.matchType(m.type);if(!v)break;c++,(c>1||a==0||m.content.size)&&(d=v,u.push(Qf(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=yr(this.placed,n,A.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,v=l;m<h;m++){let b=v.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),v=b.content}this.unplaced=p?e==0?D.empty:new D(gr(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new D(gr(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Ts(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Ts(e,n,o,r,i);if(s){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Ts(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=yr(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=yr(this.placed,this.depth,A.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(A.empty,!0);n.childCount&&(this.placed=yr(this.placed,this.frontier.length,n))}}function gr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(gr(t.firstChild.content,e-1,n)))}function yr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(yr(t.lastChild.content,e-1,n)))}function Ms(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Qf(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Qf(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(A.empty,!0)))),t.copy(r)}function Ts(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!m2(n,i.content,s)?l:null}function m2(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function g2(t){return t.spec.defining||t.spec.definingForContent}function y2(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(Xf(o,i,r))return t.step(new ve(e,n,r));let s=th(o,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let f=o.depth,h=o.pos-1;f>0;f--,h--){let p=o.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(f)>-1?l=f:o.before(f)==h&&s.splice(1,0,-f)}let a=s.indexOf(l),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=g2(h.type);if(p&&!h.sameMarkup(o.node(Math.abs(l)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m<s.length;m++){let v=s[(m+a)%s.length],b=!0;v<0&&(b=!1,v=-v);let C=o.node(v-1),x=o.index(v-1);if(C.canReplaceWith(x,x,p.type,p.marks))return t.replace(o.before(v),b?i.after(v):n,new D(eh(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=s[f];h<0||(e=o.before(h),n=i.after(h))}}function eh(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(eh(i.content,e+1,n,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(A.empty,!0))}return t}function v2(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=h2(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new D(A.from(r),0,0))}function b2(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=th(r,o);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return t.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function th(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}class Yn extends Ne{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return pe.fromReplace(e,this.pos,this.pos+1,new D(A.from(o),0,n.isLeaf?0:1))}getMap(){return Ve.empty}invert(e){return new Yn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Yn(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Yn(n.pos,n.attr,n.value)}}Ne.jsonID("attr",Yn);class Dr extends Ne{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return pe.ok(r)}getMap(){return Ve.empty}invert(e){return new Dr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Dr(n.attr,n.value)}}Ne.jsonID("docAttr",Dr);let tr=class extends Error{};tr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};tr.prototype=Object.create(Error.prototype);tr.prototype.constructor=tr;tr.prototype.name="TransformError";class nh{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Lr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new tr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=D.empty){let o=Vi(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new D(A.from(r),0,0))}delete(e,n){return this.replace(e,n,D.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return y2(this,e,n,r),this}replaceRangeWith(e,n,r){return v2(this,e,n,r),this}deleteRange(e,n){return b2(this,e,n),this}lift(e,n){return r2(this,e,n),this}join(e,n=1){return f2(this,e,n),this}wrap(e,n){return s2(this,e,n),this}setBlockType(e,n=e,r,o=null){return l2(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return c2(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Yn(e,n,r)),this}setDocAttribute(e,n){return this.step(new Dr(e,n)),this}addNodeMark(e,n){return this.step(new Jt(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof ne)n.isInSet(r.marks)&&this.step(new Tn(e,n));else{let o=r.marks,i,s=[];for(;i=n.isInSet(o);)s.push(new Tn(e,i)),o=i.removeFromSet(o);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,n=1,r){return u2(this,e,n,r),this}addMark(e,n,r){return e2(this,e,n,r),this}removeMark(e,n,r){return t2(this,e,n,r),this}clearIncompatible(e,n,r){return ya(this,e,n,r),this}}const As=Object.create(null);let q=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new C2(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=D.empty){let r=n.content.lastChild,o=null;for(let l=0;l<n.openEnd;l++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?D.empty:n),l==0&&bu(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:l}=o[i],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),bu(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new V(e):Un(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?Un(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Un(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new ze(e.node(0))}static atStart(e){return Un(e,e,0,0,1)||new ze(e)}static atEnd(e){return Un(e,e,e.content.size,e.childCount,-1)||new ze(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=As[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in As)throw new RangeError("Duplicate use of selection JSON ID "+e);return As[e]=n,n.prototype.jsonID=e,n}getBookmark(){return V.between(this.$anchor,this.$head).getBookmark()}};q.prototype.visible=!0;class C2{constructor(e,n){this.$from=e,this.$to=n}}let yu=!1;function vu(t){!yu&&!t.parent.inlineContent&&(yu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class V extends q{constructor(e,n=e){vu(e),vu(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return q.near(r);let o=e.resolve(n.map(this.anchor));return new V(o.parent.inlineContent?o:r,r)}replace(e,n=D.empty){if(super.replace(e,n),n==D.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof V&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new zi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new V(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=q.findFrom(n,r,!0)||q.findFrom(n,-r,!0);if(i)n=i.$head;else return q.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(q.findFrom(e,-r,!0)||q.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new V(e,n)}}q.jsonID("text",V);class zi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new zi(e.map(this.anchor),e.map(this.head))}resolve(e){return V.between(e.resolve(this.anchor),e.resolve(this.head))}}class B extends q{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?q.near(i):new B(i)}content(){return new D(A.from(this.node),0,0)}eq(e){return e instanceof B&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ba(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new B(e.resolve(n.anchor))}static create(e,n){return new B(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}B.prototype.visible=!1;q.jsonID("node",B);class ba{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new zi(r,r):new ba(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&B.isSelectable(r)?new B(n):q.near(n)}}class ze extends q{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=D.empty){if(n==D.empty){e.delete(0,e.doc.content.size);let r=q.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ze(e)}map(e){return new ze(e)}eq(e){return e instanceof ze}getBookmark(){return x2}}q.jsonID("all",ze);const x2={map(){return this},resolve(t){return new ze(t)}};function Un(t,e,n,r,o,i=!1){if(e.inlineContent)return V.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&B.isSelectable(l))return B.create(t,n-(o<0?l.nodeSize:0))}else{let a=Un(t,l,n+o,o<0?l.childCount:0,o,i);if(a)return a}n+=l.nodeSize*o}return null}function bu(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof ve||o instanceof be))return;let i=t.mapping.maps[r],s;i.forEach((l,a,c,u)=>{s==null&&(s=u)}),t.setSelection(q.near(t.doc.resolve(s),n))}const Cu=1,po=2,xu=4;class w2 extends nh{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|Cu)&~po,this.storedMarks=null,this}get selectionSet(){return(this.updated&Cu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=po,this}ensureMarks(e){return ne.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&po)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~po,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ne.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(q.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=xu,this}get scrolledIntoView(){return(this.updated&xu)>0}}function wu(t,e){return!e||!t?t:t.bind(e)}class vr{constructor(e,n,r){this.name=e,this.init=wu(n.init,r),this.apply=wu(n.apply,r)}}const S2=[new vr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new vr("selection",{init(t,e){return t.selection||q.atStart(e.doc)},apply(t){return t.selection}}),new vr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new vr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Rs{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=S2.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new vr(r.key,r.spec.state,r))})}}class Jn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,c=o?o[s].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Jn(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new w2(this)}static create(e){let n=new Rs(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Jn(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new Rs(this.schema,e.plugins),r=n.fields,o=new Jn(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Rs(e.schema,e.plugins),i=new Jn(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=Yt.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=q.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.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(n,l)){i[s.name]=c.fromJSON.call(a,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function rh(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=rh(o,e,{})),n[r]=o}return n}class ce{constructor(e){this.spec=e,this.props={},e.props&&rh(e.props,this,this.props),this.key=e.key?e.key.key:oh("plugin")}getState(e){return e[this.key]}}const Os=Object.create(null);function oh(t){return t in Os?t+"$"+ ++Os[t]:(Os[t]=0,t+"$")}class ye{constructor(e="key"){this.key=oh(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ca=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function ih(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const sh=(t,e,n)=>{let r=ih(t,n);if(!r)return!1;let o=xa(r);if(!o){let s=r.blockRange(),l=s&&ar(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(mh(t,o,e,-1))return!0;if(r.parent.content.size==0&&(nr(i,"end")||B.isSelectable(i)))for(let s=r.depth;;s--){let l=Vi(t.doc,r.before(s),r.after(s),D.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(nr(i,"end")?q.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):B.create(a.doc,o.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},k2=(t,e,n)=>{let r=ih(t,n);if(!r)return!1;let o=xa(r);return o?lh(t,o,e):!1},E2=(t,e,n)=>{let r=ch(t,n);if(!r)return!1;let o=wa(r);return o?lh(t,o,e):!1};function lh(t,e,n){let r=e.nodeBefore,o=r,i=e.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=Vi(t.doc,i,a,D.empty);if(!c||c.from!=i||c instanceof ve&&c.slice.size>=a-i)return!1;if(n){let u=t.tr.step(c);u.setSelection(V.create(u.doc,i)),n(u.scrollIntoView())}return!0}function nr(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const ah=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=xa(r)}let s=i&&i.nodeBefore;return!s||!B.isSelectable(s)?!1:(e&&e(t.tr.setSelection(B.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function xa(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function ch(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const uh=(t,e,n)=>{let r=ch(t,n);if(!r)return!1;let o=wa(r);if(!o)return!1;let i=o.nodeAfter;if(mh(t,o,e,1))return!0;if(r.parent.content.size==0&&(nr(i,"start")||B.isSelectable(i))){let s=Vi(t.doc,r.before(),r.after(),D.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(nr(i,"start")?q.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):B.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},dh=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=wa(r)}let s=i&&i.nodeAfter;return!s||!B.isSelectable(s)?!1:(e&&e(t.tr.setSelection(B.create(t.doc,i.pos)).scrollIntoView()),!0)};function wa(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const M2=(t,e)=>{let n=t.selection,r=n instanceof B,o;if(r){if(n.node.isTextblock||!un(t.doc,n.from))return!1;o=n.from}else if(o=$i(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(B.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},T2=(t,e)=>{let n=t.selection,r;if(n instanceof B){if(n.node.isTextblock||!un(t.doc,n.to))return!1;r=n.to}else if(r=$i(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},A2=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),i=o&&ar(o);return i==null?!1:(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},fh=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
22
+ `).scrollIntoView()),!0)};function Sa(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const R2=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Sa(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,s.createAndFill());a.setSelection(q.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},hh=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof ze||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Sa(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(V.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},ph=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Tt(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&ar(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function O2(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof B&&e.selection.node.isBlock)return!r.parentOffset||!Tt(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=Sa(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),i.unshift(a&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof V||e.selection instanceof ze)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Tt(u.doc,d,i.length,i);if(f||(i[0]=l?{type:l}:null,f=Tt(u.doc,d,i.length,i)),!f)return!1;if(u.split(d,i.length,i),!a&&c&&r.node(s).type!=l){let h=u.mapping.map(r.before(s)),p=u.doc.resolve(h);l&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(s)),l)}return n&&n(u.scrollIntoView()),!0}}const N2=O2(),I2=(t,e)=>{let{$from:n,to:r}=t.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),e&&e(t.tr.setSelection(B.create(t.doc,o))),!0)};function L2(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||un(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function mh(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&L2(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,p=A.empty;for(let b=s.length-1;b>=0;b--)p=A.from(s[b].create(null,p));p=A.from(o.copy(p));let m=t.tr.step(new be(e.pos-1,h,e.pos,h,new D(p,1,0),s.length,!0)),v=m.doc.resolve(h+2*s.length);v.nodeAfter&&v.nodeAfter.type==o.type&&un(m.doc,v.pos)&&m.join(v.pos),n(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&a?null:q.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&ar(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&nr(i,"start",!0)&&nr(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=i,v=1;for(;!m.isTextblock;m=m.firstChild)v++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let b=A.empty;for(let x=p.length-1;x>=0;x--)b=A.from(p[x].copy(b));let C=t.tr.step(new be(e.pos-p.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new D(b,p.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function gh(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(V.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}const D2=gh(-1),P2=gh(1);function j2(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),l=s&&va(s,t,e);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Su(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[s];i.setBlockType(l,a,t,e)}r(i.scrollIntoView())}return!0}}function ka(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}ka(Ca,sh,ah);ka(Ca,uh,dh);ka(fh,hh,ph,N2);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function B2(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let l=r?n.tr:null;return _2(l,s,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function _2(t,e,n,r=null){let o=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new Ko(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Ko(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let l=va(i,n,r,e);return l?(t&&H2(t,e,l,o,n),!0):!1}function H2(t,e,n,r,o){let i=A.empty;for(let u=n.length-1;u>=0;u--)i=A.from(n[u].type.create(n[u].attrs,i));t.step(new be(e.start-(r?2:0),e.end,e.start,e.end,new D(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let l=n.length-s,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Tt(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function F2(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?$2(e,n,t,i):V2(e,n,i):!0:!1}}function $2(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new be(i-1,s,i,s,new D(A.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ko(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const l=ar(r);if(l==null)return!1;o.lift(r,l);let a=o.doc.resolve(o.mapping.map(i,-1)-1);return un(o.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&o.join(a.pos),e(o.scrollIntoView()),!0}function V2(t,e,n){let r=t.tr,o=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)h-=o.child(p).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?A.empty:A.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new be(d-(l?1:0),f+(a?1:0),d+1,f-1,new D((l?A.empty:A.from(o.copy(A.empty))).append(a?A.empty:A.from(o.copy(A.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function z2(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=A.from(c?t.create():null),d=new D(A.from(t.create(null,A.from(l.type.create(null,u)))),c?3:1,0),f=i.start,h=i.end;n(e.tr.step(new be(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const ke=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},rr=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Ml=null;const kt=function(t,e,n){let r=Ml||(Ml=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},U2=function(){Ml=null},An=function(t,e,n,r){return n&&(ku(t,e,n,r,-1)||ku(t,e,n,r,1))},W2=/^(img|br|input|textarea|hr)$/i;function ku(t,e,n,r,o){for(var i;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Ye(t))){let s=t.parentNode;if(!s||s.nodeType!=1||Zr(t)||W2.test(t.nodeName)||t.contentEditable=="false")return!1;e=ke(t)+(o<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(o<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=o;else return!1;else t=s,e=o<0?Ye(t):0}else return!1}}function Ye(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function K2(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ye(t)}else if(t.parentNode&&!Zr(t))e=ke(t),t=t.parentNode;else return null}}function q2(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Zr(t))e=ke(t)+1,t=t.parentNode;else return null}}function G2(t,e,n){for(let r=e==0,o=e==Ye(t);r||o;){if(t==n)return!0;let i=ke(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==Ye(t)}}function Zr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Ui=function(t){return t.focusNode&&An(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function mn(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function J2(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Z2(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ye(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ye(r.startContainer),r.startOffset)}}}const ht=typeof navigator<"u"?navigator:null,Eu=typeof document<"u"?document:null,dn=ht&&ht.userAgent||"",Tl=/Edge\/(\d+)/.exec(dn),yh=/MSIE \d/.exec(dn),Al=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(dn),He=!!(yh||Al||Tl),Qt=yh?document.documentMode:Al?+Al[1]:Tl?+Tl[1]:0,Xe=!He&&/gecko\/(\d+)/i.test(dn);Xe&&+(/Firefox\/(\d+)/.exec(dn)||[0,0])[1];const Rl=!He&&/Chrome\/(\d+)/.exec(dn),Re=!!Rl,vh=Rl?+Rl[1]:0,Le=!He&&!!ht&&/Apple Computer/.test(ht.vendor),or=Le&&(/Mobile\/\w+/.test(dn)||!!ht&&ht.maxTouchPoints>2),Ze=or||(ht?/Mac/.test(ht.platform):!1),Y2=ht?/Win/.test(ht.platform):!1,Et=/Android \d/.test(dn),Yr=!!Eu&&"webkitFontSmoothing"in Eu.documentElement.style,X2=Yr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Q2(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Ct(t,e){return typeof t=="number"?t:t[e]}function ey(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Mu(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=rr(s);continue}let l=s,a=l==i.body,c=a?Q2(i):ey(l),u=0,d=0;if(e.top<c.top+Ct(r,"top")?d=-(c.top-e.top+Ct(o,"top")):e.bottom>c.bottom-Ct(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Ct(o,"top")-c.top:e.bottom-c.bottom+Ct(o,"bottom")),e.left<c.left+Ct(r,"left")?u=-(c.left-e.left+Ct(o,"left")):e.right>c.right-Ct(r,"right")&&(u=e.right-c.right+Ct(o,"right")),u||d)if(a)i.defaultView.scrollBy(u,d);else{let h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let m=l.scrollLeft-h,v=l.scrollTop-p;e={left:e.left-m,top:e.top-v,right:e.right-m,bottom:e.bottom-v}}let f=a?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:rr(s)}}function ty(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(i,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:bh(t.dom)}}function bh(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=rr(r));return e}function ny({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Ch(n,r==0?0:r-e)}function Ch(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Hn=null;function ry(t){if(t.setActive)return t.setActive();if(Hn)return t.focus(Hn);let e=bh(t);t.focus(Hn==null?{get preventScroll(){return Hn={preventScroll:!0},!0}}:void 0),Hn||(Hn=!1,Ch(e,0))}function xh(t,e){let n,r=2e8,o,i=0,s=e.top,l=e.top,a,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=kt(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=s&&p.bottom>=l){s=Math.max(p.bottom,s),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=u,r=m,o=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(i=d+(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=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=d+1)}}return!n&&a&&(n=a,o=c,r=0),n&&n.nodeType==3?oy(n,o):!n||r&&n.nodeType==1?{node:t,offset:i}:xh(n,o)}function oy(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let i=Ht(r,1);if(i.top!=i.bottom&&Ea(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function Ea(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function iy(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function sy(t,e,n){let{node:r,offset:o}=xh(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function ly(t,e,n,r){let o=-1;for(let i=e,s=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),s=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function wh(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=t.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Ea(e,c))return wh(s,e,c)}}if((i=(i+1)%r)==o)break}return t}function ay(t,e){let n=t.dom.ownerDocument,r,o=0,i=Z2(n,e.left,e.top);i&&({node:r,offset:o}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!Ea(e,c)||(s=wh(t.dom,e,c),!s))return null}if(Le)for(let c=s;r&&c;c=rr(c))c.draggable&&(r=void 0);if(s=iy(s,e),r){if(Xe&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;Yr&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=ly(t,r,o,e))}l==null&&(l=sy(t,s,e));let a=t.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Tu(t){return t.top<t.bottom||t.left<t.right}function Ht(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Tu(r))return r}return Array.prototype.find.call(n,Tu)||t.getBoundingClientRect()}const cy=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Sh(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=Yr||Xe;if(r.nodeType==3)if(s&&(cy.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=Ht(kt(r,o,o),n);if(Xe&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Ht(kt(r,o-1,o-1),-1);if(c.top==a.top){let u=Ht(kt(r,o,o+1),-1);if(u.top!=a.top)return pr(u,u.left<c.left)}}return a}else{let a=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(a--,u=1):n<0?a--:c++,pr(Ht(kt(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==Ye(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return Ns(a.getBoundingClientRect(),!1)}if(i==null&&o<Ye(r)){let a=r.childNodes[o];if(a.nodeType==1)return Ns(a.getBoundingClientRect(),!0)}return Ns(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==Ye(r))){let a=r.childNodes[o-1],c=a.nodeType==3?kt(a,Ye(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return pr(Ht(c,1),!1)}if(i==null&&o<Ye(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?kt(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return pr(Ht(c,-1),!0)}return pr(Ht(r.nodeType==3?kt(r):r,-n),n>=0)}function pr(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Ns(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function kh(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function uy(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return kh(t,e,()=>{let{node:i}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=Sh(t,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=kt(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const dy=/[\u0590-\u08ac]/;function fy(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=t.domSelection();return l?!dy.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:kh(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),v=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),v}):r.pos==r.start()||r.pos==r.end()}let Au=null,Ru=null,Ou=!1;function hy(t,e,n){return Au==e&&Ru==n?Ou:(Au=e,Ru=n,Ou=n=="up"||n=="down"?uy(t,e,n):fy(t,e,n))}const Qe=0,Nu=1,yn=2,pt=3;class Xr{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Qe,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>ke(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let l=o.children[s];if(l.size){o=l;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>e||s instanceof Mh){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Eh&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?ke(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?ke(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(o==-1&&e<=c){let u=s+a.border;if(e>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,u);e=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=ke(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=ke(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],v=p+m.size;if(i>p&&s<v)return m.setSelection(e-p-m.border,n-p-m.border,r,o);p=v}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Xe||Le)&&e==n){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
23
+ `),d&&p==h.nodeValue.length)for(let m=h,v;m;m=m.parentNode){if(v=m.nextSibling){v.nodeName=="BR"&&(l=a={node:v.parentNode,offset:ke(v)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Xe&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||d&&Le)&&An(l.node,l.offset,u.anchorNode,u.anchorOffset)&&An(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&Xe)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let p=l;l=a,a=p}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,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let l=r+i.border,a=s-i.border;if(e>=l&&n<=a){this.dirty=e==r||n==s?yn:Nu,e==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=pt:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?yn:pt}r=s}this.dirty=yn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?yn:Nu;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Eh extends Xr{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.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=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Qe&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class py extends Xr{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Rn extends Xr{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=Ln.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Rn(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&pt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=pt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Qe){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Qe}}slice(e,n,r){let o=Rn.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Nl(i,n,s,r)),e>0&&(i=Nl(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class en extends Xr{constructor(e,n,r,o,i,s,l,a,c){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,n,r,o,i,s){let l=i.nodeViews[n.type.name],a,c=l&&l(n,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Ln.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Rh(u,r,n),c?a=new my(e,n,r,o,u,d||null,f,c,i,s+1):n.isText?new Wi(e,n,r,o,u,f,i):new en(e,n,r,o,u,d||null,f,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>A.empty)}return e}matchesNode(e,n,r){return this.dirty==Qe&&e.eq(this.node)&&Go(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new yy(this,s&&s.node,e);Cy(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?ne.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,o)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(h=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(c,u,d,h,e)||a.updateNextNode(c,u,d,e,f,o)||a.addNode(c,u,d,e,o),o+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==yn)&&(s&&this.protectLocalComposition(e,s),Th(this.contentDOM,this.children,e),or&&xy(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof V)||r<n||o>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=wy(this.node.content,s,r-n,o-n);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new py(this,i,n,o);e.input.compositionNodes.push(s),this.children=Nl(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==pt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Qe}updateOuterDeco(e){if(Go(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ah(this.dom,this.nodeDOM,Ol(this.outerDeco,this.node,n),Ol(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Iu(t,e,n,r,o){Rh(r,e,t);let i=new en(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Wi extends en{constructor(e,n,r,o,i,s,l){super(e,n,r,o,i,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,n,r,o){return this.dirty==pt||this.dirty!=Qe&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Qe||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Qe,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),i=document.createTextNode(o.text);return new Wi(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=pt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Mh extends Xr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Qe&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class my extends en{constructor(e,n,r,o,i,s,l,a,c,u){super(e,n,r,o,i,s,l,c,u),this.spec=a}update(e,n,r,o){if(this.dirty==pt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}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 Th(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){for(;l!=r;)r=Lu(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(l,r);if(s instanceof Rn){let a=r?r.previousSibling:t.lastChild;Th(s.contentDOM,s.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=Lu(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const Sr=function(t){t&&(this.nodeName=t)};Sr.prototype=Object.create(null);const vn=[new Sr];function Ol(t,e,n){if(t.length==0)return vn;let r=n?vn[0]:new Sr,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new Sr(s.nodeName));for(let l in s){let a=s[l];a!=null&&(n&&o.length==1&&o.push(r=new Sr(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return o}function Ah(t,e,n,r){if(n==vn&&r==vn)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],l=n[i];if(i){let a;l&&l.nodeName==s.nodeName&&o!=t&&(a=o.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=vn[0]),o=a}gy(o,l||vn[0],s)}return o}function gy(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.add(o[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function Rh(t,e,n){return Ah(t,t,vn,Ol(e,n,t.nodeType!=1))}function Go(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Lu(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class yy{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=vy(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=Qe,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<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[i])&&!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=Rn.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,o,i){let s=this.top.children[o];return s.dirty==pt&&s.dom==s.contentDOM&&(s.dirty=yn),s.update(e,n,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof en){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=pt&&Go(n,a.outerDeco));if(!f&&a.update(e,n,r,o))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,o,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=yn,d.updateChildren(o,s+1),d.dirty=Qe),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Go(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=en.create(this.top,n,r,o,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,o,i){let s=en.create(this.top,e,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new Eh(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Rn;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Wi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Le||Re)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new Mh(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function vy(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];e:for(;o>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof Rn)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(o-1))break;--o,i.set(l,o),s.push(l)}}return{index:o,matched:i,matches:s.reverse()}}function by(t,e){return t.type.side-e.type.side}function Cy(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,o,e.forChild(i,u),c),i+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let v=o[s++];v.widget&&(u?(d||(d=[u])).push(v):u=v)}if(u)if(d){d.sort(by);for(let v=0;v<d.length;v++)n(d[v],c,!!a)}else n(u,c,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let v=0;v<l.length;v++)l[v].to<=i&&l.splice(v--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let p=i+f.nodeSize;if(f.isText){let v=p;s<o.length&&o[s].from<v&&(v=o[s].from);for(let b=0;b<l.length;b++)l[b].to<v&&(v=l[b].to);v<p&&(a=f.cut(v-i),f=f.cut(0,v-i),p=v,h=-1)}else for(;s<o.length&&o[s].to<p;)s++;let m=f.isInline&&!f.isLeaf?l.filter(v=>!v.inline):l.slice();r(f,m,e.forChild(i,f),h),i=p}}function xy(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function wy(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<t.childCount;){let c=t.child(o++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=n){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Nl(t,e,n,r,o){let i=[];for(let s=0,l=0;s<t.length;s++){let a=t[s],c=l,u=l+=a.size;c>=n||u<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(a.slice(n-c,a.size,r)))}return i}function Ma(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(Ui(n)){for(a=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&B.isSelectable(d)&&o.parent&&!(d.isInline&&G2(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new B(s==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,s]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(s)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;c=Ta(t,u,l,d)}return c}function Oh(t){return t.editable?t.hasFocus():Ih(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function At(t,e=!1){let n=t.state.selection;if(Nh(t,n),!!Oh(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Re){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&An(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)ky(t);else{let{anchor:r,head:o}=n,i,s;Du&&!(n instanceof V)&&(n.$from.parent.inlineContent||(i=Pu(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Pu(t,n.to))),t.docView.setSelection(r,o,t,e),Du&&(i&&ju(i),s&&ju(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Sy(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Du=Le||Re&&vh<63;function Pu(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Le&&o&&o.contentEditable=="false")return Is(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return Is(o);if(i)return Is(i)}}function Is(t){return t.contentEditable="true",Le&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function ju(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Sy(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Oh(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function ky(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,ke(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&He&&Qt<=11&&(n.disabled=!0,n.disabled=!1)}function Nh(t,e){if(e instanceof B){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Bu(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Bu(t)}function Bu(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Ta(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||V.between(e,n,r)}function _u(t){return t.editable&&!t.hasFocus()?!1:Ih(t)}function Ih(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Ey(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return An(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Il(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&q.findFrom(i,e)}function $t(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Hu(t,e,n){let r=t.state.selection;if(r instanceof V)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return $t(t,new V(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=Il(t.state,e);return o&&o instanceof B?$t(t,o):!1}else if(!(Ze&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?B.isSelectable(i)?$t(t,new B(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):Yr?$t(t,new V(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof B&&r.node.isInline)return $t(t,new V(e>0?r.$to:r.$from));{let o=Il(t.state,e);return o?$t(t,o):!1}}}function Jo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function kr(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Fn(t,e){return e<0?My(t):Ty(t)}function My(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(Xe&&n.nodeType==1&&r<Jo(n)&&kr(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(kr(l,-1))o=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(Lh(n))break;{let l=n.previousSibling;for(;l&&kr(l,-1);)o=n.parentNode,i=ke(l),l=l.previousSibling;if(l)n=l,r=Jo(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Ll(t,n,r):o&&Ll(t,o,i)}function Ty(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=Jo(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let l=n.childNodes[r];if(kr(l,1))i=n,s=++r;else break}else{if(Lh(n))break;{let l=n.nextSibling;for(;l&&kr(l,1);)i=l.parentNode,s=ke(l)+1,l=l.nextSibling;if(l)n=l,r=0,o=Jo(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&Ll(t,i,s)}function Lh(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Ay(t,e){for(;t&&e==t.childNodes.length&&!Zr(t);)e=ke(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Ry(t,e){for(;t&&!e&&!Zr(t);)e=ke(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Ll(t,e,n){if(e.nodeType!=3){let i,s;(s=Ay(e,n))?(e=s,n=0):(i=Ry(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Ui(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&At(t)},50)}function Fu(t,e){let n=t.state.doc.resolve(e);if(!(Re||Y2)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function $u(t,e,n){let r=t.state.selection;if(r instanceof V&&!r.empty||n.indexOf("s")>-1||Ze&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Il(t.state,e);if(s&&s instanceof B)return $t(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,l=r instanceof ze?q.near(s,e):q.findFrom(s,e);return l?$t(t,l):!1}return!1}function Vu(t,e){if(!(t.state.selection instanceof V))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function zu(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Oy(t){if(!Le||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;zu(t,r,"true"),setTimeout(()=>zu(t,r,"false"),20)}return!1}function Ny(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Iy(t,e){let n=e.keyCode,r=Ny(e);if(n==8||Ze&&n==72&&r=="c")return Vu(t,-1)||Fn(t,-1);if(n==46&&!e.shiftKey||Ze&&n==68&&r=="c")return Vu(t,1)||Fn(t,1);if(n==13||n==27)return!0;if(n==37||Ze&&n==66&&r=="c"){let o=n==37?Fu(t,t.state.selection.from)=="ltr"?-1:1:-1;return Hu(t,o,r)||Fn(t,o)}else if(n==39||Ze&&n==70&&r=="c"){let o=n==39?Fu(t,t.state.selection.from)=="ltr"?1:-1:1;return Hu(t,o,r)||Fn(t,o)}else{if(n==38||Ze&&n==80&&r=="c")return $u(t,-1,r)||Fn(t,-1);if(n==40||Ze&&n==78&&r=="c")return Oy(t)||$u(t,1,r)||Fn(t,1);if(r==(Ze?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Aa(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=t.someProp("clipboardSerializer")||Ln.fromSchema(t.state.schema),l=Hh(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=_h[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
24
24
 
25
25
  `);return{dom:a,text:f,slice:e}}function Dh(t,e,n,r,o){let i=o.parent.type.spec.code,s,l;if(!n&&!e)return null;let a=!!e&&(r||i||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return l=new D(A.from(t.state.schema.text(e.replace(/\r\n?/g,`
26
- `))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)l=d;else{let f=o.marks(),{schema:h}=t.state,p=Ln.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let v=s.appendChild(document.createElement("p"));m&&v.appendChild(p.serializeNode(h.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=jy(n),Yr&&By(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Qt.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Ly.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=_y(Uu(l,+u[1],+u[2]),u[4]);else if(l=D.maxOpen(Dy(l.content,o),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=Uu(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const Ly=/^(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 Dy(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&i.length&&jh(a,i,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Bh(s[s.length-1],i.length));let u=Ph(l,a);s.push(u),o=o.matchType(u.type),i=a}}),s)return A.from(s)}return t}function Ph(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,A.from(t));return t}function jh(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=jh(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(A.from(Ph(n,t,o+1))))}}function Bh(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Bh(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(A.empty,!0);return t.copy(n.append(r))}function Dl(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),o<r-1&&(l=Dl(l,e,n,r,o+1,i)),o>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(A.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function Uu(t,e,n){return e<t.openStart&&(t=new D(Dl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new D(Dl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const _h={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 Wu=null;function Hh(){return Wu||(Wu=document.implementation.createHTMLDocument("title"))}let Ls=null;function Py(t){let e=window.trustedTypes;return e?(Ls||(Ls=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Ls.createHTML(t)):t}function jy(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Hh().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&_h[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=Py(t),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function By(t){let e=t.querySelectorAll(Re?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function _y(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:i,openEnd:s}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;o=A.from(a.create(r[l+1],o)),i++,s++}return new D(o,i,s)}const De={},Pe={},Hy={touchstart:!0,touchmove:!0};class Fy{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function $y(t){for(let e in De){let n=De[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{zy(t,r)&&!Ra(t,r)&&(t.editable||!(r.type in Pe))&&n(t,r)},Hy[e]?{passive:!0}:void 0)}Le&&t.dom.addEventListener("input",()=>null),Pl(t)}function Yt(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Vy(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Pl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Ra(t,r))})}function Ra(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function zy(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Uy(t,e){!Ra(t,e)&&De[e.type]&&(t.editable||!(e.type in Pe))&&De[e.type](t,e)}Pe.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!$h(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(At&&Re&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),or&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,gn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Iy(t,n)?n.preventDefault():Yt(t,"key")};Pe.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Pe.keypress=(t,e)=>{let n=e;if($h(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ze&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof V)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,o,i))&&t.dispatch(i()),n.preventDefault()}};function Ki(t){return{left:t.clientX,top:t.clientY}}function Wy(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Oa(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),o,!0):l(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Xn(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Ky(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&B.isSelectable(r)?(Xn(t,new B(n)),!0):!1}function qy(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof B&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(B.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(Xn(t,B.create(t.state.doc,o)),!0):!1}function Gy(t,e,n,r,o){return Oa(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?qy(t,n):Ky(t,n))}function Jy(t,e,n,r){return Oa(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function Zy(t,e,n,r){return Oa(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||Yy(t,n,r)}function Yy(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Xn(t,V.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),l=o.before(i);if(s.inlineContent)Xn(t,V.create(r,l+1,l+1+s.content.size));else if(B.isSelectable(s))Xn(t,B.create(r,l));else continue;return!0}}function Na(t){return Zo(t)}const Fh=Ze?"metaKey":"ctrlKey";De.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Na(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&Wy(n,t.input.lastClick)&&!n[Fh]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(Ki(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Xy(t,s,n,!!r)):(i=="doubleClick"?Jy:Zy)(t,s.pos,s.inside,n)?n.preventDefault():Yt(t,"pointer"))};class Xy{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Fh],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const l=o?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof B&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Xe&&!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)),Yt(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(()=>Nt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ki(e))),this.updateAllowDefault(e),this.allowDefault||!n?Yt(this.view,"pointer"):Gy(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Le&&this.mightDrag&&!this.mightDrag.node.isAtom||Re&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Xn(this.view,q.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Yt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Yt(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)}}De.touchstart=t=>{t.input.lastTouch=Date.now(),Na(t),Yt(t,"pointer")};De.touchmove=t=>{t.input.lastTouch=Date.now(),Yt(t,"pointer")};De.contextmenu=t=>Na(t);function $h(t,e){return t.composing?!0:Le&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Qy=At?5e3:-1;Pe.compositionstart=Pe.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof V&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Zo(t,!0),t.markCursor=null;else if(Zo(t,!e.selection.empty),Xe&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}Vh(t,Qy)};Pe.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Vh(t,20))};function Vh(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Zo(t),e))}function zh(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=tv());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function ev(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=K2(e.focusNode,e.focusOffset),r=q2(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function tv(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Zo(t,e=!1){if(!(At&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),zh(t),e||t.docView&&t.docView.dirty){let n=Ma(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function nv(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Pr=He&&en<15||or&&X2<604;De.copy=Pe.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=Pr?null:n.clipboardData,s=r.content(),{dom:l,text:a}=Aa(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):nv(t,l),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function rv(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function ov(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?jr(t,r.value,null,o,e):jr(t,r.textContent,r.innerHTML,o,e)},50)}function jr(t,e,n,r,o){let i=Dh(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,o,i||D.empty)))return!0;if(!i)return!1;let s=rv(i),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Uh(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Pe.paste=(t,e)=>{let n=e;if(t.composing&&!At)return;let r=Pr?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&jr(t,Uh(r),r.getData("text/html"),o,n)?n.preventDefault():ov(t,n)};class Wh{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const iv=Ze?"altKey":"ctrlKey";function Kh(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[iv]}De.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(Ki(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof B?o.to-1:o.to))){if(r&&r.mightDrag)s=B.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=B.create(t.state.doc,d.posBefore))}}let l=(s||t.state.selection).content(),{dom:a,text:c,slice:u}=Aa(t,l);(!n.dataTransfer.files.length||!Re||vh>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Pr?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Pr||n.dataTransfer.setData("text/plain",c),t.dragging=new Wh(u,Kh(t,n),s)};De.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Pe.dragover=Pe.dragenter=(t,e)=>e.preventDefault();Pe.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(Ki(n));if(!o)return;let i=t.state.doc.resolve(o.pos),s=r&&r.slice;s?t.someProp("transformPasted",p=>{s=p(s,t,!1)}):s=Dh(t,Uh(n.dataTransfer),Pr?null:n.dataTransfer.getData("text/html"),!1,i);let l=!!(r&&Kh(t,n));if(t.someProp("handleDrop",p=>p(t,n,s||D.empty,l))){n.preventDefault();return}if(!s)return;n.preventDefault();let a=s?Yf(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let c=t.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&B.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new B(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,v,b,C)=>p=C),c.setSelection(Ta(t,h,c.doc.resolve(p)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};De.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Nt(t)},20))};De.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};De.beforeinput=(t,e)=>{if(Re&&At&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,gn(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in Pe)De[t]=Pe[t];function Br(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Yo{constructor(e,n){this.toDOM=e,this.spec=n||Sn,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new Ie(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Yo&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Br(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class nn{constructor(e,n){this.attrs=e,this.spec=n||Sn}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new Ie(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof nn&&Br(this.attrs,e.attrs)&&Br(this.spec,e.spec)}static is(e){return e.type instanceof nn}destroy(){}}class Ia{constructor(e,n){this.attrs=e,this.spec=n||Sn}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new Ie(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),i;return o==n.from&&!(i=e.child(r)).isText&&o+i.nodeSize==n.to}eq(e){return this==e||e instanceof Ia&&Br(this.attrs,e.attrs)&&Br(this.spec,e.spec)}destroy(){}}class Ie{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Ie(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Ie(e,e,new Yo(n,r))}static inline(e,n,r,o){return new Ie(e,n,new nn(r,o))}static node(e,n,r,o){return new Ie(e,n,new Ia(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof nn}get widget(){return this.type instanceof Yo}}const Wn=[],Sn={};class ae{constructor(e,n){this.local=e.length?e:Wn,this.children=n.length?n:Wn}static create(e,n){return n.length?Xo(n,e,0,Sn):Ae}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,o+l,i)}}map(e,n,r){return this==Ae||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Sn)}mapInner(e,n,r,o,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,o);a&&a.type.valid(n,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?sv(this.children,s||[],e,n,r,o,i):s?new ae(s.sort(kn),Wn):Ae}add(e,n){return n.length?this==Ae?ae.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Gh(n,l,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,u,c+1):o.splice(i,0,a,a+l.nodeSize,Xo(u,l,c+1,Sn)),i+=3}});let s=qh(i?Jh(n):n,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ae(s.length?this.local.concat(s).sort(kn):this.local,o||this.children)}remove(e){return e.length==0||this==Ae?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,l=r[i]+n,a=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,l+1);c!=Ae?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<o.length;l++)o[l].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new ae(o,r):Ae}forChild(e,n){if(this==Ae)return this;if(n.isLeaf)return ae.empty;let r,o;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 i=e+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof nn){let c=Math.max(i,a.from)-i,u=Math.min(s,a.to)-i;c<u&&(o||(o=[])).push(a.copy(c,u))}}if(o){let l=new ae(o.sort(kn),Wn);return r?new qt([l,r]):l}return r||Ae}eq(e){if(this==e)return!0;if(!(e instanceof ae)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return La(this.localsInner(e))}localsInner(e){if(this==Ae)return Wn;if(e.inlineContent||!this.local.some(nn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof nn||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ae.empty=new ae([],[]);ae.removeOverlap=La;const Ae=ae.empty;class qt{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,Sn));return qt.from(r)}forChild(e,n){if(n.isLeaf)return ae.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Ae&&(i instanceof qt?r=r.concat(i.members):r.push(i))}return qt.from(r)}eq(e){if(!(e instanceof qt)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?La(r?n:n.sort(kn)):Wn}static from(e){switch(e.length){case 0:return Ae;case 1:return e[0];default:return new qt(e.every(n=>n instanceof ae)?e:e.reduce((n,r)=>n.concat(r instanceof ae?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function sv(t,e,n,r,o,i,s){let l=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,m)=>{let v=m-p-(h-f);for(let b=0;b<l.length;b+=3){let C=l[b+1];if(C<0||f>C+u-d)continue;let x=l[b]+u-d;h>=x?l[b+1]=f<=x?-2:-1:f>=u&&v&&(l[b]+=v,l[b+1]+=v)}d+=v}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+i),d=u-o;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+i,-1),h=f-o,{index:p,offset:m}=r.content.findIndex(d),v=r.maybeChild(p);if(v&&m==d&&m+v.nodeSize==h){let b=l[c+2].mapInner(n,v,u+1,t[c]+i+1,s);b!=Ae?(l[c]=d,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=lv(l,t,e,n,o,i,s),u=Xo(c,r,0,s);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ae(e.sort(kn),l)}function qh(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new Ie(o.from+e,o.to+e,o.type))}return n}function lv(t,e,n,r,o,i,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function Gh(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function Jh(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Xo(t,e,n,r){let o=[],i=!1;e.forEach((l,a)=>{let c=Gh(t,l,a+n);if(c){i=!0;let u=Xo(c,l,n+a+1,r);u!=Ae&&o.push(a,a+l.nodeSize,u)}});let s=qh(i?Jh(t):t,-n).sort(kn);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||o.length?new ae(s,o):Ae}function kn(t,e){return t.from-e.from||t.to-e.to}function La(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Ku(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Ku(e,o,r.copy(i.from,r.to)));break}}}return e}function Ku(t,e,n){for(;e<t.length&&kn(n,t[e])>0;)e++;t.splice(e,0,n)}function Ds(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Ae&&e.push(r)}),t.cursorWrapper&&e.push(ae.create(t.state.doc,[t.cursorWrapper.deco])),qt.from(e)}const av={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},cv=He&&en<=11;class uv{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 dv{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new uv,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);He&&en<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),cv&&(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,av)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(_u(this.view)){if(this.suppressingSelectionUpdates)return Nt(this.view);if(He&&en<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&An(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=rr(i))n.add(i);for(let i=e.anchorNode;i;i=rr(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&_u(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(Xe&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||pv(e,d)!=h)&&f.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ui(r)&&(c=Ma(e))&&c.eq(q.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Nt(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),fv(e)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Nt(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(He&&en<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==e.target?ke(o)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?ke(i):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 qu=new WeakMap,Gu=!1;function fv(t){if(!qu.has(t)&&(qu.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Xe,Gu)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."),Gu=!0}}function Ju(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return An(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function hv(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return Ju(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Ju(t,n):null}function pv(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function mv(t,e,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,u=a.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],Ui(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Re&&t.input.lastKeyCode===8)for(let v=i;v>o;v--){let b=r.childNodes[v-1],C=b.pmViewDesc;if(b.nodeName=="BR"&&!C){i=v;break}if(!C||C.size)break}let d=t.state.doc,f=t.someProp("domParser")||Qt.fromSchema(t.state.schema),h=d.resolve(s),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:gv,context:h});if(c&&c[0].pos!=null){let v=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=v),p={anchor:v+s,head:b+s}}return{doc:m,sel:p,from:s,to:l}}function gv(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Le&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Le&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const yv=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function vv(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let S=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=Ma(t,S);if(M&&!t.state.selection.eq(M)){if(Re&&At&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",P=>P(t,gn(13,"Enter"))))return;let N=t.state.tr.setSelection(M);S=="pointer"?N.setMeta("pointer",!0):S=="key"&&N.scrollIntoView(),i&&N.setMeta("composition",i),t.dispatch(N)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=mv(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=xv(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(or&&t.input.lastIOSEnter>Date.now()-225||At)&&o.some(S=>S.nodeType==1&&!yv.test(S.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",S=>S(t,gn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof V&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let S=Zu(t,t.state.doc,c.sel);if(S&&!S.eq(t.state.selection)){let M=t.state.tr.setSelection(S);i&&M.setMeta("composition",i),t.dispatch(M)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof V&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),He&&en<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),v=c.doc.resolveNoCache(p.endB-c.from),b=u.resolve(p.start),C=m.sameParent(v)&&m.parent.inlineContent&&b.end()>=p.endA;if((or&&t.input.lastIOSEnter>Date.now()-225&&(!C||o.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!C&&m.pos<c.doc.content.size&&(!m.sameParent(v)||!m.parent.inlineContent)&&m.pos<v.pos&&!/\S/.test(c.doc.textBetween(m.pos,v.pos,"","")))&&t.someProp("handleKeyDown",S=>S(t,gn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&Cv(u,p.start,p.endA,m,v)&&t.someProp("handleKeyDown",S=>S(t,gn(8,"Backspace")))){At&&Re&&t.domObserver.suppressSelectionUpdates();return}Re&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),At&&!C&&m.start()!=v.start()&&v.parentOffset==0&&m.depth==v.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,v=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(S){return S(t,gn(13,"Enter"))})},20));let x=p.start,w=p.endA,E=S=>{let M=S||t.state.tr.replace(x,w,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let N=Zu(t,M.doc,c.sel);N&&!(Re&&t.composing&&N.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==x||N.head==M.mapping.map(w)-1)||He&&N.empty&&N.head==x)&&M.setSelection(N)}return i&&M.setMeta("composition",i),M.scrollIntoView()},k;if(C)if(m.pos==v.pos){He&&en<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Nt(t),20));let S=E(t.state.tr.delete(x,w)),M=u.resolve(p.start).marksAcross(u.resolve(p.endA));M&&S.ensureMarks(M),t.dispatch(S)}else if(p.endA==p.endB&&(k=bv(m.parent.content.cut(m.parentOffset,v.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let S=E(t.state.tr);k.type=="add"?S.addMark(x,w,k.mark):S.removeMark(x,w,k.mark),t.dispatch(S)}else if(m.parent.child(m.index()).isText&&m.index()==v.index()-(v.textOffset?0:1)){let S=m.parent.textBetween(m.parentOffset,v.parentOffset),M=()=>E(t.state.tr.insertText(S,x,w));t.someProp("handleTextInput",N=>N(t,x,w,S,M))||t.dispatch(M())}else t.dispatch(E());else t.dispatch(E())}function Zu(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Ta(t,e.resolve(n.anchor),e.resolve(n.head))}function bv(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,l,a;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(o.length==0&&i.length==1)l=i[0],s="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(A.from(c).eq(t))return{mark:l,type:s}}function Cv(t,e,n,r,o){if(n-e<=o.pos-r.pos||Ps(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Ps(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Ps(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Ps(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function xv(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let a=Math.max(0,i-Math.min(s,l));r-=s+a-i}if(s<i&&t.size<e.size){let a=r<=i&&r>=s?i-r:0;i-=a,i&&i<e.size&&Yu(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-s),s=i}else if(l<i){let a=r<=i&&r>=l?i-r:0;i-=a,i&&i<t.size&&Yu(t.textBetween(i-1,i+1))&&(i+=a?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function Yu(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Zh{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Fy,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(nd),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=ed(this),Qu(this),this.nodeViews=td(this),this.docView=Iu(this.state.doc,Xu(this),Ds(this),this.dom,this),this.domObserver=new dv(this,(r,o,i,s)=>vv(this,r,o,i,s)),this.domObserver.start(),$y(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Pl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(nd),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(zh(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=td(this);Sv(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Pl(this),this.editable=ed(this),Qu(this);let a=Ds(this),c=Xu(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&ty(this);if(s){this.domObserver.stop();let h=d&&(He||Re)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&wv(o.selection,e.selection);if(d){let p=Re?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ev(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Iu(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ey(this))?Nt(this,h):(Nh(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&ny(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof B){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Mu(this,n.getBoundingClientRect(),e)}else Mu(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Wh(e.slice,e.move,o<0?void 0:B.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(o=n?n(l):l))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(o=n?n(l):l))return o}}hasFocus(){if(He){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&&ry(this.dom),Nt(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ay(this,e)}coordsAtPos(e,n=1){return Sh(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return hy(this,n||this.state,e)}pasteHTML(e,n){return jr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return jr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Aa(this,e)}destroy(){this.docView&&(Vy(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ds(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,U2())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Uy(this,e)}domSelectionRange(){let e=this.domSelection();return e?Le&&this.root.nodeType===11&&J2(this.dom.ownerDocument)==this.dom&&hv(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Zh.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Xu(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ie.node(0,t.state.doc.content.size,e)]}function Qu(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ie.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function ed(t){return!t.someProp("editable",e=>e(t.state)===!1)}function wv(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function td(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Sv(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function nd(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var sn={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:"'"},Qo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},kv=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ev=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ee=0;Ee<10;Ee++)sn[48+Ee]=sn[96+Ee]=String(Ee);for(var Ee=1;Ee<=24;Ee++)sn[Ee+111]="F"+Ee;for(var Ee=65;Ee<=90;Ee++)sn[Ee]=String.fromCharCode(Ee+32),Qo[Ee]=String.fromCharCode(Ee);for(var js in sn)Qo.hasOwnProperty(js)||(Qo[js]=sn[js]);function Mv(t){var e=kv&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Ev&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Qo:sn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Tv=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Av=typeof navigator<"u"&&/Win/.test(navigator.platform);function Rv(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Tv?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function Ov(t){let e=Object.create(null);for(let n in t)e[Rv(n)]=t[n];return e}function Bs(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Nv(t){return new ce({props:{handleKeyDown:Yh(t)}})}function Yh(t){let e=Ov(t);return function(n,r){let o=Mv(r),i,s=e[Bs(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[Bs(o,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Av&&r.ctrlKey&&r.altKey)&&(i=sn[r.keyCode])&&i!=o){let l=e[Bs(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var Iv=Object.defineProperty,Da=(t,e)=>{for(var n in e)Iv(t,n,{get:e[n],enumerable:!0})};function qi(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var Gi=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...c)=>{const u=l(...c)(i);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],l=!!t,a=t||o.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),s.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>{const m=this.buildProps(a,e),v=f(...p)(m);return s.push(v),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:t,editor:r,view:i,state:qi({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)(s)]))}};return s}},Xh={};Da(Xh,{blur:()=>Lv,clearContent:()=>Dv,clearNodes:()=>Pv,command:()=>jv,createParagraphNear:()=>Bv,cut:()=>_v,deleteCurrentNode:()=>Hv,deleteNode:()=>Fv,deleteRange:()=>$v,deleteSelection:()=>Vv,enter:()=>zv,exitCode:()=>Uv,extendMarkRange:()=>Wv,first:()=>Kv,focus:()=>qv,forEach:()=>Gv,insertContent:()=>Jv,insertContentAt:()=>Xv,joinBackward:()=>tb,joinDown:()=>eb,joinForward:()=>nb,joinItemBackward:()=>rb,joinItemForward:()=>ob,joinTextblockBackward:()=>ib,joinTextblockForward:()=>sb,joinUp:()=>Qv,keyboardShortcut:()=>ab,lift:()=>cb,liftEmptyBlock:()=>ub,liftListItem:()=>db,newlineInCode:()=>fb,resetAttributes:()=>hb,scrollIntoView:()=>pb,selectAll:()=>mb,selectNodeBackward:()=>gb,selectNodeForward:()=>yb,selectParentNode:()=>vb,selectTextblockEnd:()=>bb,selectTextblockStart:()=>Cb,setContent:()=>xb,setMark:()=>Hb,setMeta:()=>Fb,setNode:()=>$b,setNodeSelection:()=>Vb,setTextSelection:()=>zb,sinkListItem:()=>Ub,splitBlock:()=>Wb,splitListItem:()=>Kb,toggleList:()=>qb,toggleMark:()=>Gb,toggleNode:()=>Jb,toggleWrap:()=>Zb,undoInputRule:()=>Yb,unsetAllMarks:()=>Xb,unsetMark:()=>Qb,updateAttributes:()=>eC,wrapIn:()=>tC,wrapInList:()=>nC});var Lv=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),Dv=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),Pv=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=ar(h);if(l.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},jv=t=>e=>t(e),Bv=()=>({state:t,dispatch:e})=>hh(t,e),_v=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new V(r.doc.resolve(Math.max(s-1,0)))),!0},Hv=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){const l=o.before(i),a=o.after(i);t.delete(l,a).scrollIntoView()}return!0}return!1};function me(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var Fv=t=>({tr:e,state:n,dispatch:r})=>{const o=me(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const a=i.before(s),c=i.after(s);e.delete(a,c).scrollIntoView()}return!0}return!1},$v=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},Vv=()=>({state:t,dispatch:e})=>Ca(t,e),zv=()=>({commands:t})=>t.keyboardShortcut("Enter"),Uv=()=>({state:t,dispatch:e})=>R2(t,e);function Pa(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function ei(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Pa(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Qh(t,e,n={}){return t.find(r=>r.type===e&&ei(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function rd(t,e,n={}){return!!Qh(t,e,n)}function ja(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===e)||(n=n||((r=o.node.marks[0])==null?void 0:r.attrs),!Qh([...o.node.marks],e,n)))return;let s=o.index,l=t.start()+o.offset,a=s+1,c=l+o.node.nodeSize;for(;s>0&&rd([...t.parent.child(s-1).marks],e,n);)s-=1,l-=t.parent.child(s).nodeSize;for(;a<t.parent.childCount&&rd([...t.parent.child(a).marks],e,n);)c+=t.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function Bt(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var Wv=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const i=Bt(t,r.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:u}=l;if(o){const d=ja(a,i,e);if(d&&d.from<=c&&d.to>=u){const f=V.create(s,d.from,d.to);n.setSelection(f)}}return!0},Kv=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function ep(t){return t instanceof V}function bn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function tp(t,e=null){if(!e)return null;const n=q.atStart(t),r=q.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,i=r.to;return e==="all"?V.create(t,bn(0,o,i),bn(t.content.size,o,i)):V.create(t,bn(e,o,i),bn(e,o,i))}function np(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ji(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var qv=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(Ji()||np())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!ep(n.state.selection))return s(),!0;const l=tp(o.doc,t)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},Gv=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),Jv=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),rp=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&rp(r)}return t};function mo(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return rp(n)}function _r(t,e,n){if(t instanceof Xt||t instanceof A)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return A.fromArray(t.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),_r("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,l="";const a=new Ff({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Qt.fromSchema(a).parseSlice(mo(t),n.parseOptions):Qt.fromSchema(a).parse(mo(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=Qt.fromSchema(e);return n.slice?i.parseSlice(mo(t),n.parseOptions).content:i.parse(mo(t),n.parseOptions)}return _r("",e,n)}function Zv(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof ve||o instanceof be))return;const i=t.mapping.maps[r];let s=0;i.forEach((l,a,c,u)=>{s===0&&(s=u)}),t.setSelection(q.near(t.doc.resolve(s),n))}var Yv=t=>!("type"in t),Xv=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=v=>{i.emit("contentError",{editor:i,error:v,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{_r(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(v){a(v)}try{l=_r(e,i.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(v){return a(v),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((Yv(l)?l:[l]).forEach(v=>{v.check(),f=f?v.isText&&v.marks.length===0:!1,h=h?v.isBlock:!1}),u===d&&h){const{parent:v}=r.doc.resolve(u);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(u-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(v=>v.text||"").join("");else if(e instanceof A){let v="";e.forEach(b=>{b.text&&(v+=b.text)}),m=v}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,d)}else{m=l;const v=r.doc.resolve(u),b=v.node(),C=v.parentOffset===0,x=b.isText||b.isTextblock,w=b.content.size>0;C&&x&&w&&(u=Math.max(0,u-1)),r.replaceWith(u,d,m)}n.updateSelection&&Zv(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},Qv=()=>({state:t,dispatch:e})=>M2(t,e),eb=()=>({state:t,dispatch:e})=>T2(t,e),tb=()=>({state:t,dispatch:e})=>sh(t,e),nb=()=>({state:t,dispatch:e})=>uh(t,e),rb=()=>({state:t,dispatch:e,tr:n})=>{try{const r=$i(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},ob=()=>({state:t,dispatch:e,tr:n})=>{try{const r=$i(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},ib=()=>({state:t,dispatch:e})=>k2(t,e),sb=()=>({state:t,dispatch:e})=>E2(t,e);function op(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function lb(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Ji()||op()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var ab=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=lb(t).split(/-(?!$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a?.steps.forEach(c=>{const u=c.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function ln(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?me(e,t.schema):null,l=[];t.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(o,f+d.nodeSize);l.push({node:d,from:h,to:p})});const a=o-r,c=l.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>ei(d.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}var cb=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return ln(n,o,e)?A2(n,r):!1},ub=()=>({state:t,dispatch:e})=>ph(t,e),db=t=>({state:e,dispatch:n})=>{const r=me(t,e.schema);return F2(r)(e,n)},fb=()=>({state:t,dispatch:e})=>fh(t,e);function Zi(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function od(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var hb=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=Zi(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(i=me(t,r.schema)),l==="mark"&&(s=Bt(t,r.schema)),o&&n.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,u)=>{i&&i===c.type&&n.setNodeMarkup(u,void 0,od(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(od(d.attrs,e)))})})}),!0):!1},pb=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),mb=()=>({tr:t,dispatch:e})=>{if(e){const n=new ze(t.doc);t.setSelection(n)}return!0},gb=()=>({state:t,dispatch:e})=>ah(t,e),yb=()=>({state:t,dispatch:e})=>dh(t,e),vb=()=>({state:t,dispatch:e})=>I2(t,e),bb=()=>({state:t,dispatch:e})=>P2(t,e),Cb=()=>({state:t,dispatch:e})=>D2(t,e);function jl(t,e,n={},r={}){return _r(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var xb=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:l})=>{const{doc:a}=i;if(r.preserveWhitespace!=="full"){const c=jl(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return s&&i.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function ip(t,e){const n=Bt(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function Ba(t,e){const n=new nh(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function wb(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Sb(t,e){const n=[];return t.descendants((r,o)=>{e(r)&&n.push({node:r,pos:o})}),n}function sp(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,i)=>{n(o)&&r.push({node:o,pos:i})}),r}function kb(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Yi(t){return e=>kb(e.$from,t)}function $(t,e,n){return t.config[e]===void 0&&t.parent?$(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?$(t.parent,e,n):null}):t.config[e]}function _a(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=$(e,"addExtensions",n);return r?[e,..._a(r())]:e}).flat(10)}function Ha(t,e){const n=Ln.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function lp(t){return typeof t=="function"}function X(t,e=void 0,...n){return lp(t)?e?t.bind(e)(...n):t(...n):t}function Eb(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Hr(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function ap(t){const e=[],{nodeExtensions:n,markExtensions:r}=Hr(t),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:o},a=$(s,"addGlobalAttributes",l);if(!a)return;a().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...i,...h}})})})})}),o.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=$(s,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([u,d])=>{const f={...i,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:s.name,name:u,attribute:f})})}),e}function re(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){const l=i?String(i).split(" "):[],a=r[o]?r[o].split(" "):[],c=l.filter(u=>!a.includes(u));r[o]=[...a,...c].join(" ")}else if(o==="style"){const l=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],a=r[o]?r[o].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;a.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),l.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),r[o]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[o]=i}),r},{})}function Fr(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>re(n,r),{})}function Mb(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function id(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const o=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):Mb(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...r,...o}}}}function sd(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Eb(n)?!1:n!=null))}function Tb(t,e){var n;const r=ap(t),{nodeExtensions:o,markExtensions:i}=Hr(t),s=(n=o.find(c=>$(c,"topNode")))==null?void 0:n.name,l=Object.fromEntries(o.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((b,C)=>{const x=$(C,"extendNodeSchema",d);return{...b,...x?x(c):{}}},{}),h=sd({...f,content:X($(c,"content",d)),marks:X($(c,"marks",d)),group:X($(c,"group",d)),inline:X($(c,"inline",d)),atom:X($(c,"atom",d)),selectable:X($(c,"selectable",d)),draggable:X($(c,"draggable",d)),code:X($(c,"code",d)),whitespace:X($(c,"whitespace",d)),linebreakReplacement:X($(c,"linebreakReplacement",d)),defining:X($(c,"defining",d)),isolating:X($(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var C,x;return[b.name,{default:(C=b?.attribute)==null?void 0:C.default,validate:(x=b?.attribute)==null?void 0:x.validate}]}))}),p=X($(c,"parseHTML",d));p&&(h.parseDOM=p.map(b=>id(b,u)));const m=$(c,"renderHTML",d);m&&(h.toDOM=b=>m({node:b,HTMLAttributes:Fr(b,u)}));const v=$(c,"renderText",d);return v&&(h.toText=v),[c.name,h]})),a=Object.fromEntries(i.map(c=>{const u=r.filter(v=>v.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((v,b)=>{const C=$(b,"extendMarkSchema",d);return{...v,...C?C(c):{}}},{}),h=sd({...f,inclusive:X($(c,"inclusive",d)),excludes:X($(c,"excludes",d)),group:X($(c,"group",d)),spanning:X($(c,"spanning",d)),code:X($(c,"code",d)),attrs:Object.fromEntries(u.map(v=>{var b,C;return[v.name,{default:(b=v?.attribute)==null?void 0:b.default,validate:(C=v?.attribute)==null?void 0:C.validate}]}))}),p=X($(c,"parseHTML",d));p&&(h.parseDOM=p.map(v=>id(v,u)));const m=$(c,"renderHTML",d);return m&&(h.toDOM=v=>m({mark:v,HTMLAttributes:Fr(v,u)})),[c.name,h]}));return new Ff({topNode:s,nodes:l,marks:a})}function Ab(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Fa(t){return t.sort((n,r)=>{const o=$(n,"priority")||100,i=$(r,"priority")||100;return o>i?-1:o<i?1:0})}function cp(t){const e=Fa(_a(t)),n=Ab(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function up(t,e,n){const{from:r,to:o}=e,{blockSeparator:i=`
26
+ `))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)l=d;else{let f=o.marks(),{schema:h}=t.state,p=Ln.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let v=s.appendChild(document.createElement("p"));m&&v.appendChild(p.serializeNode(h.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=jy(n),Yr&&By(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Xt.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Ly.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=_y(Uu(l,+u[1],+u[2]),u[4]);else if(l=D.maxOpen(Dy(l.content,o),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=Uu(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const Ly=/^(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 Dy(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&i.length&&jh(a,i,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Bh(s[s.length-1],i.length));let u=Ph(l,a);s.push(u),o=o.matchType(u.type),i=a}}),s)return A.from(s)}return t}function Ph(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,A.from(t));return t}function jh(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=jh(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(A.from(Ph(n,t,o+1))))}}function Bh(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Bh(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(A.empty,!0);return t.copy(n.append(r))}function Dl(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),o<r-1&&(l=Dl(l,e,n,r,o+1,i)),o>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(A.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function Uu(t,e,n){return e<t.openStart&&(t=new D(Dl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new D(Dl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const _h={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 Wu=null;function Hh(){return Wu||(Wu=document.implementation.createHTMLDocument("title"))}let Ls=null;function Py(t){let e=window.trustedTypes;return e?(Ls||(Ls=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Ls.createHTML(t)):t}function jy(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Hh().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&_h[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=Py(t),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function By(t){let e=t.querySelectorAll(Re?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function _y(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:i,openEnd:s}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;o=A.from(a.create(r[l+1],o)),i++,s++}return new D(o,i,s)}const De={},Pe={},Hy={touchstart:!0,touchmove:!0};class Fy{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function $y(t){for(let e in De){let n=De[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{zy(t,r)&&!Ra(t,r)&&(t.editable||!(r.type in Pe))&&n(t,r)},Hy[e]?{passive:!0}:void 0)}Le&&t.dom.addEventListener("input",()=>null),Pl(t)}function Zt(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Vy(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Pl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Ra(t,r))})}function Ra(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function zy(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Uy(t,e){!Ra(t,e)&&De[e.type]&&(t.editable||!(e.type in Pe))&&De[e.type](t,e)}Pe.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!$h(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Et&&Re&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),or&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,mn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Iy(t,n)?n.preventDefault():Zt(t,"key")};Pe.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Pe.keypress=(t,e)=>{let n=e;if($h(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ze&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof V)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,o,i))&&t.dispatch(i()),n.preventDefault()}};function Ki(t){return{left:t.clientX,top:t.clientY}}function Wy(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Oa(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),o,!0):l(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Xn(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Ky(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&B.isSelectable(r)?(Xn(t,new B(n)),!0):!1}function qy(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof B&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(B.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(Xn(t,B.create(t.state.doc,o)),!0):!1}function Gy(t,e,n,r,o){return Oa(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?qy(t,n):Ky(t,n))}function Jy(t,e,n,r){return Oa(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function Zy(t,e,n,r){return Oa(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||Yy(t,n,r)}function Yy(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Xn(t,V.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),l=o.before(i);if(s.inlineContent)Xn(t,V.create(r,l+1,l+1+s.content.size));else if(B.isSelectable(s))Xn(t,B.create(r,l));else continue;return!0}}function Na(t){return Zo(t)}const Fh=Ze?"metaKey":"ctrlKey";De.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Na(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&Wy(n,t.input.lastClick)&&!n[Fh]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(Ki(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Xy(t,s,n,!!r)):(i=="doubleClick"?Jy:Zy)(t,s.pos,s.inside,n)?n.preventDefault():Zt(t,"pointer"))};class Xy{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Fh],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const l=o?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof B&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Xe&&!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)),Zt(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(()=>At(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ki(e))),this.updateAllowDefault(e),this.allowDefault||!n?Zt(this.view,"pointer"):Gy(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Le&&this.mightDrag&&!this.mightDrag.node.isAtom||Re&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Xn(this.view,q.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Zt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Zt(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)}}De.touchstart=t=>{t.input.lastTouch=Date.now(),Na(t),Zt(t,"pointer")};De.touchmove=t=>{t.input.lastTouch=Date.now(),Zt(t,"pointer")};De.contextmenu=t=>Na(t);function $h(t,e){return t.composing?!0:Le&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Qy=Et?5e3:-1;Pe.compositionstart=Pe.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof V&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Zo(t,!0),t.markCursor=null;else if(Zo(t,!e.selection.empty),Xe&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}Vh(t,Qy)};Pe.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Vh(t,20))};function Vh(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Zo(t),e))}function zh(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=tv());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function ev(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=K2(e.focusNode,e.focusOffset),r=q2(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function tv(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Zo(t,e=!1){if(!(Et&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),zh(t),e||t.docView&&t.docView.dirty){let n=Ma(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function nv(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Pr=He&&Qt<15||or&&X2<604;De.copy=Pe.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=Pr?null:n.clipboardData,s=r.content(),{dom:l,text:a}=Aa(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):nv(t,l),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function rv(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function ov(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?jr(t,r.value,null,o,e):jr(t,r.textContent,r.innerHTML,o,e)},50)}function jr(t,e,n,r,o){let i=Dh(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,o,i||D.empty)))return!0;if(!i)return!1;let s=rv(i),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Uh(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Pe.paste=(t,e)=>{let n=e;if(t.composing&&!Et)return;let r=Pr?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&jr(t,Uh(r),r.getData("text/html"),o,n)?n.preventDefault():ov(t,n)};class Wh{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const iv=Ze?"altKey":"ctrlKey";function Kh(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[iv]}De.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(Ki(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof B?o.to-1:o.to))){if(r&&r.mightDrag)s=B.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=B.create(t.state.doc,d.posBefore))}}let l=(s||t.state.selection).content(),{dom:a,text:c,slice:u}=Aa(t,l);(!n.dataTransfer.files.length||!Re||vh>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Pr?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Pr||n.dataTransfer.setData("text/plain",c),t.dragging=new Wh(u,Kh(t,n),s)};De.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Pe.dragover=Pe.dragenter=(t,e)=>e.preventDefault();Pe.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(Ki(n));if(!o)return;let i=t.state.doc.resolve(o.pos),s=r&&r.slice;s?t.someProp("transformPasted",p=>{s=p(s,t,!1)}):s=Dh(t,Uh(n.dataTransfer),Pr?null:n.dataTransfer.getData("text/html"),!1,i);let l=!!(r&&Kh(t,n));if(t.someProp("handleDrop",p=>p(t,n,s||D.empty,l))){n.preventDefault();return}if(!s)return;n.preventDefault();let a=s?Yf(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let c=t.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&B.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new B(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,v,b,C)=>p=C),c.setSelection(Ta(t,h,c.doc.resolve(p)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};De.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&At(t)},20))};De.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};De.beforeinput=(t,e)=>{if(Re&&Et&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,mn(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in Pe)De[t]=Pe[t];function Br(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Yo{constructor(e,n){this.toDOM=e,this.spec=n||Sn,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new Ie(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Yo&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Br(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class tn{constructor(e,n){this.attrs=e,this.spec=n||Sn}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new Ie(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof tn&&Br(this.attrs,e.attrs)&&Br(this.spec,e.spec)}static is(e){return e.type instanceof tn}destroy(){}}class Ia{constructor(e,n){this.attrs=e,this.spec=n||Sn}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new Ie(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),i;return o==n.from&&!(i=e.child(r)).isText&&o+i.nodeSize==n.to}eq(e){return this==e||e instanceof Ia&&Br(this.attrs,e.attrs)&&Br(this.spec,e.spec)}destroy(){}}class Ie{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Ie(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Ie(e,e,new Yo(n,r))}static inline(e,n,r,o){return new Ie(e,n,new tn(r,o))}static node(e,n,r,o){return new Ie(e,n,new Ia(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof tn}get widget(){return this.type instanceof Yo}}const Wn=[],Sn={};class ae{constructor(e,n){this.local=e.length?e:Wn,this.children=n.length?n:Wn}static create(e,n){return n.length?Xo(n,e,0,Sn):Ae}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,o+l,i)}}map(e,n,r){return this==Ae||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Sn)}mapInner(e,n,r,o,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,o);a&&a.type.valid(n,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?sv(this.children,s||[],e,n,r,o,i):s?new ae(s.sort(kn),Wn):Ae}add(e,n){return n.length?this==Ae?ae.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Gh(n,l,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,u,c+1):o.splice(i,0,a,a+l.nodeSize,Xo(u,l,c+1,Sn)),i+=3}});let s=qh(i?Jh(n):n,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ae(s.length?this.local.concat(s).sort(kn):this.local,o||this.children)}remove(e){return e.length==0||this==Ae?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,l=r[i]+n,a=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,l+1);c!=Ae?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<o.length;l++)o[l].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new ae(o,r):Ae}forChild(e,n){if(this==Ae)return this;if(n.isLeaf)return ae.empty;let r,o;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 i=e+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof tn){let c=Math.max(i,a.from)-i,u=Math.min(s,a.to)-i;c<u&&(o||(o=[])).push(a.copy(c,u))}}if(o){let l=new ae(o.sort(kn),Wn);return r?new Ut([l,r]):l}return r||Ae}eq(e){if(this==e)return!0;if(!(e instanceof ae)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return La(this.localsInner(e))}localsInner(e){if(this==Ae)return Wn;if(e.inlineContent||!this.local.some(tn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof tn||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ae.empty=new ae([],[]);ae.removeOverlap=La;const Ae=ae.empty;class Ut{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,Sn));return Ut.from(r)}forChild(e,n){if(n.isLeaf)return ae.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Ae&&(i instanceof Ut?r=r.concat(i.members):r.push(i))}return Ut.from(r)}eq(e){if(!(e instanceof Ut)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?La(r?n:n.sort(kn)):Wn}static from(e){switch(e.length){case 0:return Ae;case 1:return e[0];default:return new Ut(e.every(n=>n instanceof ae)?e:e.reduce((n,r)=>n.concat(r instanceof ae?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function sv(t,e,n,r,o,i,s){let l=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,m)=>{let v=m-p-(h-f);for(let b=0;b<l.length;b+=3){let C=l[b+1];if(C<0||f>C+u-d)continue;let x=l[b]+u-d;h>=x?l[b+1]=f<=x?-2:-1:f>=u&&v&&(l[b]+=v,l[b+1]+=v)}d+=v}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+i),d=u-o;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+i,-1),h=f-o,{index:p,offset:m}=r.content.findIndex(d),v=r.maybeChild(p);if(v&&m==d&&m+v.nodeSize==h){let b=l[c+2].mapInner(n,v,u+1,t[c]+i+1,s);b!=Ae?(l[c]=d,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=lv(l,t,e,n,o,i,s),u=Xo(c,r,0,s);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ae(e.sort(kn),l)}function qh(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new Ie(o.from+e,o.to+e,o.type))}return n}function lv(t,e,n,r,o,i,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function Gh(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function Jh(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Xo(t,e,n,r){let o=[],i=!1;e.forEach((l,a)=>{let c=Gh(t,l,a+n);if(c){i=!0;let u=Xo(c,l,n+a+1,r);u!=Ae&&o.push(a,a+l.nodeSize,u)}});let s=qh(i?Jh(t):t,-n).sort(kn);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||o.length?new ae(s,o):Ae}function kn(t,e){return t.from-e.from||t.to-e.to}function La(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Ku(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Ku(e,o,r.copy(i.from,r.to)));break}}}return e}function Ku(t,e,n){for(;e<t.length&&kn(n,t[e])>0;)e++;t.splice(e,0,n)}function Ds(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Ae&&e.push(r)}),t.cursorWrapper&&e.push(ae.create(t.state.doc,[t.cursorWrapper.deco])),Ut.from(e)}const av={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},cv=He&&Qt<=11;class uv{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 dv{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new uv,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);He&&Qt<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),cv&&(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,av)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(_u(this.view)){if(this.suppressingSelectionUpdates)return At(this.view);if(He&&Qt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&An(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=rr(i))n.add(i);for(let i=e.anchorNode;i;i=rr(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&_u(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(Xe&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||pv(e,d)!=h)&&f.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ui(r)&&(c=Ma(e))&&c.eq(q.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,At(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),fv(e)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||At(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(He&&Qt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==e.target?ke(o)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?ke(i):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 qu=new WeakMap,Gu=!1;function fv(t){if(!qu.has(t)&&(qu.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Xe,Gu)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."),Gu=!0}}function Ju(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return An(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function hv(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return Ju(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Ju(t,n):null}function pv(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function mv(t,e,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,u=a.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],Ui(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Re&&t.input.lastKeyCode===8)for(let v=i;v>o;v--){let b=r.childNodes[v-1],C=b.pmViewDesc;if(b.nodeName=="BR"&&!C){i=v;break}if(!C||C.size)break}let d=t.state.doc,f=t.someProp("domParser")||Xt.fromSchema(t.state.schema),h=d.resolve(s),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:gv,context:h});if(c&&c[0].pos!=null){let v=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=v),p={anchor:v+s,head:b+s}}return{doc:m,sel:p,from:s,to:l}}function gv(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Le&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Le&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const yv=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function vv(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let S=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=Ma(t,S);if(M&&!t.state.selection.eq(M)){if(Re&&Et&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",P=>P(t,mn(13,"Enter"))))return;let N=t.state.tr.setSelection(M);S=="pointer"?N.setMeta("pointer",!0):S=="key"&&N.scrollIntoView(),i&&N.setMeta("composition",i),t.dispatch(N)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=mv(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=xv(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(or&&t.input.lastIOSEnter>Date.now()-225||Et)&&o.some(S=>S.nodeType==1&&!yv.test(S.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",S=>S(t,mn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof V&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let S=Zu(t,t.state.doc,c.sel);if(S&&!S.eq(t.state.selection)){let M=t.state.tr.setSelection(S);i&&M.setMeta("composition",i),t.dispatch(M)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof V&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),He&&Qt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),v=c.doc.resolveNoCache(p.endB-c.from),b=u.resolve(p.start),C=m.sameParent(v)&&m.parent.inlineContent&&b.end()>=p.endA;if((or&&t.input.lastIOSEnter>Date.now()-225&&(!C||o.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!C&&m.pos<c.doc.content.size&&(!m.sameParent(v)||!m.parent.inlineContent)&&m.pos<v.pos&&!/\S/.test(c.doc.textBetween(m.pos,v.pos,"","")))&&t.someProp("handleKeyDown",S=>S(t,mn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&Cv(u,p.start,p.endA,m,v)&&t.someProp("handleKeyDown",S=>S(t,mn(8,"Backspace")))){Et&&Re&&t.domObserver.suppressSelectionUpdates();return}Re&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),Et&&!C&&m.start()!=v.start()&&v.parentOffset==0&&m.depth==v.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,v=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(S){return S(t,mn(13,"Enter"))})},20));let x=p.start,w=p.endA,E=S=>{let M=S||t.state.tr.replace(x,w,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let N=Zu(t,M.doc,c.sel);N&&!(Re&&t.composing&&N.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==x||N.head==M.mapping.map(w)-1)||He&&N.empty&&N.head==x)&&M.setSelection(N)}return i&&M.setMeta("composition",i),M.scrollIntoView()},k;if(C)if(m.pos==v.pos){He&&Qt<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>At(t),20));let S=E(t.state.tr.delete(x,w)),M=u.resolve(p.start).marksAcross(u.resolve(p.endA));M&&S.ensureMarks(M),t.dispatch(S)}else if(p.endA==p.endB&&(k=bv(m.parent.content.cut(m.parentOffset,v.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let S=E(t.state.tr);k.type=="add"?S.addMark(x,w,k.mark):S.removeMark(x,w,k.mark),t.dispatch(S)}else if(m.parent.child(m.index()).isText&&m.index()==v.index()-(v.textOffset?0:1)){let S=m.parent.textBetween(m.parentOffset,v.parentOffset),M=()=>E(t.state.tr.insertText(S,x,w));t.someProp("handleTextInput",N=>N(t,x,w,S,M))||t.dispatch(M())}else t.dispatch(E());else t.dispatch(E())}function Zu(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Ta(t,e.resolve(n.anchor),e.resolve(n.head))}function bv(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,l,a;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(o.length==0&&i.length==1)l=i[0],s="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(A.from(c).eq(t))return{mark:l,type:s}}function Cv(t,e,n,r,o){if(n-e<=o.pos-r.pos||Ps(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Ps(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Ps(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Ps(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function xv(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let a=Math.max(0,i-Math.min(s,l));r-=s+a-i}if(s<i&&t.size<e.size){let a=r<=i&&r>=s?i-r:0;i-=a,i&&i<e.size&&Yu(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-s),s=i}else if(l<i){let a=r<=i&&r>=l?i-r:0;i-=a,i&&i<t.size&&Yu(t.textBetween(i-1,i+1))&&(i+=a?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function Yu(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Zh{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Fy,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(nd),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=ed(this),Qu(this),this.nodeViews=td(this),this.docView=Iu(this.state.doc,Xu(this),Ds(this),this.dom,this),this.domObserver=new dv(this,(r,o,i,s)=>vv(this,r,o,i,s)),this.domObserver.start(),$y(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Pl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(nd),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(zh(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=td(this);Sv(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Pl(this),this.editable=ed(this),Qu(this);let a=Ds(this),c=Xu(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&ty(this);if(s){this.domObserver.stop();let h=d&&(He||Re)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&wv(o.selection,e.selection);if(d){let p=Re?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ev(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Iu(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ey(this))?At(this,h):(Nh(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&ny(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof B){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Mu(this,n.getBoundingClientRect(),e)}else Mu(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Wh(e.slice,e.move,o<0?void 0:B.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(o=n?n(l):l))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(o=n?n(l):l))return o}}hasFocus(){if(He){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&&ry(this.dom),At(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ay(this,e)}coordsAtPos(e,n=1){return Sh(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return hy(this,n||this.state,e)}pasteHTML(e,n){return jr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return jr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Aa(this,e)}destroy(){this.docView&&(Vy(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ds(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,U2())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Uy(this,e)}domSelectionRange(){let e=this.domSelection();return e?Le&&this.root.nodeType===11&&J2(this.dom.ownerDocument)==this.dom&&hv(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Zh.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Xu(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ie.node(0,t.state.doc.content.size,e)]}function Qu(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ie.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function ed(t){return!t.someProp("editable",e=>e(t.state)===!1)}function wv(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function td(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Sv(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function nd(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var on={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:"'"},Qo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},kv=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ev=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ee=0;Ee<10;Ee++)on[48+Ee]=on[96+Ee]=String(Ee);for(var Ee=1;Ee<=24;Ee++)on[Ee+111]="F"+Ee;for(var Ee=65;Ee<=90;Ee++)on[Ee]=String.fromCharCode(Ee+32),Qo[Ee]=String.fromCharCode(Ee);for(var js in on)Qo.hasOwnProperty(js)||(Qo[js]=on[js]);function Mv(t){var e=kv&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Ev&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Qo:on)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Tv=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Av=typeof navigator<"u"&&/Win/.test(navigator.platform);function Rv(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Tv?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function Ov(t){let e=Object.create(null);for(let n in t)e[Rv(n)]=t[n];return e}function Bs(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Nv(t){return new ce({props:{handleKeyDown:Yh(t)}})}function Yh(t){let e=Ov(t);return function(n,r){let o=Mv(r),i,s=e[Bs(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[Bs(o,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Av&&r.ctrlKey&&r.altKey)&&(i=on[r.keyCode])&&i!=o){let l=e[Bs(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var Iv=Object.defineProperty,Da=(t,e)=>{for(var n in e)Iv(t,n,{get:e[n],enumerable:!0})};function qi(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var Gi=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...c)=>{const u=l(...c)(i);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],l=!!t,a=t||o.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),s.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>{const m=this.buildProps(a,e),v=f(...p)(m);return s.push(v),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:t,editor:r,view:i,state:qi({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)(s)]))}};return s}},Xh={};Da(Xh,{blur:()=>Lv,clearContent:()=>Dv,clearNodes:()=>Pv,command:()=>jv,createParagraphNear:()=>Bv,cut:()=>_v,deleteCurrentNode:()=>Hv,deleteNode:()=>Fv,deleteRange:()=>$v,deleteSelection:()=>Vv,enter:()=>zv,exitCode:()=>Uv,extendMarkRange:()=>Wv,first:()=>Kv,focus:()=>qv,forEach:()=>Gv,insertContent:()=>Jv,insertContentAt:()=>Xv,joinBackward:()=>tb,joinDown:()=>eb,joinForward:()=>nb,joinItemBackward:()=>rb,joinItemForward:()=>ob,joinTextblockBackward:()=>ib,joinTextblockForward:()=>sb,joinUp:()=>Qv,keyboardShortcut:()=>ab,lift:()=>cb,liftEmptyBlock:()=>ub,liftListItem:()=>db,newlineInCode:()=>fb,resetAttributes:()=>hb,scrollIntoView:()=>pb,selectAll:()=>mb,selectNodeBackward:()=>gb,selectNodeForward:()=>yb,selectParentNode:()=>vb,selectTextblockEnd:()=>bb,selectTextblockStart:()=>Cb,setContent:()=>xb,setMark:()=>Hb,setMeta:()=>Fb,setNode:()=>$b,setNodeSelection:()=>Vb,setTextSelection:()=>zb,sinkListItem:()=>Ub,splitBlock:()=>Wb,splitListItem:()=>Kb,toggleList:()=>qb,toggleMark:()=>Gb,toggleNode:()=>Jb,toggleWrap:()=>Zb,undoInputRule:()=>Yb,unsetAllMarks:()=>Xb,unsetMark:()=>Qb,updateAttributes:()=>eC,wrapIn:()=>tC,wrapInList:()=>nC});var Lv=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),Dv=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),Pv=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=ar(h);if(l.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},jv=t=>e=>t(e),Bv=()=>({state:t,dispatch:e})=>hh(t,e),_v=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new V(r.doc.resolve(Math.max(s-1,0)))),!0},Hv=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){const l=o.before(i),a=o.after(i);t.delete(l,a).scrollIntoView()}return!0}return!1};function me(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var Fv=t=>({tr:e,state:n,dispatch:r})=>{const o=me(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const a=i.before(s),c=i.after(s);e.delete(a,c).scrollIntoView()}return!0}return!1},$v=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},Vv=()=>({state:t,dispatch:e})=>Ca(t,e),zv=()=>({commands:t})=>t.keyboardShortcut("Enter"),Uv=()=>({state:t,dispatch:e})=>R2(t,e);function Pa(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function ei(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Pa(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Qh(t,e,n={}){return t.find(r=>r.type===e&&ei(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function rd(t,e,n={}){return!!Qh(t,e,n)}function ja(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===e)||(n=n||((r=o.node.marks[0])==null?void 0:r.attrs),!Qh([...o.node.marks],e,n)))return;let s=o.index,l=t.start()+o.offset,a=s+1,c=l+o.node.nodeSize;for(;s>0&&rd([...t.parent.child(s-1).marks],e,n);)s-=1,l-=t.parent.child(s).nodeSize;for(;a<t.parent.childCount&&rd([...t.parent.child(a).marks],e,n);)c+=t.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function Dt(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var Wv=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const i=Dt(t,r.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:u}=l;if(o){const d=ja(a,i,e);if(d&&d.from<=c&&d.to>=u){const f=V.create(s,d.from,d.to);n.setSelection(f)}}return!0},Kv=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function ep(t){return t instanceof V}function bn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function tp(t,e=null){if(!e)return null;const n=q.atStart(t),r=q.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,i=r.to;return e==="all"?V.create(t,bn(0,o,i),bn(t.content.size,o,i)):V.create(t,bn(e,o,i),bn(e,o,i))}function np(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ji(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var qv=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(Ji()||np())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!ep(n.state.selection))return s(),!0;const l=tp(o.doc,t)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},Gv=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),Jv=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),rp=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&rp(r)}return t};function mo(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return rp(n)}function _r(t,e,n){if(t instanceof Yt||t instanceof A)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return A.fromArray(t.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),_r("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,l="";const a=new Ff({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Xt.fromSchema(a).parseSlice(mo(t),n.parseOptions):Xt.fromSchema(a).parse(mo(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=Xt.fromSchema(e);return n.slice?i.parseSlice(mo(t),n.parseOptions).content:i.parse(mo(t),n.parseOptions)}return _r("",e,n)}function Zv(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof ve||o instanceof be))return;const i=t.mapping.maps[r];let s=0;i.forEach((l,a,c,u)=>{s===0&&(s=u)}),t.setSelection(q.near(t.doc.resolve(s),n))}var Yv=t=>!("type"in t),Xv=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=v=>{i.emit("contentError",{editor:i,error:v,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{_r(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(v){a(v)}try{l=_r(e,i.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(v){return a(v),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((Yv(l)?l:[l]).forEach(v=>{v.check(),f=f?v.isText&&v.marks.length===0:!1,h=h?v.isBlock:!1}),u===d&&h){const{parent:v}=r.doc.resolve(u);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(u-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(v=>v.text||"").join("");else if(e instanceof A){let v="";e.forEach(b=>{b.text&&(v+=b.text)}),m=v}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,d)}else{m=l;const v=r.doc.resolve(u),b=v.node(),C=v.parentOffset===0,x=b.isText||b.isTextblock,w=b.content.size>0;C&&x&&w&&(u=Math.max(0,u-1)),r.replaceWith(u,d,m)}n.updateSelection&&Zv(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},Qv=()=>({state:t,dispatch:e})=>M2(t,e),eb=()=>({state:t,dispatch:e})=>T2(t,e),tb=()=>({state:t,dispatch:e})=>sh(t,e),nb=()=>({state:t,dispatch:e})=>uh(t,e),rb=()=>({state:t,dispatch:e,tr:n})=>{try{const r=$i(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},ob=()=>({state:t,dispatch:e,tr:n})=>{try{const r=$i(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},ib=()=>({state:t,dispatch:e})=>k2(t,e),sb=()=>({state:t,dispatch:e})=>E2(t,e);function op(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function lb(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Ji()||op()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var ab=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=lb(t).split(/-(?!$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a?.steps.forEach(c=>{const u=c.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function sn(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?me(e,t.schema):null,l=[];t.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(o,f+d.nodeSize);l.push({node:d,from:h,to:p})});const a=o-r,c=l.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>ei(d.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}var cb=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return sn(n,o,e)?A2(n,r):!1},ub=()=>({state:t,dispatch:e})=>ph(t,e),db=t=>({state:e,dispatch:n})=>{const r=me(t,e.schema);return F2(r)(e,n)},fb=()=>({state:t,dispatch:e})=>fh(t,e);function Zi(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function od(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var hb=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=Zi(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(i=me(t,r.schema)),l==="mark"&&(s=Dt(t,r.schema)),o&&n.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,u)=>{i&&i===c.type&&n.setNodeMarkup(u,void 0,od(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(od(d.attrs,e)))})})}),!0):!1},pb=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),mb=()=>({tr:t,dispatch:e})=>{if(e){const n=new ze(t.doc);t.setSelection(n)}return!0},gb=()=>({state:t,dispatch:e})=>ah(t,e),yb=()=>({state:t,dispatch:e})=>dh(t,e),vb=()=>({state:t,dispatch:e})=>I2(t,e),bb=()=>({state:t,dispatch:e})=>P2(t,e),Cb=()=>({state:t,dispatch:e})=>D2(t,e);function jl(t,e,n={},r={}){return _r(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var xb=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:l})=>{const{doc:a}=i;if(r.preserveWhitespace!=="full"){const c=jl(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return s&&i.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function ip(t,e){const n=Dt(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function Ba(t,e){const n=new nh(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function wb(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Sb(t,e){const n=[];return t.descendants((r,o)=>{e(r)&&n.push({node:r,pos:o})}),n}function sp(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,i)=>{n(o)&&r.push({node:o,pos:i})}),r}function kb(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Yi(t){return e=>kb(e.$from,t)}function $(t,e,n){return t.config[e]===void 0&&t.parent?$(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?$(t.parent,e,n):null}):t.config[e]}function _a(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=$(e,"addExtensions",n);return r?[e,..._a(r())]:e}).flat(10)}function Ha(t,e){const n=Ln.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function lp(t){return typeof t=="function"}function X(t,e=void 0,...n){return lp(t)?e?t.bind(e)(...n):t(...n):t}function Eb(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Hr(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function ap(t){const e=[],{nodeExtensions:n,markExtensions:r}=Hr(t),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:o},a=$(s,"addGlobalAttributes",l);if(!a)return;a().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...i,...h}})})})})}),o.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=$(s,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([u,d])=>{const f={...i,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:s.name,name:u,attribute:f})})}),e}function re(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){const l=i?String(i).split(" "):[],a=r[o]?r[o].split(" "):[],c=l.filter(u=>!a.includes(u));r[o]=[...a,...c].join(" ")}else if(o==="style"){const l=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],a=r[o]?r[o].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;a.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),l.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),r[o]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[o]=i}),r},{})}function Fr(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>re(n,r),{})}function Mb(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function id(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const o=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):Mb(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...r,...o}}}}function sd(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Eb(n)?!1:n!=null))}function Tb(t,e){var n;const r=ap(t),{nodeExtensions:o,markExtensions:i}=Hr(t),s=(n=o.find(c=>$(c,"topNode")))==null?void 0:n.name,l=Object.fromEntries(o.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((b,C)=>{const x=$(C,"extendNodeSchema",d);return{...b,...x?x(c):{}}},{}),h=sd({...f,content:X($(c,"content",d)),marks:X($(c,"marks",d)),group:X($(c,"group",d)),inline:X($(c,"inline",d)),atom:X($(c,"atom",d)),selectable:X($(c,"selectable",d)),draggable:X($(c,"draggable",d)),code:X($(c,"code",d)),whitespace:X($(c,"whitespace",d)),linebreakReplacement:X($(c,"linebreakReplacement",d)),defining:X($(c,"defining",d)),isolating:X($(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var C,x;return[b.name,{default:(C=b?.attribute)==null?void 0:C.default,validate:(x=b?.attribute)==null?void 0:x.validate}]}))}),p=X($(c,"parseHTML",d));p&&(h.parseDOM=p.map(b=>id(b,u)));const m=$(c,"renderHTML",d);m&&(h.toDOM=b=>m({node:b,HTMLAttributes:Fr(b,u)}));const v=$(c,"renderText",d);return v&&(h.toText=v),[c.name,h]})),a=Object.fromEntries(i.map(c=>{const u=r.filter(v=>v.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((v,b)=>{const C=$(b,"extendMarkSchema",d);return{...v,...C?C(c):{}}},{}),h=sd({...f,inclusive:X($(c,"inclusive",d)),excludes:X($(c,"excludes",d)),group:X($(c,"group",d)),spanning:X($(c,"spanning",d)),code:X($(c,"code",d)),attrs:Object.fromEntries(u.map(v=>{var b,C;return[v.name,{default:(b=v?.attribute)==null?void 0:b.default,validate:(C=v?.attribute)==null?void 0:C.validate}]}))}),p=X($(c,"parseHTML",d));p&&(h.parseDOM=p.map(v=>id(v,u)));const m=$(c,"renderHTML",d);return m&&(h.toDOM=v=>m({mark:v,HTMLAttributes:Fr(v,u)})),[c.name,h]}));return new Ff({topNode:s,nodes:l,marks:a})}function Ab(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Fa(t){return t.sort((n,r)=>{const o=$(n,"priority")||100,i=$(r,"priority")||100;return o>i?-1:o<i?1:0})}function cp(t){const e=Fa(_a(t)),n=Ab(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function up(t,e,n){const{from:r,to:o}=e,{blockSeparator:i=`
27
27
 
28
- `,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(r,o,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=i);const h=s?.[a.type.name];if(h)return u&&(l+=h({node:a,pos:c,parent:u,index:d,range:e})),!1;a.isText&&(l+=(f=a?.text)==null?void 0:f.slice(Math.max(r,c)-c,o-c))}),l}function Rb(t,e){const n={from:0,to:t.content.size};return up(t,n,e)}function dp(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function Ob(t,e){const n=me(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function fp(t,e){const n=Zi(typeof e=="string"?e:e.name,t.schema);return n==="node"?Ob(t,e):n==="mark"?ip(t,e):{}}function Nb(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function Ib(t){const e=Nb(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function $a(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,i)=>{const s=[];if(o.ranges.length)o.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=n[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{const c=e.slice(i).map(l,-1),u=e.slice(i).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),Ib(r)}function Va(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const i=n.resolve(t),s=ja(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(t,e,(o,i)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}var Lb=(t,e,n,r=20)=>{const o=t.doc.resolve(n);let i=r,s=null;for(;i>0&&s===null;){const l=o.node(i);l?.type.name===e?s=l:i-=1}return[s,i]};function _s(t,e){return e.nodes[t]||e.marks[t]||null}function Po(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}var Db=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,l)=>{var a,c;const u=((c=(a=o.type.spec).toText)==null?void 0:c.call(a,{node:o,pos:i,parent:s,index:l}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-i))}),n};function Bl(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?Bt(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>ei(d.attrs,n,{strict:!1}));let s=0;const l=[];if(o.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(m,v)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(h,v),C=Math.min(p,v+m.nodeSize),x=C-b;s+=x,l.push(...m.marks.map(w=>({mark:w,from:b,to:C})))})}),s===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>ei(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+c:a)>=s}function Pb(t,e,n={}){if(!e)return ln(t,null,n)||Bl(t,null,n);const r=Zi(e,t.schema);return r==="node"?ln(t,e,n):r==="mark"?Bl(t,e,n):!1}var jb=(t,e)=>{const{$from:n,$to:r,$anchor:o}=t.selection;if(e){const i=Yi(l=>l.type.name===e)(t.selection);if(!i)return!1;const s=t.doc.resolve(i.pos+1);return o.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Bb=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function ld(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function ad(t,e){const{nodeExtensions:n}=Hr(e),r=n.find(s=>s.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=X($(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function Xi(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let o=!0;return t.content.forEach(i=>{o!==!1&&(Xi(i,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function hp(t){return t instanceof B}function _b(t,e,n){var r;const{selection:o}=e;let i=null;if(ep(o)&&(i=o.$cursor),i){const l=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(c=>c.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=h&&p}return!c}),c})}var Hb=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:l}=i,a=Bt(t,r.schema);if(o)if(s){const c=ip(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),m=Math.min(h+f.nodeSize,d);f.marks.find(b=>b.type===a)?f.marks.forEach(b=>{a===b.type&&n.addMark(p,m,a.create({...b.attrs,...e}))}):n.addMark(p,m,a.create(e))})});return _b(r,n,a)},Fb=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),$b=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=me(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:l})=>Su(i,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Su(i,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Vb=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=bn(t,0,r.content.size),i=B.create(r,o);e.setSelection(i)}return!0},zb=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:i}=typeof t=="number"?{from:t,to:t}:t,s=V.atStart(r).from,l=V.atEnd(r).to,a=bn(o,s,l),c=bn(i,s,l),u=V.create(r,a,c);e.setSelection(u)}return!0},Ub=t=>({state:e,dispatch:n})=>{const r=me(t,e.schema);return z2(r)(e,n)};function cd(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}}var Wb=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=e,{$from:l,$to:a}=i,c=o.extensionManager.attributes,u=Po(c,l.node().type.name,l.node().attrs);if(i instanceof B&&i.node.isBlock)return!l.parentOffset||!Ot(s,l.pos)?!1:(r&&(t&&cd(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:wb(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Ot(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Ot(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(i instanceof V&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const m=e.mapping.map(l.before()),v=e.doc.resolve(m);l.node(-1).canReplaceWith(v.index(),v.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&cd(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return p},Kb=(t,e={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const l=me(t,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const d=a.node(-1);if(d.type!==l)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(o){let b=A.empty;const C=a.index(-1)?1:a.index(-2)?2:3;for(let M=a.depth-C;M>=a.depth-3;M-=1)b=A.from(a.node(M).copy(b));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,w={...Po(f,a.node().type.name,a.node().attrs),...e},E=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(w))||void 0;b=b.append(A.from(l.createAndFill(null,E)||void 0));const k=a.before(a.depth-(C-1));n.replace(k,a.after(-x),new D(b,4-C,0));let S=-1;n.doc.nodesBetween(k,n.doc.content.size,(M,N)=>{if(S>-1)return!1;M.isTextblock&&M.content.size===0&&(S=N+1)}),S>-1&&n.setSelection(V.near(n.doc.resolve(S))),n.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...Po(f,d.type.name,d.attrs),...e},m={...Po(f,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,c.pos);const v=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!Ot(n.doc,a.pos,2))return!1;if(o){const{selection:b,storedMarks:C}=r,{splittableMarks:x}=i.extensionManager,w=C||b.$to.parentOffset&&b.$from.marks();if(n.split(a.pos,2,v).scrollIntoView(),!w||!o)return!0;const E=w.filter(k=>x.includes(k.type.name));n.ensureMarks(E)}return!0},Hs=(t,e)=>{const n=Yi(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&dn(t.doc,n.pos)&&t.join(n.pos),!0},Fs=(t,e)=>{const n=Yi(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&dn(t.doc,r)&&t.join(r),!0},qb=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,h=me(t,s.schema),p=me(e,s.schema),{selection:m,storedMarks:v}=s,{$from:b,$to:C}=m,x=b.blockRange(C),w=v||m.$to.parentOffset&&m.$from.marks();if(!x)return!1;const E=Yi(k=>ad(k.type.name,d))(m);if(x.depth>=1&&E&&x.depth-E.depth<=1){if(E.node.type===h)return c.liftListItem(p);if(ad(E.node.type.name,d)&&h.validContent(E.node.content)&&l)return a().command(()=>(i.setNodeMarkup(E.pos,h),!0)).command(()=>Hs(i,h)).command(()=>Fs(i,h)).run()}return!n||!w||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Hs(i,h)).command(()=>Fs(i,h)).run():a().command(()=>{const k=u().wrapInList(h,r),S=w.filter(M=>f.includes(M.type.name));return i.ensureMarks(S),k?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Hs(i,h)).command(()=>Fs(i,h)).run()},Gb=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Bt(t,r.schema);return Bl(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},Jb=(t,e,n={})=>({state:r,commands:o})=>{const i=me(t,r.schema),s=me(e,r.schema),l=ln(r,i,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?o.setNode(s,a):o.setNode(i,{...a,...n})},Zb=(t,e={})=>({state:n,commands:r})=>{const o=me(t,n.schema);return ln(n,o,e)?r.lift(o):r.wrapIn(o,e)},Yb=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const s=t.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},Xb=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},Qb=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,a=Bt(t,r.schema),{$from:c,empty:u,ranges:d}=l;if(!o)return!0;if(u&&s){let{from:f,to:h}=l;const p=(i=c.marks().find(v=>v.type===a))==null?void 0:i.attrs,m=ja(c,a,p);m&&(f=m.from,h=m.to),n.removeMark(f,h,a)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,a)});return n.removeStoredMark(a),!0},eC=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=Zi(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(i=me(t,r.schema)),l==="mark"&&(s=Bt(t,r.schema)),o&&n.selection.ranges.forEach(a=>{const c=a.$from.pos,u=a.$to.pos;let d,f,h,p;n.selection.empty?r.doc.nodesBetween(c,u,(m,v)=>{i&&i===m.type&&(h=Math.max(v,c),p=Math.min(v+m.nodeSize,u),d=v,f=m)}):r.doc.nodesBetween(c,u,(m,v)=>{v<c&&i&&i===m.type&&(h=Math.max(v,c),p=Math.min(v+m.nodeSize,u),d=v,f=m),v>=c&&v<=u&&(i&&i===m.type&&n.setNodeMarkup(v,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(b=>{if(s===b.type){const C=Math.max(v,c),x=Math.min(v+m.nodeSize,u);n.addMark(C,x,s.create({...b.attrs,...e}))}}))}),f&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(m=>{s===m.type&&n.addMark(h,p,s.create({...m.attrs,...e}))}))}),!0):!1},tC=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return j2(o,e)(n,r)},nC=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return B2(o,e)(n,r)},rC=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Qr=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},oC=(t,e)=>{if(Pa(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function go(t){var e;const{editor:n,from:r,to:o,text:i,rules:s,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Db(c)+i;return s.forEach(f=>{if(u)return;const h=oC(d,f.find);if(!h)return;const p=a.state.tr,m=qi({state:a.state,transaction:p}),v={from:r-(h[0].length-i.length),to:o},{commands:b,chain:C,can:x}=new Gi({editor:n,state:m});f.handler({state:m,range:v,match:h,commands:b,chain:C,can:x})===null||!p.steps.length||(f.undoable&&p.setMeta(l,{transform:p,from:r,to:o,text:i}),a.dispatch(p),u=!0)}),u}function iC(t){const{editor:e,rules:n}=t,r=new ce({state:{init(){return null},apply(o,i,s){const l=o.getMeta(r);if(l)return l;const a=o.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=Ha(A.from(u),s.schema);const{from:d}=a,f=d+u.length;go({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,l){return go({editor:e,from:i,to:s,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:i}=o.state.selection;i&&go({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;const{$cursor:s}=o.state.selection;return s?go({editor:e,from:s.pos,to:s.pos,text:`
29
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function sC(t){return Object.prototype.toString.call(t).slice(8,-1)}function yo(t){return sC(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function pp(t,e){const n={...t};return yo(t)&&yo(e)&&Object.keys(e).forEach(r=>{yo(e[r])&&yo(t[r])?n[r]=pp(t[r],e[r]):n[r]=e[r]}),n}var za=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...X($(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...X($(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>pp(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},it=class mp extends za{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new mp(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const s=o.marks();if(!!!s.find(c=>c?.type.name===n.name))return!1;const a=s.find(c=>c?.type.name===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function lC(t){return typeof t=="number"}var aC=class{constructor(t){this.find=t.find,this.handler=t.handler}},cC=(t,e,n)=>{if(Pa(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const i=[o.text];return i.index=o.index,i.input=t,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function uC(t){const{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:a,chain:c,can:u}=new Gi({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(h,p)=>{var m,v,b,C,x;if((v=(m=h.type)==null?void 0:m.spec)!=null&&v.code||!(h.isText||h.isTextblock||h.isInline))return;const w=(x=(C=(b=h.content)==null?void 0:b.size)!=null?C:h.nodeSize)!=null?x:0,E=Math.max(r,p),k=Math.min(o,p+w);if(E>=k)return;const S=h.isText?h.text||"":h.textBetween(E-p,k-p,void 0,"");cC(S,i.find,s).forEach(N=>{if(N.index===void 0)return;const P=E+N.index+1,z=P+N[0].length,U={from:n.tr.mapping.map(P),to:n.tr.mapping.map(z)},H=i.handler({state:n,range:U,match:N,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(H)})}),d.every(h=>h!==null)}var vo=null,dC=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function fC(t){const{editor:e,rules:n}=t;let r=null,o=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,v=qi({state:u,transaction:m});if(!(!uC({editor:e,state:v,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new ce({view(d){const f=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(vo=e)},h=()=>{vo&&(vo=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,l=f,!i){const h=vo;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return s=f,o=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!o,v=p.getMeta("uiEvent")==="drop"&&!i,b=p.getMeta("applyPasteRules"),C=!!b;if(!m&&!v&&!C)return;if(C){let{text:E}=b;typeof E=="string"?E=E:E=Ha(A.from(E),h.schema);const{from:k}=b,S=k+E.length,M=dC(E);return a({rule:u,state:h,from:k,to:{b:S},pasteEvt:M})}const x=f.doc.content.findDiffStart(h.doc.content),w=f.doc.content.findDiffEnd(h.doc.content);if(!(!lC(x)||!w||x===w.b))return a({rule:u,state:h,from:x,to:w,pasteEvt:s})}}))}var Qi=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=cp(t),this.schema=Tb(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:_s(e.name,this.schema)},r=$(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Fa([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:_s(r.name,this.schema)},i=[],s=$(r,"addKeyboardShortcuts",o);let l={};if(r.type==="mark"&&$(r,"exitable",o)&&(l.ArrowRight=()=>it.handleExit({editor:t,mark:r})),s){const f=Object.fromEntries(Object.entries(s()).map(([h,p])=>[h,()=>p({editor:t})]));l={...l,...f}}const a=Nv(l);i.push(a);const c=$(r,"addInputRules",o);if(ld(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=iC({editor:t,rules:f}),p=Array.isArray(h)?h:[h];i.push(...p)}}const u=$(r,"addPasteRules",o);if(ld(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=fC({editor:t,rules:f});i.push(...h)}}const d=$(r,"addProseMirrorPlugins",o);if(d){const f=d();i.push(...f)}return i})}get attributes(){return ap(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Hr(this.extensions);return Object.fromEntries(e.filter(n=>!!$(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:me(n.name,this.schema)},i=$(n,"addNodeView",o);if(!i)return[];const s=(l,a,c,u,d)=>{const f=Fr(l,r);return i()({node:l,view:a,getPos:c,decorations:u,innerDecorations:d,editor:t,extension:n,HTMLAttributes:f})};return[n.name,s]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=Hr(this.extensions);return Object.fromEntries(e.filter(n=>!!$(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Bt(n.name,this.schema)},i=$(n,"addMarkView",o);if(!i)return[];const s=(l,a,c)=>{const u=Fr(l,r);return i()({mark:l,view:a,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{MC(l,t,d)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:_s(e.name,this.schema)};e.type==="mark"&&((n=X($(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=$(e,"onBeforeCreate",r),i=$(e,"onCreate",r),s=$(e,"onUpdate",r),l=$(e,"onSelectionUpdate",r),a=$(e,"onTransaction",r),c=$(e,"onFocus",r),u=$(e,"onBlur",r),d=$(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};Qi.resolve=cp;Qi.sort=Fa;Qi.flatten=_a;var hC={};Da(hC,{ClipboardTextSerializer:()=>yp,Commands:()=>vp,Delete:()=>bp,Drop:()=>Cp,Editable:()=>xp,FocusEvents:()=>Sp,Keymap:()=>kp,Paste:()=>Ep,Tabindex:()=>Mp,focusEventsPluginKey:()=>wp});var Q=class gp extends za{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new gp(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},yp=Q.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ce({key:new ye("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),a=dp(n);return up(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),vp=Q.create({name:"commands",addCommands(){return{...Xh}}}),bp=Q.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,o;const i=()=>{var s,l,a,c;if((c=(a=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,t))!=null?c:t.getMeta("y-sync$"))return;const u=Ba(t.before,[t,...e]);$a(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,m)=>{const v=m+p.nodeSize-2,b=h.oldRange.from<=m&&v<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:v,newFrom:u.mapping.map(m),newTo:u.mapping.map(v),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:t,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var m,v;if(h instanceof rt){const b=f.slice(p).map(h.from,-1),C=f.slice(p).map(h.to),x=f.invert().map(b,-1),w=f.invert().map(C),E=(m=u.doc.nodeAt(b-1))==null?void 0:m.marks.some(S=>S.eq(h.mark)),k=(v=u.doc.nodeAt(C))==null?void 0:v.marks.some(S=>S.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:x,to:w},newRange:{from:b,to:C},partial:!!(k||E),editor:this.editor,transaction:t,combinedTransform:u})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(i,0):i()}}),Cp=Q.create({name:"drop",addProseMirrorPlugins(){return[new ce({key:new ye("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),xp=Q.create({name:"editable",addProseMirrorPlugins(){return[new ce({key:new ye("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wp=new ye("focusEvents"),Sp=Q.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ce({key:wp,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),kp=Q.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,v=d.pos-d.parentOffset,b=m&&p.parent.childCount===1?v===d.pos:q.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ji()||op()?i:o},addProseMirrorPlugins(){return[new ce({key:new ye("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),o=t.some(m=>m.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:l}=e.selection,a=q.atStart(e.doc).from,c=q.atEnd(e.doc).to;if(i||!(s===a&&l===c)||!Xi(n.doc))return;const f=n.tr,h=qi({state:n,transaction:f}),{commands:p}=new Gi({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),Ep=Q.create({name:"paste",addProseMirrorPlugins(){return[new ce({key:new ye("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Mp=Q.create({name:"tabindex",addProseMirrorPlugins(){return[new ce({key:new ye("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),pC=class Kn{constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Kn(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Kn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Kn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+r+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!o&&l.depth<=this.depth)return;const a=new Kn(l,this.editor,o,o?n:null);o&&(a.actualDepth=this.depth+1),e.push(new Kn(l,this.editor,o,o?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const i=o.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const a=s[l];if(i[a]!==n[a])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const i=Object.keys(n);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===e&&i.every(a=>n[a]===s.node.attrs[a])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},mC=`.ProseMirror {
28
+ `,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(r,o,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=i);const h=s?.[a.type.name];if(h)return u&&(l+=h({node:a,pos:c,parent:u,index:d,range:e})),!1;a.isText&&(l+=(f=a?.text)==null?void 0:f.slice(Math.max(r,c)-c,o-c))}),l}function Rb(t,e){const n={from:0,to:t.content.size};return up(t,n,e)}function dp(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function Ob(t,e){const n=me(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function fp(t,e){const n=Zi(typeof e=="string"?e:e.name,t.schema);return n==="node"?Ob(t,e):n==="mark"?ip(t,e):{}}function Nb(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function Ib(t){const e=Nb(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function $a(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,i)=>{const s=[];if(o.ranges.length)o.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=n[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{const c=e.slice(i).map(l,-1),u=e.slice(i).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),Ib(r)}function Va(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const i=n.resolve(t),s=ja(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(t,e,(o,i)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}var Lb=(t,e,n,r=20)=>{const o=t.doc.resolve(n);let i=r,s=null;for(;i>0&&s===null;){const l=o.node(i);l?.type.name===e?s=l:i-=1}return[s,i]};function _s(t,e){return e.nodes[t]||e.marks[t]||null}function Po(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}var Db=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,l)=>{var a,c;const u=((c=(a=o.type.spec).toText)==null?void 0:c.call(a,{node:o,pos:i,parent:s,index:l}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-i))}),n};function Bl(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?Dt(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>ei(d.attrs,n,{strict:!1}));let s=0;const l=[];if(o.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(m,v)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(h,v),C=Math.min(p,v+m.nodeSize),x=C-b;s+=x,l.push(...m.marks.map(w=>({mark:w,from:b,to:C})))})}),s===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>ei(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+c:a)>=s}function Pb(t,e,n={}){if(!e)return sn(t,null,n)||Bl(t,null,n);const r=Zi(e,t.schema);return r==="node"?sn(t,e,n):r==="mark"?Bl(t,e,n):!1}var jb=(t,e)=>{const{$from:n,$to:r,$anchor:o}=t.selection;if(e){const i=Yi(l=>l.type.name===e)(t.selection);if(!i)return!1;const s=t.doc.resolve(i.pos+1);return o.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Bb=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function ld(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function ad(t,e){const{nodeExtensions:n}=Hr(e),r=n.find(s=>s.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=X($(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function Xi(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let o=!0;return t.content.forEach(i=>{o!==!1&&(Xi(i,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function hp(t){return t instanceof B}function _b(t,e,n){var r;const{selection:o}=e;let i=null;if(ep(o)&&(i=o.$cursor),i){const l=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(c=>c.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=h&&p}return!c}),c})}var Hb=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:l}=i,a=Dt(t,r.schema);if(o)if(s){const c=ip(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),m=Math.min(h+f.nodeSize,d);f.marks.find(b=>b.type===a)?f.marks.forEach(b=>{a===b.type&&n.addMark(p,m,a.create({...b.attrs,...e}))}):n.addMark(p,m,a.create(e))})});return _b(r,n,a)},Fb=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),$b=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=me(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:l})=>Su(i,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Su(i,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Vb=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=bn(t,0,r.content.size),i=B.create(r,o);e.setSelection(i)}return!0},zb=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:i}=typeof t=="number"?{from:t,to:t}:t,s=V.atStart(r).from,l=V.atEnd(r).to,a=bn(o,s,l),c=bn(i,s,l),u=V.create(r,a,c);e.setSelection(u)}return!0},Ub=t=>({state:e,dispatch:n})=>{const r=me(t,e.schema);return z2(r)(e,n)};function cd(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}}var Wb=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=e,{$from:l,$to:a}=i,c=o.extensionManager.attributes,u=Po(c,l.node().type.name,l.node().attrs);if(i instanceof B&&i.node.isBlock)return!l.parentOffset||!Tt(s,l.pos)?!1:(r&&(t&&cd(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:wb(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Tt(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Tt(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(i instanceof V&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const m=e.mapping.map(l.before()),v=e.doc.resolve(m);l.node(-1).canReplaceWith(v.index(),v.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&cd(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return p},Kb=(t,e={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const l=me(t,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const d=a.node(-1);if(d.type!==l)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(o){let b=A.empty;const C=a.index(-1)?1:a.index(-2)?2:3;for(let M=a.depth-C;M>=a.depth-3;M-=1)b=A.from(a.node(M).copy(b));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,w={...Po(f,a.node().type.name,a.node().attrs),...e},E=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(w))||void 0;b=b.append(A.from(l.createAndFill(null,E)||void 0));const k=a.before(a.depth-(C-1));n.replace(k,a.after(-x),new D(b,4-C,0));let S=-1;n.doc.nodesBetween(k,n.doc.content.size,(M,N)=>{if(S>-1)return!1;M.isTextblock&&M.content.size===0&&(S=N+1)}),S>-1&&n.setSelection(V.near(n.doc.resolve(S))),n.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...Po(f,d.type.name,d.attrs),...e},m={...Po(f,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,c.pos);const v=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!Tt(n.doc,a.pos,2))return!1;if(o){const{selection:b,storedMarks:C}=r,{splittableMarks:x}=i.extensionManager,w=C||b.$to.parentOffset&&b.$from.marks();if(n.split(a.pos,2,v).scrollIntoView(),!w||!o)return!0;const E=w.filter(k=>x.includes(k.type.name));n.ensureMarks(E)}return!0},Hs=(t,e)=>{const n=Yi(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&un(t.doc,n.pos)&&t.join(n.pos),!0},Fs=(t,e)=>{const n=Yi(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&un(t.doc,r)&&t.join(r),!0},qb=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,h=me(t,s.schema),p=me(e,s.schema),{selection:m,storedMarks:v}=s,{$from:b,$to:C}=m,x=b.blockRange(C),w=v||m.$to.parentOffset&&m.$from.marks();if(!x)return!1;const E=Yi(k=>ad(k.type.name,d))(m);if(x.depth>=1&&E&&x.depth-E.depth<=1){if(E.node.type===h)return c.liftListItem(p);if(ad(E.node.type.name,d)&&h.validContent(E.node.content)&&l)return a().command(()=>(i.setNodeMarkup(E.pos,h),!0)).command(()=>Hs(i,h)).command(()=>Fs(i,h)).run()}return!n||!w||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Hs(i,h)).command(()=>Fs(i,h)).run():a().command(()=>{const k=u().wrapInList(h,r),S=w.filter(M=>f.includes(M.type.name));return i.ensureMarks(S),k?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Hs(i,h)).command(()=>Fs(i,h)).run()},Gb=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Dt(t,r.schema);return Bl(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},Jb=(t,e,n={})=>({state:r,commands:o})=>{const i=me(t,r.schema),s=me(e,r.schema),l=sn(r,i,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?o.setNode(s,a):o.setNode(i,{...a,...n})},Zb=(t,e={})=>({state:n,commands:r})=>{const o=me(t,n.schema);return sn(n,o,e)?r.lift(o):r.wrapIn(o,e)},Yb=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const s=t.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},Xb=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},Qb=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,a=Dt(t,r.schema),{$from:c,empty:u,ranges:d}=l;if(!o)return!0;if(u&&s){let{from:f,to:h}=l;const p=(i=c.marks().find(v=>v.type===a))==null?void 0:i.attrs,m=ja(c,a,p);m&&(f=m.from,h=m.to),n.removeMark(f,h,a)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,a)});return n.removeStoredMark(a),!0},eC=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=Zi(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(i=me(t,r.schema)),l==="mark"&&(s=Dt(t,r.schema)),o&&n.selection.ranges.forEach(a=>{const c=a.$from.pos,u=a.$to.pos;let d,f,h,p;n.selection.empty?r.doc.nodesBetween(c,u,(m,v)=>{i&&i===m.type&&(h=Math.max(v,c),p=Math.min(v+m.nodeSize,u),d=v,f=m)}):r.doc.nodesBetween(c,u,(m,v)=>{v<c&&i&&i===m.type&&(h=Math.max(v,c),p=Math.min(v+m.nodeSize,u),d=v,f=m),v>=c&&v<=u&&(i&&i===m.type&&n.setNodeMarkup(v,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(b=>{if(s===b.type){const C=Math.max(v,c),x=Math.min(v+m.nodeSize,u);n.addMark(C,x,s.create({...b.attrs,...e}))}}))}),f&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(m=>{s===m.type&&n.addMark(h,p,s.create({...m.attrs,...e}))}))}),!0):!1},tC=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return j2(o,e)(n,r)},nC=(t,e={})=>({state:n,dispatch:r})=>{const o=me(t,n.schema);return B2(o,e)(n,r)},rC=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Qr=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},oC=(t,e)=>{if(Pa(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function go(t){var e;const{editor:n,from:r,to:o,text:i,rules:s,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Db(c)+i;return s.forEach(f=>{if(u)return;const h=oC(d,f.find);if(!h)return;const p=a.state.tr,m=qi({state:a.state,transaction:p}),v={from:r-(h[0].length-i.length),to:o},{commands:b,chain:C,can:x}=new Gi({editor:n,state:m});f.handler({state:m,range:v,match:h,commands:b,chain:C,can:x})===null||!p.steps.length||(f.undoable&&p.setMeta(l,{transform:p,from:r,to:o,text:i}),a.dispatch(p),u=!0)}),u}function iC(t){const{editor:e,rules:n}=t,r=new ce({state:{init(){return null},apply(o,i,s){const l=o.getMeta(r);if(l)return l;const a=o.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=Ha(A.from(u),s.schema);const{from:d}=a,f=d+u.length;go({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,l){return go({editor:e,from:i,to:s,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:i}=o.state.selection;i&&go({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;const{$cursor:s}=o.state.selection;return s?go({editor:e,from:s.pos,to:s.pos,text:`
29
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function sC(t){return Object.prototype.toString.call(t).slice(8,-1)}function yo(t){return sC(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function pp(t,e){const n={...t};return yo(t)&&yo(e)&&Object.keys(e).forEach(r=>{yo(e[r])&&yo(t[r])?n[r]=pp(t[r],e[r]):n[r]=e[r]}),n}var za=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...X($(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...X($(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>pp(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},it=class mp extends za{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new mp(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const s=o.marks();if(!!!s.find(c=>c?.type.name===n.name))return!1;const a=s.find(c=>c?.type.name===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function lC(t){return typeof t=="number"}var aC=class{constructor(t){this.find=t.find,this.handler=t.handler}},cC=(t,e,n)=>{if(Pa(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const i=[o.text];return i.index=o.index,i.input=t,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function uC(t){const{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:a,chain:c,can:u}=new Gi({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(h,p)=>{var m,v,b,C,x;if((v=(m=h.type)==null?void 0:m.spec)!=null&&v.code||!(h.isText||h.isTextblock||h.isInline))return;const w=(x=(C=(b=h.content)==null?void 0:b.size)!=null?C:h.nodeSize)!=null?x:0,E=Math.max(r,p),k=Math.min(o,p+w);if(E>=k)return;const S=h.isText?h.text||"":h.textBetween(E-p,k-p,void 0,"");cC(S,i.find,s).forEach(N=>{if(N.index===void 0)return;const P=E+N.index+1,z=P+N[0].length,U={from:n.tr.mapping.map(P),to:n.tr.mapping.map(z)},H=i.handler({state:n,range:U,match:N,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(H)})}),d.every(h=>h!==null)}var vo=null,dC=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function fC(t){const{editor:e,rules:n}=t;let r=null,o=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,v=qi({state:u,transaction:m});if(!(!uC({editor:e,state:v,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new ce({view(d){const f=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(vo=e)},h=()=>{vo&&(vo=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,l=f,!i){const h=vo;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return s=f,o=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!o,v=p.getMeta("uiEvent")==="drop"&&!i,b=p.getMeta("applyPasteRules"),C=!!b;if(!m&&!v&&!C)return;if(C){let{text:E}=b;typeof E=="string"?E=E:E=Ha(A.from(E),h.schema);const{from:k}=b,S=k+E.length,M=dC(E);return a({rule:u,state:h,from:k,to:{b:S},pasteEvt:M})}const x=f.doc.content.findDiffStart(h.doc.content),w=f.doc.content.findDiffEnd(h.doc.content);if(!(!lC(x)||!w||x===w.b))return a({rule:u,state:h,from:x,to:w,pasteEvt:s})}}))}var Qi=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=cp(t),this.schema=Tb(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:_s(e.name,this.schema)},r=$(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Fa([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:_s(r.name,this.schema)},i=[],s=$(r,"addKeyboardShortcuts",o);let l={};if(r.type==="mark"&&$(r,"exitable",o)&&(l.ArrowRight=()=>it.handleExit({editor:t,mark:r})),s){const f=Object.fromEntries(Object.entries(s()).map(([h,p])=>[h,()=>p({editor:t})]));l={...l,...f}}const a=Nv(l);i.push(a);const c=$(r,"addInputRules",o);if(ld(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=iC({editor:t,rules:f}),p=Array.isArray(h)?h:[h];i.push(...p)}}const u=$(r,"addPasteRules",o);if(ld(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=fC({editor:t,rules:f});i.push(...h)}}const d=$(r,"addProseMirrorPlugins",o);if(d){const f=d();i.push(...f)}return i})}get attributes(){return ap(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Hr(this.extensions);return Object.fromEntries(e.filter(n=>!!$(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:me(n.name,this.schema)},i=$(n,"addNodeView",o);if(!i)return[];const s=(l,a,c,u,d)=>{const f=Fr(l,r);return i()({node:l,view:a,getPos:c,decorations:u,innerDecorations:d,editor:t,extension:n,HTMLAttributes:f})};return[n.name,s]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=Hr(this.extensions);return Object.fromEntries(e.filter(n=>!!$(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Dt(n.name,this.schema)},i=$(n,"addMarkView",o);if(!i)return[];const s=(l,a,c)=>{const u=Fr(l,r);return i()({mark:l,view:a,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{MC(l,t,d)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:_s(e.name,this.schema)};e.type==="mark"&&((n=X($(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=$(e,"onBeforeCreate",r),i=$(e,"onCreate",r),s=$(e,"onUpdate",r),l=$(e,"onSelectionUpdate",r),a=$(e,"onTransaction",r),c=$(e,"onFocus",r),u=$(e,"onBlur",r),d=$(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};Qi.resolve=cp;Qi.sort=Fa;Qi.flatten=_a;var hC={};Da(hC,{ClipboardTextSerializer:()=>yp,Commands:()=>vp,Delete:()=>bp,Drop:()=>Cp,Editable:()=>xp,FocusEvents:()=>Sp,Keymap:()=>kp,Paste:()=>Ep,Tabindex:()=>Mp,focusEventsPluginKey:()=>wp});var Q=class gp extends za{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new gp(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},yp=Q.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ce({key:new ye("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),a=dp(n);return up(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),vp=Q.create({name:"commands",addCommands(){return{...Xh}}}),bp=Q.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,o;const i=()=>{var s,l,a,c;if((c=(a=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,t))!=null?c:t.getMeta("y-sync$"))return;const u=Ba(t.before,[t,...e]);$a(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,m)=>{const v=m+p.nodeSize-2,b=h.oldRange.from<=m&&v<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:v,newFrom:u.mapping.map(m),newTo:u.mapping.map(v),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:t,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var m,v;if(h instanceof rt){const b=f.slice(p).map(h.from,-1),C=f.slice(p).map(h.to),x=f.invert().map(b,-1),w=f.invert().map(C),E=(m=u.doc.nodeAt(b-1))==null?void 0:m.marks.some(S=>S.eq(h.mark)),k=(v=u.doc.nodeAt(C))==null?void 0:v.marks.some(S=>S.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:x,to:w},newRange:{from:b,to:C},partial:!!(k||E),editor:this.editor,transaction:t,combinedTransform:u})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(i,0):i()}}),Cp=Q.create({name:"drop",addProseMirrorPlugins(){return[new ce({key:new ye("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),xp=Q.create({name:"editable",addProseMirrorPlugins(){return[new ce({key:new ye("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wp=new ye("focusEvents"),Sp=Q.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ce({key:wp,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),kp=Q.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,v=d.pos-d.parentOffset,b=m&&p.parent.childCount===1?v===d.pos:q.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ji()||op()?i:o},addProseMirrorPlugins(){return[new ce({key:new ye("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),o=t.some(m=>m.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:l}=e.selection,a=q.atStart(e.doc).from,c=q.atEnd(e.doc).to;if(i||!(s===a&&l===c)||!Xi(n.doc))return;const f=n.tr,h=qi({state:n,transaction:f}),{commands:p}=new Gi({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),Ep=Q.create({name:"paste",addProseMirrorPlugins(){return[new ce({key:new ye("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Mp=Q.create({name:"tabindex",addProseMirrorPlugins(){return[new ce({key:new ye("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),pC=class Kn{constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Kn(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Kn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Kn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+r+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!o&&l.depth<=this.depth)return;const a=new Kn(l,this.editor,o,o?n:null);o&&(a.actualDepth=this.depth+1),e.push(new Kn(l,this.editor,o,o?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const i=o.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const a=s[l];if(i[a]!==n[a])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const i=Object.keys(n);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===e&&i.every(a=>n[a]===s.node.attrs[a])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},mC=`.ProseMirror {
30
30
  position: relative;
31
31
  }
32
32
 
@@ -98,7 +98,7 @@ img.ProseMirror-separator {
98
98
  display: block;
99
99
  }`;function gC(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}var yC=class extends rC{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:o,moved:i})=>this.options.onDrop(r,o,i)),this.on("paste",({event:r,slice:o})=>this.options.onPaste(r,o)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=tp(e,this.options.autofocus);this.editorState=Jn.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=gC(mC,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=lp(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(o=>{const i=typeof o=="string"?`${o}$`:o.key;n=n.filter(s=>!s.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[xp,yp.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),vp,Sp,kp,Mp,Cp,Ep,bp].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new Qi(r,this)}createCommandManager(){this.commandManager=new Gi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=jl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=jl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){var e;this.editorView=new Zh(t,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.prependClass(),this.injectCSS();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),o=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!o)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const s=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=s?.getMeta("focus"),a=s?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:s}),a&&this.emit("blur",{editor:this,event:a.event,transaction:s}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return fp(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return Pb(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ha(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
100
100
 
101
- `,textSerializers:n={}}=t||{};return Rb(this.state.doc,{blockSeparator:e,textSerializers:{...dp(this.schema),...n}})}get isEmpty(){return Xi(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new pC(e,this)}get $doc(){return this.$pos(0)}};function On(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=X(t.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:i}=e,s=r[r.length-1],l=r[0];if(s){const a=l.search(/\S/),c=n.from+l.indexOf(s),u=c+s.length;if(Va(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+a,c);const f=n.from+a+s.length;i.addMark(n.from+a,f,t.type.create(o||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function vC(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=X(t.getAttributes,void 0,r)||{},{tr:i}=e,s=n.from;let l=n.to;const a=t.type.create(o);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=s+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,s+r[0].length-1),i.replaceWith(u,l,a)}else if(r[0]){const c=t.type.isInline?s:s-1;i.insert(c,t.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()},undoable:t.undoable})}function _l(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),i=X(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function he(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{let o=t.replace,i=n.from;const s=n.to;if(r[1]){const l=r[0].lastIndexOf(r[1]);o+=r[0].slice(l+r[1].length),i+=l;const a=i-s;a>0&&(o=r[0].slice(l-a,l)+o,i=s)}e.tr.insertText(o,i,s)},undoable:t.undoable})}function ir(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const i=X(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),c=a&&va(a,t.type,i);if(!c)return null;if(s.wrap(a,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(v=>h.includes(v.type.name));s.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(d,i).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&dn(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)},undoable:t.undoable})}function bC(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof B){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let o=r.depth;for(;o>=0;){const i=r.index(o);if(r.node(o).contentMatchAt(i).matchType(e))return!0;o-=1}return!1}var CC={};Da(CC,{createAtomBlockMarkdownSpec:()=>xC,createBlockMarkdownSpec:()=>wC,createInlineMarkdownSpec:()=>EC,parseAttributes:()=>Ua,parseIndentedBlocks:()=>Hl,renderNestedMarkdownContent:()=>Ka,serializeAttributes:()=>Wa});function Ua(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const c=o.map(u=>u.trim().slice(1));e.class=c.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[f];h&&(e[c]=h.slice(1,-1))});const a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Wa(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function xC(t){const{nodeName:e,name:n,parseAttributes:r=Ua,serializeAttributes:o=Wa,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=t,a=n||e,c=u=>{if(!l)return u;const d={};return l.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...i,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;const m=p[1]||"",v=r(m);if(!s.find(C=>!(C in v)))return{type:e,raw:p[0],attributes:v}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=o(d),h=f?` {${f}}`:"";return`:::${a}${h} :::`}}}function wC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=Ua,serializeAttributes:i=Wa,defaultAttributes:s={},content:l="block",allowedAttributes:a}=t,c=n||e,u=d=>{if(!a)return d;const f={};return a.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const m=r(d);h=typeof m=="string"?[{type:"text",text:m}]:m}else l==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...s,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=d.match(m);if(!v)return;const[b,C=""]=v,x=o(C);let w=1;const E=b.length;let k="";const S=/^:::([\w-]*)(\s.*)?/gm,M=d.slice(E);for(S.lastIndex=0;;){const N=S.exec(M);if(N===null)break;const P=N.index,z=N[1];if(!((p=N[2])!=null&&p.endsWith(":::"))){if(z)w+=1;else if(w-=1,w===0){const U=M.slice(0,P);k=U.trim();const H=d.slice(0,E+P+N[0].length);let I=[];if(k)if(l==="block")for(I=h.blockTokens(U),I.forEach(_=>{_.text&&(!_.tokens||_.tokens.length===0)&&(_.tokens=h.inlineTokens(_.text))});I.length>0;){const _=I[I.length-1];if(_.type==="paragraph"&&(!_.text||_.text.trim()===""))I.pop();else break}else I=h.inlineTokens(k);return{type:e,raw:H,attributes:x,content:k,tokens:I}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=i(h),m=p?` {${p}}`:"",v=f.renderChildren(d.content||[],`
101
+ `,textSerializers:n={}}=t||{};return Rb(this.state.doc,{blockSeparator:e,textSerializers:{...dp(this.schema),...n}})}get isEmpty(){return Xi(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new pC(e,this)}get $doc(){return this.$pos(0)}};function On(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=X(t.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:i}=e,s=r[r.length-1],l=r[0];if(s){const a=l.search(/\S/),c=n.from+l.indexOf(s),u=c+s.length;if(Va(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+a,c);const f=n.from+a+s.length;i.addMark(n.from+a,f,t.type.create(o||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function vC(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=X(t.getAttributes,void 0,r)||{},{tr:i}=e,s=n.from;let l=n.to;const a=t.type.create(o);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=s+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,s+r[0].length-1),i.replaceWith(u,l,a)}else if(r[0]){const c=t.type.isInline?s:s-1;i.insert(c,t.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()},undoable:t.undoable})}function _l(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),i=X(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function he(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r})=>{let o=t.replace,i=n.from;const s=n.to;if(r[1]){const l=r[0].lastIndexOf(r[1]);o+=r[0].slice(l+r[1].length),i+=l;const a=i-s;a>0&&(o=r[0].slice(l-a,l)+o,i=s)}e.tr.insertText(o,i,s)},undoable:t.undoable})}function ir(t){return new Qr({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const i=X(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),c=a&&va(a,t.type,i);if(!c)return null;if(s.wrap(a,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(v=>h.includes(v.type.name));s.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(d,i).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&un(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)},undoable:t.undoable})}function bC(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof B){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let o=r.depth;for(;o>=0;){const i=r.index(o);if(r.node(o).contentMatchAt(i).matchType(e))return!0;o-=1}return!1}var CC={};Da(CC,{createAtomBlockMarkdownSpec:()=>xC,createBlockMarkdownSpec:()=>wC,createInlineMarkdownSpec:()=>EC,parseAttributes:()=>Ua,parseIndentedBlocks:()=>Hl,renderNestedMarkdownContent:()=>Ka,serializeAttributes:()=>Wa});function Ua(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const c=o.map(u=>u.trim().slice(1));e.class=c.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[f];h&&(e[c]=h.slice(1,-1))});const a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Wa(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function xC(t){const{nodeName:e,name:n,parseAttributes:r=Ua,serializeAttributes:o=Wa,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=t,a=n||e,c=u=>{if(!l)return u;const d={};return l.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...i,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;const m=p[1]||"",v=r(m);if(!s.find(C=>!(C in v)))return{type:e,raw:p[0],attributes:v}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=o(d),h=f?` {${f}}`:"";return`:::${a}${h} :::`}}}function wC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=Ua,serializeAttributes:i=Wa,defaultAttributes:s={},content:l="block",allowedAttributes:a}=t,c=n||e,u=d=>{if(!a)return d;const f={};return a.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const m=r(d);h=typeof m=="string"?[{type:"text",text:m}]:m}else l==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...s,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=d.match(m);if(!v)return;const[b,C=""]=v,x=o(C);let w=1;const E=b.length;let k="";const S=/^:::([\w-]*)(\s.*)?/gm,M=d.slice(E);for(S.lastIndex=0;;){const N=S.exec(M);if(N===null)break;const P=N.index,z=N[1];if(!((p=N[2])!=null&&p.endsWith(":::"))){if(z)w+=1;else if(w-=1,w===0){const U=M.slice(0,P);k=U.trim();const H=d.slice(0,E+P+N[0].length);let I=[];if(k)if(l==="block")for(I=h.blockTokens(U),I.forEach(_=>{_.text&&(!_.tokens||_.tokens.length===0)&&(_.tokens=h.inlineTokens(_.text))});I.length>0;){const _=I[I.length-1];if(_.type==="paragraph"&&(!_.text||_.text.trim()===""))I.pop();else break}else I=h.inlineTokens(k);return{type:e,raw:H,attributes:x,content:k,tokens:I}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=i(h),m=p?` {${p}}`:"",v=f.renderChildren(d.content||[],`
102
102
 
103
103
  `);return`:::${c}${m}
104
104
 
@@ -112,7 +112,7 @@ ${v}
112
112
  `);E.trim()&&(e.customNestedParser?C=e.customNestedParser(E):C=n.blockTokens(E))}const w=e.createToken(p,C);a.push(w)}if(a.length!==0)return{items:a,raw:c.trim()}}function Ka(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const o=typeof n=="function"?n(r):n,[i,...s]=t.content,l=e.renderChildren([i]),a=[`${o}${l}`];return s&&s.length>0&&s.forEach(c=>{const u=e.renderChildren([c]);if(u){const d=u.split(`
113
113
  `).map(f=>f?e.indent(f):"").join(`
114
114
  `);a.push(d)}}),a.join(`
115
- `)}function MC(t,e,n={}){const{state:r}=e,{doc:o,tr:i}=r,s=t;o.descendants((l,a)=>{const c=i.mapping.map(a),u=i.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(h=>{if(h!==s)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});i.removeMark(c,u,t.type),i.addMark(c,u,h)}}),i.docChanged&&e.view.dispatch(i)}var je=class Tp extends za{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new Tp(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},TC=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,o,i,s,l;const{view:a}=this.editor,c=t.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!u)return;let d=0,f=0;if(this.dom!==u){const C=this.dom.getBoundingClientRect(),x=u.getBoundingClientRect(),w=(o=t.offsetX)!=null?o:(r=t.nativeEvent)==null?void 0:r.offsetX,E=(s=t.offsetY)!=null?s:(i=t.nativeEvent)==null?void 0:i.offsetY;d=x.x-C.x+w,f=x.y-C.y+E}const h=this.dom.cloneNode(!0);try{const C=this.dom.getBoundingClientRect();h.style.width=`${Math.round(C.width)}px`,h.style.height=`${Math.round(C.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(h),document.body.appendChild(p),(l=t.dataTransfer)==null||l.setDragImage(h,d,f)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const m=this.getPos();if(typeof m!="number")return;const v=B.create(a.state.doc,m),b=a.state.tr.setSelection(v);a.dispatch(b)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const o=t.type.startsWith("drag"),i=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!o)return!0;const{isEditable:l}=this.editor,{isDragging:a}=this,c=!!this.node.type.spec.draggable,u=B.isSelectable(this.node),d=t.type==="copy",f=t.type==="paste",h=t.type==="cut",p=t.type==="mousedown";if(!c&&u&&o&&t.target===this.dom&&t.preventDefault(),c&&o&&!a&&t.target===this.dom)return t.preventDefault(),!1;if(c&&l&&!a&&p){const m=n.closest("[data-drag-handle]");m&&(this.dom===m||this.dom.contains(m))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||i||d||f||h||p&&u)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(Ji()||np())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function an(t){return new aC({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const i=X(t.getAttributes,void 0,r,o);if(i===!1||i===null)return null;const{tr:s}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const u=a.search(/\S/),d=n.from+a.indexOf(l),f=d+l.length;if(Va(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(v=>v===t.type&&v!==p.mark.type)).filter(p=>p.to>d).length)return null;f<n.to&&s.delete(f,n.to),d>n.from&&s.delete(n.from+u,d),c=n.from+u+l.length,s.addMark(n.from+u,c,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}var $s,ud;function AC(){return ud||(ud=1,$s=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;for(o of e.entries())if(!t(o[1],n.get(o[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(e[o]!==n[o])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var s=i[o];if(!(s==="_owner"&&e.$$typeof)&&!t(e[s],n[s]))return!1}return!0}return e!==e&&n!==n}),$s}var RC=AC();const OC=Sf(RC);var bo={exports:{}},Vs={};/**
115
+ `)}function MC(t,e,n={}){const{state:r}=e,{doc:o,tr:i}=r,s=t;o.descendants((l,a)=>{const c=i.mapping.map(a),u=i.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(h=>{if(h!==s)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});i.removeMark(c,u,t.type),i.addMark(c,u,h)}}),i.docChanged&&e.view.dispatch(i)}var je=class Tp extends za{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new Tp(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},TC=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,o,i,s,l;const{view:a}=this.editor,c=t.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!u)return;let d=0,f=0;if(this.dom!==u){const C=this.dom.getBoundingClientRect(),x=u.getBoundingClientRect(),w=(o=t.offsetX)!=null?o:(r=t.nativeEvent)==null?void 0:r.offsetX,E=(s=t.offsetY)!=null?s:(i=t.nativeEvent)==null?void 0:i.offsetY;d=x.x-C.x+w,f=x.y-C.y+E}const h=this.dom.cloneNode(!0);try{const C=this.dom.getBoundingClientRect();h.style.width=`${Math.round(C.width)}px`,h.style.height=`${Math.round(C.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(h),document.body.appendChild(p),(l=t.dataTransfer)==null||l.setDragImage(h,d,f)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const m=this.getPos();if(typeof m!="number")return;const v=B.create(a.state.doc,m),b=a.state.tr.setSelection(v);a.dispatch(b)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const o=t.type.startsWith("drag"),i=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!o)return!0;const{isEditable:l}=this.editor,{isDragging:a}=this,c=!!this.node.type.spec.draggable,u=B.isSelectable(this.node),d=t.type==="copy",f=t.type==="paste",h=t.type==="cut",p=t.type==="mousedown";if(!c&&u&&o&&t.target===this.dom&&t.preventDefault(),c&&o&&!a&&t.target===this.dom)return t.preventDefault(),!1;if(c&&l&&!a&&p){const m=n.closest("[data-drag-handle]");m&&(this.dom===m||this.dom.contains(m))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||i||d||f||h||p&&u)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(Ji()||np())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function ln(t){return new aC({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const i=X(t.getAttributes,void 0,r,o);if(i===!1||i===null)return null;const{tr:s}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const u=a.search(/\S/),d=n.from+a.indexOf(l),f=d+l.length;if(Va(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(v=>v===t.type&&v!==p.mark.type)).filter(p=>p.to>d).length)return null;f<n.to&&s.delete(f,n.to),d>n.from&&s.delete(n.from+u,d),c=n.from+u+l.length,s.addMark(n.from+u,c,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}var $s,ud;function AC(){return ud||(ud=1,$s=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;for(o of e.entries())if(!t(o[1],n.get(o[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(e[o]!==n[o])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var s=i[o];if(!(s==="_owner"&&e.$$typeof)&&!t(e[s],n[s]))return!1}return!0}return e!==e&&n!==n}),$s}var RC=AC();const OC=Sf(RC);var bo={exports:{}},Vs={};/**
116
116
  * @license React
117
117
  * use-sync-external-store-shim/with-selector.production.js
118
118
  *
@@ -131,7 +131,7 @@ ${v}
131
131
  */var fd;function IC(){return fd||(fd=1,process.env.NODE_ENV!=="production"&&(function(){function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=j,n=ma(),r=typeof Object.is=="function"?Object.is:t,o=n.useSyncExternalStore,i=e.useRef,s=e.useEffect,l=e.useMemo,a=e.useDebugValue;zs.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=i(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=l(function(){function b(k){if(!C){if(C=!0,x=k,k=f(k),h!==void 0&&m.hasValue){var S=m.value;if(h(S,k))return w=S}return w=k}if(S=w,r(x,k))return S;var M=f(k);return h!==void 0&&h(S,M)?(x=k,S):(x=k,w=M)}var C=!1,x,w,E=d===void 0?null:d;return[function(){return b(u())},E===null?void 0:function(){return b(E())}]},[u,d,f,h]);var v=o(c,p[0],p[1]);return s(function(){m.hasValue=!0,m.value=v},[v]),a(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),zs}var hd;function LC(){return hd||(hd=1,process.env.NODE_ENV==="production"?bo.exports=NC():bo.exports=IC()),bo.exports}var DC=LC(),PC=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},jC=({contentComponent:t})=>{const e=kf.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return g.jsx(g.Fragment,{children:Object.values(e)})};function BC(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Hi.createPortal(r.reactElement,r.element,n)},t.forEach(o=>o())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(o=>o())}}}var _C=class extends j.Component{constructor(t){var e;super(t),this.editorContentRef=j.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(t.view.dom),t.setOptions({element:e}),t.contentComponent=BC(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.firstChild))return;const n=document.createElement("div");n.append(e.view.dom),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return g.jsxs(g.Fragment,{children:[g.jsx("div",{ref:PC(e,this.editorContentRef),...n}),t?.contentComponent&&g.jsx(jC,{contentComponent:t.contentComponent})]})}},HC=j.forwardRef((t,e)=>{const n=j.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return j.createElement(_C,{key:n,innerRef:e,...t})}),FC=j.memo(HC),$C=typeof window<"u"?j.useLayoutEffect:j.useEffect,VC=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function Ap(t){var e;const[n]=j.useState(()=>new VC(t.editor)),r=DC.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:OC);return $C(()=>n.watch(t.editor),[t.editor,n]),j.useDebugValue(r),r}var pd=process.env.NODE_ENV!=="production",Fl=typeof window>"u",zC=Fl||!!(typeof window<"u"&&window.next),UC=class Rp{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0){if(Fl||zC){if(pd)throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&Fl&&pd)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var o,i;return(i=(o=this.options.current).onBeforeCreate)==null?void 0:i.call(o,...r)},onBlur:(...r)=>{var o,i;return(i=(o=this.options.current).onBlur)==null?void 0:i.call(o,...r)},onCreate:(...r)=>{var o,i;return(i=(o=this.options.current).onCreate)==null?void 0:i.call(o,...r)},onDestroy:(...r)=>{var o,i;return(i=(o=this.options.current).onDestroy)==null?void 0:i.call(o,...r)},onFocus:(...r)=>{var o,i;return(i=(o=this.options.current).onFocus)==null?void 0:i.call(o,...r)},onSelectionUpdate:(...r)=>{var o,i;return(i=(o=this.options.current).onSelectionUpdate)==null?void 0:i.call(o,...r)},onTransaction:(...r)=>{var o,i;return(i=(o=this.options.current).onTransaction)==null?void 0:i.call(o,...r)},onUpdate:(...r)=>{var o,i;return(i=(o=this.options.current).onUpdate)==null?void 0:i.call(o,...r)},onContentError:(...r)=>{var o,i;return(i=(o=this.options.current).onContentError)==null?void 0:i.call(o,...r)},onDrop:(...r)=>{var o,i;return(i=(o=this.options.current).onDrop)==null?void 0:i.call(o,...r)},onPaste:(...r)=>{var o,i;return(i=(o=this.options.current).onPaste)==null?void 0:i.call(o,...r)},onDelete:(...r)=>{var o,i;return(i=(o=this.options.current).onDelete)==null?void 0:i.call(o,...r)}};return new yC(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((o,i)=>{var s;return o===((s=n.extensions)==null?void 0:s[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Rp.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,o)=>r===e[o]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function WC(t={},e=[]){const n=j.useRef(t);n.current=t;const[r]=j.useState(()=>new UC(n)),o=kf.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return j.useDebugValue(o),j.useEffect(r.onRender(e)),Ap({editor:o,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),o}var qa=j.createContext({editor:null});qa.Consumer;var KC=()=>j.useContext(qa),Op=j.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),qC=()=>j.useContext(Op),Np=j.forwardRef((t,e)=>{const{onDragStart:n}=qC(),r=t.as||"div";return g.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function md(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function gd(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function GC(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function JC(t){if(md(t)||gd(t))return!0;if(GC(t)){const e=t.type;if(e)return md(e)||gd(e)}return!1}function ZC(){try{if(j.version)return parseInt(j.version.split(".")[0],10)>=19}catch{}return!1}var YC=class{constructor(t,{editor:e,props:n={},as:r="div",className:o=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?Hi.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var t;const e=this.component,n=this.props,r=this.editor,o=ZC(),i=JC(e),s={...n};s.ref&&!(o||i)&&delete s.ref,!s.ref&&(o||i)&&(s.ref=l=>{this.ref=l}),this.reactElement=g.jsx(e,{...s}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.props={...this.props,...t},this.render()}destroy(){var t;const e=this.editor;(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};j.createContext({markViewContentRef:()=>{}});var XC=class extends TC{constructor(t,e,n){if(super(t,e,n),!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(a={})=>this.updateAttributes(a),deleteNode:()=>this.deleteNode(),ref:j.createRef()};if(!this.component.displayName){const a=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=a(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:a=>{a&&this.contentDOMElement&&a.firstChild!==this.contentDOMElement&&(a.hasAttribute("data-node-view-wrapper")&&a.removeAttribute("data-node-view-wrapper"),a.appendChild(this.contentDOMElement))}},o=this.component,i=j.memo(a=>g.jsx(Op.Provider,{value:r,children:j.createElement(o,a)}));i.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:l=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new YC(i,{editor:this.editor,props:t,as:s,className:`node-${this.node.type.name} ${l}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(t,e,n){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,i=this.decorations,s=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:o,oldDecorations:i,newNode:t,newDecorations:e,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=Fr(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function Ip(t,e){return n=>n.editor.contentComponent?new XC(t,n,e):{}}const xe=[];for(let t=0;t<256;++t)xe.push((t+256).toString(16).slice(1));function QC(t,e=0){return(xe[t[e+0]]+xe[t[e+1]]+xe[t[e+2]]+xe[t[e+3]]+"-"+xe[t[e+4]]+xe[t[e+5]]+"-"+xe[t[e+6]]+xe[t[e+7]]+"-"+xe[t[e+8]]+xe[t[e+9]]+"-"+xe[t[e+10]]+xe[t[e+11]]+xe[t[e+12]]+xe[t[e+13]]+xe[t[e+14]]+xe[t[e+15]]).toLowerCase()}let Us;const ex=new Uint8Array(16);function tx(){if(!Us){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Us=crypto.getRandomValues.bind(crypto)}return Us(ex)}const nx=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),yd={randomUUID:nx};function rx(t,e,n){t=t||{};const r=t.random??t.rng?.()??tx();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,QC(r)}function ox(t,e,n){return yd.randomUUID&&!t?yd.randomUUID():rx(t)}var ti=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},ix=/^\s*>\s$/,sx=je.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return ti("blockquote",{...re(this.options.HTMLAttributes,t),children:ti("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=[];return t.content.forEach(o=>{const s=e.renderChildren(o).split(`
132
132
  `).map(l=>`> ${l}`).join(`
133
133
  `);n.push(s)}),n.flatMap(o=>[o,"> "]).slice(0,-1).join(`
134
- `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[ir({find:ix,type:this.type})]}}),lx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ax=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,cx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,ux=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,dx=it.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return ti("strong",{...re(this.options.HTMLAttributes,t),children:ti("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[On({find:lx,type:this.type}),On({find:cx,type:this.type})]},addPasteRules(){return[an({find:ax,type:this.type}),an({find:ux,type:this.type})]}}),fx=/(^|[^`])`([^`]+)`(?!`)$/,hx=/(^|[^`])`([^`]+)`(?!`)/g,px=it.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[On({find:fx,type:this.type})]},addPasteRules(){return[an({find:hx,type:this.type})]}}),Ws=4,mx=/^```([a-z]+)?[\s\n]$/,gx=/^~~~([a-z]+)?[\s\n]$/,yx=je.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Ws,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",re(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const o=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${o}`,e.renderChildren(t.content),"```"].join(`
134
+ `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[ir({find:ix,type:this.type})]}}),lx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ax=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,cx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,ux=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,dx=it.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return ti("strong",{...re(this.options.HTMLAttributes,t),children:ti("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[On({find:lx,type:this.type}),On({find:cx,type:this.type})]},addPasteRules(){return[ln({find:ax,type:this.type}),ln({find:ux,type:this.type})]}}),fx=/(^|[^`])`([^`]+)`(?!`)$/,hx=/(^|[^`])`([^`]+)`(?!`)/g,px=it.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[On({find:fx,type:this.type})]},addPasteRules(){return[ln({find:hx,type:this.type})]}}),Ws=4,mx=/^```([a-z]+)?[\s\n]$/,gx=/^~~~([a-z]+)?[\s\n]$/,yx=je.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Ws,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",re(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const o=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${o}`,e.renderChildren(t.content),"```"].join(`
135
135
  `):r=`\`\`\`${o}
136
136
 
137
137
  \`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Ws,{state:r}=t,{selection:o}=r,{$from:i,empty:s}=o;if(i.parent.type!==this.type)return!1;const l=" ".repeat(n);return s?t.commands.insertContent(l):t.commands.command(({tr:a})=>{const{from:c,to:u}=o,h=r.doc.textBetween(c,u,`
@@ -152,12 +152,12 @@ ${v}
152
152
 
153
153
  `):""}),bx=je.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",re(this.options.HTMLAttributes,t)]},renderText(){return`
154
154
  `},renderMarkdown:(t,e)=>e.indent(`
155
- `),parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:i}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&s){const d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Cx=je.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,re(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,o="#".repeat(r);return t.content?`${o} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>_l({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),Lp=je.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",re(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!bC(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,o=t();return hp(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:i,tr:s,dispatch:l})=>{if(l){const{$to:a}=s.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(V.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection(B.create(s.doc,a.pos)):s.setSelection(V.create(s.doc,a.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u?.create();d&&(s.insert(c,d),s.setSelection(V.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[vC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),xx=Lp,wx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Sx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,kx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ex=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Mx=it.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",re(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[On({find:wx,type:this.type}),On({find:kx,type:this.type})]},addPasteRules(){return[an({find:Sx,type:this.type}),an({find:Ex,type:this.type})]}});const Tx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Ax="ελ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",$l="numeric",Vl="ascii",zl="alpha",Er="asciinumeric",br="alphanumeric",Ul="domain",Dp="emoji",Rx="scheme",Ox="slashscheme",Ks="whitespace";function Nx(t,e){return t in e||(e[t]=[]),e[t]}function Cn(t,e,n){e[$l]&&(e[Er]=!0,e[br]=!0),e[Vl]&&(e[Er]=!0,e[zl]=!0),e[Er]&&(e[br]=!0),e[zl]&&(e[br]=!0),e[br]&&(e[Ul]=!0),e[Dp]&&(e[Ul]=!0);for(const r in e){const o=Nx(r,n);o.indexOf(t)<0&&o.push(t)}}function Ix(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function _e(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}_e.groups={};_e.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],i=e.jr[r][1];if(i&&o.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||_e.groups;let o;return e&&e.j?o=e:(o=new _e(e),n&&r&&Cn(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const i=t.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(t[s]);return o.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||_e.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const i=e;let s,l=o.go(t);if(l?(s=new _e,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new _e,i){if(r)if(s.t&&typeof s.t=="string"){const a=Object.assign(Ix(s.t,r),n);Cn(i,a,r)}else n&&Cn(i,n,r);s.t=i}return o.j[t]=s,s}};const G=(t,e,n,r,o)=>t.ta(e,n,r,o),ue=(t,e,n,r,o)=>t.tr(e,n,r,o),vd=(t,e,n,r,o)=>t.ts(e,n,r,o),O=(t,e,n,r,o)=>t.tt(e,n,r,o),St="WORD",Wl="UWORD",Pp="ASCIINUMERICAL",jp="ALPHANUMERICAL",$r="LOCALHOST",Kl="TLD",ql="UTLD",jo="SCHEME",qn="SLASH_SCHEME",Ga="NUM",Gl="WS",Ja="NL",Mr="OPENBRACE",Tr="CLOSEBRACE",ni="OPENBRACKET",ri="CLOSEBRACKET",oi="OPENPAREN",ii="CLOSEPAREN",si="OPENANGLEBRACKET",li="CLOSEANGLEBRACKET",ai="FULLWIDTHLEFTPAREN",ci="FULLWIDTHRIGHTPAREN",ui="LEFTCORNERBRACKET",di="RIGHTCORNERBRACKET",fi="LEFTWHITECORNERBRACKET",hi="RIGHTWHITECORNERBRACKET",pi="FULLWIDTHLESSTHAN",mi="FULLWIDTHGREATERTHAN",gi="AMPERSAND",yi="APOSTROPHE",vi="ASTERISK",Wt="AT",bi="BACKSLASH",Ci="BACKTICK",xi="CARET",Gt="COLON",Za="COMMA",wi="DOLLAR",st="DOT",Si="EQUALS",Ya="EXCLAMATION",Je="HYPHEN",Ar="PERCENT",ki="PIPE",Ei="PLUS",Mi="POUND",Rr="QUERY",Xa="QUOTE",Bp="FULLWIDTHMIDDLEDOT",Qa="SEMI",lt="SLASH",Or="TILDE",Ti="UNDERSCORE",_p="EMOJI",Ai="SYM";var Hp=Object.freeze({__proto__:null,ALPHANUMERICAL:jp,AMPERSAND:gi,APOSTROPHE:yi,ASCIINUMERICAL:Pp,ASTERISK:vi,AT:Wt,BACKSLASH:bi,BACKTICK:Ci,CARET:xi,CLOSEANGLEBRACKET:li,CLOSEBRACE:Tr,CLOSEBRACKET:ri,CLOSEPAREN:ii,COLON:Gt,COMMA:Za,DOLLAR:wi,DOT:st,EMOJI:_p,EQUALS:Si,EXCLAMATION:Ya,FULLWIDTHGREATERTHAN:mi,FULLWIDTHLEFTPAREN:ai,FULLWIDTHLESSTHAN:pi,FULLWIDTHMIDDLEDOT:Bp,FULLWIDTHRIGHTPAREN:ci,HYPHEN:Je,LEFTCORNERBRACKET:ui,LEFTWHITECORNERBRACKET:fi,LOCALHOST:$r,NL:Ja,NUM:Ga,OPENANGLEBRACKET:si,OPENBRACE:Mr,OPENBRACKET:ni,OPENPAREN:oi,PERCENT:Ar,PIPE:ki,PLUS:Ei,POUND:Mi,QUERY:Rr,QUOTE:Xa,RIGHTCORNERBRACKET:di,RIGHTWHITECORNERBRACKET:hi,SCHEME:jo,SEMI:Qa,SLASH:lt,SLASH_SCHEME:qn,SYM:Ai,TILDE:Or,TLD:Kl,UNDERSCORE:Ti,UTLD:ql,UWORD:Wl,WORD:St,WS:Gl});const xt=/[a-z]/,mr=new RegExp("\\p{L}","u"),qs=new RegExp("\\p{Emoji}","u"),wt=/\d/,Gs=/\s/,bd="\r",Js=`
156
- `,Lx="️",Dx="‍",Zs="";let Co=null,xo=null;function Px(t=[]){const e={};_e.groups=e;const n=new _e;Co==null&&(Co=Cd(Tx)),xo==null&&(xo=Cd(Ax)),O(n,"'",yi),O(n,"{",Mr),O(n,"}",Tr),O(n,"[",ni),O(n,"]",ri),O(n,"(",oi),O(n,")",ii),O(n,"<",si),O(n,">",li),O(n,"(",ai),O(n,")",ci),O(n,"「",ui),O(n,"」",di),O(n,"『",fi),O(n,"』",hi),O(n,"<",pi),O(n,">",mi),O(n,"&",gi),O(n,"*",vi),O(n,"@",Wt),O(n,"`",Ci),O(n,"^",xi),O(n,":",Gt),O(n,",",Za),O(n,"$",wi),O(n,".",st),O(n,"=",Si),O(n,"!",Ya),O(n,"-",Je),O(n,"%",Ar),O(n,"|",ki),O(n,"+",Ei),O(n,"#",Mi),O(n,"?",Rr),O(n,'"',Xa),O(n,"/",lt),O(n,";",Qa),O(n,"~",Or),O(n,"_",Ti),O(n,"\\",bi),O(n,"・",Bp);const r=ue(n,wt,Ga,{[$l]:!0});ue(r,wt,r);const o=ue(r,xt,Pp,{[Er]:!0}),i=ue(r,mr,jp,{[br]:!0}),s=ue(n,xt,St,{[Vl]:!0});ue(s,wt,o),ue(s,xt,s),ue(o,wt,o),ue(o,xt,o);const l=ue(n,mr,Wl,{[zl]:!0});ue(l,xt),ue(l,wt,i),ue(l,mr,l),ue(i,wt,i),ue(i,xt),ue(i,mr,i);const a=O(n,Js,Ja,{[Ks]:!0}),c=O(n,bd,Gl,{[Ks]:!0}),u=ue(n,Gs,Gl,{[Ks]:!0});O(n,Zs,u),O(c,Js,a),O(c,Zs,u),ue(c,Gs,u),O(u,bd),O(u,Js),ue(u,Gs,u),O(u,Zs,u);const d=ue(n,qs,_p,{[Dp]:!0});O(d,"#"),ue(d,qs,d),O(d,Lx,d);const f=O(d,Dx);O(f,"#"),ue(f,qs,d);const h=[[xt,s],[wt,o]],p=[[xt,null],[mr,l],[wt,i]];for(let m=0;m<Co.length;m++)Ft(n,Co[m],Kl,St,h);for(let m=0;m<xo.length;m++)Ft(n,xo[m],ql,Wl,p);Cn(Kl,{tld:!0,ascii:!0},e),Cn(ql,{utld:!0,alpha:!0},e),Ft(n,"file",jo,St,h),Ft(n,"mailto",jo,St,h),Ft(n,"http",qn,St,h),Ft(n,"https",qn,St,h),Ft(n,"ftp",qn,St,h),Ft(n,"ftps",qn,St,h),Cn(jo,{scheme:!0,ascii:!0},e),Cn(qn,{slashscheme:!0,ascii:!0},e),t=t.sort((m,v)=>m[0]>v[0]?1:-1);for(let m=0;m<t.length;m++){const v=t[m][0],C=t[m][1]?{[Rx]:!0}:{[Ox]:!0};v.indexOf("-")>=0?C[Ul]=!0:xt.test(v)?wt.test(v)?C[Er]=!0:C[Vl]=!0:C[$l]=!0,vd(n,v,v,C)}return vd(n,"localhost",$r,{ascii:!0}),n.jd=new _e(Ai),{start:n,tokens:Object.assign({groups:e},Hp)}}function Fp(t,e){const n=jx(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let l=t,a=null,c=0,u=null,d=-1,f=-1;for(;s<r&&(a=l.go(n[s]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=n[s].length,f++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=f,c-=d,o.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}function jx(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Ft(t,e,n,r,o){let i;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];t.j[a]?i=t.j[a]:(i=new _e(r),i.jr=o.slice(),t.j[a]=i),t=i}return i=new _e(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function Cd(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}const Vr={defaultProtocol:"http",events:null,format:xd,formatHref:xd,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ec(t,e=null){let n=Object.assign({},Vr);t&&(n=Object.assign(n,t instanceof ec?t.o:t));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}ec.prototype={o:Vr,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:Vr[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function xd(t){return t}function $p(t,e){this.t="token",this.v=t,this.tk=e}$p.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Vr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};function es(t,e){class n extends $p{constructor(o,i){super(o,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const wd=es("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Sd=es("text"),Bx=es("nl"),wo=es("url",{isLink:!0,toHref(t=Vr.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==$r&&t[1].t===Gt}}),qe=t=>new _e(t);function _x({groups:t}){const e=t.domain.concat([gi,vi,Wt,bi,Ci,xi,wi,Si,Je,Ga,Ar,ki,Ei,Mi,lt,Ai,Or,Ti]),n=[yi,Gt,Za,st,Ya,Ar,Rr,Xa,Qa,si,li,Mr,Tr,ri,ni,oi,ii,ai,ci,ui,di,fi,hi,pi,mi],r=[gi,yi,vi,bi,Ci,xi,wi,Si,Je,Mr,Tr,Ar,ki,Ei,Mi,Rr,lt,Ai,Or,Ti],o=qe(),i=O(o,Or);G(i,r,i),G(i,t.domain,i);const s=qe(),l=qe(),a=qe();G(o,t.domain,s),G(o,t.scheme,l),G(o,t.slashscheme,a),G(s,r,i),G(s,t.domain,s);const c=O(s,Wt);O(i,Wt,c),O(l,Wt,c),O(a,Wt,c);const u=O(i,st);G(u,r,i),G(u,t.domain,i);const d=qe();G(c,t.domain,d),G(d,t.domain,d);const f=O(d,st);G(f,t.domain,d);const h=qe(wd);G(f,t.tld,h),G(f,t.utld,h),O(c,$r,h);const p=O(d,Je);O(p,Je,p),G(p,t.domain,d),G(h,t.domain,d),O(h,st,f),O(h,Je,p);const m=O(h,Gt);G(m,t.numeric,wd);const v=O(s,Je),b=O(s,st);O(v,Je,v),G(v,t.domain,s),G(b,r,i),G(b,t.domain,s);const C=qe(wo);G(b,t.tld,C),G(b,t.utld,C),G(C,t.domain,s),G(C,r,i),O(C,st,b),O(C,Je,v),O(C,Wt,c);const x=O(C,Gt),w=qe(wo);G(x,t.numeric,w);const E=qe(wo),k=qe();G(E,e,E),G(E,n,k),G(k,e,E),G(k,n,k),O(C,lt,E),O(w,lt,E);const S=O(l,Gt),M=O(a,Gt),N=O(M,lt),P=O(N,lt);G(l,t.domain,s),O(l,st,b),O(l,Je,v),G(a,t.domain,s),O(a,st,b),O(a,Je,v),G(S,t.domain,E),O(S,lt,E),O(S,Rr,E),G(P,t.domain,E),G(P,e,E),O(P,lt,E);const z=[[Mr,Tr],[ni,ri],[oi,ii],[si,li],[ai,ci],[ui,di],[fi,hi],[pi,mi]];for(let U=0;U<z.length;U++){const[H,I]=z[U],_=O(E,H);O(k,H,_),O(_,I,E);const F=qe(wo);G(_,e,F);const L=qe();G(_,n),G(F,e,F),G(F,n,L),G(L,e,F),G(L,n,L),O(F,I,E),O(L,I,E)}return O(o,$r,C),O(o,Ja,Bx),{start:o,tokens:Hp}}function Hx(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let l=t,a=null,c=null,u=0,d=null,f=-1;for(;o<r&&!(a=l.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=a||l.go(n[o].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(Ys(Sd,e,s)),s=[]),o-=f,u-=f;const h=d.t,p=n.slice(o-u,o);i.push(Ys(h,e,p))}}return s.length>0&&i.push(Ys(Sd,e,s)),i}function Ys(t,e,n){const r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}const Fx=typeof console<"u"&&console&&console.warn||(()=>{}),$x="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",se={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Vx(){return _e.groups={},se.scanner=null,se.parser=null,se.tokenQueue=[],se.pluginQueue=[],se.customSchemes=[],se.initialized=!1,se}function kd(t,e=!1){if(se.initialized&&Fx(`linkifyjs: already initialized - will not register custom scheme "${t}" ${$x}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
155
+ `),parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:i}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&s){const d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Cx=je.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,re(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,o="#".repeat(r);return t.content?`${o} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>_l({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),Lp=je.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",re(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!bC(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,o=t();return hp(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:i,tr:s,dispatch:l})=>{if(l){const{$to:a}=s.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(V.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection(B.create(s.doc,a.pos)):s.setSelection(V.create(s.doc,a.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u?.create();d&&(s.insert(c,d),s.setSelection(V.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[vC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),xx=Lp,wx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Sx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,kx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ex=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Mx=it.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",re(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[On({find:wx,type:this.type}),On({find:kx,type:this.type})]},addPasteRules(){return[ln({find:Sx,type:this.type}),ln({find:Ex,type:this.type})]}});const Tx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Ax="ελ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",$l="numeric",Vl="ascii",zl="alpha",Er="asciinumeric",br="alphanumeric",Ul="domain",Dp="emoji",Rx="scheme",Ox="slashscheme",Ks="whitespace";function Nx(t,e){return t in e||(e[t]=[]),e[t]}function Cn(t,e,n){e[$l]&&(e[Er]=!0,e[br]=!0),e[Vl]&&(e[Er]=!0,e[zl]=!0),e[Er]&&(e[br]=!0),e[zl]&&(e[br]=!0),e[br]&&(e[Ul]=!0),e[Dp]&&(e[Ul]=!0);for(const r in e){const o=Nx(r,n);o.indexOf(t)<0&&o.push(t)}}function Ix(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function _e(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}_e.groups={};_e.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],i=e.jr[r][1];if(i&&o.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||_e.groups;let o;return e&&e.j?o=e:(o=new _e(e),n&&r&&Cn(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const i=t.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(t[s]);return o.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||_e.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const i=e;let s,l=o.go(t);if(l?(s=new _e,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new _e,i){if(r)if(s.t&&typeof s.t=="string"){const a=Object.assign(Ix(s.t,r),n);Cn(i,a,r)}else n&&Cn(i,n,r);s.t=i}return o.j[t]=s,s}};const G=(t,e,n,r,o)=>t.ta(e,n,r,o),ue=(t,e,n,r,o)=>t.tr(e,n,r,o),vd=(t,e,n,r,o)=>t.ts(e,n,r,o),O=(t,e,n,r,o)=>t.tt(e,n,r,o),St="WORD",Wl="UWORD",Pp="ASCIINUMERICAL",jp="ALPHANUMERICAL",$r="LOCALHOST",Kl="TLD",ql="UTLD",jo="SCHEME",qn="SLASH_SCHEME",Ga="NUM",Gl="WS",Ja="NL",Mr="OPENBRACE",Tr="CLOSEBRACE",ni="OPENBRACKET",ri="CLOSEBRACKET",oi="OPENPAREN",ii="CLOSEPAREN",si="OPENANGLEBRACKET",li="CLOSEANGLEBRACKET",ai="FULLWIDTHLEFTPAREN",ci="FULLWIDTHRIGHTPAREN",ui="LEFTCORNERBRACKET",di="RIGHTCORNERBRACKET",fi="LEFTWHITECORNERBRACKET",hi="RIGHTWHITECORNERBRACKET",pi="FULLWIDTHLESSTHAN",mi="FULLWIDTHGREATERTHAN",gi="AMPERSAND",yi="APOSTROPHE",vi="ASTERISK",Vt="AT",bi="BACKSLASH",Ci="BACKTICK",xi="CARET",Wt="COLON",Za="COMMA",wi="DOLLAR",st="DOT",Si="EQUALS",Ya="EXCLAMATION",Je="HYPHEN",Ar="PERCENT",ki="PIPE",Ei="PLUS",Mi="POUND",Rr="QUERY",Xa="QUOTE",Bp="FULLWIDTHMIDDLEDOT",Qa="SEMI",lt="SLASH",Or="TILDE",Ti="UNDERSCORE",_p="EMOJI",Ai="SYM";var Hp=Object.freeze({__proto__:null,ALPHANUMERICAL:jp,AMPERSAND:gi,APOSTROPHE:yi,ASCIINUMERICAL:Pp,ASTERISK:vi,AT:Vt,BACKSLASH:bi,BACKTICK:Ci,CARET:xi,CLOSEANGLEBRACKET:li,CLOSEBRACE:Tr,CLOSEBRACKET:ri,CLOSEPAREN:ii,COLON:Wt,COMMA:Za,DOLLAR:wi,DOT:st,EMOJI:_p,EQUALS:Si,EXCLAMATION:Ya,FULLWIDTHGREATERTHAN:mi,FULLWIDTHLEFTPAREN:ai,FULLWIDTHLESSTHAN:pi,FULLWIDTHMIDDLEDOT:Bp,FULLWIDTHRIGHTPAREN:ci,HYPHEN:Je,LEFTCORNERBRACKET:ui,LEFTWHITECORNERBRACKET:fi,LOCALHOST:$r,NL:Ja,NUM:Ga,OPENANGLEBRACKET:si,OPENBRACE:Mr,OPENBRACKET:ni,OPENPAREN:oi,PERCENT:Ar,PIPE:ki,PLUS:Ei,POUND:Mi,QUERY:Rr,QUOTE:Xa,RIGHTCORNERBRACKET:di,RIGHTWHITECORNERBRACKET:hi,SCHEME:jo,SEMI:Qa,SLASH:lt,SLASH_SCHEME:qn,SYM:Ai,TILDE:Or,TLD:Kl,UNDERSCORE:Ti,UTLD:ql,UWORD:Wl,WORD:St,WS:Gl});const xt=/[a-z]/,mr=new RegExp("\\p{L}","u"),qs=new RegExp("\\p{Emoji}","u"),wt=/\d/,Gs=/\s/,bd="\r",Js=`
156
+ `,Lx="️",Dx="‍",Zs="";let Co=null,xo=null;function Px(t=[]){const e={};_e.groups=e;const n=new _e;Co==null&&(Co=Cd(Tx)),xo==null&&(xo=Cd(Ax)),O(n,"'",yi),O(n,"{",Mr),O(n,"}",Tr),O(n,"[",ni),O(n,"]",ri),O(n,"(",oi),O(n,")",ii),O(n,"<",si),O(n,">",li),O(n,"(",ai),O(n,")",ci),O(n,"「",ui),O(n,"」",di),O(n,"『",fi),O(n,"』",hi),O(n,"<",pi),O(n,">",mi),O(n,"&",gi),O(n,"*",vi),O(n,"@",Vt),O(n,"`",Ci),O(n,"^",xi),O(n,":",Wt),O(n,",",Za),O(n,"$",wi),O(n,".",st),O(n,"=",Si),O(n,"!",Ya),O(n,"-",Je),O(n,"%",Ar),O(n,"|",ki),O(n,"+",Ei),O(n,"#",Mi),O(n,"?",Rr),O(n,'"',Xa),O(n,"/",lt),O(n,";",Qa),O(n,"~",Or),O(n,"_",Ti),O(n,"\\",bi),O(n,"・",Bp);const r=ue(n,wt,Ga,{[$l]:!0});ue(r,wt,r);const o=ue(r,xt,Pp,{[Er]:!0}),i=ue(r,mr,jp,{[br]:!0}),s=ue(n,xt,St,{[Vl]:!0});ue(s,wt,o),ue(s,xt,s),ue(o,wt,o),ue(o,xt,o);const l=ue(n,mr,Wl,{[zl]:!0});ue(l,xt),ue(l,wt,i),ue(l,mr,l),ue(i,wt,i),ue(i,xt),ue(i,mr,i);const a=O(n,Js,Ja,{[Ks]:!0}),c=O(n,bd,Gl,{[Ks]:!0}),u=ue(n,Gs,Gl,{[Ks]:!0});O(n,Zs,u),O(c,Js,a),O(c,Zs,u),ue(c,Gs,u),O(u,bd),O(u,Js),ue(u,Gs,u),O(u,Zs,u);const d=ue(n,qs,_p,{[Dp]:!0});O(d,"#"),ue(d,qs,d),O(d,Lx,d);const f=O(d,Dx);O(f,"#"),ue(f,qs,d);const h=[[xt,s],[wt,o]],p=[[xt,null],[mr,l],[wt,i]];for(let m=0;m<Co.length;m++)Bt(n,Co[m],Kl,St,h);for(let m=0;m<xo.length;m++)Bt(n,xo[m],ql,Wl,p);Cn(Kl,{tld:!0,ascii:!0},e),Cn(ql,{utld:!0,alpha:!0},e),Bt(n,"file",jo,St,h),Bt(n,"mailto",jo,St,h),Bt(n,"http",qn,St,h),Bt(n,"https",qn,St,h),Bt(n,"ftp",qn,St,h),Bt(n,"ftps",qn,St,h),Cn(jo,{scheme:!0,ascii:!0},e),Cn(qn,{slashscheme:!0,ascii:!0},e),t=t.sort((m,v)=>m[0]>v[0]?1:-1);for(let m=0;m<t.length;m++){const v=t[m][0],C=t[m][1]?{[Rx]:!0}:{[Ox]:!0};v.indexOf("-")>=0?C[Ul]=!0:xt.test(v)?wt.test(v)?C[Er]=!0:C[Vl]=!0:C[$l]=!0,vd(n,v,v,C)}return vd(n,"localhost",$r,{ascii:!0}),n.jd=new _e(Ai),{start:n,tokens:Object.assign({groups:e},Hp)}}function Fp(t,e){const n=jx(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let l=t,a=null,c=0,u=null,d=-1,f=-1;for(;s<r&&(a=l.go(n[s]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=n[s].length,f++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=f,c-=d,o.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}function jx(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Bt(t,e,n,r,o){let i;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];t.j[a]?i=t.j[a]:(i=new _e(r),i.jr=o.slice(),t.j[a]=i),t=i}return i=new _e(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function Cd(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}const Vr={defaultProtocol:"http",events:null,format:xd,formatHref:xd,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ec(t,e=null){let n=Object.assign({},Vr);t&&(n=Object.assign(n,t instanceof ec?t.o:t));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}ec.prototype={o:Vr,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:Vr[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function xd(t){return t}function $p(t,e){this.t="token",this.v=t,this.tk=e}$p.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Vr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};function es(t,e){class n extends $p{constructor(o,i){super(o,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const wd=es("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Sd=es("text"),Bx=es("nl"),wo=es("url",{isLink:!0,toHref(t=Vr.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==$r&&t[1].t===Wt}}),qe=t=>new _e(t);function _x({groups:t}){const e=t.domain.concat([gi,vi,Vt,bi,Ci,xi,wi,Si,Je,Ga,Ar,ki,Ei,Mi,lt,Ai,Or,Ti]),n=[yi,Wt,Za,st,Ya,Ar,Rr,Xa,Qa,si,li,Mr,Tr,ri,ni,oi,ii,ai,ci,ui,di,fi,hi,pi,mi],r=[gi,yi,vi,bi,Ci,xi,wi,Si,Je,Mr,Tr,Ar,ki,Ei,Mi,Rr,lt,Ai,Or,Ti],o=qe(),i=O(o,Or);G(i,r,i),G(i,t.domain,i);const s=qe(),l=qe(),a=qe();G(o,t.domain,s),G(o,t.scheme,l),G(o,t.slashscheme,a),G(s,r,i),G(s,t.domain,s);const c=O(s,Vt);O(i,Vt,c),O(l,Vt,c),O(a,Vt,c);const u=O(i,st);G(u,r,i),G(u,t.domain,i);const d=qe();G(c,t.domain,d),G(d,t.domain,d);const f=O(d,st);G(f,t.domain,d);const h=qe(wd);G(f,t.tld,h),G(f,t.utld,h),O(c,$r,h);const p=O(d,Je);O(p,Je,p),G(p,t.domain,d),G(h,t.domain,d),O(h,st,f),O(h,Je,p);const m=O(h,Wt);G(m,t.numeric,wd);const v=O(s,Je),b=O(s,st);O(v,Je,v),G(v,t.domain,s),G(b,r,i),G(b,t.domain,s);const C=qe(wo);G(b,t.tld,C),G(b,t.utld,C),G(C,t.domain,s),G(C,r,i),O(C,st,b),O(C,Je,v),O(C,Vt,c);const x=O(C,Wt),w=qe(wo);G(x,t.numeric,w);const E=qe(wo),k=qe();G(E,e,E),G(E,n,k),G(k,e,E),G(k,n,k),O(C,lt,E),O(w,lt,E);const S=O(l,Wt),M=O(a,Wt),N=O(M,lt),P=O(N,lt);G(l,t.domain,s),O(l,st,b),O(l,Je,v),G(a,t.domain,s),O(a,st,b),O(a,Je,v),G(S,t.domain,E),O(S,lt,E),O(S,Rr,E),G(P,t.domain,E),G(P,e,E),O(P,lt,E);const z=[[Mr,Tr],[ni,ri],[oi,ii],[si,li],[ai,ci],[ui,di],[fi,hi],[pi,mi]];for(let U=0;U<z.length;U++){const[H,I]=z[U],_=O(E,H);O(k,H,_),O(_,I,E);const F=qe(wo);G(_,e,F);const L=qe();G(_,n),G(F,e,F),G(F,n,L),G(L,e,F),G(L,n,L),O(F,I,E),O(L,I,E)}return O(o,$r,C),O(o,Ja,Bx),{start:o,tokens:Hp}}function Hx(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let l=t,a=null,c=null,u=0,d=null,f=-1;for(;o<r&&!(a=l.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=a||l.go(n[o].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(Ys(Sd,e,s)),s=[]),o-=f,u-=f;const h=d.t,p=n.slice(o-u,o);i.push(Ys(h,e,p))}}return s.length>0&&i.push(Ys(Sd,e,s)),i}function Ys(t,e,n){const r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}const Fx=typeof console<"u"&&console&&console.warn||(()=>{}),$x="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",se={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Vx(){return _e.groups={},se.scanner=null,se.parser=null,se.tokenQueue=[],se.pluginQueue=[],se.customSchemes=[],se.initialized=!1,se}function kd(t,e=!1){if(se.initialized&&Fx(`linkifyjs: already initialized - will not register custom scheme "${t}" ${$x}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
157
157
  1. Must only contain digits, lowercase ASCII letters or "-"
158
158
  2. Cannot start or end with "-"
159
- 3. "-" cannot repeat`);se.customSchemes.push([t,e])}function zx(){se.scanner=Px(se.customSchemes);for(let t=0;t<se.tokenQueue.length;t++)se.tokenQueue[t][1]({scanner:se.scanner});se.parser=_x(se.scanner.tokens);for(let t=0;t<se.pluginQueue.length;t++)se.pluginQueue[t][1]({scanner:se.scanner,parser:se.parser});return se.initialized=!0,se}function tc(t){return se.initialized||zx(),Hx(se.parser.start,t,Fp(se.scanner.start,t))}tc.scan=Fp;function Vp(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new ec(n),o=tc(t),i=[];for(let s=0;s<o.length;s++){const l=o[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var nc="[\0-   ᠎ -\u2029  ]",Ux=new RegExp(nc),Wx=new RegExp(`${nc}$`),Kx=new RegExp(nc,"g");function qx(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Gx(t){return new ce({key:new ye("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,l=Ba(n.doc,[...e]);if($a(l).forEach(({newRange:c})=>{const u=sp(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!Wx.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(Ux).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;const v=tc(p).map(b=>b.toObject(t.defaultProtocol));if(!qx(v))return!1;v.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{Va(b.from,b.to,r.doc).some(C=>C.mark.type===t.type)||s.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function Jx(t){return new ce({key:new ye("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{let u=r.target;const d=[];for(;u.nodeName!=="DIV";)d.push(u),u=u.parentNode;s=d.find(f=>f.nodeName==="A")}if(!s)return!1;const l=fp(e.state,t.type.name),a=(o=s?.href)!=null?o:l.href,c=(i=s?.target)!=null?i:l.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),s&&a?(window.open(a,c),!0):!1}}})}function Zx(t){return new ce({key:new ye("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:o}=t,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=Vp(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||o!==void 0&&!o(c.href)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function mn(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(Kx,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Yx=it.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){kd(t);return}kd(t.scheme,t.optionalSlashes)})},onDestroy(){Vx()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!mn(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!mn(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!mn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",re(this.options.HTMLAttributes,t),0]:["a",re(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const r=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${r})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!mn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!mn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[an({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=Vp(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!mn(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Gx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!mn(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Jx({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Zx({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Xx=Object.defineProperty,Qx=(t,e)=>{for(var n in e)Xx(t,n,{get:e[n],enumerable:!0})},ew="listItem",Ed="textStyle",Md=/^\s*([-+*])\s$/,zp=je.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
160
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ew,this.editor.getAttributes(Ed)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=ir({find:Md,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ir({find:Md,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ed),editor:this.editor})),[t]}}),Up=je.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(o=>o.type==="paragraph"))n=e.parseChildren(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const s=t.tokens.slice(1),l=e.parseChildren(s);n.push(...l)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>Ka(t,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),tw={};Qx(tw,{findListItemPos:()=>eo,getNextListDepth:()=>rc,handleBackspace:()=>Jl,handleDelete:()=>Zl,hasListBefore:()=>Wp,hasListItemAfter:()=>nw,hasListItemBefore:()=>Kp,listItemHasSubList:()=>qp,nextListIsDeeper:()=>Gp,nextListIsHigher:()=>Jp});var eo=(t,e)=>{const{$from:n}=e.selection,r=me(t,e.schema);let o=null,i=n.depth,s=n.pos,l=null;for(;i>0&&l===null;)o=n.node(i),o.type===r?l=i:(i-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},rc=(t,e)=>{const n=eo(t,e);if(!n)return!1;const[,r]=Lb(e,t,n.$pos.pos+4);return r},Wp=(t,e,n)=>{const{$anchor:r}=t.selection,o=Math.max(0,r.pos-2),i=t.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},Kp=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-2);return!(o.index()===0||((n=o.nodeBefore)==null?void 0:n.type.name)!==t)},qp=(t,e,n)=>{if(!n)return!1;const r=me(t,e.schema);let o=!1;return n.descendants(i=>{i.type===r&&(o=!0)}),o},Jl=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!ln(t.state,e)&&Wp(t.state,e,n)){const{$anchor:l}=t.state.selection,a=t.state.doc.resolve(l.before()-1),c=[];a.node().descendants((f,h)=>{f.type.name===e&&c.push({node:f,pos:h})});const u=c.at(-1);if(!u)return!1;const d=t.state.doc.resolve(a.start()+u.pos+1);return t.chain().cut({from:l.start()-1,to:l.end()+1},d.end()).joinForward().run()}if(!ln(t.state,e)||!Bb(t.state))return!1;const r=eo(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),s=qp(e,t.state,i);return Kp(e,t.state)&&!s?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},Gp=(t,e)=>{const n=rc(t,e),r=eo(t,e);return!r||!n?!1:n>r.depth},Jp=(t,e)=>{const n=rc(t,e),r=eo(t,e);return!r||!n?!1:n<r.depth},Zl=(t,e)=>{if(!ln(t.state,e)||!jb(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:o}=n;return!n.empty&&r.sameParent(o)?!1:Gp(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():Jp(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},nw=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((n=o.nodeAfter)==null?void 0:n.type.name)!==t)},Zp=Q.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Zl(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Zl(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Jl(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Jl(t,n,r)&&(e=!0)}),e}}}}),Td=/^(\s*)(\d+)\.\s+(.*)$/,rw=/^\s/;function ow(t){const e=[];let n=0,r=0;for(;n<t.length;){const o=t[n],i=o.match(Td);if(!i)break;const[,s,l,a]=i,c=s.length;let u=a,d=n+1;const f=[o];for(;d<t.length;){const h=t[d];if(h.match(Td))break;if(h.trim()==="")f.push(h),u+=`
159
+ 3. "-" cannot repeat`);se.customSchemes.push([t,e])}function zx(){se.scanner=Px(se.customSchemes);for(let t=0;t<se.tokenQueue.length;t++)se.tokenQueue[t][1]({scanner:se.scanner});se.parser=_x(se.scanner.tokens);for(let t=0;t<se.pluginQueue.length;t++)se.pluginQueue[t][1]({scanner:se.scanner,parser:se.parser});return se.initialized=!0,se}function tc(t){return se.initialized||zx(),Hx(se.parser.start,t,Fp(se.scanner.start,t))}tc.scan=Fp;function Vp(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new ec(n),o=tc(t),i=[];for(let s=0;s<o.length;s++){const l=o[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var nc="[\0-   ᠎ -\u2029  ]",Ux=new RegExp(nc),Wx=new RegExp(`${nc}$`),Kx=new RegExp(nc,"g");function qx(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Gx(t){return new ce({key:new ye("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,l=Ba(n.doc,[...e]);if($a(l).forEach(({newRange:c})=>{const u=sp(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!Wx.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(Ux).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;const v=tc(p).map(b=>b.toObject(t.defaultProtocol));if(!qx(v))return!1;v.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{Va(b.from,b.to,r.doc).some(C=>C.mark.type===t.type)||s.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function Jx(t){return new ce({key:new ye("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{let u=r.target;const d=[];for(;u.nodeName!=="DIV";)d.push(u),u=u.parentNode;s=d.find(f=>f.nodeName==="A")}if(!s)return!1;const l=fp(e.state,t.type.name),a=(o=s?.href)!=null?o:l.href,c=(i=s?.target)!=null?i:l.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),s&&a?(window.open(a,c),!0):!1}}})}function Zx(t){return new ce({key:new ye("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:o}=t,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=Vp(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||o!==void 0&&!o(c.href)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function pn(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(Kx,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Yx=it.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){kd(t);return}kd(t.scheme,t.optionalSlashes)})},onDestroy(){Vx()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!pn(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!pn(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!pn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",re(this.options.HTMLAttributes,t),0]:["a",re(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const r=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${r})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!pn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!pn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ln({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=Vp(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!pn(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Gx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!pn(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Jx({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Zx({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Xx=Object.defineProperty,Qx=(t,e)=>{for(var n in e)Xx(t,n,{get:e[n],enumerable:!0})},ew="listItem",Ed="textStyle",Md=/^\s*([-+*])\s$/,zp=je.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
160
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ew,this.editor.getAttributes(Ed)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=ir({find:Md,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ir({find:Md,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ed),editor:this.editor})),[t]}}),Up=je.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(o=>o.type==="paragraph"))n=e.parseChildren(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const s=t.tokens.slice(1),l=e.parseChildren(s);n.push(...l)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>Ka(t,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),tw={};Qx(tw,{findListItemPos:()=>eo,getNextListDepth:()=>rc,handleBackspace:()=>Jl,handleDelete:()=>Zl,hasListBefore:()=>Wp,hasListItemAfter:()=>nw,hasListItemBefore:()=>Kp,listItemHasSubList:()=>qp,nextListIsDeeper:()=>Gp,nextListIsHigher:()=>Jp});var eo=(t,e)=>{const{$from:n}=e.selection,r=me(t,e.schema);let o=null,i=n.depth,s=n.pos,l=null;for(;i>0&&l===null;)o=n.node(i),o.type===r?l=i:(i-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},rc=(t,e)=>{const n=eo(t,e);if(!n)return!1;const[,r]=Lb(e,t,n.$pos.pos+4);return r},Wp=(t,e,n)=>{const{$anchor:r}=t.selection,o=Math.max(0,r.pos-2),i=t.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},Kp=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-2);return!(o.index()===0||((n=o.nodeBefore)==null?void 0:n.type.name)!==t)},qp=(t,e,n)=>{if(!n)return!1;const r=me(t,e.schema);let o=!1;return n.descendants(i=>{i.type===r&&(o=!0)}),o},Jl=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!sn(t.state,e)&&Wp(t.state,e,n)){const{$anchor:l}=t.state.selection,a=t.state.doc.resolve(l.before()-1),c=[];a.node().descendants((f,h)=>{f.type.name===e&&c.push({node:f,pos:h})});const u=c.at(-1);if(!u)return!1;const d=t.state.doc.resolve(a.start()+u.pos+1);return t.chain().cut({from:l.start()-1,to:l.end()+1},d.end()).joinForward().run()}if(!sn(t.state,e)||!Bb(t.state))return!1;const r=eo(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),s=qp(e,t.state,i);return Kp(e,t.state)&&!s?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},Gp=(t,e)=>{const n=rc(t,e),r=eo(t,e);return!r||!n?!1:n>r.depth},Jp=(t,e)=>{const n=rc(t,e),r=eo(t,e);return!r||!n?!1:n<r.depth},Zl=(t,e)=>{if(!sn(t.state,e)||!jb(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:o}=n;return!n.empty&&r.sameParent(o)?!1:Gp(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():Jp(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},nw=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((n=o.nodeAfter)==null?void 0:n.type.name)!==t)},Zp=Q.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Zl(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Zl(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Jl(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Jl(t,n,r)&&(e=!0)}),e}}}}),Td=/^(\s*)(\d+)\.\s+(.*)$/,rw=/^\s/;function ow(t){const e=[];let n=0,r=0;for(;n<t.length;){const o=t[n],i=o.match(Td);if(!i)break;const[,s,l,a]=i,c=s.length;let u=a,d=n+1;const f=[o];for(;d<t.length;){const h=t[d];if(h.match(Td))break;if(h.trim()==="")f.push(h),u+=`
161
161
  `,d+=1;else if(h.match(rw))f.push(h),u+=`
162
162
  ${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(l,10),content:u.trim(),raw:f.join(`
163
163
  `)}),r=d,n=d}return[e,r]}function Yp(t,e,n){var r;const o=[];let i=0;for(;i<t.length;){const s=t[i];if(s.indent===e){const l=s.content.split(`
@@ -167,10 +167,10 @@ ${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(l,10),content:
167
167
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const o=t.split(`
168
168
  `),[i,s]=ow(o);if(i.length===0)return;const l=Yp(i,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:l,raw:o.slice(0,s).join(`
169
169
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(sw,this.editor.getAttributes(Ad)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=ir({find:Rd,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ir({find:Rd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ad)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),lw=/^\s*(\[([( |x])?\])\s$/,Qp=je.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",re(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const o=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Ka(t,e,o)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=u=>{var d,f;l.ariaLabel=((f=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:f.call(d,u,l.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return c(t),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",u=>u.preventDefault()),l.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:d}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const h=n();if(typeof h!="number")return!1;const p=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...p?.attrs,checked:d}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,d)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{o.setAttribute(u,d)}),o.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,s),o.append(i,a),Object.entries(e).forEach(([u,d])=>{o.setAttribute(u,d)}),{dom:o,contentDOM:a,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,c(u),!0)}}},addInputRules(){return[ir({find:lw,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),em=je.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",re(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
170
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const s=Hl(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(i)},o=Hl(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Q.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(zp.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Up.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Zp.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Xp.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Qp.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(em.configure(this.options.taskList)),t}});var aw=je.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",re(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),cw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,uw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,dw=it.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[On({find:cw,type:this.type})]},addPasteRules(){return[an({find:uw,type:this.type})]}}),fw=je.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),hw=it.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",re(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!o)return;const i=o[2].trim();return{type:"underline",raw:o[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function pw(t={}){return new ce({view(e){return new mw(e,t)}})}class mw{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,l=i.height/o.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*l;r={left:p.left,right:p.right,top:m-v,bottom:m+v}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Yf(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){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class de extends q{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return de.valid(r)?new de(r):q.near(r)}content(){return D.empty}eq(e){return e instanceof de&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new de(e.resolve(n.pos))}getBookmark(){return new oc(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!gw(e)||!yw(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&de.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(n>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let a=e.doc.resolve(o);if(de.valid(a))return a}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!B.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let l=e.doc.resolve(o);if(de.valid(l))return l}return null}}}de.prototype.visible=!1;de.findFrom=de.findGapCursorFrom;q.jsonID("gapcursor",de);class oc{constructor(e){this.pos=e}map(e){return new oc(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return de.valid(n)?new de(n):q.near(n)}}function tm(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function gw(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||tm(o.type))return!0;if(o.inlineContent)return!1}}return!0}function yw(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||tm(o.type))return!0;if(o.inlineContent)return!1}}return!0}function vw(){return new ce({props:{decorations:ww,createSelectionBetween(t,e,n){return e.pos==n.pos&&de.valid(n)?new de(n):null},handleClick:Cw,handleKeyDown:bw,handleDOMEvents:{beforeinput:xw}}})}const bw=Yh({ArrowLeft:So("horiz",-1),ArrowRight:So("horiz",1),ArrowUp:So("vert",-1),ArrowDown:So("vert",1)});function So(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof V){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=de.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new de(c))),!0):!1}}function Cw(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!de.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&B.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new de(r))),!0)}function xw(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof de))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=A.empty;for(let s=r.length-1;s>=0;s--)o=A.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new D(o,0,0));return i.setSelection(V.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function ww(t){if(!(t.selection instanceof de))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ae.create(t.doc,[Ie.widget(t.selection.head,e,{key:"gapcursor"})])}var Ri=200,Ce=function(){};Ce.prototype.append=function(e){return e.length?(e=Ce.from(e),!this.length&&e||e.length<Ri&&this.leafAppend(e)||this.length<Ri&&e.leafPrepend(this)||this.appendInner(e)):this};Ce.prototype.prepend=function(e){return e.length?Ce.from(e).append(this):this};Ce.prototype.appendInner=function(e){return new Sw(this,e)};Ce.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ce.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ce.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ce.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Ce.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};Ce.from=function(e){return e instanceof Ce?e:e&&e.length?new nm(e):Ce.empty};var nm=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,l){for(var a=i-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Ri)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Ri)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Ce);Ce.empty=new nm([]);var Sw=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,i,s){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(o,l),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Ce);const kw=500;class nt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new $t(d.map));let h=d.step.map(o.slice(i)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new $t(p,void 0,void 0,c.length+u.length))),i--,p&&o.appendMap(p,i)}else s.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(i)):d.selection,a=new nt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,n,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new $t(e.mapping.maps[u],d,n),h;(h=a&&a.merge(f))&&(f=h,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(s++,n=void 0),o||(a=f)}let c=s-r.depth;return c>Mw&&(l=Ew(l,c),s-=c),new nt(l.append(i),s)}remapping(e,n){let r=new Lr;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new nt(this.items.append(e.map(n=>new $t(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=n;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),v=f.selection&&f.selection.map(i.slice(a+1,h));v&&l++,r.push(new $t(p,m,v))}else r.push(new $t(p))},o);let c=[];for(let f=n;f<s;f++)c.push(new $t(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new nt(u,l);return d.emptyItemCount()>kw&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new $t(c.invert(),a,u),f,h=o.length-1;(f=o.length&&o[h].merge(d))?o[h]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new nt(Ce.from(o.reverse()),i)}}nt.empty=new nt(Ce.empty,0);function Ew(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}let $t=class rm{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new rm(n.getMap().invert(),n,this.selection)}}};class Kt{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const Mw=20;function Tw(t,e,n,r){let o=n.getMeta(En),i;if(o)return o.historyState;n.getMeta(Ow)&&(t=new Kt(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(En))return s.getMeta(En).redo?new Kt(t.done.addTransform(n,void 0,r,Bo(e)),t.undone,Od(n.mapping.maps),t.prevTime,t.prevComposition):new Kt(t.done,t.undone.addTransform(n,void 0,r,Bo(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Aw(n,t.prevRanges)),c=s?Xs(t.prevRanges,n.mapping):Od(n.mapping.maps);return new Kt(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Bo(e)),nt.empty,c,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Kt(t.done.rebased(n,i),t.undone.rebased(n,i),Xs(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Kt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Xs(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Aw(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function Od(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,s)=>e.push(i,s));return e}function Xs(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function Rw(t,e,n){let r=Bo(e),o=En.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),a=new Kt(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(En,{redo:n,historyState:a})}let Qs=!1,Nd=null;function Bo(t){let e=t.plugins;if(Nd!=e){Qs=!1,Nd=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Qs=!0;break}}return Qs}const En=new ye("history"),Ow=new ye("closeHistory");function Nw(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ce({key:En,state:{init(){return new Kt(nt.empty,nt.empty,null,0,-1)},apply(e,n,r){return Tw(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?im:r=="historyRedo"?sm:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function om(t,e){return(n,r)=>{let o=En.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=Rw(o,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const im=om(!1,!0),sm=om(!0,!0);Q.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new ce({key:new ye("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const o=this.options.limit;if(o==null||o===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>o){const s=i-o,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||o>r&&i>r&&i<=o)return!0;if(o>r&&i>r&&i>o||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var Iw=Q.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[pw(this.options)]}});Q.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ce({key:new ye("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,i=[];if(!n||!r)return ae.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(a.isText)return;if(!(o>=c&&o<=c+a.nodeSize-1))return!1;s+=1});let l=0;return t.descendants((a,c)=>{if(a.isText||!(o>=c&&o<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ie.node(c,c+a.nodeSize,{class:this.options.className}))}),ae.create(t,i)}}})]}});var Lw=Q.create({name:"gapCursor",addProseMirrorPlugins(){return[vw()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=X($(t,"allowGapCursor",n)))!=null?e:null}}});Q.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ce({key:new ye("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,l)=>{const a=r>=l&&r<=l+s.nodeSize,c=!s.isLeaf&&Xi(s);if((a||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];i&&u.push(this.options.emptyEditorClass);const d=Ie.node(l,l+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:a}):this.options.placeholder});o.push(d)}return this.options.includeChildren}),ae.create(t,o)}}})]}});var Dw=Q.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new ce({key:new ye("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||hp(n.selection)||t.view.dragging?null:ae.create(n.doc,[Ie.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Id({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var Pw=Q.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ye(this.name),n=((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new ce({key:e,appendTransaction:(o,i,s)=>{const{doc:l,tr:a,schema:c}=s,u=e.getState(s),d=l.content.size,f=c.nodes[n];if(u)return a.insert(d,f.create())},state:{init:(o,i)=>{const s=i.tr.doc.lastChild;return!Id({node:s,types:r})},apply:(o,i)=>{if(!o.docChanged)return i;const s=o.doc.lastChild;return!Id({node:s,types:r})}}})]}}),jw=Q.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>im(t,e),redo:()=>({state:t,dispatch:e})=>sm(t,e)}},addProseMirrorPlugins(){return[Nw(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Bw=Q.create({name:"starterKit",addExtensions(){var t,e,n,r;const o=[];return this.options.bold!==!1&&o.push(dx.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(sx.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(zp.configure(this.options.bulletList)),this.options.code!==!1&&o.push(px.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(yx.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(vx.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(Iw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(Lw.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(bx.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(Cx.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(jw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(Lp.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(Mx.configure(this.options.italic)),this.options.listItem!==!1&&o.push(Up.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(Zp.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(Yx.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(Xp.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(aw.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(dw.configure(this.options.strike)),this.options.text!==!1&&o.push(fw.configure(this.options.text)),this.options.underline!==!1&&o.push(hw.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(Pw.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),_w=Q.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Hw=t=>he({find:/--$/,replace:t??"—"}),Fw=t=>he({find:/\.\.\.$/,replace:t??"…"}),$w=t=>he({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),Vw=t=>he({find:/"$/,replace:t??"”"}),zw=t=>he({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),Uw=t=>he({find:/'$/,replace:t??"’"}),Ww=t=>he({find:/<-$/,replace:t??"←"}),Kw=t=>he({find:/->$/,replace:t??"→"}),qw=t=>he({find:/\(c\)$/,replace:t??"©"}),Gw=t=>he({find:/\(tm\)$/,replace:t??"™"}),Jw=t=>he({find:/\(sm\)$/,replace:t??"℠"}),Zw=t=>he({find:/\(r\)$/,replace:t??"®"}),Yw=t=>he({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),Xw=t=>he({find:/\+\/-$/,replace:t??"±"}),Qw=t=>he({find:/!=$/,replace:t??"≠"}),e7=t=>he({find:/<<$/,replace:t??"«"}),t7=t=>he({find:/>>$/,replace:t??"»"}),n7=t=>he({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),r7=t=>he({find:/\^2$/,replace:t??"²"}),o7=t=>he({find:/\^3$/,replace:t??"³"}),i7=t=>he({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),s7=t=>he({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),l7=Q.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){const t=[];return this.options.emDash!==!1&&t.push(Hw(this.options.emDash)),this.options.ellipsis!==!1&&t.push(Fw(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push($w(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(Vw(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(zw(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(Uw(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(Ww(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(Kw(this.options.rightArrow)),this.options.copyright!==!1&&t.push(qw(this.options.copyright)),this.options.trademark!==!1&&t.push(Gw(this.options.trademark)),this.options.servicemark!==!1&&t.push(Jw(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(Zw(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(Yw(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(Xw(this.options.plusMinus)),this.options.notEqual!==!1&&t.push(Qw(this.options.notEqual)),this.options.laquo!==!1&&t.push(e7(this.options.laquo)),this.options.raquo!==!1&&t.push(t7(this.options.raquo)),this.options.multiplication!==!1&&t.push(n7(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(r7(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push(o7(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(i7(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(s7(this.options.threeQuarters)),t}}),a7=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,c7=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,u7=it.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",re(this.options.HTMLAttributes,t),0]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,n){const o=/^(==)([^=]+)(==)/.exec(t);if(o){const i=o[2].trim(),s=n.inlineTokens(i);return{type:"highlight",raw:o[0],text:i,tokens:s}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[On({find:a7,type:this.type})]},addPasteRules(){return[an({find:c7,type:this.type})]}}),d7=it.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",re(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),f7=it.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",re(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),we=[];for(var el=0;el<256;++el)we.push((el+256).toString(16).slice(1));function h7(t,e=0){return(we[t[e+0]]+we[t[e+1]]+we[t[e+2]]+we[t[e+3]]+"-"+we[t[e+4]]+we[t[e+5]]+"-"+we[t[e+6]]+we[t[e+7]]+"-"+we[t[e+8]]+we[t[e+9]]+"-"+we[t[e+10]]+we[t[e+11]]+we[t[e+12]]+we[t[e+13]]+we[t[e+14]]+we[t[e+15]]).toLowerCase()}var ko,p7=new Uint8Array(16);function m7(){if(!ko&&(ko=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ko))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ko(p7)}var g7=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Ld={randomUUID:g7};function y7(t,e,n){if(Ld.randomUUID&&!t)return Ld.randomUUID();t=t||{};var r=t.random||(t.rng||m7)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,h7(r)}function v7(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function b7(t){const e=t.filter((r,o)=>t.indexOf(r)!==o);return v7(e)}var C7=Q.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],generateID:()=>y7(),filterTransaction:null,updateDocument:!0}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:t=>t.getAttribute(`data-${this.options.attributeName}`),renderHTML:t=>t[this.options.attributeName]?{[`data-${this.options.attributeName}`]:t[this.options.attributeName]}:{}}}}]},onCreate(){var t;if(!this.options.updateDocument)return;const e=this.editor.extensionManager.extensions.find(l=>l.name==="collaboration"),n=this.editor.extensionManager.extensions.find(l=>l.name==="collaborationCaret"),o=[e,n].filter(Boolean).find(l=>{var a;return(a=l?.options)==null?void 0:a.provider}),i=(t=o?.options)==null?void 0:t.provider,s=()=>{const{view:l,state:a}=this.editor,{tr:c,doc:u}=a,{types:d,attributeName:f,generateID:h}=this.options;Sb(u,m=>d.includes(m.type.name)&&m.attrs[f]===null).forEach(({node:m,pos:v})=>{c.setNodeMarkup(v,void 0,{...m.attrs,[f]:h({node:m,pos:v})})}),c.setMeta("addToHistory",!1),l.dispatch(c),i&&i.off("synced",s)};if(o){if(!i)return s();i.on("synced",s)}else return s()},addProseMirrorPlugins(){if(!this.options.updateDocument)return[];let t=null,e=!1;return[new ce({key:new ye("uniqueID"),appendTransaction:(n,r,o)=>{const i=n.some(m=>m.docChanged)&&!r.doc.eq(o.doc),s=this.options.filterTransaction&&n.some(m=>{var v,b;return!((b=(v=this.options).filterTransaction)!=null&&b.call(v,m))});if(n.find(m=>m.getMeta("y-sync$"))||!i||s)return;const{tr:a}=o,{types:c,attributeName:u,generateID:d}=this.options,f=Ba(r.doc,n),{mapping:h}=f;if($a(f).forEach(({newRange:m})=>{const v=sp(o.doc,m,C=>c.includes(C.type.name)),b=v.map(({node:C})=>C.attrs[u]).filter(C=>C!==null);v.forEach(({node:C,pos:x},w)=>{var E;const k=(E=a.doc.nodeAt(x))==null?void 0:E.attrs[u];if(k===null){a.setNodeMarkup(x,void 0,{...C.attrs,[u]:d({node:C,pos:x})});return}const S=v[w+1];if(S&&C.content.size===0){if(a.setNodeMarkup(S.pos,void 0,{...S.node.attrs,[u]:k}),b[w+1]=k,S.node.attrs[u])return;const z=d({node:C,pos:x});return a.setNodeMarkup(x,void 0,{...C.attrs,[u]:z}),b[w]=z,a}const M=b7(b),{deleted:N}=h.invert().mapResult(x);N&&M.includes(k)&&a.setNodeMarkup(x,void 0,{...C.attrs,[u]:d({node:C,pos:x})})})}),!!a.steps.length)return a.setStoredMarks(o.tr.storedMarks),a},view(n){const r=o=>{var i;t=(i=n.dom.parentElement)!=null&&i.contains(o.target)?n.dom.parentElement:null};return window.addEventListener("dragstart",r),{destroy(){window.removeEventListener("dragstart",r)}}},props:{handleDOMEvents:{drop:(n,r)=>{var o,i;return(t!==n.dom.parentElement||((o=r.dataTransfer)==null?void 0:o.effectAllowed)==="copyMove"||((i=r.dataTransfer)==null?void 0:i.effectAllowed)==="copy")&&(t=null,e=!0),!1},paste:()=>(e=!0,!1)},transformPasted:n=>{if(!e)return n;const{types:r,attributeName:o}=this.options,i=s=>{const l=[];return s.forEach(a=>{if(a.isText){l.push(a);return}if(!r.includes(a.type.name)){l.push(a.copy(i(a.content)));return}const c=a.type.create({...a.attrs,[o]:null},i(a.content),a.marks);l.push(c)}),A.from(l)};return e=!1,new D(i(n.content),n.openStart,n.openEnd)}}})]}}),x7=C7,w7=20,lm=(t,e=0)=>{const n=[];return!t.children.length||e>w7||Array.from(t.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...lm(r,e+1))}),n},S7=t=>{if(!t.children.length)return;const e=lm(t);e&&e.forEach(n=>{var r,o;const i=n.getAttribute("style"),s=(o=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:o.getAttribute("style");n.setAttribute("style",`${s};${i}`)})},am=it.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&S7(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",re(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(i=>!!i))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),k7=Q.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const i=r[o].split(":");if(i.length>=2){const s=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(s==="background-color")return l.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),cm=Q.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const i=r[o].split(":");if(i.length>=2){const s=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(s==="color")return l.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),E7=Q.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),M7=Q.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),T7=Q.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});Q.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(k7.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(cm.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(E7.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(M7.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(T7.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(am.configure(this.options.textStyle)),t}});function ts(){return typeof window<"u"}function cr(t){return ic(t)?(t.nodeName||"").toLowerCase():"#document"}function Fe(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function mt(t){var e;return(e=(ic(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function ic(t){return ts()?t instanceof Node||t instanceof Fe(t).Node:!1}function oe(t){return ts()?t instanceof Element||t instanceof Fe(t).Element:!1}function Ue(t){return ts()?t instanceof HTMLElement||t instanceof Fe(t).HTMLElement:!1}function Yl(t){return!ts()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Fe(t).ShadowRoot}const A7=new Set(["inline","contents"]);function to(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=tt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!A7.has(o)}const R7=new Set(["table","td","th"]);function O7(t){return R7.has(cr(t))}const N7=[":popover-open",":modal"];function ns(t){return N7.some(e=>{try{return t.matches(e)}catch{return!1}})}const I7=["transform","translate","scale","rotate","perspective"],L7=["transform","translate","scale","rotate","perspective","filter"],D7=["paint","layout","strict","content"];function sc(t){const e=rs(),n=oe(t)?tt(t):t;return I7.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||L7.some(r=>(n.willChange||"").includes(r))||D7.some(r=>(n.contain||"").includes(r))}function P7(t){let e=Lt(t);for(;Ue(e)&&!It(e);){if(sc(e))return e;if(ns(e))return null;e=Lt(e)}return null}function rs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const j7=new Set(["html","body","#document"]);function It(t){return j7.has(cr(t))}function tt(t){return Fe(t).getComputedStyle(t)}function is(t){return oe(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Lt(t){if(cr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Yl(t)&&t.host||mt(t);return Yl(e)?e.host:e}function um(t){const e=Lt(t);return It(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ue(e)&&to(e)?e:um(e)}function rn(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=um(t),i=o===((r=t.ownerDocument)==null?void 0:r.body),s=Fe(o);if(i){const l=Xl(s);return e.concat(s,s.visualViewport||[],to(o)?o:[],l&&n?rn(l):[])}return e.concat(o,rn(o,[],n))}function Xl(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const B7=["top","right","bottom","left"],cn=Math.min,$e=Math.max,Oi=Math.round,Eo=Math.floor,ft=t=>({x:t,y:t}),_7={left:"right",right:"left",bottom:"top",top:"bottom"},H7={start:"end",end:"start"};function Ql(t,e,n){return $e(t,cn(e,n))}function Dt(t,e){return typeof t=="function"?t(e):t}function Pt(t){return t.split("-")[0]}function ur(t){return t.split("-")[1]}function lc(t){return t==="x"?"y":"x"}function ac(t){return t==="y"?"height":"width"}const F7=new Set(["top","bottom"]);function ut(t){return F7.has(Pt(t))?"y":"x"}function cc(t){return lc(ut(t))}function $7(t,e,n){n===void 0&&(n=!1);const r=ur(t),o=cc(t),i=ac(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=Ni(s)),[s,Ni(s)]}function V7(t){const e=Ni(t);return[ea(t),e,ea(e)]}function ea(t){return t.replace(/start|end/g,e=>H7[e])}const Dd=["left","right"],Pd=["right","left"],z7=["top","bottom"],U7=["bottom","top"];function W7(t,e,n){switch(t){case"top":case"bottom":return n?e?Pd:Dd:e?Dd:Pd;case"left":case"right":return e?z7:U7;default:return[]}}function K7(t,e,n,r){const o=ur(t);let i=W7(Pt(t),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),e&&(i=i.concat(i.map(ea)))),i}function Ni(t){return t.replace(/left|right|bottom|top/g,e=>_7[e])}function q7(t){return{top:0,right:0,bottom:0,left:0,...t}}function dm(t){return typeof t!="number"?q7(t):{top:t,right:t,bottom:t,left:t}}function Ii(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}/*!
170
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const s=Hl(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(i)},o=Hl(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Q.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(zp.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Up.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Zp.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Xp.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Qp.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(em.configure(this.options.taskList)),t}});var aw=je.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",re(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),cw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,uw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,dw=it.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",re(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[On({find:cw,type:this.type})]},addPasteRules(){return[ln({find:uw,type:this.type})]}}),fw=je.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),hw=it.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",re(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!o)return;const i=o[2].trim();return{type:"underline",raw:o[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function pw(t={}){return new ce({view(e){return new mw(e,t)}})}class mw{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,l=i.height/o.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*l;r={left:p.left,right:p.right,top:m-v,bottom:m+v}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Yf(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){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class de extends q{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return de.valid(r)?new de(r):q.near(r)}content(){return D.empty}eq(e){return e instanceof de&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new de(e.resolve(n.pos))}getBookmark(){return new oc(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!gw(e)||!yw(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&de.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(n>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let a=e.doc.resolve(o);if(de.valid(a))return a}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!B.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let l=e.doc.resolve(o);if(de.valid(l))return l}return null}}}de.prototype.visible=!1;de.findFrom=de.findGapCursorFrom;q.jsonID("gapcursor",de);class oc{constructor(e){this.pos=e}map(e){return new oc(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return de.valid(n)?new de(n):q.near(n)}}function tm(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function gw(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||tm(o.type))return!0;if(o.inlineContent)return!1}}return!0}function yw(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||tm(o.type))return!0;if(o.inlineContent)return!1}}return!0}function vw(){return new ce({props:{decorations:ww,createSelectionBetween(t,e,n){return e.pos==n.pos&&de.valid(n)?new de(n):null},handleClick:Cw,handleKeyDown:bw,handleDOMEvents:{beforeinput:xw}}})}const bw=Yh({ArrowLeft:So("horiz",-1),ArrowRight:So("horiz",1),ArrowUp:So("vert",-1),ArrowDown:So("vert",1)});function So(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof V){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=de.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new de(c))),!0):!1}}function Cw(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!de.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&B.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new de(r))),!0)}function xw(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof de))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=A.empty;for(let s=r.length-1;s>=0;s--)o=A.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new D(o,0,0));return i.setSelection(V.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function ww(t){if(!(t.selection instanceof de))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ae.create(t.doc,[Ie.widget(t.selection.head,e,{key:"gapcursor"})])}var Ri=200,Ce=function(){};Ce.prototype.append=function(e){return e.length?(e=Ce.from(e),!this.length&&e||e.length<Ri&&this.leafAppend(e)||this.length<Ri&&e.leafPrepend(this)||this.appendInner(e)):this};Ce.prototype.prepend=function(e){return e.length?Ce.from(e).append(this):this};Ce.prototype.appendInner=function(e){return new Sw(this,e)};Ce.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ce.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ce.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ce.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Ce.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};Ce.from=function(e){return e instanceof Ce?e:e&&e.length?new nm(e):Ce.empty};var nm=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,l){for(var a=i-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Ri)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Ri)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Ce);Ce.empty=new nm([]);var Sw=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,i,s){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(o,l),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Ce);const kw=500;class nt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new _t(d.map));let h=d.step.map(o.slice(i)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new _t(p,void 0,void 0,c.length+u.length))),i--,p&&o.appendMap(p,i)}else s.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(i)):d.selection,a=new nt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,n,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new _t(e.mapping.maps[u],d,n),h;(h=a&&a.merge(f))&&(f=h,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(s++,n=void 0),o||(a=f)}let c=s-r.depth;return c>Mw&&(l=Ew(l,c),s-=c),new nt(l.append(i),s)}remapping(e,n){let r=new Lr;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new nt(this.items.append(e.map(n=>new _t(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=n;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),v=f.selection&&f.selection.map(i.slice(a+1,h));v&&l++,r.push(new _t(p,m,v))}else r.push(new _t(p))},o);let c=[];for(let f=n;f<s;f++)c.push(new _t(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new nt(u,l);return d.emptyItemCount()>kw&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new _t(c.invert(),a,u),f,h=o.length-1;(f=o.length&&o[h].merge(d))?o[h]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new nt(Ce.from(o.reverse()),i)}}nt.empty=new nt(Ce.empty,0);function Ew(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}let _t=class rm{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new rm(n.getMap().invert(),n,this.selection)}}};class zt{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const Mw=20;function Tw(t,e,n,r){let o=n.getMeta(En),i;if(o)return o.historyState;n.getMeta(Ow)&&(t=new zt(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(En))return s.getMeta(En).redo?new zt(t.done.addTransform(n,void 0,r,Bo(e)),t.undone,Od(n.mapping.maps),t.prevTime,t.prevComposition):new zt(t.done,t.undone.addTransform(n,void 0,r,Bo(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Aw(n,t.prevRanges)),c=s?Xs(t.prevRanges,n.mapping):Od(n.mapping.maps);return new zt(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Bo(e)),nt.empty,c,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new zt(t.done.rebased(n,i),t.undone.rebased(n,i),Xs(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new zt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Xs(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Aw(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function Od(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,s)=>e.push(i,s));return e}function Xs(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function Rw(t,e,n){let r=Bo(e),o=En.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),a=new zt(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(En,{redo:n,historyState:a})}let Qs=!1,Nd=null;function Bo(t){let e=t.plugins;if(Nd!=e){Qs=!1,Nd=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Qs=!0;break}}return Qs}const En=new ye("history"),Ow=new ye("closeHistory");function Nw(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ce({key:En,state:{init(){return new zt(nt.empty,nt.empty,null,0,-1)},apply(e,n,r){return Tw(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?im:r=="historyRedo"?sm:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function om(t,e){return(n,r)=>{let o=En.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=Rw(o,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const im=om(!1,!0),sm=om(!0,!0);Q.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new ce({key:new ye("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const o=this.options.limit;if(o==null||o===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>o){const s=i-o,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||o>r&&i>r&&i<=o)return!0;if(o>r&&i>r&&i>o||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var Iw=Q.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[pw(this.options)]}});Q.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ce({key:new ye("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,i=[];if(!n||!r)return ae.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(a.isText)return;if(!(o>=c&&o<=c+a.nodeSize-1))return!1;s+=1});let l=0;return t.descendants((a,c)=>{if(a.isText||!(o>=c&&o<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ie.node(c,c+a.nodeSize,{class:this.options.className}))}),ae.create(t,i)}}})]}});var Lw=Q.create({name:"gapCursor",addProseMirrorPlugins(){return[vw()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=X($(t,"allowGapCursor",n)))!=null?e:null}}});Q.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ce({key:new ye("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,l)=>{const a=r>=l&&r<=l+s.nodeSize,c=!s.isLeaf&&Xi(s);if((a||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];i&&u.push(this.options.emptyEditorClass);const d=Ie.node(l,l+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:a}):this.options.placeholder});o.push(d)}return this.options.includeChildren}),ae.create(t,o)}}})]}});var Dw=Q.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new ce({key:new ye("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||hp(n.selection)||t.view.dragging?null:ae.create(n.doc,[Ie.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Id({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var Pw=Q.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ye(this.name),n=((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new ce({key:e,appendTransaction:(o,i,s)=>{const{doc:l,tr:a,schema:c}=s,u=e.getState(s),d=l.content.size,f=c.nodes[n];if(u)return a.insert(d,f.create())},state:{init:(o,i)=>{const s=i.tr.doc.lastChild;return!Id({node:s,types:r})},apply:(o,i)=>{if(!o.docChanged)return i;const s=o.doc.lastChild;return!Id({node:s,types:r})}}})]}}),jw=Q.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>im(t,e),redo:()=>({state:t,dispatch:e})=>sm(t,e)}},addProseMirrorPlugins(){return[Nw(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Bw=Q.create({name:"starterKit",addExtensions(){var t,e,n,r;const o=[];return this.options.bold!==!1&&o.push(dx.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(sx.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(zp.configure(this.options.bulletList)),this.options.code!==!1&&o.push(px.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(yx.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(vx.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(Iw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(Lw.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(bx.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(Cx.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(jw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(Lp.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(Mx.configure(this.options.italic)),this.options.listItem!==!1&&o.push(Up.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(Zp.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(Yx.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(Xp.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(aw.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(dw.configure(this.options.strike)),this.options.text!==!1&&o.push(fw.configure(this.options.text)),this.options.underline!==!1&&o.push(hw.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(Pw.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),_w=Q.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Hw=t=>he({find:/--$/,replace:t??"—"}),Fw=t=>he({find:/\.\.\.$/,replace:t??"…"}),$w=t=>he({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),Vw=t=>he({find:/"$/,replace:t??"”"}),zw=t=>he({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),Uw=t=>he({find:/'$/,replace:t??"’"}),Ww=t=>he({find:/<-$/,replace:t??"←"}),Kw=t=>he({find:/->$/,replace:t??"→"}),qw=t=>he({find:/\(c\)$/,replace:t??"©"}),Gw=t=>he({find:/\(tm\)$/,replace:t??"™"}),Jw=t=>he({find:/\(sm\)$/,replace:t??"℠"}),Zw=t=>he({find:/\(r\)$/,replace:t??"®"}),Yw=t=>he({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),Xw=t=>he({find:/\+\/-$/,replace:t??"±"}),Qw=t=>he({find:/!=$/,replace:t??"≠"}),e7=t=>he({find:/<<$/,replace:t??"«"}),t7=t=>he({find:/>>$/,replace:t??"»"}),n7=t=>he({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),r7=t=>he({find:/\^2$/,replace:t??"²"}),o7=t=>he({find:/\^3$/,replace:t??"³"}),i7=t=>he({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),s7=t=>he({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),l7=Q.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){const t=[];return this.options.emDash!==!1&&t.push(Hw(this.options.emDash)),this.options.ellipsis!==!1&&t.push(Fw(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push($w(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(Vw(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(zw(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(Uw(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(Ww(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(Kw(this.options.rightArrow)),this.options.copyright!==!1&&t.push(qw(this.options.copyright)),this.options.trademark!==!1&&t.push(Gw(this.options.trademark)),this.options.servicemark!==!1&&t.push(Jw(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(Zw(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(Yw(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(Xw(this.options.plusMinus)),this.options.notEqual!==!1&&t.push(Qw(this.options.notEqual)),this.options.laquo!==!1&&t.push(e7(this.options.laquo)),this.options.raquo!==!1&&t.push(t7(this.options.raquo)),this.options.multiplication!==!1&&t.push(n7(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(r7(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push(o7(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(i7(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(s7(this.options.threeQuarters)),t}}),a7=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,c7=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,u7=it.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",re(this.options.HTMLAttributes,t),0]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,n){const o=/^(==)([^=]+)(==)/.exec(t);if(o){const i=o[2].trim(),s=n.inlineTokens(i);return{type:"highlight",raw:o[0],text:i,tokens:s}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[On({find:a7,type:this.type})]},addPasteRules(){return[ln({find:c7,type:this.type})]}}),d7=it.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",re(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),f7=it.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",re(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),we=[];for(var el=0;el<256;++el)we.push((el+256).toString(16).slice(1));function h7(t,e=0){return(we[t[e+0]]+we[t[e+1]]+we[t[e+2]]+we[t[e+3]]+"-"+we[t[e+4]]+we[t[e+5]]+"-"+we[t[e+6]]+we[t[e+7]]+"-"+we[t[e+8]]+we[t[e+9]]+"-"+we[t[e+10]]+we[t[e+11]]+we[t[e+12]]+we[t[e+13]]+we[t[e+14]]+we[t[e+15]]).toLowerCase()}var ko,p7=new Uint8Array(16);function m7(){if(!ko&&(ko=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ko))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ko(p7)}var g7=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Ld={randomUUID:g7};function y7(t,e,n){if(Ld.randomUUID&&!t)return Ld.randomUUID();t=t||{};var r=t.random||(t.rng||m7)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,h7(r)}function v7(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function b7(t){const e=t.filter((r,o)=>t.indexOf(r)!==o);return v7(e)}var C7=Q.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],generateID:()=>y7(),filterTransaction:null,updateDocument:!0}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:t=>t.getAttribute(`data-${this.options.attributeName}`),renderHTML:t=>t[this.options.attributeName]?{[`data-${this.options.attributeName}`]:t[this.options.attributeName]}:{}}}}]},onCreate(){var t;if(!this.options.updateDocument)return;const e=this.editor.extensionManager.extensions.find(l=>l.name==="collaboration"),n=this.editor.extensionManager.extensions.find(l=>l.name==="collaborationCaret"),o=[e,n].filter(Boolean).find(l=>{var a;return(a=l?.options)==null?void 0:a.provider}),i=(t=o?.options)==null?void 0:t.provider,s=()=>{const{view:l,state:a}=this.editor,{tr:c,doc:u}=a,{types:d,attributeName:f,generateID:h}=this.options;Sb(u,m=>d.includes(m.type.name)&&m.attrs[f]===null).forEach(({node:m,pos:v})=>{c.setNodeMarkup(v,void 0,{...m.attrs,[f]:h({node:m,pos:v})})}),c.setMeta("addToHistory",!1),l.dispatch(c),i&&i.off("synced",s)};if(o){if(!i)return s();i.on("synced",s)}else return s()},addProseMirrorPlugins(){if(!this.options.updateDocument)return[];let t=null,e=!1;return[new ce({key:new ye("uniqueID"),appendTransaction:(n,r,o)=>{const i=n.some(m=>m.docChanged)&&!r.doc.eq(o.doc),s=this.options.filterTransaction&&n.some(m=>{var v,b;return!((b=(v=this.options).filterTransaction)!=null&&b.call(v,m))});if(n.find(m=>m.getMeta("y-sync$"))||!i||s)return;const{tr:a}=o,{types:c,attributeName:u,generateID:d}=this.options,f=Ba(r.doc,n),{mapping:h}=f;if($a(f).forEach(({newRange:m})=>{const v=sp(o.doc,m,C=>c.includes(C.type.name)),b=v.map(({node:C})=>C.attrs[u]).filter(C=>C!==null);v.forEach(({node:C,pos:x},w)=>{var E;const k=(E=a.doc.nodeAt(x))==null?void 0:E.attrs[u];if(k===null){a.setNodeMarkup(x,void 0,{...C.attrs,[u]:d({node:C,pos:x})});return}const S=v[w+1];if(S&&C.content.size===0){if(a.setNodeMarkup(S.pos,void 0,{...S.node.attrs,[u]:k}),b[w+1]=k,S.node.attrs[u])return;const z=d({node:C,pos:x});return a.setNodeMarkup(x,void 0,{...C.attrs,[u]:z}),b[w]=z,a}const M=b7(b),{deleted:N}=h.invert().mapResult(x);N&&M.includes(k)&&a.setNodeMarkup(x,void 0,{...C.attrs,[u]:d({node:C,pos:x})})})}),!!a.steps.length)return a.setStoredMarks(o.tr.storedMarks),a},view(n){const r=o=>{var i;t=(i=n.dom.parentElement)!=null&&i.contains(o.target)?n.dom.parentElement:null};return window.addEventListener("dragstart",r),{destroy(){window.removeEventListener("dragstart",r)}}},props:{handleDOMEvents:{drop:(n,r)=>{var o,i;return(t!==n.dom.parentElement||((o=r.dataTransfer)==null?void 0:o.effectAllowed)==="copyMove"||((i=r.dataTransfer)==null?void 0:i.effectAllowed)==="copy")&&(t=null,e=!0),!1},paste:()=>(e=!0,!1)},transformPasted:n=>{if(!e)return n;const{types:r,attributeName:o}=this.options,i=s=>{const l=[];return s.forEach(a=>{if(a.isText){l.push(a);return}if(!r.includes(a.type.name)){l.push(a.copy(i(a.content)));return}const c=a.type.create({...a.attrs,[o]:null},i(a.content),a.marks);l.push(c)}),A.from(l)};return e=!1,new D(i(n.content),n.openStart,n.openEnd)}}})]}}),x7=C7,w7=20,lm=(t,e=0)=>{const n=[];return!t.children.length||e>w7||Array.from(t.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...lm(r,e+1))}),n},S7=t=>{if(!t.children.length)return;const e=lm(t);e&&e.forEach(n=>{var r,o;const i=n.getAttribute("style"),s=(o=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:o.getAttribute("style");n.setAttribute("style",`${s};${i}`)})},am=it.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&S7(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",re(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(i=>!!i))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),k7=Q.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const i=r[o].split(":");if(i.length>=2){const s=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(s==="background-color")return l.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),cm=Q.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const i=r[o].split(":");if(i.length>=2){const s=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(s==="color")return l.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),E7=Q.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),M7=Q.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),T7=Q.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});Q.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(k7.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(cm.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(E7.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(M7.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(T7.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(am.configure(this.options.textStyle)),t}});function ts(){return typeof window<"u"}function cr(t){return ic(t)?(t.nodeName||"").toLowerCase():"#document"}function Fe(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function mt(t){var e;return(e=(ic(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function ic(t){return ts()?t instanceof Node||t instanceof Fe(t).Node:!1}function oe(t){return ts()?t instanceof Element||t instanceof Fe(t).Element:!1}function Ue(t){return ts()?t instanceof HTMLElement||t instanceof Fe(t).HTMLElement:!1}function Yl(t){return!ts()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Fe(t).ShadowRoot}const A7=new Set(["inline","contents"]);function to(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=tt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!A7.has(o)}const R7=new Set(["table","td","th"]);function O7(t){return R7.has(cr(t))}const N7=[":popover-open",":modal"];function ns(t){return N7.some(e=>{try{return t.matches(e)}catch{return!1}})}const I7=["transform","translate","scale","rotate","perspective"],L7=["transform","translate","scale","rotate","perspective","filter"],D7=["paint","layout","strict","content"];function sc(t){const e=rs(),n=oe(t)?tt(t):t;return I7.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||L7.some(r=>(n.willChange||"").includes(r))||D7.some(r=>(n.contain||"").includes(r))}function P7(t){let e=Ot(t);for(;Ue(e)&&!Rt(e);){if(sc(e))return e;if(ns(e))return null;e=Ot(e)}return null}function rs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const j7=new Set(["html","body","#document"]);function Rt(t){return j7.has(cr(t))}function tt(t){return Fe(t).getComputedStyle(t)}function is(t){return oe(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ot(t){if(cr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Yl(t)&&t.host||mt(t);return Yl(e)?e.host:e}function um(t){const e=Ot(t);return Rt(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ue(e)&&to(e)?e:um(e)}function nn(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=um(t),i=o===((r=t.ownerDocument)==null?void 0:r.body),s=Fe(o);if(i){const l=Xl(s);return e.concat(s,s.visualViewport||[],to(o)?o:[],l&&n?nn(l):[])}return e.concat(o,nn(o,[],n))}function Xl(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const B7=["top","right","bottom","left"],an=Math.min,$e=Math.max,Oi=Math.round,Eo=Math.floor,ft=t=>({x:t,y:t}),_7={left:"right",right:"left",bottom:"top",top:"bottom"},H7={start:"end",end:"start"};function Ql(t,e,n){return $e(t,an(e,n))}function Nt(t,e){return typeof t=="function"?t(e):t}function It(t){return t.split("-")[0]}function ur(t){return t.split("-")[1]}function lc(t){return t==="x"?"y":"x"}function ac(t){return t==="y"?"height":"width"}const F7=new Set(["top","bottom"]);function ut(t){return F7.has(It(t))?"y":"x"}function cc(t){return lc(ut(t))}function $7(t,e,n){n===void 0&&(n=!1);const r=ur(t),o=cc(t),i=ac(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=Ni(s)),[s,Ni(s)]}function V7(t){const e=Ni(t);return[ea(t),e,ea(e)]}function ea(t){return t.replace(/start|end/g,e=>H7[e])}const Dd=["left","right"],Pd=["right","left"],z7=["top","bottom"],U7=["bottom","top"];function W7(t,e,n){switch(t){case"top":case"bottom":return n?e?Pd:Dd:e?Dd:Pd;case"left":case"right":return e?z7:U7;default:return[]}}function K7(t,e,n,r){const o=ur(t);let i=W7(It(t),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),e&&(i=i.concat(i.map(ea)))),i}function Ni(t){return t.replace(/left|right|bottom|top/g,e=>_7[e])}function q7(t){return{top:0,right:0,bottom:0,left:0,...t}}function dm(t){return typeof t!="number"?q7(t):{top:t,right:t,bottom:t,left:t}}function Ii(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}/*!
171
171
  * tabbable 6.3.0
172
172
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
173
- */var G7=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],ta=G7.join(","),fm=typeof Element>"u",zr=fm?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Li=!fm&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},Ur=function(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),i=o===""||o==="true",s=i||n&&e&&Ur(e.parentNode);return s},J7=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},Z7=function(e,n,r){if(Ur(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(ta));return n&&zr.call(e,ta)&&o.unshift(e),o=o.filter(r),o},na=function(e,n,r){for(var o=[],i=Array.from(e);i.length;){var s=i.shift();if(!Ur(s,!1))if(s.tagName==="SLOT"){var l=s.assignedElements(),a=l.length?l:s.children,c=na(a,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:s,candidates:c})}else{var u=zr.call(s,ta);u&&r.filter(s)&&(n||!e.includes(s))&&o.push(s);var d=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),f=!Ur(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(d&&f){var h=na(d===!0?s.children:d.children,!0,r);r.flatten?o.push.apply(o,h):o.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return o},hm=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},pm=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||J7(e))&&!hm(e)?0:e.tabIndex},Y7=function(e,n){var r=pm(e);return r<0&&n&&!hm(e)?0:r},X7=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},mm=function(e){return e.tagName==="INPUT"},Q7=function(e){return mm(e)&&e.type==="hidden"},e4=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},t4=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},n4=function(e){if(!e.name)return!0;var n=e.form||Li(e),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=t4(o,e.form);return!i||i===e},r4=function(e){return mm(e)&&e.type==="radio"},o4=function(e){return r4(e)&&!n4(e)},i4=function(e){var n,r=e&&Li(e),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==e){var s,l,a;for(i=!!((s=o)!==null&&s!==void 0&&(l=s.ownerDocument)!==null&&l!==void 0&&l.contains(o)||e!=null&&(a=e.ownerDocument)!==null&&a!==void 0&&a.contains(e));!i&&o;){var c,u,d;r=Li(o),o=(c=r)===null||c===void 0?void 0:c.host,i=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return i},jd=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},s4=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var i=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(e).visibility==="hidden")return!0;var s=zr.call(e,"details>summary:first-of-type"),l=s?e.parentElement:e;if(zr.call(l,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=e;e;){var c=e.parentElement,u=Li(e);if(c&&!c.shadowRoot&&o(c)===!0)return jd(e);e.assignedSlot?e=e.assignedSlot:!c&&u!==e.ownerDocument?e=u.host:e=c}e=a}if(i4(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return jd(e);return!1},l4=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return zr.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},a4=function(e,n){return!(n.disabled||Ur(n)||Q7(n)||s4(n,e)||e4(n)||l4(n))},Bd=function(e,n){return!(o4(n)||pm(n)<0||!a4(e,n))},c4=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},gm=function(e){var n=[],r=[];return e.forEach(function(o,i){var s=!!o.scopeParent,l=s?o.scopeParent:o,a=Y7(l,s),c=s?gm(o.candidates):l;a===0?s?n.push.apply(n,c):n.push(l):r.push({documentOrder:i,tabIndex:a,item:o,isScope:s,content:c})}),r.sort(X7).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},ym=function(e,n){n=n||{};var r;return n.getShadowRoot?r=na([e],n.includeContainer,{filter:Bd.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:c4}):r=Z7(e,n.includeContainer,Bd.bind(null,n)),gm(r)};function u4(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function d4(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:n,version:r}=e;return n+"/"+r}).join(" "):navigator.userAgent}function vm(){return/apple/i.test(navigator.vendor)}function f4(){return u4().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function h4(){return d4().includes("jsdom/")}const _d="data-floating-ui-focusable",p4="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function ra(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function sr(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Yl(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Gn(t){return"composedPath"in t?t.composedPath()[0]:t.target}function tl(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function m4(t){return t.matches("html,body")}function dt(t){return t?.ownerDocument||document}function g4(t){return Ue(t)&&t.matches(p4)}function y4(t){if(!t||h4())return!0;try{return t.matches(":focus-visible")}catch{return!0}}function v4(t){return t?t.hasAttribute(_d)?t:t.querySelector("["+_d+"]")||t:null}function _o(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var i;return o.parentId===e&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,..._o(t,o.id,n)])}function b4(t){return"nativeEvent"in t}function oa(t,e){const n=["mouse","pen"];return n.push("",void 0),n.includes(t)}var C4=typeof document<"u",x4=function(){},ot=C4?j.useLayoutEffect:x4;const w4={...y};function Mo(t){const e=y.useRef(t);return ot(()=>{e.current=t}),e}const S4=w4.useInsertionEffect,k4=S4||(t=>t());function at(t){const e=y.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return k4(()=>{e.current=t}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const bm=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Cm(t,e){const n=ym(t,bm()),r=n.length;if(r===0)return;const o=ra(dt(t)),i=n.indexOf(o),s=i===-1?e===1?0:r-1:i+e;return n[s]}function E4(t){return Cm(dt(t).body,1)||t}function M4(t){return Cm(dt(t).body,-1)||t}function nl(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!sr(n,r)}function T4(t){ym(t,bm()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Hd(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Fd(t,e,n){let{reference:r,floating:o}=t;const i=ut(e),s=cc(e),l=ac(s),a=Pt(e),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let h;switch(a){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(ur(e)){case"start":h[s]-=f*(n&&c?-1:1);break;case"end":h[s]+=f*(n&&c?-1:1);break}return h}const A4=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:d}=Fd(c,r,a),f=r,h={},p=0;for(let m=0;m<l.length;m++){const{name:v,fn:b}=l[m],{x:C,y:x,data:w,reset:E}=await b({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:h,rects:c,platform:s,elements:{reference:t,floating:e}});u=C??u,d=x??d,h={...h,[v]:{...h[v],...w}},E&&p<=50&&(p++,typeof E=="object"&&(E.placement&&(f=E.placement),E.rects&&(c=E.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:o}):E.rects),{x:u,y:d}=Fd(c,f,a)),m=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:h}};async function Wr(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Dt(e,t),p=dm(h),v=l[f?d==="floating"?"reference":"floating":d],b=Ii(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),C=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),w=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},E=Ii(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:C,offsetParent:x,strategy:a}):C);return{top:(b.top-E.top+p.top)/w.y,bottom:(E.bottom-b.bottom+p.bottom)/w.y,left:(b.left-E.left+p.left)/w.x,right:(E.right-b.right+p.right)/w.x}}const R4=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:a}=e,{element:c,padding:u=0}=Dt(t,e)||{};if(c==null)return{};const d=dm(u),f={x:n,y:r},h=cc(o),p=ac(h),m=await s.getDimensions(c),v=h==="y",b=v?"top":"left",C=v?"bottom":"right",x=v?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[h]-f[h]-i.floating[p],E=f[h]-i.reference[h],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let S=k?k[x]:0;(!S||!await(s.isElement==null?void 0:s.isElement(k)))&&(S=l.floating[x]||i.floating[p]);const M=w/2-E/2,N=S/2-m[p]/2-1,P=cn(d[b],N),z=cn(d[C],N),U=P,H=S-m[p]-z,I=S/2-m[p]/2+M,_=Ql(U,I,H),F=!a.arrow&&ur(o)!=null&&I!==_&&i.reference[p]/2-(I<U?P:z)-m[p]/2<0,L=F?I<U?I-U:I-H:0;return{[h]:f[h]+L,data:{[h]:_,centerOffset:I-_-L,...F&&{alignmentOffset:L}},reset:F}}}),O4=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...v}=Dt(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Pt(o),C=ut(l),x=Pt(l)===l,w=await(a.isRTL==null?void 0:a.isRTL(c.floating)),E=f||(x||!m?[Ni(l)]:V7(l)),k=p!=="none";!f&&k&&E.push(...K7(l,m,p,w));const S=[l,...E],M=await Wr(e,v),N=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&N.push(M[b]),d){const I=$7(o,s,w);N.push(M[I[0]],M[I[1]])}if(P=[...P,{placement:o,overflows:N}],!N.every(I=>I<=0)){var z,U;const I=(((z=i.flip)==null?void 0:z.index)||0)+1,_=S[I];if(_&&(!(d==="alignment"?C!==ut(_):!1)||P.every(T=>ut(T.placement)===C?T.overflows[0]>0:!0)))return{data:{index:I,overflows:P},reset:{placement:_}};let F=(U=P.filter(L=>L.overflows[0]<=0).sort((L,T)=>L.overflows[1]-T.overflows[1])[0])==null?void 0:U.placement;if(!F)switch(h){case"bestFit":{var H;const L=(H=P.filter(T=>{if(k){const R=ut(T.placement);return R===C||R==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(R=>R>0).reduce((R,W)=>R+W,0)]).sort((T,R)=>T[1]-R[1])[0])==null?void 0:H[0];L&&(F=L);break}case"initialPlacement":F=l;break}if(o!==F)return{reset:{placement:F}}}return{}}}};function $d(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Vd(t){return B7.some(e=>t[e]>=0)}const N4=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...o}=Dt(t,e);switch(r){case"referenceHidden":{const i=await Wr(e,{...o,elementContext:"reference"}),s=$d(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Vd(s)}}}case"escaped":{const i=await Wr(e,{...o,altBoundary:!0}),s=$d(i,n.floating);return{data:{escapedOffsets:s,escaped:Vd(s)}}}default:return{}}}}},xm=new Set(["left","top"]);async function I4(t,e){const{placement:n,platform:r,elements:o}=t,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Pt(n),l=ur(n),a=ut(n)==="y",c=xm.has(s)?-1:1,u=i&&a?-1:1,d=Dt(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof p=="number"&&(h=l==="end"?p*-1:p),a?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const L4=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:i,placement:s,middlewareData:l}=e,a=await I4(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:s}}}}},D4=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:v=>{let{x:b,y:C}=v;return{x:b,y:C}}},...a}=Dt(t,e),c={x:n,y:r},u=await Wr(e,a),d=ut(Pt(o)),f=lc(d);let h=c[f],p=c[d];if(i){const v=f==="y"?"top":"left",b=f==="y"?"bottom":"right",C=h+u[v],x=h-u[b];h=Ql(C,h,x)}if(s){const v=d==="y"?"top":"left",b=d==="y"?"bottom":"right",C=p+u[v],x=p-u[b];p=Ql(C,p,x)}const m=l.fn({...e,[f]:h,[d]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[f]:i,[d]:s}}}}}},P4=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=e,{offset:l=0,mainAxis:a=!0,crossAxis:c=!0}=Dt(t,e),u={x:n,y:r},d=ut(o),f=lc(d);let h=u[f],p=u[d];const m=Dt(l,e),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(a){const x=f==="y"?"height":"width",w=i.reference[f]-i.floating[x]+v.mainAxis,E=i.reference[f]+i.reference[x]-v.mainAxis;h<w?h=w:h>E&&(h=E)}if(c){var b,C;const x=f==="y"?"width":"height",w=xm.has(Pt(o)),E=i.reference[d]-i.floating[x]+(w&&((b=s.offset)==null?void 0:b[d])||0)+(w?0:v.crossAxis),k=i.reference[d]+i.reference[x]+(w?0:((C=s.offset)==null?void 0:C[d])||0)-(w?v.crossAxis:0);p<E?p=E:p>k&&(p=k)}return{[f]:h,[d]:p}}}},j4=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:o,rects:i,platform:s,elements:l}=e,{apply:a=()=>{},...c}=Dt(t,e),u=await Wr(e,c),d=Pt(o),f=ur(o),h=ut(o)==="y",{width:p,height:m}=i.floating;let v,b;d==="top"||d==="bottom"?(v=d,b=f===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(b=d,v=f==="end"?"top":"bottom");const C=m-u.top-u.bottom,x=p-u.left-u.right,w=cn(m-u[v],C),E=cn(p-u[b],x),k=!e.middlewareData.shift;let S=w,M=E;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(M=x),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(S=C),k&&!f){const P=$e(u.left,0),z=$e(u.right,0),U=$e(u.top,0),H=$e(u.bottom,0);h?M=p-2*(P!==0||z!==0?P+z:$e(u.left,u.right)):S=m-2*(U!==0||H!==0?U+H:$e(u.top,u.bottom))}await a({...e,availableWidth:M,availableHeight:S});const N=await s.getDimensions(l.floating);return p!==N.width||m!==N.height?{reset:{rects:!0}}:{}}}};function wm(t){const e=tt(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=Ue(t),i=o?t.offsetWidth:n,s=o?t.offsetHeight:r,l=Oi(n)!==i||Oi(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function uc(t){return oe(t)?t:t.contextElement}function Qn(t){const e=uc(t);if(!Ue(e))return ft(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:i}=wm(e);let s=(i?Oi(n.width):n.width)/r,l=(i?Oi(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const B4=ft(0);function Sm(t){const e=Fe(t);return!rs()||!e.visualViewport?B4:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _4(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Fe(t)?!1:e}function Nn(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),i=uc(t);let s=ft(1);e&&(r?oe(r)&&(s=Qn(r)):s=Qn(t));const l=_4(i,n,r)?Sm(i):ft(0);let a=(o.left+l.x)/s.x,c=(o.top+l.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const f=Fe(i),h=r&&oe(r)?Fe(r):r;let p=f,m=Xl(p);for(;m&&r&&h!==p;){const v=Qn(m),b=m.getBoundingClientRect(),C=tt(m),x=b.left+(m.clientLeft+parseFloat(C.paddingLeft))*v.x,w=b.top+(m.clientTop+parseFloat(C.paddingTop))*v.y;a*=v.x,c*=v.y,u*=v.x,d*=v.y,a+=x,c+=w,p=Fe(m),m=Xl(p)}}return Ii({width:u,height:d,x:a,y:c})}function ss(t,e){const n=is(t).scrollLeft;return e?e.left+n:Nn(mt(t)).left+n}function km(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-ss(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function H4(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const i=o==="fixed",s=mt(r),l=e?ns(e.floating):!1;if(r===s||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=ft(1);const u=ft(0),d=Ue(r);if((d||!d&&!i)&&((cr(r)!=="body"||to(s))&&(a=is(r)),Ue(r))){const h=Nn(r);c=Qn(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=s&&!d&&!i?km(s,a):ft(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-a.scrollTop*c.y+u.y+f.y}}function F4(t){return Array.from(t.getClientRects())}function $4(t){const e=mt(t),n=is(t),r=t.ownerDocument.body,o=$e(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=$e(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+ss(t);const l=-n.scrollTop;return tt(r).direction==="rtl"&&(s+=$e(e.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}const zd=25;function V4(t,e){const n=Fe(t),r=mt(t),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,l=0,a=0;if(o){i=o.width,s=o.height;const u=rs();(!u||u&&e==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}const c=ss(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=zd&&(i-=p)}else c<=zd&&(i+=c);return{width:i,height:s,x:l,y:a}}const z4=new Set(["absolute","fixed"]);function U4(t,e){const n=Nn(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,i=Ue(t)?Qn(t):ft(1),s=t.clientWidth*i.x,l=t.clientHeight*i.y,a=o*i.x,c=r*i.y;return{width:s,height:l,x:a,y:c}}function Ud(t,e,n){let r;if(e==="viewport")r=V4(t,n);else if(e==="document")r=$4(mt(t));else if(oe(e))r=U4(e,n);else{const o=Sm(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Ii(r)}function Em(t,e){const n=Lt(t);return n===e||!oe(n)||It(n)?!1:tt(n).position==="fixed"||Em(n,e)}function W4(t,e){const n=e.get(t);if(n)return n;let r=rn(t,[],!1).filter(l=>oe(l)&&cr(l)!=="body"),o=null;const i=tt(t).position==="fixed";let s=i?Lt(t):t;for(;oe(s)&&!It(s);){const l=tt(s),a=sc(s);!a&&l.position==="fixed"&&(o=null),(i?!a&&!o:!a&&l.position==="static"&&!!o&&z4.has(o.position)||to(s)&&!a&&Em(t,s))?r=r.filter(u=>u!==s):o=l,s=Lt(s)}return e.set(t,r),r}function K4(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const s=[...n==="clippingAncestors"?ns(e)?[]:W4(e,this._c):[].concat(n),r],l=s[0],a=s.reduce((c,u)=>{const d=Ud(e,u,o);return c.top=$e(d.top,c.top),c.right=cn(d.right,c.right),c.bottom=cn(d.bottom,c.bottom),c.left=$e(d.left,c.left),c},Ud(e,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function q4(t){const{width:e,height:n}=wm(t);return{width:e,height:n}}function G4(t,e,n){const r=Ue(e),o=mt(e),i=n==="fixed",s=Nn(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const a=ft(0);function c(){a.x=ss(o)}if(r||!r&&!i)if((cr(e)!=="body"||to(o))&&(l=is(e)),r){const h=Nn(e,!0,i,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else o&&c();i&&!r&&o&&c();const u=o&&!r&&!i?km(o,l):ft(0),d=s.left+l.scrollLeft-a.x-u.x,f=s.top+l.scrollTop-a.y-u.y;return{x:d,y:f,width:s.width,height:s.height}}function rl(t){return tt(t).position==="static"}function Wd(t,e){if(!Ue(t)||tt(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return mt(t)===n&&(n=n.ownerDocument.body),n}function Mm(t,e){const n=Fe(t);if(ns(t))return n;if(!Ue(t)){let o=Lt(t);for(;o&&!It(o);){if(oe(o)&&!rl(o))return o;o=Lt(o)}return n}let r=Wd(t,e);for(;r&&O7(r)&&rl(r);)r=Wd(r,e);return r&&It(r)&&rl(r)&&!sc(r)?n:r||P7(t)||n}const J4=async function(t){const e=this.getOffsetParent||Mm,n=this.getDimensions,r=await n(t.floating);return{reference:G4(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Z4(t){return tt(t).direction==="rtl"}const Y4={convertOffsetParentRelativeRectToViewportRelativeRect:H4,getDocumentElement:mt,getClippingRect:K4,getOffsetParent:Mm,getElementRects:J4,getClientRects:F4,getDimensions:q4,getScale:Qn,isElement:oe,isRTL:Z4};function Tm(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function X4(t,e){let n=null,r;const o=mt(t);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function s(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const c=t.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(l||e(),!f||!h)return;const p=Eo(d),m=Eo(o.clientWidth-(u+f)),v=Eo(o.clientHeight-(d+h)),b=Eo(u),x={rootMargin:-p+"px "+-m+"px "+-v+"px "+-b+"px",threshold:$e(0,cn(1,a))||1};let w=!0;function E(k){const S=k[0].intersectionRatio;if(S!==a){if(!w)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!Tm(c,t.getBoundingClientRect())&&s(),w=!1}try{n=new IntersectionObserver(E,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,x)}n.observe(t)}return s(!0),i}function Am(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=uc(t),u=o||i?[...c?rn(c):[],...rn(e)]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const d=c&&l?X4(c,n):null;let f=-1,h=null;s&&(h=new ResizeObserver(b=>{let[C]=b;C&&C.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(e)})),n()}),c&&!a&&h.observe(c),h.observe(e));let p,m=a?Nn(t):null;a&&v();function v(){const b=Nn(t);m&&!Tm(m,b)&&n(),m=b,p=requestAnimationFrame(v)}return n(),()=>{var b;u.forEach(C=>{o&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),d?.(),(b=h)==null||b.disconnect(),h=null,a&&cancelAnimationFrame(p)}}const Q4=L4,e5=D4,t5=O4,n5=j4,r5=N4,Kd=R4,o5=P4,i5=(t,e,n)=>{const r=new Map,o={platform:Y4,...n},i={...o.platform,_c:r};return A4(t,e,{...o,platform:i})};var s5=typeof document<"u",l5=function(){},Ho=s5?j.useLayoutEffect:l5;function Di(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Di(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&t.$$typeof)&&!Di(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function Rm(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function qd(t,e){const n=Rm(t);return Math.round(e*n)/n}function ol(t){const e=y.useRef(t);return Ho(()=>{e.current=t}),e}function Om(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:a,open:c}=t,[u,d]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=y.useState(r);Di(f,r)||h(r);const[p,m]=y.useState(null),[v,b]=y.useState(null),C=y.useCallback(T=>{T!==k.current&&(k.current=T,m(T))},[]),x=y.useCallback(T=>{T!==S.current&&(S.current=T,b(T))},[]),w=i||p,E=s||v,k=y.useRef(null),S=y.useRef(null),M=y.useRef(u),N=a!=null,P=ol(a),z=ol(o),U=ol(c),H=y.useCallback(()=>{if(!k.current||!S.current)return;const T={placement:e,strategy:n,middleware:f};z.current&&(T.platform=z.current),i5(k.current,S.current,T).then(R=>{const W={...R,isPositioned:U.current!==!1};I.current&&!Di(M.current,W)&&(M.current=W,pa.flushSync(()=>{d(W)}))})},[f,e,n,z,U]);Ho(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,d(T=>({...T,isPositioned:!1})))},[c]);const I=y.useRef(!1);Ho(()=>(I.current=!0,()=>{I.current=!1}),[]),Ho(()=>{if(w&&(k.current=w),E&&(S.current=E),w&&E){if(P.current)return P.current(w,E,H);H()}},[w,E,H,P,N]);const _=y.useMemo(()=>({reference:k,floating:S,setReference:C,setFloating:x}),[C,x]),F=y.useMemo(()=>({reference:w,floating:E}),[w,E]),L=y.useMemo(()=>{const T={position:n,left:0,top:0};if(!F.floating)return T;const R=qd(F.floating,u.x),W=qd(F.floating,u.y);return l?{...T,transform:"translate("+R+"px, "+W+"px)",...Rm(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:R,top:W}},[n,l,F.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:H,refs:_,elements:F,floatingStyles:L}),[u,H,_,F,L])}const a5=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Kd({element:r.current,padding:o}).fn(n):{}:r?Kd({element:r,padding:o}).fn(n):{}}}},Nm=(t,e)=>({...Q4(t),options:[t,e]}),Im=(t,e)=>({...e5(t),options:[t,e]}),c5=(t,e)=>({...o5(t),options:[t,e]}),Lm=(t,e)=>({...t5(t),options:[t,e]}),u5=(t,e)=>({...n5(t),options:[t,e]}),d5=(t,e)=>({...r5(t),options:[t,e]}),f5=(t,e)=>({...a5(t),options:[t,e]});function Dm(t){const e=y.useRef(void 0),n=y.useCallback(r=>{const o=t.map(i=>{if(i!=null){if(typeof i=="function"){const s=i,l=s(r);return typeof l=="function"?l:()=>{s(null)}}return i.current=r,()=>{i.current=null}}});return()=>{o.forEach(i=>i?.())}},t);return y.useMemo(()=>t.every(r=>r==null)?null:r=>{e.current&&(e.current(),e.current=void 0),r!=null&&(e.current=n(r))},t)}const h5="data-floating-ui-focusable",Gd="active",Jd="selected",p5={...y};let Zd=!1,m5=0;const Yd=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+m5++;function g5(){const[t,e]=y.useState(()=>Zd?Yd():void 0);return ot(()=>{t==null&&e(Yd())},[]),y.useEffect(()=>{Zd=!0},[]),t}const y5=p5.useId,dc=y5||g5;let ia;process.env.NODE_ENV!=="production"&&(ia=new Set);function v5(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((t=ia)!=null&&t.has(o))){var i;(i=ia)==null||i.add(o),console.error(o)}}function b5(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const C5=y.createContext(null),x5=y.createContext(null),fc=()=>{var t;return((t=y.useContext(C5))==null?void 0:t.id)||null},hc=()=>y.useContext(x5);function no(t){return"data-floating-ui-"+t}function Ge(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}const Xd=no("safe-polygon");function il(t,e,n){if(n&&!oa(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const r=t();return typeof r=="number"?r:r?.[e]}return t?.[e]}function sl(t){return typeof t=="function"?t():t}function w5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:s}=t,{enabled:l=!0,delay:a=0,handleClose:c=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=e,h=hc(),p=fc(),m=Mo(c),v=Mo(a),b=Mo(n),C=Mo(d),x=y.useRef(),w=y.useRef(-1),E=y.useRef(),k=y.useRef(-1),S=y.useRef(!0),M=y.useRef(!1),N=y.useRef(()=>{}),P=y.useRef(!1),z=at(()=>{var L;const T=(L=o.current.openEvent)==null?void 0:L.type;return T?.includes("mouse")&&T!=="mousedown"});y.useEffect(()=>{if(!l)return;function L(T){let{open:R}=T;R||(Ge(w),Ge(k),S.current=!0,P.current=!1)}return i.on("openchange",L),()=>{i.off("openchange",L)}},[l,i]),y.useEffect(()=>{if(!l||!m.current||!n)return;function L(R){z()&&r(!1,R,"hover")}const T=dt(s.floating).documentElement;return T.addEventListener("mouseleave",L),()=>{T.removeEventListener("mouseleave",L)}},[s.floating,n,r,l,m,z]);const U=y.useCallback(function(L,T,R){T===void 0&&(T=!0),R===void 0&&(R="hover");const W=il(v.current,"close",x.current);W&&!E.current?(Ge(w),w.current=window.setTimeout(()=>r(!1,L,R),W)):T&&(Ge(w),r(!1,L,R))},[v,r]),H=at(()=>{N.current(),E.current=void 0}),I=at(()=>{if(M.current){const L=dt(s.floating).body;L.style.pointerEvents="",L.removeAttribute(Xd),M.current=!1}}),_=at(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);y.useEffect(()=>{if(!l)return;function L(K){if(Ge(w),S.current=!1,u&&!oa(x.current)||sl(C.current)>0&&!il(v.current,"open"))return;const Z=il(v.current,"open",x.current);Z?w.current=window.setTimeout(()=>{b.current||r(!0,K,"hover")},Z):n||r(!0,K,"hover")}function T(K){if(_()){I();return}N.current();const Z=dt(s.floating);if(Ge(k),P.current=!1,m.current&&o.current.floatingContext){n||Ge(w),E.current=m.current({...o.current.floatingContext,tree:h,x:K.clientX,y:K.clientY,onClose(){I(),H(),_()||U(K,!0,"safe-polygon")}});const le=E.current;Z.addEventListener("mousemove",le),N.current=()=>{Z.removeEventListener("mousemove",le)};return}(x.current==="touch"?!sr(s.floating,K.relatedTarget):!0)&&U(K)}function R(K){_()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:h,x:K.clientX,y:K.clientY,onClose(){I(),H(),_()||U(K)}})(K))}function W(){Ge(w)}function ee(K){_()||U(K,!1)}if(oe(s.domReference)){const K=s.domReference,Z=s.floating;return n&&K.addEventListener("mouseleave",R),f&&K.addEventListener("mousemove",L,{once:!0}),K.addEventListener("mouseenter",L),K.addEventListener("mouseleave",T),Z&&(Z.addEventListener("mouseleave",R),Z.addEventListener("mouseenter",W),Z.addEventListener("mouseleave",ee)),()=>{n&&K.removeEventListener("mouseleave",R),f&&K.removeEventListener("mousemove",L),K.removeEventListener("mouseenter",L),K.removeEventListener("mouseleave",T),Z&&(Z.removeEventListener("mouseleave",R),Z.removeEventListener("mouseenter",W),Z.removeEventListener("mouseleave",ee))}}},[s,l,t,u,f,U,H,I,r,n,b,h,v,m,o,_,C]),ot(()=>{var L;if(l&&n&&(L=m.current)!=null&&(L=L.__options)!=null&&L.blockPointerEvents&&z()){M.current=!0;const R=s.floating;if(oe(s.domReference)&&R){var T;const W=dt(s.floating).body;W.setAttribute(Xd,"");const ee=s.domReference,K=h==null||(T=h.nodesRef.current.find(Z=>Z.id===p))==null||(T=T.context)==null?void 0:T.elements.floating;return K&&(K.style.pointerEvents=""),W.style.pointerEvents="none",ee.style.pointerEvents="auto",R.style.pointerEvents="auto",()=>{W.style.pointerEvents="",ee.style.pointerEvents="",R.style.pointerEvents=""}}}},[l,n,p,s,h,m,z]),ot(()=>{n||(x.current=void 0,P.current=!1,H(),I())},[n,H,I]),y.useEffect(()=>()=>{H(),Ge(w),Ge(k),I()},[l,s.domReference,H,I]);const F=y.useMemo(()=>{function L(T){x.current=T.pointerType}return{onPointerDown:L,onPointerEnter:L,onMouseMove(T){const{nativeEvent:R}=T;function W(){!S.current&&!b.current&&r(!0,R,"hover")}u&&!oa(x.current)||n||sl(C.current)===0||P.current&&T.movementX**2+T.movementY**2<2||(Ge(k),x.current==="touch"?W():(P.current=!0,k.current=window.setTimeout(W,sl(C.current))))}}},[u,r,n,b,C]);return y.useMemo(()=>l?{reference:F}:{},[l,F])}const Qd=()=>{},S5=y.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:Qd,setState:Qd,isInstantPhase:!1});function k5(t){const{children:e,delay:n,timeoutMs:r=0}=t,[o,i]=y.useReducer((a,c)=>({...a,...c}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),s=y.useRef(null),l=y.useCallback(a=>{i({currentId:a})},[]);return ot(()=>{o.currentId?s.current===null?s.current=o.currentId:o.isInstantPhase||i({isInstantPhase:!0}):(o.isInstantPhase&&i({isInstantPhase:!1}),s.current=null)},[o.currentId,o.isInstantPhase]),g.jsx(S5.Provider,{value:y.useMemo(()=>({...o,setState:i,setCurrentId:l}),[o,l]),children:e})}const Pm={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},ef=y.forwardRef(function(e,n){const[r,o]=y.useState();ot(()=>{vm()&&o("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[no("focus-guard")]:"",style:Pm};return g.jsx("span",{...e,...i})}),jm=y.createContext(null),tf=no("portal");function E5(t){t===void 0&&(t={});const{id:e,root:n}=t,r=dc(),o=T5(),[i,s]=y.useState(null),l=y.useRef(null);return ot(()=>()=>{i?.remove(),queueMicrotask(()=>{l.current=null})},[i]),ot(()=>{if(!r||l.current)return;const a=e?document.getElementById(e):null;if(!a)return;const c=document.createElement("div");c.id=r,c.setAttribute(tf,""),a.appendChild(c),l.current=c,s(c)},[e,r]),ot(()=>{if(n===null||!r||l.current)return;let a=n||o?.portalNode;a&&!ic(a)&&(a=a.current),a=a||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,a.appendChild(c));const u=document.createElement("div");u.id=r,u.setAttribute(tf,""),a=c||a,a.appendChild(u),l.current=u,s(u)},[e,n,r,o]),i}function M5(t){const{children:e,id:n,root:r,preserveTabOrder:o=!0}=t,i=E5({id:n,root:r}),[s,l]=y.useState(null),a=y.useRef(null),c=y.useRef(null),u=y.useRef(null),d=y.useRef(null),f=s?.modal,h=s?.open,p=!!s&&!s.modal&&s.open&&o&&!!(r||i);return y.useEffect(()=>{if(!i||!o||f)return;function m(v){i&&nl(v)&&(v.type==="focusin"?Hd:T4)(i)}return i.addEventListener("focusin",m,!0),i.addEventListener("focusout",m,!0),()=>{i.removeEventListener("focusin",m,!0),i.removeEventListener("focusout",m,!0)}},[i,o,f]),y.useEffect(()=>{i&&(h||Hd(i))},[h,i]),g.jsxs(jm.Provider,{value:y.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:d,portalNode:i,setFocusManagerState:l}),[o,i]),children:[p&&i&&g.jsx(ef,{"data-type":"outside",ref:a,onFocus:m=>{if(nl(m,i)){var v;(v=u.current)==null||v.focus()}else{const b=s?s.domReference:null,C=M4(b);C?.focus()}}}),p&&i&&g.jsx("span",{"aria-owns":i.id,style:Pm}),i&&pa.createPortal(e,i),p&&i&&g.jsx(ef,{"data-type":"outside",ref:c,onFocus:m=>{if(nl(m,i)){var v;(v=d.current)==null||v.focus()}else{const b=s?s.domReference:null,C=E4(b);C?.focus(),s?.closeOnFocusOut&&s?.onOpenChange(!1,m.nativeEvent,"focus-out")}}})]})}const T5=()=>y.useContext(jm),A5={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},R5={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},nf=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function O5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=t,{enabled:s=!0,escapeKey:l=!0,outsidePress:a=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:d="pointerdown",ancestorScroll:f=!1,bubbles:h,capture:p}=e,m=hc(),v=at(typeof a=="function"?a:()=>!1),b=typeof a=="function"?v:a,C=y.useRef(!1),{escapeKey:x,outsidePress:w}=nf(h),{escapeKey:E,outsidePress:k}=nf(p),S=y.useRef(!1),M=at(I=>{var _;if(!n||!s||!l||I.key!=="Escape"||S.current)return;const F=(_=i.current.floatingContext)==null?void 0:_.nodeId,L=m?_o(m.nodesRef.current,F):[];if(!x&&(I.stopPropagation(),L.length>0)){let T=!0;if(L.forEach(R=>{var W;if((W=R.context)!=null&&W.open&&!R.context.dataRef.current.__escapeKeyBubbles){T=!1;return}}),!T)return}r(!1,b4(I)?I.nativeEvent:I,"escape-key")}),N=at(I=>{var _;const F=()=>{var L;M(I),(L=Gn(I))==null||L.removeEventListener("keydown",F)};(_=Gn(I))==null||_.addEventListener("keydown",F)}),P=at(I=>{var _;const F=i.current.insideReactTree;i.current.insideReactTree=!1;const L=C.current;if(C.current=!1,c==="click"&&L||F||typeof b=="function"&&!b(I))return;const T=Gn(I),R="["+no("inert")+"]",W=dt(o.floating).querySelectorAll(R);let ee=oe(T)?T:null;for(;ee&&!It(ee);){const le=Lt(ee);if(It(le)||!oe(le))break;ee=le}if(W.length&&oe(T)&&!m4(T)&&!sr(T,o.floating)&&Array.from(W).every(le=>!sr(ee,le)))return;if(Ue(T)&&H){const le=It(T),ge=tt(T),Y=/auto|scroll/,te=le||Y.test(ge.overflowX),Ke=le||Y.test(ge.overflowY),bt=te&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,Bn=Ke&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,Cs=ge.direction==="rtl",_n=Bn&&(Cs?I.offsetX<=T.offsetWidth-T.clientWidth:I.offsetX>T.clientWidth),M0=bt&&I.offsetY>T.clientHeight;if(_n||M0)return}const K=(_=i.current.floatingContext)==null?void 0:_.nodeId,Z=m&&_o(m.nodesRef.current,K).some(le=>{var ge;return tl(I,(ge=le.context)==null?void 0:ge.elements.floating)});if(tl(I,o.floating)||tl(I,o.domReference)||Z)return;const We=m?_o(m.nodesRef.current,K):[];if(We.length>0){let le=!0;if(We.forEach(ge=>{var Y;if((Y=ge.context)!=null&&Y.open&&!ge.context.dataRef.current.__outsidePressBubbles){le=!1;return}}),!le)return}r(!1,I,"outside-press")}),z=at(I=>{var _;const F=()=>{var L;P(I),(L=Gn(I))==null||L.removeEventListener(c,F)};(_=Gn(I))==null||_.addEventListener(c,F)});y.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=x,i.current.__outsidePressBubbles=w;let I=-1;function _(W){r(!1,W,"ancestor-scroll")}function F(){window.clearTimeout(I),S.current=!0}function L(){I=window.setTimeout(()=>{S.current=!1},rs()?5:0)}const T=dt(o.floating);l&&(T.addEventListener("keydown",E?N:M,E),T.addEventListener("compositionstart",F),T.addEventListener("compositionend",L)),b&&T.addEventListener(c,k?z:P,k);let R=[];return f&&(oe(o.domReference)&&(R=rn(o.domReference)),oe(o.floating)&&(R=R.concat(rn(o.floating))),!oe(o.reference)&&o.reference&&o.reference.contextElement&&(R=R.concat(rn(o.reference.contextElement)))),R=R.filter(W=>{var ee;return W!==((ee=T.defaultView)==null?void 0:ee.visualViewport)}),R.forEach(W=>{W.addEventListener("scroll",_,{passive:!0})}),()=>{l&&(T.removeEventListener("keydown",E?N:M,E),T.removeEventListener("compositionstart",F),T.removeEventListener("compositionend",L)),b&&T.removeEventListener(c,k?z:P,k),R.forEach(W=>{W.removeEventListener("scroll",_)}),window.clearTimeout(I)}},[i,o,l,b,c,n,r,f,s,x,w,M,E,N,P,k,z]),y.useEffect(()=>{i.current.insideReactTree=!1},[i,b,c]);const U=y.useMemo(()=>({onKeyDown:M,...u&&{[A5[d]]:I=>{r(!1,I.nativeEvent,"reference-press")},...d!=="click"&&{onClick(I){r(!1,I.nativeEvent,"reference-press")}}}}),[M,r,u,d]),H=y.useMemo(()=>({onKeyDown:M,onMouseDown(){C.current=!0},onMouseUp(){C.current=!0},[R5[c]]:()=>{i.current.insideReactTree=!0}}),[M,c,i]);return y.useMemo(()=>s?{reference:U,floating:H}:{},[s,U,H])}function N5(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=dc(),i=y.useRef({}),[s]=y.useState(()=>b5()),l=fc()!=null;if(process.env.NODE_ENV!=="production"){const h=r.reference;h&&!oe(h)&&v5("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=y.useState(r.reference),u=at((h,p,m)=>{i.current.openEvent=h?p:void 0,s.emit("openchange",{open:h,event:p,reason:m,nested:l}),n?.(h,p,m)}),d=y.useMemo(()=>({setPositionReference:c}),[]),f=y.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return y.useMemo(()=>({dataRef:i,open:e,onOpenChange:u,elements:f,events:s,floatingId:o,refs:d}),[e,u,f,s,o,d])}function I5(t){t===void 0&&(t={});const{nodeId:e}=t,n=N5({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[i,s]=y.useState(null),[l,a]=y.useState(null),u=o?.domReference||i,d=y.useRef(null),f=hc();ot(()=>{u&&(d.current=u)},[u]);const h=Om({...t,elements:{...o,...l&&{reference:l}}}),p=y.useCallback(x=>{const w=oe(x)?{getBoundingClientRect:()=>x.getBoundingClientRect(),getClientRects:()=>x.getClientRects(),contextElement:x}:x;a(w),h.refs.setReference(w)},[h.refs]),m=y.useCallback(x=>{(oe(x)||x===null)&&(d.current=x,s(x)),(oe(h.refs.reference.current)||h.refs.reference.current===null||x!==null&&!oe(x))&&h.refs.setReference(x)},[h.refs]),v=y.useMemo(()=>({...h.refs,setReference:m,setPositionReference:p,domReference:d}),[h.refs,m,p]),b=y.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),C=y.useMemo(()=>({...h,...r,refs:v,elements:b,nodeId:e}),[h,v,b,e,r]);return ot(()=>{r.dataRef.current.floatingContext=C;const x=f?.nodesRef.current.find(w=>w.id===e);x&&(x.context=C)}),y.useMemo(()=>({...h,context:C,refs:v,elements:b}),[h,v,b,C])}function ll(){return f4()&&vm()}function L5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,events:o,dataRef:i,elements:s}=t,{enabled:l=!0,visibleOnly:a=!0}=e,c=y.useRef(!1),u=y.useRef(-1),d=y.useRef(!0);y.useEffect(()=>{if(!l)return;const h=Fe(s.domReference);function p(){!n&&Ue(s.domReference)&&s.domReference===ra(dt(s.domReference))&&(c.current=!0)}function m(){d.current=!0}function v(){d.current=!1}return h.addEventListener("blur",p),ll()&&(h.addEventListener("keydown",m,!0),h.addEventListener("pointerdown",v,!0)),()=>{h.removeEventListener("blur",p),ll()&&(h.removeEventListener("keydown",m,!0),h.removeEventListener("pointerdown",v,!0))}},[s.domReference,n,l]),y.useEffect(()=>{if(!l)return;function h(p){let{reason:m}=p;(m==="reference-press"||m==="escape-key")&&(c.current=!0)}return o.on("openchange",h),()=>{o.off("openchange",h)}},[o,l]),y.useEffect(()=>()=>{Ge(u)},[]);const f=y.useMemo(()=>({onMouseLeave(){c.current=!1},onFocus(h){if(c.current)return;const p=Gn(h.nativeEvent);if(a&&oe(p)){if(ll()&&!h.relatedTarget){if(!d.current&&!g4(p))return}else if(!y4(p))return}r(!0,h.nativeEvent,"focus")},onBlur(h){c.current=!1;const p=h.relatedTarget,m=h.nativeEvent,v=oe(p)&&p.hasAttribute(no("focus-guard"))&&p.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var b;const C=ra(s.domReference?s.domReference.ownerDocument:document);!p&&C===s.domReference||sr((b=i.current.floatingContext)==null?void 0:b.refs.floating.current,C)||sr(s.domReference,C)||v||r(!1,m,"focus")})}}),[i,s.domReference,r,a]);return y.useMemo(()=>l?{reference:f}:{},[l,f])}function al(t,e,n){const r=new Map,o=n==="item";let i=t;if(o&&t){const{[Gd]:s,[Jd]:l,...a}=t;i=a}return{...n==="floating"&&{tabIndex:-1,[h5]:""},...i,...e.map(s=>{const l=s?s[n]:null;return typeof l=="function"?t?l(t):null:l}).concat(t).reduce((s,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[Gd,Jd].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),s[c]=function(){for(var f,h=arguments.length,p=new Array(h),m=0;m<h;m++)p[m]=arguments[m];return(f=r.get(c))==null?void 0:f.map(v=>v(...p)).find(v=>v!==void 0)}}}else s[c]=u}),s),{})}}function D5(t){t===void 0&&(t=[]);const e=t.map(l=>l?.reference),n=t.map(l=>l?.floating),r=t.map(l=>l?.item),o=y.useCallback(l=>al(l,t,"reference"),e),i=y.useCallback(l=>al(l,t,"floating"),n),s=y.useCallback(l=>al(l,t,"item"),r);return y.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}const P5=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function j5(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:i,floatingId:s}=t,{enabled:l=!0,role:a="dialog"}=e,c=dc(),u=((n=i.domReference)==null?void 0:n.id)||c,d=y.useMemo(()=>{var C;return((C=v4(i.floating))==null?void 0:C.id)||s},[i.floating,s]),f=(r=P5.get(a))!=null?r:a,p=fc()!=null,m=y.useMemo(()=>f==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":o?d:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:u},...f==="menu"&&p&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[f,d,p,o,u,a]),v=y.useMemo(()=>{const C={id:d,...f&&{role:f}};return f==="tooltip"||a==="label"?C:{...C,...f==="menu"&&{"aria-labelledby":u}}},[f,d,u,a]),b=y.useCallback(C=>{let{active:x,selected:w}=C;const E={role:"option",...x&&{id:d+"-fui-option"}};switch(a){case"select":case"combobox":return{...E,"aria-selected":w}}return{}},[d,a]);return y.useMemo(()=>l?{reference:m,floating:v,item:b}:{},[l,m,v,b])}function B5({initialOpen:t=!1,placement:e="top",open:n,onOpenChange:r,delay:o=600,closeDelay:i=0}={}){const[s,l]=y.useState(t),a=n??s,c=r??l,u=I5({placement:e,open:a,onOpenChange:c,whileElementsMounted:Am,middleware:[Nm(4),Lm({crossAxis:e.includes("-"),fallbackAxisSideDirection:"start",padding:4}),Im({padding:4})]}),d=u.context,f=w5(d,{mouseOnly:!0,move:!1,restMs:o,enabled:n==null,delay:{close:i}}),h=L5(d,{enabled:n==null}),p=O5(d),m=j5(d,{role:"tooltip"}),v=D5([f,h,p,m]);return y.useMemo(()=>({open:a,setOpen:c,...v,...u}),[a,c,v,u])}const sa=y.createContext(null);function Bm(){const t=y.useContext(sa);if(t==null)throw new Error("Tooltip components must be wrapped in <TooltipProvider />");return t}function _m({children:t,...e}){const n=B5(e);return e.useDelayGroup?g.jsx(k5,{delay:{open:e.delay??0,close:e.closeDelay??0},timeoutMs:e.timeout,children:g.jsx(sa.Provider,{value:n,children:t})}):g.jsx(sa.Provider,{value:n,children:t})}const Hm=y.forwardRef(function({children:e,asChild:n=!1,...r},o){const i=Bm(),s=y.isValidElement(e)?parseInt(y.version,10)>=19?e.props.ref:e.ref:void 0,l=Dm([i.refs.setReference,o,s]);if(n&&y.isValidElement(e)){const a={"data-tooltip-state":i.open?"open":"closed"};return y.cloneElement(e,i.getReferenceProps({ref:l,...r,...typeof e.props=="object"?e.props:{},...a}))}return g.jsx("button",{ref:l,"data-tooltip-state":i.open?"open":"closed",...i.getReferenceProps(r),children:e})}),Fm=y.forwardRef(function({style:e,children:n,portal:r=!0,portalProps:o={},...i},s){const l=Bm(),a=Dm([l.refs.setFloating,s]);if(!l.open)return null;const c=g.jsx("div",{ref:a,style:{...l.floatingStyles,...e},...l.getFloatingProps(i),className:"tiptap-tooltip",children:n});return r?g.jsx(M5,{...o,children:c}):c});_m.displayName="Tooltip";Hm.displayName="TooltipTrigger";Fm.displayName="TooltipContent";const la=5*1024*1024,_5={mod:"⌘",command:"⌘",meta:"⌘",ctrl:"⌃",control:"⌃",alt:"⌥",option:"⌥",shift:"⇧",backspace:"Del",delete:"⌦",enter:"⏎",escape:"⎋",capslock:"⇪"};function Me(...t){return t.filter(Boolean).join(" ")}function H5(){return typeof navigator<"u"&&navigator.platform.toLowerCase().includes("mac")}const F5=(t,e,n=!0)=>{if(e){const r=t.toLowerCase();return _5[r]||(n?t.toUpperCase():t)}return n?t.charAt(0).toUpperCase()+t.slice(1):t},gt=t=>{const{shortcutKeys:e,delimiter:n="+",capitalize:r=!0}=t;return e?e.split(n).map(o=>o.trim()).map(o=>F5(o,H5(),r)):[]},ro=(t,e)=>e?.schema?e.schema.spec.marks.get(t)!==void 0:!1,_t=(t,e)=>e?.schema?e.schema.spec.nodes.get(t)!==void 0:!1;function $5(t){const{state:e,view:n}=t,{doc:r,selection:o}=e,i=q.findFrom(o.$to,1,!0);if(i)return n.dispatch(e.tr.setSelection(i).scrollIntoView()),!0;const s=e.schema.nodes.paragraph;if(!s)return console.warn("No paragraph node type found in schema."),!1;const l=r.content.size,a=s.create();let c=e.tr.insert(l,a);const u=c.doc.resolve(l+1);return c=c.setSelection(V.near(u)).scrollIntoView(),n.dispatch(c),!0}function yt(t){return typeof t=="number"&&t>=0}function ls(t,e){if(!t)return!1;const n=Array.isArray(e)?e:[e],r=n.some(o=>t.extensionManager.extensions.some(i=>i.name===o));return r||console.warn(`None of the extensions [${n.join(", ")}] were found in the editor schema. Ensure they are included in the editor configuration.`),r}function V5(t,e){try{const n=t.state.doc.nodeAt(e);return n||(console.warn(`No node found at position ${e}`),null)}catch(n){return console.error(`Error getting node at position ${e}:`,n),null}}function hn(t){const{editor:e,node:n,nodePos:r}=t;if(!e||!e.state?.doc)return null;const o=n!=null,i=yt(r);if(!o&&!i)return null;if(o){let s=-1,l=null;if(e.state.doc.descendants((a,c)=>a===n?(s=c,l=a,!1):!0),s!==-1&&l!==null)return{pos:s,node:l}}if(i){const s=V5(e,r);if(s)return{pos:r,node:s}}return null}function Ht(t,e=[]){if(!t||!t.state.selection)return!1;const{state:n}=t,{selection:r}=n;if(r.empty)return!1;if(r instanceof B){const o=r.node;return o?e.includes(o.type.name):!1}return!1}const z5=async(t,e,n)=>{if(!t)throw new Error("No file provided");if(t.size>la)throw new Error(`File size exceeds maximum allowed (${la/(1024*1024)}MB)`);for(let r=0;r<=100;r+=10){if(n?.aborted)throw new Error("Upload cancelled");await new Promise(o=>setTimeout(o,500)),e?.({progress:r})}return"/images/tiptap-ui-placeholder-image.jpg"},U5=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function W5(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return!t||t.replace(U5,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}function K5(t,e,n){try{const r=new URL(t,e);if(W5(r.href,n))return r.href}catch{}return"#"}const q5=({shortcuts:t})=>t.length===0?null:g.jsx("div",{children:t.map((e,n)=>g.jsxs(y.Fragment,{children:[n>0&&g.jsx("kbd",{children:"+"}),g.jsx("kbd",{children:e})]},n))}),fe=y.forwardRef(({className:t,children:e,tooltip:n,showTooltip:r=!0,shortcutKeys:o,"aria-label":i,...s},l)=>{const a=y.useMemo(()=>gt({shortcutKeys:o}),[o]);return!n||!r?g.jsx("button",{className:Me("tiptap-button",t),ref:l,"aria-label":i,...s,children:e}):g.jsxs(_m,{delay:200,children:[g.jsx(Hm,{className:Me("tiptap-button",t),ref:l,"aria-label":i,...s,children:e}),g.jsxs(Fm,{children:[n,g.jsx(q5,{shortcuts:a})]})]})});fe.displayName="Button";const In=y.forwardRef(({className:t,children:e,orientation:n="vertical",...r},o)=>g.jsx("div",{ref:o,className:Me("tiptap-button-group",t),"data-orientation":n,role:"group",...r,children:e}));In.displayName="ButtonGroup";function rf({orientation:t="horizontal",size:e,style:n={},...r}){const o={...n,...t==="horizontal"&&!e&&{flex:1},...e&&{width:t==="vertical"?"1px":e,height:t==="horizontal"?"1px":e}};return g.jsx("div",{...r,style:o})}const as=y.forwardRef(({decorative:t,orientation:e="vertical",className:n,...r},o)=>{const s=t?{role:"none"}:{"aria-orientation":e==="vertical"?e:void 0,role:"separator"};return g.jsx("div",{className:Me("tiptap-separator",n),"data-orientation":e,...s,...r,ref:o})});as.displayName="Separator";function $m({editor:t,containerRef:e,query:n,items:r,onSelect:o,onClose:i,orientation:s="vertical",autoSelectFirstItem:l=!0}){const[a,c]=y.useState(l?0:-1);return y.useEffect(()=>{const u=f=>{if(!r.length)return!1;const h=()=>c(m=>m===-1?0:(m+1)%r.length),p=()=>c(m=>m===-1?r.length-1:(m-1+r.length)%r.length);switch(f.key){case"ArrowUp":return s==="horizontal"?!1:(f.preventDefault(),p(),!0);case"ArrowDown":return s==="horizontal"?!1:(f.preventDefault(),h(),!0);case"ArrowLeft":return s==="vertical"?!1:(f.preventDefault(),p(),!0);case"ArrowRight":return s==="vertical"?!1:(f.preventDefault(),h(),!0);case"Tab":return f.preventDefault(),f.shiftKey?p():h(),!0;case"Home":return f.preventDefault(),c(0),!0;case"End":return f.preventDefault(),c(r.length-1),!0;case"Enter":return f.isComposing?!1:(f.preventDefault(),a!==-1&&r[a]&&o?.(r[a]),!0);case"Escape":return f.preventDefault(),i?.(),!0;default:return!1}};let d=null;if(t?d=t.view.dom:e?.current&&(d=e.current),d)return d.addEventListener("keydown",u,!0),()=>{d?.removeEventListener("keydown",u,!0)}},[t,e,r,a,o,i,s]),y.useEffect(()=>{n&&c(l?0:-1)},[n,l]),{selectedIndex:r.length?a:void 0,setSelectedIndex:c}}const of=(t,e)=>{typeof t=="function"?t(e):t&&typeof t=="object"&&"current"in t&&(t.current=e)},G5=(t,e)=>{const n=y.useRef(null);return y.useCallback(r=>{t&&"current"in t&&(t.current=r),n.current&&of(n.current,null),n.current=e,e&&of(e,r)},[t,e])},J5=t=>{const[e,n]=y.useState([]),r=y.useCallback(()=>t.current?Array.from(t.current.querySelectorAll('button:not([disabled]), [role="button"]:not([disabled]), [tabindex="0"]:not([disabled])')):[],[t]);y.useEffect(()=>{const i=t.current;if(!i)return;const s=()=>n(r());s();const l=new MutationObserver(s);return l.observe(i,{childList:!0,subtree:!0}),()=>l.disconnect()},[r,t]);const{selectedIndex:o}=$m({containerRef:t,items:e,orientation:"horizontal",onSelect:i=>i.click(),autoSelectFirstItem:!1});y.useEffect(()=>{const i=t.current;if(!i)return;const s=a=>{const c=a.target;i.contains(c)&&c.setAttribute("data-focus-visible","true")},l=a=>{const c=a.target;i.contains(c)&&c.removeAttribute("data-focus-visible")};return i.addEventListener("focus",s,!0),i.addEventListener("blur",l,!0),()=>{i.removeEventListener("focus",s,!0),i.removeEventListener("blur",l,!0)}},[t]),y.useEffect(()=>{o!==void 0&&e[o]&&e[o].focus()},[o,e])},pc=y.forwardRef(({children:t,className:e,variant:n="fixed",...r},o)=>{const i=y.useRef(null),s=G5(i,o);return J5(i),g.jsx("div",{ref:s,role:"toolbar","aria-label":"toolbar","data-variant":n,className:Me("tiptap-toolbar",e),...r,children:t})});pc.displayName="Toolbar";const Mt=y.forwardRef(({children:t,className:e,...n},r)=>g.jsx("div",{ref:r,role:"group",className:Me("tiptap-toolbar-group",e),...n,children:t}));Mt.displayName="ToolbarGroup";const Tt=y.forwardRef(({...t},e)=>g.jsx(as,{ref:e,orientation:"vertical",decorative:!0,...t}));Tt.displayName="ToolbarSeparator";const Vm=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M18.7071 6.70711C19.0976 6.31658 19.0976 5.68342 18.7071 5.29289C18.3166 4.90237 17.6834 4.90237 17.2929 5.29289L12 10.5858L6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L10.5858 12L5.29289 17.2929C4.90237 17.6834 4.90237 18.3166 5.29289 18.7071C5.68342 19.0976 6.31658 19.0976 6.70711 18.7071L12 13.4142L17.2929 18.7071C17.6834 19.0976 18.3166 19.0976 18.7071 18.7071C19.0976 18.3166 19.0976 17.6834 18.7071 17.2929L13.4142 12L18.7071 6.70711Z",fill:"currentColor"})}));Vm.displayName="CloseIcon";function Z5(t){const[e,n]=y.useState([]),r=async l=>{if(l.size>t.maxSize){const d=new Error(`File size exceeds maximum allowed (${t.maxSize/1024/1024}MB)`);return t.onError?.(d),null}const a=new AbortController,c=crypto.randomUUID(),u={id:c,file:l,progress:0,status:"uploading",abortController:a};n(d=>[...d,u]);try{if(!t.upload)throw new Error("Upload function is not defined");const d=await t.upload(l,f=>{n(h=>h.map(p=>p.id===c?{...p,progress:f.progress}:p))},a.signal);if(!d)throw new Error("Upload failed: No URL returned");return a.signal.aborted?null:(n(f=>f.map(h=>h.id===c?{...h,status:"success",url:d,progress:100}:h)),t.onSuccess?.(d),d)}catch(d){return a.signal.aborted||(n(f=>f.map(h=>h.id===c?{...h,status:"error",progress:0}:h)),t.onError?.(d instanceof Error?d:new Error("Upload failed"))),null}};return{fileItems:e,uploadFiles:async l=>{if(!l||l.length===0)return t.onError?.(new Error("No files to upload")),[];if(t.limit&&l.length>t.limit)return t.onError?.(new Error(`Maximum ${t.limit} file${t.limit===1?"":"s"} allowed`)),[];const a=l.map(u=>r(u));return(await Promise.all(a)).filter(u=>u!==null)},removeFileItem:l=>{n(a=>{const c=a.find(u=>u.id===l);return c?.abortController&&c.abortController.abort(),c?.url&&URL.revokeObjectURL(c.url),a.filter(u=>u.id!==l)})},clearAllFiles:()=>{e.forEach(l=>{l.abortController&&l.abortController.abort(),l.url&&URL.revokeObjectURL(l.url)}),n([])}}}const zm=()=>g.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",className:"tiptap-image-upload-icon",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[g.jsx("path",{d:"M11.1953 4.41771C10.3478 4.08499 9.43578 3.94949 8.5282 4.02147C7.62062 4.09345 6.74133 4.37102 5.95691 4.83316C5.1725 5.2953 4.50354 5.92989 4.00071 6.68886C3.49788 7.44783 3.17436 8.31128 3.05465 9.2138C2.93495 10.1163 3.0222 11.0343 3.3098 11.8981C3.5974 12.7619 4.07781 13.5489 4.71463 14.1995C5.10094 14.5942 5.09414 15.2274 4.69945 15.6137C4.30476 16 3.67163 15.9932 3.28532 15.5985C2.43622 14.731 1.79568 13.6816 1.41221 12.5299C1.02875 11.3781 0.91241 10.1542 1.07201 8.95084C1.23162 7.74748 1.66298 6.59621 2.33343 5.58425C3.00387 4.57229 3.89581 3.72617 4.9417 3.10998C5.98758 2.4938 7.15998 2.1237 8.37008 2.02773C9.58018 1.93176 10.7963 2.11243 11.9262 2.55605C13.0561 2.99968 14.0703 3.69462 14.8919 4.58825C15.5423 5.29573 16.0585 6.11304 16.4177 7.00002H17.4999C18.6799 6.99991 19.8288 7.37933 20.7766 8.08222C21.7245 8.78515 22.4212 9.7743 22.7637 10.9036C23.1062 12.0328 23.0765 13.2423 22.6788 14.3534C22.2812 15.4644 21.5367 16.4181 20.5554 17.0736C20.0962 17.3803 19.4752 17.2567 19.1684 16.7975C18.8617 16.3382 18.9853 15.7172 19.4445 15.4105C20.069 14.9934 20.5427 14.3865 20.7958 13.6794C21.0488 12.9724 21.0678 12.2027 20.8498 11.4841C20.6318 10.7655 20.1885 10.136 19.5853 9.6887C18.9821 9.24138 18.251 8.99993 17.5001 9.00002H15.71C15.2679 9.00002 14.8783 8.70973 14.7518 8.28611C14.4913 7.41374 14.0357 6.61208 13.4195 5.94186C12.8034 5.27164 12.0427 4.75043 11.1953 4.41771Z",fill:"currentColor"}),g.jsx("path",{d:"M11 14.4142V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V14.4142L15.2929 16.7071C15.6834 17.0976 16.3166 17.0976 16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929L12.7078 11.2936C12.7054 11.2912 12.703 11.2888 12.7005 11.2864C12.5208 11.1099 12.2746 11.0008 12.003 11L12 11L11.997 11C11.8625 11.0004 11.7343 11.0273 11.6172 11.0759C11.502 11.1236 11.3938 11.1937 11.2995 11.2864C11.297 11.2888 11.2946 11.2912 11.2922 11.2936L7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071C7.68342 17.0976 8.31658 17.0976 8.70711 16.7071L11 14.4142Z",fill:"currentColor"})]}),Y5=()=>g.jsx("svg",{width:"43",height:"57",viewBox:"0 0 43 57",fill:"currentColor",className:"tiptap-image-upload-dropzone-rect-primary",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M0.75 10.75C0.75 5.64137 4.89137 1.5 10 1.5H32.3431C33.2051 1.5 34.0317 1.84241 34.6412 2.4519L40.2981 8.10876C40.9076 8.71825 41.25 9.5449 41.25 10.4069V46.75C41.25 51.8586 37.1086 56 32 56H10C4.89137 56 0.75 51.8586 0.75 46.75V10.75Z",fill:"currentColor",fillOpacity:"0.11",stroke:"currentColor",strokeWidth:"1.5"})}),X5=()=>g.jsx("svg",{width:"10",height:"10",className:"tiptap-image-upload-dropzone-rect-secondary",viewBox:"0 0 10 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M0 0.75H0.343146C1.40401 0.75 2.42143 1.17143 3.17157 1.92157L8.82843 7.57843C9.57857 8.32857 10 9.34599 10 10.4069V10.75H4C1.79086 10.75 0 8.95914 0 6.75V0.75Z",fill:"currentColor"})}),Q5=({onFile:t,children:e})=>{const[n,r]=y.useState(!1),[o,i]=y.useState(!1),s=u=>{u.preventDefault(),u.stopPropagation(),i(!0)},l=u=>{u.preventDefault(),u.stopPropagation(),u.currentTarget.contains(u.relatedTarget)||(i(!1),r(!1))},a=u=>{u.preventDefault(),u.stopPropagation(),r(!0)},c=u=>{u.preventDefault(),u.stopPropagation(),i(!1),r(!1);const d=Array.from(u.dataTransfer.files);d.length>0&&t(d)};return g.jsx("div",{className:`tiptap-image-upload-drag-area ${o?"drag-active":""} ${n?"drag-over":""}`,onDragEnter:s,onDragLeave:l,onDragOver:a,onDrop:c,children:e})},e3=({fileItem:t,onRemove:e})=>{const n=r=>{if(r===0)return"0 Bytes";const o=1024,i=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(r)/Math.log(o));return`${parseFloat((r/Math.pow(o,s)).toFixed(2))} ${i[s]}`};return g.jsxs("div",{className:"tiptap-image-upload-preview",children:[t.status==="uploading"&&g.jsx("div",{className:"tiptap-image-upload-progress",style:{width:`${t.progress}%`}}),g.jsxs("div",{className:"tiptap-image-upload-preview-content",children:[g.jsxs("div",{className:"tiptap-image-upload-file-info",children:[g.jsx("div",{className:"tiptap-image-upload-file-icon",children:g.jsx(zm,{})}),g.jsxs("div",{className:"tiptap-image-upload-details",children:[g.jsx("span",{className:"tiptap-image-upload-text",children:t.file.name}),g.jsx("span",{className:"tiptap-image-upload-subtext",children:n(t.file.size)})]})]}),g.jsxs("div",{className:"tiptap-image-upload-actions",children:[t.status==="uploading"&&g.jsxs("span",{className:"tiptap-image-upload-progress-text",children:[t.progress,"%"]}),g.jsx(fe,{type:"button","data-style":"ghost",onClick:r=>{r.stopPropagation(),e()},children:g.jsx(Vm,{className:"tiptap-button-icon"})})]})]})]})},t3=({maxSize:t,limit:e})=>g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"tiptap-image-upload-dropzone",children:[g.jsx(Y5,{}),g.jsx(X5,{}),g.jsx("div",{className:"tiptap-image-upload-icon-container",children:g.jsx(zm,{})})]}),g.jsxs("div",{className:"tiptap-image-upload-content",children:[g.jsxs("span",{className:"tiptap-image-upload-text",children:[g.jsx("em",{children:"Click to upload"})," or drag and drop"]}),g.jsxs("span",{className:"tiptap-image-upload-subtext",children:["Maximum ",e," file",e===1?"":"s",", ",t/1024/1024,"MB each."]})]})]}),n3=t=>{const{accept:e,limit:n,maxSize:r}=t.node.attrs,o=y.useRef(null),i=t.extension,s={maxSize:r,limit:n,accept:e,upload:i.options.upload,onSuccess:i.options.onSuccess,onError:i.options.onError},{fileItems:l,uploadFiles:a,removeFileItem:c,clearAllFiles:u}=Z5(s),d=async m=>{const v=await a(m);if(v.length>0){const b=t.getPos();if(yt(b)){const C=v.map((x,w)=>{const E=m[w]?.name.replace(/\.[^/.]+$/,"")||"unknown";return{type:i.options.type,attrs:{...i.options,src:x,alt:E,title:E}}});t.editor.chain().focus().deleteRange({from:b,to:b+t.node.nodeSize}).insertContentAt(b,C).run(),$5(t.editor)}}},f=m=>{const v=m.target.files;if(!v||v.length===0){i.options.onError?.(new Error("No file selected"));return}d(Array.from(v))},h=()=>{o.current&&l.length===0&&(o.current.value="",o.current.click())},p=l.length>0;return g.jsxs(Np,{className:"tiptap-image-upload",tabIndex:0,onClick:h,children:[!p&&g.jsx(Q5,{onFile:d,children:g.jsx(t3,{maxSize:r,limit:n})}),p&&g.jsxs("div",{className:"tiptap-image-upload-previews",children:[l.length>1&&g.jsxs("div",{className:"tiptap-image-upload-header",children:[g.jsxs("span",{children:["Uploading ",l.length," files"]}),g.jsx(fe,{type:"button","data-style":"ghost",onClick:m=>{m.stopPropagation(),u()},children:"Clear All"})]}),l.map(m=>g.jsx(e3,{fileItem:m,onRemove:()=>c(m.id)},m.id))]}),g.jsx("input",{ref:o,name:"file",accept:e,type:"file",multiple:n>1,onChange:f,onClick:m=>m.stopPropagation()})]})},r3=je.create({name:"imageUpload",group:"block",draggable:!0,atom:!0,addOptions(){return{type:"image",accept:"image/*",limit:1,maxSize:0,upload:void 0,onError:void 0,onSuccess:void 0,HTMLAttributes:{}}},addAttributes(){return{accept:{default:this.options.accept},limit:{default:this.options.limit},maxSize:{default:this.options.maxSize}}},parseHTML(){return[{tag:'div[data-type="image-upload"]'}]},renderHTML({HTMLAttributes:t}){return["div",re({"data-type":"image-upload"},t)]},addNodeView(){return Ip(n3)},addCommands(){return{setImageUploadNode:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addKeyboardShortcuts(){return{Enter:({editor:t})=>{const{selection:e}=t.state,{nodeAfter:n}=e.$from;if(n&&n.type.name==="imageUpload"&&t.isActive("imageUpload")){const r=t.view.nodeDOM(e.$from.pos);if(r&&r instanceof HTMLElement){const o=r.firstChild;if(o&&o instanceof HTMLElement)return o.click(),!0}}return!1}}}}),o3=xx.extend({renderHTML(){return["div",re(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),i3=({node:t,updateAttributes:e,selected:n})=>{const[r,o]=j.useState(!1),[i,s]=j.useState({width:t.attrs.width||300,height:t.attrs.height||"auto"}),l=j.useRef(null),a=j.useRef(null),c=j.useRef(t.attrs.width||300),u=t.attrs.imageId||`img-${Date.now()}`;j.useEffect(()=>{s({width:t.attrs.width||300,height:t.attrs.height||"auto"})},[t.attrs.width,t.attrs.height]);const d=j.useCallback(C=>{C.preventDefault(),C.stopPropagation(),o(!0);const x=C.clientX,w=typeof i.width=="number"?i.width:300,E=l.current;let k=1;E&&E.naturalWidth&&E.naturalHeight&&(k=E.naturalWidth/E.naturalHeight);const S=N=>{const P=N.clientX-x,z=Math.max(50,w+P);c.current=z;const U=i.height==="auto"?"auto":Math.max(30,z/k);s({width:z,height:U}),a.current&&(a.current.style.width=`${z}px`,U!=="auto"&&(a.current.style.height=`${U}px`))},M=()=>{o(!1);const N=Math.round(c.current);e({width:N}),document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",M)};document.addEventListener("mousemove",S),document.addEventListener("mouseup",M)},[i,e]),f=j.useCallback(()=>{i.height==="auto"&&l.current&&s(C=>({...C,height:"auto"}))},[i.width,i.height]),h=t.attrs.textAlign||"left",p=h==="center"?"center":h==="right"?"flex-end":"flex-start",m={position:"relative",display:"inline-block",width:i.width,height:i.height==="auto"?"auto":i.height,maxWidth:"100%",userSelect:r?"none":"auto",outline:n?"2px solid #007bff":"none",outlineOffset:"2px"},v={width:"100%",height:i.height==="auto"?"auto":"100%",display:"block",objectFit:"contain"},b={position:"absolute",bottom:-5,right:-5,width:12,height:12,background:"#007bff",border:"2px solid white",borderRadius:"50%",cursor:"nw-resize",opacity:n||r?1:0,transition:"opacity 0.2s ease",zIndex:10,boxShadow:"0 2px 4px rgba(0,0,0,0.2)"};return g.jsx(Np,{className:"resizable-image-wrapper","data-drag-handle":"",style:{display:"flex",justifyContent:p},children:g.jsxs("div",{ref:a,id:`resizable-image-${u}`,style:m,onMouseEnter:()=>{if(a.current){const C=a.current.querySelector(".resize-handle");C&&(C.style.opacity="1")}},onMouseLeave:()=>{if(!r&&!n&&a.current){const C=a.current.querySelector(".resize-handle");C&&(C.style.opacity="0")}},children:[g.jsx("img",{ref:l,src:t.attrs.src,alt:t.attrs.alt||"",title:t.attrs.title||"",style:v,onLoad:f,draggable:!1}),g.jsx("div",{className:"resize-handle",style:b,onMouseDown:d,title:"拖拽調整圖片大小"}),(n||r)&&g.jsxs("div",{style:{position:"absolute",top:-25,left:0,background:"rgba(0, 0, 0, 0.8)",color:"white",padding:"2px 6px",borderRadius:"3px",fontSize:"12px",whiteSpace:"nowrap",zIndex:11},children:[typeof i.width=="number"?Math.round(i.width):i.width," ","×"," ",i.height==="auto"?"auto":typeof i.height=="number"?Math.round(i.height):i.height]})]})})},s3=je.create({name:"resizableImage",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null,parseHTML:t=>{const e=t.getAttribute("width");return e?parseInt(e):null},renderHTML:t=>t.width?{width:t.width,height:"auto"}:{}},textAlign:{default:"left",parseHTML:t=>t.getAttribute("data-text-align")||"left",renderHTML:t=>!t.textAlign||t.textAlign==="left"?{}:{"data-text-align":t.textAlign}},imageId:{default:null,parseHTML:t=>t.getAttribute("data-image-id"),renderHTML:t=>t.imageId?{"data-image-id":t.imageId}:{}}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])',getAttrs:t=>{const e=t,n=e.getAttribute("width"),r=e.getAttribute("data-image-id");return{src:e.getAttribute("src"),alt:e.getAttribute("alt"),title:e.getAttribute("title"),width:n?parseInt(n):300,imageId:r||`img-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}}}]},renderHTML({HTMLAttributes:t}){return["img",re(this.options.HTMLAttributes,t)]},addCommands(){return{setResizableImage:t=>({commands:e})=>{const n=`img-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return e.insertContent({type:this.name,attrs:{...t,imageId:n,width:t.width||300}})},setImageSize:t=>({commands:e})=>e.updateAttributes(this.name,t)}},addNodeView(){return Ip(i3)}}),mc=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.29289 8.29289C5.68342 7.90237 6.31658 7.90237 6.70711 8.29289L12 13.5858L17.2929 8.29289C17.6834 7.90237 18.3166 7.90237 18.7071 8.29289C19.0976 8.68342 19.0976 9.31658 18.7071 9.70711L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70711C4.90237 9.31658 4.90237 8.68342 5.29289 8.29289Z",fill:"currentColor"})}));mc.displayName="ChevronDownIcon";function ie(t){const{editor:e}=KC(),n=y.useMemo(()=>t||e,[t,e]);return Ap({editor:n,selector(o){return o.editor?{editor:o.editor,editorState:o.editor.state,canCommand:o.editor.can}:{editor:null,editorState:void 0,canCommand:void 0}}})||{editor:null}}const vt=y.forwardRef(({variant:t,size:e="default",appearance:n="default",trimText:r=!1,className:o,children:i,...s},l)=>g.jsx("div",{ref:l,className:`tiptap-badge ${o||""}`,"data-style":t,"data-size":e,"data-appearance":n,"data-text-trim":r?"on":"off",...s,children:i}));vt.displayName="Badge";function l3({level:t,shortcutKeys:e=Xm[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Um=y.forwardRef(({editor:t,level:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,canToggle:f,isActive:h,handleToggle:p,label:m,Icon:v,shortcutKeys:b}=c3({editor:u,level:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&p()},[p,s]);return d?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":h?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":m,"aria-pressed":h,tooltip:m,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(l3,{level:e,shortcutKeys:b})]})}):null});Um.displayName="HeadingButton";const Wm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M21.0001 10C21.0001 9.63121 20.7971 9.29235 20.472 9.11833C20.1468 8.94431 19.7523 8.96338 19.4454 9.16795L16.4454 11.168C15.9859 11.4743 15.8617 12.0952 16.1681 12.5547C16.4744 13.0142 17.0953 13.1384 17.5548 12.8321L19.0001 11.8685V18C19.0001 18.5523 19.4478 19 20.0001 19C20.5524 19 21.0001 18.5523 21.0001 18V10Z",fill:"currentColor"})]}));Wm.displayName="HeadingOneIcon";const Km=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M22.0001 12C22.0001 10.7611 21.1663 9.79297 20.0663 9.42632C18.9547 9.05578 17.6171 9.28724 16.4001 10.2C15.9582 10.5314 15.8687 11.1582 16.2001 11.6C16.5314 12.0418 17.1582 12.1314 17.6001 11.8C18.383 11.2128 19.0455 11.1942 19.4338 11.3237C19.8339 11.457 20.0001 11.7389 20.0001 12C20.0001 12.4839 19.8554 12.7379 19.6537 12.9481C19.4275 13.1837 19.1378 13.363 18.7055 13.6307C18.6313 13.6767 18.553 13.7252 18.4701 13.777C17.9572 14.0975 17.3128 14.5261 16.8163 15.2087C16.3007 15.9177 16.0001 16.8183 16.0001 18C16.0001 18.5523 16.4478 19 17.0001 19H21.0001C21.5523 19 22.0001 18.5523 22.0001 18C22.0001 17.4477 21.5523 17 21.0001 17H18.131C18.21 16.742 18.3176 16.5448 18.4338 16.385C18.6873 16.0364 19.0429 15.7775 19.5301 15.473C19.5898 15.4357 19.6536 15.3966 19.7205 15.3556C20.139 15.0992 20.6783 14.7687 21.0964 14.3332C21.6447 13.7621 22.0001 13.0161 22.0001 12Z",fill:"currentColor"})]}));Km.displayName="HeadingTwoIcon";const qm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4608 11.2169C19.1135 11.0531 18.5876 11.0204 18.0069 11.3619C17.5309 11.642 16.918 11.4831 16.638 11.007C16.358 10.531 16.5169 9.91809 16.9929 9.63807C18.1123 8.97962 19.3364 8.94691 20.314 9.40808C21.2839 9.86558 21.9999 10.818 21.9999 12C21.9999 12.7957 21.6838 13.5587 21.1212 14.1213C20.5586 14.6839 19.7956 15 18.9999 15C18.4476 15 17.9999 14.5523 17.9999 14C17.9999 13.4477 18.4476 13 18.9999 13C19.2651 13 19.5195 12.8947 19.707 12.7071C19.8946 12.5196 19.9999 12.2652 19.9999 12C19.9999 11.6821 19.8159 11.3844 19.4608 11.2169Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0001 14C18.0001 13.4477 18.4478 13 19.0001 13C19.7957 13 20.5588 13.3161 21.1214 13.8787C21.684 14.4413 22.0001 15.2043 22.0001 16C22.0001 17.2853 21.2767 18.3971 20.1604 18.8994C19.0257 19.41 17.642 19.2315 16.4001 18.3C15.9582 17.9686 15.8687 17.3418 16.2001 16.9C16.5314 16.4582 17.1582 16.3686 17.6001 16.7C18.3581 17.2685 18.9744 17.24 19.3397 17.0756C19.7234 16.9029 20.0001 16.5147 20.0001 16C20.0001 15.7348 19.8947 15.4804 19.7072 15.2929C19.5196 15.1054 19.2653 15 19.0001 15C18.4478 15 18.0001 14.5523 18.0001 14Z",fill:"currentColor"})]}));qm.displayName="HeadingThreeIcon";const Gm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),g.jsx("path",{d:"M17 9C17.5523 9 18 9.44772 18 10V13H20V10C20 9.44772 20.4477 9 21 9C21.5523 9 22 9.44772 22 10V18C22 18.5523 21.5523 19 21 19C20.4477 19 20 18.5523 20 18V15H17C16.4477 15 16 14.5523 16 14V10C16 9.44772 16.4477 9 17 9Z",fill:"currentColor"})]}));Gm.displayName="HeadingFourIcon";const Jm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M16 10C16 9.44772 16.4477 9 17 9H21C21.5523 9 22 9.44772 22 10C22 10.5523 21.5523 11 21 11H18V12H18.3C20.2754 12 22 13.4739 22 15.5C22 17.5261 20.2754 19 18.3 19C17.6457 19 17.0925 18.8643 16.5528 18.5944C16.0588 18.3474 15.8586 17.7468 16.1055 17.2528C16.3525 16.7588 16.9532 16.5586 17.4472 16.8056C17.7074 16.9357 17.9542 17 18.3 17C19.3246 17 20 16.2739 20 15.5C20 14.7261 19.3246 14 18.3 14H17C16.4477 14 16 13.5523 16 13L16 12.9928V10Z",fill:"currentColor"})]}));Jm.displayName="HeadingFiveIcon";const Zm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.7071 9.29289C21.0976 9.68342 21.0976 10.3166 20.7071 10.7071C19.8392 11.575 19.2179 12.2949 18.7889 13.0073C18.8587 13.0025 18.929 13 19 13C20.6569 13 22 14.3431 22 16C22 17.6569 20.6569 19 19 19C17.3431 19 16 17.6569 16 16C16 14.6007 16.2837 13.4368 16.8676 12.3419C17.4384 11.2717 18.2728 10.3129 19.2929 9.29289C19.6834 8.90237 20.3166 8.90237 20.7071 9.29289ZM19 17C18.4477 17 18 16.5523 18 16C18 15.4477 18.4477 15 19 15C19.5523 15 20 15.4477 20 16C20 16.5523 19.5523 17 19 17Z",fill:"currentColor"})]}));Zm.displayName="HeadingSixIcon";const Ym={1:Wm,2:Km,3:qm,4:Gm,5:Jm,6:Zm},Xm={1:"ctrl+alt+1",2:"ctrl+alt+2",3:"ctrl+alt+3",4:"ctrl+alt+4",5:"ctrl+alt+5",6:"ctrl+alt+6"};function Kr(t,e,n=!0){if(!t||!t.isEditable||!_t("heading",t)||Ht(t,["image"]))return!1;if(!n)return e?t.can().setNode("heading",{level:e}):t.can().setNode("heading");try{const o=t.view.state,i=o.selection;if(i.empty||i instanceof V){const s=hn({editor:t,node:o.selection.$anchor.node(1)})?.pos;if(!yt(s))return!1}return!0}catch{return!1}}function gc(t,e){return!t||!t.isEditable?!1:Array.isArray(e)?e.some(n=>t.isActive("heading",{level:n})):e?t.isActive("heading",{level:e}):t.isActive("heading")}function a3(t,e){if(!t||!t.isEditable)return!1;const n=Array.isArray(e)?e:[e],r=n.find(o=>Kr(t,o));if(!r)return!1;try{const o=t.view;let i=o.state,s=i.tr;if(i.selection.empty||i.selection instanceof V){const d=hn({editor:t,node:i.selection.$anchor.node(1)})?.pos;if(!yt(d))return!1;s=s.setSelection(B.create(i.doc,d)),o.dispatch(s),i=o.state}const l=i.selection;let a=t.chain().focus();if(l instanceof B){const d=l.node.firstChild?.firstChild,f=l.node.lastChild?.lastChild,h=d?l.from+d.nodeSize:l.from+1,p=f?l.to-f.nodeSize:l.to-1;a=a.setTextSelection({from:h,to:p}).clearNodes()}return(n.some(d=>t.isActive("heading",{level:d}))?a.setNode("paragraph"):a.setNode("heading",{level:r})).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function Qm(t){const{editor:e,level:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!_t("heading",e)?!1:r&&!e.isActive("code")?Array.isArray(n)?n.some(o=>Kr(e,o)):Kr(e,n):!0}function c3(t){const{editor:e,level:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Kr(i,n),c=gc(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(Qm({editor:i,level:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=a3(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleToggle:u,canToggle:a,label:`Heading ${n}`,shortcutKeys:Xm[n],Icon:Ym[n]}}function J(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t?.(o),n===!1||!o.defaultPrevented)return e?.(o)}}function sf(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function cs(...t){return e=>{let n=!1;const r=t.map(o=>{const i=sf(o,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():sf(t[o],null)}}}}function Oe(...t){return y.useCallback(cs(...t),t)}function dr(t,e=[]){let n=[];function r(i,s){const l=y.createContext(s),a=n.length;n=[...n,s];const c=d=>{const{scope:f,children:h,...p}=d,m=f?.[t]?.[a]||l,v=y.useMemo(()=>p,Object.values(p));return g.jsx(m.Provider,{value:v,children:h})};c.displayName=i+"Provider";function u(d,f){const h=f?.[t]?.[a]||l,p=y.useContext(h);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>y.createContext(s));return function(l){const a=l?.[t]||i;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:a}}),[l,a])}};return o.scopeName=t,[r,u3(o,...e)]}function u3(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((l,{useScope:a,scopeName:c})=>{const d=a(i)[`__scope${c}`];return{...l,...d}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var un=globalThis?.document?y.useLayoutEffect:()=>{},d3=y[" useInsertionEffect ".trim().toString()]||un;function yc({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[o,i,s]=f3({defaultProp:e,onChange:n}),l=t!==void 0,a=l?t:o;{const u=y.useRef(t!==void 0);y.useEffect(()=>{const d=u.current;d!==l&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,r])}const c=y.useCallback(u=>{if(l){const d=h3(u)?u(t):u;d!==t&&s.current?.(d)}else i(u)},[l,t,i,s]);return[a,c]}function f3({defaultProp:t,onChange:e}){const[n,r]=y.useState(t),o=y.useRef(n),i=y.useRef(e);return d3(()=>{i.current=e},[e]),y.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}function h3(t){return typeof t=="function"}function qr(t){const e=p3(t),n=y.forwardRef((r,o)=>{const{children:i,...s}=r,l=y.Children.toArray(i),a=l.find(g3);if(a){const c=a.props.children,u=l.map(d=>d===a?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:d);return g.jsx(e,{...s,ref:o,children:y.isValidElement(c)?y.cloneElement(c,void 0,u):null})}return g.jsx(e,{...s,ref:o,children:i})});return n.displayName=`${t}.Slot`,n}function p3(t){const e=y.forwardRef((n,r)=>{const{children:o,...i}=n;if(y.isValidElement(o)){const s=v3(o),l=y3(i,o.props);return o.type!==y.Fragment&&(l.ref=r?cs(r,s):s),y.cloneElement(o,l)}return y.Children.count(o)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var m3=Symbol("radix.slottable");function g3(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===m3}function y3(t,e){const n={...e};for(const r in e){const o=t[r],i=e[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const a=i(...l);return o(...l),a}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...t,...n}}function v3(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var b3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Te=b3.reduce((t,e)=>{const n=qr(`Primitive.${e}`),r=y.forwardRef((o,i)=>{const{asChild:s,...l}=o,a=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(a,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function e1(t,e){t&&pa.flushSync(()=>t.dispatchEvent(e))}function t1(t){const e=t+"CollectionProvider",[n,r]=dr(e),[o,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:v,children:b}=m,C=j.useRef(null),x=j.useRef(new Map).current;return g.jsx(o,{scope:v,itemMap:x,collectionRef:C,children:b})};s.displayName=e;const l=t+"CollectionSlot",a=qr(l),c=j.forwardRef((m,v)=>{const{scope:b,children:C}=m,x=i(l,b),w=Oe(v,x.collectionRef);return g.jsx(a,{ref:w,children:C})});c.displayName=l;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=qr(u),h=j.forwardRef((m,v)=>{const{scope:b,children:C,...x}=m,w=j.useRef(null),E=Oe(v,w),k=i(u,b);return j.useEffect(()=>(k.itemMap.set(w,{ref:w,...x}),()=>void k.itemMap.delete(w))),g.jsx(f,{[d]:"",ref:E,children:C})});h.displayName=u;function p(m){const v=i(t+"CollectionConsumer",m);return j.useCallback(()=>{const C=v.collectionRef.current;if(!C)return[];const x=Array.from(C.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((k,S)=>x.indexOf(k.ref.current)-x.indexOf(S.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:c,ItemSlot:h},p,r]}var C3=y.createContext(void 0);function n1(t){const e=y.useContext(C3);return t||e||"ltr"}function jt(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...n)=>e.current?.(...n),[])}function x3(t,e=globalThis?.document){const n=jt(t);y.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var w3="DismissableLayer",aa="dismissableLayer.update",S3="dismissableLayer.pointerDownOutside",k3="dismissableLayer.focusOutside",lf,r1=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),vc=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...a}=t,c=y.useContext(r1),[u,d]=y.useState(null),f=u?.ownerDocument??globalThis?.document,[,h]=y.useState({}),p=Oe(e,S=>d(S)),m=Array.from(c.layers),[v]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(v),C=u?m.indexOf(u):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,w=C>=b,E=T3(S=>{const M=S.target,N=[...c.branches].some(P=>P.contains(M));!w||N||(o?.(S),s?.(S),S.defaultPrevented||l?.())},f),k=A3(S=>{const M=S.target;[...c.branches].some(P=>P.contains(M))||(i?.(S),s?.(S),S.defaultPrevented||l?.())},f);return x3(S=>{C===c.layers.size-1&&(r?.(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},f),y.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(lf=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),af(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=lf)}},[u,f,n,c]),y.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),af())},[u,c]),y.useEffect(()=>{const S=()=>h({});return document.addEventListener(aa,S),()=>document.removeEventListener(aa,S)},[]),g.jsx(Te.div,{...a,ref:p,style:{pointerEvents:x?w?"auto":"none":void 0,...t.style},onFocusCapture:J(t.onFocusCapture,k.onFocusCapture),onBlurCapture:J(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:J(t.onPointerDownCapture,E.onPointerDownCapture)})});vc.displayName=w3;var E3="DismissableLayerBranch",M3=y.forwardRef((t,e)=>{const n=y.useContext(r1),r=y.useRef(null),o=Oe(e,r);return y.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),g.jsx(Te.div,{...t,ref:o})});M3.displayName=E3;function T3(t,e=globalThis?.document){const n=jt(t),r=y.useRef(!1),o=y.useRef(()=>{});return y.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let a=function(){o1(S3,n,c,{discrete:!0})};const c={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=a,e.addEventListener("click",o.current,{once:!0})):a()}else e.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function A3(t,e=globalThis?.document){const n=jt(t),r=y.useRef(!1);return y.useEffect(()=>{const o=i=>{i.target&&!r.current&&o1(k3,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function af(){const t=new CustomEvent(aa);document.dispatchEvent(t)}function o1(t,e,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?e1(o,i):o.dispatchEvent(i)}var cl=0;function i1(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??cf()),document.body.insertAdjacentElement("beforeend",t[1]??cf()),cl++,()=>{cl===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),cl--}},[])}function cf(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var ul="focusScope.autoFocusOnMount",dl="focusScope.autoFocusOnUnmount",uf={bubbles:!1,cancelable:!0},R3="FocusScope",bc=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=t,[l,a]=y.useState(null),c=jt(o),u=jt(i),d=y.useRef(null),f=Oe(e,m=>a(m)),h=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let m=function(x){if(h.paused||!l)return;const w=x.target;l.contains(w)?d.current=w:zt(d.current,{select:!0})},v=function(x){if(h.paused||!l)return;const w=x.relatedTarget;w!==null&&(l.contains(w)||zt(d.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const E of x)E.removedNodes.length>0&&zt(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",v);const C=new MutationObserver(b);return l&&C.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",v),C.disconnect()}}},[r,l,h.paused]),y.useEffect(()=>{if(l){ff.add(h);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(ul,uf);l.addEventListener(ul,c),l.dispatchEvent(b),b.defaultPrevented||(O3(P3(s1(l)),{select:!0}),document.activeElement===m&&zt(l))}return()=>{l.removeEventListener(ul,c),setTimeout(()=>{const b=new CustomEvent(dl,uf);l.addEventListener(dl,u),l.dispatchEvent(b),b.defaultPrevented||zt(m??document.body,{select:!0}),l.removeEventListener(dl,u),ff.remove(h)},0)}}},[l,c,u,h]);const p=y.useCallback(m=>{if(!n&&!r||h.paused)return;const v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(v&&b){const C=m.currentTarget,[x,w]=N3(C);x&&w?!m.shiftKey&&b===w?(m.preventDefault(),n&&zt(x,{select:!0})):m.shiftKey&&b===x&&(m.preventDefault(),n&&zt(w,{select:!0})):b===C&&m.preventDefault()}},[n,r,h.paused]);return g.jsx(Te.div,{tabIndex:-1,...s,ref:f,onKeyDown:p})});bc.displayName=R3;function O3(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(zt(r,{select:e}),document.activeElement!==n)return}function N3(t){const e=s1(t),n=df(e,t),r=df(e.reverse(),t);return[n,r]}function s1(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function df(t,e){for(const n of t)if(!I3(n,{upTo:e}))return n}function I3(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function L3(t){return t instanceof HTMLInputElement&&"select"in t}function zt(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&L3(t)&&e&&t.select()}}var ff=D3();function D3(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=hf(t,e),t.unshift(e)},remove(e){t=hf(t,e),t[0]?.resume()}}}function hf(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function P3(t){return t.filter(e=>e.tagName!=="A")}var j3=y[" useId ".trim().toString()]||(()=>{}),B3=0;function Pi(t){const[e,n]=y.useState(j3());return un(()=>{n(r=>r??String(B3++))},[t]),t||(e?`radix-${e}`:"")}var _3="Arrow",l1=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:o=5,...i}=t;return g.jsx(Te.svg,{...i,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});l1.displayName=_3;var H3=l1;function F3(t){const[e,n]=y.useState(void 0);return un(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,l;if("borderBoxSize"in i){const a=i.borderBoxSize,c=Array.isArray(a)?a[0]:a;s=c.inlineSize,l=c.blockSize}else s=t.offsetWidth,l=t.offsetHeight;n({width:s,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var Cc="Popper",[a1,us]=dr(Cc),[$3,c1]=a1(Cc),u1=t=>{const{__scopePopper:e,children:n}=t,[r,o]=y.useState(null);return g.jsx($3,{scope:e,anchor:r,onAnchorChange:o,children:n})};u1.displayName=Cc;var d1="PopperAnchor",f1=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,i=c1(d1,n),s=y.useRef(null),l=Oe(e,s),a=y.useRef(null);return y.useEffect(()=>{const c=a.current;a.current=r?.current||s.current,c!==a.current&&i.onAnchorChange(a.current)}),r?null:g.jsx(Te.div,{...o,ref:l})});f1.displayName=d1;var xc="PopperContent",[V3,z3]=a1(xc),h1=y.forwardRef((t,e)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:a=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=t,v=c1(xc,n),[b,C]=y.useState(null),x=Oe(e,Y=>C(Y)),[w,E]=y.useState(null),k=F3(w),S=k?.width??0,M=k?.height??0,N=r+(i!=="center"?"-"+i:""),P=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},z=Array.isArray(c)?c:[c],U=z.length>0,H={padding:P,boundary:z.filter(W3),altBoundary:U},{refs:I,floatingStyles:_,placement:F,isPositioned:L,middlewareData:T}=Om({strategy:"fixed",placement:N,whileElementsMounted:(...Y)=>Am(...Y,{animationFrame:h==="always"}),elements:{reference:v.anchor},middleware:[Nm({mainAxis:o+M,alignmentAxis:s}),a&&Im({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?c5():void 0,...H}),a&&Lm({...H}),u5({...H,apply:({elements:Y,rects:te,availableWidth:Ke,availableHeight:bt})=>{const{width:Bn,height:Cs}=te.reference,_n=Y.floating.style;_n.setProperty("--radix-popper-available-width",`${Ke}px`),_n.setProperty("--radix-popper-available-height",`${bt}px`),_n.setProperty("--radix-popper-anchor-width",`${Bn}px`),_n.setProperty("--radix-popper-anchor-height",`${Cs}px`)}}),w&&f5({element:w,padding:l}),K3({arrowWidth:S,arrowHeight:M}),f&&d5({strategy:"referenceHidden",...H})]}),[R,W]=g1(F),ee=jt(p);un(()=>{L&&ee?.()},[L,ee]);const K=T.arrow?.x,Z=T.arrow?.y,We=T.arrow?.centerOffset!==0,[le,ge]=y.useState();return un(()=>{b&&ge(window.getComputedStyle(b).zIndex)},[b]),g.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{..._,transform:L?_.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[T.transformOrigin?.x,T.transformOrigin?.y].join(" "),...T.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:g.jsx(V3,{scope:n,placedSide:R,onArrowChange:E,arrowX:K,arrowY:Z,shouldHideArrow:We,children:g.jsx(Te.div,{"data-side":R,"data-align":W,...m,ref:x,style:{...m.style,animation:L?void 0:"none"}})})})});h1.displayName=xc;var p1="PopperArrow",U3={top:"bottom",right:"left",bottom:"top",left:"right"},m1=y.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,i=z3(p1,r),s=U3[i.placedSide];return g.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:g.jsx(H3,{...o,ref:n,style:{...o.style,display:"block"}})})});m1.displayName=p1;function W3(t){return t!==null}var K3=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:o}=e,s=o.arrow?.centerOffset!==0,l=s?0:t.arrowWidth,a=s?0:t.arrowHeight,[c,u]=g1(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(o.arrow?.x??0)+l/2,h=(o.arrow?.y??0)+a/2;let p="",m="";return c==="bottom"?(p=s?d:`${f}px`,m=`${-a}px`):c==="top"?(p=s?d:`${f}px`,m=`${r.floating.height+a}px`):c==="right"?(p=`${-a}px`,m=s?d:`${h}px`):c==="left"&&(p=`${r.floating.width+a}px`,m=s?d:`${h}px`),{data:{x:p,y:m}}}});function g1(t){const[e,n="center"]=t.split("-");return[e,n]}var y1=u1,wc=f1,v1=h1,b1=m1,q3="Portal",Sc=y.forwardRef((t,e)=>{const{container:n,...r}=t,[o,i]=y.useState(!1);un(()=>i(!0),[]);const s=n||o&&globalThis?.document?.body;return s?Hi.createPortal(g.jsx(Te.div,{...r,ref:e}),s):null});Sc.displayName=q3;function G3(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var Dn=t=>{const{present:e,children:n}=t,r=J3(e),o=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),i=Oe(r.ref,Z3(o));return typeof n=="function"||r.isPresent?y.cloneElement(o,{ref:i}):null};Dn.displayName="Presence";function J3(t){const[e,n]=y.useState(),r=y.useRef(null),o=y.useRef(t),i=y.useRef("none"),s=t?"mounted":"unmounted",[l,a]=G3(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const c=To(r.current);i.current=l==="mounted"?c:"none"},[l]),un(()=>{const c=r.current,u=o.current;if(u!==t){const f=i.current,h=To(c);t?a("MOUNT"):h==="none"||c?.display==="none"?a("UNMOUNT"):a(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,a]),un(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=h=>{const m=To(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&m&&(a("ANIMATION_END"),!o.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},f=h=>{h.target===e&&(i.current=To(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else a("ANIMATION_END")},[e,a]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:y.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function To(t){return t?.animationName||"none"}function Z3(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var fl="rovingFocusGroup.onEntryFocus",Y3={bubbles:!1,cancelable:!0},oo="RovingFocusGroup",[ca,C1,X3]=t1(oo),[Q3,x1]=dr(oo,[X3]),[eS,tS]=Q3(oo),w1=y.forwardRef((t,e)=>g.jsx(ca.Provider,{scope:t.__scopeRovingFocusGroup,children:g.jsx(ca.Slot,{scope:t.__scopeRovingFocusGroup,children:g.jsx(nS,{...t,ref:e})})}));w1.displayName=oo;var nS=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:a,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=t,f=y.useRef(null),h=Oe(e,f),p=n1(i),[m,v]=yc({prop:s,defaultProp:l??null,onChange:a,caller:oo}),[b,C]=y.useState(!1),x=jt(c),w=C1(n),E=y.useRef(!1),[k,S]=y.useState(0);return y.useEffect(()=>{const M=f.current;if(M)return M.addEventListener(fl,x),()=>M.removeEventListener(fl,x)},[x]),g.jsx(eS,{scope:n,orientation:r,dir:p,loop:o,currentTabStopId:m,onItemFocus:y.useCallback(M=>v(M),[v]),onItemShiftTab:y.useCallback(()=>C(!0),[]),onFocusableItemAdd:y.useCallback(()=>S(M=>M+1),[]),onFocusableItemRemove:y.useCallback(()=>S(M=>M-1),[]),children:g.jsx(Te.div,{tabIndex:b||k===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...t.style},onMouseDown:J(t.onMouseDown,()=>{E.current=!0}),onFocus:J(t.onFocus,M=>{const N=!E.current;if(M.target===M.currentTarget&&N&&!b){const P=new CustomEvent(fl,Y3);if(M.currentTarget.dispatchEvent(P),!P.defaultPrevented){const z=w().filter(F=>F.focusable),U=z.find(F=>F.active),H=z.find(F=>F.id===m),_=[U,H,...z].filter(Boolean).map(F=>F.ref.current);E1(_,u)}}E.current=!1}),onBlur:J(t.onBlur,()=>C(!1))})})}),S1="RovingFocusGroupItem",k1=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...l}=t,a=Pi(),c=i||a,u=tS(S1,n),d=u.currentTabStopId===c,f=C1(n),{onFocusableItemAdd:h,onFocusableItemRemove:p,currentTabStopId:m}=u;return y.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),g.jsx(ca.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:g.jsx(Te.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...l,ref:e,onMouseDown:J(t.onMouseDown,v=>{r?u.onItemFocus(c):v.preventDefault()}),onFocus:J(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:J(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=iS(v,u.orientation,u.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let x=f().filter(w=>w.focusable).map(w=>w.ref.current);if(b==="last")x.reverse();else if(b==="prev"||b==="next"){b==="prev"&&x.reverse();const w=x.indexOf(v.currentTarget);x=u.loop?sS(x,w+1):x.slice(w+1)}setTimeout(()=>E1(x))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:m!=null}):s})})});k1.displayName=S1;var rS={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function oS(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function iS(t,e,n){const r=oS(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return rS[r]}function E1(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function sS(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var lS=w1,aS=k1,cS=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},$n=new WeakMap,Ao=new WeakMap,Ro={},hl=0,M1=function(t){return t&&(t.host||M1(t.parentNode))},uS=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=M1(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},dS=function(t,e,n,r){var o=uS(e,Array.isArray(t)?t:[t]);Ro[n]||(Ro[n]=new WeakMap);var i=Ro[n],s=[],l=new Set,a=new Set(o),c=function(d){!d||l.has(d)||(l.add(d),c(d.parentNode))};o.forEach(c);var u=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(f){if(l.has(f))u(f);else try{var h=f.getAttribute(r),p=h!==null&&h!=="false",m=($n.get(f)||0)+1,v=(i.get(f)||0)+1;$n.set(f,m),i.set(f,v),s.push(f),m===1&&p&&Ao.set(f,!0),v===1&&f.setAttribute(n,"true"),p||f.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",f,b)}})};return u(e),l.clear(),hl++,function(){s.forEach(function(d){var f=$n.get(d)-1,h=i.get(d)-1;$n.set(d,f),i.set(d,h),f||(Ao.has(d)||d.removeAttribute(r),Ao.delete(d)),h||d.removeAttribute(n)}),hl--,hl||($n=new WeakMap,$n=new WeakMap,Ao=new WeakMap,Ro={})}},T1=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=cS(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),dS(r,o,n,"aria-hidden")):function(){return null}},ct=function(){return ct=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ct.apply(this,arguments)};function A1(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n}function fS(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var Fo="right-scroll-bar-position",$o="width-before-scroll-bar",hS="with-scroll-bars-hidden",pS="--removed-body-scroll-bar-size";function pl(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function mS(t,e){var n=j.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=e,n.facade}var gS=typeof window<"u"?y.useLayoutEffect:y.useEffect,pf=new WeakMap;function yS(t,e){var n=mS(null,function(r){return t.forEach(function(o){return pl(o,r)})});return gS(function(){var r=pf.get(n);if(r){var o=new Set(r),i=new Set(t),s=n.current;o.forEach(function(l){i.has(l)||pl(l,null)}),i.forEach(function(l){o.has(l)||pl(l,s)})}pf.set(n,t)},[t]),n}function vS(t){return t}function bS(t,e){e===void 0&&(e=vS);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var s=e(i,r);return n.push(s),function(){n=n.filter(function(l){return l!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var l=n;n=[],l.forEach(i),s=n}var a=function(){var u=s;s=[],u.forEach(i)},c=function(){return Promise.resolve().then(a)};c(),n={push:function(u){s.push(u),c()},filter:function(u){return s=s.filter(u),n}}}};return o}function CS(t){t===void 0&&(t={});var e=bS(null);return e.options=ct({async:!0,ssr:!1},t),e}var R1=function(t){var e=t.sideCar,n=A1(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return y.createElement(r,ct({},n))};R1.isSideCarExport=!0;function xS(t,e){return t.useMedium(e),R1}var O1=CS(),ml=function(){},ds=y.forwardRef(function(t,e){var n=y.useRef(null),r=y.useState({onScrollCapture:ml,onWheelCapture:ml,onTouchMoveCapture:ml}),o=r[0],i=r[1],s=t.forwardProps,l=t.children,a=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,f=t.sideCar,h=t.noRelative,p=t.noIsolation,m=t.inert,v=t.allowPinchZoom,b=t.as,C=b===void 0?"div":b,x=t.gapMode,w=A1(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=f,k=yS([n,e]),S=ct(ct({},w),o);return y.createElement(y.Fragment,null,u&&y.createElement(E,{sideCar:O1,removeScrollBar:c,shards:d,noRelative:h,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:x}),s?y.cloneElement(y.Children.only(l),ct(ct({},S),{ref:k})):y.createElement(C,ct({},S,{className:a,ref:k}),l))});ds.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ds.classNames={fullWidth:$o,zeroRight:Fo};var wS=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function SS(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=wS();return e&&t.setAttribute("nonce",e),t}function kS(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function ES(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var MS=function(){var t=0,e=null;return{add:function(n){t==0&&(e=SS())&&(kS(e,n),ES(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},TS=function(){var t=MS();return function(e,n){y.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},N1=function(){var t=TS(),e=function(n){var r=n.styles,o=n.dynamic;return t(r,o),null};return e},AS={left:0,top:0,right:0,gap:0},gl=function(t){return parseInt(t||"",10)||0},RS=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[gl(n),gl(r),gl(o)]},OS=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return AS;var e=RS(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},NS=N1(),er="data-scroll-locked",IS=function(t,e,n,r){var o=t.left,i=t.top,s=t.right,l=t.gap;return n===void 0&&(n="margin"),`
173
+ */var G7=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],ta=G7.join(","),fm=typeof Element>"u",zr=fm?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Li=!fm&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},Ur=function(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),i=o===""||o==="true",s=i||n&&e&&Ur(e.parentNode);return s},J7=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},Z7=function(e,n,r){if(Ur(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(ta));return n&&zr.call(e,ta)&&o.unshift(e),o=o.filter(r),o},na=function(e,n,r){for(var o=[],i=Array.from(e);i.length;){var s=i.shift();if(!Ur(s,!1))if(s.tagName==="SLOT"){var l=s.assignedElements(),a=l.length?l:s.children,c=na(a,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:s,candidates:c})}else{var u=zr.call(s,ta);u&&r.filter(s)&&(n||!e.includes(s))&&o.push(s);var d=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),f=!Ur(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(d&&f){var h=na(d===!0?s.children:d.children,!0,r);r.flatten?o.push.apply(o,h):o.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return o},hm=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},pm=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||J7(e))&&!hm(e)?0:e.tabIndex},Y7=function(e,n){var r=pm(e);return r<0&&n&&!hm(e)?0:r},X7=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},mm=function(e){return e.tagName==="INPUT"},Q7=function(e){return mm(e)&&e.type==="hidden"},e4=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},t4=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},n4=function(e){if(!e.name)return!0;var n=e.form||Li(e),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=t4(o,e.form);return!i||i===e},r4=function(e){return mm(e)&&e.type==="radio"},o4=function(e){return r4(e)&&!n4(e)},i4=function(e){var n,r=e&&Li(e),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==e){var s,l,a;for(i=!!((s=o)!==null&&s!==void 0&&(l=s.ownerDocument)!==null&&l!==void 0&&l.contains(o)||e!=null&&(a=e.ownerDocument)!==null&&a!==void 0&&a.contains(e));!i&&o;){var c,u,d;r=Li(o),o=(c=r)===null||c===void 0?void 0:c.host,i=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return i},jd=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},s4=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var i=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(e).visibility==="hidden")return!0;var s=zr.call(e,"details>summary:first-of-type"),l=s?e.parentElement:e;if(zr.call(l,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=e;e;){var c=e.parentElement,u=Li(e);if(c&&!c.shadowRoot&&o(c)===!0)return jd(e);e.assignedSlot?e=e.assignedSlot:!c&&u!==e.ownerDocument?e=u.host:e=c}e=a}if(i4(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return jd(e);return!1},l4=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return zr.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},a4=function(e,n){return!(n.disabled||Ur(n)||Q7(n)||s4(n,e)||e4(n)||l4(n))},Bd=function(e,n){return!(o4(n)||pm(n)<0||!a4(e,n))},c4=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},gm=function(e){var n=[],r=[];return e.forEach(function(o,i){var s=!!o.scopeParent,l=s?o.scopeParent:o,a=Y7(l,s),c=s?gm(o.candidates):l;a===0?s?n.push.apply(n,c):n.push(l):r.push({documentOrder:i,tabIndex:a,item:o,isScope:s,content:c})}),r.sort(X7).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},ym=function(e,n){n=n||{};var r;return n.getShadowRoot?r=na([e],n.includeContainer,{filter:Bd.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:c4}):r=Z7(e,n.includeContainer,Bd.bind(null,n)),gm(r)};function u4(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function d4(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:n,version:r}=e;return n+"/"+r}).join(" "):navigator.userAgent}function vm(){return/apple/i.test(navigator.vendor)}function f4(){return u4().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function h4(){return d4().includes("jsdom/")}const _d="data-floating-ui-focusable",p4="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function ra(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function sr(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Yl(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Gn(t){return"composedPath"in t?t.composedPath()[0]:t.target}function tl(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function m4(t){return t.matches("html,body")}function dt(t){return t?.ownerDocument||document}function g4(t){return Ue(t)&&t.matches(p4)}function y4(t){if(!t||h4())return!0;try{return t.matches(":focus-visible")}catch{return!0}}function v4(t){return t?t.hasAttribute(_d)?t:t.querySelector("["+_d+"]")||t:null}function _o(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var i;return o.parentId===e&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,..._o(t,o.id,n)])}function b4(t){return"nativeEvent"in t}function oa(t,e){const n=["mouse","pen"];return n.push("",void 0),n.includes(t)}var C4=typeof document<"u",x4=function(){},ot=C4?j.useLayoutEffect:x4;const w4={...y};function Mo(t){const e=y.useRef(t);return ot(()=>{e.current=t}),e}const S4=w4.useInsertionEffect,k4=S4||(t=>t());function at(t){const e=y.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return k4(()=>{e.current=t}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const bm=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Cm(t,e){const n=ym(t,bm()),r=n.length;if(r===0)return;const o=ra(dt(t)),i=n.indexOf(o),s=i===-1?e===1?0:r-1:i+e;return n[s]}function E4(t){return Cm(dt(t).body,1)||t}function M4(t){return Cm(dt(t).body,-1)||t}function nl(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!sr(n,r)}function T4(t){ym(t,bm()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Hd(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Fd(t,e,n){let{reference:r,floating:o}=t;const i=ut(e),s=cc(e),l=ac(s),a=It(e),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let h;switch(a){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(ur(e)){case"start":h[s]-=f*(n&&c?-1:1);break;case"end":h[s]+=f*(n&&c?-1:1);break}return h}const A4=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:d}=Fd(c,r,a),f=r,h={},p=0;for(let m=0;m<l.length;m++){const{name:v,fn:b}=l[m],{x:C,y:x,data:w,reset:E}=await b({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:h,rects:c,platform:s,elements:{reference:t,floating:e}});u=C??u,d=x??d,h={...h,[v]:{...h[v],...w}},E&&p<=50&&(p++,typeof E=="object"&&(E.placement&&(f=E.placement),E.rects&&(c=E.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:o}):E.rects),{x:u,y:d}=Fd(c,f,a)),m=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:h}};async function Wr(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Nt(e,t),p=dm(h),v=l[f?d==="floating"?"reference":"floating":d],b=Ii(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),C=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),w=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},E=Ii(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:C,offsetParent:x,strategy:a}):C);return{top:(b.top-E.top+p.top)/w.y,bottom:(E.bottom-b.bottom+p.bottom)/w.y,left:(b.left-E.left+p.left)/w.x,right:(E.right-b.right+p.right)/w.x}}const R4=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:a}=e,{element:c,padding:u=0}=Nt(t,e)||{};if(c==null)return{};const d=dm(u),f={x:n,y:r},h=cc(o),p=ac(h),m=await s.getDimensions(c),v=h==="y",b=v?"top":"left",C=v?"bottom":"right",x=v?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[h]-f[h]-i.floating[p],E=f[h]-i.reference[h],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let S=k?k[x]:0;(!S||!await(s.isElement==null?void 0:s.isElement(k)))&&(S=l.floating[x]||i.floating[p]);const M=w/2-E/2,N=S/2-m[p]/2-1,P=an(d[b],N),z=an(d[C],N),U=P,H=S-m[p]-z,I=S/2-m[p]/2+M,_=Ql(U,I,H),F=!a.arrow&&ur(o)!=null&&I!==_&&i.reference[p]/2-(I<U?P:z)-m[p]/2<0,L=F?I<U?I-U:I-H:0;return{[h]:f[h]+L,data:{[h]:_,centerOffset:I-_-L,...F&&{alignmentOffset:L}},reset:F}}}),O4=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...v}=Nt(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=It(o),C=ut(l),x=It(l)===l,w=await(a.isRTL==null?void 0:a.isRTL(c.floating)),E=f||(x||!m?[Ni(l)]:V7(l)),k=p!=="none";!f&&k&&E.push(...K7(l,m,p,w));const S=[l,...E],M=await Wr(e,v),N=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&N.push(M[b]),d){const I=$7(o,s,w);N.push(M[I[0]],M[I[1]])}if(P=[...P,{placement:o,overflows:N}],!N.every(I=>I<=0)){var z,U;const I=(((z=i.flip)==null?void 0:z.index)||0)+1,_=S[I];if(_&&(!(d==="alignment"?C!==ut(_):!1)||P.every(T=>ut(T.placement)===C?T.overflows[0]>0:!0)))return{data:{index:I,overflows:P},reset:{placement:_}};let F=(U=P.filter(L=>L.overflows[0]<=0).sort((L,T)=>L.overflows[1]-T.overflows[1])[0])==null?void 0:U.placement;if(!F)switch(h){case"bestFit":{var H;const L=(H=P.filter(T=>{if(k){const R=ut(T.placement);return R===C||R==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(R=>R>0).reduce((R,W)=>R+W,0)]).sort((T,R)=>T[1]-R[1])[0])==null?void 0:H[0];L&&(F=L);break}case"initialPlacement":F=l;break}if(o!==F)return{reset:{placement:F}}}return{}}}};function $d(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Vd(t){return B7.some(e=>t[e]>=0)}const N4=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...o}=Nt(t,e);switch(r){case"referenceHidden":{const i=await Wr(e,{...o,elementContext:"reference"}),s=$d(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Vd(s)}}}case"escaped":{const i=await Wr(e,{...o,altBoundary:!0}),s=$d(i,n.floating);return{data:{escapedOffsets:s,escaped:Vd(s)}}}default:return{}}}}},xm=new Set(["left","top"]);async function I4(t,e){const{placement:n,platform:r,elements:o}=t,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=It(n),l=ur(n),a=ut(n)==="y",c=xm.has(s)?-1:1,u=i&&a?-1:1,d=Nt(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof p=="number"&&(h=l==="end"?p*-1:p),a?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const L4=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:i,placement:s,middlewareData:l}=e,a=await I4(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:s}}}}},D4=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:v=>{let{x:b,y:C}=v;return{x:b,y:C}}},...a}=Nt(t,e),c={x:n,y:r},u=await Wr(e,a),d=ut(It(o)),f=lc(d);let h=c[f],p=c[d];if(i){const v=f==="y"?"top":"left",b=f==="y"?"bottom":"right",C=h+u[v],x=h-u[b];h=Ql(C,h,x)}if(s){const v=d==="y"?"top":"left",b=d==="y"?"bottom":"right",C=p+u[v],x=p-u[b];p=Ql(C,p,x)}const m=l.fn({...e,[f]:h,[d]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[f]:i,[d]:s}}}}}},P4=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=e,{offset:l=0,mainAxis:a=!0,crossAxis:c=!0}=Nt(t,e),u={x:n,y:r},d=ut(o),f=lc(d);let h=u[f],p=u[d];const m=Nt(l,e),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(a){const x=f==="y"?"height":"width",w=i.reference[f]-i.floating[x]+v.mainAxis,E=i.reference[f]+i.reference[x]-v.mainAxis;h<w?h=w:h>E&&(h=E)}if(c){var b,C;const x=f==="y"?"width":"height",w=xm.has(It(o)),E=i.reference[d]-i.floating[x]+(w&&((b=s.offset)==null?void 0:b[d])||0)+(w?0:v.crossAxis),k=i.reference[d]+i.reference[x]+(w?0:((C=s.offset)==null?void 0:C[d])||0)-(w?v.crossAxis:0);p<E?p=E:p>k&&(p=k)}return{[f]:h,[d]:p}}}},j4=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:o,rects:i,platform:s,elements:l}=e,{apply:a=()=>{},...c}=Nt(t,e),u=await Wr(e,c),d=It(o),f=ur(o),h=ut(o)==="y",{width:p,height:m}=i.floating;let v,b;d==="top"||d==="bottom"?(v=d,b=f===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(b=d,v=f==="end"?"top":"bottom");const C=m-u.top-u.bottom,x=p-u.left-u.right,w=an(m-u[v],C),E=an(p-u[b],x),k=!e.middlewareData.shift;let S=w,M=E;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(M=x),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(S=C),k&&!f){const P=$e(u.left,0),z=$e(u.right,0),U=$e(u.top,0),H=$e(u.bottom,0);h?M=p-2*(P!==0||z!==0?P+z:$e(u.left,u.right)):S=m-2*(U!==0||H!==0?U+H:$e(u.top,u.bottom))}await a({...e,availableWidth:M,availableHeight:S});const N=await s.getDimensions(l.floating);return p!==N.width||m!==N.height?{reset:{rects:!0}}:{}}}};function wm(t){const e=tt(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=Ue(t),i=o?t.offsetWidth:n,s=o?t.offsetHeight:r,l=Oi(n)!==i||Oi(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function uc(t){return oe(t)?t:t.contextElement}function Qn(t){const e=uc(t);if(!Ue(e))return ft(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:i}=wm(e);let s=(i?Oi(n.width):n.width)/r,l=(i?Oi(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const B4=ft(0);function Sm(t){const e=Fe(t);return!rs()||!e.visualViewport?B4:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _4(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Fe(t)?!1:e}function Nn(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),i=uc(t);let s=ft(1);e&&(r?oe(r)&&(s=Qn(r)):s=Qn(t));const l=_4(i,n,r)?Sm(i):ft(0);let a=(o.left+l.x)/s.x,c=(o.top+l.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const f=Fe(i),h=r&&oe(r)?Fe(r):r;let p=f,m=Xl(p);for(;m&&r&&h!==p;){const v=Qn(m),b=m.getBoundingClientRect(),C=tt(m),x=b.left+(m.clientLeft+parseFloat(C.paddingLeft))*v.x,w=b.top+(m.clientTop+parseFloat(C.paddingTop))*v.y;a*=v.x,c*=v.y,u*=v.x,d*=v.y,a+=x,c+=w,p=Fe(m),m=Xl(p)}}return Ii({width:u,height:d,x:a,y:c})}function ss(t,e){const n=is(t).scrollLeft;return e?e.left+n:Nn(mt(t)).left+n}function km(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-ss(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function H4(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const i=o==="fixed",s=mt(r),l=e?ns(e.floating):!1;if(r===s||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=ft(1);const u=ft(0),d=Ue(r);if((d||!d&&!i)&&((cr(r)!=="body"||to(s))&&(a=is(r)),Ue(r))){const h=Nn(r);c=Qn(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=s&&!d&&!i?km(s,a):ft(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-a.scrollTop*c.y+u.y+f.y}}function F4(t){return Array.from(t.getClientRects())}function $4(t){const e=mt(t),n=is(t),r=t.ownerDocument.body,o=$e(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=$e(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+ss(t);const l=-n.scrollTop;return tt(r).direction==="rtl"&&(s+=$e(e.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}const zd=25;function V4(t,e){const n=Fe(t),r=mt(t),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,l=0,a=0;if(o){i=o.width,s=o.height;const u=rs();(!u||u&&e==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}const c=ss(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=zd&&(i-=p)}else c<=zd&&(i+=c);return{width:i,height:s,x:l,y:a}}const z4=new Set(["absolute","fixed"]);function U4(t,e){const n=Nn(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,i=Ue(t)?Qn(t):ft(1),s=t.clientWidth*i.x,l=t.clientHeight*i.y,a=o*i.x,c=r*i.y;return{width:s,height:l,x:a,y:c}}function Ud(t,e,n){let r;if(e==="viewport")r=V4(t,n);else if(e==="document")r=$4(mt(t));else if(oe(e))r=U4(e,n);else{const o=Sm(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Ii(r)}function Em(t,e){const n=Ot(t);return n===e||!oe(n)||Rt(n)?!1:tt(n).position==="fixed"||Em(n,e)}function W4(t,e){const n=e.get(t);if(n)return n;let r=nn(t,[],!1).filter(l=>oe(l)&&cr(l)!=="body"),o=null;const i=tt(t).position==="fixed";let s=i?Ot(t):t;for(;oe(s)&&!Rt(s);){const l=tt(s),a=sc(s);!a&&l.position==="fixed"&&(o=null),(i?!a&&!o:!a&&l.position==="static"&&!!o&&z4.has(o.position)||to(s)&&!a&&Em(t,s))?r=r.filter(u=>u!==s):o=l,s=Ot(s)}return e.set(t,r),r}function K4(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const s=[...n==="clippingAncestors"?ns(e)?[]:W4(e,this._c):[].concat(n),r],l=s[0],a=s.reduce((c,u)=>{const d=Ud(e,u,o);return c.top=$e(d.top,c.top),c.right=an(d.right,c.right),c.bottom=an(d.bottom,c.bottom),c.left=$e(d.left,c.left),c},Ud(e,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function q4(t){const{width:e,height:n}=wm(t);return{width:e,height:n}}function G4(t,e,n){const r=Ue(e),o=mt(e),i=n==="fixed",s=Nn(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const a=ft(0);function c(){a.x=ss(o)}if(r||!r&&!i)if((cr(e)!=="body"||to(o))&&(l=is(e)),r){const h=Nn(e,!0,i,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else o&&c();i&&!r&&o&&c();const u=o&&!r&&!i?km(o,l):ft(0),d=s.left+l.scrollLeft-a.x-u.x,f=s.top+l.scrollTop-a.y-u.y;return{x:d,y:f,width:s.width,height:s.height}}function rl(t){return tt(t).position==="static"}function Wd(t,e){if(!Ue(t)||tt(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return mt(t)===n&&(n=n.ownerDocument.body),n}function Mm(t,e){const n=Fe(t);if(ns(t))return n;if(!Ue(t)){let o=Ot(t);for(;o&&!Rt(o);){if(oe(o)&&!rl(o))return o;o=Ot(o)}return n}let r=Wd(t,e);for(;r&&O7(r)&&rl(r);)r=Wd(r,e);return r&&Rt(r)&&rl(r)&&!sc(r)?n:r||P7(t)||n}const J4=async function(t){const e=this.getOffsetParent||Mm,n=this.getDimensions,r=await n(t.floating);return{reference:G4(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Z4(t){return tt(t).direction==="rtl"}const Y4={convertOffsetParentRelativeRectToViewportRelativeRect:H4,getDocumentElement:mt,getClippingRect:K4,getOffsetParent:Mm,getElementRects:J4,getClientRects:F4,getDimensions:q4,getScale:Qn,isElement:oe,isRTL:Z4};function Tm(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function X4(t,e){let n=null,r;const o=mt(t);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function s(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const c=t.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(l||e(),!f||!h)return;const p=Eo(d),m=Eo(o.clientWidth-(u+f)),v=Eo(o.clientHeight-(d+h)),b=Eo(u),x={rootMargin:-p+"px "+-m+"px "+-v+"px "+-b+"px",threshold:$e(0,an(1,a))||1};let w=!0;function E(k){const S=k[0].intersectionRatio;if(S!==a){if(!w)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!Tm(c,t.getBoundingClientRect())&&s(),w=!1}try{n=new IntersectionObserver(E,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,x)}n.observe(t)}return s(!0),i}function Am(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=uc(t),u=o||i?[...c?nn(c):[],...nn(e)]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const d=c&&l?X4(c,n):null;let f=-1,h=null;s&&(h=new ResizeObserver(b=>{let[C]=b;C&&C.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(e)})),n()}),c&&!a&&h.observe(c),h.observe(e));let p,m=a?Nn(t):null;a&&v();function v(){const b=Nn(t);m&&!Tm(m,b)&&n(),m=b,p=requestAnimationFrame(v)}return n(),()=>{var b;u.forEach(C=>{o&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),d?.(),(b=h)==null||b.disconnect(),h=null,a&&cancelAnimationFrame(p)}}const Q4=L4,e5=D4,t5=O4,n5=j4,r5=N4,Kd=R4,o5=P4,i5=(t,e,n)=>{const r=new Map,o={platform:Y4,...n},i={...o.platform,_c:r};return A4(t,e,{...o,platform:i})};var s5=typeof document<"u",l5=function(){},Ho=s5?j.useLayoutEffect:l5;function Di(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Di(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&t.$$typeof)&&!Di(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function Rm(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function qd(t,e){const n=Rm(t);return Math.round(e*n)/n}function ol(t){const e=y.useRef(t);return Ho(()=>{e.current=t}),e}function Om(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:a,open:c}=t,[u,d]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=y.useState(r);Di(f,r)||h(r);const[p,m]=y.useState(null),[v,b]=y.useState(null),C=y.useCallback(T=>{T!==k.current&&(k.current=T,m(T))},[]),x=y.useCallback(T=>{T!==S.current&&(S.current=T,b(T))},[]),w=i||p,E=s||v,k=y.useRef(null),S=y.useRef(null),M=y.useRef(u),N=a!=null,P=ol(a),z=ol(o),U=ol(c),H=y.useCallback(()=>{if(!k.current||!S.current)return;const T={placement:e,strategy:n,middleware:f};z.current&&(T.platform=z.current),i5(k.current,S.current,T).then(R=>{const W={...R,isPositioned:U.current!==!1};I.current&&!Di(M.current,W)&&(M.current=W,pa.flushSync(()=>{d(W)}))})},[f,e,n,z,U]);Ho(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,d(T=>({...T,isPositioned:!1})))},[c]);const I=y.useRef(!1);Ho(()=>(I.current=!0,()=>{I.current=!1}),[]),Ho(()=>{if(w&&(k.current=w),E&&(S.current=E),w&&E){if(P.current)return P.current(w,E,H);H()}},[w,E,H,P,N]);const _=y.useMemo(()=>({reference:k,floating:S,setReference:C,setFloating:x}),[C,x]),F=y.useMemo(()=>({reference:w,floating:E}),[w,E]),L=y.useMemo(()=>{const T={position:n,left:0,top:0};if(!F.floating)return T;const R=qd(F.floating,u.x),W=qd(F.floating,u.y);return l?{...T,transform:"translate("+R+"px, "+W+"px)",...Rm(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:R,top:W}},[n,l,F.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:H,refs:_,elements:F,floatingStyles:L}),[u,H,_,F,L])}const a5=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Kd({element:r.current,padding:o}).fn(n):{}:r?Kd({element:r,padding:o}).fn(n):{}}}},Nm=(t,e)=>({...Q4(t),options:[t,e]}),Im=(t,e)=>({...e5(t),options:[t,e]}),c5=(t,e)=>({...o5(t),options:[t,e]}),Lm=(t,e)=>({...t5(t),options:[t,e]}),u5=(t,e)=>({...n5(t),options:[t,e]}),d5=(t,e)=>({...r5(t),options:[t,e]}),f5=(t,e)=>({...a5(t),options:[t,e]});function Dm(t){const e=y.useRef(void 0),n=y.useCallback(r=>{const o=t.map(i=>{if(i!=null){if(typeof i=="function"){const s=i,l=s(r);return typeof l=="function"?l:()=>{s(null)}}return i.current=r,()=>{i.current=null}}});return()=>{o.forEach(i=>i?.())}},t);return y.useMemo(()=>t.every(r=>r==null)?null:r=>{e.current&&(e.current(),e.current=void 0),r!=null&&(e.current=n(r))},t)}const h5="data-floating-ui-focusable",Gd="active",Jd="selected",p5={...y};let Zd=!1,m5=0;const Yd=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+m5++;function g5(){const[t,e]=y.useState(()=>Zd?Yd():void 0);return ot(()=>{t==null&&e(Yd())},[]),y.useEffect(()=>{Zd=!0},[]),t}const y5=p5.useId,dc=y5||g5;let ia;process.env.NODE_ENV!=="production"&&(ia=new Set);function v5(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((t=ia)!=null&&t.has(o))){var i;(i=ia)==null||i.add(o),console.error(o)}}function b5(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const C5=y.createContext(null),x5=y.createContext(null),fc=()=>{var t;return((t=y.useContext(C5))==null?void 0:t.id)||null},hc=()=>y.useContext(x5);function no(t){return"data-floating-ui-"+t}function Ge(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}const Xd=no("safe-polygon");function il(t,e,n){if(n&&!oa(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const r=t();return typeof r=="number"?r:r?.[e]}return t?.[e]}function sl(t){return typeof t=="function"?t():t}function w5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:s}=t,{enabled:l=!0,delay:a=0,handleClose:c=null,mouseOnly:u=!1,restMs:d=0,move:f=!0}=e,h=hc(),p=fc(),m=Mo(c),v=Mo(a),b=Mo(n),C=Mo(d),x=y.useRef(),w=y.useRef(-1),E=y.useRef(),k=y.useRef(-1),S=y.useRef(!0),M=y.useRef(!1),N=y.useRef(()=>{}),P=y.useRef(!1),z=at(()=>{var L;const T=(L=o.current.openEvent)==null?void 0:L.type;return T?.includes("mouse")&&T!=="mousedown"});y.useEffect(()=>{if(!l)return;function L(T){let{open:R}=T;R||(Ge(w),Ge(k),S.current=!0,P.current=!1)}return i.on("openchange",L),()=>{i.off("openchange",L)}},[l,i]),y.useEffect(()=>{if(!l||!m.current||!n)return;function L(R){z()&&r(!1,R,"hover")}const T=dt(s.floating).documentElement;return T.addEventListener("mouseleave",L),()=>{T.removeEventListener("mouseleave",L)}},[s.floating,n,r,l,m,z]);const U=y.useCallback(function(L,T,R){T===void 0&&(T=!0),R===void 0&&(R="hover");const W=il(v.current,"close",x.current);W&&!E.current?(Ge(w),w.current=window.setTimeout(()=>r(!1,L,R),W)):T&&(Ge(w),r(!1,L,R))},[v,r]),H=at(()=>{N.current(),E.current=void 0}),I=at(()=>{if(M.current){const L=dt(s.floating).body;L.style.pointerEvents="",L.removeAttribute(Xd),M.current=!1}}),_=at(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);y.useEffect(()=>{if(!l)return;function L(K){if(Ge(w),S.current=!1,u&&!oa(x.current)||sl(C.current)>0&&!il(v.current,"open"))return;const Z=il(v.current,"open",x.current);Z?w.current=window.setTimeout(()=>{b.current||r(!0,K,"hover")},Z):n||r(!0,K,"hover")}function T(K){if(_()){I();return}N.current();const Z=dt(s.floating);if(Ge(k),P.current=!1,m.current&&o.current.floatingContext){n||Ge(w),E.current=m.current({...o.current.floatingContext,tree:h,x:K.clientX,y:K.clientY,onClose(){I(),H(),_()||U(K,!0,"safe-polygon")}});const le=E.current;Z.addEventListener("mousemove",le),N.current=()=>{Z.removeEventListener("mousemove",le)};return}(x.current==="touch"?!sr(s.floating,K.relatedTarget):!0)&&U(K)}function R(K){_()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:h,x:K.clientX,y:K.clientY,onClose(){I(),H(),_()||U(K)}})(K))}function W(){Ge(w)}function ee(K){_()||U(K,!1)}if(oe(s.domReference)){const K=s.domReference,Z=s.floating;return n&&K.addEventListener("mouseleave",R),f&&K.addEventListener("mousemove",L,{once:!0}),K.addEventListener("mouseenter",L),K.addEventListener("mouseleave",T),Z&&(Z.addEventListener("mouseleave",R),Z.addEventListener("mouseenter",W),Z.addEventListener("mouseleave",ee)),()=>{n&&K.removeEventListener("mouseleave",R),f&&K.removeEventListener("mousemove",L),K.removeEventListener("mouseenter",L),K.removeEventListener("mouseleave",T),Z&&(Z.removeEventListener("mouseleave",R),Z.removeEventListener("mouseenter",W),Z.removeEventListener("mouseleave",ee))}}},[s,l,t,u,f,U,H,I,r,n,b,h,v,m,o,_,C]),ot(()=>{var L;if(l&&n&&(L=m.current)!=null&&(L=L.__options)!=null&&L.blockPointerEvents&&z()){M.current=!0;const R=s.floating;if(oe(s.domReference)&&R){var T;const W=dt(s.floating).body;W.setAttribute(Xd,"");const ee=s.domReference,K=h==null||(T=h.nodesRef.current.find(Z=>Z.id===p))==null||(T=T.context)==null?void 0:T.elements.floating;return K&&(K.style.pointerEvents=""),W.style.pointerEvents="none",ee.style.pointerEvents="auto",R.style.pointerEvents="auto",()=>{W.style.pointerEvents="",ee.style.pointerEvents="",R.style.pointerEvents=""}}}},[l,n,p,s,h,m,z]),ot(()=>{n||(x.current=void 0,P.current=!1,H(),I())},[n,H,I]),y.useEffect(()=>()=>{H(),Ge(w),Ge(k),I()},[l,s.domReference,H,I]);const F=y.useMemo(()=>{function L(T){x.current=T.pointerType}return{onPointerDown:L,onPointerEnter:L,onMouseMove(T){const{nativeEvent:R}=T;function W(){!S.current&&!b.current&&r(!0,R,"hover")}u&&!oa(x.current)||n||sl(C.current)===0||P.current&&T.movementX**2+T.movementY**2<2||(Ge(k),x.current==="touch"?W():(P.current=!0,k.current=window.setTimeout(W,sl(C.current))))}}},[u,r,n,b,C]);return y.useMemo(()=>l?{reference:F}:{},[l,F])}const Qd=()=>{},S5=y.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:Qd,setState:Qd,isInstantPhase:!1});function k5(t){const{children:e,delay:n,timeoutMs:r=0}=t,[o,i]=y.useReducer((a,c)=>({...a,...c}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),s=y.useRef(null),l=y.useCallback(a=>{i({currentId:a})},[]);return ot(()=>{o.currentId?s.current===null?s.current=o.currentId:o.isInstantPhase||i({isInstantPhase:!0}):(o.isInstantPhase&&i({isInstantPhase:!1}),s.current=null)},[o.currentId,o.isInstantPhase]),g.jsx(S5.Provider,{value:y.useMemo(()=>({...o,setState:i,setCurrentId:l}),[o,l]),children:e})}const Pm={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},ef=y.forwardRef(function(e,n){const[r,o]=y.useState();ot(()=>{vm()&&o("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[no("focus-guard")]:"",style:Pm};return g.jsx("span",{...e,...i})}),jm=y.createContext(null),tf=no("portal");function E5(t){t===void 0&&(t={});const{id:e,root:n}=t,r=dc(),o=T5(),[i,s]=y.useState(null),l=y.useRef(null);return ot(()=>()=>{i?.remove(),queueMicrotask(()=>{l.current=null})},[i]),ot(()=>{if(!r||l.current)return;const a=e?document.getElementById(e):null;if(!a)return;const c=document.createElement("div");c.id=r,c.setAttribute(tf,""),a.appendChild(c),l.current=c,s(c)},[e,r]),ot(()=>{if(n===null||!r||l.current)return;let a=n||o?.portalNode;a&&!ic(a)&&(a=a.current),a=a||document.body;let c=null;e&&(c=document.createElement("div"),c.id=e,a.appendChild(c));const u=document.createElement("div");u.id=r,u.setAttribute(tf,""),a=c||a,a.appendChild(u),l.current=u,s(u)},[e,n,r,o]),i}function M5(t){const{children:e,id:n,root:r,preserveTabOrder:o=!0}=t,i=E5({id:n,root:r}),[s,l]=y.useState(null),a=y.useRef(null),c=y.useRef(null),u=y.useRef(null),d=y.useRef(null),f=s?.modal,h=s?.open,p=!!s&&!s.modal&&s.open&&o&&!!(r||i);return y.useEffect(()=>{if(!i||!o||f)return;function m(v){i&&nl(v)&&(v.type==="focusin"?Hd:T4)(i)}return i.addEventListener("focusin",m,!0),i.addEventListener("focusout",m,!0),()=>{i.removeEventListener("focusin",m,!0),i.removeEventListener("focusout",m,!0)}},[i,o,f]),y.useEffect(()=>{i&&(h||Hd(i))},[h,i]),g.jsxs(jm.Provider,{value:y.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:d,portalNode:i,setFocusManagerState:l}),[o,i]),children:[p&&i&&g.jsx(ef,{"data-type":"outside",ref:a,onFocus:m=>{if(nl(m,i)){var v;(v=u.current)==null||v.focus()}else{const b=s?s.domReference:null,C=M4(b);C?.focus()}}}),p&&i&&g.jsx("span",{"aria-owns":i.id,style:Pm}),i&&pa.createPortal(e,i),p&&i&&g.jsx(ef,{"data-type":"outside",ref:c,onFocus:m=>{if(nl(m,i)){var v;(v=d.current)==null||v.focus()}else{const b=s?s.domReference:null,C=E4(b);C?.focus(),s?.closeOnFocusOut&&s?.onOpenChange(!1,m.nativeEvent,"focus-out")}}})]})}const T5=()=>y.useContext(jm),A5={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},R5={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},nf=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function O5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=t,{enabled:s=!0,escapeKey:l=!0,outsidePress:a=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:d="pointerdown",ancestorScroll:f=!1,bubbles:h,capture:p}=e,m=hc(),v=at(typeof a=="function"?a:()=>!1),b=typeof a=="function"?v:a,C=y.useRef(!1),{escapeKey:x,outsidePress:w}=nf(h),{escapeKey:E,outsidePress:k}=nf(p),S=y.useRef(!1),M=at(I=>{var _;if(!n||!s||!l||I.key!=="Escape"||S.current)return;const F=(_=i.current.floatingContext)==null?void 0:_.nodeId,L=m?_o(m.nodesRef.current,F):[];if(!x&&(I.stopPropagation(),L.length>0)){let T=!0;if(L.forEach(R=>{var W;if((W=R.context)!=null&&W.open&&!R.context.dataRef.current.__escapeKeyBubbles){T=!1;return}}),!T)return}r(!1,b4(I)?I.nativeEvent:I,"escape-key")}),N=at(I=>{var _;const F=()=>{var L;M(I),(L=Gn(I))==null||L.removeEventListener("keydown",F)};(_=Gn(I))==null||_.addEventListener("keydown",F)}),P=at(I=>{var _;const F=i.current.insideReactTree;i.current.insideReactTree=!1;const L=C.current;if(C.current=!1,c==="click"&&L||F||typeof b=="function"&&!b(I))return;const T=Gn(I),R="["+no("inert")+"]",W=dt(o.floating).querySelectorAll(R);let ee=oe(T)?T:null;for(;ee&&!Rt(ee);){const le=Ot(ee);if(Rt(le)||!oe(le))break;ee=le}if(W.length&&oe(T)&&!m4(T)&&!sr(T,o.floating)&&Array.from(W).every(le=>!sr(ee,le)))return;if(Ue(T)&&H){const le=Rt(T),ge=tt(T),Y=/auto|scroll/,te=le||Y.test(ge.overflowX),Ke=le||Y.test(ge.overflowY),bt=te&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,Bn=Ke&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,Cs=ge.direction==="rtl",_n=Bn&&(Cs?I.offsetX<=T.offsetWidth-T.clientWidth:I.offsetX>T.clientWidth),M0=bt&&I.offsetY>T.clientHeight;if(_n||M0)return}const K=(_=i.current.floatingContext)==null?void 0:_.nodeId,Z=m&&_o(m.nodesRef.current,K).some(le=>{var ge;return tl(I,(ge=le.context)==null?void 0:ge.elements.floating)});if(tl(I,o.floating)||tl(I,o.domReference)||Z)return;const We=m?_o(m.nodesRef.current,K):[];if(We.length>0){let le=!0;if(We.forEach(ge=>{var Y;if((Y=ge.context)!=null&&Y.open&&!ge.context.dataRef.current.__outsidePressBubbles){le=!1;return}}),!le)return}r(!1,I,"outside-press")}),z=at(I=>{var _;const F=()=>{var L;P(I),(L=Gn(I))==null||L.removeEventListener(c,F)};(_=Gn(I))==null||_.addEventListener(c,F)});y.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=x,i.current.__outsidePressBubbles=w;let I=-1;function _(W){r(!1,W,"ancestor-scroll")}function F(){window.clearTimeout(I),S.current=!0}function L(){I=window.setTimeout(()=>{S.current=!1},rs()?5:0)}const T=dt(o.floating);l&&(T.addEventListener("keydown",E?N:M,E),T.addEventListener("compositionstart",F),T.addEventListener("compositionend",L)),b&&T.addEventListener(c,k?z:P,k);let R=[];return f&&(oe(o.domReference)&&(R=nn(o.domReference)),oe(o.floating)&&(R=R.concat(nn(o.floating))),!oe(o.reference)&&o.reference&&o.reference.contextElement&&(R=R.concat(nn(o.reference.contextElement)))),R=R.filter(W=>{var ee;return W!==((ee=T.defaultView)==null?void 0:ee.visualViewport)}),R.forEach(W=>{W.addEventListener("scroll",_,{passive:!0})}),()=>{l&&(T.removeEventListener("keydown",E?N:M,E),T.removeEventListener("compositionstart",F),T.removeEventListener("compositionend",L)),b&&T.removeEventListener(c,k?z:P,k),R.forEach(W=>{W.removeEventListener("scroll",_)}),window.clearTimeout(I)}},[i,o,l,b,c,n,r,f,s,x,w,M,E,N,P,k,z]),y.useEffect(()=>{i.current.insideReactTree=!1},[i,b,c]);const U=y.useMemo(()=>({onKeyDown:M,...u&&{[A5[d]]:I=>{r(!1,I.nativeEvent,"reference-press")},...d!=="click"&&{onClick(I){r(!1,I.nativeEvent,"reference-press")}}}}),[M,r,u,d]),H=y.useMemo(()=>({onKeyDown:M,onMouseDown(){C.current=!0},onMouseUp(){C.current=!0},[R5[c]]:()=>{i.current.insideReactTree=!0}}),[M,c,i]);return y.useMemo(()=>s?{reference:U,floating:H}:{},[s,U,H])}function N5(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=dc(),i=y.useRef({}),[s]=y.useState(()=>b5()),l=fc()!=null;if(process.env.NODE_ENV!=="production"){const h=r.reference;h&&!oe(h)&&v5("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=y.useState(r.reference),u=at((h,p,m)=>{i.current.openEvent=h?p:void 0,s.emit("openchange",{open:h,event:p,reason:m,nested:l}),n?.(h,p,m)}),d=y.useMemo(()=>({setPositionReference:c}),[]),f=y.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return y.useMemo(()=>({dataRef:i,open:e,onOpenChange:u,elements:f,events:s,floatingId:o,refs:d}),[e,u,f,s,o,d])}function I5(t){t===void 0&&(t={});const{nodeId:e}=t,n=N5({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[i,s]=y.useState(null),[l,a]=y.useState(null),u=o?.domReference||i,d=y.useRef(null),f=hc();ot(()=>{u&&(d.current=u)},[u]);const h=Om({...t,elements:{...o,...l&&{reference:l}}}),p=y.useCallback(x=>{const w=oe(x)?{getBoundingClientRect:()=>x.getBoundingClientRect(),getClientRects:()=>x.getClientRects(),contextElement:x}:x;a(w),h.refs.setReference(w)},[h.refs]),m=y.useCallback(x=>{(oe(x)||x===null)&&(d.current=x,s(x)),(oe(h.refs.reference.current)||h.refs.reference.current===null||x!==null&&!oe(x))&&h.refs.setReference(x)},[h.refs]),v=y.useMemo(()=>({...h.refs,setReference:m,setPositionReference:p,domReference:d}),[h.refs,m,p]),b=y.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),C=y.useMemo(()=>({...h,...r,refs:v,elements:b,nodeId:e}),[h,v,b,e,r]);return ot(()=>{r.dataRef.current.floatingContext=C;const x=f?.nodesRef.current.find(w=>w.id===e);x&&(x.context=C)}),y.useMemo(()=>({...h,context:C,refs:v,elements:b}),[h,v,b,C])}function ll(){return f4()&&vm()}function L5(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,events:o,dataRef:i,elements:s}=t,{enabled:l=!0,visibleOnly:a=!0}=e,c=y.useRef(!1),u=y.useRef(-1),d=y.useRef(!0);y.useEffect(()=>{if(!l)return;const h=Fe(s.domReference);function p(){!n&&Ue(s.domReference)&&s.domReference===ra(dt(s.domReference))&&(c.current=!0)}function m(){d.current=!0}function v(){d.current=!1}return h.addEventListener("blur",p),ll()&&(h.addEventListener("keydown",m,!0),h.addEventListener("pointerdown",v,!0)),()=>{h.removeEventListener("blur",p),ll()&&(h.removeEventListener("keydown",m,!0),h.removeEventListener("pointerdown",v,!0))}},[s.domReference,n,l]),y.useEffect(()=>{if(!l)return;function h(p){let{reason:m}=p;(m==="reference-press"||m==="escape-key")&&(c.current=!0)}return o.on("openchange",h),()=>{o.off("openchange",h)}},[o,l]),y.useEffect(()=>()=>{Ge(u)},[]);const f=y.useMemo(()=>({onMouseLeave(){c.current=!1},onFocus(h){if(c.current)return;const p=Gn(h.nativeEvent);if(a&&oe(p)){if(ll()&&!h.relatedTarget){if(!d.current&&!g4(p))return}else if(!y4(p))return}r(!0,h.nativeEvent,"focus")},onBlur(h){c.current=!1;const p=h.relatedTarget,m=h.nativeEvent,v=oe(p)&&p.hasAttribute(no("focus-guard"))&&p.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var b;const C=ra(s.domReference?s.domReference.ownerDocument:document);!p&&C===s.domReference||sr((b=i.current.floatingContext)==null?void 0:b.refs.floating.current,C)||sr(s.domReference,C)||v||r(!1,m,"focus")})}}),[i,s.domReference,r,a]);return y.useMemo(()=>l?{reference:f}:{},[l,f])}function al(t,e,n){const r=new Map,o=n==="item";let i=t;if(o&&t){const{[Gd]:s,[Jd]:l,...a}=t;i=a}return{...n==="floating"&&{tabIndex:-1,[h5]:""},...i,...e.map(s=>{const l=s?s[n]:null;return typeof l=="function"?t?l(t):null:l}).concat(t).reduce((s,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[Gd,Jd].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),s[c]=function(){for(var f,h=arguments.length,p=new Array(h),m=0;m<h;m++)p[m]=arguments[m];return(f=r.get(c))==null?void 0:f.map(v=>v(...p)).find(v=>v!==void 0)}}}else s[c]=u}),s),{})}}function D5(t){t===void 0&&(t=[]);const e=t.map(l=>l?.reference),n=t.map(l=>l?.floating),r=t.map(l=>l?.item),o=y.useCallback(l=>al(l,t,"reference"),e),i=y.useCallback(l=>al(l,t,"floating"),n),s=y.useCallback(l=>al(l,t,"item"),r);return y.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}const P5=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function j5(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:i,floatingId:s}=t,{enabled:l=!0,role:a="dialog"}=e,c=dc(),u=((n=i.domReference)==null?void 0:n.id)||c,d=y.useMemo(()=>{var C;return((C=v4(i.floating))==null?void 0:C.id)||s},[i.floating,s]),f=(r=P5.get(a))!=null?r:a,p=fc()!=null,m=y.useMemo(()=>f==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":o?d:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:u},...f==="menu"&&p&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[f,d,p,o,u,a]),v=y.useMemo(()=>{const C={id:d,...f&&{role:f}};return f==="tooltip"||a==="label"?C:{...C,...f==="menu"&&{"aria-labelledby":u}}},[f,d,u,a]),b=y.useCallback(C=>{let{active:x,selected:w}=C;const E={role:"option",...x&&{id:d+"-fui-option"}};switch(a){case"select":case"combobox":return{...E,"aria-selected":w}}return{}},[d,a]);return y.useMemo(()=>l?{reference:m,floating:v,item:b}:{},[l,m,v,b])}function B5({initialOpen:t=!1,placement:e="top",open:n,onOpenChange:r,delay:o=600,closeDelay:i=0}={}){const[s,l]=y.useState(t),a=n??s,c=r??l,u=I5({placement:e,open:a,onOpenChange:c,whileElementsMounted:Am,middleware:[Nm(4),Lm({crossAxis:e.includes("-"),fallbackAxisSideDirection:"start",padding:4}),Im({padding:4})]}),d=u.context,f=w5(d,{mouseOnly:!0,move:!1,restMs:o,enabled:n==null,delay:{close:i}}),h=L5(d,{enabled:n==null}),p=O5(d),m=j5(d,{role:"tooltip"}),v=D5([f,h,p,m]);return y.useMemo(()=>({open:a,setOpen:c,...v,...u}),[a,c,v,u])}const sa=y.createContext(null);function Bm(){const t=y.useContext(sa);if(t==null)throw new Error("Tooltip components must be wrapped in <TooltipProvider />");return t}function _m({children:t,...e}){const n=B5(e);return e.useDelayGroup?g.jsx(k5,{delay:{open:e.delay??0,close:e.closeDelay??0},timeoutMs:e.timeout,children:g.jsx(sa.Provider,{value:n,children:t})}):g.jsx(sa.Provider,{value:n,children:t})}const Hm=y.forwardRef(function({children:e,asChild:n=!1,...r},o){const i=Bm(),s=y.isValidElement(e)?parseInt(y.version,10)>=19?e.props.ref:e.ref:void 0,l=Dm([i.refs.setReference,o,s]);if(n&&y.isValidElement(e)){const a={"data-tooltip-state":i.open?"open":"closed"};return y.cloneElement(e,i.getReferenceProps({ref:l,...r,...typeof e.props=="object"?e.props:{},...a}))}return g.jsx("button",{ref:l,"data-tooltip-state":i.open?"open":"closed",...i.getReferenceProps(r),children:e})}),Fm=y.forwardRef(function({style:e,children:n,portal:r=!0,portalProps:o={},...i},s){const l=Bm(),a=Dm([l.refs.setFloating,s]);if(!l.open)return null;const c=g.jsx("div",{ref:a,style:{...l.floatingStyles,...e},...l.getFloatingProps(i),className:"tiptap-tooltip",children:n});return r?g.jsx(M5,{...o,children:c}):c});_m.displayName="Tooltip";Hm.displayName="TooltipTrigger";Fm.displayName="TooltipContent";const la=5*1024*1024,_5={mod:"⌘",command:"⌘",meta:"⌘",ctrl:"⌃",control:"⌃",alt:"⌥",option:"⌥",shift:"⇧",backspace:"Del",delete:"⌦",enter:"⏎",escape:"⎋",capslock:"⇪"};function Me(...t){return t.filter(Boolean).join(" ")}function H5(){return typeof navigator<"u"&&navigator.platform.toLowerCase().includes("mac")}const F5=(t,e,n=!0)=>{if(e){const r=t.toLowerCase();return _5[r]||(n?t.toUpperCase():t)}return n?t.charAt(0).toUpperCase()+t.slice(1):t},gt=t=>{const{shortcutKeys:e,delimiter:n="+",capitalize:r=!0}=t;return e?e.split(n).map(o=>o.trim()).map(o=>F5(o,H5(),r)):[]},ro=(t,e)=>e?.schema?e.schema.spec.marks.get(t)!==void 0:!1,Pt=(t,e)=>e?.schema?e.schema.spec.nodes.get(t)!==void 0:!1;function $5(t){const{state:e,view:n}=t,{doc:r,selection:o}=e,i=q.findFrom(o.$to,1,!0);if(i)return n.dispatch(e.tr.setSelection(i).scrollIntoView()),!0;const s=e.schema.nodes.paragraph;if(!s)return console.warn("No paragraph node type found in schema."),!1;const l=r.content.size,a=s.create();let c=e.tr.insert(l,a);const u=c.doc.resolve(l+1);return c=c.setSelection(V.near(u)).scrollIntoView(),n.dispatch(c),!0}function yt(t){return typeof t=="number"&&t>=0}function ls(t,e){if(!t)return!1;const n=Array.isArray(e)?e:[e],r=n.some(o=>t.extensionManager.extensions.some(i=>i.name===o));return r||console.warn(`None of the extensions [${n.join(", ")}] were found in the editor schema. Ensure they are included in the editor configuration.`),r}function V5(t,e){try{const n=t.state.doc.nodeAt(e);return n||(console.warn(`No node found at position ${e}`),null)}catch(n){return console.error(`Error getting node at position ${e}:`,n),null}}function fn(t){const{editor:e,node:n,nodePos:r}=t;if(!e||!e.state?.doc)return null;const o=n!=null,i=yt(r);if(!o&&!i)return null;if(o){let s=-1,l=null;if(e.state.doc.descendants((a,c)=>a===n?(s=c,l=a,!1):!0),s!==-1&&l!==null)return{pos:s,node:l}}if(i){const s=V5(e,r);if(s)return{pos:r,node:s}}return null}function jt(t,e=[]){if(!t||!t.state.selection)return!1;const{state:n}=t,{selection:r}=n;if(r.empty)return!1;if(r instanceof B){const o=r.node;return o?e.includes(o.type.name):!1}return!1}const z5=async(t,e,n)=>{if(!t)throw new Error("No file provided");if(t.size>la)throw new Error(`File size exceeds maximum allowed (${la/(1024*1024)}MB)`);for(let r=0;r<=100;r+=10){if(n?.aborted)throw new Error("Upload cancelled");await new Promise(o=>setTimeout(o,500)),e?.({progress:r})}return"/images/tiptap-ui-placeholder-image.jpg"},U5=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function W5(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return!t||t.replace(U5,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}function K5(t,e,n){try{const r=new URL(t,e);if(W5(r.href,n))return r.href}catch{}return"#"}const q5=({shortcuts:t})=>t.length===0?null:g.jsx("div",{children:t.map((e,n)=>g.jsxs(y.Fragment,{children:[n>0&&g.jsx("kbd",{children:"+"}),g.jsx("kbd",{children:e})]},n))}),fe=y.forwardRef(({className:t,children:e,tooltip:n,showTooltip:r=!0,shortcutKeys:o,"aria-label":i,...s},l)=>{const a=y.useMemo(()=>gt({shortcutKeys:o}),[o]);return!n||!r?g.jsx("button",{className:Me("tiptap-button",t),ref:l,"aria-label":i,...s,children:e}):g.jsxs(_m,{delay:200,children:[g.jsx(Hm,{className:Me("tiptap-button",t),ref:l,"aria-label":i,...s,children:e}),g.jsxs(Fm,{children:[n,g.jsx(q5,{shortcuts:a})]})]})});fe.displayName="Button";const In=y.forwardRef(({className:t,children:e,orientation:n="vertical",...r},o)=>g.jsx("div",{ref:o,className:Me("tiptap-button-group",t),"data-orientation":n,role:"group",...r,children:e}));In.displayName="ButtonGroup";function rf({orientation:t="horizontal",size:e,style:n={},...r}){const o={...n,...t==="horizontal"&&!e&&{flex:1},...e&&{width:t==="vertical"?"1px":e,height:t==="horizontal"?"1px":e}};return g.jsx("div",{...r,style:o})}const as=y.forwardRef(({decorative:t,orientation:e="vertical",className:n,...r},o)=>{const s=t?{role:"none"}:{"aria-orientation":e==="vertical"?e:void 0,role:"separator"};return g.jsx("div",{className:Me("tiptap-separator",n),"data-orientation":e,...s,...r,ref:o})});as.displayName="Separator";function $m({editor:t,containerRef:e,query:n,items:r,onSelect:o,onClose:i,orientation:s="vertical",autoSelectFirstItem:l=!0}){const[a,c]=y.useState(l?0:-1);return y.useEffect(()=>{const u=f=>{if(!r.length)return!1;const h=()=>c(m=>m===-1?0:(m+1)%r.length),p=()=>c(m=>m===-1?r.length-1:(m-1+r.length)%r.length);switch(f.key){case"ArrowUp":return s==="horizontal"?!1:(f.preventDefault(),p(),!0);case"ArrowDown":return s==="horizontal"?!1:(f.preventDefault(),h(),!0);case"ArrowLeft":return s==="vertical"?!1:(f.preventDefault(),p(),!0);case"ArrowRight":return s==="vertical"?!1:(f.preventDefault(),h(),!0);case"Tab":return f.preventDefault(),f.shiftKey?p():h(),!0;case"Home":return f.preventDefault(),c(0),!0;case"End":return f.preventDefault(),c(r.length-1),!0;case"Enter":return f.isComposing?!1:(f.preventDefault(),a!==-1&&r[a]&&o?.(r[a]),!0);case"Escape":return f.preventDefault(),i?.(),!0;default:return!1}};let d=null;if(t?d=t.view.dom:e?.current&&(d=e.current),d)return d.addEventListener("keydown",u,!0),()=>{d?.removeEventListener("keydown",u,!0)}},[t,e,r,a,o,i,s]),y.useEffect(()=>{n&&c(l?0:-1)},[n,l]),{selectedIndex:r.length?a:void 0,setSelectedIndex:c}}const of=(t,e)=>{typeof t=="function"?t(e):t&&typeof t=="object"&&"current"in t&&(t.current=e)},G5=(t,e)=>{const n=y.useRef(null);return y.useCallback(r=>{t&&"current"in t&&(t.current=r),n.current&&of(n.current,null),n.current=e,e&&of(e,r)},[t,e])},J5=t=>{const[e,n]=y.useState([]),r=y.useCallback(()=>t.current?Array.from(t.current.querySelectorAll('button:not([disabled]), [role="button"]:not([disabled]), [tabindex="0"]:not([disabled])')):[],[t]);y.useEffect(()=>{const i=t.current;if(!i)return;const s=()=>n(r());s();const l=new MutationObserver(s);return l.observe(i,{childList:!0,subtree:!0}),()=>l.disconnect()},[r,t]);const{selectedIndex:o}=$m({containerRef:t,items:e,orientation:"horizontal",onSelect:i=>i.click(),autoSelectFirstItem:!1});y.useEffect(()=>{const i=t.current;if(!i)return;const s=a=>{const c=a.target;i.contains(c)&&c.setAttribute("data-focus-visible","true")},l=a=>{const c=a.target;i.contains(c)&&c.removeAttribute("data-focus-visible")};return i.addEventListener("focus",s,!0),i.addEventListener("blur",l,!0),()=>{i.removeEventListener("focus",s,!0),i.removeEventListener("blur",l,!0)}},[t]),y.useEffect(()=>{o!==void 0&&e[o]&&e[o].focus()},[o,e])},pc=y.forwardRef(({children:t,className:e,variant:n="fixed",...r},o)=>{const i=y.useRef(null),s=G5(i,o);return J5(i),g.jsx("div",{ref:s,role:"toolbar","aria-label":"toolbar","data-variant":n,className:Me("tiptap-toolbar",e),...r,children:t})});pc.displayName="Toolbar";const Kt=y.forwardRef(({children:t,className:e,...n},r)=>g.jsx("div",{ref:r,role:"group",className:Me("tiptap-toolbar-group",e),...n,children:t}));Kt.displayName="ToolbarGroup";const qt=y.forwardRef(({...t},e)=>g.jsx(as,{ref:e,orientation:"vertical",decorative:!0,...t}));qt.displayName="ToolbarSeparator";const Vm=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M18.7071 6.70711C19.0976 6.31658 19.0976 5.68342 18.7071 5.29289C18.3166 4.90237 17.6834 4.90237 17.2929 5.29289L12 10.5858L6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L10.5858 12L5.29289 17.2929C4.90237 17.6834 4.90237 18.3166 5.29289 18.7071C5.68342 19.0976 6.31658 19.0976 6.70711 18.7071L12 13.4142L17.2929 18.7071C17.6834 19.0976 18.3166 19.0976 18.7071 18.7071C19.0976 18.3166 19.0976 17.6834 18.7071 17.2929L13.4142 12L18.7071 6.70711Z",fill:"currentColor"})}));Vm.displayName="CloseIcon";function Z5(t){const[e,n]=y.useState([]),r=async l=>{if(l.size>t.maxSize){const d=new Error(`File size exceeds maximum allowed (${t.maxSize/1024/1024}MB)`);return t.onError?.(d),null}const a=new AbortController,c=crypto.randomUUID(),u={id:c,file:l,progress:0,status:"uploading",abortController:a};n(d=>[...d,u]);try{if(!t.upload)throw new Error("Upload function is not defined");const d=await t.upload(l,f=>{n(h=>h.map(p=>p.id===c?{...p,progress:f.progress}:p))},a.signal);if(!d)throw new Error("Upload failed: No URL returned");return a.signal.aborted?null:(n(f=>f.map(h=>h.id===c?{...h,status:"success",url:d,progress:100}:h)),t.onSuccess?.(d),d)}catch(d){return a.signal.aborted||(n(f=>f.map(h=>h.id===c?{...h,status:"error",progress:0}:h)),t.onError?.(d instanceof Error?d:new Error("Upload failed"))),null}};return{fileItems:e,uploadFiles:async l=>{if(!l||l.length===0)return t.onError?.(new Error("No files to upload")),[];if(t.limit&&l.length>t.limit)return t.onError?.(new Error(`Maximum ${t.limit} file${t.limit===1?"":"s"} allowed`)),[];const a=l.map(u=>r(u));return(await Promise.all(a)).filter(u=>u!==null)},removeFileItem:l=>{n(a=>{const c=a.find(u=>u.id===l);return c?.abortController&&c.abortController.abort(),c?.url&&URL.revokeObjectURL(c.url),a.filter(u=>u.id!==l)})},clearAllFiles:()=>{e.forEach(l=>{l.abortController&&l.abortController.abort(),l.url&&URL.revokeObjectURL(l.url)}),n([])}}}const zm=()=>g.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",className:"tiptap-image-upload-icon",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[g.jsx("path",{d:"M11.1953 4.41771C10.3478 4.08499 9.43578 3.94949 8.5282 4.02147C7.62062 4.09345 6.74133 4.37102 5.95691 4.83316C5.1725 5.2953 4.50354 5.92989 4.00071 6.68886C3.49788 7.44783 3.17436 8.31128 3.05465 9.2138C2.93495 10.1163 3.0222 11.0343 3.3098 11.8981C3.5974 12.7619 4.07781 13.5489 4.71463 14.1995C5.10094 14.5942 5.09414 15.2274 4.69945 15.6137C4.30476 16 3.67163 15.9932 3.28532 15.5985C2.43622 14.731 1.79568 13.6816 1.41221 12.5299C1.02875 11.3781 0.91241 10.1542 1.07201 8.95084C1.23162 7.74748 1.66298 6.59621 2.33343 5.58425C3.00387 4.57229 3.89581 3.72617 4.9417 3.10998C5.98758 2.4938 7.15998 2.1237 8.37008 2.02773C9.58018 1.93176 10.7963 2.11243 11.9262 2.55605C13.0561 2.99968 14.0703 3.69462 14.8919 4.58825C15.5423 5.29573 16.0585 6.11304 16.4177 7.00002H17.4999C18.6799 6.99991 19.8288 7.37933 20.7766 8.08222C21.7245 8.78515 22.4212 9.7743 22.7637 10.9036C23.1062 12.0328 23.0765 13.2423 22.6788 14.3534C22.2812 15.4644 21.5367 16.4181 20.5554 17.0736C20.0962 17.3803 19.4752 17.2567 19.1684 16.7975C18.8617 16.3382 18.9853 15.7172 19.4445 15.4105C20.069 14.9934 20.5427 14.3865 20.7958 13.6794C21.0488 12.9724 21.0678 12.2027 20.8498 11.4841C20.6318 10.7655 20.1885 10.136 19.5853 9.6887C18.9821 9.24138 18.251 8.99993 17.5001 9.00002H15.71C15.2679 9.00002 14.8783 8.70973 14.7518 8.28611C14.4913 7.41374 14.0357 6.61208 13.4195 5.94186C12.8034 5.27164 12.0427 4.75043 11.1953 4.41771Z",fill:"currentColor"}),g.jsx("path",{d:"M11 14.4142V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V14.4142L15.2929 16.7071C15.6834 17.0976 16.3166 17.0976 16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929L12.7078 11.2936C12.7054 11.2912 12.703 11.2888 12.7005 11.2864C12.5208 11.1099 12.2746 11.0008 12.003 11L12 11L11.997 11C11.8625 11.0004 11.7343 11.0273 11.6172 11.0759C11.502 11.1236 11.3938 11.1937 11.2995 11.2864C11.297 11.2888 11.2946 11.2912 11.2922 11.2936L7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071C7.68342 17.0976 8.31658 17.0976 8.70711 16.7071L11 14.4142Z",fill:"currentColor"})]}),Y5=()=>g.jsx("svg",{width:"43",height:"57",viewBox:"0 0 43 57",fill:"currentColor",className:"tiptap-image-upload-dropzone-rect-primary",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M0.75 10.75C0.75 5.64137 4.89137 1.5 10 1.5H32.3431C33.2051 1.5 34.0317 1.84241 34.6412 2.4519L40.2981 8.10876C40.9076 8.71825 41.25 9.5449 41.25 10.4069V46.75C41.25 51.8586 37.1086 56 32 56H10C4.89137 56 0.75 51.8586 0.75 46.75V10.75Z",fill:"currentColor",fillOpacity:"0.11",stroke:"currentColor",strokeWidth:"1.5"})}),X5=()=>g.jsx("svg",{width:"10",height:"10",className:"tiptap-image-upload-dropzone-rect-secondary",viewBox:"0 0 10 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M0 0.75H0.343146C1.40401 0.75 2.42143 1.17143 3.17157 1.92157L8.82843 7.57843C9.57857 8.32857 10 9.34599 10 10.4069V10.75H4C1.79086 10.75 0 8.95914 0 6.75V0.75Z",fill:"currentColor"})}),Q5=({onFile:t,children:e})=>{const[n,r]=y.useState(!1),[o,i]=y.useState(!1),s=u=>{u.preventDefault(),u.stopPropagation(),i(!0)},l=u=>{u.preventDefault(),u.stopPropagation(),u.currentTarget.contains(u.relatedTarget)||(i(!1),r(!1))},a=u=>{u.preventDefault(),u.stopPropagation(),r(!0)},c=u=>{u.preventDefault(),u.stopPropagation(),i(!1),r(!1);const d=Array.from(u.dataTransfer.files);d.length>0&&t(d)};return g.jsx("div",{className:`tiptap-image-upload-drag-area ${o?"drag-active":""} ${n?"drag-over":""}`,onDragEnter:s,onDragLeave:l,onDragOver:a,onDrop:c,children:e})},e3=({fileItem:t,onRemove:e})=>{const n=r=>{if(r===0)return"0 Bytes";const o=1024,i=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(r)/Math.log(o));return`${parseFloat((r/Math.pow(o,s)).toFixed(2))} ${i[s]}`};return g.jsxs("div",{className:"tiptap-image-upload-preview",children:[t.status==="uploading"&&g.jsx("div",{className:"tiptap-image-upload-progress",style:{width:`${t.progress}%`}}),g.jsxs("div",{className:"tiptap-image-upload-preview-content",children:[g.jsxs("div",{className:"tiptap-image-upload-file-info",children:[g.jsx("div",{className:"tiptap-image-upload-file-icon",children:g.jsx(zm,{})}),g.jsxs("div",{className:"tiptap-image-upload-details",children:[g.jsx("span",{className:"tiptap-image-upload-text",children:t.file.name}),g.jsx("span",{className:"tiptap-image-upload-subtext",children:n(t.file.size)})]})]}),g.jsxs("div",{className:"tiptap-image-upload-actions",children:[t.status==="uploading"&&g.jsxs("span",{className:"tiptap-image-upload-progress-text",children:[t.progress,"%"]}),g.jsx(fe,{type:"button","data-style":"ghost",onClick:r=>{r.stopPropagation(),e()},children:g.jsx(Vm,{className:"tiptap-button-icon"})})]})]})]})},t3=({maxSize:t,limit:e})=>g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"tiptap-image-upload-dropzone",children:[g.jsx(Y5,{}),g.jsx(X5,{}),g.jsx("div",{className:"tiptap-image-upload-icon-container",children:g.jsx(zm,{})})]}),g.jsxs("div",{className:"tiptap-image-upload-content",children:[g.jsxs("span",{className:"tiptap-image-upload-text",children:[g.jsx("em",{children:"Click to upload"})," or drag and drop"]}),g.jsxs("span",{className:"tiptap-image-upload-subtext",children:["Maximum ",e," file",e===1?"":"s",", ",t/1024/1024,"MB each."]})]})]}),n3=t=>{const{accept:e,limit:n,maxSize:r}=t.node.attrs,o=y.useRef(null),i=t.extension,s={maxSize:r,limit:n,accept:e,upload:i.options.upload,onSuccess:i.options.onSuccess,onError:i.options.onError},{fileItems:l,uploadFiles:a,removeFileItem:c,clearAllFiles:u}=Z5(s),d=async m=>{const v=await a(m);if(v.length>0){const b=t.getPos();if(yt(b)){const C=v.map((x,w)=>{const E=m[w]?.name.replace(/\.[^/.]+$/,"")||"unknown";return{type:i.options.type,attrs:{...i.options,src:x,alt:E,title:E}}});t.editor.chain().focus().deleteRange({from:b,to:b+t.node.nodeSize}).insertContentAt(b,C).run(),$5(t.editor)}}},f=m=>{const v=m.target.files;if(!v||v.length===0){i.options.onError?.(new Error("No file selected"));return}d(Array.from(v))},h=()=>{o.current&&l.length===0&&(o.current.value="",o.current.click())},p=l.length>0;return g.jsxs(Np,{className:"tiptap-image-upload",tabIndex:0,onClick:h,children:[!p&&g.jsx(Q5,{onFile:d,children:g.jsx(t3,{maxSize:r,limit:n})}),p&&g.jsxs("div",{className:"tiptap-image-upload-previews",children:[l.length>1&&g.jsxs("div",{className:"tiptap-image-upload-header",children:[g.jsxs("span",{children:["Uploading ",l.length," files"]}),g.jsx(fe,{type:"button","data-style":"ghost",onClick:m=>{m.stopPropagation(),u()},children:"Clear All"})]}),l.map(m=>g.jsx(e3,{fileItem:m,onRemove:()=>c(m.id)},m.id))]}),g.jsx("input",{ref:o,name:"file",accept:e,type:"file",multiple:n>1,onChange:f,onClick:m=>m.stopPropagation()})]})},r3=je.create({name:"imageUpload",group:"block",draggable:!0,atom:!0,addOptions(){return{type:"image",accept:"image/*",limit:1,maxSize:0,upload:void 0,onError:void 0,onSuccess:void 0,HTMLAttributes:{}}},addAttributes(){return{accept:{default:this.options.accept},limit:{default:this.options.limit},maxSize:{default:this.options.maxSize}}},parseHTML(){return[{tag:'div[data-type="image-upload"]'}]},renderHTML({HTMLAttributes:t}){return["div",re({"data-type":"image-upload"},t)]},addNodeView(){return Ip(n3)},addCommands(){return{setImageUploadNode:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addKeyboardShortcuts(){return{Enter:({editor:t})=>{const{selection:e}=t.state,{nodeAfter:n}=e.$from;if(n&&n.type.name==="imageUpload"&&t.isActive("imageUpload")){const r=t.view.nodeDOM(e.$from.pos);if(r&&r instanceof HTMLElement){const o=r.firstChild;if(o&&o instanceof HTMLElement)return o.click(),!0}}return!1}}}}),o3=xx.extend({renderHTML(){return["div",re(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),i3=({node:t,updateAttributes:e,selected:n})=>{const[r,o]=j.useState(!1),[i,s]=j.useState({width:t.attrs.width||300,height:t.attrs.height||"auto"}),l=j.useRef(null),a=j.useRef(null),c=j.useRef(t.attrs.width||300),u=t.attrs.imageId||`img-${Date.now()}`;j.useEffect(()=>{s({width:t.attrs.width||300,height:t.attrs.height||"auto"})},[t.attrs.width,t.attrs.height]);const d=j.useCallback(C=>{C.preventDefault(),C.stopPropagation(),o(!0);const x=C.clientX,w=typeof i.width=="number"?i.width:300,E=l.current;let k=1;E&&E.naturalWidth&&E.naturalHeight&&(k=E.naturalWidth/E.naturalHeight);const S=N=>{const P=N.clientX-x,z=Math.max(50,w+P);c.current=z;const U=i.height==="auto"?"auto":Math.max(30,z/k);s({width:z,height:U}),a.current&&(a.current.style.width=`${z}px`,U!=="auto"&&(a.current.style.height=`${U}px`))},M=()=>{o(!1);const N=Math.round(c.current);e({width:N}),document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",M)};document.addEventListener("mousemove",S),document.addEventListener("mouseup",M)},[i,e]),f=j.useCallback(()=>{i.height==="auto"&&l.current&&s(C=>({...C,height:"auto"}))},[i.width,i.height]),h=t.attrs.textAlign||"left",p=h==="center"?"center":h==="right"?"flex-end":"flex-start",m={position:"relative",display:"inline-block",width:i.width,height:i.height==="auto"?"auto":i.height,maxWidth:"100%",userSelect:r?"none":"auto",outline:n?"2px solid #007bff":"none",outlineOffset:"2px"},v={width:"100%",height:i.height==="auto"?"auto":"100%",display:"block",objectFit:"contain"},b={position:"absolute",bottom:-5,right:-5,width:12,height:12,background:"#007bff",border:"2px solid white",borderRadius:"50%",cursor:"nw-resize",opacity:n||r?1:0,transition:"opacity 0.2s ease",zIndex:10,boxShadow:"0 2px 4px rgba(0,0,0,0.2)"};return g.jsx(Np,{className:"resizable-image-wrapper","data-drag-handle":"",style:{display:"flex",justifyContent:p},children:g.jsxs("div",{ref:a,id:`resizable-image-${u}`,style:m,onMouseEnter:()=>{if(a.current){const C=a.current.querySelector(".resize-handle");C&&(C.style.opacity="1")}},onMouseLeave:()=>{if(!r&&!n&&a.current){const C=a.current.querySelector(".resize-handle");C&&(C.style.opacity="0")}},children:[g.jsx("img",{ref:l,src:t.attrs.src,alt:t.attrs.alt||"",title:t.attrs.title||"",style:v,onLoad:f,draggable:!1}),g.jsx("div",{className:"resize-handle",style:b,onMouseDown:d,title:"拖拽調整圖片大小"}),(n||r)&&g.jsxs("div",{style:{position:"absolute",top:-25,left:0,background:"rgba(0, 0, 0, 0.8)",color:"white",padding:"2px 6px",borderRadius:"3px",fontSize:"12px",whiteSpace:"nowrap",zIndex:11},children:[typeof i.width=="number"?Math.round(i.width):i.width," ","×"," ",i.height==="auto"?"auto":typeof i.height=="number"?Math.round(i.height):i.height]})]})})},s3=je.create({name:"resizableImage",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null,parseHTML:t=>{const e=t.getAttribute("width");return e?parseInt(e):null},renderHTML:t=>t.width?{width:t.width,height:"auto"}:{}},textAlign:{default:"left",parseHTML:t=>t.getAttribute("data-text-align")||"left",renderHTML:t=>!t.textAlign||t.textAlign==="left"?{}:{"data-text-align":t.textAlign}},imageId:{default:null,parseHTML:t=>t.getAttribute("data-image-id"),renderHTML:t=>t.imageId?{"data-image-id":t.imageId}:{}}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])',getAttrs:t=>{const e=t,n=e.getAttribute("width"),r=e.getAttribute("data-image-id");return{src:e.getAttribute("src"),alt:e.getAttribute("alt"),title:e.getAttribute("title"),width:n?parseInt(n):300,imageId:r||`img-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}}}]},renderHTML({HTMLAttributes:t}){return["img",re(this.options.HTMLAttributes,t)]},addCommands(){return{setResizableImage:t=>({commands:e})=>{const n=`img-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return e.insertContent({type:this.name,attrs:{...t,imageId:n,width:t.width||300}})},setImageSize:t=>({commands:e})=>e.updateAttributes(this.name,t)}},addNodeView(){return Ip(i3)}}),mc=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.29289 8.29289C5.68342 7.90237 6.31658 7.90237 6.70711 8.29289L12 13.5858L17.2929 8.29289C17.6834 7.90237 18.3166 7.90237 18.7071 8.29289C19.0976 8.68342 19.0976 9.31658 18.7071 9.70711L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70711C4.90237 9.31658 4.90237 8.68342 5.29289 8.29289Z",fill:"currentColor"})}));mc.displayName="ChevronDownIcon";function ie(t){const{editor:e}=KC(),n=y.useMemo(()=>t||e,[t,e]);return Ap({editor:n,selector(o){return o.editor?{editor:o.editor,editorState:o.editor.state,canCommand:o.editor.can}:{editor:null,editorState:void 0,canCommand:void 0}}})||{editor:null}}const vt=y.forwardRef(({variant:t,size:e="default",appearance:n="default",trimText:r=!1,className:o,children:i,...s},l)=>g.jsx("div",{ref:l,className:`tiptap-badge ${o||""}`,"data-style":t,"data-size":e,"data-appearance":n,"data-text-trim":r?"on":"off",...s,children:i}));vt.displayName="Badge";function l3({level:t,shortcutKeys:e=Xm[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Um=y.forwardRef(({editor:t,level:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,canToggle:f,isActive:h,handleToggle:p,label:m,Icon:v,shortcutKeys:b}=c3({editor:u,level:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&p()},[p,s]);return d?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":h?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":m,"aria-pressed":h,tooltip:m,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(l3,{level:e,shortcutKeys:b})]})}):null});Um.displayName="HeadingButton";const Wm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M21.0001 10C21.0001 9.63121 20.7971 9.29235 20.472 9.11833C20.1468 8.94431 19.7523 8.96338 19.4454 9.16795L16.4454 11.168C15.9859 11.4743 15.8617 12.0952 16.1681 12.5547C16.4744 13.0142 17.0953 13.1384 17.5548 12.8321L19.0001 11.8685V18C19.0001 18.5523 19.4478 19 20.0001 19C20.5524 19 21.0001 18.5523 21.0001 18V10Z",fill:"currentColor"})]}));Wm.displayName="HeadingOneIcon";const Km=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M22.0001 12C22.0001 10.7611 21.1663 9.79297 20.0663 9.42632C18.9547 9.05578 17.6171 9.28724 16.4001 10.2C15.9582 10.5314 15.8687 11.1582 16.2001 11.6C16.5314 12.0418 17.1582 12.1314 17.6001 11.8C18.383 11.2128 19.0455 11.1942 19.4338 11.3237C19.8339 11.457 20.0001 11.7389 20.0001 12C20.0001 12.4839 19.8554 12.7379 19.6537 12.9481C19.4275 13.1837 19.1378 13.363 18.7055 13.6307C18.6313 13.6767 18.553 13.7252 18.4701 13.777C17.9572 14.0975 17.3128 14.5261 16.8163 15.2087C16.3007 15.9177 16.0001 16.8183 16.0001 18C16.0001 18.5523 16.4478 19 17.0001 19H21.0001C21.5523 19 22.0001 18.5523 22.0001 18C22.0001 17.4477 21.5523 17 21.0001 17H18.131C18.21 16.742 18.3176 16.5448 18.4338 16.385C18.6873 16.0364 19.0429 15.7775 19.5301 15.473C19.5898 15.4357 19.6536 15.3966 19.7205 15.3556C20.139 15.0992 20.6783 14.7687 21.0964 14.3332C21.6447 13.7621 22.0001 13.0161 22.0001 12Z",fill:"currentColor"})]}));Km.displayName="HeadingTwoIcon";const qm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4608 11.2169C19.1135 11.0531 18.5876 11.0204 18.0069 11.3619C17.5309 11.642 16.918 11.4831 16.638 11.007C16.358 10.531 16.5169 9.91809 16.9929 9.63807C18.1123 8.97962 19.3364 8.94691 20.314 9.40808C21.2839 9.86558 21.9999 10.818 21.9999 12C21.9999 12.7957 21.6838 13.5587 21.1212 14.1213C20.5586 14.6839 19.7956 15 18.9999 15C18.4476 15 17.9999 14.5523 17.9999 14C17.9999 13.4477 18.4476 13 18.9999 13C19.2651 13 19.5195 12.8947 19.707 12.7071C19.8946 12.5196 19.9999 12.2652 19.9999 12C19.9999 11.6821 19.8159 11.3844 19.4608 11.2169Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0001 14C18.0001 13.4477 18.4478 13 19.0001 13C19.7957 13 20.5588 13.3161 21.1214 13.8787C21.684 14.4413 22.0001 15.2043 22.0001 16C22.0001 17.2853 21.2767 18.3971 20.1604 18.8994C19.0257 19.41 17.642 19.2315 16.4001 18.3C15.9582 17.9686 15.8687 17.3418 16.2001 16.9C16.5314 16.4582 17.1582 16.3686 17.6001 16.7C18.3581 17.2685 18.9744 17.24 19.3397 17.0756C19.7234 16.9029 20.0001 16.5147 20.0001 16C20.0001 15.7348 19.8947 15.4804 19.7072 15.2929C19.5196 15.1054 19.2653 15 19.0001 15C18.4478 15 18.0001 14.5523 18.0001 14Z",fill:"currentColor"})]}));qm.displayName="HeadingThreeIcon";const Gm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",fill:"currentColor"}),g.jsx("path",{d:"M17 9C17.5523 9 18 9.44772 18 10V13H20V10C20 9.44772 20.4477 9 21 9C21.5523 9 22 9.44772 22 10V18C22 18.5523 21.5523 19 21 19C20.4477 19 20 18.5523 20 18V15H17C16.4477 15 16 14.5523 16 14V10C16 9.44772 16.4477 9 17 9Z",fill:"currentColor"})]}));Gm.displayName="HeadingFourIcon";const Jm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{d:"M16 10C16 9.44772 16.4477 9 17 9H21C21.5523 9 22 9.44772 22 10C22 10.5523 21.5523 11 21 11H18V12H18.3C20.2754 12 22 13.4739 22 15.5C22 17.5261 20.2754 19 18.3 19C17.6457 19 17.0925 18.8643 16.5528 18.5944C16.0588 18.3474 15.8586 17.7468 16.1055 17.2528C16.3525 16.7588 16.9532 16.5586 17.4472 16.8056C17.7074 16.9357 17.9542 17 18.3 17C19.3246 17 20 16.2739 20 15.5C20 14.7261 19.3246 14 18.3 14H17C16.4477 14 16 13.5523 16 13L16 12.9928V10Z",fill:"currentColor"})]}));Jm.displayName="HeadingFiveIcon";const Zm=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.7071 9.29289C21.0976 9.68342 21.0976 10.3166 20.7071 10.7071C19.8392 11.575 19.2179 12.2949 18.7889 13.0073C18.8587 13.0025 18.929 13 19 13C20.6569 13 22 14.3431 22 16C22 17.6569 20.6569 19 19 19C17.3431 19 16 17.6569 16 16C16 14.6007 16.2837 13.4368 16.8676 12.3419C17.4384 11.2717 18.2728 10.3129 19.2929 9.29289C19.6834 8.90237 20.3166 8.90237 20.7071 9.29289ZM19 17C18.4477 17 18 16.5523 18 16C18 15.4477 18.4477 15 19 15C19.5523 15 20 15.4477 20 16C20 16.5523 19.5523 17 19 17Z",fill:"currentColor"})]}));Zm.displayName="HeadingSixIcon";const Ym={1:Wm,2:Km,3:qm,4:Gm,5:Jm,6:Zm},Xm={1:"ctrl+alt+1",2:"ctrl+alt+2",3:"ctrl+alt+3",4:"ctrl+alt+4",5:"ctrl+alt+5",6:"ctrl+alt+6"};function Kr(t,e,n=!0){if(!t||!t.isEditable||!Pt("heading",t)||jt(t,["image"]))return!1;if(!n)return e?t.can().setNode("heading",{level:e}):t.can().setNode("heading");try{const o=t.view.state,i=o.selection;if(i.empty||i instanceof V){const s=fn({editor:t,node:o.selection.$anchor.node(1)})?.pos;if(!yt(s))return!1}return!0}catch{return!1}}function gc(t,e){return!t||!t.isEditable?!1:Array.isArray(e)?e.some(n=>t.isActive("heading",{level:n})):e?t.isActive("heading",{level:e}):t.isActive("heading")}function a3(t,e){if(!t||!t.isEditable)return!1;const n=Array.isArray(e)?e:[e],r=n.find(o=>Kr(t,o));if(!r)return!1;try{const o=t.view;let i=o.state,s=i.tr;if(i.selection.empty||i.selection instanceof V){const d=fn({editor:t,node:i.selection.$anchor.node(1)})?.pos;if(!yt(d))return!1;s=s.setSelection(B.create(i.doc,d)),o.dispatch(s),i=o.state}const l=i.selection;let a=t.chain().focus();if(l instanceof B){const d=l.node.firstChild?.firstChild,f=l.node.lastChild?.lastChild,h=d?l.from+d.nodeSize:l.from+1,p=f?l.to-f.nodeSize:l.to-1;a=a.setTextSelection({from:h,to:p}).clearNodes()}return(n.some(d=>t.isActive("heading",{level:d}))?a.setNode("paragraph"):a.setNode("heading",{level:r})).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function Qm(t){const{editor:e,level:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!Pt("heading",e)?!1:r&&!e.isActive("code")?Array.isArray(n)?n.some(o=>Kr(e,o)):Kr(e,n):!0}function c3(t){const{editor:e,level:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Kr(i,n),c=gc(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(Qm({editor:i,level:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=a3(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleToggle:u,canToggle:a,label:`Heading ${n}`,shortcutKeys:Xm[n],Icon:Ym[n]}}function J(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t?.(o),n===!1||!o.defaultPrevented)return e?.(o)}}function sf(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function cs(...t){return e=>{let n=!1;const r=t.map(o=>{const i=sf(o,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():sf(t[o],null)}}}}function Oe(...t){return y.useCallback(cs(...t),t)}function dr(t,e=[]){let n=[];function r(i,s){const l=y.createContext(s),a=n.length;n=[...n,s];const c=d=>{const{scope:f,children:h,...p}=d,m=f?.[t]?.[a]||l,v=y.useMemo(()=>p,Object.values(p));return g.jsx(m.Provider,{value:v,children:h})};c.displayName=i+"Provider";function u(d,f){const h=f?.[t]?.[a]||l,p=y.useContext(h);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>y.createContext(s));return function(l){const a=l?.[t]||i;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:a}}),[l,a])}};return o.scopeName=t,[r,u3(o,...e)]}function u3(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((l,{useScope:a,scopeName:c})=>{const d=a(i)[`__scope${c}`];return{...l,...d}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var cn=globalThis?.document?y.useLayoutEffect:()=>{},d3=y[" useInsertionEffect ".trim().toString()]||cn;function yc({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[o,i,s]=f3({defaultProp:e,onChange:n}),l=t!==void 0,a=l?t:o;{const u=y.useRef(t!==void 0);y.useEffect(()=>{const d=u.current;d!==l&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,r])}const c=y.useCallback(u=>{if(l){const d=h3(u)?u(t):u;d!==t&&s.current?.(d)}else i(u)},[l,t,i,s]);return[a,c]}function f3({defaultProp:t,onChange:e}){const[n,r]=y.useState(t),o=y.useRef(n),i=y.useRef(e);return d3(()=>{i.current=e},[e]),y.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}function h3(t){return typeof t=="function"}function qr(t){const e=p3(t),n=y.forwardRef((r,o)=>{const{children:i,...s}=r,l=y.Children.toArray(i),a=l.find(g3);if(a){const c=a.props.children,u=l.map(d=>d===a?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:d);return g.jsx(e,{...s,ref:o,children:y.isValidElement(c)?y.cloneElement(c,void 0,u):null})}return g.jsx(e,{...s,ref:o,children:i})});return n.displayName=`${t}.Slot`,n}function p3(t){const e=y.forwardRef((n,r)=>{const{children:o,...i}=n;if(y.isValidElement(o)){const s=v3(o),l=y3(i,o.props);return o.type!==y.Fragment&&(l.ref=r?cs(r,s):s),y.cloneElement(o,l)}return y.Children.count(o)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var m3=Symbol("radix.slottable");function g3(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===m3}function y3(t,e){const n={...e};for(const r in e){const o=t[r],i=e[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const a=i(...l);return o(...l),a}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...t,...n}}function v3(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var b3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Te=b3.reduce((t,e)=>{const n=qr(`Primitive.${e}`),r=y.forwardRef((o,i)=>{const{asChild:s,...l}=o,a=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(a,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function e1(t,e){t&&pa.flushSync(()=>t.dispatchEvent(e))}function t1(t){const e=t+"CollectionProvider",[n,r]=dr(e),[o,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:v,children:b}=m,C=j.useRef(null),x=j.useRef(new Map).current;return g.jsx(o,{scope:v,itemMap:x,collectionRef:C,children:b})};s.displayName=e;const l=t+"CollectionSlot",a=qr(l),c=j.forwardRef((m,v)=>{const{scope:b,children:C}=m,x=i(l,b),w=Oe(v,x.collectionRef);return g.jsx(a,{ref:w,children:C})});c.displayName=l;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=qr(u),h=j.forwardRef((m,v)=>{const{scope:b,children:C,...x}=m,w=j.useRef(null),E=Oe(v,w),k=i(u,b);return j.useEffect(()=>(k.itemMap.set(w,{ref:w,...x}),()=>void k.itemMap.delete(w))),g.jsx(f,{[d]:"",ref:E,children:C})});h.displayName=u;function p(m){const v=i(t+"CollectionConsumer",m);return j.useCallback(()=>{const C=v.collectionRef.current;if(!C)return[];const x=Array.from(C.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((k,S)=>x.indexOf(k.ref.current)-x.indexOf(S.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:c,ItemSlot:h},p,r]}var C3=y.createContext(void 0);function n1(t){const e=y.useContext(C3);return t||e||"ltr"}function Lt(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...n)=>e.current?.(...n),[])}function x3(t,e=globalThis?.document){const n=Lt(t);y.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var w3="DismissableLayer",aa="dismissableLayer.update",S3="dismissableLayer.pointerDownOutside",k3="dismissableLayer.focusOutside",lf,r1=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),vc=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...a}=t,c=y.useContext(r1),[u,d]=y.useState(null),f=u?.ownerDocument??globalThis?.document,[,h]=y.useState({}),p=Oe(e,S=>d(S)),m=Array.from(c.layers),[v]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(v),C=u?m.indexOf(u):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,w=C>=b,E=T3(S=>{const M=S.target,N=[...c.branches].some(P=>P.contains(M));!w||N||(o?.(S),s?.(S),S.defaultPrevented||l?.())},f),k=A3(S=>{const M=S.target;[...c.branches].some(P=>P.contains(M))||(i?.(S),s?.(S),S.defaultPrevented||l?.())},f);return x3(S=>{C===c.layers.size-1&&(r?.(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},f),y.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(lf=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),af(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=lf)}},[u,f,n,c]),y.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),af())},[u,c]),y.useEffect(()=>{const S=()=>h({});return document.addEventListener(aa,S),()=>document.removeEventListener(aa,S)},[]),g.jsx(Te.div,{...a,ref:p,style:{pointerEvents:x?w?"auto":"none":void 0,...t.style},onFocusCapture:J(t.onFocusCapture,k.onFocusCapture),onBlurCapture:J(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:J(t.onPointerDownCapture,E.onPointerDownCapture)})});vc.displayName=w3;var E3="DismissableLayerBranch",M3=y.forwardRef((t,e)=>{const n=y.useContext(r1),r=y.useRef(null),o=Oe(e,r);return y.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),g.jsx(Te.div,{...t,ref:o})});M3.displayName=E3;function T3(t,e=globalThis?.document){const n=Lt(t),r=y.useRef(!1),o=y.useRef(()=>{});return y.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let a=function(){o1(S3,n,c,{discrete:!0})};const c={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=a,e.addEventListener("click",o.current,{once:!0})):a()}else e.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function A3(t,e=globalThis?.document){const n=Lt(t),r=y.useRef(!1);return y.useEffect(()=>{const o=i=>{i.target&&!r.current&&o1(k3,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function af(){const t=new CustomEvent(aa);document.dispatchEvent(t)}function o1(t,e,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?e1(o,i):o.dispatchEvent(i)}var cl=0;function i1(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??cf()),document.body.insertAdjacentElement("beforeend",t[1]??cf()),cl++,()=>{cl===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),cl--}},[])}function cf(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var ul="focusScope.autoFocusOnMount",dl="focusScope.autoFocusOnUnmount",uf={bubbles:!1,cancelable:!0},R3="FocusScope",bc=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=t,[l,a]=y.useState(null),c=Lt(o),u=Lt(i),d=y.useRef(null),f=Oe(e,m=>a(m)),h=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let m=function(x){if(h.paused||!l)return;const w=x.target;l.contains(w)?d.current=w:Ft(d.current,{select:!0})},v=function(x){if(h.paused||!l)return;const w=x.relatedTarget;w!==null&&(l.contains(w)||Ft(d.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const E of x)E.removedNodes.length>0&&Ft(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",v);const C=new MutationObserver(b);return l&&C.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",v),C.disconnect()}}},[r,l,h.paused]),y.useEffect(()=>{if(l){ff.add(h);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(ul,uf);l.addEventListener(ul,c),l.dispatchEvent(b),b.defaultPrevented||(O3(P3(s1(l)),{select:!0}),document.activeElement===m&&Ft(l))}return()=>{l.removeEventListener(ul,c),setTimeout(()=>{const b=new CustomEvent(dl,uf);l.addEventListener(dl,u),l.dispatchEvent(b),b.defaultPrevented||Ft(m??document.body,{select:!0}),l.removeEventListener(dl,u),ff.remove(h)},0)}}},[l,c,u,h]);const p=y.useCallback(m=>{if(!n&&!r||h.paused)return;const v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(v&&b){const C=m.currentTarget,[x,w]=N3(C);x&&w?!m.shiftKey&&b===w?(m.preventDefault(),n&&Ft(x,{select:!0})):m.shiftKey&&b===x&&(m.preventDefault(),n&&Ft(w,{select:!0})):b===C&&m.preventDefault()}},[n,r,h.paused]);return g.jsx(Te.div,{tabIndex:-1,...s,ref:f,onKeyDown:p})});bc.displayName=R3;function O3(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Ft(r,{select:e}),document.activeElement!==n)return}function N3(t){const e=s1(t),n=df(e,t),r=df(e.reverse(),t);return[n,r]}function s1(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function df(t,e){for(const n of t)if(!I3(n,{upTo:e}))return n}function I3(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function L3(t){return t instanceof HTMLInputElement&&"select"in t}function Ft(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&L3(t)&&e&&t.select()}}var ff=D3();function D3(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=hf(t,e),t.unshift(e)},remove(e){t=hf(t,e),t[0]?.resume()}}}function hf(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function P3(t){return t.filter(e=>e.tagName!=="A")}var j3=y[" useId ".trim().toString()]||(()=>{}),B3=0;function Pi(t){const[e,n]=y.useState(j3());return cn(()=>{n(r=>r??String(B3++))},[t]),t||(e?`radix-${e}`:"")}var _3="Arrow",l1=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:o=5,...i}=t;return g.jsx(Te.svg,{...i,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});l1.displayName=_3;var H3=l1;function F3(t){const[e,n]=y.useState(void 0);return cn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,l;if("borderBoxSize"in i){const a=i.borderBoxSize,c=Array.isArray(a)?a[0]:a;s=c.inlineSize,l=c.blockSize}else s=t.offsetWidth,l=t.offsetHeight;n({width:s,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var Cc="Popper",[a1,us]=dr(Cc),[$3,c1]=a1(Cc),u1=t=>{const{__scopePopper:e,children:n}=t,[r,o]=y.useState(null);return g.jsx($3,{scope:e,anchor:r,onAnchorChange:o,children:n})};u1.displayName=Cc;var d1="PopperAnchor",f1=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,i=c1(d1,n),s=y.useRef(null),l=Oe(e,s),a=y.useRef(null);return y.useEffect(()=>{const c=a.current;a.current=r?.current||s.current,c!==a.current&&i.onAnchorChange(a.current)}),r?null:g.jsx(Te.div,{...o,ref:l})});f1.displayName=d1;var xc="PopperContent",[V3,z3]=a1(xc),h1=y.forwardRef((t,e)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:a=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=t,v=c1(xc,n),[b,C]=y.useState(null),x=Oe(e,Y=>C(Y)),[w,E]=y.useState(null),k=F3(w),S=k?.width??0,M=k?.height??0,N=r+(i!=="center"?"-"+i:""),P=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},z=Array.isArray(c)?c:[c],U=z.length>0,H={padding:P,boundary:z.filter(W3),altBoundary:U},{refs:I,floatingStyles:_,placement:F,isPositioned:L,middlewareData:T}=Om({strategy:"fixed",placement:N,whileElementsMounted:(...Y)=>Am(...Y,{animationFrame:h==="always"}),elements:{reference:v.anchor},middleware:[Nm({mainAxis:o+M,alignmentAxis:s}),a&&Im({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?c5():void 0,...H}),a&&Lm({...H}),u5({...H,apply:({elements:Y,rects:te,availableWidth:Ke,availableHeight:bt})=>{const{width:Bn,height:Cs}=te.reference,_n=Y.floating.style;_n.setProperty("--radix-popper-available-width",`${Ke}px`),_n.setProperty("--radix-popper-available-height",`${bt}px`),_n.setProperty("--radix-popper-anchor-width",`${Bn}px`),_n.setProperty("--radix-popper-anchor-height",`${Cs}px`)}}),w&&f5({element:w,padding:l}),K3({arrowWidth:S,arrowHeight:M}),f&&d5({strategy:"referenceHidden",...H})]}),[R,W]=g1(F),ee=Lt(p);cn(()=>{L&&ee?.()},[L,ee]);const K=T.arrow?.x,Z=T.arrow?.y,We=T.arrow?.centerOffset!==0,[le,ge]=y.useState();return cn(()=>{b&&ge(window.getComputedStyle(b).zIndex)},[b]),g.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{..._,transform:L?_.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[T.transformOrigin?.x,T.transformOrigin?.y].join(" "),...T.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:g.jsx(V3,{scope:n,placedSide:R,onArrowChange:E,arrowX:K,arrowY:Z,shouldHideArrow:We,children:g.jsx(Te.div,{"data-side":R,"data-align":W,...m,ref:x,style:{...m.style,animation:L?void 0:"none"}})})})});h1.displayName=xc;var p1="PopperArrow",U3={top:"bottom",right:"left",bottom:"top",left:"right"},m1=y.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,i=z3(p1,r),s=U3[i.placedSide];return g.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:g.jsx(H3,{...o,ref:n,style:{...o.style,display:"block"}})})});m1.displayName=p1;function W3(t){return t!==null}var K3=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:o}=e,s=o.arrow?.centerOffset!==0,l=s?0:t.arrowWidth,a=s?0:t.arrowHeight,[c,u]=g1(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(o.arrow?.x??0)+l/2,h=(o.arrow?.y??0)+a/2;let p="",m="";return c==="bottom"?(p=s?d:`${f}px`,m=`${-a}px`):c==="top"?(p=s?d:`${f}px`,m=`${r.floating.height+a}px`):c==="right"?(p=`${-a}px`,m=s?d:`${h}px`):c==="left"&&(p=`${r.floating.width+a}px`,m=s?d:`${h}px`),{data:{x:p,y:m}}}});function g1(t){const[e,n="center"]=t.split("-");return[e,n]}var y1=u1,wc=f1,v1=h1,b1=m1,q3="Portal",Sc=y.forwardRef((t,e)=>{const{container:n,...r}=t,[o,i]=y.useState(!1);cn(()=>i(!0),[]);const s=n||o&&globalThis?.document?.body;return s?Hi.createPortal(g.jsx(Te.div,{...r,ref:e}),s):null});Sc.displayName=q3;function G3(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var Dn=t=>{const{present:e,children:n}=t,r=J3(e),o=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),i=Oe(r.ref,Z3(o));return typeof n=="function"||r.isPresent?y.cloneElement(o,{ref:i}):null};Dn.displayName="Presence";function J3(t){const[e,n]=y.useState(),r=y.useRef(null),o=y.useRef(t),i=y.useRef("none"),s=t?"mounted":"unmounted",[l,a]=G3(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const c=To(r.current);i.current=l==="mounted"?c:"none"},[l]),cn(()=>{const c=r.current,u=o.current;if(u!==t){const f=i.current,h=To(c);t?a("MOUNT"):h==="none"||c?.display==="none"?a("UNMOUNT"):a(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,a]),cn(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=h=>{const m=To(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&m&&(a("ANIMATION_END"),!o.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},f=h=>{h.target===e&&(i.current=To(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else a("ANIMATION_END")},[e,a]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:y.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function To(t){return t?.animationName||"none"}function Z3(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var fl="rovingFocusGroup.onEntryFocus",Y3={bubbles:!1,cancelable:!0},oo="RovingFocusGroup",[ca,C1,X3]=t1(oo),[Q3,x1]=dr(oo,[X3]),[eS,tS]=Q3(oo),w1=y.forwardRef((t,e)=>g.jsx(ca.Provider,{scope:t.__scopeRovingFocusGroup,children:g.jsx(ca.Slot,{scope:t.__scopeRovingFocusGroup,children:g.jsx(nS,{...t,ref:e})})}));w1.displayName=oo;var nS=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:a,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=t,f=y.useRef(null),h=Oe(e,f),p=n1(i),[m,v]=yc({prop:s,defaultProp:l??null,onChange:a,caller:oo}),[b,C]=y.useState(!1),x=Lt(c),w=C1(n),E=y.useRef(!1),[k,S]=y.useState(0);return y.useEffect(()=>{const M=f.current;if(M)return M.addEventListener(fl,x),()=>M.removeEventListener(fl,x)},[x]),g.jsx(eS,{scope:n,orientation:r,dir:p,loop:o,currentTabStopId:m,onItemFocus:y.useCallback(M=>v(M),[v]),onItemShiftTab:y.useCallback(()=>C(!0),[]),onFocusableItemAdd:y.useCallback(()=>S(M=>M+1),[]),onFocusableItemRemove:y.useCallback(()=>S(M=>M-1),[]),children:g.jsx(Te.div,{tabIndex:b||k===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...t.style},onMouseDown:J(t.onMouseDown,()=>{E.current=!0}),onFocus:J(t.onFocus,M=>{const N=!E.current;if(M.target===M.currentTarget&&N&&!b){const P=new CustomEvent(fl,Y3);if(M.currentTarget.dispatchEvent(P),!P.defaultPrevented){const z=w().filter(F=>F.focusable),U=z.find(F=>F.active),H=z.find(F=>F.id===m),_=[U,H,...z].filter(Boolean).map(F=>F.ref.current);E1(_,u)}}E.current=!1}),onBlur:J(t.onBlur,()=>C(!1))})})}),S1="RovingFocusGroupItem",k1=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...l}=t,a=Pi(),c=i||a,u=tS(S1,n),d=u.currentTabStopId===c,f=C1(n),{onFocusableItemAdd:h,onFocusableItemRemove:p,currentTabStopId:m}=u;return y.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),g.jsx(ca.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:g.jsx(Te.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...l,ref:e,onMouseDown:J(t.onMouseDown,v=>{r?u.onItemFocus(c):v.preventDefault()}),onFocus:J(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:J(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=iS(v,u.orientation,u.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let x=f().filter(w=>w.focusable).map(w=>w.ref.current);if(b==="last")x.reverse();else if(b==="prev"||b==="next"){b==="prev"&&x.reverse();const w=x.indexOf(v.currentTarget);x=u.loop?sS(x,w+1):x.slice(w+1)}setTimeout(()=>E1(x))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:m!=null}):s})})});k1.displayName=S1;var rS={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function oS(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function iS(t,e,n){const r=oS(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return rS[r]}function E1(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function sS(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var lS=w1,aS=k1,cS=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},$n=new WeakMap,Ao=new WeakMap,Ro={},hl=0,M1=function(t){return t&&(t.host||M1(t.parentNode))},uS=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=M1(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},dS=function(t,e,n,r){var o=uS(e,Array.isArray(t)?t:[t]);Ro[n]||(Ro[n]=new WeakMap);var i=Ro[n],s=[],l=new Set,a=new Set(o),c=function(d){!d||l.has(d)||(l.add(d),c(d.parentNode))};o.forEach(c);var u=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(f){if(l.has(f))u(f);else try{var h=f.getAttribute(r),p=h!==null&&h!=="false",m=($n.get(f)||0)+1,v=(i.get(f)||0)+1;$n.set(f,m),i.set(f,v),s.push(f),m===1&&p&&Ao.set(f,!0),v===1&&f.setAttribute(n,"true"),p||f.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",f,b)}})};return u(e),l.clear(),hl++,function(){s.forEach(function(d){var f=$n.get(d)-1,h=i.get(d)-1;$n.set(d,f),i.set(d,h),f||(Ao.has(d)||d.removeAttribute(r),Ao.delete(d)),h||d.removeAttribute(n)}),hl--,hl||($n=new WeakMap,$n=new WeakMap,Ao=new WeakMap,Ro={})}},T1=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=cS(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),dS(r,o,n,"aria-hidden")):function(){return null}},ct=function(){return ct=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ct.apply(this,arguments)};function A1(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n}function fS(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var Fo="right-scroll-bar-position",$o="width-before-scroll-bar",hS="with-scroll-bars-hidden",pS="--removed-body-scroll-bar-size";function pl(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function mS(t,e){var n=j.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=e,n.facade}var gS=typeof window<"u"?y.useLayoutEffect:y.useEffect,pf=new WeakMap;function yS(t,e){var n=mS(null,function(r){return t.forEach(function(o){return pl(o,r)})});return gS(function(){var r=pf.get(n);if(r){var o=new Set(r),i=new Set(t),s=n.current;o.forEach(function(l){i.has(l)||pl(l,null)}),i.forEach(function(l){o.has(l)||pl(l,s)})}pf.set(n,t)},[t]),n}function vS(t){return t}function bS(t,e){e===void 0&&(e=vS);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var s=e(i,r);return n.push(s),function(){n=n.filter(function(l){return l!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var l=n;n=[],l.forEach(i),s=n}var a=function(){var u=s;s=[],u.forEach(i)},c=function(){return Promise.resolve().then(a)};c(),n={push:function(u){s.push(u),c()},filter:function(u){return s=s.filter(u),n}}}};return o}function CS(t){t===void 0&&(t={});var e=bS(null);return e.options=ct({async:!0,ssr:!1},t),e}var R1=function(t){var e=t.sideCar,n=A1(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return y.createElement(r,ct({},n))};R1.isSideCarExport=!0;function xS(t,e){return t.useMedium(e),R1}var O1=CS(),ml=function(){},ds=y.forwardRef(function(t,e){var n=y.useRef(null),r=y.useState({onScrollCapture:ml,onWheelCapture:ml,onTouchMoveCapture:ml}),o=r[0],i=r[1],s=t.forwardProps,l=t.children,a=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,f=t.sideCar,h=t.noRelative,p=t.noIsolation,m=t.inert,v=t.allowPinchZoom,b=t.as,C=b===void 0?"div":b,x=t.gapMode,w=A1(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=f,k=yS([n,e]),S=ct(ct({},w),o);return y.createElement(y.Fragment,null,u&&y.createElement(E,{sideCar:O1,removeScrollBar:c,shards:d,noRelative:h,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:x}),s?y.cloneElement(y.Children.only(l),ct(ct({},S),{ref:k})):y.createElement(C,ct({},S,{className:a,ref:k}),l))});ds.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ds.classNames={fullWidth:$o,zeroRight:Fo};var wS=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function SS(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=wS();return e&&t.setAttribute("nonce",e),t}function kS(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function ES(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var MS=function(){var t=0,e=null;return{add:function(n){t==0&&(e=SS())&&(kS(e,n),ES(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},TS=function(){var t=MS();return function(e,n){y.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},N1=function(){var t=TS(),e=function(n){var r=n.styles,o=n.dynamic;return t(r,o),null};return e},AS={left:0,top:0,right:0,gap:0},gl=function(t){return parseInt(t||"",10)||0},RS=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[gl(n),gl(r),gl(o)]},OS=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return AS;var e=RS(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},NS=N1(),er="data-scroll-locked",IS=function(t,e,n,r){var o=t.left,i=t.top,s=t.right,l=t.gap;return n===void 0&&(n="margin"),`
174
174
  .`.concat(hS,` {
175
175
  overflow: hidden `).concat(r,`;
176
176
  padding-right: `).concat(l,"px ").concat(r,`;
@@ -210,5 +210,5 @@ ${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(l,10),content:
210
210
  `)},mf=function(){var t=parseInt(document.body.getAttribute(er)||"0",10);return isFinite(t)?t:0},LS=function(){y.useEffect(function(){return document.body.setAttribute(er,(mf()+1).toString()),function(){var t=mf()-1;t<=0?document.body.removeAttribute(er):document.body.setAttribute(er,t.toString())}},[])},DS=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,o=r===void 0?"margin":r;LS();var i=y.useMemo(function(){return OS(o)},[o]);return y.createElement(NS,{styles:IS(i,!e,o,n?"":"!important")})},ua=!1;if(typeof window<"u")try{var Oo=Object.defineProperty({},"passive",{get:function(){return ua=!0,!0}});window.addEventListener("test",Oo,Oo),window.removeEventListener("test",Oo,Oo)}catch{ua=!1}var Vn=ua?{passive:!1}:!1,PS=function(t){return t.tagName==="TEXTAREA"},I1=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!PS(t)&&n[e]==="visible")},jS=function(t){return I1(t,"overflowY")},BS=function(t){return I1(t,"overflowX")},gf=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=L1(t,r);if(o){var i=D1(t,r),s=i[1],l=i[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},_S=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},HS=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},L1=function(t,e){return t==="v"?jS(e):BS(e)},D1=function(t,e){return t==="v"?_S(e):HS(e)},FS=function(t,e){return t==="h"&&e==="rtl"?-1:1},$S=function(t,e,n,r,o){var i=FS(t,window.getComputedStyle(e).direction),s=i*r,l=n.target,a=e.contains(l),c=!1,u=s>0,d=0,f=0;do{if(!l)break;var h=D1(t,l),p=h[0],m=h[1],v=h[2],b=m-v-i*p;(p||b)&&L1(t,l)&&(d+=b,f+=p);var C=l.parentNode;l=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!a&&l!==document.body||a&&(e.contains(l)||e===l));return(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(c=!0),c},No=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},yf=function(t){return[t.deltaX,t.deltaY]},vf=function(t){return t&&"current"in t?t.current:t},VS=function(t,e){return t[0]===e[0]&&t[1]===e[1]},zS=function(t){return`
211
211
  .block-interactivity-`.concat(t,` {pointer-events: none;}
212
212
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
213
- `)},US=0,zn=[];function WS(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),o=y.useState(US++)[0],i=y.useState(N1)[0],s=y.useRef(t);y.useEffect(function(){s.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=fS([t.lockRef.current],(t.shards||[]).map(vf),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var l=y.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var b=No(m),C=n.current,x="deltaX"in m?m.deltaX:C[0]-b[0],w="deltaY"in m?m.deltaY:C[1]-b[1],E,k=m.target,S=Math.abs(x)>Math.abs(w)?"h":"v";if("touches"in m&&S==="h"&&k.type==="range")return!1;var M=gf(S,k);if(!M)return!0;if(M?E=S:(E=S==="v"?"h":"v",M=gf(S,k)),!M)return!1;if(!r.current&&"changedTouches"in m&&(x||w)&&(r.current=E),!E)return!0;var N=r.current||E;return $S(N,v,m,N==="h"?x:w)},[]),a=y.useCallback(function(m){var v=m;if(!(!zn.length||zn[zn.length-1]!==i)){var b="deltaY"in v?yf(v):No(v),C=e.current.filter(function(E){return E.name===v.type&&(E.target===v.target||v.target===E.shadowParent)&&VS(E.delta,b)})[0];if(C&&C.should){v.cancelable&&v.preventDefault();return}if(!C){var x=(s.current.shards||[]).map(vf).filter(Boolean).filter(function(E){return E.contains(v.target)}),w=x.length>0?l(v,x[0]):!s.current.noIsolation;w&&v.cancelable&&v.preventDefault()}}},[]),c=y.useCallback(function(m,v,b,C){var x={name:m,delta:v,target:b,should:C,shadowParent:KS(b)};e.current.push(x),setTimeout(function(){e.current=e.current.filter(function(w){return w!==x})},1)},[]),u=y.useCallback(function(m){n.current=No(m),r.current=void 0},[]),d=y.useCallback(function(m){c(m.type,yf(m),m.target,l(m,t.lockRef.current))},[]),f=y.useCallback(function(m){c(m.type,No(m),m.target,l(m,t.lockRef.current))},[]);y.useEffect(function(){return zn.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,Vn),document.addEventListener("touchmove",a,Vn),document.addEventListener("touchstart",u,Vn),function(){zn=zn.filter(function(m){return m!==i}),document.removeEventListener("wheel",a,Vn),document.removeEventListener("touchmove",a,Vn),document.removeEventListener("touchstart",u,Vn)}},[]);var h=t.removeScrollBar,p=t.inert;return y.createElement(y.Fragment,null,p?y.createElement(i,{styles:zS(o)}):null,h?y.createElement(DS,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function KS(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const qS=xS(O1,WS);var kc=y.forwardRef(function(t,e){return y.createElement(ds,ct({},t,{ref:e,sideCar:qS}))});kc.classNames=ds.classNames;var da=["Enter"," "],GS=["ArrowDown","PageUp","Home"],P1=["ArrowUp","PageDown","End"],JS=[...GS,...P1],ZS={ltr:[...da,"ArrowRight"],rtl:[...da,"ArrowLeft"]},YS={ltr:["ArrowLeft"],rtl:["ArrowRight"]},io="Menu",[Gr,XS,QS]=t1(io),[Pn,j1]=dr(io,[QS,us,x1]),fs=us(),B1=x1(),[ek,jn]=Pn(io),[tk,so]=Pn(io),_1=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=t,l=fs(e),[a,c]=y.useState(null),u=y.useRef(!1),d=jt(i),f=n1(o);return y.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),g.jsx(y1,{...l,children:g.jsx(ek,{scope:e,open:n,onOpenChange:d,content:a,onContentChange:c,children:g.jsx(tk,{scope:e,onClose:y.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:s,children:r})})})};_1.displayName=io;var nk="MenuAnchor",Ec=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=fs(n);return g.jsx(wc,{...o,...r,ref:e})});Ec.displayName=nk;var Mc="MenuPortal",[rk,H1]=Pn(Mc,{forceMount:void 0}),F1=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:o}=t,i=jn(Mc,e);return g.jsx(rk,{scope:e,forceMount:n,children:g.jsx(Dn,{present:n||i.open,children:g.jsx(Sc,{asChild:!0,container:o,children:r})})})};F1.displayName=Mc;var et="MenuContent",[ok,Tc]=Pn(et),$1=y.forwardRef((t,e)=>{const n=H1(et,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=jn(et,t.__scopeMenu),s=so(et,t.__scopeMenu);return g.jsx(Gr.Provider,{scope:t.__scopeMenu,children:g.jsx(Dn,{present:r||i.open,children:g.jsx(Gr.Slot,{scope:t.__scopeMenu,children:s.modal?g.jsx(ik,{...o,ref:e}):g.jsx(sk,{...o,ref:e})})})})}),ik=y.forwardRef((t,e)=>{const n=jn(et,t.__scopeMenu),r=y.useRef(null),o=Oe(e,r);return y.useEffect(()=>{const i=r.current;if(i)return T1(i)},[]),g.jsx(Ac,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),sk=y.forwardRef((t,e)=>{const n=jn(et,t.__scopeMenu);return g.jsx(Ac,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),lk=qr("MenuContent.ScrollLock"),Ac=y.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEntryFocus:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,disableOutsideScroll:p,...m}=t,v=jn(et,n),b=so(et,n),C=fs(n),x=B1(n),w=XS(n),[E,k]=y.useState(null),S=y.useRef(null),M=Oe(e,S,v.onContentChange),N=y.useRef(0),P=y.useRef(""),z=y.useRef(0),U=y.useRef(null),H=y.useRef("right"),I=y.useRef(0),_=p?kc:y.Fragment,F=p?{as:lk,allowPinchZoom:!0}:void 0,L=R=>{const W=P.current+R,ee=w().filter(Y=>!Y.disabled),K=document.activeElement,Z=ee.find(Y=>Y.ref.current===K)?.textValue,We=ee.map(Y=>Y.textValue),le=bk(We,W,Z),ge=ee.find(Y=>Y.textValue===le)?.ref.current;(function Y(te){P.current=te,window.clearTimeout(N.current),te!==""&&(N.current=window.setTimeout(()=>Y(""),1e3))})(W),ge&&setTimeout(()=>ge.focus())};y.useEffect(()=>()=>window.clearTimeout(N.current),[]),i1();const T=y.useCallback(R=>H.current===U.current?.side&&xk(R,U.current?.area),[]);return g.jsx(ok,{scope:n,searchRef:P,onItemEnter:y.useCallback(R=>{T(R)&&R.preventDefault()},[T]),onItemLeave:y.useCallback(R=>{T(R)||(S.current?.focus(),k(null))},[T]),onTriggerLeave:y.useCallback(R=>{T(R)&&R.preventDefault()},[T]),pointerGraceTimerRef:z,onPointerGraceIntentChange:y.useCallback(R=>{U.current=R},[]),children:g.jsx(_,{...F,children:g.jsx(bc,{asChild:!0,trapped:o,onMountAutoFocus:J(i,R=>{R.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:g.jsx(vc,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,children:g.jsx(lS,{asChild:!0,...x,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:k,onEntryFocus:J(a,R=>{b.isUsingKeyboardRef.current||R.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(v1,{role:"menu","aria-orientation":"vertical","data-state":rg(v.open),"data-radix-menu-content":"",dir:b.dir,...C,...m,ref:M,style:{outline:"none",...m.style},onKeyDown:J(m.onKeyDown,R=>{const ee=R.target.closest("[data-radix-menu-content]")===R.currentTarget,K=R.ctrlKey||R.altKey||R.metaKey,Z=R.key.length===1;ee&&(R.key==="Tab"&&R.preventDefault(),!K&&Z&&L(R.key));const We=S.current;if(R.target!==We||!JS.includes(R.key))return;R.preventDefault();const ge=w().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);P1.includes(R.key)&&ge.reverse(),yk(ge)}),onBlur:J(t.onBlur,R=>{R.currentTarget.contains(R.target)||(window.clearTimeout(N.current),P.current="")}),onPointerMove:J(t.onPointerMove,Jr(R=>{const W=R.target,ee=I.current!==R.clientX;if(R.currentTarget.contains(W)&&ee){const K=R.clientX>I.current?"right":"left";H.current=K,I.current=R.clientX}}))})})})})})})});$1.displayName=et;var ak="MenuGroup",Rc=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Te.div,{role:"group",...r,ref:e})});Rc.displayName=ak;var ck="MenuLabel",V1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Te.div,{...r,ref:e})});V1.displayName=ck;var ji="MenuItem",bf="menu.itemSelect",hs=y.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...o}=t,i=y.useRef(null),s=so(ji,t.__scopeMenu),l=Tc(ji,t.__scopeMenu),a=Oe(e,i),c=y.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const f=new CustomEvent(bf,{bubbles:!0,cancelable:!0});d.addEventListener(bf,h=>r?.(h),{once:!0}),e1(d,f),f.defaultPrevented?c.current=!1:s.onClose()}};return g.jsx(z1,{...o,ref:a,disabled:n,onClick:J(t.onClick,u),onPointerDown:d=>{t.onPointerDown?.(d),c.current=!0},onPointerUp:J(t.onPointerUp,d=>{c.current||d.currentTarget?.click()}),onKeyDown:J(t.onKeyDown,d=>{const f=l.searchRef.current!=="";n||f&&d.key===" "||da.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});hs.displayName=ji;var z1=y.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=t,s=Tc(ji,n),l=B1(n),a=y.useRef(null),c=Oe(e,a),[u,d]=y.useState(!1),[f,h]=y.useState("");return y.useEffect(()=>{const p=a.current;p&&h((p.textContent??"").trim())},[i.children]),g.jsx(Gr.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:g.jsx(aS,{asChild:!0,...l,focusable:!r,children:g.jsx(Te.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:J(t.onPointerMove,Jr(p=>{r?s.onItemLeave(p):(s.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:J(t.onPointerLeave,Jr(p=>s.onItemLeave(p))),onFocus:J(t.onFocus,()=>d(!0)),onBlur:J(t.onBlur,()=>d(!1))})})})}),uk="MenuCheckboxItem",U1=y.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...o}=t;return g.jsx(J1,{scope:t.__scopeMenu,checked:n,children:g.jsx(hs,{role:"menuitemcheckbox","aria-checked":Bi(n)?"mixed":n,...o,ref:e,"data-state":Nc(n),onSelect:J(o.onSelect,()=>r?.(Bi(n)?!0:!n),{checkForDefaultPrevented:!1})})})});U1.displayName=uk;var W1="MenuRadioGroup",[dk,fk]=Pn(W1,{value:void 0,onValueChange:()=>{}}),K1=y.forwardRef((t,e)=>{const{value:n,onValueChange:r,...o}=t,i=jt(r);return g.jsx(dk,{scope:t.__scopeMenu,value:n,onValueChange:i,children:g.jsx(Rc,{...o,ref:e})})});K1.displayName=W1;var q1="MenuRadioItem",G1=y.forwardRef((t,e)=>{const{value:n,...r}=t,o=fk(q1,t.__scopeMenu),i=n===o.value;return g.jsx(J1,{scope:t.__scopeMenu,checked:i,children:g.jsx(hs,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":Nc(i),onSelect:J(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});G1.displayName=q1;var Oc="MenuItemIndicator",[J1,hk]=Pn(Oc,{checked:!1}),Z1=y.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...o}=t,i=hk(Oc,n);return g.jsx(Dn,{present:r||Bi(i.checked)||i.checked===!0,children:g.jsx(Te.span,{...o,ref:e,"data-state":Nc(i.checked)})})});Z1.displayName=Oc;var pk="MenuSeparator",Y1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Te.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});Y1.displayName=pk;var mk="MenuArrow",X1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=fs(n);return g.jsx(b1,{...o,...r,ref:e})});X1.displayName=mk;var gk="MenuSub",[lM,Q1]=Pn(gk),Cr="MenuSubTrigger",eg=y.forwardRef((t,e)=>{const n=jn(Cr,t.__scopeMenu),r=so(Cr,t.__scopeMenu),o=Q1(Cr,t.__scopeMenu),i=Tc(Cr,t.__scopeMenu),s=y.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:a}=i,c={__scopeMenu:t.__scopeMenu},u=y.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return y.useEffect(()=>u,[u]),y.useEffect(()=>{const d=l.current;return()=>{window.clearTimeout(d),a(null)}},[l,a]),g.jsx(Ec,{asChild:!0,...c,children:g.jsx(z1,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":rg(n.open),...t,ref:cs(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:J(t.onPointerMove,Jr(d=>{i.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:J(t.onPointerLeave,Jr(d=>{u();const f=n.content?.getBoundingClientRect();if(f){const h=n.content?.dataset.side,p=h==="right",m=p?-5:5,v=f[p?"left":"right"],b=f[p?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+m,y:d.clientY},{x:v,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:v,y:f.bottom}],side:h}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:J(t.onKeyDown,d=>{const f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||ZS[r.dir].includes(d.key)&&(n.onOpenChange(!0),n.content?.focus(),d.preventDefault())})})})});eg.displayName=Cr;var tg="MenuSubContent",ng=y.forwardRef((t,e)=>{const n=H1(et,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=jn(et,t.__scopeMenu),s=so(et,t.__scopeMenu),l=Q1(tg,t.__scopeMenu),a=y.useRef(null),c=Oe(e,a);return g.jsx(Gr.Provider,{scope:t.__scopeMenu,children:g.jsx(Dn,{present:r||i.open,children:g.jsx(Gr.Slot,{scope:t.__scopeMenu,children:g.jsx(Ac,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{s.isUsingKeyboardRef.current&&a.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:J(t.onFocusOutside,u=>{u.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:J(t.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:J(t.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),f=YS[s.dir].includes(u.key);d&&f&&(i.onOpenChange(!1),l.trigger?.focus(),u.preventDefault())})})})})})});ng.displayName=tg;function rg(t){return t?"open":"closed"}function Bi(t){return t==="indeterminate"}function Nc(t){return Bi(t)?"indeterminate":t?"checked":"unchecked"}function yk(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function vk(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function bk(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let s=vk(t,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const a=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return a!==n?a:void 0}function Ck(t,e){const{x:n,y:r}=t;let o=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){const l=e[i],a=e[s],c=l.x,u=l.y,d=a.x,f=a.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(o=!o)}return o}function xk(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Ck(n,e)}function Jr(t){return e=>e.pointerType==="mouse"?t(e):void 0}var wk=_1,Sk=Ec,kk=F1,Ek=$1,Mk=Rc,Tk=V1,Ak=hs,Rk=U1,Ok=K1,Nk=G1,Ik=Z1,Lk=Y1,Dk=X1,Pk=eg,jk=ng,ps="DropdownMenu",[Bk]=dr(ps,[j1]),Be=j1(),[_k,og]=Bk(ps),ig=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:l=!0}=t,a=Be(e),c=y.useRef(null),[u,d]=yc({prop:o,defaultProp:i??!1,onChange:s,caller:ps});return g.jsx(_k,{scope:e,triggerId:Pi(),triggerRef:c,contentId:Pi(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(f=>!f),[d]),modal:l,children:g.jsx(wk,{...a,open:u,onOpenChange:d,dir:r,modal:l,children:n})})};ig.displayName=ps;var sg="DropdownMenuTrigger",lg=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=t,i=og(sg,n),s=Be(n);return g.jsx(Sk,{asChild:!0,...s,children:g.jsx(Te.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:cs(e,i.triggerRef),onPointerDown:J(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:J(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});lg.displayName=sg;var Hk="DropdownMenuPortal",ag=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Be(e);return g.jsx(kk,{...r,...n})};ag.displayName=Hk;var cg="DropdownMenuContent",ug=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=og(cg,n),i=Be(n),s=y.useRef(!1);return g.jsx(Ek,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:e,onCloseAutoFocus:J(t.onCloseAutoFocus,l=>{s.current||o.triggerRef.current?.focus(),s.current=!1,l.preventDefault()}),onInteractOutside:J(t.onInteractOutside,l=>{const a=l.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0,u=a.button===2||c;(!o.modal||u)&&(s.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ug.displayName=cg;var Fk="DropdownMenuGroup",$k=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Mk,{...o,...r,ref:e})});$k.displayName=Fk;var Vk="DropdownMenuLabel",zk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Tk,{...o,...r,ref:e})});zk.displayName=Vk;var Uk="DropdownMenuItem",dg=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Ak,{...o,...r,ref:e})});dg.displayName=Uk;var Wk="DropdownMenuCheckboxItem",Kk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Rk,{...o,...r,ref:e})});Kk.displayName=Wk;var qk="DropdownMenuRadioGroup",Gk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Ok,{...o,...r,ref:e})});Gk.displayName=qk;var Jk="DropdownMenuRadioItem",Zk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Nk,{...o,...r,ref:e})});Zk.displayName=Jk;var Yk="DropdownMenuItemIndicator",Xk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Ik,{...o,...r,ref:e})});Xk.displayName=Yk;var Qk="DropdownMenuSeparator",e9=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Lk,{...o,...r,ref:e})});e9.displayName=Qk;var t9="DropdownMenuArrow",n9=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Dk,{...o,...r,ref:e})});n9.displayName=t9;var r9="DropdownMenuSubTrigger",o9=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Pk,{...o,...r,ref:e})});o9.displayName=r9;var i9="DropdownMenuSubContent",fg=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(jk,{...o,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});fg.displayName=i9;var s9=ig,hg=lg,l9=ag,pg=ug,a9=dg,mg=fg;function gg({...t}){return g.jsx(s9,{modal:!1,...t})}function yg({...t}){return g.jsx(l9,{...t})}const Ic=y.forwardRef(({...t},e)=>g.jsx(hg,{ref:e,...t}));Ic.displayName=hg.displayName;const vg=a9,c9=y.forwardRef(({className:t,portal:e=!0,...n},r)=>{const o=g.jsx(mg,{ref:r,className:Me("tiptap-dropdown-menu",t),...n});return e?g.jsx(yg,{...typeof e=="object"?e:{},children:o}):o});c9.displayName=mg.displayName;const Lc=y.forwardRef(({className:t,sideOffset:e=4,portal:n=!1,...r},o)=>{const i=g.jsx(pg,{ref:o,sideOffset:e,onCloseAutoFocus:s=>s.preventDefault(),className:Me("tiptap-dropdown-menu",t),...r});return n?g.jsx(yg,{...typeof n=="object"?n:{},children:i}):i});Lc.displayName=pg.displayName;const fr=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card",t),...e}));fr.displayName="Card";const u9=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-header",t),...e}));u9.displayName="CardHeader";const lo=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-body",t),...e}));lo.displayName="CardBody";const Dc=y.forwardRef(({className:t,orientation:e="vertical",...n},r)=>g.jsx("div",{ref:r,"data-orientation":e,className:Me("tiptap-card-item-group",t),...n}));Dc.displayName="CardItemGroup";const d9=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-group-label",t),...e}));d9.displayName="CardGroupLabel";const f9=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-footer",t),...e}));f9.displayName="CardFooter";const Pc=y.forwardRef(({editor:t,levels:e=[1,2,3,4,5,6],hideWhenUnavailable:n=!1,portal:r=!1,onOpenChange:o,...i},s)=>{const{editor:l}=ie(t),[a,c]=y.useState(!1),{isVisible:u,isActive:d,canToggle:f,Icon:h}=p9({editor:l,levels:e,hideWhenUnavailable:n}),p=y.useCallback(m=>{!l||!f||(c(m),o?.(m))},[f,l,o]);return u?g.jsxs(gg,{modal:!0,open:a,onOpenChange:p,children:[g.jsx(Ic,{asChild:!0,children:g.jsxs(fe,{type:"button","data-style":"ghost","data-active-state":d?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":"Format text as heading","aria-pressed":d,tooltip:"Heading",...i,ref:s,children:[g.jsx(h,{className:"tiptap-button-icon"}),g.jsx(mc,{className:"tiptap-button-dropdown-small"})]})}),g.jsx(Lc,{align:"start",portal:r,children:g.jsx(fr,{children:g.jsx(lo,{children:g.jsx(In,{children:e.map(m=>g.jsx(vg,{asChild:!0,children:g.jsx(Um,{editor:l,level:m,text:`Heading ${m}`,showTooltip:!1})},`heading-${m}`))})})})})]}):null});Pc.displayName="HeadingDropdownMenu";const bg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M6 3C6.55228 3 7 3.44772 7 4V11H17V4C17 3.44772 17.4477 3 18 3C18.5523 3 19 3.44772 19 4V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V13H7V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V4C5 3.44772 5.44772 3 6 3Z",fill:"currentColor"})}));bg.displayName="HeadingIcon";function h9(t,e=[1,2,3,4,5,6]){if(!(!t||!t.isEditable))return e.find(n=>gc(t,n))}function p9(t){const{editor:e,levels:n=[1,2,3,4,5,6],hideWhenUnavailable:r=!1}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!0),l=h9(o,n),a=gc(o),c=Kr(o);return y.useEffect(()=>{if(!o)return;const u=()=>{s(Qm({editor:o,hideWhenUnavailable:r,level:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,r,n]),{isVisible:i,activeLevel:l,isActive:a,canToggle:c,levels:n,label:"Heading",Icon:l?Ym[l]:bg}}function m9({shortcutKeys:t=fa}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const jc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onInserted:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),{isVisible:u,canInsert:d,handleImage:f,label:h,isActive:p,shortcutKeys:m,Icon:v}=D9({editor:c,hideWhenUnavailable:n,onInserted:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&f()},[f,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":p?"on":"off",role:"button",tabIndex:-1,disabled:!d,"data-disabled":!d,"aria-label":h,"aria-pressed":p,tooltip:h,onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(m9,{shortcutKeys:m})]})}):null});jc.displayName="ImageUploadButton";const Cg=["shift","alt","meta","mod","ctrl","control"],g9={esc:"escape",return:"enter",left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function on(t){return(g9[t.trim()]||t.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function xg(t){return Cg.includes(t)}function yl(t,e=","){return t.toLowerCase().split(e)}function vl(t,e="+",n=">",r=!1,o){let i=[],s=!1;t=t.trim(),t.includes(n)?(s=!0,i=t.toLocaleLowerCase().split(n).map(c=>on(c))):i=t.toLocaleLowerCase().split(e).map(c=>on(c));const l={alt:i.includes("alt"),ctrl:i.includes("ctrl")||i.includes("control"),shift:i.includes("shift"),meta:i.includes("meta"),mod:i.includes("mod"),useKey:r},a=i.filter(c=>!Cg.includes(c));return{...l,keys:a,description:o,isSequence:s,hotkey:t}}typeof document<"u"&&(document.addEventListener("keydown",t=>{t.code!==void 0&&wg([on(t.code)])}),document.addEventListener("keyup",t=>{t.code!==void 0&&Sg([on(t.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{Rt.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{Rt.clear()},0)}));const Rt=new Set;function Bc(t){return Array.isArray(t)}function y9(t,e=","){return(Bc(t)?t:t.split(e)).every(n=>Rt.has(n.trim().toLowerCase()))}function wg(t){const e=Array.isArray(t)?t:[t];Rt.has("meta")&&Rt.forEach(n=>!xg(n)&&Rt.delete(n.toLowerCase())),e.forEach(n=>Rt.add(n.toLowerCase()))}function Sg(t){const e=Array.isArray(t)?t:[t];t==="meta"?Rt.clear():e.forEach(n=>Rt.delete(n.toLowerCase()))}function v9(t,e,n){(typeof n=="function"&&n(t,e)||n===!0)&&t.preventDefault()}function b9(t,e,n){return typeof n=="function"?n(t,e):n===!0||n===void 0}const C9=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function x9(t){return kg(t,C9)}function kg(t,e=!1){const{target:n,composed:r}=t;let o,i;return w9(n)&&r?(o=t.composedPath()[0]&&t.composedPath()[0].tagName,i=t.composedPath()[0]&&t.composedPath()[0].role):(o=n&&n.tagName,i=n&&n.role),Bc(e)?!!(o&&e&&e.some(s=>s.toLowerCase()===o.toLowerCase()||s===i)):!!(o&&e&&e)}function w9(t){return!!t.tagName&&!t.tagName.startsWith("-")&&t.tagName.includes("-")}function S9(t,e){return t.length===0&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):e?t.some(n=>e.includes(n))||t.includes("*"):!0}const k9=(t,e,n=!1)=>{const{alt:r,meta:o,mod:i,shift:s,ctrl:l,keys:a,useKey:c}=e,{code:u,key:d,ctrlKey:f,metaKey:h,shiftKey:p,altKey:m}=t,v=on(u);if(c&&a?.length===1&&a.includes(d))return!0;if(!a?.includes(v)&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(v))return!1;if(!n){if(r!==m&&v!=="alt"||s!==p&&v!=="shift")return!1;if(i){if(!h&&!f)return!1}else if(o!==h&&v!=="meta"&&v!=="os"||l!==f&&v!=="ctrl"&&v!=="control")return!1}return a&&a.length===1&&a.includes(v)?!0:a?y9(a):!a},E9=j.createContext(void 0),M9=()=>j.useContext(E9);function Eg(t,e){return t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(t).length===Object.keys(e).length&&Object.keys(t).reduce((n,r)=>n&&Eg(t[r],e[r]),!0):t===e}const T9=j.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),A9=()=>j.useContext(T9);function R9(t){const e=j.useRef(void 0);return Eg(e.current,t)||(e.current=t),e.current}const Cf=t=>{t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},O9=typeof window<"u"?j.useLayoutEffect:j.useEffect;function Mg(t,e,n,r){const o=j.useRef(null),i=j.useRef(!1),s=Array.isArray(n)?Array.isArray(r)?void 0:r:n,l=Bc(t)?t.join(s?.delimiter):t,a=Array.isArray(n)?n:Array.isArray(r)?r:void 0,c=j.useCallback(e,a??[]),u=j.useRef(c);a?u.current=c:u.current=e;const d=R9(s),{activeScopes:f}=A9(),h=M9();return O9(()=>{if(d?.enabled===!1||!S9(f,d?.scopes))return;let p=[],m;const v=(w,E=!1)=>{if(!(x9(w)&&!kg(w,d?.enableOnFormTags))){if(o.current!==null){const k=o.current.getRootNode();if((k instanceof Document||k instanceof ShadowRoot)&&k.activeElement!==o.current&&!o.current.contains(k.activeElement)){Cf(w);return}}w.target?.isContentEditable&&!d?.enableOnContentEditable||yl(l,d?.delimiter).forEach(k=>{if(k.includes(d?.splitKey??"+")&&k.includes(d?.sequenceSplitKey??">")){console.warn(`Hotkey ${k} contains both ${d?.splitKey??"+"} and ${d?.sequenceSplitKey??">"} which is not supported.`);return}const S=vl(k,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description);if(S.isSequence){m=setTimeout(()=>{p=[]},d?.sequenceTimeoutMs??1e3);const M=S.useKey?w.key:on(w.code);if(xg(M.toLowerCase()))return;p.push(M);const N=S.keys?.[p.length-1];if(M!==N){p=[],m&&clearTimeout(m);return}p.length===S.keys?.length&&(u.current(w,S),m&&clearTimeout(m),p=[])}else if(k9(w,S,d?.ignoreModifiers)||S.keys?.includes("*")){if(d?.ignoreEventWhen?.(w)||E&&i.current)return;if(v9(w,S,d?.preventDefault),!b9(w,S,d?.enabled)){Cf(w);return}u.current(w,S),E||(i.current=!0)}})}},b=w=>{w.code!==void 0&&(wg(on(w.code)),(d?.keydown===void 0&&d?.keyup!==!0||d?.keydown)&&v(w))},C=w=>{w.code!==void 0&&(Sg(on(w.code)),i.current=!1,d?.keyup&&v(w,!0))},x=o.current||s?.document||document;return x.addEventListener("keyup",C,s?.eventListenerOptions),x.addEventListener("keydown",b,s?.eventListenerOptions),h&&yl(l,d?.delimiter).forEach(w=>h.addHotkey(vl(w,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description))),()=>{x.removeEventListener("keyup",C,s?.eventListenerOptions),x.removeEventListener("keydown",b,s?.eventListenerOptions),h&&yl(l,d?.delimiter).forEach(w=>h.removeHotkey(vl(w,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description))),p=[],m&&clearTimeout(m)}},[l,d,f]),o}function hr(t=768){const[e,n]=y.useState(void 0);return y.useEffect(()=>{const r=window.matchMedia(`(max-width: ${t-1}px)`),o=()=>{n(window.innerWidth<t)};return r.addEventListener("change",o),n(window.innerWidth<t),()=>r.removeEventListener("change",o)},[t]),!!e}const Tg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 2C20 1.44772 19.5523 1 19 1C18.4477 1 18 1.44772 18 2V4H16C15.4477 4 15 4.44772 15 5C15 5.55228 15.4477 6 16 6H18V8C18 8.55228 18.4477 9 19 9C19.5523 9 20 8.55228 20 8V6H22C22.5523 6 23 5.55228 23 5C23 4.44772 22.5523 4 22 4H20V2ZM5 4C4.73478 4 4.48043 4.10536 4.29289 4.29289C4.10536 4.48043 4 4.73478 4 5V19C4 19.2652 4.10536 19.5196 4.29289 19.7071C4.48043 19.8946 4.73478 20 5 20H5.58579L14.379 11.2068C14.9416 10.6444 15.7045 10.3284 16.5 10.3284C17.2955 10.3284 18.0584 10.6444 18.621 11.2068L20 12.5858V12C20 11.4477 20.4477 11 21 11C21.5523 11 22 11.4477 22 12V14.998C22 14.9994 22 15.0007 22 15.002V19C22 19.7957 21.6839 20.5587 21.1213 21.1213C20.5587 21.6839 19.7957 22 19 22H6.00219C6.00073 22 5.99927 22 5.99781 22H5C4.20435 22 3.44129 21.6839 2.87868 21.1213C2.31607 20.5587 2 19.7957 2 19V5C2 4.20435 2.31607 3.44129 2.87868 2.87868C3.44129 2.31607 4.20435 2 5 2H12C12.5523 2 13 2.44772 13 3C13 3.55228 12.5523 4 12 4H5ZM8.41422 20H19C19.2652 20 19.5196 19.8946 19.7071 19.7071C19.8946 19.5196 20 19.2652 20 19V15.4142L17.207 12.6212C17.0195 12.4338 16.7651 12.3284 16.5 12.3284C16.2349 12.3284 15.9806 12.4337 15.7931 12.6211L8.41422 20ZM6.87868 6.87868C7.44129 6.31607 8.20435 6 9 6C9.79565 6 10.5587 6.31607 11.1213 6.87868C11.6839 7.44129 12 8.20435 12 9C12 9.79565 11.6839 10.5587 11.1213 11.1213C10.5587 11.6839 9.79565 12 9 12C8.20435 12 7.44129 11.6839 6.87868 11.1213C6.31607 10.5587 6 9.79565 6 9C6 8.20435 6.31607 7.44129 6.87868 6.87868ZM9 8C8.73478 8 8.48043 8.10536 8.29289 8.29289C8.10536 8.48043 8 8.73478 8 9C8 9.26522 8.10536 9.51957 8.29289 9.70711C8.48043 9.89464 8.73478 10 9 10C9.26522 10 9.51957 9.89464 9.70711 9.70711C9.89464 9.51957 10 9.26522 10 9C10 8.73478 9.89464 8.48043 9.70711 8.29289C9.51957 8.10536 9.26522 8 9 8Z",fill:"currentColor"})}));Tg.displayName="ImagePlusIcon";const fa="mod+shift+i";function _c(t){return!t||!t.isEditable||!ls(t,"imageUpload")||Ht(t,["image"])?!1:t.can().insertContent({type:"imageUpload"})}function N9(t){return!t||!t.isEditable?!1:t.isActive("imageUpload")}function I9(t){if(!t||!t.isEditable||!_c(t))return!1;try{return t.chain().focus().insertContent({type:"imageUpload"}).run()}catch{return!1}}function L9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!ls(e,"imageUpload")?!1:n&&!e.isActive("code")?_c(e):!0}function D9(t){const{editor:e,hideWhenUnavailable:n=!1,onInserted:r}=t||{},{editor:o}=ie(e),i=hr(),[s,l]=y.useState(!0),a=_c(o),c=N9(o);y.useEffect(()=>{if(!o)return;const d=()=>{l(L9({editor:o,hideWhenUnavailable:n}))};return d(),o.on("selectionUpdate",d),()=>{o.off("selectionUpdate",d)}},[o,n]);const u=y.useCallback(()=>{if(!o)return!1;const d=I9(o);return d&&r?.(),d},[o,r]);return Mg(fa,d=>{d.preventDefault(),u()},{enabled:s&&a,enableOnContentEditable:!i,enableOnFormTags:!0}),{isVisible:s,isActive:c,handleImage:u,canInsert:a,label:"Add image",shortcutKeys:fa,Icon:Tg}}function P9({type:t,shortcutKeys:e=Og[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Ag=y.forwardRef(({editor:t,type:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,canToggle:f,isActive:h,handleToggle:p,label:m,shortcutKeys:v,Icon:b}=H9({editor:u,type:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&p()},[p,s]);return d?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":h?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":m,"aria-pressed":h,tooltip:m,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(b,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(P9,{type:e,shortcutKeys:v})]})}):null});Ag.displayName="ListButton";const ms=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));ms.displayName="ListIcon";const Hc=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 6C9 5.44772 9.44772 5 10 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H10C9.44772 7 9 6.55228 9 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 12C9 11.4477 9.44772 11 10 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H10C9.44772 13 9 12.5523 9 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 18C9 17.4477 9.44772 17 10 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H10C9.44772 19 9 18.5523 9 18Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6C3 5.44772 3.44772 5 4 5H5C5.55228 5 6 5.44772 6 6V10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10V7C3.44772 7 3 6.55228 3 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 10C3 9.44772 3.44772 9 4 9H6C6.55228 9 7 9.44772 7 10C7 10.5523 6.55228 11 6 11H4C3.44772 11 3 10.5523 3 10Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.82219 13.0431C6.54543 13.4047 6.99997 14.1319 6.99997 15C6.99997 15.5763 6.71806 16.0426 6.48747 16.35C6.31395 16.5814 6.1052 16.8044 5.91309 17H5.99997C6.55226 17 6.99997 17.4477 6.99997 18C6.99997 18.5523 6.55226 19 5.99997 19H3.99997C3.44769 19 2.99997 18.5523 2.99997 18C2.99997 17.4237 3.28189 16.9575 3.51247 16.65C3.74323 16.3424 4.03626 16.0494 4.26965 15.8161C4.27745 15.8083 4.2852 15.8006 4.29287 15.7929C4.55594 15.5298 4.75095 15.3321 4.88748 15.15C4.96287 15.0495 4.99021 14.9922 4.99911 14.9714C4.99535 14.9112 4.9803 14.882 4.9739 14.8715C4.96613 14.8588 4.95382 14.845 4.92776 14.8319C4.87723 14.8067 4.71156 14.7623 4.44719 14.8944C3.95321 15.1414 3.35254 14.9412 3.10555 14.4472C2.85856 13.9533 3.05878 13.3526 3.55276 13.1056C4.28839 12.7378 5.12272 12.6934 5.82219 13.0431Z",fill:"currentColor"})]}));Hc.displayName="ListOrderedIcon";const Fc=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 4.89543 2.89543 4 4 4H8C9.10457 4 10 4.89543 10 6V10C10 11.1046 9.10457 12 8 12H4C2.89543 12 2 11.1046 2 10V6ZM8 6H4V10H8V6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071L2.29289 17.7071C1.90237 17.3166 1.90237 16.6834 2.29289 16.2929C2.68342 15.9024 3.31658 15.9024 3.70711 16.2929L5 17.5858L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 6C12 5.44772 12.4477 5 13 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H13C12.4477 7 12 6.55228 12 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 12C12 11.4477 12.4477 11 13 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H13C12.4477 13 12 12.5523 12 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18C12 17.4477 12.4477 17 13 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H13C12.4477 19 12 18.5523 12 18Z",fill:"currentColor"})]}));Fc.displayName="ListTodoIcon";const Rg={bulletList:ms,orderedList:Hc,taskList:Fc},j9={bulletList:"Bullet List",orderedList:"Ordered List",taskList:"Task List"},Og={bulletList:"mod+shift+8",orderedList:"mod+shift+7",taskList:"mod+shift+9"};function gs(t,e,n=!0){if(!t||!t.isEditable||!_t(e,t)||Ht(t,["image"]))return!1;if(!n)switch(e){case"bulletList":return t.can().toggleBulletList();case"orderedList":return t.can().toggleOrderedList();case"taskList":return t.can().toggleList("taskList","taskItem");default:return!1}try{const o=t.view.state,i=o.selection;if(i.empty||i instanceof V){const s=hn({editor:t,node:o.selection.$anchor.node(1)})?.pos;if(!yt(s))return!1}return!0}catch{return!1}}function $c(t,e){if(!t||!t.isEditable)return!1;switch(e){case"bulletList":return t.isActive("bulletList");case"orderedList":return t.isActive("orderedList");case"taskList":return t.isActive("taskList");default:return!1}}function B9(t,e){if(!t||!t.isEditable||!gs(t,e))return!1;try{const n=t.view;let r=n.state,o=r.tr;if(r.selection.empty||r.selection instanceof V){const l=hn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!yt(l))return!1;o=o.setSelection(B.create(r.doc,l)),n.dispatch(o),r=n.state}const i=r.selection;let s=t.chain().focus();if(i instanceof B){const l=i.node.firstChild?.firstChild,a=i.node.lastChild?.lastChild,c=l?i.from+l.nodeSize:i.from+1,u=a?i.to-a.nodeSize:i.to-1;s=s.setTextSelection({from:c,to:u}).clearNodes()}if(t.isActive(e))s.liftListItem("listItem").lift("bulletList").lift("orderedList").lift("taskList").run();else{const a={bulletList:()=>s.toggleBulletList(),orderedList:()=>s.toggleOrderedList(),taskList:()=>s.toggleList("taskList","taskItem")}[e];if(!a)return!1;a().run()}return t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function _9(t){const{editor:e,type:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!_t(n,e)?!1:r&&!e.isActive("code")?gs(e,n):!0}function H9(t){const{editor:e,type:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=gs(i,n),c=$c(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(_9({editor:i,type:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=B9(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleToggle:u,canToggle:a,label:j9[n],shortcutKeys:Og[n],Icon:Rg[n]}}const F9=[{label:"Bullet List",type:"bulletList",icon:ms},{label:"Ordered List",type:"orderedList",icon:Hc},{label:"Task List",type:"taskList",icon:Fc}];function $9(t,e){return!t||!t.isEditable?!1:e.some(n=>gs(t,n))}function V9(t,e){return!t||!t.isEditable?!1:e.some(n=>$c(t,n))}function z9(t){return F9.filter(e=>!e.type||t.includes(e.type))}function U9(t){const{editor:e,hideWhenUnavailable:n,listInSchema:r,canToggleAny:o}=t;return!r||!e?!1:n&&!e.isActive("code")?o:!0}function W9(t,e){if(!(!t||!t.isEditable))return e.find(n=>$c(t,n))}function K9(t){const{editor:e,types:n=["bulletList","orderedList","taskList"],hideWhenUnavailable:r=!1}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!1),l=n.some(h=>_t(h,o)),a=y.useMemo(()=>z9(n),[n]),c=$9(o,n),u=V9(o,n),d=W9(o,n),f=a.find(h=>h.type===d);return y.useEffect(()=>{if(!o)return;const h=()=>{s(U9({editor:o,hideWhenUnavailable:r,listInSchema:l,canToggleAny:c}))};return h(),o.on("selectionUpdate",h),()=>{o.off("selectionUpdate",h)}},[c,o,r,l,n]),{isVisible:i,activeType:d,isActive:u,canToggle:c,types:n,filteredLists:a,label:"List",Icon:f?Rg[f.type]:ms}}function Ng({editor:t,types:e=["bulletList","orderedList","taskList"],hideWhenUnavailable:n=!1,onOpenChange:r,portal:o=!1,...i}){const{editor:s}=ie(t),[l,a]=y.useState(!1),{filteredLists:c,canToggle:u,isActive:d,isVisible:f,Icon:h}=K9({editor:s,types:e,hideWhenUnavailable:n}),p=y.useCallback(m=>{a(m),r?.(m)},[r]);return!f||!s||!s.isEditable?null:g.jsxs(gg,{open:l,onOpenChange:p,children:[g.jsx(Ic,{asChild:!0,children:g.jsxs(fe,{type:"button","data-style":"ghost","data-active-state":d?"on":"off",role:"button",tabIndex:-1,disabled:!u,"data-disabled":!u,"aria-label":"List options",tooltip:"List",...i,children:[g.jsx(h,{className:"tiptap-button-icon"}),g.jsx(mc,{className:"tiptap-button-dropdown-small"})]})}),g.jsx(Lc,{align:"start",portal:o,children:g.jsx(fr,{children:g.jsx(lo,{children:g.jsx(In,{children:c.map(m=>g.jsx(vg,{asChild:!0,children:g.jsx(Ag,{editor:s,type:m.type,text:m.label,showTooltip:!1})},m.type))})})})})]})}function q9({shortcutKeys:t=Lg}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const Vc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onToggled:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),{isVisible:u,canToggle:d,isActive:f,handleToggle:h,label:p,shortcutKeys:m,Icon:v}=Z9({editor:c,hideWhenUnavailable:n,onToggled:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&h()},[h,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",tabIndex:-1,disabled:!d,"data-disabled":!d,"aria-label":p,"aria-pressed":f,tooltip:"Blockquote",onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(q9,{shortcutKeys:m})]})}):null});Vc.displayName="BlockquoteButton";const Ig=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 6C8 5.44772 8.44772 5 9 5H16C16.5523 5 17 5.44772 17 6C17 6.55228 16.5523 7 16 7H9C8.44772 7 8 6.55228 8 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3C4.55228 3 5 3.44772 5 4L5 20C5 20.5523 4.55229 21 4 21C3.44772 21 3 20.5523 3 20L3 4C3 3.44772 3.44772 3 4 3Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 18C8 17.4477 8.44772 17 9 17H16C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19H9C8.44772 19 8 18.5523 8 18Z",fill:"currentColor"})]}));Ig.displayName="BlockquoteIcon";const Lg="mod+shift+b";function zc(t,e=!0){if(!t||!t.isEditable||!_t("blockquote",t)||Ht(t,["image"]))return!1;if(!e)return t.can().toggleWrap("blockquote");try{const r=t.view.state,o=r.selection;if(o.empty||o instanceof V){const i=hn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!yt(i))return!1}return!0}catch{return!1}}function G9(t){if(!t||!t.isEditable||!zc(t))return!1;try{const e=t.view;let n=e.state,r=n.tr;if(n.selection.empty||n.selection instanceof V){const l=hn({editor:t,node:n.selection.$anchor.node(1)})?.pos;if(!yt(l))return!1;r=r.setSelection(B.create(n.doc,l)),e.dispatch(r),n=e.state}const o=n.selection;let i=t.chain().focus();if(o instanceof B){const l=o.node.firstChild?.firstChild,a=o.node.lastChild?.lastChild,c=l?o.from+l.nodeSize:o.from+1,u=a?o.to-a.nodeSize:o.to-1;i=i.setTextSelection({from:c,to:u}).clearNodes()}return(t.isActive("blockquote")?i.lift("blockquote"):i.wrapIn("blockquote")).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function J9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!_t("blockquote",e)?!1:n&&!e.isActive("code")?zc(e):!0}function Z9(t){const{editor:e,hideWhenUnavailable:n=!1,onToggled:r}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!0),l=zc(o),a=o?.isActive("blockquote")||!1;y.useEffect(()=>{if(!o)return;const u=()=>{s(J9({editor:o,hideWhenUnavailable:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,n]);const c=y.useCallback(()=>{if(!o)return!1;const u=G9(o);return u&&r?.(),u},[o,r]);return{isVisible:i,isActive:a,handleToggle:c,canToggle:l,label:"Blockquote",shortcutKeys:Lg,Icon:Ig}}function Y9({shortcutKeys:t=Pg}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const Uc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onToggled:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),{isVisible:u,canToggle:d,isActive:f,handleToggle:h,label:p,shortcutKeys:m,Icon:v}=eE({editor:c,hideWhenUnavailable:n,onToggled:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&h()},[h,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",disabled:!d,"data-disabled":!d,tabIndex:-1,"aria-label":p,"aria-pressed":f,tooltip:"Code Block",onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(Y9,{shortcutKeys:m})]})}):null});Uc.displayName="CodeBlockButton";const Dg=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.70711 2.29289C7.09763 2.68342 7.09763 3.31658 6.70711 3.70711L4.41421 6L6.70711 8.29289C7.09763 8.68342 7.09763 9.31658 6.70711 9.70711C6.31658 10.0976 5.68342 10.0976 5.29289 9.70711L2.29289 6.70711C1.90237 6.31658 1.90237 5.68342 2.29289 5.29289L5.29289 2.29289C5.68342 1.90237 6.31658 1.90237 6.70711 2.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.2929 2.29289C10.6834 1.90237 11.3166 1.90237 11.7071 2.29289L14.7071 5.29289C15.0976 5.68342 15.0976 6.31658 14.7071 6.70711L11.7071 9.70711C11.3166 10.0976 10.6834 10.0976 10.2929 9.70711C9.90237 9.31658 9.90237 8.68342 10.2929 8.29289L12.5858 6L10.2929 3.70711C9.90237 3.31658 9.90237 2.68342 10.2929 2.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17 4C17 3.44772 17.4477 3 18 3H19C20.6569 3 22 4.34315 22 6V18C22 19.6569 20.6569 21 19 21H5C3.34315 21 2 19.6569 2 18V12C2 11.4477 2.44772 11 3 11C3.55228 11 4 11.4477 4 12V18C4 18.5523 4.44772 19 5 19H19C19.5523 19 20 18.5523 20 18V6C20 5.44772 19.5523 5 19 5H18C17.4477 5 17 4.55228 17 4Z",fill:"currentColor"})]}));Dg.displayName="CodeBlockIcon";const Pg="mod+alt+c";function Wc(t,e=!0){if(!t||!t.isEditable||!_t("codeBlock",t)||Ht(t,["image"]))return!1;if(!e)return t.can().toggleNode("codeBlock","paragraph");try{const r=t.view.state,o=r.selection;if(o.empty||o instanceof V){const i=hn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!yt(i))return!1}return!0}catch{return!1}}function X9(t){if(!t||!t.isEditable||!Wc(t))return!1;try{const e=t.view;let n=e.state,r=n.tr;if(n.selection.empty||n.selection instanceof V){const l=hn({editor:t,node:n.selection.$anchor.node(1)})?.pos;if(!yt(l))return!1;r=r.setSelection(B.create(n.doc,l)),e.dispatch(r),n=e.state}const o=n.selection;let i=t.chain().focus();if(o instanceof B){const l=o.node.firstChild?.firstChild,a=o.node.lastChild?.lastChild,c=l?o.from+l.nodeSize:o.from+1,u=a?o.to-a.nodeSize:o.to-1;i=i.setTextSelection({from:c,to:u}).clearNodes()}return(t.isActive("codeBlock")?i.setNode("paragraph"):i.toggleNode("codeBlock","paragraph")).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function Q9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!_t("codeBlock",e)?!1:n&&!e.isActive("code")?Wc(e):!0}function eE(t){const{editor:e,hideWhenUnavailable:n=!1,onToggled:r}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!0),l=Wc(o),a=o?.isActive("codeBlock")||!1;y.useEffect(()=>{if(!o)return;const u=()=>{s(Q9({editor:o,hideWhenUnavailable:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,n]);const c=y.useCallback(()=>{if(!o)return!1;const u=X9(o);return u&&r?.(),u},[o,r]);return{isVisible:i,isActive:a,handleToggle:c,canToggle:l,label:"Code Block",shortcutKeys:Pg,Icon:Dg}}const jg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.43471 4.01458C4.34773 4.06032 4.26607 4.11977 4.19292 4.19292C4.11977 4.26607 4.06032 4.34773 4.01458 4.43471C2.14611 6.40628 1 9.0693 1 12C1 18.0751 5.92487 23 12 23C14.9306 23 17.5936 21.854 19.5651 19.9856C19.6522 19.9398 19.7339 19.8803 19.8071 19.8071C19.8803 19.7339 19.9398 19.6522 19.9856 19.5651C21.854 17.5936 23 14.9306 23 12C23 5.92487 18.0751 1 12 1C9.0693 1 6.40628 2.14611 4.43471 4.01458ZM6.38231 4.9681C7.92199 3.73647 9.87499 3 12 3C16.9706 3 21 7.02944 21 12C21 14.125 20.2635 16.078 19.0319 17.6177L6.38231 4.9681ZM17.6177 19.0319C16.078 20.2635 14.125 21 12 21C7.02944 21 3 16.9706 3 12C3 9.87499 3.73647 7.92199 4.9681 6.38231L17.6177 19.0319Z",fill:"currentColor"})}));jg.displayName="BanIcon";const ys=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.7072 4.70711C15.0977 4.31658 15.0977 3.68342 14.7072 3.29289C14.3167 2.90237 13.6835 2.90237 13.293 3.29289L8.69294 7.89286L8.68594 7.9C8.13626 8.46079 7.82837 9.21474 7.82837 10C7.82837 10.2306 7.85491 10.4584 7.90631 10.6795L2.29289 16.2929C2.10536 16.4804 2 16.7348 2 17V20C2 20.5523 2.44772 21 3 21H12C12.2652 21 12.5196 20.8946 12.7071 20.7071L15.3205 18.0937C15.5416 18.1452 15.7695 18.1717 16.0001 18.1717C16.7853 18.1717 17.5393 17.8639 18.1001 17.3142L22.7072 12.7071C23.0977 12.3166 23.0977 11.6834 22.7072 11.2929C22.3167 10.9024 21.6835 10.9024 21.293 11.2929L16.6971 15.8887C16.5105 16.0702 16.2605 16.1717 16.0001 16.1717C15.7397 16.1717 15.4897 16.0702 15.303 15.8887L10.1113 10.697C9.92992 10.5104 9.82837 10.2604 9.82837 10C9.82837 9.73963 9.92992 9.48958 10.1113 9.30297L14.7072 4.70711ZM13.5858 17L9.00004 12.4142L4 17.4142V19H11.5858L13.5858 17Z",fill:"currentColor"})}));ys.displayName="HighlighterIcon";var vs="Popover",[Bg]=dr(vs,[us]),ao=us(),[tE,pn]=Bg(vs),_g=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=t,l=ao(e),a=y.useRef(null),[c,u]=y.useState(!1),[d,f]=yc({prop:r,defaultProp:o??!1,onChange:i,caller:vs});return g.jsx(y1,{...l,children:g.jsx(tE,{scope:e,contentId:Pi(),triggerRef:a,open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:c,onCustomAnchorAdd:y.useCallback(()=>u(!0),[]),onCustomAnchorRemove:y.useCallback(()=>u(!1),[]),modal:s,children:n})})};_g.displayName=vs;var Hg="PopoverAnchor",nE=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=pn(Hg,n),i=ao(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:l}=o;return y.useEffect(()=>(s(),()=>l()),[s,l]),g.jsx(wc,{...i,...r,ref:e})});nE.displayName=Hg;var Fg="PopoverTrigger",$g=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=pn(Fg,n),i=ao(n),s=Oe(e,o.triggerRef),l=g.jsx(Te.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Kg(o.open),...r,ref:s,onClick:J(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:g.jsx(wc,{asChild:!0,...i,children:l})});$g.displayName=Fg;var Kc="PopoverPortal",[rE,oE]=Bg(Kc,{forceMount:void 0}),Vg=t=>{const{__scopePopover:e,forceMount:n,children:r,container:o}=t,i=pn(Kc,e);return g.jsx(rE,{scope:e,forceMount:n,children:g.jsx(Dn,{present:n||i.open,children:g.jsx(Sc,{asChild:!0,container:o,children:r})})})};Vg.displayName=Kc;var lr="PopoverContent",zg=y.forwardRef((t,e)=>{const n=oE(lr,t.__scopePopover),{forceMount:r=n.forceMount,...o}=t,i=pn(lr,t.__scopePopover);return g.jsx(Dn,{present:r||i.open,children:i.modal?g.jsx(sE,{...o,ref:e}):g.jsx(lE,{...o,ref:e})})});zg.displayName=lr;var iE=qr("PopoverContent.RemoveScroll"),sE=y.forwardRef((t,e)=>{const n=pn(lr,t.__scopePopover),r=y.useRef(null),o=Oe(e,r),i=y.useRef(!1);return y.useEffect(()=>{const s=r.current;if(s)return T1(s)},[]),g.jsx(kc,{as:iE,allowPinchZoom:!0,children:g.jsx(Ug,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(t.onCloseAutoFocus,s=>{s.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:J(t.onPointerDownOutside,s=>{const l=s.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0,c=l.button===2||a;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:J(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),lE=y.forwardRef((t,e)=>{const n=pn(lr,t.__scopePopover),r=y.useRef(!1),o=y.useRef(!1);return g.jsx(Ug,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),Ug=y.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:c,onInteractOutside:u,...d}=t,f=pn(lr,n),h=ao(n);return i1(),g.jsx(bc,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:g.jsx(vc,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:g.jsx(v1,{"data-state":Kg(f.open),role:"dialog",id:f.contentId,...h,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Wg="PopoverClose",aE=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=pn(Wg,n);return g.jsx(Te.button,{type:"button",...r,ref:e,onClick:J(t.onClick,()=>o.onOpenChange(!1))})});aE.displayName=Wg;var cE="PopoverArrow",uE=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=ao(n);return g.jsx(b1,{...o,...r,ref:e})});uE.displayName=cE;function Kg(t){return t?"open":"closed"}var dE=_g,fE=$g,hE=Vg,pE=zg;function qg({...t}){return g.jsx(dE,{...t})}function Gg({...t}){return g.jsx(fE,{...t})}function Jg({className:t,align:e="center",sideOffset:n=4,...r}){return g.jsx(hE,{children:g.jsx(pE,{align:e,sideOffset:n,className:Me("tiptap-popover",t),...r})})}function mE({shortcutKeys:t=ha}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const Zg=y.forwardRef(({editor:t,highlightColor:e,text:n,hideWhenUnavailable:r=!1,onApplied:o,showShortcut:i=!1,onClick:s,children:l,style:a,...c},u)=>{const{editor:d}=ie(t),{isVisible:f,canColorHighlight:h,isActive:p,handleColorHighlight:m,label:v,shortcutKeys:b}=Gc({editor:d,highlightColor:e,label:n||`Toggle highlight (${e})`,hideWhenUnavailable:r,onApplied:o}),C=y.useCallback(w=>{s?.(w),!w.defaultPrevented&&m()},[m,s]),x=y.useMemo(()=>({...a,"--highlight-color":e}),[e,a]);return f?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":p?"on":"off",role:"button",tabIndex:-1,disabled:!h,"data-disabled":!h,"aria-label":v,"aria-pressed":p,tooltip:v,onClick:C,style:x,...c,ref:u,children:l??g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"tiptap-button-highlight",style:{"--highlight-color":e}}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(mE,{shortcutKeys:b})]})}):null});Zg.displayName="ColorHighlightButton";const ha="mod+shift+h",gE=[{label:"Default background",value:"var(--tt-bg-color)",border:"var(--tt-bg-color-contrast)"},{label:"Gray background",value:"var(--tt-color-highlight-gray)",border:"var(--tt-color-highlight-gray-contrast)"},{label:"Brown background",value:"var(--tt-color-highlight-brown)",border:"var(--tt-color-highlight-brown-contrast)"},{label:"Orange background",value:"var(--tt-color-highlight-orange)",border:"var(--tt-color-highlight-orange-contrast)"},{label:"Yellow background",value:"var(--tt-color-highlight-yellow)",border:"var(--tt-color-highlight-yellow-contrast)"},{label:"Green background",value:"var(--tt-color-highlight-green)",border:"var(--tt-color-highlight-green-contrast)"},{label:"Blue background",value:"var(--tt-color-highlight-blue)",border:"var(--tt-color-highlight-blue-contrast)"},{label:"Purple background",value:"var(--tt-color-highlight-purple)",border:"var(--tt-color-highlight-purple-contrast)"},{label:"Pink background",value:"var(--tt-color-highlight-pink)",border:"var(--tt-color-highlight-pink-contrast)"},{label:"Red background",value:"var(--tt-color-highlight-red)",border:"var(--tt-color-highlight-red-contrast)"}];function Yg(t){const e=new Map(gE.map(n=>[n.value,n]));return t.map(n=>e.get(n)).filter(n=>!!n)}function qc(t){return!t||!t.isEditable||!ro("highlight",t)||Ht(t,["image"])?!1:t.can().setMark("highlight")}function yE(t,e){return!t||!t.isEditable?!1:e?t.isActive("highlight",{color:e}):t.isActive("highlight")}function vE(t){return!t||!t.isEditable||!qc(t)?!1:t.chain().focus().unsetMark("highlight").run()}function bE(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!ro("highlight",e)?!1:n&&!e.isActive("code")?qc(e):!0}function Gc(t){const{editor:e,label:n,highlightColor:r,hideWhenUnavailable:o=!1,onApplied:i}=t,{editor:s}=ie(e),l=hr(),[a,c]=y.useState(!0),u=qc(s),d=yE(s,r);y.useEffect(()=>{if(!s)return;const p=()=>{c(bE({editor:s,hideWhenUnavailable:o}))};return p(),s.on("selectionUpdate",p),()=>{s.off("selectionUpdate",p)}},[s,o]);const f=y.useCallback(()=>{if(!s||!u||!r||!n)return!1;if(s.state.storedMarks){const p=s.schema.marks.highlight;p&&s.view.dispatch(s.state.tr.removeStoredMark(p))}setTimeout(()=>{const p=s.chain().focus().toggleMark("highlight",{color:r}).run();return p&&i?.({color:r,label:n}),p},0)},[u,r,s,n,i]),h=y.useCallback(()=>{const p=vE(s);return p&&i?.({color:"",label:"Remove highlight"}),p},[s,i]);return Mg(ha,p=>{p.preventDefault(),f()},{enabled:a&&u,enableOnContentEditable:!l,enableOnFormTags:!0}),{isVisible:a,isActive:d,handleColorHighlight:f,handleRemoveHighlight:h,canColorHighlight:u,label:n||"Highlight",shortcutKeys:ha,Icon:ys}}const Jc=y.forwardRef(({className:t,children:e,...n},r)=>g.jsx(fe,{type:"button",className:t,"data-style":"ghost","data-appearance":"default",role:"button",tabIndex:-1,"aria-label":"Highlight text",tooltip:"Highlight",ref:r,...n,children:e??g.jsx(ys,{className:"tiptap-button-icon"})}));Jc.displayName="ColorHighlightPopoverButton";function Xg({editor:t,colors:e=Yg(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"])}){const{handleRemoveHighlight:n}=Gc({editor:t}),r=hr(),o=y.useRef(null),i=y.useMemo(()=>[...e,{label:"Remove highlight",value:"none"}],[e]),{selectedIndex:s}=$m({containerRef:o,items:i,orientation:"both",onSelect:l=>{if(!o.current)return!1;const a=o.current.querySelector('[data-highlighted="true"]');a&&a.click(),l.value==="none"&&n()},autoSelectFirstItem:!1});return g.jsx(fr,{ref:o,tabIndex:0,style:r?{boxShadow:"none",border:0}:{},children:g.jsx(lo,{style:r?{padding:0}:{},children:g.jsxs(Dc,{orientation:"horizontal",children:[g.jsx(In,{orientation:"horizontal",children:e.map((l,a)=>g.jsx(Zg,{editor:t,highlightColor:l.value,tooltip:l.label,"aria-label":`${l.label} highlight color`,tabIndex:a===s?0:-1,"data-highlighted":s===a},l.value))}),g.jsx(as,{}),g.jsx(In,{orientation:"horizontal",children:g.jsx(fe,{onClick:n,"aria-label":"Remove highlight",tooltip:"Remove highlight",tabIndex:s===e.length?0:-1,type:"button",role:"menuitem","data-style":"ghost","data-highlighted":s===e.length,children:g.jsx(jg,{className:"tiptap-button-icon"})})})]})})})}function CE({editor:t,colors:e=Yg(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"]),hideWhenUnavailable:n=!1,onApplied:r,...o}){const{editor:i}=ie(t),[s,l]=y.useState(!1),{isVisible:a,canColorHighlight:c,isActive:u,label:d,Icon:f}=Gc({editor:i,hideWhenUnavailable:n,onApplied:r});return a?g.jsxs(qg,{open:s,onOpenChange:l,children:[g.jsx(Gg,{asChild:!0,children:g.jsx(Jc,{disabled:!c,"data-active-state":u?"on":"off","data-disabled":!c,"aria-pressed":u,"aria-label":d,tooltip:d,...o,children:g.jsx(f,{className:"tiptap-button-icon"})})}),g.jsx(Jg,{"aria-label":"Highlight colors",children:g.jsx(Xg,{editor:i,colors:e})})]}):null}const Qg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21 4C21 3.44772 20.5523 3 20 3C19.4477 3 19 3.44772 19 4V11C19 11.7956 18.6839 12.5587 18.1213 13.1213C17.5587 13.6839 16.7956 14 16 14H6.41421L9.70711 10.7071C10.0976 10.3166 10.0976 9.68342 9.70711 9.29289C9.31658 8.90237 8.68342 8.90237 8.29289 9.29289L3.29289 14.2929C2.90237 14.6834 2.90237 15.3166 3.29289 15.7071L8.29289 20.7071C8.68342 21.0976 9.31658 21.0976 9.70711 20.7071C10.0976 20.3166 10.0976 19.6834 9.70711 19.2929L6.41421 16H16C17.3261 16 18.5979 15.4732 19.5355 14.5355C20.4732 13.5979 21 12.3261 21 11V4Z",fill:"currentColor"})}));Qg.displayName="CornerDownLeftIcon";const e0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M14 3C14 2.44772 14.4477 2 15 2H21C21.5523 2 22 2.44772 22 3V9C22 9.55228 21.5523 10 21 10C20.4477 10 20 9.55228 20 9V5.41421L10.7071 14.7071C10.3166 15.0976 9.68342 15.0976 9.29289 14.7071C8.90237 14.3166 8.90237 13.6834 9.29289 13.2929L18.5858 4H15C14.4477 4 14 3.55228 14 3Z",fill:"currentColor"}),g.jsx("path",{d:"M4.29289 7.29289C4.48043 7.10536 4.73478 7 5 7H11C11.5523 7 12 6.55228 12 6C12 5.44772 11.5523 5 11 5H5C4.20435 5 3.44129 5.31607 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V19C2 19.7957 2.31607 20.5587 2.87868 21.1213C3.44129 21.6839 4.20435 22 5 22H16C16.7957 22 17.5587 21.6839 18.1213 21.1213C18.6839 20.5587 19 19.7957 19 19V13C19 12.4477 18.5523 12 18 12C17.4477 12 17 12.4477 17 13V19C17 19.2652 16.8946 19.5196 16.7071 19.7071C16.5196 19.8946 16.2652 20 16 20H5C4.73478 20 4.48043 19.8946 4.29289 19.7071C4.10536 19.5196 4 19.2652 4 19V8C4 7.73478 4.10536 7.48043 4.29289 7.29289Z",fill:"currentColor"})]}));e0.displayName="ExternalLinkIcon";const bs=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z",fill:"currentColor"}),g.jsx("path",{d:"M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z",fill:"currentColor"})]}));bs.displayName="LinkIcon";const t0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 5V4C7 3.17477 7.40255 2.43324 7.91789 1.91789C8.43324 1.40255 9.17477 1 10 1H14C14.8252 1 15.5668 1.40255 16.0821 1.91789C16.5975 2.43324 17 3.17477 17 4V5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H20V20C20 20.8252 19.5975 21.5668 19.0821 22.0821C18.5668 22.5975 17.8252 23 17 23H7C6.17477 23 5.43324 22.5975 4.91789 22.0821C4.40255 21.5668 4 20.8252 4 20V7H3C2.44772 7 2 6.55228 2 6C2 5.44772 2.44772 5 3 5H7ZM9 4C9 3.82523 9.09745 3.56676 9.33211 3.33211C9.56676 3.09745 9.82523 3 10 3H14C14.1748 3 14.4332 3.09745 14.6679 3.33211C14.9025 3.56676 15 3.82523 15 4V5H9V4ZM6 7V20C6 20.1748 6.09745 20.4332 6.33211 20.6679C6.56676 20.9025 6.82523 21 7 21H17C17.1748 21 17.4332 20.9025 17.6679 20.6679C17.9025 20.4332 18 20.1748 18 20V7H6Z",fill:"currentColor"})}));t0.displayName="TrashIcon";function xE({className:t,type:e,...n}){return g.jsx("input",{type:e,className:Me("tiptap-input",t),...n})}function wE({className:t,children:e,...n}){return g.jsx("div",{className:Me("tiptap-input-group",t),...n,children:e})}const Zc=y.forwardRef(({className:t,children:e,...n},r)=>g.jsx(fe,{type:"button",className:t,"data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Link",tooltip:"Link",ref:r,...n,children:e||g.jsx(bs,{className:"tiptap-button-icon"})}));Zc.displayName="LinkButton";const n0=({url:t,setUrl:e,setLink:n,removeLink:r,openLink:o,isActive:i})=>{const s=hr(),l=a=>{a.key==="Enter"&&(a.preventDefault(),n())};return g.jsx(fr,{style:{...s?{boxShadow:"none",border:0}:{}},children:g.jsx(lo,{style:{...s?{padding:0}:{}},children:g.jsxs(Dc,{orientation:"horizontal",children:[g.jsx(wE,{children:g.jsx(xE,{type:"url",placeholder:"Paste a link...",value:t,onChange:a=>e(a.target.value),onKeyDown:l,autoFocus:!0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off"})}),g.jsx(In,{orientation:"horizontal",children:g.jsx(fe,{type:"button",onClick:n,title:"Apply link",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(Qg,{className:"tiptap-button-icon"})})}),g.jsx(as,{}),g.jsxs(In,{orientation:"horizontal",children:[g.jsx(fe,{type:"button",onClick:o,title:"Open in new window",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(e0,{className:"tiptap-button-icon"})}),g.jsx(fe,{type:"button",onClick:r,title:"Remove link",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(t0,{className:"tiptap-button-icon"})})]})]})})})},SE=({editor:t})=>{const e=s0({editor:t});return g.jsx(n0,{...e})},r0=y.forwardRef(({editor:t,hideWhenUnavailable:e=!1,onSetLink:n,onOpenChange:r,autoOpenOnLinkActive:o=!0,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),[u,d]=y.useState(!1),{isVisible:f,canSet:h,isActive:p,url:m,setUrl:v,setLink:b,removeLink:C,openLink:x,label:w,Icon:E}=s0({editor:c,hideWhenUnavailable:e,onSetLink:n}),k=y.useCallback(N=>{d(N),r?.(N)},[r]),S=y.useCallback(()=>{b(),d(!1)},[b]),M=y.useCallback(N=>{i?.(N),!N.defaultPrevented&&d(!u)},[i,u]);return y.useEffect(()=>{o&&p&&d(!0)},[o,p]),f?g.jsxs(qg,{open:u,onOpenChange:k,children:[g.jsx(Gg,{asChild:!0,children:g.jsx(Zc,{disabled:!h,"data-active-state":p?"on":"off","data-disabled":!h,"aria-label":w,"aria-pressed":p,onClick:M,...l,ref:a,children:s??g.jsx(E,{className:"tiptap-button-icon"})})}),g.jsx(Jg,{children:g.jsx(n0,{url:m,setUrl:v,setLink:S,removeLink:C,openLink:x,isActive:p})})]}):null});r0.displayName="LinkPopover";function o0(t){return!t||!t.isEditable?!1:t.can().setMark("link")}function i0(t){return!t||!t.isEditable?!1:t.isActive("link")}function kE(t){const{editor:e,hideWhenUnavailable:n}=t;return!ro("link",e)||!e?!1:n&&!e.isActive("code")?o0(e):!0}function EE(t){const{editor:e,onSetLink:n}=t,[r,o]=y.useState(null);y.useEffect(()=>{if(!e)return;const{href:a}=e.getAttributes("link");i0(e)&&r===null&&o(a||"")},[e,r]),y.useEffect(()=>{if(!e)return;const a=()=>{const{href:c}=e.getAttributes("link");o(c||"")};return e.on("selectionUpdate",a),()=>{e.off("selectionUpdate",a)}},[e]);const i=y.useCallback(()=>{if(!r||!e)return;const{selection:a}=e.state,c=a.empty;let u=e.chain().focus();u=u.extendMarkRange("link").setLink({href:r}),c&&(u=u.insertContent({type:"text",text:r})),u.run(),o(null),n?.()},[e,n,r]),s=y.useCallback(()=>{e&&(e.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink",!0).run(),o(""))},[e]),l=y.useCallback((a="_blank",c="noopener,noreferrer")=>{if(!r)return;const u=K5(r,window.location.href);u!=="#"&&window.open(u,a,c)},[r]);return{url:r||"",setUrl:o,setLink:i,removeLink:s,openLink:l}}function ME(t){const{editor:e,hideWhenUnavailable:n=!1}=t,r=o0(e),o=i0(e),[i,s]=y.useState(!1);return y.useEffect(()=>{if(!e)return;const l=()=>{s(kE({editor:e,hideWhenUnavailable:n}))};return l(),e.on("selectionUpdate",l),()=>{e.off("selectionUpdate",l)}},[e,n]),{isVisible:i,canSet:r,isActive:o}}function s0(t){const{editor:e,hideWhenUnavailable:n=!1,onSetLink:r}=t||{},{editor:o}=ie(e),{isVisible:i,canSet:s,isActive:l}=ME({editor:o,hideWhenUnavailable:n}),a=EE({editor:o,onSetLink:r});return{isVisible:i,canSet:s,isActive:l,label:"Link",Icon:bs,...a}}function TE({type:t,shortcutKeys:e=p0[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Et=y.forwardRef(({editor:t,type:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,handleMark:f,label:h,canToggle:p,isActive:m,Icon:v,shortcutKeys:b}=LE({editor:u,type:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&f()},[f,s]);return d?g.jsx(fe,{type:"button",disabled:!p,"data-style":"ghost","data-active-state":m?"on":"off","data-disabled":!p,role:"button",tabIndex:-1,"aria-label":h,"aria-pressed":m,tooltip:h,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(TE,{type:e,shortcutKeys:b})]})}):null});Et.displayName="MarkButton";const l0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2.5C5.17157 2.5 4.5 3.17157 4.5 4V20C4.5 20.8284 5.17157 21.5 6 21.5H15C16.4587 21.5 17.8576 20.9205 18.8891 19.8891C19.9205 18.8576 20.5 17.4587 20.5 16C20.5 14.5413 19.9205 13.1424 18.8891 12.1109C18.6781 11.9 18.4518 11.7079 18.2128 11.5359C19.041 10.5492 19.5 9.29829 19.5 8C19.5 6.54131 18.9205 5.14236 17.8891 4.11091C16.8576 3.07946 15.4587 2.5 14 2.5H6ZM14 10.5C14.663 10.5 15.2989 10.2366 15.7678 9.76777C16.2366 9.29893 16.5 8.66304 16.5 8C16.5 7.33696 16.2366 6.70107 15.7678 6.23223C15.2989 5.76339 14.663 5.5 14 5.5H7.5V10.5H14ZM7.5 18.5V13.5H15C15.663 13.5 16.2989 13.7634 16.7678 14.2322C17.2366 14.7011 17.5 15.337 17.5 16C17.5 16.663 17.2366 17.2989 16.7678 17.7678C16.2989 18.2366 15.663 18.5 15 18.5H7.5Z",fill:"currentColor"})}));l0.displayName="BoldIcon";const a0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M15.4545 4.2983C15.6192 3.77115 15.3254 3.21028 14.7983 3.04554C14.2712 2.88081 13.7103 3.1746 13.5455 3.70175L8.54554 19.7017C8.38081 20.2289 8.6746 20.7898 9.20175 20.9545C9.72889 21.1192 10.2898 20.8254 10.4545 20.2983L15.4545 4.2983Z",fill:"currentColor"}),g.jsx("path",{d:"M6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.70711L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289Z",fill:"currentColor"}),g.jsx("path",{d:"M17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C23.0976 11.6834 23.0976 12.3166 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z",fill:"currentColor"})]}));a0.displayName="Code2Icon";const c0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M15.0222 3H19C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H15.693L10.443 19H14C14.5523 19 15 19.4477 15 20C15 20.5523 14.5523 21 14 21H9.02418C9.00802 21.0004 8.99181 21.0004 8.97557 21H5C4.44772 21 4 20.5523 4 20C4 19.4477 4.44772 19 5 19H8.30704L13.557 5H10C9.44772 5 9 4.55228 9 4C9 3.44772 9.44772 3 10 3H14.9782C14.9928 2.99968 15.0075 2.99967 15.0222 3Z",fill:"currentColor"})}));c0.displayName="ItalicIcon";const u0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M9.00039 3H16.0001C16.5524 3 17.0001 3.44772 17.0001 4C17.0001 4.55229 16.5524 5 16.0001 5H9.00011C8.68006 4.99983 8.36412 5.07648 8.07983 5.22349C7.79555 5.37051 7.55069 5.5836 7.36585 5.84487C7.181 6.10614 7.06155 6.40796 7.01754 6.72497C6.97352 7.04198 7.00623 7.36492 7.11292 7.66667C7.29701 8.18737 7.02414 8.75872 6.50344 8.94281C5.98274 9.1269 5.4114 8.85403 5.2273 8.33333C5.01393 7.72984 4.94851 7.08396 5.03654 6.44994C5.12456 5.81592 5.36346 5.21229 5.73316 4.68974C6.10285 4.1672 6.59256 3.74101 7.16113 3.44698C7.72955 3.15303 8.36047 2.99975 9.00039 3Z",fill:"currentColor"}),g.jsx("path",{d:"M18 13H20C20.5523 13 21 12.5523 21 12C21 11.4477 20.5523 11 20 11H4C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13H14C14.7956 13 15.5587 13.3161 16.1213 13.8787C16.6839 14.4413 17 15.2044 17 16C17 16.7956 16.6839 17.5587 16.1213 18.1213C15.5587 18.6839 14.7956 19 14 19H6C5.44772 19 5 19.4477 5 20C5 20.5523 5.44772 21 6 21H14C15.3261 21 16.5979 20.4732 17.5355 19.5355C18.4732 18.5979 19 17.3261 19 16C19 14.9119 18.6453 13.8604 18 13Z",fill:"currentColor"})]}));u0.displayName="StrikeIcon";const d0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.4079 14.3995C18.0284 14.0487 18.7506 13.9217 19.4536 14.0397C20.1566 14.1578 20.7977 14.5138 21.2696 15.0481L21.2779 15.0574L21.2778 15.0575C21.7439 15.5988 22 16.2903 22 17C22 18.0823 21.3962 18.8401 20.7744 19.3404C20.194 19.8073 19.4858 20.141 18.9828 20.378C18.9638 20.387 18.9451 20.3958 18.9266 20.4045C18.4473 20.6306 18.2804 20.7817 18.1922 20.918C18.1773 20.9412 18.1619 20.9681 18.1467 21H21C21.5523 21 22 21.4477 22 22C22 22.5523 21.5523 23 21 23H17C16.4477 23 16 22.5523 16 22C16 21.1708 16.1176 20.4431 16.5128 19.832C16.9096 19.2184 17.4928 18.8695 18.0734 18.5956C18.6279 18.334 19.138 18.0901 19.5207 17.7821C19.8838 17.49 20 17.2477 20 17C20 16.7718 19.9176 16.5452 19.7663 16.3672C19.5983 16.1792 19.3712 16.0539 19.1224 16.0121C18.8722 15.9701 18.6152 16.015 18.3942 16.1394C18.1794 16.2628 18.0205 16.4549 17.9422 16.675C17.7572 17.1954 17.1854 17.4673 16.665 17.2822C16.1446 17.0972 15.8728 16.5254 16.0578 16.005C16.2993 15.3259 16.7797 14.7584 17.4039 14.4018L17.4079 14.3995L17.4079 14.3995Z",fill:"currentColor"})]}));d0.displayName="SubscriptIcon";const f0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.405 1.40657C18.0246 1.05456 18.7463 0.92634 19.4492 1.04344C20.1521 1.16054 20.7933 1.51583 21.2652 2.0497L21.2697 2.05469L21.2696 2.05471C21.7431 2.5975 22 3.28922 22 4.00203C22 5.08579 21.3952 5.84326 20.7727 6.34289C20.1966 6.80531 19.4941 7.13675 18.9941 7.37261C18.9714 7.38332 18.9491 7.39383 18.9273 7.40415C18.4487 7.63034 18.2814 7.78152 18.1927 7.91844C18.1778 7.94155 18.1625 7.96834 18.1473 8.00003H21C21.5523 8.00003 22 8.44774 22 9.00003C22 9.55231 21.5523 10 21 10H17C16.4477 10 16 9.55231 16 9.00003C16 8.17007 16.1183 7.44255 16.5138 6.83161C16.9107 6.21854 17.4934 5.86971 18.0728 5.59591C18.6281 5.33347 19.1376 5.09075 19.5208 4.78316C19.8838 4.49179 20 4.25026 20 4.00203C20 3.77192 19.9178 3.54865 19.7646 3.37182C19.5968 3.18324 19.3696 3.05774 19.1205 3.01625C18.8705 2.97459 18.6137 3.02017 18.3933 3.14533C18.1762 3.26898 18.0191 3.45826 17.9406 3.67557C17.7531 4.19504 17.18 4.46414 16.6605 4.27662C16.141 4.0891 15.8719 3.51596 16.0594 2.99649C16.303 2.3219 16.7817 1.76125 17.4045 1.40689L17.405 1.40657Z",fill:"currentColor"})]}));f0.displayName="SuperscriptIcon";const h0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4V10C5 11.8565 5.7375 13.637 7.05025 14.9497C8.36301 16.2625 10.1435 17 12 17C13.8565 17 15.637 16.2625 16.9497 14.9497C18.2625 13.637 19 11.8565 19 10V4C19 3.44772 18.5523 3 18 3C17.4477 3 17 3.44772 17 4V10C17 11.3261 16.4732 12.5979 15.5355 13.5355C14.5979 14.4732 13.3261 15 12 15C10.6739 15 9.40215 14.4732 8.46447 13.5355C7.52678 12.5979 7 11.3261 7 10V4ZM4 19C3.44772 19 3 19.4477 3 20C3 20.5523 3.44772 21 4 21H20C20.5523 21 21 20.5523 21 20C21 19.4477 20.5523 19 20 19H4Z",fill:"currentColor"})}));h0.displayName="UnderlineIcon";const AE={bold:l0,italic:c0,underline:h0,strike:u0,code:a0,superscript:f0,subscript:d0},p0={bold:"mod+b",italic:"mod+i",underline:"mod+u",strike:"mod+shift+s",code:"mod+e",superscript:"mod+.",subscript:"mod+,"};function Yc(t,e){return!t||!t.isEditable||!ro(e,t)||Ht(t,["image"])?!1:t.can().toggleMark(e)}function RE(t,e){return!t||!t.isEditable?!1:t.isActive(e)}function OE(t,e){return!t||!t.isEditable||!Yc(t,e)?!1:t.chain().focus().toggleMark(e).run()}function NE(t){const{editor:e,type:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!ro(n,e)?!1:r&&!e.isActive("code")?Yc(e,n):!0}function IE(t){return t.charAt(0).toUpperCase()+t.slice(1)}function LE(t){const{editor:e,type:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Yc(i,n),c=RE(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(NE({editor:i,type:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=OE(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleMark:u,canToggle:a,label:IE(n),shortcutKeys:p0[n],Icon:AE[n]}}function DE({align:t,shortcutKeys:e=b0[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Zn=y.forwardRef(({editor:t,align:e,text:n,hideWhenUnavailable:r=!1,onAligned:o,showShortcut:i=!1,onClick:s,icon:l,children:a,...c},u)=>{const{editor:d}=ie(t),{isVisible:f,handleTextAlign:h,label:p,canAlign:m,isActive:v,Icon:b,shortcutKeys:C}=$E({editor:d,align:e,hideWhenUnavailable:r,onAligned:o}),x=y.useCallback(E=>{s?.(E),!E.defaultPrevented&&h()},[h,s]);if(!f)return null;const w=l??b;return g.jsx(fe,{type:"button",disabled:!m,"data-style":"ghost","data-active-state":v?"on":"off","data-disabled":!m,role:"button",tabIndex:-1,"aria-label":p,"aria-pressed":v,tooltip:p,onClick:x,...c,ref:u,children:a??g.jsxs(g.Fragment,{children:[g.jsx(w,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(DE,{align:e,shortcutKeys:C})]})})});Zn.displayName="TextAlignButton";const m0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 18C4 17.4477 4.44772 17 5 17H19C19.5523 17 20 17.4477 20 18C20 18.5523 19.5523 19 19 19H5C4.44772 19 4 18.5523 4 18Z",fill:"currentColor"})]}));m0.displayName="AlignCenterIcon";const g0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));g0.displayName="AlignJustifyIcon";const y0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H15C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H17C17.5523 17 18 17.4477 18 18C18 18.5523 17.5523 19 17 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));y0.displayName="AlignLeftIcon";const v0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 18C6 17.4477 6.44772 17 7 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H7C6.44772 19 6 18.5523 6 18Z",fill:"currentColor"})]}));v0.displayName="AlignRightIcon";const b0={left:"mod+shift+l",center:"mod+shift+e",right:"mod+shift+r",justify:"mod+shift+j"},PE={left:y0,center:m0,right:v0,justify:g0},jE={left:"Align left",center:"Align center",right:"Align right",justify:"Align justify"};function Xc(t,e){return!t||!t.isEditable||!ls(t,"textAlign")||Ht(t,["image"])?!1:t.can().setTextAlign(e)}function BE(t){return"setTextAlign"in t}function _E(t,e){return!t||!t.isEditable?!1:t.isActive({textAlign:e})}function HE(t,e){if(!t||!t.isEditable||!Xc(t,e))return!1;const n=t.chain().focus();return BE(n)?n.setTextAlign(e).run():!1}function FE(t){const{editor:e,hideWhenUnavailable:n,align:r}=t;return!e||!e.isEditable||!ls(e,"textAlign")?!1:n&&!e.isActive("code")?Xc(e,r):!0}function $E(t){const{editor:e,align:n,hideWhenUnavailable:r=!1,onAligned:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Xc(i,n),c=_E(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(FE({editor:i,align:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,r,n]);const u=y.useCallback(()=>{if(!i)return!1;const d=HE(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleTextAlign:u,canAlign:a,label:jE[n],shortcutKeys:b0[n],Icon:PE[n]}}function VE({action:t,shortcutKeys:e=w0[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const _i=y.forwardRef(({editor:t,action:e,text:n,hideWhenUnavailable:r=!1,onExecuted:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,handleAction:f,label:h,canExecute:p,Icon:m,shortcutKeys:v}=qE({editor:u,action:e,hideWhenUnavailable:r,onExecuted:o}),b=y.useCallback(C=>{s?.(C),!C.defaultPrevented&&f()},[f,s]);return d?g.jsx(fe,{type:"button",disabled:!p,"data-style":"ghost","data-disabled":!p,role:"button",tabIndex:-1,"aria-label":h,tooltip:h,onClick:b,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(m,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(VE,{action:e,shortcutKeys:v})]})}):null});_i.displayName="UndoRedoButton";const C0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.7071 2.29289C15.3166 1.90237 14.6834 1.90237 14.2929 2.29289C13.9024 2.68342 13.9024 3.31658 14.2929 3.70711L17.5858 7H9.5C7.77609 7 6.12279 7.68482 4.90381 8.90381C3.68482 10.1228 3 11.7761 3 13.5C3 14.3536 3.16813 15.1988 3.49478 15.9874C3.82144 16.7761 4.30023 17.4926 4.90381 18.0962C6.12279 19.3152 7.77609 20 9.5 20H13C13.5523 20 14 19.5523 14 19C14 18.4477 13.5523 18 13 18H9.5C8.30653 18 7.16193 17.5259 6.31802 16.682C5.90016 16.2641 5.56869 15.768 5.34254 15.2221C5.1164 14.6761 5 14.0909 5 13.5C5 12.3065 5.47411 11.1619 6.31802 10.318C7.16193 9.47411 8.30653 9 9.5 9H17.5858L14.2929 12.2929C13.9024 12.6834 13.9024 13.3166 14.2929 13.7071C14.6834 14.0976 15.3166 14.0976 15.7071 13.7071L20.7071 8.70711C21.0976 8.31658 21.0976 7.68342 20.7071 7.29289L15.7071 2.29289Z",fill:"currentColor"})}));C0.displayName="Redo2Icon";const x0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 3.70711C10.0976 3.31658 10.0976 2.68342 9.70711 2.29289C9.31658 1.90237 8.68342 1.90237 8.29289 2.29289L3.29289 7.29289C2.90237 7.68342 2.90237 8.31658 3.29289 8.70711L8.29289 13.7071C8.68342 14.0976 9.31658 14.0976 9.70711 13.7071C10.0976 13.3166 10.0976 12.6834 9.70711 12.2929L6.41421 9H14.5C15.0909 9 15.6761 9.1164 16.2221 9.34254C16.768 9.56869 17.2641 9.90016 17.682 10.318C18.0998 10.7359 18.4313 11.232 18.6575 11.7779C18.8836 12.3239 19 12.9091 19 13.5C19 14.0909 18.8836 14.6761 18.6575 15.2221C18.4313 15.768 18.0998 16.2641 17.682 16.682C17.2641 17.0998 16.768 17.4313 16.2221 17.6575C15.6761 17.8836 15.0909 18 14.5 18H11C10.4477 18 10 18.4477 10 19C10 19.5523 10.4477 20 11 20H14.5C15.3536 20 16.1988 19.8319 16.9874 19.5052C17.7761 19.1786 18.4926 18.6998 19.0962 18.0962C19.6998 17.4926 20.1786 16.7761 20.5052 15.9874C20.8319 15.1988 21 14.3536 21 13.5C21 12.6464 20.8319 11.8012 20.5052 11.0126C20.1786 10.2239 19.6998 9.50739 19.0962 8.90381C18.4926 8.30022 17.7761 7.82144 16.9874 7.49478C16.1988 7.16813 15.3536 7 14.5 7H6.41421L9.70711 3.70711Z",fill:"currentColor"})}));x0.displayName="Undo2Icon";const w0={undo:"mod+z",redo:"mod+shift+z"},zE={undo:"Undo",redo:"Redo"},UE={undo:x0,redo:C0};function Qc(t,e){return!t||!t.isEditable||Ht(t,["image"])?!1:e==="undo"?t.can().undo():t.can().redo()}function WE(t,e){if(!t||!t.isEditable||!Qc(t,e))return!1;const n=t.chain().focus();return e==="undo"?n.undo().run():n.redo().run()}function KE(t){const{editor:e,hideWhenUnavailable:n,action:r}=t;return!e||!e.isEditable?!1:n&&!e.isActive("code")?Qc(e,r):!0}function qE(t){const{editor:e,action:n,hideWhenUnavailable:r=!1,onExecuted:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Qc(i,n);y.useEffect(()=>{if(!i)return;const u=()=>{l(KE({editor:i,hideWhenUnavailable:r,action:n}))};return u(),i.on("transaction",u),()=>{i.off("transaction",u)}},[i,r,n]);const c=y.useCallback(()=>{if(!i)return!1;const u=WE(i,n);return u&&o?.(),u},[i,n,o]);return{isVisible:s,handleAction:c,canExecute:a,label:zE[n],shortcutKeys:w0[n],Icon:UE[n]}}const S0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M12.7071 5.70711C13.0976 5.31658 13.0976 4.68342 12.7071 4.29289C12.3166 3.90237 11.6834 3.90237 11.2929 4.29289L4.29289 11.2929C3.90237 11.6834 3.90237 12.3166 4.29289 12.7071L11.2929 19.7071C11.6834 20.0976 12.3166 20.0976 12.7071 19.7071C13.0976 19.3166 13.0976 18.6834 12.7071 18.2929L7.41421 13L19 13C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11L7.41421 11L12.7071 5.70711Z",fill:"currentColor"})}));S0.displayName="ArrowLeftIcon";var bl,xf;function GE(){if(xf)return bl;xf=1;var t="Expected a function",e=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt,a=typeof co=="object"&&co&&co.Object===Object&&co,c=typeof self=="object"&&self&&self.Object===Object&&self,u=a||c||Function("return this")(),d=Object.prototype,f=d.toString,h=Math.max,p=Math.min,m=function(){return u.Date.now()};function v(k,S,M){var N,P,z,U,H,I,_=0,F=!1,L=!1,T=!0;if(typeof k!="function")throw new TypeError(t);S=E(S)||0,C(M)&&(F=!!M.leading,L="maxWait"in M,z=L?h(E(M.maxWait)||0,S):z,T="trailing"in M?!!M.trailing:T);function R(te){var Ke=N,bt=P;return N=P=void 0,_=te,U=k.apply(bt,Ke),U}function W(te){return _=te,H=setTimeout(Z,S),F?R(te):U}function ee(te){var Ke=te-I,bt=te-_,Bn=S-Ke;return L?p(Bn,z-bt):Bn}function K(te){var Ke=te-I,bt=te-_;return I===void 0||Ke>=S||Ke<0||L&&bt>=z}function Z(){var te=m();if(K(te))return We(te);H=setTimeout(Z,ee(te))}function We(te){return H=void 0,T&&N?R(te):(N=P=void 0,U)}function le(){H!==void 0&&clearTimeout(H),_=0,N=I=P=H=void 0}function ge(){return H===void 0?U:We(m())}function Y(){var te=m(),Ke=K(te);if(N=arguments,P=this,I=te,Ke){if(H===void 0)return W(I);if(L)return H=setTimeout(Z,S),R(I)}return H===void 0&&(H=setTimeout(Z,S)),U}return Y.cancel=le,Y.flush=ge,Y}function b(k,S,M){var N=!0,P=!0;if(typeof k!="function")throw new TypeError(t);return C(M)&&(N="leading"in M?!!M.leading:N,P="trailing"in M?!!M.trailing:P),v(k,S,{leading:N,maxWait:S,trailing:P})}function C(k){var S=typeof k;return!!k&&(S=="object"||S=="function")}function x(k){return!!k&&typeof k=="object"}function w(k){return typeof k=="symbol"||x(k)&&f.call(k)==n}function E(k){if(typeof k=="number")return k;if(w(k))return e;if(C(k)){var S=typeof k.valueOf=="function"?k.valueOf():k;k=C(S)?S+"":S}if(typeof k!="string")return k===0?k:+k;k=k.replace(r,"");var M=i.test(k);return M||s.test(k)?l(k.slice(2),M?2:8):o.test(k)?e:+k}return bl=b,bl}var JE=GE();const ZE=Sf(JE),YE=t=>{const e=j.useRef(t);e.current=t,j.useEffect(()=>()=>{e.current()},[])},XE={leading:!1,trailing:!0};function k0(t,e=250,n=[],r=XE){const o=y.useMemo(()=>ZE(t,e,r),n);return YE(()=>{o.cancel()}),o}function eu(){const[t,e]=y.useState({width:0,height:0,offsetTop:0,offsetLeft:0,scale:0}),n=k0(()=>{if(typeof window>"u")return;const r=window.visualViewport;if(!r)return;const{width:o=0,height:i=0,offsetTop:s=0,offsetLeft:l=0,scale:a=0}=r;e(c=>o===c.width&&i===c.height&&s===c.offsetTop&&l===c.offsetLeft&&a===c.scale?c:{width:o,height:i,offsetTop:s,offsetLeft:l,scale:a})},200);return y.useEffect(()=>{const r=window.visualViewport;if(r)return r.addEventListener("resize",n),n(),()=>{r.removeEventListener("resize",n)}},[n]),t}const Io={x:0,y:0,width:0,height:0,top:0,right:0,bottom:0,left:0},E0=typeof window>"u",QE=!E0&&typeof ResizeObserver<"u",Vo=()=>!E0;function eM({element:t,enabled:e=!0,throttleMs:n=100,useResizeObserver:r=!0}={}){const[o,i]=y.useState(Io),s=y.useCallback(()=>!e||!Vo()?null:t?typeof t=="string"?document.querySelector(t):"current"in t?t.current:t:document.body,[t,e]),l=k0(()=>{if(!e||!Vo())return;const a=s();if(!a){i(Io);return}const c=a.getBoundingClientRect();i({x:c.x,y:c.y,width:c.width,height:c.height,top:c.top,right:c.right,bottom:c.bottom,left:c.left})},n,[e,s],{leading:!0,trailing:!0});return y.useEffect(()=>{if(!e||!Vo()){i(Io);return}const a=s();if(!a)return;l();const c=[];if(r&&QE){const d=new ResizeObserver(()=>{window.requestAnimationFrame(l)});d.observe(a),c.push(()=>d.disconnect())}const u=()=>l();return window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u,{passive:!0}),c.push(()=>{window.removeEventListener("scroll",u),window.removeEventListener("resize",u)}),()=>{c.forEach(d=>d()),i(Io)}},[e,s,l,r]),o}function tM(t={}){return eM({...t,element:Vo()?document.body:null})}function nM({editor:t,overlayHeight:e=0}){const{height:n}=eu(),r=tM({enabled:!0,throttleMs:100,useResizeObserver:!0});return y.useEffect(()=>{(()=>{if(!t)return;const{state:i,view:s}=t;if(!s.hasFocus())return;const{from:l}=i.selection,a=s.coordsAtPos(l);if(n<r.height&&a&&n-a.top<e){const u=Math.max(n/2,e),d=window.scrollY,h=a.top+d-u;window.scrollTo({top:Math.max(0,h),behavior:"smooth"})}})()},[t,e,n,r.height]),r}const rM=({onHighlighterClick:t,onLinkClick:e,isMobile:n})=>g.jsxs(g.Fragment,{children:[g.jsx(rf,{}),g.jsxs(Mt,{children:[g.jsx(_i,{action:"undo"}),g.jsx(_i,{action:"redo"})]}),g.jsx(Tt,{}),g.jsxs(Mt,{children:[g.jsx(Pc,{levels:[1,2,3,4],portal:n}),g.jsx(Ng,{types:["bulletList","orderedList","taskList"],portal:n}),g.jsx(Vc,{}),g.jsx(Uc,{})]}),g.jsx(Tt,{}),g.jsxs(Mt,{children:[g.jsx(Et,{type:"bold"}),g.jsx(Et,{type:"italic"}),g.jsx(Et,{type:"strike"}),g.jsx(Et,{type:"code"}),g.jsx(Et,{type:"underline"}),n?g.jsx(Jc,{onClick:t}):g.jsx(CE,{}),n?g.jsx(Zc,{onClick:e}):g.jsx(r0,{})]}),g.jsx(Tt,{}),g.jsxs(Mt,{children:[g.jsx(Et,{type:"superscript"}),g.jsx(Et,{type:"subscript"})]}),g.jsx(Tt,{}),g.jsxs(Mt,{children:[g.jsx(Zn,{align:"left"}),g.jsx(Zn,{align:"center"}),g.jsx(Zn,{align:"right"}),g.jsx(Zn,{align:"justify"})]}),g.jsx(Tt,{}),g.jsx(Mt,{children:g.jsx(jc,{text:"Add"})}),g.jsx(rf,{}),n&&g.jsx(Tt,{})]}),oM=({type:t,onBack:e})=>g.jsxs(g.Fragment,{children:[g.jsx(Mt,{children:g.jsxs(fe,{"data-style":"ghost",onClick:e,children:[g.jsx(S0,{className:"tiptap-button-icon"}),t==="highlighter"?g.jsx(ys,{className:"tiptap-button-icon"}):g.jsx(bs,{className:"tiptap-button-icon"})]})}),g.jsx(Tt,{}),t==="highlighter"?g.jsx(Xg,{}):g.jsx(SE,{})]});function iM(t){const e=hr(),{height:n}=eu(),[r,o]=j.useState("main"),i=j.useRef(null),s=WC({content:t.value,immediatelyRender:!1,shouldRerenderOnTransaction:!1,onUpdate:({editor:a})=>{a&&t.onChange(a.getHTML())},editorProps:{attributes:{autocomplete:"off",autocorrect:"off",autocapitalize:"off","aria-label":"Main content area, start typing to enter text.",class:"simple-editor"}},extensions:[s3,r3.configure({type:"resizableImage",accept:"image/*",maxSize:1*1024*1024*1024,upload:(a,c,u)=>Promise.resolve(t.onUploadImage?.(a,c,u)||"")}),cm,am,Bw.configure({horizontalRule:!1,link:{openOnClick:!1,enableClickSelection:!0}}),o3,_w.configure({types:["heading","paragraph","resizableImage"]}),em,Qp.configure({nested:!0}),u7.configure({multicolor:!0}),l7,f7,d7,Dw,x7.configure({attributeName:"id",generateID:()=>`tiptap-editor-${t.id||ox()}`})]}),l=nM({editor:s,overlayHeight:i.current?.getBoundingClientRect().height??0});return j.useEffect(()=>{!e&&r!=="main"&&o("main")},[e,r]),j.useEffect(()=>()=>{s&&s.commands.clearContent()},[s]),g.jsx("div",{className:"simple-editor-wrapper",children:g.jsxs(qa.Provider,{value:{editor:s},children:[g.jsx(pc,{ref:i,style:{...e?{bottom:`calc(100% - ${n-l.y}px)`}:{}},children:r==="main"?g.jsx(rM,{onHighlighterClick:()=>o("highlighter"),onLinkClick:()=>o("link"),isMobile:e}):g.jsx(oM,{type:r==="highlighter"?"highlighter":"link",onBack:()=>o("main")})}),g.jsx(FC,{editor:s,className:"simple-editor-content"})]})})}exports.BlockquoteButton=Vc;exports.Button=fe;exports.Card=fr;exports.CodeBlockButton=Uc;exports.HeadingDropdownMenu=Pc;exports.ImageUploadButton=jc;exports.ListDropdownMenu=Ng;exports.MAX_FILE_SIZE=la;exports.MarkButton=Et;exports.TextAlignButton=Zn;exports.TiptapEditor=iM;exports.Toolbar=pc;exports.ToolbarGroup=Mt;exports.ToolbarSeparator=Tt;exports.UndoRedoButton=_i;exports.onUploadImage=z5;exports.useIsMobile=hr;exports.useTiptapEditor=ie;exports.useWindowSize=eu;
213
+ `)},US=0,zn=[];function WS(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),o=y.useState(US++)[0],i=y.useState(N1)[0],s=y.useRef(t);y.useEffect(function(){s.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=fS([t.lockRef.current],(t.shards||[]).map(vf),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var l=y.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var b=No(m),C=n.current,x="deltaX"in m?m.deltaX:C[0]-b[0],w="deltaY"in m?m.deltaY:C[1]-b[1],E,k=m.target,S=Math.abs(x)>Math.abs(w)?"h":"v";if("touches"in m&&S==="h"&&k.type==="range")return!1;var M=gf(S,k);if(!M)return!0;if(M?E=S:(E=S==="v"?"h":"v",M=gf(S,k)),!M)return!1;if(!r.current&&"changedTouches"in m&&(x||w)&&(r.current=E),!E)return!0;var N=r.current||E;return $S(N,v,m,N==="h"?x:w)},[]),a=y.useCallback(function(m){var v=m;if(!(!zn.length||zn[zn.length-1]!==i)){var b="deltaY"in v?yf(v):No(v),C=e.current.filter(function(E){return E.name===v.type&&(E.target===v.target||v.target===E.shadowParent)&&VS(E.delta,b)})[0];if(C&&C.should){v.cancelable&&v.preventDefault();return}if(!C){var x=(s.current.shards||[]).map(vf).filter(Boolean).filter(function(E){return E.contains(v.target)}),w=x.length>0?l(v,x[0]):!s.current.noIsolation;w&&v.cancelable&&v.preventDefault()}}},[]),c=y.useCallback(function(m,v,b,C){var x={name:m,delta:v,target:b,should:C,shadowParent:KS(b)};e.current.push(x),setTimeout(function(){e.current=e.current.filter(function(w){return w!==x})},1)},[]),u=y.useCallback(function(m){n.current=No(m),r.current=void 0},[]),d=y.useCallback(function(m){c(m.type,yf(m),m.target,l(m,t.lockRef.current))},[]),f=y.useCallback(function(m){c(m.type,No(m),m.target,l(m,t.lockRef.current))},[]);y.useEffect(function(){return zn.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,Vn),document.addEventListener("touchmove",a,Vn),document.addEventListener("touchstart",u,Vn),function(){zn=zn.filter(function(m){return m!==i}),document.removeEventListener("wheel",a,Vn),document.removeEventListener("touchmove",a,Vn),document.removeEventListener("touchstart",u,Vn)}},[]);var h=t.removeScrollBar,p=t.inert;return y.createElement(y.Fragment,null,p?y.createElement(i,{styles:zS(o)}):null,h?y.createElement(DS,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function KS(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const qS=xS(O1,WS);var kc=y.forwardRef(function(t,e){return y.createElement(ds,ct({},t,{ref:e,sideCar:qS}))});kc.classNames=ds.classNames;var da=["Enter"," "],GS=["ArrowDown","PageUp","Home"],P1=["ArrowUp","PageDown","End"],JS=[...GS,...P1],ZS={ltr:[...da,"ArrowRight"],rtl:[...da,"ArrowLeft"]},YS={ltr:["ArrowLeft"],rtl:["ArrowRight"]},io="Menu",[Gr,XS,QS]=t1(io),[Pn,j1]=dr(io,[QS,us,x1]),fs=us(),B1=x1(),[ek,jn]=Pn(io),[tk,so]=Pn(io),_1=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=t,l=fs(e),[a,c]=y.useState(null),u=y.useRef(!1),d=Lt(i),f=n1(o);return y.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),g.jsx(y1,{...l,children:g.jsx(ek,{scope:e,open:n,onOpenChange:d,content:a,onContentChange:c,children:g.jsx(tk,{scope:e,onClose:y.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:s,children:r})})})};_1.displayName=io;var nk="MenuAnchor",Ec=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=fs(n);return g.jsx(wc,{...o,...r,ref:e})});Ec.displayName=nk;var Mc="MenuPortal",[rk,H1]=Pn(Mc,{forceMount:void 0}),F1=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:o}=t,i=jn(Mc,e);return g.jsx(rk,{scope:e,forceMount:n,children:g.jsx(Dn,{present:n||i.open,children:g.jsx(Sc,{asChild:!0,container:o,children:r})})})};F1.displayName=Mc;var et="MenuContent",[ok,Tc]=Pn(et),$1=y.forwardRef((t,e)=>{const n=H1(et,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=jn(et,t.__scopeMenu),s=so(et,t.__scopeMenu);return g.jsx(Gr.Provider,{scope:t.__scopeMenu,children:g.jsx(Dn,{present:r||i.open,children:g.jsx(Gr.Slot,{scope:t.__scopeMenu,children:s.modal?g.jsx(ik,{...o,ref:e}):g.jsx(sk,{...o,ref:e})})})})}),ik=y.forwardRef((t,e)=>{const n=jn(et,t.__scopeMenu),r=y.useRef(null),o=Oe(e,r);return y.useEffect(()=>{const i=r.current;if(i)return T1(i)},[]),g.jsx(Ac,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),sk=y.forwardRef((t,e)=>{const n=jn(et,t.__scopeMenu);return g.jsx(Ac,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),lk=qr("MenuContent.ScrollLock"),Ac=y.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEntryFocus:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,disableOutsideScroll:p,...m}=t,v=jn(et,n),b=so(et,n),C=fs(n),x=B1(n),w=XS(n),[E,k]=y.useState(null),S=y.useRef(null),M=Oe(e,S,v.onContentChange),N=y.useRef(0),P=y.useRef(""),z=y.useRef(0),U=y.useRef(null),H=y.useRef("right"),I=y.useRef(0),_=p?kc:y.Fragment,F=p?{as:lk,allowPinchZoom:!0}:void 0,L=R=>{const W=P.current+R,ee=w().filter(Y=>!Y.disabled),K=document.activeElement,Z=ee.find(Y=>Y.ref.current===K)?.textValue,We=ee.map(Y=>Y.textValue),le=bk(We,W,Z),ge=ee.find(Y=>Y.textValue===le)?.ref.current;(function Y(te){P.current=te,window.clearTimeout(N.current),te!==""&&(N.current=window.setTimeout(()=>Y(""),1e3))})(W),ge&&setTimeout(()=>ge.focus())};y.useEffect(()=>()=>window.clearTimeout(N.current),[]),i1();const T=y.useCallback(R=>H.current===U.current?.side&&xk(R,U.current?.area),[]);return g.jsx(ok,{scope:n,searchRef:P,onItemEnter:y.useCallback(R=>{T(R)&&R.preventDefault()},[T]),onItemLeave:y.useCallback(R=>{T(R)||(S.current?.focus(),k(null))},[T]),onTriggerLeave:y.useCallback(R=>{T(R)&&R.preventDefault()},[T]),pointerGraceTimerRef:z,onPointerGraceIntentChange:y.useCallback(R=>{U.current=R},[]),children:g.jsx(_,{...F,children:g.jsx(bc,{asChild:!0,trapped:o,onMountAutoFocus:J(i,R=>{R.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:g.jsx(vc,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,children:g.jsx(lS,{asChild:!0,...x,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:k,onEntryFocus:J(a,R=>{b.isUsingKeyboardRef.current||R.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(v1,{role:"menu","aria-orientation":"vertical","data-state":rg(v.open),"data-radix-menu-content":"",dir:b.dir,...C,...m,ref:M,style:{outline:"none",...m.style},onKeyDown:J(m.onKeyDown,R=>{const ee=R.target.closest("[data-radix-menu-content]")===R.currentTarget,K=R.ctrlKey||R.altKey||R.metaKey,Z=R.key.length===1;ee&&(R.key==="Tab"&&R.preventDefault(),!K&&Z&&L(R.key));const We=S.current;if(R.target!==We||!JS.includes(R.key))return;R.preventDefault();const ge=w().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);P1.includes(R.key)&&ge.reverse(),yk(ge)}),onBlur:J(t.onBlur,R=>{R.currentTarget.contains(R.target)||(window.clearTimeout(N.current),P.current="")}),onPointerMove:J(t.onPointerMove,Jr(R=>{const W=R.target,ee=I.current!==R.clientX;if(R.currentTarget.contains(W)&&ee){const K=R.clientX>I.current?"right":"left";H.current=K,I.current=R.clientX}}))})})})})})})});$1.displayName=et;var ak="MenuGroup",Rc=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Te.div,{role:"group",...r,ref:e})});Rc.displayName=ak;var ck="MenuLabel",V1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Te.div,{...r,ref:e})});V1.displayName=ck;var ji="MenuItem",bf="menu.itemSelect",hs=y.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...o}=t,i=y.useRef(null),s=so(ji,t.__scopeMenu),l=Tc(ji,t.__scopeMenu),a=Oe(e,i),c=y.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const f=new CustomEvent(bf,{bubbles:!0,cancelable:!0});d.addEventListener(bf,h=>r?.(h),{once:!0}),e1(d,f),f.defaultPrevented?c.current=!1:s.onClose()}};return g.jsx(z1,{...o,ref:a,disabled:n,onClick:J(t.onClick,u),onPointerDown:d=>{t.onPointerDown?.(d),c.current=!0},onPointerUp:J(t.onPointerUp,d=>{c.current||d.currentTarget?.click()}),onKeyDown:J(t.onKeyDown,d=>{const f=l.searchRef.current!=="";n||f&&d.key===" "||da.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});hs.displayName=ji;var z1=y.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=t,s=Tc(ji,n),l=B1(n),a=y.useRef(null),c=Oe(e,a),[u,d]=y.useState(!1),[f,h]=y.useState("");return y.useEffect(()=>{const p=a.current;p&&h((p.textContent??"").trim())},[i.children]),g.jsx(Gr.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:g.jsx(aS,{asChild:!0,...l,focusable:!r,children:g.jsx(Te.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:J(t.onPointerMove,Jr(p=>{r?s.onItemLeave(p):(s.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:J(t.onPointerLeave,Jr(p=>s.onItemLeave(p))),onFocus:J(t.onFocus,()=>d(!0)),onBlur:J(t.onBlur,()=>d(!1))})})})}),uk="MenuCheckboxItem",U1=y.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...o}=t;return g.jsx(J1,{scope:t.__scopeMenu,checked:n,children:g.jsx(hs,{role:"menuitemcheckbox","aria-checked":Bi(n)?"mixed":n,...o,ref:e,"data-state":Nc(n),onSelect:J(o.onSelect,()=>r?.(Bi(n)?!0:!n),{checkForDefaultPrevented:!1})})})});U1.displayName=uk;var W1="MenuRadioGroup",[dk,fk]=Pn(W1,{value:void 0,onValueChange:()=>{}}),K1=y.forwardRef((t,e)=>{const{value:n,onValueChange:r,...o}=t,i=Lt(r);return g.jsx(dk,{scope:t.__scopeMenu,value:n,onValueChange:i,children:g.jsx(Rc,{...o,ref:e})})});K1.displayName=W1;var q1="MenuRadioItem",G1=y.forwardRef((t,e)=>{const{value:n,...r}=t,o=fk(q1,t.__scopeMenu),i=n===o.value;return g.jsx(J1,{scope:t.__scopeMenu,checked:i,children:g.jsx(hs,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":Nc(i),onSelect:J(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});G1.displayName=q1;var Oc="MenuItemIndicator",[J1,hk]=Pn(Oc,{checked:!1}),Z1=y.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...o}=t,i=hk(Oc,n);return g.jsx(Dn,{present:r||Bi(i.checked)||i.checked===!0,children:g.jsx(Te.span,{...o,ref:e,"data-state":Nc(i.checked)})})});Z1.displayName=Oc;var pk="MenuSeparator",Y1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return g.jsx(Te.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});Y1.displayName=pk;var mk="MenuArrow",X1=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=fs(n);return g.jsx(b1,{...o,...r,ref:e})});X1.displayName=mk;var gk="MenuSub",[lM,Q1]=Pn(gk),Cr="MenuSubTrigger",eg=y.forwardRef((t,e)=>{const n=jn(Cr,t.__scopeMenu),r=so(Cr,t.__scopeMenu),o=Q1(Cr,t.__scopeMenu),i=Tc(Cr,t.__scopeMenu),s=y.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:a}=i,c={__scopeMenu:t.__scopeMenu},u=y.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return y.useEffect(()=>u,[u]),y.useEffect(()=>{const d=l.current;return()=>{window.clearTimeout(d),a(null)}},[l,a]),g.jsx(Ec,{asChild:!0,...c,children:g.jsx(z1,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":rg(n.open),...t,ref:cs(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:J(t.onPointerMove,Jr(d=>{i.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:J(t.onPointerLeave,Jr(d=>{u();const f=n.content?.getBoundingClientRect();if(f){const h=n.content?.dataset.side,p=h==="right",m=p?-5:5,v=f[p?"left":"right"],b=f[p?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+m,y:d.clientY},{x:v,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:v,y:f.bottom}],side:h}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:J(t.onKeyDown,d=>{const f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||ZS[r.dir].includes(d.key)&&(n.onOpenChange(!0),n.content?.focus(),d.preventDefault())})})})});eg.displayName=Cr;var tg="MenuSubContent",ng=y.forwardRef((t,e)=>{const n=H1(et,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=jn(et,t.__scopeMenu),s=so(et,t.__scopeMenu),l=Q1(tg,t.__scopeMenu),a=y.useRef(null),c=Oe(e,a);return g.jsx(Gr.Provider,{scope:t.__scopeMenu,children:g.jsx(Dn,{present:r||i.open,children:g.jsx(Gr.Slot,{scope:t.__scopeMenu,children:g.jsx(Ac,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{s.isUsingKeyboardRef.current&&a.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:J(t.onFocusOutside,u=>{u.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:J(t.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:J(t.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),f=YS[s.dir].includes(u.key);d&&f&&(i.onOpenChange(!1),l.trigger?.focus(),u.preventDefault())})})})})})});ng.displayName=tg;function rg(t){return t?"open":"closed"}function Bi(t){return t==="indeterminate"}function Nc(t){return Bi(t)?"indeterminate":t?"checked":"unchecked"}function yk(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function vk(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function bk(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let s=vk(t,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const a=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return a!==n?a:void 0}function Ck(t,e){const{x:n,y:r}=t;let o=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){const l=e[i],a=e[s],c=l.x,u=l.y,d=a.x,f=a.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(o=!o)}return o}function xk(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Ck(n,e)}function Jr(t){return e=>e.pointerType==="mouse"?t(e):void 0}var wk=_1,Sk=Ec,kk=F1,Ek=$1,Mk=Rc,Tk=V1,Ak=hs,Rk=U1,Ok=K1,Nk=G1,Ik=Z1,Lk=Y1,Dk=X1,Pk=eg,jk=ng,ps="DropdownMenu",[Bk]=dr(ps,[j1]),Be=j1(),[_k,og]=Bk(ps),ig=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:l=!0}=t,a=Be(e),c=y.useRef(null),[u,d]=yc({prop:o,defaultProp:i??!1,onChange:s,caller:ps});return g.jsx(_k,{scope:e,triggerId:Pi(),triggerRef:c,contentId:Pi(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(f=>!f),[d]),modal:l,children:g.jsx(wk,{...a,open:u,onOpenChange:d,dir:r,modal:l,children:n})})};ig.displayName=ps;var sg="DropdownMenuTrigger",lg=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=t,i=og(sg,n),s=Be(n);return g.jsx(Sk,{asChild:!0,...s,children:g.jsx(Te.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:cs(e,i.triggerRef),onPointerDown:J(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:J(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});lg.displayName=sg;var Hk="DropdownMenuPortal",ag=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Be(e);return g.jsx(kk,{...r,...n})};ag.displayName=Hk;var cg="DropdownMenuContent",ug=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=og(cg,n),i=Be(n),s=y.useRef(!1);return g.jsx(Ek,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:e,onCloseAutoFocus:J(t.onCloseAutoFocus,l=>{s.current||o.triggerRef.current?.focus(),s.current=!1,l.preventDefault()}),onInteractOutside:J(t.onInteractOutside,l=>{const a=l.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0,u=a.button===2||c;(!o.modal||u)&&(s.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ug.displayName=cg;var Fk="DropdownMenuGroup",$k=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Mk,{...o,...r,ref:e})});$k.displayName=Fk;var Vk="DropdownMenuLabel",zk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Tk,{...o,...r,ref:e})});zk.displayName=Vk;var Uk="DropdownMenuItem",dg=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Ak,{...o,...r,ref:e})});dg.displayName=Uk;var Wk="DropdownMenuCheckboxItem",Kk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Rk,{...o,...r,ref:e})});Kk.displayName=Wk;var qk="DropdownMenuRadioGroup",Gk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Ok,{...o,...r,ref:e})});Gk.displayName=qk;var Jk="DropdownMenuRadioItem",Zk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Nk,{...o,...r,ref:e})});Zk.displayName=Jk;var Yk="DropdownMenuItemIndicator",Xk=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Ik,{...o,...r,ref:e})});Xk.displayName=Yk;var Qk="DropdownMenuSeparator",e9=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Lk,{...o,...r,ref:e})});e9.displayName=Qk;var t9="DropdownMenuArrow",n9=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Dk,{...o,...r,ref:e})});n9.displayName=t9;var r9="DropdownMenuSubTrigger",o9=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(Pk,{...o,...r,ref:e})});o9.displayName=r9;var i9="DropdownMenuSubContent",fg=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Be(n);return g.jsx(jk,{...o,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});fg.displayName=i9;var s9=ig,hg=lg,l9=ag,pg=ug,a9=dg,mg=fg;function gg({...t}){return g.jsx(s9,{modal:!1,...t})}function yg({...t}){return g.jsx(l9,{...t})}const Ic=y.forwardRef(({...t},e)=>g.jsx(hg,{ref:e,...t}));Ic.displayName=hg.displayName;const vg=a9,c9=y.forwardRef(({className:t,portal:e=!0,...n},r)=>{const o=g.jsx(mg,{ref:r,className:Me("tiptap-dropdown-menu",t),...n});return e?g.jsx(yg,{...typeof e=="object"?e:{},children:o}):o});c9.displayName=mg.displayName;const Lc=y.forwardRef(({className:t,sideOffset:e=4,portal:n=!1,...r},o)=>{const i=g.jsx(pg,{ref:o,sideOffset:e,onCloseAutoFocus:s=>s.preventDefault(),className:Me("tiptap-dropdown-menu",t),...r});return n?g.jsx(yg,{...typeof n=="object"?n:{},children:i}):i});Lc.displayName=pg.displayName;const fr=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card",t),...e}));fr.displayName="Card";const u9=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-header",t),...e}));u9.displayName="CardHeader";const lo=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-body",t),...e}));lo.displayName="CardBody";const Dc=y.forwardRef(({className:t,orientation:e="vertical",...n},r)=>g.jsx("div",{ref:r,"data-orientation":e,className:Me("tiptap-card-item-group",t),...n}));Dc.displayName="CardItemGroup";const d9=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-group-label",t),...e}));d9.displayName="CardGroupLabel";const f9=y.forwardRef(({className:t,...e},n)=>g.jsx("div",{ref:n,className:Me("tiptap-card-footer",t),...e}));f9.displayName="CardFooter";const Pc=y.forwardRef(({editor:t,levels:e=[1,2,3,4,5,6],hideWhenUnavailable:n=!1,portal:r=!1,onOpenChange:o,...i},s)=>{const{editor:l}=ie(t),[a,c]=y.useState(!1),{isVisible:u,isActive:d,canToggle:f,Icon:h}=p9({editor:l,levels:e,hideWhenUnavailable:n}),p=y.useCallback(m=>{!l||!f||(c(m),o?.(m))},[f,l,o]);return u?g.jsxs(gg,{modal:!0,open:a,onOpenChange:p,children:[g.jsx(Ic,{asChild:!0,children:g.jsxs(fe,{type:"button","data-style":"ghost","data-active-state":d?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":"Format text as heading","aria-pressed":d,tooltip:"Heading",...i,ref:s,children:[g.jsx(h,{className:"tiptap-button-icon"}),g.jsx(mc,{className:"tiptap-button-dropdown-small"})]})}),g.jsx(Lc,{align:"start",portal:r,children:g.jsx(fr,{children:g.jsx(lo,{children:g.jsx(In,{children:e.map(m=>g.jsx(vg,{asChild:!0,children:g.jsx(Um,{editor:l,level:m,text:`Heading ${m}`,showTooltip:!1})},`heading-${m}`))})})})})]}):null});Pc.displayName="HeadingDropdownMenu";const bg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M6 3C6.55228 3 7 3.44772 7 4V11H17V4C17 3.44772 17.4477 3 18 3C18.5523 3 19 3.44772 19 4V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V13H7V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V4C5 3.44772 5.44772 3 6 3Z",fill:"currentColor"})}));bg.displayName="HeadingIcon";function h9(t,e=[1,2,3,4,5,6]){if(!(!t||!t.isEditable))return e.find(n=>gc(t,n))}function p9(t){const{editor:e,levels:n=[1,2,3,4,5,6],hideWhenUnavailable:r=!1}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!0),l=h9(o,n),a=gc(o),c=Kr(o);return y.useEffect(()=>{if(!o)return;const u=()=>{s(Qm({editor:o,hideWhenUnavailable:r,level:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,r,n]),{isVisible:i,activeLevel:l,isActive:a,canToggle:c,levels:n,label:"Heading",Icon:l?Ym[l]:bg}}function m9({shortcutKeys:t=fa}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const jc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onInserted:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),{isVisible:u,canInsert:d,handleImage:f,label:h,isActive:p,shortcutKeys:m,Icon:v}=D9({editor:c,hideWhenUnavailable:n,onInserted:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&f()},[f,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":p?"on":"off",role:"button",tabIndex:-1,disabled:!d,"data-disabled":!d,"aria-label":h,"aria-pressed":p,tooltip:h,onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(m9,{shortcutKeys:m})]})}):null});jc.displayName="ImageUploadButton";const Cg=["shift","alt","meta","mod","ctrl","control"],g9={esc:"escape",return:"enter",left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function rn(t){return(g9[t.trim()]||t.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function xg(t){return Cg.includes(t)}function yl(t,e=","){return t.toLowerCase().split(e)}function vl(t,e="+",n=">",r=!1,o){let i=[],s=!1;t=t.trim(),t.includes(n)?(s=!0,i=t.toLocaleLowerCase().split(n).map(c=>rn(c))):i=t.toLocaleLowerCase().split(e).map(c=>rn(c));const l={alt:i.includes("alt"),ctrl:i.includes("ctrl")||i.includes("control"),shift:i.includes("shift"),meta:i.includes("meta"),mod:i.includes("mod"),useKey:r},a=i.filter(c=>!Cg.includes(c));return{...l,keys:a,description:o,isSequence:s,hotkey:t}}typeof document<"u"&&(document.addEventListener("keydown",t=>{t.code!==void 0&&wg([rn(t.code)])}),document.addEventListener("keyup",t=>{t.code!==void 0&&Sg([rn(t.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{Mt.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{Mt.clear()},0)}));const Mt=new Set;function Bc(t){return Array.isArray(t)}function y9(t,e=","){return(Bc(t)?t:t.split(e)).every(n=>Mt.has(n.trim().toLowerCase()))}function wg(t){const e=Array.isArray(t)?t:[t];Mt.has("meta")&&Mt.forEach(n=>!xg(n)&&Mt.delete(n.toLowerCase())),e.forEach(n=>Mt.add(n.toLowerCase()))}function Sg(t){const e=Array.isArray(t)?t:[t];t==="meta"?Mt.clear():e.forEach(n=>Mt.delete(n.toLowerCase()))}function v9(t,e,n){(typeof n=="function"&&n(t,e)||n===!0)&&t.preventDefault()}function b9(t,e,n){return typeof n=="function"?n(t,e):n===!0||n===void 0}const C9=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function x9(t){return kg(t,C9)}function kg(t,e=!1){const{target:n,composed:r}=t;let o,i;return w9(n)&&r?(o=t.composedPath()[0]&&t.composedPath()[0].tagName,i=t.composedPath()[0]&&t.composedPath()[0].role):(o=n&&n.tagName,i=n&&n.role),Bc(e)?!!(o&&e&&e.some(s=>s.toLowerCase()===o.toLowerCase()||s===i)):!!(o&&e&&e)}function w9(t){return!!t.tagName&&!t.tagName.startsWith("-")&&t.tagName.includes("-")}function S9(t,e){return t.length===0&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):e?t.some(n=>e.includes(n))||t.includes("*"):!0}const k9=(t,e,n=!1)=>{const{alt:r,meta:o,mod:i,shift:s,ctrl:l,keys:a,useKey:c}=e,{code:u,key:d,ctrlKey:f,metaKey:h,shiftKey:p,altKey:m}=t,v=rn(u);if(c&&a?.length===1&&a.includes(d))return!0;if(!a?.includes(v)&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(v))return!1;if(!n){if(r!==m&&v!=="alt"||s!==p&&v!=="shift")return!1;if(i){if(!h&&!f)return!1}else if(o!==h&&v!=="meta"&&v!=="os"||l!==f&&v!=="ctrl"&&v!=="control")return!1}return a&&a.length===1&&a.includes(v)?!0:a?y9(a):!a},E9=j.createContext(void 0),M9=()=>j.useContext(E9);function Eg(t,e){return t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(t).length===Object.keys(e).length&&Object.keys(t).reduce((n,r)=>n&&Eg(t[r],e[r]),!0):t===e}const T9=j.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),A9=()=>j.useContext(T9);function R9(t){const e=j.useRef(void 0);return Eg(e.current,t)||(e.current=t),e.current}const Cf=t=>{t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},O9=typeof window<"u"?j.useLayoutEffect:j.useEffect;function Mg(t,e,n,r){const o=j.useRef(null),i=j.useRef(!1),s=Array.isArray(n)?Array.isArray(r)?void 0:r:n,l=Bc(t)?t.join(s?.delimiter):t,a=Array.isArray(n)?n:Array.isArray(r)?r:void 0,c=j.useCallback(e,a??[]),u=j.useRef(c);a?u.current=c:u.current=e;const d=R9(s),{activeScopes:f}=A9(),h=M9();return O9(()=>{if(d?.enabled===!1||!S9(f,d?.scopes))return;let p=[],m;const v=(w,E=!1)=>{if(!(x9(w)&&!kg(w,d?.enableOnFormTags))){if(o.current!==null){const k=o.current.getRootNode();if((k instanceof Document||k instanceof ShadowRoot)&&k.activeElement!==o.current&&!o.current.contains(k.activeElement)){Cf(w);return}}w.target?.isContentEditable&&!d?.enableOnContentEditable||yl(l,d?.delimiter).forEach(k=>{if(k.includes(d?.splitKey??"+")&&k.includes(d?.sequenceSplitKey??">")){console.warn(`Hotkey ${k} contains both ${d?.splitKey??"+"} and ${d?.sequenceSplitKey??">"} which is not supported.`);return}const S=vl(k,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description);if(S.isSequence){m=setTimeout(()=>{p=[]},d?.sequenceTimeoutMs??1e3);const M=S.useKey?w.key:rn(w.code);if(xg(M.toLowerCase()))return;p.push(M);const N=S.keys?.[p.length-1];if(M!==N){p=[],m&&clearTimeout(m);return}p.length===S.keys?.length&&(u.current(w,S),m&&clearTimeout(m),p=[])}else if(k9(w,S,d?.ignoreModifiers)||S.keys?.includes("*")){if(d?.ignoreEventWhen?.(w)||E&&i.current)return;if(v9(w,S,d?.preventDefault),!b9(w,S,d?.enabled)){Cf(w);return}u.current(w,S),E||(i.current=!0)}})}},b=w=>{w.code!==void 0&&(wg(rn(w.code)),(d?.keydown===void 0&&d?.keyup!==!0||d?.keydown)&&v(w))},C=w=>{w.code!==void 0&&(Sg(rn(w.code)),i.current=!1,d?.keyup&&v(w,!0))},x=o.current||s?.document||document;return x.addEventListener("keyup",C,s?.eventListenerOptions),x.addEventListener("keydown",b,s?.eventListenerOptions),h&&yl(l,d?.delimiter).forEach(w=>h.addHotkey(vl(w,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description))),()=>{x.removeEventListener("keyup",C,s?.eventListenerOptions),x.removeEventListener("keydown",b,s?.eventListenerOptions),h&&yl(l,d?.delimiter).forEach(w=>h.removeHotkey(vl(w,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description))),p=[],m&&clearTimeout(m)}},[l,d,f]),o}function hr(t=768){const[e,n]=y.useState(void 0);return y.useEffect(()=>{const r=window.matchMedia(`(max-width: ${t-1}px)`),o=()=>{n(window.innerWidth<t)};return r.addEventListener("change",o),n(window.innerWidth<t),()=>r.removeEventListener("change",o)},[t]),!!e}const Tg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 2C20 1.44772 19.5523 1 19 1C18.4477 1 18 1.44772 18 2V4H16C15.4477 4 15 4.44772 15 5C15 5.55228 15.4477 6 16 6H18V8C18 8.55228 18.4477 9 19 9C19.5523 9 20 8.55228 20 8V6H22C22.5523 6 23 5.55228 23 5C23 4.44772 22.5523 4 22 4H20V2ZM5 4C4.73478 4 4.48043 4.10536 4.29289 4.29289C4.10536 4.48043 4 4.73478 4 5V19C4 19.2652 4.10536 19.5196 4.29289 19.7071C4.48043 19.8946 4.73478 20 5 20H5.58579L14.379 11.2068C14.9416 10.6444 15.7045 10.3284 16.5 10.3284C17.2955 10.3284 18.0584 10.6444 18.621 11.2068L20 12.5858V12C20 11.4477 20.4477 11 21 11C21.5523 11 22 11.4477 22 12V14.998C22 14.9994 22 15.0007 22 15.002V19C22 19.7957 21.6839 20.5587 21.1213 21.1213C20.5587 21.6839 19.7957 22 19 22H6.00219C6.00073 22 5.99927 22 5.99781 22H5C4.20435 22 3.44129 21.6839 2.87868 21.1213C2.31607 20.5587 2 19.7957 2 19V5C2 4.20435 2.31607 3.44129 2.87868 2.87868C3.44129 2.31607 4.20435 2 5 2H12C12.5523 2 13 2.44772 13 3C13 3.55228 12.5523 4 12 4H5ZM8.41422 20H19C19.2652 20 19.5196 19.8946 19.7071 19.7071C19.8946 19.5196 20 19.2652 20 19V15.4142L17.207 12.6212C17.0195 12.4338 16.7651 12.3284 16.5 12.3284C16.2349 12.3284 15.9806 12.4337 15.7931 12.6211L8.41422 20ZM6.87868 6.87868C7.44129 6.31607 8.20435 6 9 6C9.79565 6 10.5587 6.31607 11.1213 6.87868C11.6839 7.44129 12 8.20435 12 9C12 9.79565 11.6839 10.5587 11.1213 11.1213C10.5587 11.6839 9.79565 12 9 12C8.20435 12 7.44129 11.6839 6.87868 11.1213C6.31607 10.5587 6 9.79565 6 9C6 8.20435 6.31607 7.44129 6.87868 6.87868ZM9 8C8.73478 8 8.48043 8.10536 8.29289 8.29289C8.10536 8.48043 8 8.73478 8 9C8 9.26522 8.10536 9.51957 8.29289 9.70711C8.48043 9.89464 8.73478 10 9 10C9.26522 10 9.51957 9.89464 9.70711 9.70711C9.89464 9.51957 10 9.26522 10 9C10 8.73478 9.89464 8.48043 9.70711 8.29289C9.51957 8.10536 9.26522 8 9 8Z",fill:"currentColor"})}));Tg.displayName="ImagePlusIcon";const fa="mod+shift+i";function _c(t){return!t||!t.isEditable||!ls(t,"imageUpload")||jt(t,["image"])?!1:t.can().insertContent({type:"imageUpload"})}function N9(t){return!t||!t.isEditable?!1:t.isActive("imageUpload")}function I9(t){if(!t||!t.isEditable||!_c(t))return!1;try{return t.chain().focus().insertContent({type:"imageUpload"}).run()}catch{return!1}}function L9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!ls(e,"imageUpload")?!1:n&&!e.isActive("code")?_c(e):!0}function D9(t){const{editor:e,hideWhenUnavailable:n=!1,onInserted:r}=t||{},{editor:o}=ie(e),i=hr(),[s,l]=y.useState(!0),a=_c(o),c=N9(o);y.useEffect(()=>{if(!o)return;const d=()=>{l(L9({editor:o,hideWhenUnavailable:n}))};return d(),o.on("selectionUpdate",d),()=>{o.off("selectionUpdate",d)}},[o,n]);const u=y.useCallback(()=>{if(!o)return!1;const d=I9(o);return d&&r?.(),d},[o,r]);return Mg(fa,d=>{d.preventDefault(),u()},{enabled:s&&a,enableOnContentEditable:!i,enableOnFormTags:!0}),{isVisible:s,isActive:c,handleImage:u,canInsert:a,label:"Add image",shortcutKeys:fa,Icon:Tg}}function P9({type:t,shortcutKeys:e=Og[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Ag=y.forwardRef(({editor:t,type:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,canToggle:f,isActive:h,handleToggle:p,label:m,shortcutKeys:v,Icon:b}=H9({editor:u,type:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&p()},[p,s]);return d?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":h?"on":"off",role:"button",tabIndex:-1,disabled:!f,"data-disabled":!f,"aria-label":m,"aria-pressed":h,tooltip:m,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(b,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(P9,{type:e,shortcutKeys:v})]})}):null});Ag.displayName="ListButton";const ms=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));ms.displayName="ListIcon";const Hc=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 6C9 5.44772 9.44772 5 10 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H10C9.44772 7 9 6.55228 9 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 12C9 11.4477 9.44772 11 10 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H10C9.44772 13 9 12.5523 9 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 18C9 17.4477 9.44772 17 10 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H10C9.44772 19 9 18.5523 9 18Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6C3 5.44772 3.44772 5 4 5H5C5.55228 5 6 5.44772 6 6V10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10V7C3.44772 7 3 6.55228 3 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 10C3 9.44772 3.44772 9 4 9H6C6.55228 9 7 9.44772 7 10C7 10.5523 6.55228 11 6 11H4C3.44772 11 3 10.5523 3 10Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.82219 13.0431C6.54543 13.4047 6.99997 14.1319 6.99997 15C6.99997 15.5763 6.71806 16.0426 6.48747 16.35C6.31395 16.5814 6.1052 16.8044 5.91309 17H5.99997C6.55226 17 6.99997 17.4477 6.99997 18C6.99997 18.5523 6.55226 19 5.99997 19H3.99997C3.44769 19 2.99997 18.5523 2.99997 18C2.99997 17.4237 3.28189 16.9575 3.51247 16.65C3.74323 16.3424 4.03626 16.0494 4.26965 15.8161C4.27745 15.8083 4.2852 15.8006 4.29287 15.7929C4.55594 15.5298 4.75095 15.3321 4.88748 15.15C4.96287 15.0495 4.99021 14.9922 4.99911 14.9714C4.99535 14.9112 4.9803 14.882 4.9739 14.8715C4.96613 14.8588 4.95382 14.845 4.92776 14.8319C4.87723 14.8067 4.71156 14.7623 4.44719 14.8944C3.95321 15.1414 3.35254 14.9412 3.10555 14.4472C2.85856 13.9533 3.05878 13.3526 3.55276 13.1056C4.28839 12.7378 5.12272 12.6934 5.82219 13.0431Z",fill:"currentColor"})]}));Hc.displayName="ListOrderedIcon";const Fc=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 4.89543 2.89543 4 4 4H8C9.10457 4 10 4.89543 10 6V10C10 11.1046 9.10457 12 8 12H4C2.89543 12 2 11.1046 2 10V6ZM8 6H4V10H8V6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071L2.29289 17.7071C1.90237 17.3166 1.90237 16.6834 2.29289 16.2929C2.68342 15.9024 3.31658 15.9024 3.70711 16.2929L5 17.5858L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 6C12 5.44772 12.4477 5 13 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H13C12.4477 7 12 6.55228 12 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 12C12 11.4477 12.4477 11 13 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H13C12.4477 13 12 12.5523 12 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18C12 17.4477 12.4477 17 13 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H13C12.4477 19 12 18.5523 12 18Z",fill:"currentColor"})]}));Fc.displayName="ListTodoIcon";const Rg={bulletList:ms,orderedList:Hc,taskList:Fc},j9={bulletList:"Bullet List",orderedList:"Ordered List",taskList:"Task List"},Og={bulletList:"mod+shift+8",orderedList:"mod+shift+7",taskList:"mod+shift+9"};function gs(t,e,n=!0){if(!t||!t.isEditable||!Pt(e,t)||jt(t,["image"]))return!1;if(!n)switch(e){case"bulletList":return t.can().toggleBulletList();case"orderedList":return t.can().toggleOrderedList();case"taskList":return t.can().toggleList("taskList","taskItem");default:return!1}try{const o=t.view.state,i=o.selection;if(i.empty||i instanceof V){const s=fn({editor:t,node:o.selection.$anchor.node(1)})?.pos;if(!yt(s))return!1}return!0}catch{return!1}}function $c(t,e){if(!t||!t.isEditable)return!1;switch(e){case"bulletList":return t.isActive("bulletList");case"orderedList":return t.isActive("orderedList");case"taskList":return t.isActive("taskList");default:return!1}}function B9(t,e){if(!t||!t.isEditable||!gs(t,e))return!1;try{const n=t.view;let r=n.state,o=r.tr;if(r.selection.empty||r.selection instanceof V){const l=fn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!yt(l))return!1;o=o.setSelection(B.create(r.doc,l)),n.dispatch(o),r=n.state}const i=r.selection;let s=t.chain().focus();if(i instanceof B){const l=i.node.firstChild?.firstChild,a=i.node.lastChild?.lastChild,c=l?i.from+l.nodeSize:i.from+1,u=a?i.to-a.nodeSize:i.to-1;s=s.setTextSelection({from:c,to:u}).clearNodes()}if(t.isActive(e))s.liftListItem("listItem").lift("bulletList").lift("orderedList").lift("taskList").run();else{const a={bulletList:()=>s.toggleBulletList(),orderedList:()=>s.toggleOrderedList(),taskList:()=>s.toggleList("taskList","taskItem")}[e];if(!a)return!1;a().run()}return t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function _9(t){const{editor:e,type:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!Pt(n,e)?!1:r&&!e.isActive("code")?gs(e,n):!0}function H9(t){const{editor:e,type:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=gs(i,n),c=$c(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(_9({editor:i,type:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=B9(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleToggle:u,canToggle:a,label:j9[n],shortcutKeys:Og[n],Icon:Rg[n]}}const F9=[{label:"Bullet List",type:"bulletList",icon:ms},{label:"Ordered List",type:"orderedList",icon:Hc},{label:"Task List",type:"taskList",icon:Fc}];function $9(t,e){return!t||!t.isEditable?!1:e.some(n=>gs(t,n))}function V9(t,e){return!t||!t.isEditable?!1:e.some(n=>$c(t,n))}function z9(t){return F9.filter(e=>!e.type||t.includes(e.type))}function U9(t){const{editor:e,hideWhenUnavailable:n,listInSchema:r,canToggleAny:o}=t;return!r||!e?!1:n&&!e.isActive("code")?o:!0}function W9(t,e){if(!(!t||!t.isEditable))return e.find(n=>$c(t,n))}function K9(t){const{editor:e,types:n=["bulletList","orderedList","taskList"],hideWhenUnavailable:r=!1}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!1),l=n.some(h=>Pt(h,o)),a=y.useMemo(()=>z9(n),[n]),c=$9(o,n),u=V9(o,n),d=W9(o,n),f=a.find(h=>h.type===d);return y.useEffect(()=>{if(!o)return;const h=()=>{s(U9({editor:o,hideWhenUnavailable:r,listInSchema:l,canToggleAny:c}))};return h(),o.on("selectionUpdate",h),()=>{o.off("selectionUpdate",h)}},[c,o,r,l,n]),{isVisible:i,activeType:d,isActive:u,canToggle:c,types:n,filteredLists:a,label:"List",Icon:f?Rg[f.type]:ms}}function Ng({editor:t,types:e=["bulletList","orderedList","taskList"],hideWhenUnavailable:n=!1,onOpenChange:r,portal:o=!1,...i}){const{editor:s}=ie(t),[l,a]=y.useState(!1),{filteredLists:c,canToggle:u,isActive:d,isVisible:f,Icon:h}=K9({editor:s,types:e,hideWhenUnavailable:n}),p=y.useCallback(m=>{a(m),r?.(m)},[r]);return!f||!s||!s.isEditable?null:g.jsxs(gg,{open:l,onOpenChange:p,children:[g.jsx(Ic,{asChild:!0,children:g.jsxs(fe,{type:"button","data-style":"ghost","data-active-state":d?"on":"off",role:"button",tabIndex:-1,disabled:!u,"data-disabled":!u,"aria-label":"List options",tooltip:"List",...i,children:[g.jsx(h,{className:"tiptap-button-icon"}),g.jsx(mc,{className:"tiptap-button-dropdown-small"})]})}),g.jsx(Lc,{align:"start",portal:o,children:g.jsx(fr,{children:g.jsx(lo,{children:g.jsx(In,{children:c.map(m=>g.jsx(vg,{asChild:!0,children:g.jsx(Ag,{editor:s,type:m.type,text:m.label,showTooltip:!1})},m.type))})})})})]})}function q9({shortcutKeys:t=Lg}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const Vc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onToggled:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),{isVisible:u,canToggle:d,isActive:f,handleToggle:h,label:p,shortcutKeys:m,Icon:v}=Z9({editor:c,hideWhenUnavailable:n,onToggled:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&h()},[h,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",tabIndex:-1,disabled:!d,"data-disabled":!d,"aria-label":p,"aria-pressed":f,tooltip:"Blockquote",onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(q9,{shortcutKeys:m})]})}):null});Vc.displayName="BlockquoteButton";const Ig=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 6C8 5.44772 8.44772 5 9 5H16C16.5523 5 17 5.44772 17 6C17 6.55228 16.5523 7 16 7H9C8.44772 7 8 6.55228 8 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3C4.55228 3 5 3.44772 5 4L5 20C5 20.5523 4.55229 21 4 21C3.44772 21 3 20.5523 3 20L3 4C3 3.44772 3.44772 3 4 3Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 18C8 17.4477 8.44772 17 9 17H16C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19H9C8.44772 19 8 18.5523 8 18Z",fill:"currentColor"})]}));Ig.displayName="BlockquoteIcon";const Lg="mod+shift+b";function zc(t,e=!0){if(!t||!t.isEditable||!Pt("blockquote",t)||jt(t,["image"]))return!1;if(!e)return t.can().toggleWrap("blockquote");try{const r=t.view.state,o=r.selection;if(o.empty||o instanceof V){const i=fn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!yt(i))return!1}return!0}catch{return!1}}function G9(t){if(!t||!t.isEditable||!zc(t))return!1;try{const e=t.view;let n=e.state,r=n.tr;if(n.selection.empty||n.selection instanceof V){const l=fn({editor:t,node:n.selection.$anchor.node(1)})?.pos;if(!yt(l))return!1;r=r.setSelection(B.create(n.doc,l)),e.dispatch(r),n=e.state}const o=n.selection;let i=t.chain().focus();if(o instanceof B){const l=o.node.firstChild?.firstChild,a=o.node.lastChild?.lastChild,c=l?o.from+l.nodeSize:o.from+1,u=a?o.to-a.nodeSize:o.to-1;i=i.setTextSelection({from:c,to:u}).clearNodes()}return(t.isActive("blockquote")?i.lift("blockquote"):i.wrapIn("blockquote")).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function J9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!Pt("blockquote",e)?!1:n&&!e.isActive("code")?zc(e):!0}function Z9(t){const{editor:e,hideWhenUnavailable:n=!1,onToggled:r}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!0),l=zc(o),a=o?.isActive("blockquote")||!1;y.useEffect(()=>{if(!o)return;const u=()=>{s(J9({editor:o,hideWhenUnavailable:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,n]);const c=y.useCallback(()=>{if(!o)return!1;const u=G9(o);return u&&r?.(),u},[o,r]);return{isVisible:i,isActive:a,handleToggle:c,canToggle:l,label:"Blockquote",shortcutKeys:Lg,Icon:Ig}}function Y9({shortcutKeys:t=Pg}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const Uc=y.forwardRef(({editor:t,text:e,hideWhenUnavailable:n=!1,onToggled:r,showShortcut:o=!1,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),{isVisible:u,canToggle:d,isActive:f,handleToggle:h,label:p,shortcutKeys:m,Icon:v}=eE({editor:c,hideWhenUnavailable:n,onToggled:r}),b=y.useCallback(C=>{i?.(C),!C.defaultPrevented&&h()},[h,i]);return u?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":f?"on":"off",role:"button",disabled:!d,"data-disabled":!d,tabIndex:-1,"aria-label":p,"aria-pressed":f,tooltip:"Code Block",onClick:b,...l,ref:a,children:s??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),e&&g.jsx("span",{className:"tiptap-button-text",children:e}),o&&g.jsx(Y9,{shortcutKeys:m})]})}):null});Uc.displayName="CodeBlockButton";const Dg=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.70711 2.29289C7.09763 2.68342 7.09763 3.31658 6.70711 3.70711L4.41421 6L6.70711 8.29289C7.09763 8.68342 7.09763 9.31658 6.70711 9.70711C6.31658 10.0976 5.68342 10.0976 5.29289 9.70711L2.29289 6.70711C1.90237 6.31658 1.90237 5.68342 2.29289 5.29289L5.29289 2.29289C5.68342 1.90237 6.31658 1.90237 6.70711 2.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.2929 2.29289C10.6834 1.90237 11.3166 1.90237 11.7071 2.29289L14.7071 5.29289C15.0976 5.68342 15.0976 6.31658 14.7071 6.70711L11.7071 9.70711C11.3166 10.0976 10.6834 10.0976 10.2929 9.70711C9.90237 9.31658 9.90237 8.68342 10.2929 8.29289L12.5858 6L10.2929 3.70711C9.90237 3.31658 9.90237 2.68342 10.2929 2.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17 4C17 3.44772 17.4477 3 18 3H19C20.6569 3 22 4.34315 22 6V18C22 19.6569 20.6569 21 19 21H5C3.34315 21 2 19.6569 2 18V12C2 11.4477 2.44772 11 3 11C3.55228 11 4 11.4477 4 12V18C4 18.5523 4.44772 19 5 19H19C19.5523 19 20 18.5523 20 18V6C20 5.44772 19.5523 5 19 5H18C17.4477 5 17 4.55228 17 4Z",fill:"currentColor"})]}));Dg.displayName="CodeBlockIcon";const Pg="mod+alt+c";function Wc(t,e=!0){if(!t||!t.isEditable||!Pt("codeBlock",t)||jt(t,["image"]))return!1;if(!e)return t.can().toggleNode("codeBlock","paragraph");try{const r=t.view.state,o=r.selection;if(o.empty||o instanceof V){const i=fn({editor:t,node:r.selection.$anchor.node(1)})?.pos;if(!yt(i))return!1}return!0}catch{return!1}}function X9(t){if(!t||!t.isEditable||!Wc(t))return!1;try{const e=t.view;let n=e.state,r=n.tr;if(n.selection.empty||n.selection instanceof V){const l=fn({editor:t,node:n.selection.$anchor.node(1)})?.pos;if(!yt(l))return!1;r=r.setSelection(B.create(n.doc,l)),e.dispatch(r),n=e.state}const o=n.selection;let i=t.chain().focus();if(o instanceof B){const l=o.node.firstChild?.firstChild,a=o.node.lastChild?.lastChild,c=l?o.from+l.nodeSize:o.from+1,u=a?o.to-a.nodeSize:o.to-1;i=i.setTextSelection({from:c,to:u}).clearNodes()}return(t.isActive("codeBlock")?i.setNode("paragraph"):i.toggleNode("codeBlock","paragraph")).run(),t.chain().focus().selectTextblockEnd().run(),!0}catch{return!1}}function Q9(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!Pt("codeBlock",e)?!1:n&&!e.isActive("code")?Wc(e):!0}function eE(t){const{editor:e,hideWhenUnavailable:n=!1,onToggled:r}=t||{},{editor:o}=ie(e),[i,s]=y.useState(!0),l=Wc(o),a=o?.isActive("codeBlock")||!1;y.useEffect(()=>{if(!o)return;const u=()=>{s(Q9({editor:o,hideWhenUnavailable:n}))};return u(),o.on("selectionUpdate",u),()=>{o.off("selectionUpdate",u)}},[o,n]);const c=y.useCallback(()=>{if(!o)return!1;const u=X9(o);return u&&r?.(),u},[o,r]);return{isVisible:i,isActive:a,handleToggle:c,canToggle:l,label:"Code Block",shortcutKeys:Pg,Icon:Dg}}const jg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.43471 4.01458C4.34773 4.06032 4.26607 4.11977 4.19292 4.19292C4.11977 4.26607 4.06032 4.34773 4.01458 4.43471C2.14611 6.40628 1 9.0693 1 12C1 18.0751 5.92487 23 12 23C14.9306 23 17.5936 21.854 19.5651 19.9856C19.6522 19.9398 19.7339 19.8803 19.8071 19.8071C19.8803 19.7339 19.9398 19.6522 19.9856 19.5651C21.854 17.5936 23 14.9306 23 12C23 5.92487 18.0751 1 12 1C9.0693 1 6.40628 2.14611 4.43471 4.01458ZM6.38231 4.9681C7.92199 3.73647 9.87499 3 12 3C16.9706 3 21 7.02944 21 12C21 14.125 20.2635 16.078 19.0319 17.6177L6.38231 4.9681ZM17.6177 19.0319C16.078 20.2635 14.125 21 12 21C7.02944 21 3 16.9706 3 12C3 9.87499 3.73647 7.92199 4.9681 6.38231L17.6177 19.0319Z",fill:"currentColor"})}));jg.displayName="BanIcon";const ys=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.7072 4.70711C15.0977 4.31658 15.0977 3.68342 14.7072 3.29289C14.3167 2.90237 13.6835 2.90237 13.293 3.29289L8.69294 7.89286L8.68594 7.9C8.13626 8.46079 7.82837 9.21474 7.82837 10C7.82837 10.2306 7.85491 10.4584 7.90631 10.6795L2.29289 16.2929C2.10536 16.4804 2 16.7348 2 17V20C2 20.5523 2.44772 21 3 21H12C12.2652 21 12.5196 20.8946 12.7071 20.7071L15.3205 18.0937C15.5416 18.1452 15.7695 18.1717 16.0001 18.1717C16.7853 18.1717 17.5393 17.8639 18.1001 17.3142L22.7072 12.7071C23.0977 12.3166 23.0977 11.6834 22.7072 11.2929C22.3167 10.9024 21.6835 10.9024 21.293 11.2929L16.6971 15.8887C16.5105 16.0702 16.2605 16.1717 16.0001 16.1717C15.7397 16.1717 15.4897 16.0702 15.303 15.8887L10.1113 10.697C9.92992 10.5104 9.82837 10.2604 9.82837 10C9.82837 9.73963 9.92992 9.48958 10.1113 9.30297L14.7072 4.70711ZM13.5858 17L9.00004 12.4142L4 17.4142V19H11.5858L13.5858 17Z",fill:"currentColor"})}));ys.displayName="HighlighterIcon";var vs="Popover",[Bg]=dr(vs,[us]),ao=us(),[tE,hn]=Bg(vs),_g=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=t,l=ao(e),a=y.useRef(null),[c,u]=y.useState(!1),[d,f]=yc({prop:r,defaultProp:o??!1,onChange:i,caller:vs});return g.jsx(y1,{...l,children:g.jsx(tE,{scope:e,contentId:Pi(),triggerRef:a,open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:c,onCustomAnchorAdd:y.useCallback(()=>u(!0),[]),onCustomAnchorRemove:y.useCallback(()=>u(!1),[]),modal:s,children:n})})};_g.displayName=vs;var Hg="PopoverAnchor",nE=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=hn(Hg,n),i=ao(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:l}=o;return y.useEffect(()=>(s(),()=>l()),[s,l]),g.jsx(wc,{...i,...r,ref:e})});nE.displayName=Hg;var Fg="PopoverTrigger",$g=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=hn(Fg,n),i=ao(n),s=Oe(e,o.triggerRef),l=g.jsx(Te.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Kg(o.open),...r,ref:s,onClick:J(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:g.jsx(wc,{asChild:!0,...i,children:l})});$g.displayName=Fg;var Kc="PopoverPortal",[rE,oE]=Bg(Kc,{forceMount:void 0}),Vg=t=>{const{__scopePopover:e,forceMount:n,children:r,container:o}=t,i=hn(Kc,e);return g.jsx(rE,{scope:e,forceMount:n,children:g.jsx(Dn,{present:n||i.open,children:g.jsx(Sc,{asChild:!0,container:o,children:r})})})};Vg.displayName=Kc;var lr="PopoverContent",zg=y.forwardRef((t,e)=>{const n=oE(lr,t.__scopePopover),{forceMount:r=n.forceMount,...o}=t,i=hn(lr,t.__scopePopover);return g.jsx(Dn,{present:r||i.open,children:i.modal?g.jsx(sE,{...o,ref:e}):g.jsx(lE,{...o,ref:e})})});zg.displayName=lr;var iE=qr("PopoverContent.RemoveScroll"),sE=y.forwardRef((t,e)=>{const n=hn(lr,t.__scopePopover),r=y.useRef(null),o=Oe(e,r),i=y.useRef(!1);return y.useEffect(()=>{const s=r.current;if(s)return T1(s)},[]),g.jsx(kc,{as:iE,allowPinchZoom:!0,children:g.jsx(Ug,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(t.onCloseAutoFocus,s=>{s.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:J(t.onPointerDownOutside,s=>{const l=s.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0,c=l.button===2||a;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:J(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),lE=y.forwardRef((t,e)=>{const n=hn(lr,t.__scopePopover),r=y.useRef(!1),o=y.useRef(!1);return g.jsx(Ug,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),Ug=y.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:c,onInteractOutside:u,...d}=t,f=hn(lr,n),h=ao(n);return i1(),g.jsx(bc,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:g.jsx(vc,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:g.jsx(v1,{"data-state":Kg(f.open),role:"dialog",id:f.contentId,...h,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Wg="PopoverClose",aE=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=hn(Wg,n);return g.jsx(Te.button,{type:"button",...r,ref:e,onClick:J(t.onClick,()=>o.onOpenChange(!1))})});aE.displayName=Wg;var cE="PopoverArrow",uE=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,o=ao(n);return g.jsx(b1,{...o,...r,ref:e})});uE.displayName=cE;function Kg(t){return t?"open":"closed"}var dE=_g,fE=$g,hE=Vg,pE=zg;function qg({...t}){return g.jsx(dE,{...t})}function Gg({...t}){return g.jsx(fE,{...t})}function Jg({className:t,align:e="center",sideOffset:n=4,...r}){return g.jsx(hE,{children:g.jsx(pE,{align:e,sideOffset:n,className:Me("tiptap-popover",t),...r})})}function mE({shortcutKeys:t=ha}){return g.jsx(vt,{children:gt({shortcutKeys:t})})}const Zg=y.forwardRef(({editor:t,highlightColor:e,text:n,hideWhenUnavailable:r=!1,onApplied:o,showShortcut:i=!1,onClick:s,children:l,style:a,...c},u)=>{const{editor:d}=ie(t),{isVisible:f,canColorHighlight:h,isActive:p,handleColorHighlight:m,label:v,shortcutKeys:b}=Gc({editor:d,highlightColor:e,label:n||`Toggle highlight (${e})`,hideWhenUnavailable:r,onApplied:o}),C=y.useCallback(w=>{s?.(w),!w.defaultPrevented&&m()},[m,s]),x=y.useMemo(()=>({...a,"--highlight-color":e}),[e,a]);return f?g.jsx(fe,{type:"button","data-style":"ghost","data-active-state":p?"on":"off",role:"button",tabIndex:-1,disabled:!h,"data-disabled":!h,"aria-label":v,"aria-pressed":p,tooltip:v,onClick:C,style:x,...c,ref:u,children:l??g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"tiptap-button-highlight",style:{"--highlight-color":e}}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(mE,{shortcutKeys:b})]})}):null});Zg.displayName="ColorHighlightButton";const ha="mod+shift+h",gE=[{label:"Default background",value:"var(--tt-bg-color)",border:"var(--tt-bg-color-contrast)"},{label:"Gray background",value:"var(--tt-color-highlight-gray)",border:"var(--tt-color-highlight-gray-contrast)"},{label:"Brown background",value:"var(--tt-color-highlight-brown)",border:"var(--tt-color-highlight-brown-contrast)"},{label:"Orange background",value:"var(--tt-color-highlight-orange)",border:"var(--tt-color-highlight-orange-contrast)"},{label:"Yellow background",value:"var(--tt-color-highlight-yellow)",border:"var(--tt-color-highlight-yellow-contrast)"},{label:"Green background",value:"var(--tt-color-highlight-green)",border:"var(--tt-color-highlight-green-contrast)"},{label:"Blue background",value:"var(--tt-color-highlight-blue)",border:"var(--tt-color-highlight-blue-contrast)"},{label:"Purple background",value:"var(--tt-color-highlight-purple)",border:"var(--tt-color-highlight-purple-contrast)"},{label:"Pink background",value:"var(--tt-color-highlight-pink)",border:"var(--tt-color-highlight-pink-contrast)"},{label:"Red background",value:"var(--tt-color-highlight-red)",border:"var(--tt-color-highlight-red-contrast)"}];function Yg(t){const e=new Map(gE.map(n=>[n.value,n]));return t.map(n=>e.get(n)).filter(n=>!!n)}function qc(t){return!t||!t.isEditable||!ro("highlight",t)||jt(t,["image"])?!1:t.can().setMark("highlight")}function yE(t,e){return!t||!t.isEditable?!1:e?t.isActive("highlight",{color:e}):t.isActive("highlight")}function vE(t){return!t||!t.isEditable||!qc(t)?!1:t.chain().focus().unsetMark("highlight").run()}function bE(t){const{editor:e,hideWhenUnavailable:n}=t;return!e||!e.isEditable||!ro("highlight",e)?!1:n&&!e.isActive("code")?qc(e):!0}function Gc(t){const{editor:e,label:n,highlightColor:r,hideWhenUnavailable:o=!1,onApplied:i}=t,{editor:s}=ie(e),l=hr(),[a,c]=y.useState(!0),u=qc(s),d=yE(s,r);y.useEffect(()=>{if(!s)return;const p=()=>{c(bE({editor:s,hideWhenUnavailable:o}))};return p(),s.on("selectionUpdate",p),()=>{s.off("selectionUpdate",p)}},[s,o]);const f=y.useCallback(()=>{if(!s||!u||!r||!n)return!1;if(s.state.storedMarks){const p=s.schema.marks.highlight;p&&s.view.dispatch(s.state.tr.removeStoredMark(p))}setTimeout(()=>{const p=s.chain().focus().toggleMark("highlight",{color:r}).run();return p&&i?.({color:r,label:n}),p},0)},[u,r,s,n,i]),h=y.useCallback(()=>{const p=vE(s);return p&&i?.({color:"",label:"Remove highlight"}),p},[s,i]);return Mg(ha,p=>{p.preventDefault(),f()},{enabled:a&&u,enableOnContentEditable:!l,enableOnFormTags:!0}),{isVisible:a,isActive:d,handleColorHighlight:f,handleRemoveHighlight:h,canColorHighlight:u,label:n||"Highlight",shortcutKeys:ha,Icon:ys}}const Jc=y.forwardRef(({className:t,children:e,...n},r)=>g.jsx(fe,{type:"button",className:t,"data-style":"ghost","data-appearance":"default",role:"button",tabIndex:-1,"aria-label":"Highlight text",tooltip:"Highlight",ref:r,...n,children:e??g.jsx(ys,{className:"tiptap-button-icon"})}));Jc.displayName="ColorHighlightPopoverButton";function Xg({editor:t,colors:e=Yg(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"])}){const{handleRemoveHighlight:n}=Gc({editor:t}),r=hr(),o=y.useRef(null),i=y.useMemo(()=>[...e,{label:"Remove highlight",value:"none"}],[e]),{selectedIndex:s}=$m({containerRef:o,items:i,orientation:"both",onSelect:l=>{if(!o.current)return!1;const a=o.current.querySelector('[data-highlighted="true"]');a&&a.click(),l.value==="none"&&n()},autoSelectFirstItem:!1});return g.jsx(fr,{ref:o,tabIndex:0,style:r?{boxShadow:"none",border:0}:{},children:g.jsx(lo,{style:r?{padding:0}:{},children:g.jsxs(Dc,{orientation:"horizontal",children:[g.jsx(In,{orientation:"horizontal",children:e.map((l,a)=>g.jsx(Zg,{editor:t,highlightColor:l.value,tooltip:l.label,"aria-label":`${l.label} highlight color`,tabIndex:a===s?0:-1,"data-highlighted":s===a},l.value))}),g.jsx(as,{}),g.jsx(In,{orientation:"horizontal",children:g.jsx(fe,{onClick:n,"aria-label":"Remove highlight",tooltip:"Remove highlight",tabIndex:s===e.length?0:-1,type:"button",role:"menuitem","data-style":"ghost","data-highlighted":s===e.length,children:g.jsx(jg,{className:"tiptap-button-icon"})})})]})})})}function CE({editor:t,colors:e=Yg(["var(--tt-color-highlight-green)","var(--tt-color-highlight-blue)","var(--tt-color-highlight-red)","var(--tt-color-highlight-purple)","var(--tt-color-highlight-yellow)"]),hideWhenUnavailable:n=!1,onApplied:r,...o}){const{editor:i}=ie(t),[s,l]=y.useState(!1),{isVisible:a,canColorHighlight:c,isActive:u,label:d,Icon:f}=Gc({editor:i,hideWhenUnavailable:n,onApplied:r});return a?g.jsxs(qg,{open:s,onOpenChange:l,children:[g.jsx(Gg,{asChild:!0,children:g.jsx(Jc,{disabled:!c,"data-active-state":u?"on":"off","data-disabled":!c,"aria-pressed":u,"aria-label":d,tooltip:d,...o,children:g.jsx(f,{className:"tiptap-button-icon"})})}),g.jsx(Jg,{"aria-label":"Highlight colors",children:g.jsx(Xg,{editor:i,colors:e})})]}):null}const Qg=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21 4C21 3.44772 20.5523 3 20 3C19.4477 3 19 3.44772 19 4V11C19 11.7956 18.6839 12.5587 18.1213 13.1213C17.5587 13.6839 16.7956 14 16 14H6.41421L9.70711 10.7071C10.0976 10.3166 10.0976 9.68342 9.70711 9.29289C9.31658 8.90237 8.68342 8.90237 8.29289 9.29289L3.29289 14.2929C2.90237 14.6834 2.90237 15.3166 3.29289 15.7071L8.29289 20.7071C8.68342 21.0976 9.31658 21.0976 9.70711 20.7071C10.0976 20.3166 10.0976 19.6834 9.70711 19.2929L6.41421 16H16C17.3261 16 18.5979 15.4732 19.5355 14.5355C20.4732 13.5979 21 12.3261 21 11V4Z",fill:"currentColor"})}));Qg.displayName="CornerDownLeftIcon";const e0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M14 3C14 2.44772 14.4477 2 15 2H21C21.5523 2 22 2.44772 22 3V9C22 9.55228 21.5523 10 21 10C20.4477 10 20 9.55228 20 9V5.41421L10.7071 14.7071C10.3166 15.0976 9.68342 15.0976 9.29289 14.7071C8.90237 14.3166 8.90237 13.6834 9.29289 13.2929L18.5858 4H15C14.4477 4 14 3.55228 14 3Z",fill:"currentColor"}),g.jsx("path",{d:"M4.29289 7.29289C4.48043 7.10536 4.73478 7 5 7H11C11.5523 7 12 6.55228 12 6C12 5.44772 11.5523 5 11 5H5C4.20435 5 3.44129 5.31607 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V19C2 19.7957 2.31607 20.5587 2.87868 21.1213C3.44129 21.6839 4.20435 22 5 22H16C16.7957 22 17.5587 21.6839 18.1213 21.1213C18.6839 20.5587 19 19.7957 19 19V13C19 12.4477 18.5523 12 18 12C17.4477 12 17 12.4477 17 13V19C17 19.2652 16.8946 19.5196 16.7071 19.7071C16.5196 19.8946 16.2652 20 16 20H5C4.73478 20 4.48043 19.8946 4.29289 19.7071C4.10536 19.5196 4 19.2652 4 19V8C4 7.73478 4.10536 7.48043 4.29289 7.29289Z",fill:"currentColor"})]}));e0.displayName="ExternalLinkIcon";const bs=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z",fill:"currentColor"}),g.jsx("path",{d:"M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z",fill:"currentColor"})]}));bs.displayName="LinkIcon";const t0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 5V4C7 3.17477 7.40255 2.43324 7.91789 1.91789C8.43324 1.40255 9.17477 1 10 1H14C14.8252 1 15.5668 1.40255 16.0821 1.91789C16.5975 2.43324 17 3.17477 17 4V5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H20V20C20 20.8252 19.5975 21.5668 19.0821 22.0821C18.5668 22.5975 17.8252 23 17 23H7C6.17477 23 5.43324 22.5975 4.91789 22.0821C4.40255 21.5668 4 20.8252 4 20V7H3C2.44772 7 2 6.55228 2 6C2 5.44772 2.44772 5 3 5H7ZM9 4C9 3.82523 9.09745 3.56676 9.33211 3.33211C9.56676 3.09745 9.82523 3 10 3H14C14.1748 3 14.4332 3.09745 14.6679 3.33211C14.9025 3.56676 15 3.82523 15 4V5H9V4ZM6 7V20C6 20.1748 6.09745 20.4332 6.33211 20.6679C6.56676 20.9025 6.82523 21 7 21H17C17.1748 21 17.4332 20.9025 17.6679 20.6679C17.9025 20.4332 18 20.1748 18 20V7H6Z",fill:"currentColor"})}));t0.displayName="TrashIcon";function xE({className:t,type:e,...n}){return g.jsx("input",{type:e,className:Me("tiptap-input",t),...n})}function wE({className:t,children:e,...n}){return g.jsx("div",{className:Me("tiptap-input-group",t),...n,children:e})}const Zc=y.forwardRef(({className:t,children:e,...n},r)=>g.jsx(fe,{type:"button",className:t,"data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Link",tooltip:"Link",ref:r,...n,children:e||g.jsx(bs,{className:"tiptap-button-icon"})}));Zc.displayName="LinkButton";const n0=({url:t,setUrl:e,setLink:n,removeLink:r,openLink:o,isActive:i})=>{const s=hr(),l=a=>{a.key==="Enter"&&(a.preventDefault(),n())};return g.jsx(fr,{style:{...s?{boxShadow:"none",border:0}:{}},children:g.jsx(lo,{style:{...s?{padding:0}:{}},children:g.jsxs(Dc,{orientation:"horizontal",children:[g.jsx(wE,{children:g.jsx(xE,{type:"url",placeholder:"Paste a link...",value:t,onChange:a=>e(a.target.value),onKeyDown:l,autoFocus:!0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off"})}),g.jsx(In,{orientation:"horizontal",children:g.jsx(fe,{type:"button",onClick:n,title:"Apply link",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(Qg,{className:"tiptap-button-icon"})})}),g.jsx(as,{}),g.jsxs(In,{orientation:"horizontal",children:[g.jsx(fe,{type:"button",onClick:o,title:"Open in new window",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(e0,{className:"tiptap-button-icon"})}),g.jsx(fe,{type:"button",onClick:r,title:"Remove link",disabled:!t&&!i,"data-style":"ghost",children:g.jsx(t0,{className:"tiptap-button-icon"})})]})]})})})},SE=({editor:t})=>{const e=s0({editor:t});return g.jsx(n0,{...e})},r0=y.forwardRef(({editor:t,hideWhenUnavailable:e=!1,onSetLink:n,onOpenChange:r,autoOpenOnLinkActive:o=!0,onClick:i,children:s,...l},a)=>{const{editor:c}=ie(t),[u,d]=y.useState(!1),{isVisible:f,canSet:h,isActive:p,url:m,setUrl:v,setLink:b,removeLink:C,openLink:x,label:w,Icon:E}=s0({editor:c,hideWhenUnavailable:e,onSetLink:n}),k=y.useCallback(N=>{d(N),r?.(N)},[r]),S=y.useCallback(()=>{b(),d(!1)},[b]),M=y.useCallback(N=>{i?.(N),!N.defaultPrevented&&d(!u)},[i,u]);return y.useEffect(()=>{o&&p&&d(!0)},[o,p]),f?g.jsxs(qg,{open:u,onOpenChange:k,children:[g.jsx(Gg,{asChild:!0,children:g.jsx(Zc,{disabled:!h,"data-active-state":p?"on":"off","data-disabled":!h,"aria-label":w,"aria-pressed":p,onClick:M,...l,ref:a,children:s??g.jsx(E,{className:"tiptap-button-icon"})})}),g.jsx(Jg,{children:g.jsx(n0,{url:m,setUrl:v,setLink:S,removeLink:C,openLink:x,isActive:p})})]}):null});r0.displayName="LinkPopover";function o0(t){return!t||!t.isEditable?!1:t.can().setMark("link")}function i0(t){return!t||!t.isEditable?!1:t.isActive("link")}function kE(t){const{editor:e,hideWhenUnavailable:n}=t;return!ro("link",e)||!e?!1:n&&!e.isActive("code")?o0(e):!0}function EE(t){const{editor:e,onSetLink:n}=t,[r,o]=y.useState(null);y.useEffect(()=>{if(!e)return;const{href:a}=e.getAttributes("link");i0(e)&&r===null&&o(a||"")},[e,r]),y.useEffect(()=>{if(!e)return;const a=()=>{const{href:c}=e.getAttributes("link");o(c||"")};return e.on("selectionUpdate",a),()=>{e.off("selectionUpdate",a)}},[e]);const i=y.useCallback(()=>{if(!r||!e)return;const{selection:a}=e.state,c=a.empty;let u=e.chain().focus();u=u.extendMarkRange("link").setLink({href:r}),c&&(u=u.insertContent({type:"text",text:r})),u.run(),o(null),n?.()},[e,n,r]),s=y.useCallback(()=>{e&&(e.chain().focus().extendMarkRange("link").unsetLink().setMeta("preventAutolink",!0).run(),o(""))},[e]),l=y.useCallback((a="_blank",c="noopener,noreferrer")=>{if(!r)return;const u=K5(r,window.location.href);u!=="#"&&window.open(u,a,c)},[r]);return{url:r||"",setUrl:o,setLink:i,removeLink:s,openLink:l}}function ME(t){const{editor:e,hideWhenUnavailable:n=!1}=t,r=o0(e),o=i0(e),[i,s]=y.useState(!1);return y.useEffect(()=>{if(!e)return;const l=()=>{s(kE({editor:e,hideWhenUnavailable:n}))};return l(),e.on("selectionUpdate",l),()=>{e.off("selectionUpdate",l)}},[e,n]),{isVisible:i,canSet:r,isActive:o}}function s0(t){const{editor:e,hideWhenUnavailable:n=!1,onSetLink:r}=t||{},{editor:o}=ie(e),{isVisible:i,canSet:s,isActive:l}=ME({editor:o,hideWhenUnavailable:n}),a=EE({editor:o,onSetLink:r});return{isVisible:i,canSet:s,isActive:l,label:"Link",Icon:bs,...a}}function TE({type:t,shortcutKeys:e=p0[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const gn=y.forwardRef(({editor:t,type:e,text:n,hideWhenUnavailable:r=!1,onToggled:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,handleMark:f,label:h,canToggle:p,isActive:m,Icon:v,shortcutKeys:b}=LE({editor:u,type:e,hideWhenUnavailable:r,onToggled:o}),C=y.useCallback(x=>{s?.(x),!x.defaultPrevented&&f()},[f,s]);return d?g.jsx(fe,{type:"button",disabled:!p,"data-style":"ghost","data-active-state":m?"on":"off","data-disabled":!p,role:"button",tabIndex:-1,"aria-label":h,"aria-pressed":m,tooltip:h,onClick:C,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(v,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(TE,{type:e,shortcutKeys:b})]})}):null});gn.displayName="MarkButton";const l0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2.5C5.17157 2.5 4.5 3.17157 4.5 4V20C4.5 20.8284 5.17157 21.5 6 21.5H15C16.4587 21.5 17.8576 20.9205 18.8891 19.8891C19.9205 18.8576 20.5 17.4587 20.5 16C20.5 14.5413 19.9205 13.1424 18.8891 12.1109C18.6781 11.9 18.4518 11.7079 18.2128 11.5359C19.041 10.5492 19.5 9.29829 19.5 8C19.5 6.54131 18.9205 5.14236 17.8891 4.11091C16.8576 3.07946 15.4587 2.5 14 2.5H6ZM14 10.5C14.663 10.5 15.2989 10.2366 15.7678 9.76777C16.2366 9.29893 16.5 8.66304 16.5 8C16.5 7.33696 16.2366 6.70107 15.7678 6.23223C15.2989 5.76339 14.663 5.5 14 5.5H7.5V10.5H14ZM7.5 18.5V13.5H15C15.663 13.5 16.2989 13.7634 16.7678 14.2322C17.2366 14.7011 17.5 15.337 17.5 16C17.5 16.663 17.2366 17.2989 16.7678 17.7678C16.2989 18.2366 15.663 18.5 15 18.5H7.5Z",fill:"currentColor"})}));l0.displayName="BoldIcon";const a0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M15.4545 4.2983C15.6192 3.77115 15.3254 3.21028 14.7983 3.04554C14.2712 2.88081 13.7103 3.1746 13.5455 3.70175L8.54554 19.7017C8.38081 20.2289 8.6746 20.7898 9.20175 20.9545C9.72889 21.1192 10.2898 20.8254 10.4545 20.2983L15.4545 4.2983Z",fill:"currentColor"}),g.jsx("path",{d:"M6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.70711L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289Z",fill:"currentColor"}),g.jsx("path",{d:"M17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C23.0976 11.6834 23.0976 12.3166 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z",fill:"currentColor"})]}));a0.displayName="Code2Icon";const c0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M15.0222 3H19C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H15.693L10.443 19H14C14.5523 19 15 19.4477 15 20C15 20.5523 14.5523 21 14 21H9.02418C9.00802 21.0004 8.99181 21.0004 8.97557 21H5C4.44772 21 4 20.5523 4 20C4 19.4477 4.44772 19 5 19H8.30704L13.557 5H10C9.44772 5 9 4.55228 9 4C9 3.44772 9.44772 3 10 3H14.9782C14.9928 2.99968 15.0075 2.99967 15.0222 3Z",fill:"currentColor"})}));c0.displayName="ItalicIcon";const u0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{d:"M9.00039 3H16.0001C16.5524 3 17.0001 3.44772 17.0001 4C17.0001 4.55229 16.5524 5 16.0001 5H9.00011C8.68006 4.99983 8.36412 5.07648 8.07983 5.22349C7.79555 5.37051 7.55069 5.5836 7.36585 5.84487C7.181 6.10614 7.06155 6.40796 7.01754 6.72497C6.97352 7.04198 7.00623 7.36492 7.11292 7.66667C7.29701 8.18737 7.02414 8.75872 6.50344 8.94281C5.98274 9.1269 5.4114 8.85403 5.2273 8.33333C5.01393 7.72984 4.94851 7.08396 5.03654 6.44994C5.12456 5.81592 5.36346 5.21229 5.73316 4.68974C6.10285 4.1672 6.59256 3.74101 7.16113 3.44698C7.72955 3.15303 8.36047 2.99975 9.00039 3Z",fill:"currentColor"}),g.jsx("path",{d:"M18 13H20C20.5523 13 21 12.5523 21 12C21 11.4477 20.5523 11 20 11H4C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13H14C14.7956 13 15.5587 13.3161 16.1213 13.8787C16.6839 14.4413 17 15.2044 17 16C17 16.7956 16.6839 17.5587 16.1213 18.1213C15.5587 18.6839 14.7956 19 14 19H6C5.44772 19 5 19.4477 5 20C5 20.5523 5.44772 21 6 21H14C15.3261 21 16.5979 20.4732 17.5355 19.5355C18.4732 18.5979 19 17.3261 19 16C19 14.9119 18.6453 13.8604 18 13Z",fill:"currentColor"})]}));u0.displayName="StrikeIcon";const d0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.4079 14.3995C18.0284 14.0487 18.7506 13.9217 19.4536 14.0397C20.1566 14.1578 20.7977 14.5138 21.2696 15.0481L21.2779 15.0574L21.2778 15.0575C21.7439 15.5988 22 16.2903 22 17C22 18.0823 21.3962 18.8401 20.7744 19.3404C20.194 19.8073 19.4858 20.141 18.9828 20.378C18.9638 20.387 18.9451 20.3958 18.9266 20.4045C18.4473 20.6306 18.2804 20.7817 18.1922 20.918C18.1773 20.9412 18.1619 20.9681 18.1467 21H21C21.5523 21 22 21.4477 22 22C22 22.5523 21.5523 23 21 23H17C16.4477 23 16 22.5523 16 22C16 21.1708 16.1176 20.4431 16.5128 19.832C16.9096 19.2184 17.4928 18.8695 18.0734 18.5956C18.6279 18.334 19.138 18.0901 19.5207 17.7821C19.8838 17.49 20 17.2477 20 17C20 16.7718 19.9176 16.5452 19.7663 16.3672C19.5983 16.1792 19.3712 16.0539 19.1224 16.0121C18.8722 15.9701 18.6152 16.015 18.3942 16.1394C18.1794 16.2628 18.0205 16.4549 17.9422 16.675C17.7572 17.1954 17.1854 17.4673 16.665 17.2822C16.1446 17.0972 15.8728 16.5254 16.0578 16.005C16.2993 15.3259 16.7797 14.7584 17.4039 14.4018L17.4079 14.3995L17.4079 14.3995Z",fill:"currentColor"})]}));d0.displayName="SubscriptIcon";const f0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.7071 7.29289C13.0976 7.68342 13.0976 8.31658 12.7071 8.70711L4.70711 16.7071C4.31658 17.0976 3.68342 17.0976 3.29289 16.7071C2.90237 16.3166 2.90237 15.6834 3.29289 15.2929L11.2929 7.29289C11.6834 6.90237 12.3166 6.90237 12.7071 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.29289 7.29289C3.68342 6.90237 4.31658 6.90237 4.70711 7.29289L12.7071 15.2929C13.0976 15.6834 13.0976 16.3166 12.7071 16.7071C12.3166 17.0976 11.6834 17.0976 11.2929 16.7071L3.29289 8.70711C2.90237 8.31658 2.90237 7.68342 3.29289 7.29289Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.405 1.40657C18.0246 1.05456 18.7463 0.92634 19.4492 1.04344C20.1521 1.16054 20.7933 1.51583 21.2652 2.0497L21.2697 2.05469L21.2696 2.05471C21.7431 2.5975 22 3.28922 22 4.00203C22 5.08579 21.3952 5.84326 20.7727 6.34289C20.1966 6.80531 19.4941 7.13675 18.9941 7.37261C18.9714 7.38332 18.9491 7.39383 18.9273 7.40415C18.4487 7.63034 18.2814 7.78152 18.1927 7.91844C18.1778 7.94155 18.1625 7.96834 18.1473 8.00003H21C21.5523 8.00003 22 8.44774 22 9.00003C22 9.55231 21.5523 10 21 10H17C16.4477 10 16 9.55231 16 9.00003C16 8.17007 16.1183 7.44255 16.5138 6.83161C16.9107 6.21854 17.4934 5.86971 18.0728 5.59591C18.6281 5.33347 19.1376 5.09075 19.5208 4.78316C19.8838 4.49179 20 4.25026 20 4.00203C20 3.77192 19.9178 3.54865 19.7646 3.37182C19.5968 3.18324 19.3696 3.05774 19.1205 3.01625C18.8705 2.97459 18.6137 3.02017 18.3933 3.14533C18.1762 3.26898 18.0191 3.45826 17.9406 3.67557C17.7531 4.19504 17.18 4.46414 16.6605 4.27662C16.141 4.0891 15.8719 3.51596 16.0594 2.99649C16.303 2.3219 16.7817 1.76125 17.4045 1.40689L17.405 1.40657Z",fill:"currentColor"})]}));f0.displayName="SuperscriptIcon";const h0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4V10C5 11.8565 5.7375 13.637 7.05025 14.9497C8.36301 16.2625 10.1435 17 12 17C13.8565 17 15.637 16.2625 16.9497 14.9497C18.2625 13.637 19 11.8565 19 10V4C19 3.44772 18.5523 3 18 3C17.4477 3 17 3.44772 17 4V10C17 11.3261 16.4732 12.5979 15.5355 13.5355C14.5979 14.4732 13.3261 15 12 15C10.6739 15 9.40215 14.4732 8.46447 13.5355C7.52678 12.5979 7 11.3261 7 10V4ZM4 19C3.44772 19 3 19.4477 3 20C3 20.5523 3.44772 21 4 21H20C20.5523 21 21 20.5523 21 20C21 19.4477 20.5523 19 20 19H4Z",fill:"currentColor"})}));h0.displayName="UnderlineIcon";const AE={bold:l0,italic:c0,underline:h0,strike:u0,code:a0,superscript:f0,subscript:d0},p0={bold:"mod+b",italic:"mod+i",underline:"mod+u",strike:"mod+shift+s",code:"mod+e",superscript:"mod+.",subscript:"mod+,"};function Yc(t,e){return!t||!t.isEditable||!ro(e,t)||jt(t,["image"])?!1:t.can().toggleMark(e)}function RE(t,e){return!t||!t.isEditable?!1:t.isActive(e)}function OE(t,e){return!t||!t.isEditable||!Yc(t,e)?!1:t.chain().focus().toggleMark(e).run()}function NE(t){const{editor:e,type:n,hideWhenUnavailable:r}=t;return!e||!e.isEditable||!ro(n,e)?!1:r&&!e.isActive("code")?Yc(e,n):!0}function IE(t){return t.charAt(0).toUpperCase()+t.slice(1)}function LE(t){const{editor:e,type:n,hideWhenUnavailable:r=!1,onToggled:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Yc(i,n),c=RE(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(NE({editor:i,type:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,n,r]);const u=y.useCallback(()=>{if(!i)return!1;const d=OE(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleMark:u,canToggle:a,label:IE(n),shortcutKeys:p0[n],Icon:AE[n]}}function DE({align:t,shortcutKeys:e=b0[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const Zn=y.forwardRef(({editor:t,align:e,text:n,hideWhenUnavailable:r=!1,onAligned:o,showShortcut:i=!1,onClick:s,icon:l,children:a,...c},u)=>{const{editor:d}=ie(t),{isVisible:f,handleTextAlign:h,label:p,canAlign:m,isActive:v,Icon:b,shortcutKeys:C}=$E({editor:d,align:e,hideWhenUnavailable:r,onAligned:o}),x=y.useCallback(E=>{s?.(E),!E.defaultPrevented&&h()},[h,s]);if(!f)return null;const w=l??b;return g.jsx(fe,{type:"button",disabled:!m,"data-style":"ghost","data-active-state":v?"on":"off","data-disabled":!m,role:"button",tabIndex:-1,"aria-label":p,"aria-pressed":v,tooltip:p,onClick:x,...c,ref:u,children:a??g.jsxs(g.Fragment,{children:[g.jsx(w,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(DE,{align:e,shortcutKeys:C})]})})});Zn.displayName="TextAlignButton";const m0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 18C4 17.4477 4.44772 17 5 17H19C19.5523 17 20 17.4477 20 18C20 18.5523 19.5523 19 19 19H5C4.44772 19 4 18.5523 4 18Z",fill:"currentColor"})]}));m0.displayName="AlignCenterIcon";const g0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));g0.displayName="AlignJustifyIcon";const y0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 12C2 11.4477 2.44772 11 3 11H15C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13H3C2.44772 13 2 12.5523 2 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 18C2 17.4477 2.44772 17 3 17H17C17.5523 17 18 17.4477 18 18C18 18.5523 17.5523 19 17 19H3C2.44772 19 2 18.5523 2 18Z",fill:"currentColor"})]}));y0.displayName="AlignLeftIcon";const v0=y.memo(({className:t,...e})=>g.jsxs("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 6C2 5.44772 2.44772 5 3 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H3C2.44772 7 2 6.55228 2 6Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 12C8 11.4477 8.44772 11 9 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H9C8.44772 13 8 12.5523 8 12Z",fill:"currentColor"}),g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 18C6 17.4477 6.44772 17 7 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H7C6.44772 19 6 18.5523 6 18Z",fill:"currentColor"})]}));v0.displayName="AlignRightIcon";const b0={left:"mod+shift+l",center:"mod+shift+e",right:"mod+shift+r",justify:"mod+shift+j"},PE={left:y0,center:m0,right:v0,justify:g0},jE={left:"Align left",center:"Align center",right:"Align right",justify:"Align justify"};function Xc(t,e){return!t||!t.isEditable||!ls(t,"textAlign")||jt(t,["image"])?!1:t.can().setTextAlign(e)}function BE(t){return"setTextAlign"in t}function _E(t,e){return!t||!t.isEditable?!1:t.isActive({textAlign:e})}function HE(t,e){if(!t||!t.isEditable||!Xc(t,e))return!1;const n=t.chain().focus();return BE(n)?n.setTextAlign(e).run():!1}function FE(t){const{editor:e,hideWhenUnavailable:n,align:r}=t;return!e||!e.isEditable||!ls(e,"textAlign")?!1:n&&!e.isActive("code")?Xc(e,r):!0}function $E(t){const{editor:e,align:n,hideWhenUnavailable:r=!1,onAligned:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Xc(i,n),c=_E(i,n);y.useEffect(()=>{if(!i)return;const d=()=>{l(FE({editor:i,align:n,hideWhenUnavailable:r}))};return d(),i.on("selectionUpdate",d),()=>{i.off("selectionUpdate",d)}},[i,r,n]);const u=y.useCallback(()=>{if(!i)return!1;const d=HE(i,n);return d&&o?.(),d},[i,n,o]);return{isVisible:s,isActive:c,handleTextAlign:u,canAlign:a,label:jE[n],shortcutKeys:b0[n],Icon:PE[n]}}function VE({action:t,shortcutKeys:e=w0[t]}){return g.jsx(vt,{children:gt({shortcutKeys:e})})}const _i=y.forwardRef(({editor:t,action:e,text:n,hideWhenUnavailable:r=!1,onExecuted:o,showShortcut:i=!1,onClick:s,children:l,...a},c)=>{const{editor:u}=ie(t),{isVisible:d,handleAction:f,label:h,canExecute:p,Icon:m,shortcutKeys:v}=qE({editor:u,action:e,hideWhenUnavailable:r,onExecuted:o}),b=y.useCallback(C=>{s?.(C),!C.defaultPrevented&&f()},[f,s]);return d?g.jsx(fe,{type:"button",disabled:!p,"data-style":"ghost","data-disabled":!p,role:"button",tabIndex:-1,"aria-label":h,tooltip:h,onClick:b,...a,ref:c,children:l??g.jsxs(g.Fragment,{children:[g.jsx(m,{className:"tiptap-button-icon"}),n&&g.jsx("span",{className:"tiptap-button-text",children:n}),i&&g.jsx(VE,{action:e,shortcutKeys:v})]})}):null});_i.displayName="UndoRedoButton";const C0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.7071 2.29289C15.3166 1.90237 14.6834 1.90237 14.2929 2.29289C13.9024 2.68342 13.9024 3.31658 14.2929 3.70711L17.5858 7H9.5C7.77609 7 6.12279 7.68482 4.90381 8.90381C3.68482 10.1228 3 11.7761 3 13.5C3 14.3536 3.16813 15.1988 3.49478 15.9874C3.82144 16.7761 4.30023 17.4926 4.90381 18.0962C6.12279 19.3152 7.77609 20 9.5 20H13C13.5523 20 14 19.5523 14 19C14 18.4477 13.5523 18 13 18H9.5C8.30653 18 7.16193 17.5259 6.31802 16.682C5.90016 16.2641 5.56869 15.768 5.34254 15.2221C5.1164 14.6761 5 14.0909 5 13.5C5 12.3065 5.47411 11.1619 6.31802 10.318C7.16193 9.47411 8.30653 9 9.5 9H17.5858L14.2929 12.2929C13.9024 12.6834 13.9024 13.3166 14.2929 13.7071C14.6834 14.0976 15.3166 14.0976 15.7071 13.7071L20.7071 8.70711C21.0976 8.31658 21.0976 7.68342 20.7071 7.29289L15.7071 2.29289Z",fill:"currentColor"})}));C0.displayName="Redo2Icon";const x0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.70711 3.70711C10.0976 3.31658 10.0976 2.68342 9.70711 2.29289C9.31658 1.90237 8.68342 1.90237 8.29289 2.29289L3.29289 7.29289C2.90237 7.68342 2.90237 8.31658 3.29289 8.70711L8.29289 13.7071C8.68342 14.0976 9.31658 14.0976 9.70711 13.7071C10.0976 13.3166 10.0976 12.6834 9.70711 12.2929L6.41421 9H14.5C15.0909 9 15.6761 9.1164 16.2221 9.34254C16.768 9.56869 17.2641 9.90016 17.682 10.318C18.0998 10.7359 18.4313 11.232 18.6575 11.7779C18.8836 12.3239 19 12.9091 19 13.5C19 14.0909 18.8836 14.6761 18.6575 15.2221C18.4313 15.768 18.0998 16.2641 17.682 16.682C17.2641 17.0998 16.768 17.4313 16.2221 17.6575C15.6761 17.8836 15.0909 18 14.5 18H11C10.4477 18 10 18.4477 10 19C10 19.5523 10.4477 20 11 20H14.5C15.3536 20 16.1988 19.8319 16.9874 19.5052C17.7761 19.1786 18.4926 18.6998 19.0962 18.0962C19.6998 17.4926 20.1786 16.7761 20.5052 15.9874C20.8319 15.1988 21 14.3536 21 13.5C21 12.6464 20.8319 11.8012 20.5052 11.0126C20.1786 10.2239 19.6998 9.50739 19.0962 8.90381C18.4926 8.30022 17.7761 7.82144 16.9874 7.49478C16.1988 7.16813 15.3536 7 14.5 7H6.41421L9.70711 3.70711Z",fill:"currentColor"})}));x0.displayName="Undo2Icon";const w0={undo:"mod+z",redo:"mod+shift+z"},zE={undo:"Undo",redo:"Redo"},UE={undo:x0,redo:C0};function Qc(t,e){return!t||!t.isEditable||jt(t,["image"])?!1:e==="undo"?t.can().undo():t.can().redo()}function WE(t,e){if(!t||!t.isEditable||!Qc(t,e))return!1;const n=t.chain().focus();return e==="undo"?n.undo().run():n.redo().run()}function KE(t){const{editor:e,hideWhenUnavailable:n,action:r}=t;return!e||!e.isEditable?!1:n&&!e.isActive("code")?Qc(e,r):!0}function qE(t){const{editor:e,action:n,hideWhenUnavailable:r=!1,onExecuted:o}=t,{editor:i}=ie(e),[s,l]=y.useState(!0),a=Qc(i,n);y.useEffect(()=>{if(!i)return;const u=()=>{l(KE({editor:i,hideWhenUnavailable:r,action:n}))};return u(),i.on("transaction",u),()=>{i.off("transaction",u)}},[i,r,n]);const c=y.useCallback(()=>{if(!i)return!1;const u=WE(i,n);return u&&o?.(),u},[i,n,o]);return{isVisible:s,handleAction:c,canExecute:a,label:zE[n],shortcutKeys:w0[n],Icon:UE[n]}}const S0=y.memo(({className:t,...e})=>g.jsx("svg",{width:"24",height:"24",className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:g.jsx("path",{d:"M12.7071 5.70711C13.0976 5.31658 13.0976 4.68342 12.7071 4.29289C12.3166 3.90237 11.6834 3.90237 11.2929 4.29289L4.29289 11.2929C3.90237 11.6834 3.90237 12.3166 4.29289 12.7071L11.2929 19.7071C11.6834 20.0976 12.3166 20.0976 12.7071 19.7071C13.0976 19.3166 13.0976 18.6834 12.7071 18.2929L7.41421 13L19 13C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11L7.41421 11L12.7071 5.70711Z",fill:"currentColor"})}));S0.displayName="ArrowLeftIcon";var bl,xf;function GE(){if(xf)return bl;xf=1;var t="Expected a function",e=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt,a=typeof co=="object"&&co&&co.Object===Object&&co,c=typeof self=="object"&&self&&self.Object===Object&&self,u=a||c||Function("return this")(),d=Object.prototype,f=d.toString,h=Math.max,p=Math.min,m=function(){return u.Date.now()};function v(k,S,M){var N,P,z,U,H,I,_=0,F=!1,L=!1,T=!0;if(typeof k!="function")throw new TypeError(t);S=E(S)||0,C(M)&&(F=!!M.leading,L="maxWait"in M,z=L?h(E(M.maxWait)||0,S):z,T="trailing"in M?!!M.trailing:T);function R(te){var Ke=N,bt=P;return N=P=void 0,_=te,U=k.apply(bt,Ke),U}function W(te){return _=te,H=setTimeout(Z,S),F?R(te):U}function ee(te){var Ke=te-I,bt=te-_,Bn=S-Ke;return L?p(Bn,z-bt):Bn}function K(te){var Ke=te-I,bt=te-_;return I===void 0||Ke>=S||Ke<0||L&&bt>=z}function Z(){var te=m();if(K(te))return We(te);H=setTimeout(Z,ee(te))}function We(te){return H=void 0,T&&N?R(te):(N=P=void 0,U)}function le(){H!==void 0&&clearTimeout(H),_=0,N=I=P=H=void 0}function ge(){return H===void 0?U:We(m())}function Y(){var te=m(),Ke=K(te);if(N=arguments,P=this,I=te,Ke){if(H===void 0)return W(I);if(L)return H=setTimeout(Z,S),R(I)}return H===void 0&&(H=setTimeout(Z,S)),U}return Y.cancel=le,Y.flush=ge,Y}function b(k,S,M){var N=!0,P=!0;if(typeof k!="function")throw new TypeError(t);return C(M)&&(N="leading"in M?!!M.leading:N,P="trailing"in M?!!M.trailing:P),v(k,S,{leading:N,maxWait:S,trailing:P})}function C(k){var S=typeof k;return!!k&&(S=="object"||S=="function")}function x(k){return!!k&&typeof k=="object"}function w(k){return typeof k=="symbol"||x(k)&&f.call(k)==n}function E(k){if(typeof k=="number")return k;if(w(k))return e;if(C(k)){var S=typeof k.valueOf=="function"?k.valueOf():k;k=C(S)?S+"":S}if(typeof k!="string")return k===0?k:+k;k=k.replace(r,"");var M=i.test(k);return M||s.test(k)?l(k.slice(2),M?2:8):o.test(k)?e:+k}return bl=b,bl}var JE=GE();const ZE=Sf(JE),YE=t=>{const e=j.useRef(t);e.current=t,j.useEffect(()=>()=>{e.current()},[])},XE={leading:!1,trailing:!0};function k0(t,e=250,n=[],r=XE){const o=y.useMemo(()=>ZE(t,e,r),n);return YE(()=>{o.cancel()}),o}function eu(){const[t,e]=y.useState({width:0,height:0,offsetTop:0,offsetLeft:0,scale:0}),n=k0(()=>{if(typeof window>"u")return;const r=window.visualViewport;if(!r)return;const{width:o=0,height:i=0,offsetTop:s=0,offsetLeft:l=0,scale:a=0}=r;e(c=>o===c.width&&i===c.height&&s===c.offsetTop&&l===c.offsetLeft&&a===c.scale?c:{width:o,height:i,offsetTop:s,offsetLeft:l,scale:a})},200);return y.useEffect(()=>{const r=window.visualViewport;if(r)return r.addEventListener("resize",n),n(),()=>{r.removeEventListener("resize",n)}},[n]),t}const Io={x:0,y:0,width:0,height:0,top:0,right:0,bottom:0,left:0},E0=typeof window>"u",QE=!E0&&typeof ResizeObserver<"u",Vo=()=>!E0;function eM({element:t,enabled:e=!0,throttleMs:n=100,useResizeObserver:r=!0}={}){const[o,i]=y.useState(Io),s=y.useCallback(()=>!e||!Vo()?null:t?typeof t=="string"?document.querySelector(t):"current"in t?t.current:t:document.body,[t,e]),l=k0(()=>{if(!e||!Vo())return;const a=s();if(!a){i(Io);return}const c=a.getBoundingClientRect();i({x:c.x,y:c.y,width:c.width,height:c.height,top:c.top,right:c.right,bottom:c.bottom,left:c.left})},n,[e,s],{leading:!0,trailing:!0});return y.useEffect(()=>{if(!e||!Vo()){i(Io);return}const a=s();if(!a)return;l();const c=[];if(r&&QE){const d=new ResizeObserver(()=>{window.requestAnimationFrame(l)});d.observe(a),c.push(()=>d.disconnect())}const u=()=>l();return window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u,{passive:!0}),c.push(()=>{window.removeEventListener("scroll",u),window.removeEventListener("resize",u)}),()=>{c.forEach(d=>d()),i(Io)}},[e,s,l,r]),o}function tM(t={}){return eM({...t,element:Vo()?document.body:null})}function nM({editor:t,overlayHeight:e=0}){const{height:n}=eu(),r=tM({enabled:!0,throttleMs:100,useResizeObserver:!0});return y.useEffect(()=>{(()=>{if(!t)return;const{state:i,view:s}=t;if(!s.hasFocus())return;const{from:l}=i.selection,a=s.coordsAtPos(l);if(n<r.height&&a&&n-a.top<e){const u=Math.max(n/2,e),d=window.scrollY,h=a.top+d-u;window.scrollTo({top:Math.max(0,h),behavior:"smooth"})}})()},[t,e,n,r.height]),r}const rM=({onHighlighterClick:t,onLinkClick:e,isMobile:n})=>g.jsxs(g.Fragment,{children:[g.jsx(rf,{}),g.jsxs(Kt,{children:[g.jsx(_i,{action:"undo"}),g.jsx(_i,{action:"redo"})]}),g.jsx(qt,{}),g.jsxs(Kt,{children:[g.jsx(Pc,{levels:[1,2,3,4],portal:n}),g.jsx(Ng,{types:["bulletList","orderedList","taskList"],portal:n}),g.jsx(Vc,{}),g.jsx(Uc,{})]}),g.jsx(qt,{}),g.jsxs(Kt,{children:[g.jsx(gn,{type:"bold"}),g.jsx(gn,{type:"italic"}),g.jsx(gn,{type:"strike"}),g.jsx(gn,{type:"code"}),g.jsx(gn,{type:"underline"}),n?g.jsx(Jc,{onClick:t}):g.jsx(CE,{}),n?g.jsx(Zc,{onClick:e}):g.jsx(r0,{})]}),g.jsx(qt,{}),g.jsxs(Kt,{children:[g.jsx(Zn,{align:"left"}),g.jsx(Zn,{align:"center"}),g.jsx(Zn,{align:"right"}),g.jsx(Zn,{align:"justify"})]}),g.jsx(qt,{}),g.jsx(Kt,{children:g.jsx(jc,{text:"Add"})}),g.jsx(rf,{}),n&&g.jsx(qt,{})]}),oM=({type:t,onBack:e})=>g.jsxs(g.Fragment,{children:[g.jsx(Kt,{children:g.jsxs(fe,{"data-style":"ghost",onClick:e,children:[g.jsx(S0,{className:"tiptap-button-icon"}),t==="highlighter"?g.jsx(ys,{className:"tiptap-button-icon"}):g.jsx(bs,{className:"tiptap-button-icon"})]})}),g.jsx(qt,{}),t==="highlighter"?g.jsx(Xg,{}):g.jsx(SE,{})]});function iM(t){const e=hr(),{height:n}=eu(),[r,o]=j.useState("main"),i=j.useRef(null),s=WC({content:t.value,immediatelyRender:!1,shouldRerenderOnTransaction:!1,onUpdate:({editor:a})=>{a&&t.onChange(a.getHTML())},editorProps:{attributes:{autocomplete:"off",autocorrect:"off",autocapitalize:"off","aria-label":"Main content area, start typing to enter text.",class:"simple-editor"}},extensions:[s3,r3.configure({type:"resizableImage",accept:"image/*",maxSize:1*1024*1024*1024,upload:(a,c,u)=>Promise.resolve(t.onUploadImage?.(a,c,u)||"")}),cm,am,Bw.configure({horizontalRule:!1,link:{openOnClick:!1,enableClickSelection:!0}}),o3,_w.configure({types:["heading","paragraph","resizableImage"]}),em,Qp.configure({nested:!0}),u7.configure({multicolor:!0}),l7,f7,d7,Dw,x7.configure({attributeName:"id",generateID:()=>`tiptap-editor-${t.id||ox()}`})]}),l=nM({editor:s,overlayHeight:i.current?.getBoundingClientRect().height??0});return j.useEffect(()=>{!e&&r!=="main"&&o("main")},[e,r]),j.useEffect(()=>()=>{s&&s.commands.clearContent()},[s]),g.jsx("div",{className:"simple-editor-wrapper",children:g.jsxs(qa.Provider,{value:{editor:s},children:[g.jsx(pc,{ref:i,style:{...e?{bottom:`calc(100% - ${n-l.y}px)`}:{}},children:r==="main"?g.jsx(rM,{onHighlighterClick:()=>o("highlighter"),onLinkClick:()=>o("link"),isMobile:e}):g.jsx(oM,{type:r==="highlighter"?"highlighter":"link",onBack:()=>o("main")})}),g.jsx(FC,{editor:s,className:"simple-editor-content"})]})})}exports.BlockquoteButton=Vc;exports.Button=fe;exports.Card=fr;exports.CodeBlockButton=Uc;exports.HeadingDropdownMenu=Pc;exports.ImageUploadButton=jc;exports.ListDropdownMenu=Ng;exports.MAX_FILE_SIZE=la;exports.MarkButton=gn;exports.TextAlignButton=Zn;exports.TiptapEditor=iM;exports.Toolbar=pc;exports.ToolbarGroup=Kt;exports.ToolbarSeparator=qt;exports.UndoRedoButton=_i;exports.onUploadImage=z5;exports.useIsMobile=hr;exports.useTiptapEditor=ie;exports.useWindowSize=eu;
214
214
  //# sourceMappingURL=index.cjs.map