@opengis/richtext 0.0.24 → 0.0.25
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-W-qQIppj-BsopI3Hz.js +2383 -0
- package/dist/richtext.js +15068 -8807
- package/dist/richtext.umd.cjs +55 -39
- package/package.json +8 -2
package/dist/richtext.umd.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(function(mt,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],f):(mt=typeof globalThis<"u"?globalThis:mt||self,f(mt.richtext={},mt.Vue))})(this,(function(mt,f){"use strict";function Ae(t){this.content=t}Ae.prototype={constructor:Ae,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),s=r.content.slice();return o==-1?s.push(n||t,e):(s[o+1]=e,n&&(s[o]=n)),new Ae(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ae(n)},addToStart:function(t,e){return new Ae([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ae(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),s=r.find(t);return o.splice(s==-1?o.length:s,0,e,n),new Ae(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=Ae.from(t),t.size?new Ae(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ae.from(t),t.size?new Ae(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ae.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}},Ae.from=function(t){if(t instanceof Ae)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ae(e)};function ba(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),s=e.child(r);if(o==s){n+=o.nodeSize;continue}if(!o.sameMarkup(s))return n;if(o.isText&&o.text!=s.text){for(let i=0;o.text[i]==s.text[i];i++)n++;return n}if(o.content.size||s.content.size){let i=ba(o.content,s.content,n+1);if(i!=null)return i}n+=o.nodeSize}}function ka(t,e,n,r){for(let o=t.childCount,s=e.childCount;;){if(o==0||s==0)return o==s?null:{a:n,b:r};let i=t.child(--o),l=e.child(--s),a=i.nodeSize;if(i==l){n-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:n,b:r};if(i.isText&&i.text!=l.text){let c=0,d=Math.min(i.text.length,l.text.length);for(;c<d&&i.text[i.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(i.content.size||l.content.size){let c=ka(i.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class v{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,s){for(let i=0,l=0;l<n;i++){let a=this.content[i],c=l+a.nodeSize;if(c>e&&r(a,o+l,s||null,i)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,n-d),r,o+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let s="",i=!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&&(i?i=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)o.push(e.content[s]);return new v(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 s=0,i=0;i<n;s++){let l=this.content[s],a=i+l.nodeSize;a>e&&((i<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,n-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,n-i-1))),r.push(l),o+=l.nodeSize),i=a}return new v(r,o)}cutByIndex(e,n){return e==n?v.empty:e==0&&n==this.content.length?this:new v(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new v(o,s)}addToStart(e){return new v([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new v(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 ba(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return ka(this,e,n,r)}findIndex(e){if(e==0)return Jr(0,e);if(e==this.size)return Jr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),s=r+o.nodeSize;if(s>=e)return s==e?Jr(n+1,s):Jr(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return v.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new v(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return v.empty;let n,r=0;for(let o=0;o<e.length;o++){let s=e[o];r+=s.nodeSize,o&&s.isText&&e[o-1].sameMarkup(s)?(n||(n=e.slice(0,o)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new v(n||e,r)}static from(e){if(!e)return v.empty;if(e instanceof v)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new v([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}v.empty=new v([],0);const Fs={index:0,offset:0};function Jr(t,e){return Fs.index=t,Fs.offset=e,Fs}function Yr(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(!Yr(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Yr(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let oe=class ma{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let s=e[o];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,o));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(s)}}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&&Yr(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 ma.none;if(e instanceof ma)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};oe.none=[];class Xr extends Error{}class L{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=Ea(this.content,e+this.openStart,n);return r&&new L(r,this.openStart,this.openEnd)}removeBetween(e,n){return new L(xa(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 L.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 L(v.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)o++;return new L(e,r,o)}}L.empty=new L(v.empty,0,0);function xa(t,e,n){let{index:r,offset:o}=t.findIndex(e),s=t.maybeChild(r),{index:i,offset:l}=t.findIndex(n);if(o==e||s.isText){if(l!=n&&!t.child(i).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=i)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(xa(s.content,e-o-1,n-o-1)))}function Ea(t,e,n,r){let{index:o,offset:s}=t.findIndex(e),i=t.maybeChild(o);if(s==e||i.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Ea(i.content,e-s-1,n,i);return l&&t.replaceChild(o,i.copy(l))}function hp(t,e,n){if(n.openStart>t.depth)throw new Xr("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Xr("Inconsistent open depths");return wa(t,e,n,0)}function wa(t,e,n,r){let o=t.index(r),s=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let i=wa(t,e,n,r+1);return s.copy(s.content.replaceChild(o,i))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let i=t.parent,l=i.content;return un(i,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=pp(n,t);return un(s,Sa(t,i,l,e,r))}else return un(s,Qr(t,e,r))}function Ca(t,e){if(!e.type.compatibleContent(t.type))throw new Xr("Cannot join "+e.type.name+" onto "+t.type.name)}function Vs(t,e,n){let r=t.node(n);return Ca(r,e.node(n)),r}function dn(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 sr(t,e,n,r){let o=(e||t).node(n),s=0,i=e?e.index(n):o.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(dn(t.nodeAfter,r),s++));for(let l=s;l<i;l++)dn(o.child(l),r);e&&e.depth==n&&e.textOffset&&dn(e.nodeBefore,r)}function un(t,e){return t.type.checkContent(e),t.copy(e)}function Sa(t,e,n,r,o){let s=t.depth>o&&Vs(t,e,o+1),i=r.depth>o&&Vs(n,r,o+1),l=[];return sr(null,t,o,l),s&&i&&e.index(o)==n.index(o)?(Ca(s,i),dn(un(s,Sa(t,e,n,r,o+1)),l)):(s&&dn(un(s,Qr(t,e,o+1)),l),sr(e,n,o,l),i&&dn(un(i,Qr(n,r,o+1)),l)),sr(r,null,o,l),new v(l)}function Qr(t,e,n){let r=[];if(sr(null,t,n,r),t.depth>n){let o=Vs(t,e,n+1);dn(un(o,Qr(t,e,n+1)),r)}return sr(e,null,n,r),new v(r)}function pp(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)o=e.node(s).copy(v.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class ir{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 s=0;s<e;s++)o+=r.child(s).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return oe.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let l=r;r=o,o=l}let s=r.marks;for(var i=0;i<s.length;i++)s[i].type.spec.inclusive===!1&&(!o||!s[i].isInSet(o.marks))&&(s=s[i--].removeFromSet(s));return s}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 s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.marks))&&(r=r[s--].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 Zr(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,s=n;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(s),c=s-a;if(r.push(i,l,o+a),!c||(i=i.child(l),i.isText))break;s=c-1,o+=a+1}return new ir(n,r,s)}static resolveCached(e,n){let r=Ta.get(e);if(r)for(let s=0;s<r.elts.length;s++){let i=r.elts[s];if(i.pos==n)return i}else Ta.set(e,r=new mp);let o=r.elts[r.i]=ir.resolve(e,n);return r.i=(r.i+1)%gp,o}}class mp{constructor(){this.elts=[],this.i=0}}const gp=12,Ta=new WeakMap;class Zr{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const yp=Object.create(null);let Ft=class ga{constructor(e,n,r,o=oe.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||v.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&&Yr(this.attrs,n||e.defaultAttrs||yp)&&oe.sameSet(this.marks,r||oe.none)}copy(e=null){return e==this.content?this:new ga(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ga(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 L.empty;let o=this.resolve(e),s=this.resolve(n),i=r?0:o.sharedDepth(n),l=o.start(i),c=o.node(i).content.cut(o.pos-l,s.pos-l);return new L(c,o.depth-i,s.depth-i)}replace(e,n,r){return hp(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 ir.resolveCached(this,e)}resolveNoCache(e){return ir.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.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()+")"),Na(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=v.empty,o=0,s=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,o,s),l=i&&i.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<s;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 s=this.contentMatchAt(e).matchType(r),i=s&&s.matchFragment(this.content,n);return i?i.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=oe.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!oe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=v.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,o,r);return s.type.checkAttrs(s.attrs),s}};Ft.prototype.text=void 0;class eo extends Ft{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):Na(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 eo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new eo(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 Na(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class fn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new bp(e,n);if(r.next==null)return fn.empty;let o=va(r);r.next&&r.err("Unexpected trailing text");let s=Tp(Sp(o));return Np(s,r),s}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 s=n;o&&s<r;s++)o=o.matchType(e.child(s).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 s(i,l){let a=i.matchFragment(e,r);if(a&&(!n||a.validEnd))return v.from(l.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:d,next:u}=i.next[c];if(!(d.isText||d.hasRequiredAttrs())&&o.indexOf(u)==-1){o.push(u);let h=s(u,l.concat(d));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let 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(),s=o.match;if(s.matchType(e)){let i=[];for(let l=o;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<s.next.length;i++){let{type:l,next:a}=s.next[i];!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 s=o+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)s+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return s}).join(`
|
|
2
|
-
`)}}fn.empty=new fn(!0);class bp{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 va(t){let e=[];do e.push(kp(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function kp(t){let e=[];do e.push(xp(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function xp(t){let e=Cp(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=Ep(t,e);else break;return e}function _a(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Ep(t,e){let n=_a(t),r=n;return t.eat(",")&&(t.next!="}"?r=_a(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function wp(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let s in n){let i=n[s];i.isInGroup(e)&&o.push(i)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function Cp(t){if(t.eat("(")){let e=va(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=wp(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 Sp(t){let e=[[]];return o(s(t,0),n()),e;function n(){return e.push([])-1}function r(i,l,a){let c={term:a,to:l};return e[i].push(c),c}function o(i,l){i.forEach(a=>a.to=l)}function s(i,l){if(i.type=="choice")return i.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(i.type=="seq")for(let a=0;;a++){let c=s(i.exprs[a],l);if(a==i.exprs.length-1)return c;o(c,l=n())}else if(i.type=="star"){let a=n();return r(l,a),o(s(i.expr,a),a),[r(a)]}else if(i.type=="plus"){let a=n();return o(s(i.expr,l),a),o(s(i.expr,a),a),[r(a)]}else{if(i.type=="opt")return[r(l)].concat(s(i.expr,l));if(i.type=="range"){let a=l;for(let c=0;c<i.min;c++){let d=n();o(s(i.expr,a),d),a=d}if(i.max==-1)o(s(i.expr,a),a);else for(let c=i.min;c<i.max;c++){let d=n();r(a,d),o(s(i.expr,a),d),a=d}return[r(a)]}else{if(i.type=="name")return[r(l,void 0,i.value)];throw new Error("Unknown expr type")}}}}function Ma(t,e){return e-t}function Aa(t,e){let n=[];return r(e),n.sort(Ma);function r(o){let s=t[o];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(o);for(let i=0;i<s.length;i++){let{term:l,to:a}=s[i];!l&&n.indexOf(a)==-1&&r(a)}}}function Tp(t){let e=Object.create(null);return n(Aa(t,0));function n(r){let o=[];r.forEach(i=>{t[i].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<o.length;d++)o[d][0]==l&&(c=o[d][1]);Aa(t,a).forEach(d=>{c||o.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let s=e[r.join(",")]=new fn(r.indexOf(t.length-1)>-1);for(let i=0;i<o.length;i++){let l=o[i][1].sort(Ma);s.next.push({type:o[i][0],next:e[l.join(",")]||n(l)})}return s}}function Np(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],s=!o.validEnd,i=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];i.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Oa(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 La(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let s=t[r];if(s.hasDefault)o=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function Ia(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 s=t[o];s.validate&&s.validate(e[o])}}function Da(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new _p(t,r,e[r]);return n}let Ra=class ap{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=Da(e,r.attrs),this.defaultAttrs=Oa(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==fn.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:La(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ft(this,this.computeAttrs(e),v.from(n),oe.setFrom(r))}createChecked(e=null,n,r){return n=v.from(n),this.checkContent(n),new Ft(this,this.computeAttrs(e),n,oe.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=v.from(n),n.size){let i=this.contentMatch.fillBefore(n);if(!i)return null;n=i.append(n)}let o=this.contentMatch.matchFragment(n),s=o&&o.fillBefore(v.empty,!0);return s?new Ft(this,e,n.append(s),oe.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ia(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:oe.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,i)=>r[s]=new ap(s,n,i));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 s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function vp(t,e,n){let r=n.split("|");return o=>{let s=o===null?"null":typeof o;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class _p{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?vp(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class to{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=Da(e,o.attrs),this.excluded=null;let s=Oa(this.attrs);this.instance=s?new oe(this,s):null}create(e=null){return!e&&this.instance?this.instance:new oe(this,La(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((s,i)=>r[s]=new to(s,o++,n,i)),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){Ia(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Pa{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=Ae.from(e.nodes),n.marks=Ae.from(e.marks||{}),this.nodes=Ra.compile(this.spec.nodes,this),this.marks=to.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 s=this.nodes[o],i=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[i]||(r[i]=fn.parse(i,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?Ba(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let o in this.marks){let s=this.marks[o],i=s.spec.excludes;s.excluded=i==null?[s]:i==""?[]:Ba(this,i.split(" "))}this.nodeFromJSON=o=>Ft.fromJSON(this,o),this.markFromJSON=o=>oe.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 Ra){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 eo(r,r.defaultAttrs,e,oe.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Ba(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],s=t.marks[o],i=s;if(s)n.push(s);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(i=a)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function Mp(t){return t.tag!=null}function Ap(t){return t.style!=null}let Rn=class ya{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(Mp(o))this.tags.push(o);else if(Ap(o)){let s=/[^=]*/.exec(o.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let s=e.nodes[o.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new Ha(this,n,!1);return r.addAll(e,oe.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Ha(this,n,!0);return r.addAll(e,oe.none,n.from,n.to),L.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let s=this.tags[o];if(Ip(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let i=s.getAttrs(e);if(i===!1)continue;s.attrs=i||void 0}return s}}}matchStyle(e,n,r,o){for(let s=o?this.styles.indexOf(o)+1:0;s<this.styles.length;s++){let i=this.styles[s],l=i.style;if(!(l.indexOf(e)!=0||i.context&&!r.matchesContext(i.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(i.getAttrs){let a=i.getAttrs(n);if(a===!1)continue;i.attrs=a||void 0}return i}}}static schemaRules(e){let n=[];function r(o){let s=o.priority==null?50:o.priority,i=0;for(;i<n.length;i++){let l=n[i];if((l.priority==null?50:l.priority)<s)break}n.splice(i,0,o)}for(let o in e.marks){let s=e.marks[o].spec.parseDOM;s&&s.forEach(i=>{r(i=za(i)),i.mark||i.ignore||i.clearMark||(i.mark=o)})}for(let o in e.nodes){let s=e.nodes[o].spec.parseDOM;s&&s.forEach(i=>{r(i=za(i)),i.node||i.ignore||i.mark||(i.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ya(e,ya.schemaRules(e)))}};const Fa={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},Op={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Va={ol:!0,ul:!0},lr=1,$s=2,ar=4;function $a(t,e,n){return e!=null?(e?lr:0)|(e==="full"?$s:0):t&&t.whitespace=="pre"?lr|$s:n&~ar}class no{constructor(e,n,r,o,s,i){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=i,this.content=[],this.activeMarks=oe.none,this.match=s||(i&ar?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(v.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&lr)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-o[0].length))}}let n=v.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(v.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&&!Fa.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ha{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,s,i=$a(null,n.preserveWhitespace,0)|(r?ar:0);o?s=new no(o.type,o.attrs,oe.none,!0,n.topMatch||o.type.contentMatch,i):r?s=new no(null,null,oe.none,!0,null,i):s=new no(e.schema.topNodeType,null,oe.none,!0,null,i),this.nodes=[s],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,s=o.options&$s?"full":this.localPreserveWS||(o.options&lr)>0;if(s==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)s!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
|
|
3
|
-
`);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let
|
|
4
|
-
`),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 s=this.parser.matchedStyles[o],i=r.getPropertyValue(s);if(i)for(let l=void 0;;){let a=this.parser.matchStyle(s,i,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 s,i;if(n.node)if(i=this.parser.schema.nodes[n.node],i.isLeaf)this.insertNode(i.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(i,n.attrs||null,r,n.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(i&&i.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)}s&&this.sync(l)&&this.open--}addAll(e,n,r,o){let s=r||0;for(let i=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];i!=l;i=i.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(i,n);this.findAtPoint(e,s)}findPlace(e,n,r){let o,s;for(let i=this.open,l=0;i>=0;i--){let a=this.nodes[i],c=a.findWrapping(e);if(c&&(!o||o.length>c.length+l)&&(o=c,s=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(s);for(let i=0;i<o.length;i++)n=this.enterInner(o[i],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let i=oe.none;for(let l of o.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):Ua(l.type,e.type))&&(i=l.addToSet(i));return s.content.push(e.mark(i)),!0}return!1}enter(e,n,r,o){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,o)),s}enterInner(e,n,r,o=!1,s){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let l=$a(e,s,i.options);i.options&ar&&i.content.length==0&&(l|=ar);let a=oe.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):Ua(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new no(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|=lr)}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),s=-(r?r.depth+1:0)+(o?0:1),i=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=s;a--)if(i(l-1,a))return!0;return!1}else{let d=a>0||a==0&&o?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return i(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 Lp(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Va.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Ip(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function za(t){let e={};for(let n in t)e[n]=t[n];return e}function Ua(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let s=[],i=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||s.indexOf(d)<0&&i(d))return!0}};if(i(o.contentMatch))return!0}}class hn{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Hs(n).createDocumentFragment());let o=r,s=[];return e.forEach(i=>{if(s.length||i.marks.length){let l=0,a=0;for(;l<s.length&&a<i.marks.length;){let c=i.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)o=s.pop()[1];for(;a<i.marks.length;){let c=i.marks[a++],d=this.serializeMark(c,i.isInline,n);d&&(s.push([c,o]),o.appendChild(d.dom),o=d.contentDOM||d.dom)}}o.appendChild(this.serializeNodeInner(i,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=ro(Hs(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 s=this.serializeMark(e.marks[o],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&ro(Hs(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return ro(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new hn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=ja(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return ja(e.marks)}}function ja(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Hs(t){return t.document||window.document}const Wa=new WeakMap;function Dp(t){let e=Wa.get(t);return e===void 0&&Wa.set(t,e=Rp(t)),e}function Rp(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 ro(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],s;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=Dp(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));let l,a=n?t.createElementNS(n,o):t.createElement(o),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?a.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):u=="style"&&a.style?a.style.cssText=c[u]:a.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let h=e[u];if(h===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:p,contentDOM:m}=ro(t,h,n,r);if(a.appendChild(p),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const Ka=65535,qa=Math.pow(2,16);function Pp(t,e){return t+e*qa}function Ga(t){return t&Ka}function Bp(t){return(t-(t&Ka))/qa}const Ja=1,Ya=2,oo=4,Xa=8;class zs{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Xa)>0}get deletedBefore(){return(this.delInfo&(Ja|oo))>0}get deletedAfter(){return(this.delInfo&(Ya|oo))>0}get deletedAcross(){return(this.delInfo&oo)>0}}class Je{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Je.empty)return Je.empty}recover(e){let n=0,r=Ga(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+Bp(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,s=this.inverted?2:1,i=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+s],d=this.ranges[l+i],u=a+c;if(e<=u){let h=c?e==a?-1:e==u?1:n:n,p=a+o+(h<0?0:d);if(r)return p;let m=e==(n<0?a:u)?null:Pp(l/3,e-a),g=e==a?Ya:e==u?Ja:oo;return(n<0?e!=a:e!=u)&&(g|=Xa),new zs(p,g,m)}o+=d-c}return r?e+o:new zs(e+o,0,null)}touches(e,n){let r=0,o=Ga(n),s=this.inverted?2:1,i=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+s],d=a+c;if(e<=d&&l==o*3)return!0;r+=this.ranges[l+i]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,s=0;o<this.ranges.length;o+=3){let i=this.ranges[o],l=i-(this.inverted?s:0),a=i+(this.inverted?0:s),c=this.ranges[o+n],d=this.ranges[o+r];e(l,l+c,a,a+d),s+=d-c}}invert(){return new Je(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Je.empty:new Je(e<0?[0,-e,0]:[0,0,e])}}Je.empty=new Je([]);class cr{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 cr(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 cr;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 s=this.from;s<this.to;s++){let i=this._maps[s],l=i.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new zs(e,o,null)}}const Us=Object.create(null);class Ie{getMap(){return Je.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Us[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 Us)throw new RangeError("Duplicate use of step JSON ID "+e);return Us[e]=n,n.prototype.jsonID=e,n}}class xe{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new xe(e,null)}static fail(e){return new xe(null,e)}static fromReplace(e,n,r,o){try{return xe.ok(e.replace(n,r,o))}catch(s){if(s instanceof Xr)return xe.fail(s.message);throw s}}}function js(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let s=t.child(o);s.content.size&&(s=s.copy(js(s.content,e,s))),s.isInline&&(s=e(s,n,o)),r.push(s)}return v.fromArray(r)}class Vt extends Ie{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)),s=new L(js(n.content,(i,l)=>!i.isAtom||!l.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),o),n.openStart,n.openEnd);return xe.fromReplace(e,this.from,this.to,s)}invert(){return new ct(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 Vt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Vt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Vt(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 Vt(n.from,n.to,e.markFromJSON(n.mark))}}Ie.jsonID("addMark",Vt);class ct extends Ie{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 L(js(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return xe.fromReplace(e,this.from,this.to,r)}invert(){return new Vt(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 ct(n.pos,r.pos,this.mark)}merge(e){return e instanceof ct&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ct(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ct(n.from,n.to,e.markFromJSON(n.mark))}}Ie.jsonID("removeMark",ct);class $t extends Ie{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return xe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return xe.fromReplace(e,this.pos,this.pos+1,new L(v.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 $t(this.pos,n.marks[o]);return new $t(this.pos,this.mark)}}return new pn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new $t(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 $t(n.pos,e.markFromJSON(n.mark))}}Ie.jsonID("addNodeMark",$t);class pn extends Ie{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return xe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return xe.fromReplace(e,this.pos,this.pos+1,new L(v.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new $t(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new pn(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 pn(n.pos,e.markFromJSON(n.mark))}}Ie.jsonID("removeNodeMark",pn);class Te extends Ie{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&Ws(e,this.from,this.to)?xe.fail("Structure replace would overwrite content"):xe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Je([this.from,this.to-this.from,this.slice.size])}invert(e){return new Te(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 Te(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Te)||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?L.empty:new L(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Te(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?L.empty:new L(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Te(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 Te(n.from,n.to,L.fromJSON(e,n.slice),!!n.structure)}}Ie.jsonID("replace",Te);class Ne extends Ie{constructor(e,n,r,o,s,i,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=i,this.structure=l}apply(e){if(this.structure&&(Ws(e,this.from,this.gapFrom)||Ws(e,this.gapTo,this.to)))return xe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return xe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?xe.fromReplace(e,this.from,this.to,r):xe.fail("Content does not fit in gap")}getMap(){return new Je([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 Ne(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),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||s>r.pos?null:new Ne(n.pos,r.pos,o,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,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 Ne(n.from,n.to,n.gapFrom,n.gapTo,L.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ie.jsonID("replaceAround",Ne);function Ws(t,e,n){let r=t.resolve(e),o=n-e,s=r.depth;for(;o>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,o--;if(o>0){let i=r.node(s).maybeChild(r.indexAfter(s));for(;o>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,o--}}return!1}function Fp(t,e,n,r){let o=[],s=[],i,l;t.doc.nodesBetween(e,n,(a,c,d)=>{if(!a.isInline)return;let u=a.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let h=Math.max(c,e),p=Math.min(c+a.nodeSize,n),m=r.addToSet(u);for(let g=0;g<u.length;g++)u[g].isInSet(m)||(i&&i.to==h&&i.mark.eq(u[g])?i.to=p:o.push(i=new ct(h,p,u[g])));l&&l.to==h?l.to=p:s.push(l=new Vt(h,p,r))}}),o.forEach(a=>t.step(a)),s.forEach(a=>t.step(a))}function Vp(t,e,n,r){let o=[],s=0;t.doc.nodesBetween(e,n,(i,l)=>{if(!i.isInline)return;s++;let a=null;if(r instanceof to){let c=i.marks,d;for(;d=r.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(i.marks)&&(a=[r]):a=i.marks;if(a&&a.length){let c=Math.min(l+i.nodeSize,n);for(let d=0;d<a.length;d++){let u=a[d],h;for(let p=0;p<o.length;p++){let m=o[p];m.step==s-1&&u.eq(o[p].style)&&(h=m)}h?(h.to=c,h.step=s):o.push({style:u,from:Math.max(l,e),to:c,step:s})}}}),o.forEach(i=>t.step(new ct(i.from,i.to,i.style)))}function Ks(t,e,n,r=n.contentMatch,o=!0){let s=t.doc.nodeAt(e),i=[],l=e+1;for(let a=0;a<s.childCount;a++){let c=s.child(a),d=l+c.nodeSize,u=r.matchType(c.type);if(!u)i.push(new Te(l,d,L.empty));else{r=u;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new ct(l,d,c.marks[h]));if(o&&c.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(c.text);)m||(m=new L(v.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),i.push(new Te(l+h.index,l+h.index+h[0].length,m))}}l=d}if(!r.validEnd){let a=r.fillBefore(v.empty,!0);t.replace(l,l,new L(a,0,0))}for(let a=i.length-1;a>=0;a--)t.step(i[a])}function $p(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Pn(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let o=t.$from.node(r),s=t.$from.index(r),i=t.$to.indexAfter(r);if(r<t.depth&&o.canReplace(s,i,n))return r;if(r==0||o.type.spec.isolating||!$p(o,s,i))break}return null}function Hp(t,e,n){let{$from:r,$to:o,depth:s}=e,i=r.before(s+1),l=o.after(s+1),a=i,c=l,d=v.empty,u=0;for(let m=s,g=!1;m>n;m--)g||r.index(m)>0?(g=!0,d=v.from(r.node(m).copy(d)),u++):a--;let h=v.empty,p=0;for(let m=s,g=!1;m>n;m--)g||o.after(m+1)<o.end(m)?(g=!0,h=v.from(o.node(m).copy(h)),p++):c++;t.step(new Ne(a,c,i,l,new L(d.append(h),u,p),d.size-u,!0))}function qs(t,e,n=null,r=t){let o=zp(t,e),s=o&&Up(r,e);return s?o.map(Qa).concat({type:e,attrs:n}).concat(s.map(Qa)):null}function Qa(t){return{type:t,attrs:null}}function zp(t,e){let{parent:n,startIndex:r,endIndex:o}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let i=s.length?s[0]:e;return n.canReplaceWith(r,o,i)?s:null}function Up(t,e){let{parent:n,startIndex:r,endIndex:o}=t,s=n.child(r),i=e.contentMatch.findWrapping(s.type);if(!i)return null;let a=(i.length?i[i.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:i}function jp(t,e,n){let r=v.empty;for(let i=n.length-1;i>=0;i--){if(r.size){let l=n[i].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=v.from(n[i].type.create(n[i].attrs,r))}let o=e.start,s=e.end;t.step(new Ne(o,s,o,s,new L(r,0,0),n.length,!0))}function Wp(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(i,l)=>{let a=typeof o=="function"?o(i):o;if(i.isTextblock&&!i.hasMarkup(r,a)&&Kp(t.doc,t.mapping.slice(s).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?c=!1:!p&&m&&(c=!0)}c===!1&&ec(t,i,l,s),Ks(t,t.mapping.slice(s).map(l,1),r,void 0,c===null);let d=t.mapping.slice(s),u=d.map(l,1),h=d.map(l+i.nodeSize,1);return t.step(new Ne(u,h,u+1,h-1,new L(v.from(r.create(a,null,i.marks)),0,0),1,!0)),c===!0&&Za(t,i,l,s),!1}})}function Za(t,e,n,r){e.forEach((o,s)=>{if(o.isText){let i,l=/\r?\n|\r/g;for(;i=l.exec(o.text);){let a=t.mapping.slice(r).map(n+1+s+i.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function ec(t,e,n,r){e.forEach((o,s)=>{if(o.type==o.type.schema.linebreakReplacement){let i=t.mapping.slice(r).map(n+1+s);t.replaceWith(i,i+1,e.type.schema.text(`
|
|
5
|
-
`))}})}function Kp(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function qp(t,e,n,r,o){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let i=n.create(r,null,o||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,i);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ne(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new L(v.from(i),0,0),1,!0))}function Nt(t,e,n=1,r){let o=t.resolve(e),s=o.depth-n,i=r&&r[r.length-1]||o.parent;if(s<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!i.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,d=n-2;c>s;c--,d--){let u=o.node(c),h=o.index(c);if(u.type.spec.isolating)return!1;let p=u.content.cutByIndex(h,u.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[d]||u;if(!u.canReplace(h+1,u.childCount)||!g.type.validContent(p))return!1}let l=o.indexAfter(s),a=r&&r[0];return o.node(s).canReplaceWith(l,l,a?a.type:o.node(s+1).type)}function Gp(t,e,n=1,r){let o=t.doc.resolve(e),s=v.empty,i=v.empty;for(let l=o.depth,a=o.depth-n,c=n-1;l>a;l--,c--){s=v.from(o.node(l).copy(s));let d=r&&r[c];i=v.from(d?d.type.create(d.attrs,i):o.node(l).copy(i))}t.step(new Te(e,e,new L(s.append(i),n,n),!0))}function Ht(t,e){let n=t.resolve(e),r=n.index();return tc(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Jp(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 s=e.child(o),i=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(i),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function tc(t,e){return!!(t&&e&&!t.isLeaf&&Jp(t,e))}function so(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let s,i,l=r.index(o);if(o==r.depth?(s=r.nodeBefore,i=r.nodeAfter):n>0?(s=r.node(o+1),l++,i=r.node(o).maybeChild(l)):(s=r.node(o).maybeChild(l-1),i=r.node(o+1)),s&&!s.isTextblock&&tc(s,i)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function Yp(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,s=t.doc.resolve(e-n),i=s.node().type;if(o&&i.inlineContent){let d=i.whitespace=="pre",u=!!i.contentMatch.matchType(o);d&&!u?r=!1:!d&&u&&(r=!0)}let l=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);ec(t,d.node(),d.before(),l)}i.inlineContent&&Ks(t,e+n-1,i,s.node().contentMatchAt(s.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new Te(c,a.map(e+n,-1),L.empty,!0)),r===!0){let d=t.doc.resolve(c);Za(t,d.node(),d.before(),t.steps.length)}return t}function Xp(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 s=r.index(o);if(r.node(o).canReplaceWith(s,s,n))return r.before(o+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let s=r.indexAfter(o);if(r.node(o).canReplaceWith(s,s,n))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function nc(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let s=0;s<n.openStart;s++)o=o.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let i=r.depth;i>=0;i--){let l=i==r.depth?0:r.pos<=(r.start(i+1)+r.end(i+1))/2?-1:1,a=r.index(i)+(l>0?1:0),c=r.node(i),d=!1;if(s==1)d=c.canReplace(a,a,o);else{let u=c.contentMatchAt(a).findWrapping(o.firstChild.type);d=u&&c.canReplaceWith(a,a,u[0])}if(d)return l==0?r.pos:l<0?r.before(i+1):r.after(i+1)}return null}function io(t,e,n=e,r=L.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),s=t.resolve(n);return rc(o,s,r)?new Te(e,n,r):new Qp(o,s,r).fit()}function rc(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Qp{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=v.empty;for(let o=0;o<=e.depth;o++){let s=e.node(o);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=v.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 s=this.placed,i=r.depth,l=o.depth;for(;i&&l&&s.childCount==1;)s=s.firstChild.content,i--,l--;let a=new L(s,i,l);return e>-1?new Ne(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new Te(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 s=n.firstChild;if(n.childCount>1&&(o=0),s.type.spec.isolating&&o<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,s=null;r?(s=Gs(this.unplaced.content,r-1).firstChild,o=s.content):o=this.unplaced.content;let i=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,u=null;if(n==1&&(i?c.matchType(i.type)||(u=c.fillBefore(v.from(i),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:u};if(n==2&&i&&(d=c.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:d};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Gs(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new L(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=Gs(e,n);if(o.childCount<=1&&n>0){let s=e.size-n<=n+o.size;this.unplaced=new L(dr(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new L(dr(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let i=this.unplaced,l=r?r.content:i.content,a=i.openStart-e,c=0,d=[],{match:u,type:h}=this.frontier[n];if(o){for(let g=0;g<o.childCount;g++)d.push(o.child(g));u=u.matchFragment(o)}let p=l.size+e-(i.content.size-i.openEnd);for(;c<l.childCount;){let g=l.child(c),y=u.matchType(g.type);if(!y)break;c++,(c>1||a==0||g.content.size)&&(u=y,d.push(oc(g.mark(h.allowedMarks(g.marks)),c==1?a:0,c==l.childCount?p:-1)))}let m=c==l.childCount;m||(p=-1),this.placed=ur(this.placed,n,v.from(d)),this.frontier[n].match=u,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<p;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?L.empty:new L(dr(i.content,e-1,1),e-1,p<0?i.openEnd:e-1):new L(dr(i.content,e,c),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Js(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],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),i=Js(e,n,o,r,s);if(i){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],d=Js(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:n,fit:i,move:s?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=ur(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),s=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,s)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=ur(this.placed,this.depth,v.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(v.empty,!0);n.childCount&&(this.placed=ur(this.placed,this.frontier.length,n))}}function dr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(dr(t.firstChild.content,e-1,n)))}function ur(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(ur(t.lastChild.content,e-1,n)))}function Gs(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function oc(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,oc(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(v.empty,!0)))),t.copy(r)}function Js(t,e,n,r,o){let s=t.node(e),i=o?t.indexAfter(e):t.index(e);if(i==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,i);return l&&!Zp(n,s.content,i)?l:null}function Zp(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function em(t){return t.spec.defining||t.spec.definingForContent}function tm(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),s=t.doc.resolve(n);if(rc(o,s,r))return t.step(new Te(e,n,r));let i=ic(o,t.doc.resolve(n));i[i.length-1]==0&&i.pop();let l=-(o.depth+1);i.unshift(l);for(let h=o.depth,p=o.pos-1;h>0;h--,p--){let m=o.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;i.indexOf(h)>-1?l=h:o.before(h)==p&&i.splice(1,0,-h)}let a=i.indexOf(l),c=[],d=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(c.push(m),p==r.openStart)break;h=m.content}for(let h=d-1;h>=0;h--){let p=c[h],m=em(p.type);if(m&&!p.sameMarkup(o.node(Math.abs(l)-1)))d=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+d+1)%(r.openStart+1),m=c[p];if(m)for(let g=0;g<i.length;g++){let y=i[(g+a)%i.length],b=!0;y<0&&(b=!1,y=-y);let k=o.node(y-1),w=o.index(y-1);if(k.canReplaceWith(w,w,m.type,m.marks))return t.replace(o.before(y),b?s.after(y):n,new L(sc(r.content,0,r.openStart,p),p,r.openEnd))}}let u=t.steps.length;for(let h=i.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>u));h--){let p=i[h];p<0||(e=o.before(p),n=s.after(p))}}function sc(t,e,n,r,o){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(sc(s.content,e+1,n,r,s)))}if(e>r){let s=o.contentMatchAt(0),i=s.fillBefore(t).append(t);t=i.append(s.matchFragment(i).fillBefore(v.empty,!0))}return t}function nm(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=Xp(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new L(v.from(r),0,0))}function rm(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),s=ic(r,o);for(let i=0;i<s.length;i++){let l=s[i],a=i==s.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 i=1;i<=r.depth&&i<=o.depth;i++)if(e-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i&&r.start(i-1)==o.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),o.index(i-1)))return t.delete(r.before(i),n);t.delete(e,n)}function ic(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let s=t.start(o);if(s<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;(s==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==s-1)&&n.push(o)}return n}class Bn extends Ie{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return xe.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return xe.fromReplace(e,this.pos,this.pos+1,new L(v.from(o),0,n.isLeaf?0:1))}getMap(){return Je.empty}invert(e){return new Bn(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 Bn(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 Bn(n.pos,n.attr,n.value)}}Ie.jsonID("attr",Bn);class fr extends Ie{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 xe.ok(r)}getMap(){return Je.empty}invert(e){return new fr(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 fr(n.attr,n.value)}}Ie.jsonID("docAttr",fr);let Fn=class extends Error{};Fn=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Fn.prototype=Object.create(Error.prototype),Fn.prototype.constructor=Fn,Fn.prototype.name="TransformError";class Ys{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new cr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Fn(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=L.empty){let o=io(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new L(v.from(r),0,0))}delete(e,n){return this.replace(e,n,L.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return tm(this,e,n,r),this}replaceRangeWith(e,n,r){return nm(this,e,n,r),this}deleteRange(e,n){return rm(this,e,n),this}lift(e,n){return Hp(this,e,n),this}join(e,n=1){return Yp(this,e,n),this}wrap(e,n){return jp(this,e,n),this}setBlockType(e,n=e,r,o=null){return Wp(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return qp(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Bn(e,n,r)),this}setDocAttribute(e,n){return this.step(new fr(e,n)),this}addNodeMark(e,n){return this.step(new $t(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof oe)n.isInSet(r.marks)&&this.step(new pn(e,n));else{let o=r.marks,s,i=[];for(;s=n.isInSet(o);)i.push(new pn(e,s)),o=s.removeFromSet(o);for(let l=i.length-1;l>=0;l--)this.step(i[l])}return this}split(e,n=1,r){return Gp(this,e,n,r),this}addMark(e,n,r){return Fp(this,e,n,r),this}removeMark(e,n,r){return Vp(this,e,n,r),this}clearIncompatible(e,n,r){return Ks(this,e,n,r),this}}const Xs=Object.create(null);class z{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new lc(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=L.empty){let r=n.content.lastChild,o=null;for(let l=0;l<n.openEnd;l++)o=r,r=r.lastChild;let s=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){let{$from:a,$to:c}=i[l],d=e.mapping.slice(s);e.replaceRange(d.map(a.pos),d.map(c.pos),l?L.empty:n),l==0&&dc(e,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:i,$to:l}=o[s],a=e.mapping.slice(r),c=a.map(i.pos),d=a.map(l.pos);s?e.deleteRange(c,d):(e.replaceRangeWith(c,d,n),dc(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new H(e):Vn(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let s=e.depth-1;s>=0;s--){let i=n<0?Vn(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Vn(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(i)return i}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Ye(e.node(0))}static atStart(e){return Vn(e,e,0,0,1)||new Ye(e)}static atEnd(e){return Vn(e,e,e.content.size,e.childCount,-1)||new Ye(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Xs[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 Xs)throw new RangeError("Duplicate use of selection JSON ID "+e);return Xs[e]=n,n.prototype.jsonID=e,n}getBookmark(){return H.between(this.$anchor,this.$head).getBookmark()}}z.prototype.visible=!0;class lc{constructor(e,n){this.$from=e,this.$to=n}}let ac=!1;function cc(t){!ac&&!t.parent.inlineContent&&(ac=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class H extends z{constructor(e,n=e){cc(e),cc(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 z.near(r);let o=e.resolve(n.map(this.anchor));return new H(o.parent.inlineContent?o:r,r)}replace(e,n=L.empty){if(super.replace(e,n),n==L.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof H&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new lo(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 H(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 s=z.findFrom(n,r,!0)||z.findFrom(n,-r,!0);if(s)n=s.$head;else return z.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(z.findFrom(e,-r,!0)||z.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new H(e,n)}}z.jsonID("text",H);class lo{constructor(e,n){this.anchor=e,this.head=n}map(e){return new lo(e.map(this.anchor),e.map(this.head))}resolve(e){return H.between(e.resolve(this.anchor),e.resolve(this.head))}}class $ extends z{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),s=e.resolve(o);return r?z.near(s):new $(s)}content(){return new L(v.from(this.node),0,0)}eq(e){return e instanceof $&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Qs(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new $(e.resolve(n.anchor))}static create(e,n){return new $(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}$.prototype.visible=!1,z.jsonID("node",$);class Qs{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new lo(r,r):new Qs(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&$.isSelectable(r)?new $(n):z.near(n)}}class Ye extends z{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=L.empty){if(n==L.empty){e.delete(0,e.doc.content.size);let r=z.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ye(e)}map(e){return new Ye(e)}eq(e){return e instanceof Ye}getBookmark(){return om}}z.jsonID("all",Ye);const om={map(){return this},resolve(t){return new Ye(t)}};function Vn(t,e,n,r,o,s=!1){if(e.inlineContent)return H.create(t,n);for(let i=r-(o>0?0:1);o>0?i<e.childCount:i>=0;i+=o){let l=e.child(i);if(l.isAtom){if(!s&&$.isSelectable(l))return $.create(t,n-(o<0?l.nodeSize:0))}else{let a=Vn(t,l,n+o,o<0?l.childCount:0,o,s);if(a)return a}n+=l.nodeSize*o}return null}function dc(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof Te||o instanceof Ne))return;let s=t.mapping.maps[r],i;s.forEach((l,a,c,d)=>{i==null&&(i=d)}),t.setSelection(z.near(t.doc.resolve(i),n))}const uc=1,ao=2,fc=4;class sm extends Ys{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|uc)&~ao,this.storedMarks=null,this}get selectionSet(){return(this.updated&uc)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ao,this}ensureMarks(e){return oe.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&ao)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ao,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||oe.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let i=this.doc.resolve(n);s=r==n?i.marks():i.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,s)),this.selection.empty||this.setSelection(z.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|=fc,this}get scrolledIntoView(){return(this.updated&fc)>0}}function hc(t,e){return!e||!t?t:t.bind(e)}class hr{constructor(e,n,r){this.name=e,this.init=hc(n.init,r),this.apply=hc(n.apply,r)}}const im=[new hr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new hr("selection",{init(t,e){return t.selection||z.atStart(e.doc)},apply(t){return t.selection}}),new hr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new hr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Zs{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=im.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 hr(r.key,r.spec.state,r))})}}class $n{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,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 s=!1;for(let i=0;i<this.config.plugins.length;i++){let l=this.config.plugins[i];if(l.spec.appendTransaction){let a=o?o[i].n:0,c=o?o[i].state:this,d=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(d&&r.filterTransaction(d,i)){if(d.setMeta("appendedTransaction",e),!o){o=[];for(let u=0;u<this.config.plugins.length;u++)o.push(u<i?{state:r,n:n.length}:{state:this,n:0})}n.push(d),r=r.applyInner(d),s=!0}o&&(o[i]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new $n(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let s=r[o];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new sm(this)}static create(e){let n=new Zs(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new $n(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 Zs(this.schema,e.plugins),r=n.fields,o=new $n(n);for(let s=0;s<r.length;s++){let i=r[s].name;o[i]=this.hasOwnProperty(i)?this[i]:r[s].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],s=o.spec.state;s&&s.toJSON&&(n[r]=s.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 Zs(e.schema,e.plugins),s=new $n(o);return o.fields.forEach(i=>{if(i.name=="doc")s.doc=Ft.fromJSON(e.schema,n.doc);else if(i.name=="selection")s.selection=z.fromJSON(s.doc,n.selection);else if(i.name=="storedMarks")n.storedMarks&&(s.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==i.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){s[i.name]=c.fromJSON.call(a,e,n[l],s);return}}s[i.name]=i.init(e,s)}}),s}}function pc(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=pc(o,e,{})),n[r]=o}return n}class ue{constructor(e){this.spec=e,this.props={},e.props&&pc(e.props,this,this.props),this.key=e.key?e.key.key:mc("plugin")}getState(e){return e[this.key]}}const ei=Object.create(null);function mc(t){return t in ei?t+"$"+ ++ei[t]:(ei[t]=0,t+"$")}class ye{constructor(e="key"){this.key=mc(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Oe=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Hn=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let ti=null;const vt=function(t,e,n){let r=ti||(ti=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},lm=function(){ti=null},mn=function(t,e,n,r){return n&&(gc(t,e,n,r,-1)||gc(t,e,n,r,1))},am=/^(img|br|input|textarea|hr)$/i;function gc(t,e,n,r,o){for(var s;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Ze(t))){let i=t.parentNode;if(!i||i.nodeType!=1||pr(t)||am.test(t.nodeName)||t.contentEditable=="false")return!1;e=Oe(t)+(o<0?0:1),t=i}else if(t.nodeType==1){let i=t.childNodes[e+(o<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")if(!((s=i.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=o;else return!1;else t=i,e=o<0?Ze(t):0}else return!1}}function Ze(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function cm(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=Ze(t)}else if(t.parentNode&&!pr(t))e=Oe(t),t=t.parentNode;else return null}}function dm(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&&!pr(t))e=Oe(t)+1,t=t.parentNode;else return null}}function um(t,e,n){for(let r=e==0,o=e==Ze(t);r||o;){if(t==n)return!0;let s=Oe(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,o=o&&s==Ze(t)}}function pr(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 co=function(t){return t.focusNode&&mn(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 fm(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function hm(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ze(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ze(r.startContainer),r.startOffset)}}}const gt=typeof navigator<"u"?navigator:null,yc=typeof document<"u"?document:null,zt=gt&>.userAgent||"",ni=/Edge\/(\d+)/.exec(zt),bc=/MSIE \d/.exec(zt),ri=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(zt),We=!!(bc||ri||ni),Ut=bc?document.documentMode:ri?+ri[1]:ni?+ni[1]:0,et=!We&&/gecko\/(\d+)/i.test(zt);et&&+(/Firefox\/(\d+)/.exec(zt)||[0,0])[1];const oi=!We&&/Chrome\/(\d+)/.exec(zt),De=!!oi,kc=oi?+oi[1]:0,$e=!We&&!!gt&&/Apple Computer/.test(gt.vendor),zn=$e&&(/Mobile\/\w+/.test(zt)||!!gt&>.maxTouchPoints>2),tt=zn||(gt?/Mac/.test(gt.platform):!1),pm=gt?/Win/.test(gt.platform):!1,_t=/Android \d/.test(zt),mr=!!yc&&"webkitFontSmoothing"in yc.documentElement.style,mm=mr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function gm(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 Mt(t,e){return typeof t=="number"?t:t[e]}function ym(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 xc(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let i=n||t.dom;i;){if(i.nodeType!=1){i=Hn(i);continue}let l=i,a=l==s.body,c=a?gm(s):ym(l),d=0,u=0;if(e.top<c.top+Mt(r,"top")?u=-(c.top-e.top+Mt(o,"top")):e.bottom>c.bottom-Mt(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+Mt(o,"top")-c.top:e.bottom-c.bottom+Mt(o,"bottom")),e.left<c.left+Mt(r,"left")?d=-(c.left-e.left+Mt(o,"left")):e.right>c.right-Mt(r,"right")&&(d=e.right-c.right+Mt(o,"right")),d||u)if(a)s.defaultView.scrollBy(d,u);else{let p=l.scrollLeft,m=l.scrollTop;u&&(l.scrollTop+=u),d&&(l.scrollLeft+=d);let g=l.scrollLeft-p,y=l.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let h=a?"fixed":getComputedStyle(i).position;if(/^(fixed|sticky)$/.test(h))break;i=h=="absolute"?i.offsetParent:Hn(i)}}function bm(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let s=(e.left+e.right)/2,i=n+1;i<Math.min(innerHeight,e.bottom);i+=5){let l=t.root.elementFromPoint(s,i);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:Ec(t.dom)}}function Ec(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Hn(r));return e}function km({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;wc(n,r==0?0:r-e)}function wc(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:s}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Un=null;function xm(t){if(t.setActive)return t.setActive();if(Un)return t.focus(Un);let e=Ec(t);t.focus(Un==null?{get preventScroll(){return Un={preventScroll:!0},!0}}:void 0),Un||(Un=!1,wc(e,0))}function Cc(t,e){let n,r=2e8,o,s=0,i=e.top,l=e.top,a,c;for(let d=t.firstChild,u=0;d;d=d.nextSibling,u++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=vt(d).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=i&&m.bottom>=l){i=Math.max(m.bottom,i),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){n=d,r=g,o=g&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(s=u+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!a&&m.left<=e.left&&m.right>=e.left&&(a=d,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=u+1)}}return!n&&a&&(n=a,o=c,r=0),n&&n.nodeType==3?Em(n,o):!n||r&&n.nodeType==1?{node:t,offset:s}:Cc(n,o)}function Em(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 s=jt(r,1);if(s.top!=s.bottom&&si(e,s))return{node:t,offset:o+(e.left>=(s.left+s.right)/2?1:0)}}return{node:t,offset:0}}function si(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function wm(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Cm(t,e,n){let{node:r,offset:o}=Cc(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let i=r.getBoundingClientRect();s=i.left!=i.right&&n.left>(i.left+i.right)/2?1:-1}return t.docView.posFromDOM(r,o,s)}function Sm(t,e,n,r){let o=-1;for(let s=e,i=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!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)&&(!i&&a.left>r.left||a.top>r.top?o=l.posBefore:(!i&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),i=!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;s=l.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function Sc(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)),s=o;;){let i=t.childNodes[s];if(i.nodeType==1){let l=i.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(si(e,c))return Sc(i,e,c)}}if((s=(s+1)%r)==o)break}return t}function Tm(t,e){let n=t.dom.ownerDocument,r,o=0,s=hm(n,e.left,e.top);s&&({node:r,offset:o}=s);let i=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!i||!t.dom.contains(i.nodeType!=1?i.parentNode:i)){let c=t.dom.getBoundingClientRect();if(!si(e,c)||(i=Sc(t.dom,e,c),!i))return null}if($e)for(let c=i;r&&c;c=Hn(c))c.draggable&&(r=void 0);if(i=wm(i,e),r){if(et&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let d=r.childNodes[o],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&o++}let c;mr&&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=Sm(t,r,o,e))}l==null&&(l=Cm(t,i,e));let a=t.docView.nearestDesc(i,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Tc(t){return t.top<t.bottom||t.left<t.right}function jt(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Tc(r))return r}return Array.prototype.find.call(n,Tc)||t.getBoundingClientRect()}const Nm=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Nc(t,e,n){let{node:r,offset:o,atom:s}=t.docView.domFromPos(e,n<0?-1:1),i=mr||et;if(r.nodeType==3)if(i&&(Nm.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=jt(vt(r,o,o),n);if(et&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=jt(vt(r,o-1,o-1),-1);if(c.top==a.top){let d=jt(vt(r,o,o+1),-1);if(d.top!=a.top)return gr(d,d.left<c.left)}}return a}else{let a=o,c=o,d=n<0?1:-1;return n<0&&!o?(c++,d=-1):n>=0&&o==r.nodeValue.length?(a--,d=1):n<0?a--:c++,gr(jt(vt(r,a,c),d),d<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(n<0||o==Ze(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return ii(a.getBoundingClientRect(),!1)}if(s==null&&o<Ze(r)){let a=r.childNodes[o];if(a.nodeType==1)return ii(a.getBoundingClientRect(),!0)}return ii(r.getBoundingClientRect(),n>=0)}if(s==null&&o&&(n<0||o==Ze(r))){let a=r.childNodes[o-1],c=a.nodeType==3?vt(a,Ze(a)-(i?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return gr(jt(c,1),!1)}if(s==null&&o<Ze(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?vt(a,0,i?0:1):a.nodeType==1?a:null:null;if(c)return gr(jt(c,-1),!0)}return gr(jt(r.nodeType==3?vt(r):r,-n),n>=0)}function gr(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 ii(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 vc(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 vm(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return vc(t,e,()=>{let{node:s}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let i=Nc(t,o.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=vt(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let d=a[c];if(d.bottom>d.top+1&&(n=="up"?i.top-d.top>(d.bottom-i.top)*2:d.bottom-i.bottom>(i.bottom-d.top)*2))return!1}}return!0})}const _m=/[\u0590-\u08ac]/;function Mm(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,s=!o,i=o==r.parent.content.size,l=t.domSelection();return l?!_m.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:i:vc(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:u}=t.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:g}=t.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||a==m&&c==g;try{l.collapse(d,u),a&&(a!=d||c!=u)&&l.extend&&l.extend(a,c)}catch{}return h!=null&&(l.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}let _c=null,Mc=null,Ac=!1;function Am(t,e,n){return _c==e&&Mc==n?Ac:(_c=e,Mc=n,Ac=n=="up"||n=="down"?vm(t,e,n):Mm(t,e,n))}const nt=0,Oc=1,yn=2,yt=3;class yr{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=nt,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 s,i;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(i)+i.size:this.posAtStart}else{let s,i;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(i):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>Oe(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 s=e;;s=s.parentNode){if(s==this.dom){o=!1;break}if(s.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!0;break}if(s.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 s=this.getDesc(o),i;if(s&&(!n||s.node))if(r&&(i=s.nodeDOM)&&!(i.nodeType==1?i.contains(e.nodeType==1?e:e.parentNode):i==e))r=!1;else return s}}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 s=this.getDesc(o);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],s=r+o.size;if(r==e&&s!=r){for(;!o.border&&o.children.length;)for(let i=0;i<o.children.length;i++){let l=o.children[i];if(l.size){o=l;break}}return o}if(e<s)return o.descAt(e-r-o.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let s=0;r<this.children.length;r++){let i=this.children[r],l=s+i.size;if(l>e||i instanceof Dc){o=e-s;break}s=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Lc&&s.side>=0;r--);if(n<=0){let s,i=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,i=!1);return s&&n&&i&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Oe(s.dom)+1:0}}else{let s,i=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,i=!1);return s&&i&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Oe(s.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,s=-1;for(let i=r,l=0;;l++){let a=this.children[l],c=i+a.size;if(o==-1&&e<=c){let d=i+a.border;if(e>=d&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,d);e=i;for(let u=l;u>0;u--){let h=this.children[u-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){o=Oe(h.dom)+1;break}e-=h.size}o==-1&&(o=0)}if(o>-1&&(c>n||l==this.children.length-1)){n=c;for(let d=l+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){s=Oe(u.dom);break}n+=u.size}s==-1&&(s=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:s}}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 s=Math.min(e,n),i=Math.max(e,n);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],y=m+g.size;if(s>m&&i<y)return g.setSelection(e-m-g.border,n-m-g.border,r,o);m=y}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),d=r.domSelectionRange(),u=!1;if((et||$e)&&e==n){let{node:p,offset:m}=l;if(p.nodeType==3){if(u=!!(m&&p.nodeValue[m-1]==`
|
|
6
|
-
`),u&&m==p.nodeValue.length)for(let g=p,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:Oe(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=p.childNodes[m-1];u=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(et&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(o=!0)}if(!(o||u&&$e)&&mn(l.node,l.offset,d.anchorNode,d.anchorOffset)&&mn(a.node,a.offset,d.focusNode,d.focusOffset))return;let h=!1;if((c.extend||e==n)&&!(u&&et)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),h=!0}catch{}}if(!h){if(e>n){let m=l;l=a,a=m}let p=document.createRange();p.setEnd(a.node,a.offset),p.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(p)}}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 s=this.children[o],i=r+s.size;if(r==i?e<=i&&n>=r:e<i&&n>r){let l=r+s.border,a=i-s.border;if(e>=l&&n<=a){this.dirty=e==r||n==i?yn:Oc,e==l&&n==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=yt:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?yn:yt}r=i}this.dirty=yn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?yn:Oc;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Lc extends yr{constructor(e,n,r,o){let s,i=n.type.toDOM;if(typeof i=="function"&&(i=i(r,()=>{if(!s)return o;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(i.nodeType!=1){let l=document.createElement("span");l.appendChild(i),i=l}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==nt&&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 Om extends yr{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 bn extends yr{constructor(e,n,r,o,s){super(e,[],r,o),this.mark=n,this.spec=s}static create(e,n,r,o){let s=o.nodeViews[n.type.name],i=s&&s(n,o,r);return(!i||!i.dom)&&(i=hn.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new bn(e,n,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&yt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=yt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=nt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=nt}}slice(e,n,r){let o=bn.create(this.parent,this.mark,!0,r),s=this.children,i=this.size;n<i&&(s=ai(s,n,i,r)),e>0&&(s=ai(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=o;return o.children=s,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Wt extends yr{constructor(e,n,r,o,s,i,l,a,c){super(e,[],s,i),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,n,r,o,s,i){let l=s.nodeViews[n.type.name],a,c=l&&l(n,s,()=>{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)},r,o),d=c&&c.dom,u=c&&c.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=hn.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!u&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let h=d;return d=Bc(d,r,n),c?a=new Lm(e,n,r,o,d,u||null,h,c,s,i+1):n.isText?new uo(e,n,r,o,d,h,s):new Wt(e,n,r,o,d,u||null,h,s,i+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=()=>v.empty)}return e}matchesNode(e,n,r){return this.dirty==nt&&e.eq(this.node)&&fo(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,s=e.composing?this.localCompositionInfo(e,n):null,i=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new Dm(this,i&&i.node,e);Bm(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!u&&a.syncToMarks(d==this.node.childCount?oe.none:this.node.child(d).marks,r,e),a.placeWidget(c,e,o)},(c,d,u,h)=>{a.syncToMarks(c.marks,r,e);let p;a.findNodeMatch(c,d,u,h)||l&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(p=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(c,d,u,p,e)||a.updateNextNode(c,d,u,e,h,o)||a.addNode(c,d,u,e,o),o+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==yn)&&(i&&this.protectLocalComposition(e,i),Rc(this.contentDOM,this.children,e),zn&&Fm(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof H)||r<n||o>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let i=s.nodeValue,l=Vm(this.node.content,i,r-n,o-n);return l<0?null:{node:s,pos:l,text:i}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let i=new Om(this,s,n,o);e.input.compositionNodes.push(i),this.children=ai(this.children,r,r+o.length,e,i)}update(e,n,r,o){return this.dirty==yt||!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=nt}updateOuterDeco(e){if(fo(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Pc(this.dom,this.nodeDOM,li(this.outerDeco,this.node,n),li(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 Ic(t,e,n,r,o){Bc(r,e,t);let s=new Wt(void 0,t,e,n,r,r,r,o,0);return s.contentDOM&&s.updateChildren(o,0),s}class uo extends Wt{constructor(e,n,r,o,s,i,l){super(e,n,r,o,s,null,i,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==yt||this.dirty!=nt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=nt||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=nt,!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),s=document.createTextNode(o.text);return new uo(this.parent,o,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=yt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Dc extends yr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==nt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Lm extends Wt{constructor(e,n,r,o,s,i,l,a,c,d){super(e,n,r,o,s,i,l,c,d),this.spec=a}update(e,n,r,o){if(this.dirty==yt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,o),s}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 Rc(t,e,n){let r=t.firstChild,o=!1;for(let s=0;s<e.length;s++){let i=e[s],l=i.dom;if(l.parentNode==t){for(;l!=r;)r=Fc(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(l,r);if(i instanceof bn){let a=r?r.previousSibling:t.lastChild;Rc(i.contentDOM,i.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=Fc(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const br=function(t){t&&(this.nodeName=t)};br.prototype=Object.create(null);const kn=[new br];function li(t,e,n){if(t.length==0)return kn;let r=n?kn[0]:new br,o=[r];for(let s=0;s<t.length;s++){let i=t[s].type.attrs;if(i){i.nodeName&&o.push(r=new br(i.nodeName));for(let l in i){let a=i[l];a!=null&&(n&&o.length==1&&o.push(r=new br(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 Pc(t,e,n,r){if(n==kn&&r==kn)return e;let o=e;for(let s=0;s<r.length;s++){let i=r[s],l=n[s];if(s){let a;l&&l.nodeName==i.nodeName&&o!=t&&(a=o.parentNode)&&a.nodeName.toLowerCase()==i.nodeName||(a=document.createElement(i.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=kn[0]),o=a}Im(o,l||kn[0],i)}return o}function Im(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 s=0;s<r.length;s++)o.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<o.length;s++)r.indexOf(o[s])==-1&&t.classList.add(o[s]);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 Bc(t,e,n){return Pc(t,t,kn,li(e,n,t.nodeType!=1))}function fo(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 Fc(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Dm{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Rm(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,s=this.stack.length>>1,i=Math.min(s,e.length);for(;o<i&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=nt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1;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[s])&&!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=bn.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,o){let s=-1,i;if(o>=this.preMatch.index&&(i=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&i.matchesNode(e,n,r))s=this.top.children.indexOf(i,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)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,o,s){let i=this.top.children[o];return i.dirty==yt&&i.dom==i.contentDOM&&(i.dirty=yn),i.update(e,n,r,s)?(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,s,i){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Wt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=s)return!1;let d=a.dom,u,h=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=yt&&fo(n,a.outerDeco));if(!h&&a.update(e,n,r,o))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(u=this.recreateWrapper(a,e,n,r,o,i)))return this.destroyBetween(this.index,l),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=yn,u.updateChildren(o,i+1),u.dirty=nt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,s,i){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!fo(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=Wt.create(this.top,n,r,o,s,i);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,s){let i=Wt.create(this.top,e,n,r,o,s);i.contentDOM&&i.updateChildren(o,s+1),this.top.children.splice(this.index++,0,i),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 s=new Lc(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof bn;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof uo)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&(($e||De)&&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 Dc(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 Rm(t,e){let n=e,r=n.children.length,o=t.childCount,s=new Map,i=[];e:for(;o>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof bn)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,s.set(l,o),i.push(l)}}return{index:o,matched:s,matches:i.reverse()}}function Pm(t,e){return t.type.side-e.type.side}function Bm(t,e,n,r){let o=e.locals(t),s=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let d=t.child(c);r(d,o,e.forChild(s,d),c),s+=d.nodeSize}return}let i=0,l=[],a=null;for(let c=0;;){let d,u;for(;i<o.length&&o[i].to==s;){let y=o[i++];y.widget&&(d?(u||(u=[d])).push(y):d=y)}if(d)if(u){u.sort(Pm);for(let y=0;y<u.length;y++)n(u[y],c,!!a)}else n(d,c,!!a);let h,p;if(a)p=-1,h=a,a=null;else if(c<t.childCount)p=c,h=t.child(c++);else break;for(let y=0;y<l.length;y++)l[y].to<=s&&l.splice(y--,1);for(;i<o.length&&o[i].from<=s&&o[i].to>s;)l.push(o[i++]);let m=s+h.nodeSize;if(h.isText){let y=m;i<o.length&&o[i].from<y&&(y=o[i].from);for(let b=0;b<l.length;b++)l[b].to<y&&(y=l[b].to);y<m&&(a=h.cut(y-s),h=h.cut(0,y-s),m=y,p=-1)}else for(;i<o.length&&o[i].to<m;)i++;let g=h.isInline&&!h.isLeaf?l.filter(y=>!y.inline):l.slice();r(h,g,e.forChild(s,h),p),s=m}}function Fm(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 Vm(t,e,n,r){for(let o=0,s=0;o<t.childCount&&s<=r;){let i=t.child(o++),l=s;if(s+=i.nodeSize,!i.isText)continue;let a=i.text;for(;o<t.childCount;){let c=t.child(o++);if(s+=c.nodeSize,!c.isText)break;a+=c.text}if(s>=n){if(s>=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 ai(t,e,n,r,o){let s=[];for(let i=0,l=0;i<t.length;i++){let a=t[i],c=l,d=l+=a.size;c>=n||d<=e?s.push(a):(c<e&&s.push(a.slice(0,e-c,r)),o&&(s.push(o),o=void 0),d>n&&s.push(a.slice(n-c,a.size,r)))}return s}function ci(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),s=o&&o.size==0,i=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(i<0)return null;let l=r.resolve(i),a,c;if(co(n)){for(a=i;o&&!o.node;)o=o.parent;let u=o.node;if(o&&u.isAtom&&$.isSelectable(u)&&o.parent&&!(u.isInline&&um(n.focusNode,n.focusOffset,o.dom))){let h=o.posBefore;c=new $(i==h?l:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let u=i,h=i;for(let p=0;p<n.rangeCount;p++){let m=n.getRangeAt(p);u=Math.min(u,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(u<0)return null;[a,i]=h==t.state.selection.anchor?[h,u]:[u,h],l=r.resolve(i)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);if(!c){let u=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;c=ui(t,d,l,u)}return c}function Vc(t){return t.editable?t.hasFocus():Kc(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function At(t,e=!1){let n=t.state.selection;if(Uc(t,n),!!Vc(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&De){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&mn(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Hm(t);else{let{anchor:r,head:o}=n,s,i;$c&&!(n instanceof H)&&(n.$from.parent.inlineContent||(s=Hc(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(i=Hc(t,n.to))),t.docView.setSelection(r,o,t,e),$c&&(s&&zc(s),i&&zc(i)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&$m(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const $c=$e||De&&kc<63;function Hc(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if($e&&o&&o.contentEditable=="false")return di(o);if((!o||o.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(o)return di(o);if(s)return di(s)}}function di(t){return t.contentEditable="true",$e&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function zc(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function $m(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(()=>{(!Vc(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Hm(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Oe(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&We&&Ut<=11&&(n.disabled=!0,n.disabled=!1)}function Uc(t,e){if(e instanceof $){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(jc(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else jc(t)}function jc(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ui(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||H.between(e,n,r)}function Wc(t){return t.editable&&!t.hasFocus()?!1:Kc(t)}function Kc(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 zm(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return mn(e.node,e.offset,n.anchorNode,n.anchorOffset)}function fi(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),s=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return s&&z.findFrom(s,e)}function Kt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function qc(t,e,n){let r=t.state.selection;if(r instanceof H)if(n.indexOf("s")>-1){let{$head:o}=r,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let i=t.state.doc.resolve(o.pos+s.nodeSize*(e<0?-1:1));return Kt(t,new H(r.$anchor,i))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=fi(t.state,e);return o&&o instanceof $?Kt(t,o):!1}else if(!(tt&&n.indexOf("m")>-1)){let o=r.$head,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,i;if(!s||s.isText)return!1;let l=e<0?o.pos-s.nodeSize:o.pos;return s.isAtom||(i=t.docView.descAt(l))&&!i.contentDOM?$.isSelectable(s)?Kt(t,new $(e<0?t.state.doc.resolve(o.pos-s.nodeSize):o)):mr?Kt(t,new H(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof $&&r.node.isInline)return Kt(t,new H(e>0?r.$to:r.$from));{let o=fi(t.state,e);return o?Kt(t,o):!1}}}function ho(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 jn(t,e){return e<0?Um(t):jm(t)}function Um(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,s,i=!1;for(et&&n.nodeType==1&&r<ho(n)&&kr(n.childNodes[r],-1)&&(i=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(kr(l,-1))o=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(Gc(n))break;{let l=n.previousSibling;for(;l&&kr(l,-1);)o=n.parentNode,s=Oe(l),l=l.previousSibling;if(l)n=l,r=ho(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}i?hi(t,n,r):o&&hi(t,o,s)}function jm(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=ho(n),s,i;for(;;)if(r<o){if(n.nodeType!=1)break;let l=n.childNodes[r];if(kr(l,1))s=n,i=++r;else break}else{if(Gc(n))break;{let l=n.nextSibling;for(;l&&kr(l,1);)s=l.parentNode,i=Oe(l)+1,l=l.nextSibling;if(l)n=l,r=0,o=ho(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}s&&hi(t,s,i)}function Gc(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Wm(t,e){for(;t&&e==t.childNodes.length&&!pr(t);)e=Oe(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 Km(t,e){for(;t&&!e&&!pr(t);)e=Oe(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 hi(t,e,n){if(e.nodeType!=3){let s,i;(i=Wm(e,n))?(e=i,n=0):(s=Km(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(co(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&At(t)},50)}function Jc(t,e){let n=t.state.doc.resolve(e);if(!(De||pm)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),i=(s.top+s.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(s.left-o.left)>1)return s.left<o.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),i=(s.top+s.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(s.left-o.left)>1)return s.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Yc(t,e,n){let r=t.state.selection;if(r instanceof H&&!r.empty||n.indexOf("s")>-1||tt&&n.indexOf("m")>-1)return!1;let{$from:o,$to:s}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let i=fi(t.state,e);if(i&&i instanceof $)return Kt(t,i)}if(!o.parent.inlineContent){let i=e<0?o:s,l=r instanceof Ye?z.near(i,e):z.findFrom(i,e);return l?Kt(t,l):!1}return!1}function Xc(t,e){if(!(t.state.selection instanceof H))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 s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let i=t.state.tr;return e<0?i.delete(n.pos-s.nodeSize,n.pos):i.delete(n.pos,n.pos+s.nodeSize),t.dispatch(i),!0}return!1}function Qc(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function qm(t){if(!$e||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;Qc(t,r,"true"),setTimeout(()=>Qc(t,r,"false"),20)}return!1}function Gm(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Jm(t,e){let n=e.keyCode,r=Gm(e);if(n==8||tt&&n==72&&r=="c")return Xc(t,-1)||jn(t,-1);if(n==46&&!e.shiftKey||tt&&n==68&&r=="c")return Xc(t,1)||jn(t,1);if(n==13||n==27)return!0;if(n==37||tt&&n==66&&r=="c"){let o=n==37?Jc(t,t.state.selection.from)=="ltr"?-1:1:-1;return qc(t,o,r)||jn(t,o)}else if(n==39||tt&&n==70&&r=="c"){let o=n==39?Jc(t,t.state.selection.from)=="ltr"?1:-1:1;return qc(t,o,r)||jn(t,o)}else{if(n==38||tt&&n==80&&r=="c")return Yc(t,-1,r)||jn(t,-1);if(n==40||tt&&n==78&&r=="c")return qm(t)||Yc(t,1,r)||jn(t,1);if(r==(tt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function pi(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:o,openEnd:s}=e;for(;o>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,s--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let i=t.someProp("clipboardSerializer")||hn.fromSchema(t.state.schema),l=id(),a=l.createElement("div");a.appendChild(i.serializeFragment(r,{document:l}));let c=a.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=od[c.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let m=l.createElement(d[p]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),u++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${s}${u?` -${u}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`))),0,0),t.someProp("transformPasted",h=>{l=h(l,t,!0)}),l;let u=t.someProp("clipboardTextParser",h=>h(e,o,r,t));if(u)l=u;else{let h=o.marks(),{schema:p}=t.state,m=hn.fromSchema(p);i=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=i.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(p.text(g,h)))})}}else t.someProp("transformPastedHTML",u=>{n=u(n,t)}),i=Zm(n),mr&&eg(i);let c=i&&i.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let h=i.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;i=h}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Rn.fromSchema(t.state.schema)).parseSlice(i,{preserveWhitespace:!!(a||d),context:o,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Ym.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)l=tg(rd(l,+d[1],+d[2]),d[4]);else if(l=L.maxOpen(Xm(l.content,o),!0),l.openStart||l.openEnd){let u=0,h=0;for(let p=l.content.firstChild;u<l.openStart&&!p.type.spec.isolating;u++,p=p.firstChild);for(let p=l.content.lastChild;h<l.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);l=rd(l,u,h)}return t.someProp("transformPasted",u=>{l=u(l,t,a)}),l}const Ym=/^(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 Xm(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)),s,i=[];if(t.forEach(l=>{if(!i)return;let a=o.findWrapping(l.type),c;if(!a)return i=null;if(c=i.length&&s.length&&td(a,s,l,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=nd(i[i.length-1],s.length));let d=ed(l,a);i.push(d),o=o.matchType(d.type),s=a}}),i)return v.from(i)}return t}function ed(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,v.from(t));return t}function td(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let s=td(t,e,n,r.lastChild,o+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(v.from(ed(n,t,o+1))))}}function nd(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,nd(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(v.empty,!0);return t.copy(n.append(r))}function mi(t,e,n,r,o,s){let i=e<0?t.firstChild:t.lastChild,l=i.content;return t.childCount>1&&(s=0),o<r-1&&(l=mi(l,e,n,r,o+1,s)),o>=n&&(l=e<0?i.contentMatchAt(0).fillBefore(l,s<=o).append(l):l.append(i.contentMatchAt(i.childCount).fillBefore(v.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,i.copy(l))}function rd(t,e,n){return e<t.openStart&&(t=new L(mi(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new L(mi(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const od={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 sd=null;function id(){return sd||(sd=document.implementation.createHTMLDocument("title"))}let gi=null;function Qm(t){let e=window.trustedTypes;return e?(gi||(gi=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),gi.createHTML(t)):t}function Zm(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=id().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&od[r[1].toLowerCase()])&&(t=o.map(s=>"<"+s+">").join("")+t+o.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=Qm(t),o)for(let s=0;s<o.length;s++)n=n.querySelector(o[s])||n;return n}function eg(t){let e=t.querySelectorAll(De?"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 tg(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:s,openEnd:i}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;o=v.from(a.create(r[l+1],o)),s++,i++}return new L(o,s,i)}const He={},ze={},ng={touchstart:!0,touchmove:!0};class rg{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function og(t){for(let e in He){let n=He[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{ig(t,r)&&!bi(t,r)&&(t.editable||!(r.type in ze))&&n(t,r)},ng[e]?{passive:!0}:void 0)}$e&&t.dom.addEventListener("input",()=>null),yi(t)}function qt(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function sg(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 yi(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>bi(t,r))})}function bi(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function ig(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 lg(t,e){!bi(t,e)&&He[e.type]&&(t.editable||!(e.type in ze))&&He[e.type](t,e)}ze.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!ad(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(_t&&De&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),zn&&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))||Jm(t,n)?n.preventDefault():qt(t,"key")},ze.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},ze.keypress=(t,e)=>{let n=e;if(ad(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||tt&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof H)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",i=>i(t,r.$from.pos,r.$to.pos,o,s))&&t.dispatch(s()),n.preventDefault()}};function po(t){return{left:t.clientX,top:t.clientY}}function ag(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function ki(t,e,n,r,o){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let i=s.depth+1;i>0;i--)if(t.someProp(e,l=>i>s.depth?l(t,n,s.nodeAfter,s.before(i),o,!0):l(t,n,s.node(i),s.before(i),o,!1)))return!0;return!1}function Wn(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 cg(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&$.isSelectable(r)?(Wn(t,new $(n)),!0):!1}function dg(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof $&&(r=n.node);let s=t.state.doc.resolve(e);for(let i=s.depth+1;i>0;i--){let l=i>s.depth?s.nodeAfter:s.node(i);if($.isSelectable(l)){r&&n.$from.depth>0&&i>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?o=s.before(n.$from.depth):o=s.before(i);break}}return o!=null?(Wn(t,$.create(t.state.doc,o)),!0):!1}function ug(t,e,n,r,o){return ki(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(o?dg(t,n):cg(t,n))}function fg(t,e,n,r){return ki(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function hg(t,e,n,r){return ki(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||pg(t,n,r)}function pg(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Wn(t,H.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let s=o.depth+1;s>0;s--){let i=s>o.depth?o.nodeAfter:o.node(s),l=o.before(s);if(i.inlineContent)Wn(t,H.create(r,l+1,l+1+i.content.size));else if($.isSelectable(i))Wn(t,$.create(r,l));else continue;return!0}}function xi(t){return mo(t)}const ld=tt?"metaKey":"ctrlKey";He.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=xi(t),o=Date.now(),s="singleClick";o-t.input.lastClick.time<500&&ag(n,t.input.lastClick)&&!n[ld]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:s,button:n.button};let i=t.posAtCoords(po(n));i&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new mg(t,i,n,!!r)):(s=="doubleClick"?fg:hg)(t,i.pos,i.inside,n)?n.preventDefault():qt(t,"pointer"))};class mg{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[ld],this.allowDefault=r.shiftKey;let s,i;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),i=n.inside;else{let d=e.state.doc.resolve(n.pos);s=d.parent,i=d.depth?d.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&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof $&&c.from<=i&&c.to>i)&&(this.mightDrag={node:s,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&et&&!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)),qt(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(po(e))),this.updateAllowDefault(e),this.allowDefault||!n?qt(this.view,"pointer"):ug(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||$e&&this.mightDrag&&!this.mightDrag.node.isAtom||De&&!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)?(Wn(this.view,z.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):qt(this.view,"pointer")}move(e){this.updateAllowDefault(e),qt(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)}}He.touchstart=t=>{t.input.lastTouch=Date.now(),xi(t),qt(t,"pointer")},He.touchmove=t=>{t.input.lastTouch=Date.now(),qt(t,"pointer")},He.contextmenu=t=>xi(t);function ad(t,e){return t.composing?!0:$e&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const gg=_t?5e3:-1;ze.compositionstart=ze.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof H&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),mo(t,!0),t.markCursor=null;else if(mo(t,!e.selection.empty),et&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,s=r.focusOffset;o&&o.nodeType==1&&s!=0;){let i=s<0?o.lastChild:o.childNodes[s-1];if(!i)break;if(i.nodeType==3){let l=t.domSelection();l&&l.collapse(i,i.nodeValue.length);break}else o=i,s=-1}}t.input.composing=!0}cd(t,gg)},ze.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++,cd(t,20))};function cd(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>mo(t),e))}function dd(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=bg());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function yg(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=cm(e.focusNode,e.focusOffset),r=dm(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let i=n.pmViewDesc;if(!(!i||!i.isText(n.nodeValue)))return r}}return n||r}function bg(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function mo(t,e=!1){if(!(_t&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),dd(t),e||t.docView&&t.docView.dirty){let n=ci(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 kg(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 xr=We&&Ut<15||zn&&mm<604;He.copy=ze.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let s=xr?null:n.clipboardData,i=r.content(),{dom:l,text:a}=pi(t,i);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):kg(t,l),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function xg(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Eg(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?Er(t,r.value,null,o,e):Er(t,r.textContent,r.innerHTML,o,e)},50)}function Er(t,e,n,r,o){let s=Zc(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,o,s||L.empty)))return!0;if(!s)return!1;let i=xg(s),l=i?t.state.tr.replaceSelectionWith(i,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ud(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," "):""}ze.paste=(t,e)=>{let n=e;if(t.composing&&!_t)return;let r=xr?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Er(t,ud(r),r.getData("text/html"),o,n)?n.preventDefault():Eg(t,n)};class fd{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const wg=tt?"altKey":"ctrlKey";function hd(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[wg]}He.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,s=o.empty?null:t.posAtCoords(po(n)),i;if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof $?o.to-1:o.to))){if(r&&r.mightDrag)i=$.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let u=t.docView.nearestDesc(n.target,!0);u&&u.node.type.spec.draggable&&u!=t.docView&&(i=$.create(t.state.doc,u.posBefore))}}let l=(i||t.state.selection).content(),{dom:a,text:c,slice:d}=pi(t,l);(!n.dataTransfer.files.length||!De||kc>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(xr?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",xr||n.dataTransfer.setData("text/plain",c),t.dragging=new fd(d,hd(t,n),i)},He.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},ze.dragover=ze.dragenter=(t,e)=>e.preventDefault(),ze.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(po(n));if(!o)return;let s=t.state.doc.resolve(o.pos),i=r&&r.slice;i?t.someProp("transformPasted",m=>{i=m(i,t,!1)}):i=Zc(t,ud(n.dataTransfer),xr?null:n.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&hd(t,n));if(t.someProp("handleDrop",m=>m(t,n,i||L.empty,l))){n.preventDefault();return}if(!i)return;n.preventDefault();let a=i?nc(t.state.doc,s.pos,i):s.pos;a==null&&(a=s.pos);let c=t.state.tr;if(l){let{node:m}=r;m?m.replace(c):c.deleteSelection()}let d=c.mapping.map(a),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,h=c.doc;if(u?c.replaceRangeWith(d,d,i.content.firstChild):c.replaceRange(d,d,i),c.doc.eq(h))return;let p=c.doc.resolve(d);if(u&&$.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new $(p));else{let m=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((g,y,b,k)=>m=k),c.setSelection(ui(t,p,c.doc.resolve(m)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},He.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))},He.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)},He.beforeinput=(t,e)=>{if(De&&_t&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(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 ze)He[t]=ze[t];function wr(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 go{constructor(e,n){this.toDOM=e,this.spec=n||xn,this.side=this.spec.side||0}map(e,n,r,o){let{pos:s,deleted:i}=e.mapResult(n.from+o,this.side<0?-1:1);return i?null:new ve(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof go&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&wr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Gt{constructor(e,n){this.attrs=e,this.spec=n||xn}map(e,n,r,o){let s=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,i=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return s>=i?null:new ve(s,i,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Gt&&wr(this.attrs,e.attrs)&&wr(this.spec,e.spec)}static is(e){return e.type instanceof Gt}destroy(){}}class Ei{constructor(e,n){this.attrs=e,this.spec=n||xn}map(e,n,r,o){let s=e.mapResult(n.from+o,1);if(s.deleted)return null;let i=e.mapResult(n.to+o,-1);return i.deleted||i.pos<=s.pos?null:new ve(s.pos-r,i.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),s;return o==n.from&&!(s=e.child(r)).isText&&o+s.nodeSize==n.to}eq(e){return this==e||e instanceof Ei&&wr(this.attrs,e.attrs)&&wr(this.spec,e.spec)}destroy(){}}class ve{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new ve(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 ve(e,e,new go(n,r))}static inline(e,n,r,o){return new ve(e,n,new Gt(r,o))}static node(e,n,r,o){return new ve(e,n,new Ei(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Gt}get widget(){return this.type instanceof go}}const Kn=[],xn={};class ie{constructor(e,n){this.local=e.length?e:Kn,this.children=n.length?n:Kn}static create(e,n){return n.length?yo(n,e,0,xn):Re}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,s){for(let i=0;i<this.local.length;i++){let l=this.local[i];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<n&&this.children[i+1]>e){let l=this.children[i]+1;this.children[i+2].findInner(e-l,n-l,r,o+l,s)}}map(e,n,r){return this==Re||e.maps.length==0?this:this.mapInner(e,n,0,0,r||xn)}mapInner(e,n,r,o,s){let i;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,o);a&&a.type.valid(n,a)?(i||(i=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?Cg(this.children,i||[],e,n,r,o,s):i?new ie(i.sort(En),Kn):Re}add(e,n){return n.length?this==Re?ie.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,s=0;e.forEach((l,a)=>{let c=a+r,d;if(d=md(n,l,c)){for(o||(o=this.children.slice());s<o.length&&o[s]<a;)s+=3;o[s]==a?o[s+2]=o[s+2].addInner(l,d,c+1):o.splice(s,0,a,a+l.nodeSize,yo(d,l,c+1,xn)),s+=3}});let i=pd(s?gd(n):n,-r);for(let l=0;l<i.length;l++)i[l].type.valid(e,i[l])||i.splice(l--,1);return new ie(i.length?this.local.concat(i).sort(En):this.local,o||this.children)}remove(e){return e.length==0||this==Re?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let s=0;s<r.length;s+=3){let i,l=r[s]+n,a=r[s+1]+n;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>l&&u.to<a&&(e[d]=null,(i||(i=[])).push(u));if(!i)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(i,l+1);c!=Re?r[s+2]=c:(r.splice(s,3),s-=3)}if(o.length){for(let s=0,i;s<e.length;s++)if(i=e[s])for(let l=0;l<o.length;l++)o[l].eq(i,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 ie(o,r):Re}forChild(e,n){if(this==Re)return this;if(n.isLeaf)return ie.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 s=e+1,i=s+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<i&&a.to>s&&a.type instanceof Gt){let c=Math.max(s,a.from)-s,d=Math.min(i,a.to)-s;c<d&&(o||(o=[])).push(a.copy(c,d))}}if(o){let l=new ie(o.sort(En),Kn);return r?new Jt([l,r]):l}return r||Re}eq(e){if(this==e)return!0;if(!(e instanceof ie)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return wi(this.localsInner(e))}localsInner(e){if(this==Re)return Kn;if(e.inlineContent||!this.local.some(Gt.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Gt||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ie.empty=new ie([],[]),ie.removeOverlap=wi;const Re=ie.empty;class Jt{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,xn));return Jt.from(r)}forChild(e,n){if(n.isLeaf)return ie.empty;let r=[];for(let o=0;o<this.members.length;o++){let s=this.members[o].forChild(e,n);s!=Re&&(s instanceof Jt?r=r.concat(s.members):r.push(s))}return Jt.from(r)}eq(e){if(!(e instanceof Jt)||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 s=this.members[o].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let i=0;i<s.length;i++)n.push(s[i])}}return n?wi(r?n:n.sort(En)):Kn}static from(e){switch(e.length){case 0:return Re;case 1:return e[0];default:return new Jt(e.every(n=>n instanceof ie)?e:e.reduce((n,r)=>n.concat(r instanceof ie?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Cg(t,e,n,r,o,s,i){let l=t.slice();for(let c=0,d=s;c<n.maps.length;c++){let u=0;n.maps[c].forEach((h,p,m,g)=>{let y=g-m-(p-h);for(let b=0;b<l.length;b+=3){let k=l[b+1];if(k<0||h>k+d-u)continue;let w=l[b]+d-u;p>=w?l[b+1]=h<=w?-2:-1:h>=d&&y&&(l[b]+=y,l[b+1]+=y)}u+=y}),d=n.maps[c].map(d,-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 d=n.map(t[c]+s),u=d-o;if(u<0||u>=r.content.size){a=!0;continue}let h=n.map(t[c+1]+s,-1),p=h-o,{index:m,offset:g}=r.content.findIndex(u),y=r.maybeChild(m);if(y&&g==u&&g+y.nodeSize==p){let b=l[c+2].mapInner(n,y,d+1,t[c]+s+1,i);b!=Re?(l[c]=u,l[c+1]=p,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Sg(l,t,e,n,o,s,i),d=yo(c,r,0,i);e=d.local;for(let u=0;u<l.length;u+=3)l[u+1]<0&&(l.splice(u,3),u-=3);for(let u=0,h=0;u<d.children.length;u+=3){let p=d.children[u];for(;h<l.length&&l[h]<p;)h+=3;l.splice(h,0,d.children[u],d.children[u+1],d.children[u+2])}}return new ie(e.sort(En),l)}function pd(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 ve(o.from+e,o.to+e,o.type))}return n}function Sg(t,e,n,r,o,s,i){function l(a,c){for(let d=0;d<a.local.length;d++){let u=a.local[d].map(r,o,c);u?n.push(u):i.onRemove&&i.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+s+1);return n}function md(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let s=0,i;s<t.length;s++)(i=t[s])&&i.from>n&&i.to<r&&((o||(o=[])).push(i),t[s]=null);return o}function gd(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function yo(t,e,n,r){let o=[],s=!1;e.forEach((l,a)=>{let c=md(t,l,a+n);if(c){s=!0;let d=yo(c,l,n+a+1,r);d!=Re&&o.push(a,a+l.nodeSize,d)}});let i=pd(s?gd(t):t,-n).sort(En);for(let l=0;l<i.length;l++)i[l].type.valid(e,i[l])||(r.onRemove&&r.onRemove(i[l].spec),i.splice(l--,1));return i.length||o.length?new ie(i,o):Re}function En(t,e){return t.from-e.from||t.to-e.to}function wi(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 s=e[o];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[o]=s.copy(s.from,r.to),yd(e,o+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),yd(e,o,r.copy(s.from,r.to)));break}}}return e}function yd(t,e,n){for(;e<t.length&&En(n,t[e])>0;)e++;t.splice(e,0,n)}function Ci(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Re&&e.push(r)}),t.cursorWrapper&&e.push(ie.create(t.state.doc,[t.cursorWrapper.deco])),Jt.from(e)}const Tg={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ng=We&&Ut<=11;class vg{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class _g{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new vg,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]);We&&Ut<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),Ng&&(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,Tg)),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(Wc(this.view)){if(this.suppressingSelectionUpdates)return At(this.view);if(We&&Ut<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&mn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=Hn(s))n.add(s);for(let s=e.anchorNode;s;s=Hn(s))if(n.has(s)){r=s;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)&&Wc(e)&&!this.ignoreSelectionChange(r),s=-1,i=-1,l=!1,a=[];if(e.editable)for(let d=0;d<n.length;d++){let u=this.registerMutation(n[d],a);u&&(s=s<0?u.from:Math.min(u.from,s),i=i<0?u.to:Math.max(u.to,i),u.typeOver&&(l=!0))}if(et&&a.length){let d=a.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,h]=d;u.parentNode&&u.parentNode.parentNode==h.parentNode?h.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let h of d){let p=h.parentNode;p&&p.nodeName=="LI"&&(!u||Og(e,u)!=p)&&h.remove()}}}let c=null;s<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&co(r)&&(c=ci(e))&&c.eq(z.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,At(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||o)&&(s>-1&&(e.docView.markDirty(s,i),Mg(e)),this.handleDOMChange(s,i,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 d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];n.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,s=e.nextSibling;if(We&&Ut<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:h}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(o=u),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let i=o&&o.parentNode==e.target?Oe(o)+1:0,l=r.localPosFromDOM(e.target,i,-1),a=s&&s.parentNode==e.target?Oe(s):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 bd=new WeakMap,kd=!1;function Mg(t){if(!bd.has(t)&&(bd.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=et,kd)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."),kd=!0}}function xd(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,i=t.domAtPos(t.state.selection.anchor);return mn(i.node,i.offset,o,s)&&([n,r,o,s]=[o,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:s}}function Ag(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return xd(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?xd(t,n):null}function Og(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 Lg(t,e,n){let{node:r,fromOffset:o,toOffset:s,from:i,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,d=a.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:a.anchorOffset}],co(a)||c.push({node:a.focusNode,offset:a.focusOffset})),De&&t.input.lastKeyCode===8)for(let y=s;y>o;y--){let b=r.childNodes[y-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){s=y;break}if(!k||k.size)break}let u=t.state.doc,h=t.someProp("domParser")||Rn.fromSchema(t.state.schema),p=u.resolve(i),m=null,g=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Ig,context:p});if(c&&c[0].pos!=null){let y=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=y),m={anchor:y+i,head:b+i}}return{doc:g,sel:m,from:i,to:l}}function Ig(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if($e&&/^(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||$e&&/^(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 Dg=/^(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 Rg(t,e,n,r,o){let s=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,I=ci(t,S);if(I&&!t.state.selection.eq(I)){if(De&&_t&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",J=>J(t,gn(13,"Enter"))))return;let F=t.state.tr.setSelection(I);S=="pointer"?F.setMeta("pointer",!0):S=="key"&&F.scrollIntoView(),s&&F.setMeta("composition",s),t.dispatch(F)}return}let i=t.state.doc.resolve(e),l=i.sharedDepth(n);e=i.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=Lg(t,e,n),d=t.state.doc,u=d.slice(c.from,c.to),h,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,p="end"):(h=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let m=Fg(u.content,c.doc.content,c.from,h,p);if(m&&t.input.domChangeCount++,(zn&&t.input.lastIOSEnter>Date.now()-225||_t)&&o.some(S=>S.nodeType==1&&!Dg.test(S.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",S=>S(t,gn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&a instanceof H&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let S=Ed(t,t.state.doc,c.sel);if(S&&!S.eq(t.state.selection)){let I=t.state.tr.setSelection(S);s&&I.setMeta("composition",s),t.dispatch(I)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof H&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),We&&Ut<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)==" "&&(m.start--,m.endA--,m.endB--);let g=c.doc.resolveNoCache(m.start-c.from),y=c.doc.resolveNoCache(m.endB-c.from),b=d.resolve(m.start),k=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((zn&&t.input.lastIOSEnter>Date.now()-225&&(!k||o.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!k&&g.pos<c.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(c.doc.textBetween(g.pos,y.pos,"","")))&&t.someProp("handleKeyDown",S=>S(t,gn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&Bg(d,m.start,m.endA,g,y)&&t.someProp("handleKeyDown",S=>S(t,gn(8,"Backspace")))){_t&&De&&t.domObserver.suppressSelectionUpdates();return}De&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),_t&&!k&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,y=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(S){return S(t,gn(13,"Enter"))})},20));let w=m.start,C=m.endA,T=S=>{let I=S||t.state.tr.replace(w,C,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let F=Ed(t,I.doc,c.sel);F&&!(De&&t.composing&&F.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(F.head==w||F.head==I.mapping.map(C)-1)||We&&F.empty&&F.head==w)&&I.setSelection(F)}return s&&I.setMeta("composition",s),I.scrollIntoView()},_;if(k){if(g.pos==y.pos){We&&Ut<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>At(t),20));let S=T(t.state.tr.delete(w,C)),I=d.resolve(m.start).marksAcross(d.resolve(m.endA));I&&S.ensureMarks(I),t.dispatch(S)}else if(m.endA==m.endB&&(_=Pg(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let S=T(t.state.tr);_.type=="add"?S.addMark(w,C,_.mark):S.removeMark(w,C,_.mark),t.dispatch(S)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let S=g.parent.textBetween(g.parentOffset,y.parentOffset),I=()=>T(t.state.tr.insertText(S,w,C));t.someProp("handleTextInput",F=>F(t,w,C,S,I))||t.dispatch(I())}}else t.dispatch(T())}function Ed(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ui(t,e.resolve(n.anchor),e.resolve(n.head))}function Pg(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,s=r,i,l,a;for(let d=0;d<r.length;d++)o=r[d].removeFromSet(o);for(let d=0;d<n.length;d++)s=n[d].removeFromSet(s);if(o.length==1&&s.length==0)l=o[0],i="add",a=d=>d.mark(l.addToSet(d.marks));else if(o.length==0&&s.length==1)l=s[0],i="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(a(e.child(d)));if(v.from(c).eq(t))return{mark:l,type:i}}function Bg(t,e,n,r,o){if(n-e<=o.pos-r.pos||Si(r,!0,!1)<o.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let i=t.resolve(Si(s,!0,!0));return!i.parent.isTextblock||i.pos>n||Si(i,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(i.parent.content)}function Si(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 s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,o++}return o}function Fg(t,e,n,r,o){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:i,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let a=Math.max(0,s-Math.min(i,l));r-=i+a-s}if(i<s&&t.size<e.size){let a=r<=s&&r>=i?s-r:0;s-=a,s&&s<e.size&&wd(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-i),i=s}else if(l<s){let a=r<=s&&r>=l?s-r:0;s-=a,s&&s<t.size&&wd(t.textBetween(s-1,s+1))&&(s+=a?1:-1),i=s+(i-l),l=s}return{start:s,endA:i,endB:l}}function wd(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 Cd{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 rg,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(_d),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=Nd(this),Td(this),this.nodeViews=vd(this),this.docView=Ic(this.state.doc,Sd(this),Ci(this),this.dom,this),this.domObserver=new _g(this,(r,o,s,i)=>Rg(this,r,o,s,i)),this.domObserver.start(),og(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&yi(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(_d),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,s=!1,i=!1;e.storedMarks&&this.composing&&(dd(this),i=!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 p=vd(this);$g(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&yi(this),this.editable=Nd(this),Td(this);let a=Ci(this),c=Sd(this),d=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",u=s||!this.docView.matchesNode(e.doc,c,a);(u||!e.selection.eq(o.selection))&&(i=!0);let h=d=="preserve"&&i&&this.dom.style.overflowAnchor==null&&bm(this);if(i){this.domObserver.stop();let p=u&&(We||De)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Vg(o.selection,e.selection);if(u){let m=De?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=yg(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Ic(e.doc,c,a,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&zm(this))?At(this,p):(Uc(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),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&km(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof $){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&xc(this,n.getBoundingClientRect(),e)}else xc(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 s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(o=s)}this.dragging=new fd(e.slice,e.move,o<0?void 0:$.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 i=0;i<this.directPlugins.length;i++){let l=this.directPlugins[i].props[e];if(l!=null&&(o=n?n(l):l))return o}let s=this.state.plugins;if(s)for(let i=0;i<s.length;i++){let l=s[i].props[e];if(l!=null&&(o=n?n(l):l))return o}}hasFocus(){if(We){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&xm(this.dom),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 Tm(this,e)}coordsAtPos(e,n=1){return Nc(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 Am(this,n||this.state,e)}pasteHTML(e,n){return Er(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Er(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return pi(this,e)}destroy(){this.docView&&(sg(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ci(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,lm())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return lg(this,e)}domSelectionRange(){let e=this.domSelection();return e?$e&&this.root.nodeType===11&&fm(this.dom.ownerDocument)==this.dom&&Ag(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Cd.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Sd(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"),[ve.node(0,t.state.doc.content.size,e)]}function Td(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:ve.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Nd(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Vg(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 vd(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 $g(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 _d(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")}for(var Yt={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:"'"},bo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Hg=typeof navigator<"u"&&/Mac/.test(navigator.platform),zg=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Le=0;Le<10;Le++)Yt[48+Le]=Yt[96+Le]=String(Le);for(var Le=1;Le<=24;Le++)Yt[Le+111]="F"+Le;for(var Le=65;Le<=90;Le++)Yt[Le]=String.fromCharCode(Le+32),bo[Le]=String.fromCharCode(Le);for(var Ti in Yt)bo.hasOwnProperty(Ti)||(bo[Ti]=Yt[Ti]);function Ug(t){var e=Hg&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||zg&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?bo:Yt)[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 jg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Wg=typeof navigator<"u"&&/Win/.test(navigator.platform);function Kg(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,s,i;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))i=!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))s=!0;else if(/^mod$/i.test(a))jg?i=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),i&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function qg(t){let e=Object.create(null);for(let n in t)e[Kg(n)]=t[n];return e}function Ni(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 Gg(t){return new ue({props:{handleKeyDown:vi(t)}})}function vi(t){let e=qg(t);return function(n,r){let o=Ug(r),s,i=e[Ni(o,r)];if(i&&i(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[Ni(o,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Wg&&r.ctrlKey&&r.altKey)&&(s=Yt[r.keyCode])&&s!=o){let l=e[Ni(s,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const _i=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Md(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Ad=(t,e,n)=>{let r=Md(t,n);if(!r)return!1;let o=Mi(r);if(!o){let i=r.blockRange(),l=i&&Pn(i);return l==null?!1:(e&&e(t.tr.lift(i,l).scrollIntoView()),!0)}let s=o.nodeBefore;if(Vd(t,o,e,-1))return!0;if(r.parent.content.size==0&&(qn(s,"end")||$.isSelectable(s)))for(let i=r.depth;;i--){let l=io(t.doc,r.before(i),r.after(i),L.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(qn(s,"end")?z.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):$.create(a.doc,o.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(i==1||r.node(i-1).childCount>1)break}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-s.nodeSize,o.pos).scrollIntoView()),!0):!1},Jg=(t,e,n)=>{let r=Md(t,n);if(!r)return!1;let o=Mi(r);return o?Od(t,o,e):!1},Yg=(t,e,n)=>{let r=Id(t,n);if(!r)return!1;let o=Ai(r);return o?Od(t,o,e):!1};function Od(t,e,n){let r=e.nodeBefore,o=r,s=e.pos-1;for(;!o.isTextblock;s--){if(o.type.spec.isolating)return!1;let d=o.lastChild;if(!d)return!1;o=d}let i=e.nodeAfter,l=i,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let c=io(t.doc,s,a,L.empty);if(!c||c.from!=s||c instanceof Te&&c.slice.size>=a-s)return!1;if(n){let d=t.tr.step(c);d.setSelection(H.create(d.doc,s)),n(d.scrollIntoView())}return!0}function qn(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Ld=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=Mi(r)}let i=s&&s.nodeBefore;return!i||!$.isSelectable(i)?!1:(e&&e(t.tr.setSelection($.create(t.doc,s.pos-i.nodeSize)).scrollIntoView()),!0)};function Mi(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 Id(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Dd=(t,e,n)=>{let r=Id(t,n);if(!r)return!1;let o=Ai(r);if(!o)return!1;let s=o.nodeAfter;if(Vd(t,o,e,1))return!0;if(r.parent.content.size==0&&(qn(s,"start")||$.isSelectable(s))){let i=io(t.doc,r.before(),r.after(),L.empty);if(i&&i.slice.size<i.to-i.from){if(e){let l=t.tr.step(i);l.setSelection(qn(s,"start")?z.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):$.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+s.nodeSize).scrollIntoView()),!0):!1},Rd=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=Ai(r)}let i=s&&s.nodeAfter;return!i||!$.isSelectable(i)?!1:(e&&e(t.tr.setSelection($.create(t.doc,s.pos)).scrollIntoView()),!0)};function Ai(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 Xg=(t,e)=>{let n=t.selection,r=n instanceof $,o;if(r){if(n.node.isTextblock||!Ht(t.doc,n.from))return!1;o=n.from}else if(o=so(t.doc,n.from,-1),o==null)return!1;if(e){let s=t.tr.join(o);r&&s.setSelection($.create(s.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Qg=(t,e)=>{let n=t.selection,r;if(n instanceof $){if(n.node.isTextblock||!Ht(t.doc,n.to))return!1;r=n.to}else if(r=so(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Zg=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),s=o&&Pn(o);return s==null?!1:(e&&e(t.tr.lift(o,s).scrollIntoView()),!0)},Pd=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
10
|
-
`).scrollIntoView()),!0)};function Oi(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 e0=(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),s=n.indexAfter(-1),i=Oi(o.contentMatchAt(s));if(!i||!o.canReplaceWith(s,s,i))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,i.createAndFill());a.setSelection(z.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Bd=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof Ye||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=Oi(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let i=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=t.tr.insert(i,s.createAndFill());l.setSelection(H.create(l.doc,i+1)),e(l.scrollIntoView())}return!0},Fd=(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 s=n.before();if(Nt(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Pn(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function t0(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof $&&e.selection.node.isBlock)return!r.parentOffset||!Nt(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],i,l,a=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){a=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),l=Oi(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),s.unshift(a&&l?{type:l}:null),i=p;break}else{if(p==1)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof H||e.selection instanceof Ye)&&d.deleteSelection();let u=d.mapping.map(r.pos),h=Nt(d.doc,u,s.length,s);if(h||(s[0]=l?{type:l}:null,h=Nt(d.doc,u,s.length,s)),!h)return!1;if(d.split(u,s.length,s),!a&&c&&r.node(i).type!=l){let p=d.mapping.map(r.before(i)),m=d.doc.resolve(p);l&&r.node(i-1).canReplaceWith(m.index(),m.index()+1,l)&&d.setNodeMarkup(d.mapping.map(r.before(i)),l)}return n&&n(d.scrollIntoView()),!0}}const n0=t0(),r0=(t,e)=>{let{$from:n,to:r}=t.selection,o,s=n.sharedDepth(r);return s==0?!1:(o=n.before(s),e&&e(t.tr.setSelection($.create(t.doc,o))),!0)};function o0(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,s=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(o.isTextblock||Ht(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Vd(t,e,n,r){let o=e.nodeBefore,s=e.nodeAfter,i,l,a=o.type.spec.isolating||s.type.spec.isolating;if(!a&&o0(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(i=(l=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&l.matchType(i[0]||s.type).validEnd){if(n){let p=e.pos+s.nodeSize,m=v.empty;for(let b=i.length-1;b>=0;b--)m=v.from(i[b].create(null,m));m=v.from(o.copy(m));let g=t.tr.step(new Ne(e.pos-1,p,e.pos,p,new L(m,1,0),i.length,!0)),y=g.doc.resolve(p+2*i.length);y.nodeAfter&&y.nodeAfter.type==o.type&&Ht(g.doc,y.pos)&&g.join(y.pos),n(g.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&a?null:z.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),h=u&&Pn(u);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(u,h).scrollIntoView()),!0;if(c&&qn(s,"start",!0)&&qn(o,"end")){let p=o,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=s,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(n){let b=v.empty;for(let w=m.length-1;w>=0;w--)b=v.from(m[w].copy(b));let k=t.tr.step(new Ne(e.pos-m.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new L(b,m.length,0),0,!0));n(k.scrollIntoView())}return!0}}return!1}function $d(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return o.node(s).isTextblock?(n&&n(e.tr.setSelection(H.create(e.doc,t<0?o.start(s):o.end(s)))),!0):!1}}const s0=$d(-1),i0=$d(1);function l0(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,i=o.blockRange(s),l=i&&qs(i,t,e);return l?(r&&r(n.tr.wrap(i,l).scrollIntoView()),!0):!1}}function Hd(t,e=null){return function(n,r){let o=!1;for(let s=0;s<n.selection.ranges.length&&!o;s++){let{$from:{pos:i},$to:{pos:l}}=n.selection.ranges[s];n.doc.nodesBetween(i,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)o=!0;else{let d=n.doc.resolve(c),u=d.index();o=d.parent.canReplaceWith(u,u+1,t)}})}if(!o)return!1;if(r){let s=n.tr;for(let i=0;i<n.selection.ranges.length;i++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[i];s.setBlockType(l,a,t,e)}r(s.scrollIntoView())}return!0}}function Li(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}Li(_i,Ad,Ld),Li(_i,Dd,Rd),Li(Pd,Bd,Fd,n0),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function a0(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,i=o.blockRange(s);if(!i)return!1;let l=r?n.tr:null;return c0(l,i,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function c0(t,e,n,r=null){let o=!1,s=e,i=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=i.resolve(e.start-2);s=new Zr(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Zr(e.$from,i.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let l=qs(s,n,r,e);return l?(t&&d0(t,e,l,o,n),!0):!1}function d0(t,e,n,r,o){let s=v.empty;for(let d=n.length-1;d>=0;d--)s=v.from(n[d].type.create(n[d].attrs,s));t.step(new Ne(e.start-(r?2:0),e.end,e.start,e.end,new L(s,0,0),n.length,!0));let i=0;for(let d=0;d<n.length;d++)n[d].type==o&&(i=d+1);let l=n.length-i,a=e.start+n.length-(r?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,h=!0;d<u;d++,h=!1)!h&&Nt(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(d).nodeSize;return t}function u0(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,i=>i.childCount>0&&i.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?f0(e,n,t,s):h0(e,n,s):!0:!1}}function f0(t,e,n,r){let o=t.tr,s=r.end,i=r.$to.end(r.depth);s<i&&(o.step(new Ne(s-1,i,s,i,new L(v.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Zr(o.doc.resolve(r.$from.pos),o.doc.resolve(i),r.depth));const l=Pn(r);if(l==null)return!1;o.lift(r,l);let a=o.doc.resolve(o.mapping.map(s,-1)-1);return Ht(o.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&o.join(a.pos),e(o.scrollIntoView()),!0}function h0(t,e,n){let r=t.tr,o=n.parent;for(let p=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)p-=o.child(m).nodeSize,r.delete(p-1,p+1);let s=r.doc.resolve(n.start),i=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==o.childCount,c=s.node(-1),d=s.index(-1);if(!c.canReplace(d+(l?0:1),d+1,i.content.append(a?v.empty:v.from(o))))return!1;let u=s.pos,h=u+i.nodeSize;return r.step(new Ne(u-(l?1:0),h+(a?1:0),u+1,h-1,new L((l?v.empty:v.from(o.copy(v.empty))).append(a?v.empty:v.from(o.copy(v.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function p0(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let i=s.startIndex;if(i==0)return!1;let l=s.parent,a=l.child(i-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,d=v.from(c?t.create():null),u=new L(v.from(t.create(null,v.from(l.type.create(null,d)))),c?3:1,0),h=s.start,p=s.end;n(e.tr.step(new Ne(h-(c?3:1),p,h,p,u,1,!0)).scrollIntoView())}return!0}}var m0=Object.defineProperty,zd=(t,e)=>{for(var n in e)m0(t,n,{get:e[n],enumerable:!0})};function ko(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:s}=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 s},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,s=n.storedMarks,n}}}var xo=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,s=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([i,l])=>[i,(...c)=>{const d=l(...c)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:s}=r,i=[],l=!!t,a=t||o.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(a),i.every(u=>u===!0)),d={...Object.fromEntries(Object.entries(n).map(([u,h])=>[u,(...m)=>{const g=this.buildProps(a,e),y=h(...m)(g);return i.push(y),d}])),run:c};return d}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,s=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:s}=r,i={tr:t,editor:r,view:s,state:ko({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)(i)]))}};return i}},g0=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={}}};function Ud(t,e){const n=new Ys(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}var jd=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&&jd(r)}return t};function Eo(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 jd(n)}function Cr(t,e,n){if(t instanceof Ft||t instanceof v)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 v.fromArray(t.map(l=>e.nodeFromJSON(l)));const i=e.nodeFromJSON(t);return n.errorOnInvalidContent&&i.check(),i}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),Cr("",e,n)}if(o){if(n.errorOnInvalidContent){let i=!1,l="";const a=new Pa({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=>(i=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Rn.fromSchema(a).parseSlice(Eo(t),n.parseOptions):Rn.fromSchema(a).parse(Eo(t),n.parseOptions),n.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=Rn.fromSchema(e);return n.slice?s.parseSlice(Eo(t),n.parseOptions).content:s.parse(Eo(t),n.parseOptions)}return Cr("",e,n)}function Ii(t,e,n={},r={}){return Cr(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}function y0(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 b0(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,s)=>{n(o)&&r.push({node:o,pos:s})}),r}function Wd(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 wo(t){return e=>Wd(e.$from,t)}function V(t,e,n){return t.config[e]===void 0&&t.parent?V(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?V(t.parent,e,n):null}):t.config[e]}function Di(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=V(e,"addExtensions",n);return r?[e,...Di(r())]:e}).flat(10)}function Ri(t,e){const n=hn.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function Kd(t){return typeof t=="function"}function Q(t,e=void 0,...n){return Kd(t)?e?t.bind(e)(...n):t(...n):t}function k0(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Sr(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 qd(t){const e=[],{nodeExtensions:n,markExtensions:r}=Sr(t),o=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(i=>{const l={name:i.name,options:i.options,storage:i.storage,extensions:o},a=V(i,"addGlobalAttributes",l);if(!a)return;a().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([h,p])=>{e.push({type:u,name:h,attribute:{...s,...p}})})})})}),o.forEach(i=>{const l={name:i.name,options:i.options,storage:i.storage},a=V(i,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([d,u])=>{const h={...s,...u};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:i.name,name:d,attribute:h})})}),e}function ee(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,s])=>{if(!r[o]){r[o]=s;return}if(o==="class"){const l=s?String(s).split(" "):[],a=r[o]?r[o].split(" "):[],c=l.filter(d=>!a.includes(d));r[o]=[...a,...c].join(" ")}else if(o==="style"){const l=s?s.split(";").map(d=>d.trim()).filter(Boolean):[],a=r[o]?r[o].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;a.forEach(d=>{const[u,h]=d.split(":").map(p=>p.trim());c.set(u,h)}),l.forEach(d=>{const[u,h]=d.split(":").map(p=>p.trim());c.set(u,h)}),r[o]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ")}else r[o]=s}),r},{})}function Co(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)=>ee(n,r),{})}function x0(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Gd(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((s,i)=>{const l=i.attribute.parseHTML?i.attribute.parseHTML(n):x0(n.getAttribute(i.name));return l==null?s:{...s,[i.name]:l}},{});return{...r,...o}}}}function Jd(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&k0(n)?!1:n!=null))}function E0(t,e){var n;const r=qd(t),{nodeExtensions:o,markExtensions:s}=Sr(t),i=(n=o.find(c=>V(c,"topNode")))==null?void 0:n.name,l=Object.fromEntries(o.map(c=>{const d=r.filter(b=>b.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((b,k)=>{const w=V(k,"extendNodeSchema",u);return{...b,...w?w(c):{}}},{}),p=Jd({...h,content:Q(V(c,"content",u)),marks:Q(V(c,"marks",u)),group:Q(V(c,"group",u)),inline:Q(V(c,"inline",u)),atom:Q(V(c,"atom",u)),selectable:Q(V(c,"selectable",u)),draggable:Q(V(c,"draggable",u)),code:Q(V(c,"code",u)),whitespace:Q(V(c,"whitespace",u)),linebreakReplacement:Q(V(c,"linebreakReplacement",u)),defining:Q(V(c,"defining",u)),isolating:Q(V(c,"isolating",u)),attrs:Object.fromEntries(d.map(b=>{var k,w;return[b.name,{default:(k=b?.attribute)==null?void 0:k.default,validate:(w=b?.attribute)==null?void 0:w.validate}]}))}),m=Q(V(c,"parseHTML",u));m&&(p.parseDOM=m.map(b=>Gd(b,d)));const g=V(c,"renderHTML",u);g&&(p.toDOM=b=>g({node:b,HTMLAttributes:Co(b,d)}));const y=V(c,"renderText",u);return y&&(p.toText=y),[c.name,p]})),a=Object.fromEntries(s.map(c=>{const d=r.filter(y=>y.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((y,b)=>{const k=V(b,"extendMarkSchema",u);return{...y,...k?k(c):{}}},{}),p=Jd({...h,inclusive:Q(V(c,"inclusive",u)),excludes:Q(V(c,"excludes",u)),group:Q(V(c,"group",u)),spanning:Q(V(c,"spanning",u)),code:Q(V(c,"code",u)),attrs:Object.fromEntries(d.map(y=>{var b,k;return[y.name,{default:(b=y?.attribute)==null?void 0:b.default,validate:(k=y?.attribute)==null?void 0:k.validate}]}))}),m=Q(V(c,"parseHTML",u));m&&(p.parseDOM=m.map(y=>Gd(y,d)));const g=V(c,"renderHTML",u);return g&&(p.toDOM=y=>g({mark:y,HTMLAttributes:Co(y,d)})),[c.name,p]}));return new Pa({topNode:i,nodes:l,marks:a})}function w0(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Pi(t){return t.sort((n,r)=>{const o=V(n,"priority")||100,s=V(r,"priority")||100;return o>s?-1:o<s?1:0})}function Yd(t){const e=Pi(Di(t)),n=w0(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 Xd(t,e,n){const{from:r,to:o}=e,{blockSeparator:s=`
|
|
11
|
-
|
|
12
|
-
`,textSerializers:i={}}=n||{};let l="";return t.nodesBetween(r,o,(a,c,d,u)=>{var h;a.isBlock&&c>r&&(l+=s);const p=i?.[a.type.name];if(p)return d&&(l+=p({node:a,pos:c,parent:d,index:u,range:e})),!1;a.isText&&(l+=(h=a?.text)==null?void 0:h.slice(Math.max(r,c)-c,o-c))}),l}function C0(t,e){const n={from:0,to:t.content.size};return Xd(t,n,e)}function Qd(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function Ot(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}function Zd(t,e){const n=Ot(e,t.schema),{from:r,to:o,empty:s}=t.selection,i=[];s?(t.storedMarks&&i.push(...t.storedMarks),i.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,a=>{i.push(...a.marks)});const l=i.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function Ee(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}function S0(t,e){const n=Ee(e,t.schema),{from:r,to:o}=t.selection,s=[];t.doc.nodesBetween(r,o,l=>{s.push(l)});const i=s.reverse().find(l=>l.type.name===n.name);return i?{...i.attrs}:{}}function So(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function eu(t,e){const n=So(typeof e=="string"?e:e.name,t.schema);return n==="node"?S0(t,e):n==="mark"?Zd(t,e):{}}function T0(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 N0(t){const e=T0(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,i)=>i!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function tu(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,s)=>{const i=[];if(o.ranges.length)o.forEach((l,a)=>{i.push({from:l,to:a})});else{const{from:l,to:a}=n[s];if(l===void 0||a===void 0)return;i.push({from:l,to:a})}i.forEach(({from:l,to:a})=>{const c=e.slice(s).map(l,-1),d=e.slice(s).map(a),u=e.invert().map(c,-1),h=e.invert().map(d);r.push({oldRange:{from:u,to:h},newRange:{from:c,to:d}})})}),N0(r)}function Bi(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function To(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Bi(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function nu(t,e,n={}){return t.find(r=>r.type===e&&To(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function ru(t,e,n={}){return!!nu(t,e,n)}function Fi(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(d=>d.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(d=>d.type===e)||(n=n||((r=o.node.marks[0])==null?void 0:r.attrs),!nu([...o.node.marks],e,n)))return;let i=o.index,l=t.start()+o.offset,a=i+1,c=l+o.node.nodeSize;for(;i>0&&ru([...t.parent.child(i-1).marks],e,n);)i-=1,l-=t.parent.child(i).nodeSize;for(;a<t.parent.childCount&&ru([...t.parent.child(a).marks],e,n);)c+=t.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function Vi(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const s=n.resolve(t),i=Fi(s,o.type);i&&r.push({mark:o,...i})}):n.nodesBetween(t,e,(o,s)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(i=>({from:s,to:s+o.nodeSize,mark:i})))}),r}var v0=(t,e,n,r=20)=>{const o=t.doc.resolve(n);let s=r,i=null;for(;s>0&&i===null;){const l=o.node(s);l?.type.name===e?i=l:s-=1}return[i,s]};function $i(t,e){return e.nodes[t]||e.marks[t]||null}function No(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(s=>s.type===e&&s.name===r);return o?o.attribute.keepOnSplit:!1}))}var _0=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,s,i,l)=>{var a,c;const d=((c=(a=o.type.spec).toText)==null?void 0:c.call(a,{node:o,pos:s,parent:i,index:l}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?d:d.slice(0,Math.max(0,r-s))}),n};function Hi(t,e,n={}){const{empty:r,ranges:o}=t.selection,s=e?Ot(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>s?s.name===u.type.name:!0).find(u=>To(u.attrs,n,{strict:!1}));let i=0;const l=[];if(o.forEach(({$from:u,$to:h})=>{const p=u.pos,m=h.pos;t.doc.nodesBetween(p,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const b=Math.max(p,y),k=Math.min(m,y+g.nodeSize),w=k-b;i+=w,l.push(...g.marks.map(C=>({mark:C,from:b,to:k})))})}),i===0)return!1;const a=l.filter(u=>s?s.name===u.mark.type.name:!0).filter(u=>To(u.mark.attrs,n,{strict:!1})).reduce((u,h)=>u+h.to-h.from,0),c=l.filter(u=>s?u.mark.type!==s&&u.mark.type.excludes(s):!0).reduce((u,h)=>u+h.to-h.from,0);return(a>0?a+c:a)>=i}function Xt(t,e,n={}){const{from:r,to:o,empty:s}=t.selection,i=e?Ee(e,t.schema):null,l=[];t.doc.nodesBetween(r,o,(u,h)=>{if(u.isText)return;const p=Math.max(r,h),m=Math.min(o,h+u.nodeSize);l.push({node:u,from:p,to:m})});const a=o-r,c=l.filter(u=>i?i.name===u.node.type.name:!0).filter(u=>To(u.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((u,h)=>u+h.to-h.from,0)>=a}function M0(t,e,n={}){if(!e)return Xt(t,null,n)||Hi(t,null,n);const r=So(e,t.schema);return r==="node"?Xt(t,e,n):r==="mark"?Hi(t,e,n):!1}var A0=(t,e)=>{const{$from:n,$to:r,$anchor:o}=t.selection;if(e){const s=wo(l=>l.type.name===e)(t.selection);if(!s)return!1;const i=t.doc.resolve(s.pos+1);return o.pos+1===i.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},O0=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function ou(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function su(t,e){const{nodeExtensions:n}=Sr(e),r=n.find(i=>i.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},s=Q(V(r,"group",o));return typeof s!="string"?!1:s.split(" ").includes("list")}function vo(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(s=>{o!==!1&&(vo(s,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function iu(t){return t instanceof $}function lu(t){return t instanceof H}function wn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function au(t,e=null){if(!e)return null;const n=z.atStart(t),r=z.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,s=r.to;return e==="all"?H.create(t,wn(0,o,s),wn(t.content.size,o,s)):H.create(t,wn(e,o,s),wn(e,o,s))}function L0(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof Te||o instanceof Ne))return;const s=t.mapping.maps[r];let i=0;s.forEach((l,a,c,d)=>{i===0&&(i=d)}),t.setSelection(z.near(t.doc.resolve(i),n))}var _o=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},I0=(t,e)=>{if(Bi(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 Mo(t){var e;const{editor:n,from:r,to:o,text:s,rules:i,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(h=>h.type.spec.code))return!1;let d=!1;const u=_0(c)+s;return i.forEach(h=>{if(d)return;const p=I0(u,h.find);if(!p)return;const m=a.state.tr,g=ko({state:a.state,transaction:m}),y={from:r-(p[0].length-s.length),to:o},{commands:b,chain:k,can:w}=new xo({editor:n,state:g});h.handler({state:g,range:y,match:p,commands:b,chain:k,can:w})===null||!m.steps.length||(h.undoable&&m.setMeta(l,{transform:m,from:r,to:o,text:s}),a.dispatch(m),d=!0)}),d}function D0(t){const{editor:e,rules:n}=t,r=new ue({state:{init(){return null},apply(o,s,i){const l=o.getMeta(r);if(l)return l;const a=o.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:d}=a;typeof d=="string"?d=d:d=Ri(v.from(d),i.schema);const{from:u}=a,h=u+d.length;Mo({editor:e,from:u,to:h,text:d,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:s}},props:{handleTextInput(o,s,i,l){return Mo({editor:e,from:s,to:i,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:s}=o.state.selection;s&&Mo({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,s){if(s.key!=="Enter")return!1;const{$cursor:i}=o.state.selection;return i?Mo({editor:e,from:i.pos,to:i.pos,text:`
|
|
13
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function R0(t){return Object.prototype.toString.call(t).slice(8,-1)}function Ao(t){return R0(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function cu(t,e){const n={...t};return Ao(t)&&Ao(e)&&Object.keys(e).forEach(r=>{Ao(e[r])&&Ao(t[r])?n[r]=cu(t[r],e[r]):n[r]=e[r]}),n}var zi=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{...Q(V(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Q(V(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>cu(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}},dt=class cp extends zi{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new cp(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const i=o.marks();if(!!!i.find(c=>c?.type.name===n.name))return!1;const a=i.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 P0(t){return typeof t=="number"}var B0=class{constructor(t){this.find=t.find,this.handler=t.handler}},F0=(t,e,n)=>{if(Bi(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const s=[o.text];return s.index=o.index,s.input=t,s.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(o.replaceWith)),s}):[]};function V0(t){const{editor:e,state:n,from:r,to:o,rule:s,pasteEvent:i,dropEvent:l}=t,{commands:a,chain:c,can:d}=new xo({editor:e,state:n}),u=[];return n.doc.nodesBetween(r,o,(p,m)=>{var g,y,b,k,w;if((y=(g=p.type)==null?void 0:g.spec)!=null&&y.code||!(p.isText||p.isTextblock||p.isInline))return;const C=(w=(k=(b=p.content)==null?void 0:b.size)!=null?k:p.nodeSize)!=null?w:0,T=Math.max(r,m),_=Math.min(o,m+C);if(T>=_)return;const S=p.isText?p.text||"":p.textBetween(T-m,_-m,void 0,"");F0(S,s.find,i).forEach(F=>{if(F.index===void 0)return;const J=T+F.index+1,P=J+F[0].length,D={from:n.tr.mapping.map(J),to:n.tr.mapping.map(P)},K=s.handler({state:n,range:D,match:F,commands:a,chain:c,can:d,pasteEvent:i,dropEvent:l});u.push(K)})}),u.every(p=>p!==null)}var Oo=null,$0=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function H0(t){const{editor:e,rules:n}=t;let r=null,o=!1,s=!1,i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:d,from:u,to:h,rule:p,pasteEvt:m})=>{const g=d.tr,y=ko({state:d,transaction:g});if(!(!V0({editor:e,state:y,from:Math.max(u-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(d=>new ue({view(u){const h=m=>{var g;r=(g=u.dom.parentElement)!=null&&g.contains(m.target)?u.dom.parentElement:null,r&&(Oo=e)},p=()=>{Oo&&(Oo=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(u,h)=>{if(s=r===u.dom.parentElement,l=h,!s){const p=Oo;p?.isEditable&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(u,h)=>{var p;const m=(p=h.clipboardData)==null?void 0:p.getData("text/html");return i=h,o=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(u,h,p)=>{const m=u[0],g=m.getMeta("uiEvent")==="paste"&&!o,y=m.getMeta("uiEvent")==="drop"&&!s,b=m.getMeta("applyPasteRules"),k=!!b;if(!g&&!y&&!k)return;if(k){let{text:T}=b;typeof T=="string"?T=T:T=Ri(v.from(T),p.schema);const{from:_}=b,S=_+T.length,I=$0(T);return a({rule:d,state:p,from:_,to:{b:S},pasteEvt:I})}const w=h.doc.content.findDiffStart(p.doc.content),C=h.doc.content.findDiffEnd(p.doc.content);if(!(!P0(w)||!C||w===C.b))return a({rule:d,state:p,from:w,to:C,pasteEvt:i})}}))}var Lo=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=Yd(t),this.schema=E0(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:$i(e.name,this.schema)},r=V(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Pi([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:$i(r.name,this.schema)},s=[],i=V(r,"addKeyboardShortcuts",o);let l={};if(r.type==="mark"&&V(r,"exitable",o)&&(l.ArrowRight=()=>dt.handleExit({editor:t,mark:r})),i){const h=Object.fromEntries(Object.entries(i()).map(([p,m])=>[p,()=>m({editor:t})]));l={...l,...h}}const a=Gg(l);s.push(a);const c=V(r,"addInputRules",o);if(ou(r,t.options.enableInputRules)&&c){const h=c();if(h&&h.length){const p=D0({editor:t,rules:h}),m=Array.isArray(p)?p:[p];s.push(...m)}}const d=V(r,"addPasteRules",o);if(ou(r,t.options.enablePasteRules)&&d){const h=d();if(h&&h.length){const p=H0({editor:t,rules:h});s.push(...p)}}const u=V(r,"addProseMirrorPlugins",o);if(u){const h=u();s.push(...h)}return s})}get attributes(){return qd(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Sr(this.extensions);return Object.fromEntries(e.filter(n=>!!V(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:Ee(n.name,this.schema)},s=V(n,"addNodeView",o);if(!s)return[];const i=(l,a,c,d,u)=>{const h=Co(l,r);return s()({node:l,view:a,getPos:c,decorations:d,innerDecorations:u,editor:t,extension:n,HTMLAttributes:h})};return[n.name,i]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=Sr(this.extensions);return Object.fromEntries(e.filter(n=>!!V(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:Ot(n.name,this.schema)},s=V(n,"addMarkView",o);if(!s)return[];const i=(l,a,c)=>{const d=Co(l,r);return s()({mark:l,view:a,inline:c,editor:t,extension:n,HTMLAttributes:d,updateAttributes:u=>{nb(l,t,u)}})};return[n.name,i]}))}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:$i(e.name,this.schema)};e.type==="mark"&&((n=Q(V(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=V(e,"onBeforeCreate",r),s=V(e,"onCreate",r),i=V(e,"onUpdate",r),l=V(e,"onSelectionUpdate",r),a=V(e,"onTransaction",r),c=V(e,"onFocus",r),d=V(e,"onBlur",r),u=V(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),s&&this.editor.on("create",s),i&&this.editor.on("update",i),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u)})}};Lo.resolve=Yd,Lo.sort=Pi,Lo.flatten=Di;var z0={};zd(z0,{ClipboardTextSerializer:()=>du,Commands:()=>mu,Delete:()=>gu,Drop:()=>yu,Editable:()=>bu,FocusEvents:()=>xu,Keymap:()=>Eu,Paste:()=>wu,Tabindex:()=>Cu,focusEventsPluginKey:()=>ku});var te=class dp extends zi{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new dp(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},du=te.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ue({key:new ye("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:s}=o,i=Math.min(...s.map(d=>d.$from.pos)),l=Math.max(...s.map(d=>d.$to.pos)),a=Qd(n);return Xd(r,{from:i,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),uu={};zd(uu,{blur:()=>U0,clearContent:()=>j0,clearNodes:()=>W0,command:()=>K0,createParagraphNear:()=>q0,cut:()=>G0,deleteCurrentNode:()=>J0,deleteNode:()=>Y0,deleteRange:()=>X0,deleteSelection:()=>Q0,enter:()=>Z0,exitCode:()=>ey,extendMarkRange:()=>ty,first:()=>ny,focus:()=>oy,forEach:()=>sy,insertContent:()=>iy,insertContentAt:()=>ay,joinBackward:()=>uy,joinDown:()=>dy,joinForward:()=>fy,joinItemBackward:()=>hy,joinItemForward:()=>py,joinTextblockBackward:()=>my,joinTextblockForward:()=>gy,joinUp:()=>cy,keyboardShortcut:()=>by,lift:()=>ky,liftEmptyBlock:()=>xy,liftListItem:()=>Ey,newlineInCode:()=>wy,resetAttributes:()=>Cy,scrollIntoView:()=>Sy,selectAll:()=>Ty,selectNodeBackward:()=>Ny,selectNodeForward:()=>vy,selectParentNode:()=>_y,selectTextblockEnd:()=>My,selectTextblockStart:()=>Ay,setContent:()=>Oy,setMark:()=>Iy,setMeta:()=>Dy,setNode:()=>Ry,setNodeSelection:()=>Py,setTextSelection:()=>By,sinkListItem:()=>Fy,splitBlock:()=>Vy,splitListItem:()=>$y,toggleList:()=>Hy,toggleMark:()=>zy,toggleNode:()=>Uy,toggleWrap:()=>jy,undoInputRule:()=>Wy,unsetAllMarks:()=>Ky,unsetMark:()=>qy,updateAttributes:()=>Gy,wrapIn:()=>Jy,wrapInList:()=>Yy});var U0=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),j0=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),W0=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:s,$to:i})=>{t.doc.nodesBetween(s.pos,i.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:d}=e,u=c.resolve(d.map(a)),h=c.resolve(d.map(a+l.nodeSize)),p=u.blockRange(h);if(!p)return;const m=Pn(p);if(l.type.isTextblock){const{defaultType:g}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(p.start,g)}(m||m===0)&&e.lift(p,m)})}),!0},K0=t=>e=>t(e),q0=()=>({state:t,dispatch:e})=>Bd(t,e),G0=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,s=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const i=r.mapping.map(e);return r.insert(i,s.content),r.setSelection(new H(r.doc.resolve(Math.max(i-1,0)))),!0},J0=()=>({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 s=o.depth;s>0;s-=1)if(o.node(s).type===r.type){if(e){const l=o.before(s),a=o.after(s);t.delete(l,a).scrollIntoView()}return!0}return!1},Y0=t=>({tr:e,state:n,dispatch:r})=>{const o=Ee(t,n.schema),s=e.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===o){if(r){const a=s.before(i),c=s.after(i);e.delete(a,c).scrollIntoView()}return!0}return!1},X0=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},Q0=()=>({state:t,dispatch:e})=>_i(t,e),Z0=()=>({commands:t})=>t.keyboardShortcut("Enter"),ey=()=>({state:t,dispatch:e})=>e0(t,e),ty=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const s=Ot(t,r.schema),{doc:i,selection:l}=n,{$from:a,from:c,to:d}=l;if(o){const u=Fi(a,s,e);if(u&&u.from<=c&&u.to>=d){const h=H.create(i,u.from,u.to);n.setSelection(h)}}return!0},ny=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 ry(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ui(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var oy=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const i=()=>{(Ui()||ry())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!lu(n.state.selection))return i(),!0;const l=au(o.doc,t)||n.state.selection,a=n.state.selection.eq(l);return s&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),i()),!0},sy=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),iy=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),ly=t=>!("type"in t),ay=(t,e,n)=>({tr:r,dispatch:o,editor:s})=>{var i;if(o){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=y=>{s.emit("contentError",{editor:s,error:y,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Cr(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=Cr(e,s.schema,{parseOptions:c,errorOnInvalidContent:(i=n.errorOnInvalidContent)!=null?i:s.options.enableContentCheck})}catch(y){return a(y),!1}let{from:d,to:u}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,p=!0;if((ly(l)?l:[l]).forEach(y=>{y.check(),h=h?y.isText&&y.marks.length===0:!1,p=p?y.isBlock:!1}),d===u&&p){const{parent:y}=r.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,u+=1)}let g;if(h){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof v){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,d,u)}else{g=l;const y=r.doc.resolve(d),b=y.node(),k=y.parentOffset===0,w=b.isText||b.isTextblock,C=b.content.size>0;k&&w&&C&&(d=Math.max(0,d-1)),r.replaceWith(d,u,g)}n.updateSelection&&L0(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:g})}return!0},cy=()=>({state:t,dispatch:e})=>Xg(t,e),dy=()=>({state:t,dispatch:e})=>Qg(t,e),uy=()=>({state:t,dispatch:e})=>Ad(t,e),fy=()=>({state:t,dispatch:e})=>Dd(t,e),hy=()=>({state:t,dispatch:e,tr:n})=>{try{const r=so(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},py=()=>({state:t,dispatch:e,tr:n})=>{try{const r=so(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},my=()=>({state:t,dispatch:e})=>Jg(t,e),gy=()=>({state:t,dispatch:e})=>Yg(t,e);function fu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function yy(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,s,i;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))i=!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))s=!0;else if(/^mod$/i.test(a))Ui()||fu()?i=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),i&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var by=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const s=yy(t).split(/-(?!$)/),i=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a?.steps.forEach(c=>{const d=c.map(r.mapping);d&&o&&r.maybeStep(d)}),!0},ky=(t,e={})=>({state:n,dispatch:r})=>{const o=Ee(t,n.schema);return Xt(n,o,e)?Zg(n,r):!1},xy=()=>({state:t,dispatch:e})=>Fd(t,e),Ey=t=>({state:e,dispatch:n})=>{const r=Ee(t,e.schema);return u0(r)(e,n)},wy=()=>({state:t,dispatch:e})=>Pd(t,e);function hu(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 Cy=(t,e)=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const l=So(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(s=Ee(t,r.schema)),l==="mark"&&(i=Ot(t,r.schema)),o&&n.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,d)=>{s&&s===c.type&&n.setNodeMarkup(d,void 0,hu(c.attrs,e)),i&&c.marks.length&&c.marks.forEach(u=>{i===u.type&&n.addMark(d,d+c.nodeSize,i.create(hu(u.attrs,e)))})})}),!0):!1},Sy=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Ty=()=>({tr:t,dispatch:e})=>{if(e){const n=new Ye(t.doc);t.setSelection(n)}return!0},Ny=()=>({state:t,dispatch:e})=>Ld(t,e),vy=()=>({state:t,dispatch:e})=>Rd(t,e),_y=()=>({state:t,dispatch:e})=>r0(t,e),My=()=>({state:t,dispatch:e})=>i0(t,e),Ay=()=>({state:t,dispatch:e})=>s0(t,e),Oy=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:s,dispatch:i,commands:l})=>{const{doc:a}=s;if(r.preserveWhitespace!=="full"){const c=Ii(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return i&&s.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!n),!0}return i&&s.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function Ly(t,e,n){var r;const{selection:o}=e;let s=null;if(lu(o)&&(s=o.$cursor),s){const l=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(c=>c.type.excludes(n)))}const{ranges:i}=o;return i.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,(d,u,h)=>{if(c)return!1;if(d.isInline){const p=!h||h.type.allowsMarkType(n),m=!!n.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(n));c=p&&m}return!c}),c})}var Iy=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=n,{empty:i,ranges:l}=s,a=Ot(t,r.schema);if(o)if(i){const c=Zd(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(h,p)=>{const m=Math.max(p,d),g=Math.min(p+h.nodeSize,u);h.marks.find(b=>b.type===a)?h.marks.forEach(b=>{a===b.type&&n.addMark(m,g,a.create({...b.attrs,...e}))}):n.addMark(m,g,a.create(e))})});return Ly(r,n,a)},Dy=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Ry=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const s=Ee(t,n.schema);let i;return n.selection.$anchor.sameParent(n.selection.$head)&&(i=n.selection.$anchor.parent.attrs),s.isTextblock?o().command(({commands:l})=>Hd(s,{...i,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Hd(s,{...i,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Py=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=wn(t,0,r.content.size),s=$.create(r,o);e.setSelection(s)}return!0},By=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:s}=typeof t=="number"?{from:t,to:t}:t,i=H.atStart(r).from,l=H.atEnd(r).to,a=wn(o,i,l),c=wn(s,i,l),d=H.create(r,a,c);e.setSelection(d)}return!0},Fy=t=>({state:e,dispatch:n})=>{const r=Ee(t,e.schema);return p0(r)(e,n)};function pu(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 Vy=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:s,doc:i}=e,{$from:l,$to:a}=s,c=o.extensionManager.attributes,d=No(c,l.node().type.name,l.node().attrs);if(s instanceof $&&s.node.isBlock)return!l.parentOffset||!Nt(i,l.pos)?!1:(r&&(t&&pu(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const u=a.parentOffset===a.parent.content.size,h=l.depth===0?void 0:y0(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=u&&h?[{type:h,attrs:d}]:void 0,m=Nt(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!m&&Nt(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:d}]:void 0),r){if(m&&(s instanceof H&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,p),h&&!u&&!l.parentOffset&&l.parent.type!==h)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}t&&pu(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return m},$y=(t,e={})=>({tr:n,state:r,dispatch:o,editor:s})=>{var i;const l=Ee(t,r.schema),{$from:a,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(c))return!1;const u=a.node(-1);if(u.type!==l)return!1;const h=s.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=v.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let I=a.depth-k;I>=a.depth-3;I-=1)b=v.from(a.node(I).copy(b));const w=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,C={...No(h,a.node().type.name,a.node().attrs),...e},T=((i=l.contentMatch.defaultType)==null?void 0:i.createAndFill(C))||void 0;b=b.append(v.from(l.createAndFill(null,T)||void 0));const _=a.before(a.depth-(k-1));n.replace(_,a.after(-w),new L(b,4-k,0));let S=-1;n.doc.nodesBetween(_,n.doc.content.size,(I,F)=>{if(S>-1)return!1;I.isTextblock&&I.content.size===0&&(S=F+1)}),S>-1&&n.setSelection(H.near(n.doc.resolve(S))),n.scrollIntoView()}return!0}const p=c.pos===a.end()?u.contentMatchAt(0).defaultType:null,m={...No(h,u.type.name,u.attrs),...e},g={...No(h,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,c.pos);const y=p?[{type:l,attrs:m},{type:p,attrs:g}]:[{type:l,attrs:m}];if(!Nt(n.doc,a.pos,2))return!1;if(o){const{selection:b,storedMarks:k}=r,{splittableMarks:w}=s.extensionManager,C=k||b.$to.parentOffset&&b.$from.marks();if(n.split(a.pos,2,y).scrollIntoView(),!C||!o)return!0;const T=C.filter(_=>w.includes(_.type.name));n.ensureMarks(T)}return!0},ji=(t,e)=>{const n=wo(i=>i.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&&Ht(t.doc,n.pos)&&t.join(n.pos),!0},Wi=(t,e)=>{const n=wo(i=>i.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&&Ht(t.doc,r)&&t.join(r),!0},Hy=(t,e,n,r={})=>({editor:o,tr:s,state:i,dispatch:l,chain:a,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=o.extensionManager,p=Ee(t,i.schema),m=Ee(e,i.schema),{selection:g,storedMarks:y}=i,{$from:b,$to:k}=g,w=b.blockRange(k),C=y||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const T=wo(_=>su(_.type.name,u))(g);if(w.depth>=1&&T&&w.depth-T.depth<=1){if(T.node.type===p)return c.liftListItem(m);if(su(T.node.type.name,u)&&p.validContent(T.node.content)&&l)return a().command(()=>(s.setNodeMarkup(T.pos,p),!0)).command(()=>ji(s,p)).command(()=>Wi(s,p)).run()}return!n||!C||!l?a().command(()=>d().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>ji(s,p)).command(()=>Wi(s,p)).run():a().command(()=>{const _=d().wrapInList(p,r),S=C.filter(I=>h.includes(I.type.name));return s.ensureMarks(S),_?!0:c.clearNodes()}).wrapInList(p,r).command(()=>ji(s,p)).command(()=>Wi(s,p)).run()},zy=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=n,i=Ot(t,r.schema);return Hi(r,i,e)?o.unsetMark(i,{extendEmptyMarkRange:s}):o.setMark(i,e)},Uy=(t,e,n={})=>({state:r,commands:o})=>{const s=Ee(t,r.schema),i=Ee(e,r.schema),l=Xt(r,s,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?o.setNode(i,a):o.setNode(s,{...a,...n})},jy=(t,e={})=>({state:n,commands:r})=>{const o=Ee(t,n.schema);return Xt(n,o,e)?r.lift(o):r.wrapIn(o,e)},Wy=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let s;if(o.spec.isInputRules&&(s=o.getState(t))){if(e){const i=t.tr,l=s.transform;for(let a=l.steps.length-1;a>=0;a-=1)i.step(l.steps[a].invert(l.docs[a]));if(s.text){const a=i.doc.resolve(s.from).marks();i.replaceWith(s.from,s.to,t.schema.text(s.text,a))}else i.delete(s.from,s.to)}return!0}}return!1},Ky=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},qy=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:i=!1}=e,{selection:l}=n,a=Ot(t,r.schema),{$from:c,empty:d,ranges:u}=l;if(!o)return!0;if(d&&i){let{from:h,to:p}=l;const m=(s=c.marks().find(y=>y.type===a))==null?void 0:s.attrs,g=Fi(c,a,m);g&&(h=g.from,p=g.to),n.removeMark(h,p,a)}else u.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,a)});return n.removeStoredMark(a),!0},Gy=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const l=So(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(s=Ee(t,r.schema)),l==="mark"&&(i=Ot(t,r.schema)),o&&n.selection.ranges.forEach(a=>{const c=a.$from.pos,d=a.$to.pos;let u,h,p,m;n.selection.empty?r.doc.nodesBetween(c,d,(g,y)=>{s&&s===g.type&&(p=Math.max(y,c),m=Math.min(y+g.nodeSize,d),u=y,h=g)}):r.doc.nodesBetween(c,d,(g,y)=>{y<c&&s&&s===g.type&&(p=Math.max(y,c),m=Math.min(y+g.nodeSize,d),u=y,h=g),y>=c&&y<=d&&(s&&s===g.type&&n.setNodeMarkup(y,void 0,{...g.attrs,...e}),i&&g.marks.length&&g.marks.forEach(b=>{if(i===b.type){const k=Math.max(y,c),w=Math.min(y+g.nodeSize,d);n.addMark(k,w,i.create({...b.attrs,...e}))}}))}),h&&(u!==void 0&&n.setNodeMarkup(u,void 0,{...h.attrs,...e}),i&&h.marks.length&&h.marks.forEach(g=>{i===g.type&&n.addMark(p,m,i.create({...g.attrs,...e}))}))}),!0):!1},Jy=(t,e={})=>({state:n,dispatch:r})=>{const o=Ee(t,n.schema);return l0(o,e)(n,r)},Yy=(t,e={})=>({state:n,dispatch:r})=>{const o=Ee(t,n.schema);return a0(o,e)(n,r)},mu=te.create({name:"commands",addCommands(){return{...uu}}}),gu=te.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,o;const s=()=>{var i,l,a,c;if((c=(a=(l=(i=this.editor.options.coreExtensionOptions)==null?void 0:i.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,t))!=null?c:t.getMeta("y-sync$"))return;const d=Ud(t.before,[t,...e]);tu(d).forEach(p=>{d.mapping.mapResult(p.oldRange.from).deletedAfter&&d.mapping.mapResult(p.oldRange.to).deletedBefore&&d.before.nodesBetween(p.oldRange.from,p.oldRange.to,(m,g)=>{const y=g+m.nodeSize-2,b=p.oldRange.from<=g&&y<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:d.mapping.map(g),newTo:d.mapping.map(y),deletedRange:p.oldRange,newRange:p.newRange,partial:!b,editor:this.editor,transaction:t,combinedTransform:d})})});const h=d.mapping;d.steps.forEach((p,m)=>{var g,y;if(p instanceof ct){const b=h.slice(m).map(p.from,-1),k=h.slice(m).map(p.to),w=h.invert().map(b,-1),C=h.invert().map(k),T=(g=d.doc.nodeAt(b-1))==null?void 0:g.marks.some(S=>S.eq(p.mark)),_=(y=d.doc.nodeAt(k))==null?void 0:y.marks.some(S=>S.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:w,to:C},newRange:{from:b,to:k},partial:!!(_||T),editor:this.editor,transaction:t,combinedTransform:d})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(s,0):s()}}),yu=te.create({name:"drop",addProseMirrorPlugins(){return[new ue({key:new ye("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),bu=te.create({name:"editable",addProseMirrorPlugins(){return[new ue({key:new ye("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ku=new ye("focusEvents"),xu=te.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ue({key:ku,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}}}})]}}),Eu=te.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:d,$anchor:u}=a,{pos:h,parent:p}=u,m=u.parent.isTextblock&&h>0?l.doc.resolve(h-1):u,g=m.parent.type.spec.isolating,y=u.pos-u.parentOffset,b=g&&m.parent.childCount===1?y===u.pos:z.atStart(c).from===h;return!d||!p.type.isTextblock||p.textContent.length||!b||b&&u.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.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},s={...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 Ui()||fu()?s:o},addProseMirrorPlugins(){return[new ue({key:new ye("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(g=>g.getMeta("composition")))return;const r=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),o=t.some(g=>g.getMeta("preventClearDocument"));if(!r||o)return;const{empty:s,from:i,to:l}=e.selection,a=z.atStart(e.doc).from,c=z.atEnd(e.doc).to;if(s||!(i===a&&l===c)||!vo(n.doc))return;const h=n.tr,p=ko({state:n,transaction:h}),{commands:m}=new xo({editor:this.editor,state:p});if(m.clearNodes(),!!h.steps.length)return h}})]}}),wu=te.create({name:"paste",addProseMirrorPlugins(){return[new ue({key:new ye("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Cu=te.create({name:"tabindex",addProseMirrorPlugins(){return[new ue({key:new ye("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Xy=class or{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 or(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 or(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 or(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,i=this.pos+r+(s?0:1);if(i<0||i>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(i);if(!o&&l.depth<=this.depth)return;const a=new or(l,this.editor,o,o?n:null);o&&(a.actualDepth=this.depth+1),e.push(new or(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 s=o.node.attrs,i=Object.keys(n);for(let l=0;l<i.length;l+=1){const a=i[l];if(s[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 s=Object.keys(n);return this.children.forEach(i=>{r&&o.length>0||(i.node.type.name===e&&s.every(a=>n[a]===i.node.attrs[a])&&o.push(i),!(r&&o.length>0)&&(o=o.concat(i.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)}},Qy=`.ProseMirror {
|
|
1
|
+
(function(Gt,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(Gt=typeof globalThis<"u"?globalThis:Gt||self,i(Gt.richtext={},Gt.Vue))})(this,(function(Gt,i){"use strict";function Qe(n){this.content=n}Qe.prototype={constructor:Qe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),s=r.content.slice();return o==-1?s.push(t||n,e):(s[o+1]=e,t&&(s[o]=t)),new Qe(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Qe(t)},addToStart:function(n,e){return new Qe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Qe(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),s=r.find(n);return o.splice(s==-1?o.length:s,0,e,t),new Qe(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Qe.from(n),n.size?new Qe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Qe.from(n),n.size?new Qe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Qe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Qe.from=function(n){if(n instanceof Qe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Qe(e)};function Ec(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),s=e.child(r);if(o==s){t+=o.nodeSize;continue}if(!o.sameMarkup(s))return t;if(o.isText&&o.text!=s.text){for(let l=0;o.text[l]==s.text[l];l++)t++;return t}if(o.content.size||s.content.size){let l=Ec(o.content,s.content,t+1);if(l!=null)return l}t+=o.nodeSize}}function Cc(n,e,t,r){for(let o=n.childCount,s=e.childCount;;){if(o==0||s==0)return o==s?null:{a:t,b:r};let l=n.child(--o),a=e.child(--s),c=l.nodeSize;if(l==a){t-=c,r-=c;continue}if(!l.sameMarkup(a))return{a:t,b:r};if(l.isText&&l.text!=a.text){let d=0,u=Math.min(l.text.length,a.text.length);for(;d<u&&l.text[l.text.length-d-1]==a.text[a.text.length-d-1];)d++,t--,r--;return{a:t,b:r}}if(l.content.size||a.content.size){let d=Cc(l.content,a.content,t-1,r-1);if(d)return d}t-=c,r-=c}}class I{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,s){for(let l=0,a=0;a<t;l++){let c=this.content[l],d=a+c.nodeSize;if(d>e&&r(c,o+a,s||null,l)!==!1&&c.content.size){let u=a+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,t-u),r,o+u)}a=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let s="",l=!0;return this.nodesBetween(e,t,(a,c)=>{let d=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&d||a.isTextblock)&&r&&(l?l=!1:s+=r),s+=d},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)o.push(e.content[s]);return new I(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;c>e&&((l<e||c>t)&&(a.isText?a=a.cut(Math.max(0,e-l),Math.min(a.text.length,t-l)):a=a.cut(Math.max(0,e-l-1),Math.min(a.content.size,t-l-1))),r.push(a),o+=a.nodeSize),l=c}return new I(r,o)}cutByIndex(e,t){return e==t?I.empty:e==0&&t==this.content.length?this:new I(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new I(o,s)}addToStart(e){return new I([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new I(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return Ec(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Cc(this,e,t,r)}findIndex(e){if(e==0)return Wo(0,e);if(e==this.size)return Wo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let o=this.child(t),s=r+o.nodeSize;if(s>=e)return s==e?Wo(t+1,s):Wo(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return I.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new I(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return I.empty;let t,r=0;for(let o=0;o<e.length;o++){let s=e[o];r+=s.nodeSize,o&&s.isText&&e[o-1].sameMarkup(s)?(t||(t=e.slice(0,o)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new I(t||e,r)}static from(e){if(!e)return I.empty;if(e instanceof I)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new I([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}I.empty=new I([],0);const Fl={index:0,offset:0};function Wo(n,e){return Fl.index=n,Fl.offset=e,Fl}function Ko(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Ko(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Ko(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Se=class kc{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let s=e[o];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,o));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ko(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let o=r.create(t.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return kc.none;if(e instanceof kc)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};Se.none=[];class qo extends Error{}class q{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=_c(this.content,e+this.openStart,t);return r&&new q(r,this.openStart,this.openEnd)}removeBetween(e,t){return new q(vc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return q.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new q(I.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)o++;return new q(e,r,o)}}q.empty=new q(I.empty,0,0);function vc(n,e,t){let{index:r,offset:o}=n.findIndex(e),s=n.maybeChild(r),{index:l,offset:a}=n.findIndex(t);if(o==e||s.isText){if(a!=t&&!n.child(l).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=l)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(vc(s.content,e-o-1,t-o-1)))}function _c(n,e,t,r){let{index:o,offset:s}=n.findIndex(e),l=n.maybeChild(o);if(s==e||l.isText)return r&&!r.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=_c(l.content,e-s-1,t,l);return a&&n.replaceChild(o,l.copy(a))}function zm(n,e,t){if(t.openStart>n.depth)throw new qo("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new qo("Inconsistent open depths");return Sc(n,e,t,0)}function Sc(n,e,t,r){let o=n.index(r),s=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let l=Sc(n,e,t,r+1);return s.copy(s.content.replaceChild(o,l))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let l=n.parent,a=l.content;return Qn(l,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:l,end:a}=Hm(t,n);return Qn(s,Mc(n,l,a,e,r))}else return Qn(s,Go(n,e,r))}function Nc(n,e){if(!e.type.compatibleContent(n.type))throw new qo("Cannot join "+e.type.name+" onto "+n.type.name)}function Pl(n,e,t){let r=n.node(t);return Nc(r,e.node(t)),r}function Zn(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function qr(n,e,t,r){let o=(e||n).node(t),s=0,l=e?e.index(t):o.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Zn(n.nodeAfter,r),s++));for(let a=s;a<l;a++)Zn(o.child(a),r);e&&e.depth==t&&e.textOffset&&Zn(e.nodeBefore,r)}function Qn(n,e){return n.type.checkContent(e),n.copy(e)}function Mc(n,e,t,r,o){let s=n.depth>o&&Pl(n,e,o+1),l=r.depth>o&&Pl(t,r,o+1),a=[];return qr(null,n,o,a),s&&l&&e.index(o)==t.index(o)?(Nc(s,l),Zn(Qn(s,Mc(n,e,t,r,o+1)),a)):(s&&Zn(Qn(s,Go(n,e,o+1)),a),qr(e,t,o,a),l&&Zn(Qn(l,Go(t,r,o+1)),a)),qr(r,null,o,a),new I(a)}function Go(n,e,t){let r=[];if(qr(null,n,t,r),n.depth>t){let o=Pl(n,e,t+1);Zn(Qn(o,Go(n,e,t+1)),r)}return qr(e,null,t,r),new I(r)}function Hm(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)o=e.node(s).copy(I.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class Gr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)o+=r.child(s).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Se.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let a=r;r=o,o=a}let s=r.marks;for(var l=0;l<s.length;l++)s[l].type.spec.inclusive===!1&&(!o||!s[l].isInSet(o.marks))&&(s=s[l--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Jo(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],o=0,s=t;for(let l=e;;){let{index:a,offset:c}=l.content.findIndex(s),d=s-c;if(r.push(l,a,o+c),!d||(l=l.child(a),l.isText))break;s=d-1,o+=c+1}return new Gr(t,r,s)}static resolveCached(e,t){let r=Tc.get(e);if(r)for(let s=0;s<r.elts.length;s++){let l=r.elts[s];if(l.pos==t)return l}else Tc.set(e,r=new jm);let o=r.elts[r.i]=Gr.resolve(e,t);return r.i=(r.i+1)%Um,o}}class jm{constructor(){this.elts=[],this.i=0}}const Um=12,Tc=new WeakMap;class Jo{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Wm=Object.create(null);let Sn=class xc{constructor(e,t,r,o=Se.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||I.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,o=0){this.content.nodesBetween(e,t,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Ko(this.attrs,t||e.defaultAttrs||Wm)&&Se.sameSet(this.marks,r||Se.none)}copy(e=null){return e==this.content?this:new xc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new xc(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return q.empty;let o=this.resolve(e),s=this.resolve(t),l=r?0:o.sharedDepth(t),a=o.start(l),d=o.node(l).content.cut(o.pos-a,s.pos-a);return new q(d,o.depth-l,s.depth-l)}replace(e,t,r){return zm(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return Gr.resolveCached(this,e)}resolveNoCache(e){return Gr.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.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()+")"),Ac(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=I.empty,o=0,s=r.childCount){let l=this.contentMatchAt(e).matchFragment(r,o,s),a=l&&l.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let c=o;c<s;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let s=this.contentMatchAt(e).matchType(r),l=s&&s.matchFragment(this.content,t);return l?l.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=Se.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Se.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=I.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,o,r);return s.type.checkAttrs(s.attrs),s}};Sn.prototype.text=void 0;class Yo extends Sn{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ac(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Yo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Yo(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ac(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class er{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Km(e,t);if(r.next==null)return er.empty;let o=Bc(r);r.next&&r.err("Unexpected trailing text");let s=Qm(Zm(o));return eg(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let o=this;for(let s=t;o&&s<r;s++)o=o.matchType(e.child(s).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function s(l,a){let c=l.matchFragment(e,r);if(c&&(!t||c.validEnd))return I.from(a.map(d=>d.createAndFill()));for(let d=0;d<l.next.length;d++){let{type:u,next:f}=l.next[d];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(f)==-1){o.push(f);let p=s(f,a.concat(u));if(p)return p}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),s=o.match;if(s.matchType(e)){let l=[];for(let a=o;a.type;a=a.via)l.push(a.type);return l.reverse()}for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!o.type||c.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let s=o+(r.validEnd?"*":" ")+" ";for(let l=0;l<r.next.length;l++)s+=(l?", ":"")+r.next[l].type.name+"->"+e.indexOf(r.next[l].next);return s}).join(`
|
|
2
|
+
`)}}er.empty=new er(!0);class Km{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Bc(n){let e=[];do e.push(qm(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function qm(n){let e=[];do e.push(Gm(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Gm(n){let e=Xm(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Jm(n,e);else break;return e}function Vc(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Jm(n,e){let t=Vc(n),r=t;return n.eat(",")&&(n.next!="}"?r=Vc(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Ym(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let s in t){let l=t[s];l.isInGroup(e)&&o.push(l)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function Xm(n){if(n.eat("(")){let e=Bc(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Ym(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Zm(n){let e=[[]];return o(s(n,0),t()),e;function t(){return e.push([])-1}function r(l,a,c){let d={term:c,to:a};return e[l].push(d),d}function o(l,a){l.forEach(c=>c.to=a)}function s(l,a){if(l.type=="choice")return l.exprs.reduce((c,d)=>c.concat(s(d,a)),[]);if(l.type=="seq")for(let c=0;;c++){let d=s(l.exprs[c],a);if(c==l.exprs.length-1)return d;o(d,a=t())}else if(l.type=="star"){let c=t();return r(a,c),o(s(l.expr,c),c),[r(c)]}else if(l.type=="plus"){let c=t();return o(s(l.expr,a),c),o(s(l.expr,c),c),[r(c)]}else{if(l.type=="opt")return[r(a)].concat(s(l.expr,a));if(l.type=="range"){let c=a;for(let d=0;d<l.min;d++){let u=t();o(s(l.expr,c),u),c=u}if(l.max==-1)o(s(l.expr,c),c);else for(let d=l.min;d<l.max;d++){let u=t();r(c,u),o(s(l.expr,c),u),c=u}return[r(c)]}else{if(l.type=="name")return[r(a,void 0,l.value)];throw new Error("Unknown expr type")}}}}function Lc(n,e){return e-n}function Oc(n,e){let t=[];return r(e),t.sort(Lc);function r(o){let s=n[o];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(o);for(let l=0;l<s.length;l++){let{term:a,to:c}=s[l];!a&&t.indexOf(c)==-1&&r(c)}}}function Qm(n){let e=Object.create(null);return t(Oc(n,0));function t(r){let o=[];r.forEach(l=>{n[l].forEach(({term:a,to:c})=>{if(!a)return;let d;for(let u=0;u<o.length;u++)o[u][0]==a&&(d=o[u][1]);Oc(n,c).forEach(u=>{d||o.push([a,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let s=e[r.join(",")]=new er(r.indexOf(n.length-1)>-1);for(let l=0;l<o.length;l++){let a=o[l][1].sort(Lc);s.next.push({type:o[l][0],next:e[a.join(",")]||t(a)})}return s}}function eg(n,e){for(let t=0,r=[n];t<r.length;t++){let o=r[t],s=!o.validEnd,l=[];for(let a=0;a<o.next.length;a++){let{type:c,next:d}=o.next[a];l.push(c.name),s&&!(c.isText||c.hasRequiredAttrs())&&(s=!1),r.indexOf(d)==-1&&r.push(d)}s&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Ic(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Dc(n,e){let t=Object.create(null);for(let r in n){let o=e&&e[r];if(o===void 0){let s=n[r];if(s.hasDefault)o=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=o}return t}function Rc(n,e,t,r){for(let o in e)if(!(o in n))throw new RangeError(`Unsupported attribute ${o} for ${t} of type ${o}`);for(let o in n){let s=n[o];s.validate&&s.validate(e[o])}}function Fc(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new ng(n,r,e[r]);return t}let Pc=class Dm{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Fc(e,r.attrs),this.defaultAttrs=Ic(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==er.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:Dc(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Sn(this,this.computeAttrs(e),I.from(t),Se.setFrom(r))}createChecked(e=null,t,r){return t=I.from(t),this.checkContent(t),new Sn(this,this.computeAttrs(e),t,Se.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=I.from(t),t.size){let l=this.contentMatch.fillBefore(t);if(!l)return null;t=l.append(t)}let o=this.contentMatch.matchFragment(t),s=o&&o.fillBefore(I.empty,!0);return s?new Sn(this,e,t.append(s),Se.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Rc(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Se.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,l)=>r[s]=new Dm(s,t,l));let o=t.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function tg(n,e,t){let r=t.split("|");return o=>{let s=o===null?"null":typeof o;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class ng{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?tg(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Xo{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=Fc(e,o.attrs),this.excluded=null;let s=Ic(this.attrs);this.instance=s?new Se(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Se(this,Dc(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((s,l)=>r[s]=new Xo(s,o++,t,l)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Rc(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class $c{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=Qe.from(e.nodes),t.marks=Qe.from(e.marks||{}),this.nodes=Pc.compile(this.spec.nodes,this),this.marks=Xo.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 s=this.nodes[o],l=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[l]||(r[l]=er.parse(l,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?zc(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let o in this.marks){let s=this.marks[o],l=s.spec.excludes;s.excluded=l==null?[s]:l==""?[]:zc(this,l.split(" "))}this.nodeFromJSON=o=>Sn.fromJSON(this,o),this.markFromJSON=o=>Se.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Pc){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,o)}text(e,t){let r=this.nodes.text;return new Yo(r,r.defaultAttrs,e,Se.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function zc(n,e){let t=[];for(let r=0;r<e.length;r++){let o=e[r],s=n.marks[o],l=s;if(s)t.push(s);else for(let a in n.marks){let c=n.marks[a];(o=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(o)>-1)&&t.push(l=c)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function rg(n){return n.tag!=null}function og(n){return n.style!=null}let wr=class wc{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(o=>{if(rg(o))this.tags.push(o);else if(og(o)){let s=/[^=]*/.exec(o.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let s=e.nodes[o.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new Wc(this,t,!1);return r.addAll(e,Se.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Wc(this,t,!0);return r.addAll(e,Se.none,t.from,t.to),q.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let s=this.tags[o];if(ig(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let l=s.getAttrs(e);if(l===!1)continue;s.attrs=l||void 0}return s}}}matchStyle(e,t,r,o){for(let s=o?this.styles.indexOf(o)+1:0;s<this.styles.length;s++){let l=this.styles[s],a=l.style;if(!(a.indexOf(e)!=0||l.context&&!r.matchesContext(l.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(l.getAttrs){let c=l.getAttrs(t);if(c===!1)continue;l.attrs=c||void 0}return l}}}static schemaRules(e){let t=[];function r(o){let s=o.priority==null?50:o.priority,l=0;for(;l<t.length;l++){let a=t[l];if((a.priority==null?50:a.priority)<s)break}t.splice(l,0,o)}for(let o in e.marks){let s=e.marks[o].spec.parseDOM;s&&s.forEach(l=>{r(l=Kc(l)),l.mark||l.ignore||l.clearMark||(l.mark=o)})}for(let o in e.nodes){let s=e.nodes[o].spec.parseDOM;s&&s.forEach(l=>{r(l=Kc(l)),l.node||l.ignore||l.mark||(l.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new wc(e,wc.schemaRules(e)))}};const Hc={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},sg={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},jc={ol:!0,ul:!0},Jr=1,$l=2,Yr=4;function Uc(n,e,t){return e!=null?(e?Jr:0)|(e==="full"?$l:0):n&&n.whitespace=="pre"?Jr|$l:t&~Yr}class Zo{constructor(e,t,r,o,s,l){this.type=e,this.attrs=t,this.marks=r,this.solid=o,this.options=l,this.content=[],this.activeMarks=Se.none,this.match=s||(l&Yr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(I.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Jr)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-o[0].length))}}let t=I.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(I.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Hc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Wc{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=t.topNode,s,l=Uc(null,t.preserveWhitespace,0)|(r?Yr:0);o?s=new Zo(o.type,o.attrs,Se.none,!0,t.topMatch||o.type.contentMatch,l):r?s=new Zo(null,null,Se.none,!0,null,l):s=new Zo(e.schema.topNodeType,null,Se.none,!0,null,l),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,o=this.top,s=o.options&$l?"full":this.localPreserveWS||(o.options&Jr)>0;if(s==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)s!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
|
|
3
|
+
`);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(this.parser.schema.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let o=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l=e.nodeName.toLowerCase(),a;jc.hasOwnProperty(l)&&this.parser.normalizeLists&&lg(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(c?c.ignore:sg.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,t);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let d,u=this.needsBlock;if(Hc.hasOwnProperty(l))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),d=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=c&&c.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),d&&this.sync(s),this.needsBlock=u}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,c,d,c.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
|
+
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let s=this.parser.matchedStyles[o],l=r.getPropertyValue(s);if(l)for(let a=void 0;;){let c=this.parser.matchStyle(s,l,this,a);if(!c)break;if(c.ignore)return null;if(c.clearMark?t=t.filter(d=>!c.clearMark(d)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)a=c;else break}}return t}addElementByRule(e,t,r,o){let s,l;if(t.node)if(l=this.parser.schema.nodes[t.node],l.isLeaf)this.insertNode(l.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(l,t.attrs||null,r,t.preserveWhitespace);c&&(s=!0,r=c)}else{let c=this.parser.schema.marks[t.mark];r=r.concat(c.create(t.attrs))}let a=this.top;if(l&&l.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r,!1));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,r,o){let s=r||0;for(let l=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];l!=a;l=l.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(l,t);this.findAtPoint(e,s)}findPlace(e,t,r){let o,s;for(let l=this.open,a=0;l>=0;l--){let c=this.nodes[l],d=c.findWrapping(e);if(d&&(!o||o.length>d.length+a)&&(o=d,s=c,!d.length))break;if(c.solid){if(r)break;a+=2}}if(!o)return null;this.sync(s);for(let l=0;l<o.length;l++)t=this.enterInner(o[l],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let o=this.findPlace(e,t,r);if(o){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let l=Se.none;for(let a of o.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):qc(a.type,e.type))&&(l=a.addToSet(l));return s.content.push(e.mark(l)),!0}return!1}enter(e,t,r,o){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,o)),s}enterInner(e,t,r,o=!1,s){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(e);let a=Uc(e,s,l.options);l.options&Yr&&l.content.length==0&&(a|=Yr);let c=Se.none;return r=r.filter(d=>(l.type?l.type.allowsMarkType(d.type):qc(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new Zo(e,t,c,o,null,a)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Jr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&t.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(o?0:1),l=(a,c)=>{for(;a>=0;a--){let d=t[a];if(d==""){if(a==t.length-1||a==0)continue;for(;c>=s;c--)if(l(a-1,c))return!0;return!1}else{let u=c>0||c==0&&o?this.nodes[c].type:r&&c>=s?r.node(c-s).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return l(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function lg(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&jc.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function ig(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Kc(n){let e={};for(let t in n)e[t]=n[t];return e}function qc(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let s=[],l=a=>{s.push(a);for(let c=0;c<a.edgeCount;c++){let{type:d,next:u}=a.edge(c);if(d==e||s.indexOf(u)<0&&l(u))return!0}};if(l(o.contentMatch))return!0}}class tr{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=zl(t).createDocumentFragment());let o=r,s=[];return e.forEach(l=>{if(s.length||l.marks.length){let a=0,c=0;for(;a<s.length&&c<l.marks.length;){let d=l.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(s[a][0])||d.type.spec.spanning===!1)break;a++,c++}for(;a<s.length;)o=s.pop()[1];for(;c<l.marks.length;){let d=l.marks[c++],u=this.serializeMark(d,l.isInline,t);u&&(s.push([d,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(l,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:o}=Qo(zl(t),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let s=this.serializeMark(e.marks[o],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&Qo(zl(r),o(e,t),null,e.attrs)}static renderSpec(e,t,r=null,o){return Qo(e,t,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new tr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Gc(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Gc(e.marks)}}function Gc(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function zl(n){return n.document||window.document}const Jc=new WeakMap;function ag(n){let e=Jc.get(n);return e===void 0&&Jc.set(n,e=cg(n)),e}function cg(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)t(r[o]);else for(let o in r)t(r[o])}return t(n),e}function Qo(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],s;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=ag(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=o.indexOf(" ");l>0&&(t=o.slice(0,l),o=o.slice(l+1));let a,c=t?n.createElementNS(t,o):n.createElement(o),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let p=f.indexOf(" ");p>0?c.setAttributeNS(f.slice(0,p),f.slice(p+1),d[f]):f=="style"&&c.style?c.style.cssText=d[f]:c.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:h,contentDOM:m}=Qo(n,p,t,r);if(c.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:c,contentDOM:a}}const Yc=65535,Xc=Math.pow(2,16);function dg(n,e){return n+e*Xc}function Zc(n){return n&Yc}function ug(n){return(n-(n&Yc))/Xc}const Qc=1,ed=2,es=4,td=8;class Hl{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&td)>0}get deletedBefore(){return(this.delInfo&(Qc|es))>0}get deletedAfter(){return(this.delInfo&(ed|es))>0}get deletedAcross(){return(this.delInfo&es)>0}}class wt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&wt.empty)return wt.empty}recover(e){let t=0,r=Zc(e);if(!this.inverted)for(let o=0;o<r;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+t+ug(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let o=0,s=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?o:0);if(c>e)break;let d=this.ranges[a+s],u=this.ranges[a+l],f=c+d;if(e<=f){let p=d?e==c?-1:e==f?1:t:t,h=c+o+(p<0?0:u);if(r)return h;let m=e==(t<0?c:f)?null:dg(a/3,e-c),g=e==c?ed:e==f?Qc:es;return(t<0?e!=c:e!=f)&&(g|=td),new Hl(h,g,m)}o+=u-d}return r?e+o:new Hl(e+o,0,null)}touches(e,t){let r=0,o=Zc(t),s=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[a+s],u=c+d;if(e<=u&&a==o*3)return!0;r+=this.ranges[a+l]-d}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,s=0;o<this.ranges.length;o+=3){let l=this.ranges[o],a=l-(this.inverted?s:0),c=l+(this.inverted?0:s),d=this.ranges[o+t],u=this.ranges[o+r];e(a,a+d,c,c+u),s+=u-d}}invert(){return new wt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?wt.empty:new wt(e<0?[0,-e,0]:[0,0,e])}}wt.empty=new wt([]);class Xr{constructor(e,t,r=0,o=e?e.length:0){this.mirror=t,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Xr(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let o=e.getMirror(t);this.appendMap(e._maps[t],o!=null&&o<t?r+o:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e._maps[t].invert(),o!=null&&o>t?r-o-1:void 0)}}invert(){let e=new Xr;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let o=0;for(let s=this.from;s<this.to;s++){let l=this._maps[s],a=l.mapResult(e,t);if(a.recover!=null){let c=this.getMirror(s);if(c!=null&&c>s&&c<this.to){s=c,e=this._maps[c].recover(a.recover);continue}}o|=a.delInfo,e=a.pos}return r?e:new Hl(e,o,null)}}const jl=Object.create(null);class ot{getMap(){return wt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=jl[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in jl)throw new RangeError("Duplicate use of step JSON ID "+e);return jl[e]=t,t.prototype.jsonID=e,t}}class ze{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ze(e,null)}static fail(e){return new ze(null,e)}static fromReplace(e,t,r,o){try{return ze.ok(e.replace(t,r,o))}catch(s){if(s instanceof qo)return ze.fail(s.message);throw s}}}function Ul(n,e,t){let r=[];for(let o=0;o<n.childCount;o++){let s=n.child(o);s.content.size&&(s=s.copy(Ul(s.content,e,s))),s.isInline&&(s=e(s,t,o)),r.push(s)}return I.fromArray(r)}class Nn extends ot{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),s=new q(Ul(t.content,(l,a)=>!l.isAtom||!a.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),o),t.openStart,t.openEnd);return ze.fromReplace(e,this.from,this.to,s)}invert(){return new zt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Nn(t.pos,r.pos,this.mark)}merge(e){return e instanceof Nn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Nn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Nn(t.from,t.to,e.markFromJSON(t.mark))}}ot.jsonID("addMark",Nn);class zt extends ot{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new q(Ul(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return ze.fromReplace(e,this.from,this.to,r)}invert(){return new Nn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new zt(t.pos,r.pos,this.mark)}merge(e){return e instanceof zt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new zt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new zt(t.from,t.to,e.markFromJSON(t.mark))}}ot.jsonID("removeMark",zt);class Mn extends ot{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ze.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ze.fromReplace(e,this.pos,this.pos+1,new q(I.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new Mn(this.pos,t.marks[o]);return new Mn(this.pos,this.mark)}}return new nr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Mn(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Mn(t.pos,e.markFromJSON(t.mark))}}ot.jsonID("addNodeMark",Mn);class nr extends ot{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ze.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ze.fromReplace(e,this.pos,this.pos+1,new q(I.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Mn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new nr(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new nr(t.pos,e.markFromJSON(t.mark))}}ot.jsonID("removeNodeMark",nr);class Ge extends ot{constructor(e,t,r,o=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=o}apply(e){return this.structure&&Wl(e,this.from,this.to)?ze.fail("Structure replace would overwrite content"):ze.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new wt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ge(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Ge(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ge)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?q.empty:new q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ge(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?q.empty:new q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ge(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ge(t.from,t.to,q.fromJSON(e,t.slice),!!t.structure)}}ot.jsonID("replace",Ge);class Je extends ot{constructor(e,t,r,o,s,l,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=l,this.structure=a}apply(e){if(this.structure&&(Wl(e,this.from,this.gapFrom)||Wl(e,this.gapTo,this.to)))return ze.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ze.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ze.fromReplace(e,this.from,this.to,r):ze.fail("Content does not fit in gap")}getMap(){return new wt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Je(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||s>r.pos?null:new Je(t.pos,r.pos,o,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Je(t.from,t.to,t.gapFrom,t.gapTo,q.fromJSON(e,t.slice),t.insert,!!t.structure)}}ot.jsonID("replaceAround",Je);function Wl(n,e,t){let r=n.resolve(e),o=t-e,s=r.depth;for(;o>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,o--;if(o>0){let l=r.node(s).maybeChild(r.indexAfter(s));for(;o>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,o--}}return!1}function fg(n,e,t,r){let o=[],s=[],l,a;n.doc.nodesBetween(e,t,(c,d,u)=>{if(!c.isInline)return;let f=c.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let p=Math.max(d,e),h=Math.min(d+c.nodeSize,t),m=r.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(l&&l.to==p&&l.mark.eq(f[g])?l.to=h:o.push(l=new zt(p,h,f[g])));a&&a.to==p?a.to=h:s.push(a=new Nn(p,h,r))}}),o.forEach(c=>n.step(c)),s.forEach(c=>n.step(c))}function pg(n,e,t,r){let o=[],s=0;n.doc.nodesBetween(e,t,(l,a)=>{if(!l.isInline)return;s++;let c=null;if(r instanceof Xo){let d=l.marks,u;for(;u=r.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else r?r.isInSet(l.marks)&&(c=[r]):c=l.marks;if(c&&c.length){let d=Math.min(a+l.nodeSize,t);for(let u=0;u<c.length;u++){let f=c[u],p;for(let h=0;h<o.length;h++){let m=o[h];m.step==s-1&&f.eq(o[h].style)&&(p=m)}p?(p.to=d,p.step=s):o.push({style:f,from:Math.max(a,e),to:d,step:s})}}}),o.forEach(l=>n.step(new zt(l.from,l.to,l.style)))}function Kl(n,e,t,r=t.contentMatch,o=!0){let s=n.doc.nodeAt(e),l=[],a=e+1;for(let c=0;c<s.childCount;c++){let d=s.child(c),u=a+d.nodeSize,f=r.matchType(d.type);if(!f)l.push(new Ge(a,u,q.empty));else{r=f;for(let p=0;p<d.marks.length;p++)t.allowsMarkType(d.marks[p].type)||n.step(new zt(a,u,d.marks[p]));if(o&&d.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(d.text);)m||(m=new q(I.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),l.push(new Ge(a+p.index,a+p.index+p[0].length,m))}}a=u}if(!r.validEnd){let c=r.fillBefore(I.empty,!0);n.replace(a,a,new q(c,0,0))}for(let c=l.length-1;c>=0;c--)n.step(l[c])}function hg(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Er(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let o=n.$from.node(r),s=n.$from.index(r),l=n.$to.indexAfter(r);if(r<n.depth&&o.canReplace(s,l,t))return r;if(r==0||o.type.spec.isolating||!hg(o,s,l))break}return null}function mg(n,e,t){let{$from:r,$to:o,depth:s}=e,l=r.before(s+1),a=o.after(s+1),c=l,d=a,u=I.empty,f=0;for(let m=s,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=I.from(r.node(m).copy(u)),f++):c--;let p=I.empty,h=0;for(let m=s,g=!1;m>t;m--)g||o.after(m+1)<o.end(m)?(g=!0,p=I.from(o.node(m).copy(p)),h++):d++;n.step(new Je(c,d,l,a,new q(u.append(p),f,h),u.size-f,!0))}function ql(n,e,t=null,r=n){let o=gg(n,e),s=o&&yg(r,e);return s?o.map(nd).concat({type:e,attrs:t}).concat(s.map(nd)):null}function nd(n){return{type:n,attrs:null}}function gg(n,e){let{parent:t,startIndex:r,endIndex:o}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let l=s.length?s[0]:e;return t.canReplaceWith(r,o,l)?s:null}function yg(n,e){let{parent:t,startIndex:r,endIndex:o}=n,s=t.child(r),l=e.contentMatch.findWrapping(s.type);if(!l)return null;let c=(l.length?l[l.length-1]:e).contentMatch;for(let d=r;c&&d<o;d++)c=c.matchType(t.child(d).type);return!c||!c.validEnd?null:l}function bg(n,e,t){let r=I.empty;for(let l=t.length-1;l>=0;l--){if(r.size){let a=t[l].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=I.from(t[l].type.create(t[l].attrs,r))}let o=e.start,s=e.end;n.step(new Je(o,s,o,s,new q(r,0,0),t.length,!0))}function kg(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(l,a)=>{let c=typeof o=="function"?o(l):o;if(l.isTextblock&&!l.hasMarkup(r,c)&&xg(n.doc,n.mapping.slice(s).map(a),r)){let d=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&od(n,l,a,s),Kl(n,n.mapping.slice(s).map(a,1),r,void 0,d===null);let u=n.mapping.slice(s),f=u.map(a,1),p=u.map(a+l.nodeSize,1);return n.step(new Je(f,p,f+1,p-1,new q(I.from(r.create(c,null,l.marks)),0,0),1,!0)),d===!0&&rd(n,l,a,s),!1}})}function rd(n,e,t,r){e.forEach((o,s)=>{if(o.isText){let l,a=/\r?\n|\r/g;for(;l=a.exec(o.text);){let c=n.mapping.slice(r).map(t+1+s+l.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function od(n,e,t,r){e.forEach((o,s)=>{if(o.type==o.type.schema.linebreakReplacement){let l=n.mapping.slice(r).map(t+1+s);n.replaceWith(l,l+1,e.type.schema.text(`
|
|
5
|
+
`))}})}function xg(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function wg(n,e,t,r,o){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let l=t.create(r,null,o||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,l);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Je(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new q(I.from(l),0,0),1,!0))}function un(n,e,t=1,r){let o=n.resolve(e),s=o.depth-t,l=r&&r[r.length-1]||o.parent;if(s<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!l.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let d=o.depth-1,u=t-2;d>s;d--,u--){let f=o.node(d),p=o.index(d);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=r&&r[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||f;if(!f.canReplace(p+1,f.childCount)||!g.type.validContent(h))return!1}let a=o.indexAfter(s),c=r&&r[0];return o.node(s).canReplaceWith(a,a,c?c.type:o.node(s+1).type)}function Eg(n,e,t=1,r){let o=n.doc.resolve(e),s=I.empty,l=I.empty;for(let a=o.depth,c=o.depth-t,d=t-1;a>c;a--,d--){s=I.from(o.node(a).copy(s));let u=r&&r[d];l=I.from(u?u.type.create(u.attrs,l):o.node(a).copy(l))}n.step(new Ge(e,e,new q(s.append(l),t,t),!0))}function Tn(n,e){let t=n.resolve(e),r=t.index();return sd(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Cg(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let o=0;o<e.childCount;o++){let s=e.child(o),l=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(l),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function sd(n,e){return!!(n&&e&&!n.isLeaf&&Cg(n,e))}function ts(n,e,t=-1){let r=n.resolve(e);for(let o=r.depth;;o--){let s,l,a=r.index(o);if(o==r.depth?(s=r.nodeBefore,l=r.nodeAfter):t>0?(s=r.node(o+1),a++,l=r.node(o).maybeChild(a)):(s=r.node(o).maybeChild(a-1),l=r.node(o+1)),s&&!s.isTextblock&&sd(s,l)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=t<0?r.before(o):r.after(o)}}function vg(n,e,t){let r=null,{linebreakReplacement:o}=n.doc.type.schema,s=n.doc.resolve(e-t),l=s.node().type;if(o&&l.inlineContent){let u=l.whitespace=="pre",f=!!l.contentMatch.matchType(o);u&&!f?r=!1:!u&&f&&(r=!0)}let a=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);od(n,u.node(),u.before(),a)}l.inlineContent&&Kl(n,e+t-1,l,s.node().contentMatchAt(s.index()),r==null);let c=n.mapping.slice(a),d=c.map(e-t);if(n.step(new Ge(d,c.map(e+t,-1),q.empty,!0)),r===!0){let u=n.doc.resolve(d);rd(n,u.node(),u.before(),n.steps.length)}return n}function _g(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let s=r.index(o);if(r.node(o).canReplaceWith(s,s,t))return r.before(o+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let s=r.indexAfter(o);if(r.node(o).canReplaceWith(s,s,t))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function ld(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let s=0;s<t.openStart;s++)o=o.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let l=r.depth;l>=0;l--){let a=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,c=r.index(l)+(a>0?1:0),d=r.node(l),u=!1;if(s==1)u=d.canReplace(c,c,o);else{let f=d.contentMatchAt(c).findWrapping(o.firstChild.type);u=f&&d.canReplaceWith(c,c,f[0])}if(u)return a==0?r.pos:a<0?r.before(l+1):r.after(l+1)}return null}function ns(n,e,t=e,r=q.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),s=n.resolve(t);return id(o,s,r)?new Ge(e,t,r):new Sg(o,s,r).fit()}function id(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Sg{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=I.empty;for(let o=0;o<=e.depth;o++){let s=e.node(o);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=I.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let s=this.placed,l=r.depth,a=o.depth;for(;l&&a&&s.childCount==1;)s=s.firstChild.content,l--,a--;let c=new q(s,l,a);return e>-1?new Je(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new Ge(r.pos,o.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(o=0),s.type.spec.isolating&&o<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,s=null;r?(s=Gl(this.unplaced.content,r-1).firstChild,o=s.content):o=this.unplaced.content;let l=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:d}=this.frontier[a],u,f=null;if(t==1&&(l?d.matchType(l.type)||(f=d.fillBefore(I.from(l),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:f};if(t==2&&l&&(u=d.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&d.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Gl(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new q(e,t+1,Math.max(r,o.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Gl(e,t);if(o.childCount<=1&&t>0){let s=e.size-t<=t+o.size;this.unplaced=new q(Zr(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new q(Zr(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let l=this.unplaced,a=r?r.content:l.content,c=l.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[t];if(o){for(let g=0;g<o.childCount;g++)u.push(o.child(g));f=f.matchFragment(o)}let h=a.size+e-(l.content.size-l.openEnd);for(;d<a.childCount;){let g=a.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||c==0||g.content.size)&&(f=y,u.push(ad(g.mark(p.allowedMarks(g.marks)),d==1?c:0,d==a.childCount?h:-1)))}let m=d==a.childCount;m||(h=-1),this.placed=Qr(this.placed,t,I.from(u)),this.frontier[t].match=f,m&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=a;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?q.empty:new q(Zr(l.content,e-1,1),e-1,h<0?l.openEnd:e-1):new q(Zr(l.content,e,d),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Jl(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),l=Jl(e,t,o,r,s);if(l){for(let a=t-1;a>=0;a--){let{match:c,type:d}=this.frontier[a],u=Jl(e,a,d,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:l,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Qr(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),s=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,s)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Qr(this.placed,this.depth,I.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(I.empty,!0);t.childCount&&(this.placed=Qr(this.placed,this.frontier.length,t))}}function Zr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Zr(n.firstChild.content,e-1,t)))}function Qr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Qr(n.lastChild.content,e-1,t)))}function Gl(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function ad(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,ad(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(I.empty,!0)))),n.copy(r)}function Jl(n,e,t,r,o){let s=n.node(e),l=o?n.indexAfter(e):n.index(e);if(l==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,l);return a&&!Ng(t,s.content,l)?a:null}function Ng(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Mg(n){return n.spec.defining||n.spec.definingForContent}function Tg(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),s=n.doc.resolve(t);if(id(o,s,r))return n.step(new Ge(e,t,r));let l=dd(o,n.doc.resolve(t));l[l.length-1]==0&&l.pop();let a=-(o.depth+1);l.unshift(a);for(let p=o.depth,h=o.pos-1;p>0;p--,h--){let m=o.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;l.indexOf(p)>-1?a=p:o.before(p)==h&&l.splice(1,0,-p)}let c=l.indexOf(a),d=[],u=r.openStart;for(let p=r.content,h=0;;h++){let m=p.firstChild;if(d.push(m),h==r.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=d[p],m=Mg(h.type);if(m&&!h.sameMarkup(o.node(Math.abs(a)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let h=(p+u+1)%(r.openStart+1),m=d[h];if(m)for(let g=0;g<l.length;g++){let y=l[(g+c)%l.length],b=!0;y<0&&(b=!1,y=-y);let k=o.node(y-1),w=o.index(y-1);if(k.canReplaceWith(w,w,m.type,m.marks))return n.replace(o.before(y),b?s.after(y):t,new q(cd(r.content,0,r.openStart,h),h,r.openEnd))}}let f=n.steps.length;for(let p=l.length-1;p>=0&&(n.replace(e,t,r),!(n.steps.length>f));p--){let h=l[p];h<0||(e=o.before(h),t=s.after(h))}}function cd(n,e,t,r,o){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(cd(s.content,e+1,t,r,s)))}if(e>r){let s=o.contentMatchAt(0),l=s.fillBefore(n).append(n);n=l.append(s.matchFragment(l).fillBefore(I.empty,!0))}return n}function Ag(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=_g(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new q(I.from(r),0,0))}function Bg(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t),s=dd(r,o);for(let l=0;l<s.length;l++){let a=s[l],c=l==s.length-1;if(c&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),o.end(a));if(a>0&&(c||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return n.delete(r.before(a),o.after(a))}for(let l=1;l<=r.depth&&l<=o.depth;l++)if(e-r.start(l)==r.depth-l&&t>r.end(l)&&o.end(l)-t!=o.depth-l&&r.start(l-1)==o.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),o.index(l-1)))return n.delete(r.before(l),t);n.delete(e,t)}function dd(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let s=n.start(o);if(s<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(s==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==s-1)&&t.push(o)}return t}class Cr extends ot{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ze.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return ze.fromReplace(e,this.pos,this.pos+1,new q(I.from(o),0,t.isLeaf?0:1))}getMap(){return wt.empty}invert(e){return new Cr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Cr(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Cr(t.pos,t.attr,t.value)}}ot.jsonID("attr",Cr);class eo extends ot{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ze.ok(r)}getMap(){return wt.empty}invert(e){return new eo(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new eo(t.attr,t.value)}}ot.jsonID("docAttr",eo);let vr=class extends Error{};vr=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},vr.prototype=Object.create(Error.prototype),vr.prototype.constructor=vr,vr.prototype.name="TransformError";class Yl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Xr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new vr(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=q.empty){let o=ns(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new q(I.from(r),0,0))}delete(e,t){return this.replace(e,t,q.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Tg(this,e,t,r),this}replaceRangeWith(e,t,r){return Ag(this,e,t,r),this}deleteRange(e,t){return Bg(this,e,t),this}lift(e,t){return mg(this,e,t),this}join(e,t=1){return vg(this,e,t),this}wrap(e,t){return bg(this,e,t),this}setBlockType(e,t=e,r,o=null){return kg(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return wg(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new Cr(e,t,r)),this}setDocAttribute(e,t){return this.step(new eo(e,t)),this}addNodeMark(e,t){return this.step(new Mn(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof Se)t.isInSet(r.marks)&&this.step(new nr(e,t));else{let o=r.marks,s,l=[];for(;s=t.isInSet(o);)l.push(new nr(e,s)),o=s.removeFromSet(o);for(let a=l.length-1;a>=0;a--)this.step(l[a])}return this}split(e,t=1,r){return Eg(this,e,t,r),this}addMark(e,t,r){return fg(this,e,t,r),this}removeMark(e,t,r){return pg(this,e,t,r),this}clearIncompatible(e,t,r){return Kl(this,e,t,r),this}}const Xl=Object.create(null);class le{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new ud(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=q.empty){let r=t.content.lastChild,o=null;for(let a=0;a<t.openEnd;a++)o=r,r=r.lastChild;let s=e.steps.length,l=this.ranges;for(let a=0;a<l.length;a++){let{$from:c,$to:d}=l[a],u=e.mapping.slice(s);e.replaceRange(u.map(c.pos),u.map(d.pos),a?q.empty:t),a==0&&hd(e,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:a}=o[s],c=e.mapping.slice(r),d=c.map(l.pos),u=c.map(a.pos);s?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),hd(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let o=e.parent.inlineContent?new oe(e):_r(e.node(0),e.parent,e.pos,e.index(),t,r);if(o)return o;for(let s=e.depth-1;s>=0;s--){let l=t<0?_r(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):_r(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(l)return l}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Et(e.node(0))}static atStart(e){return _r(e,e,0,0,1)||new Et(e)}static atEnd(e){return _r(e,e,e.content.size,e.childCount,-1)||new Et(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Xl[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Xl)throw new RangeError("Duplicate use of selection JSON ID "+e);return Xl[e]=t,t.prototype.jsonID=e,t}getBookmark(){return oe.between(this.$anchor,this.$head).getBookmark()}}le.prototype.visible=!0;class ud{constructor(e,t){this.$from=e,this.$to=t}}let fd=!1;function pd(n){!fd&&!n.parent.inlineContent&&(fd=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class oe extends le{constructor(e,t=e){pd(e),pd(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return le.near(r);let o=e.resolve(t.map(this.anchor));return new oe(o.parent.inlineContent?o:r,r)}replace(e,t=q.empty){if(super.replace(e,t),t==q.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof oe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new rs(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new oe(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let s=le.findFrom(t,r,!0)||le.findFrom(t,-r,!0);if(s)t=s.$head;else return le.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(le.findFrom(e,-r,!0)||le.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new oe(e,t)}}le.jsonID("text",oe);class rs{constructor(e,t){this.anchor=e,this.head=t}map(e){return new rs(e.map(this.anchor),e.map(this.head))}resolve(e){return oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class ne extends le{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:o}=t.mapResult(this.anchor),s=e.resolve(o);return r?le.near(s):new ne(s)}content(){return new q(I.from(this.node),0,0)}eq(e){return e instanceof ne&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Zl(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ne(e.resolve(t.anchor))}static create(e,t){return new ne(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ne.prototype.visible=!1,le.jsonID("node",ne);class Zl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new rs(r,r):new Zl(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&ne.isSelectable(r)?new ne(t):le.near(t)}}class Et extends le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=q.empty){if(t==q.empty){e.delete(0,e.doc.content.size);let r=le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Et(e)}map(e){return new Et(e)}eq(e){return e instanceof Et}getBookmark(){return Vg}}le.jsonID("all",Et);const Vg={map(){return this},resolve(n){return new Et(n)}};function _r(n,e,t,r,o,s=!1){if(e.inlineContent)return oe.create(n,t);for(let l=r-(o>0?0:1);o>0?l<e.childCount:l>=0;l+=o){let a=e.child(l);if(a.isAtom){if(!s&&ne.isSelectable(a))return ne.create(n,t-(o<0?a.nodeSize:0))}else{let c=_r(n,a,t+o,o<0?a.childCount:0,o,s);if(c)return c}t+=a.nodeSize*o}return null}function hd(n,e,t){let r=n.steps.length-1;if(r<e)return;let o=n.steps[r];if(!(o instanceof Ge||o instanceof Je))return;let s=n.mapping.maps[r],l;s.forEach((a,c,d,u)=>{l==null&&(l=u)}),n.setSelection(le.near(n.doc.resolve(l),t))}const md=1,ss=2,gd=4;class Lg extends Yl{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|md)&~ss,this.storedMarks=null,this}get selectionSet(){return(this.updated&md)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ss,this}ensureMarks(e){return Se.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&ss)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ss,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Se.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let l=this.doc.resolve(t);s=r==t?l.marks():l.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,s)),this.selection.empty||this.setSelection(le.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=gd,this}get scrolledIntoView(){return(this.updated&gd)>0}}function yd(n,e){return!e||!n?n:n.bind(e)}class to{constructor(e,t,r){this.name=e,this.init=yd(t.init,r),this.apply=yd(t.apply,r)}}const Og=[new to("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new to("selection",{init(n,e){return n.selection||le.atStart(e.doc)},apply(n){return n.selection}}),new to("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new to("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Ql{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Og.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new to(r.key,r.spec.state,r))})}}class Sr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),o=null;for(;;){let s=!1;for(let l=0;l<this.config.plugins.length;l++){let a=this.config.plugins[l];if(a.spec.appendTransaction){let c=o?o[l].n:0,d=o?o[l].state:this,u=c<t.length&&a.spec.appendTransaction.call(a,c?t.slice(c):t,d,r);if(u&&r.filterTransaction(u,l)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let f=0;f<this.config.plugins.length;f++)o.push(f<l?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),s=!0}o&&(o[l]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Sr(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let s=r[o];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new Lg(this)}static create(e){let t=new Ql(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Sr(t);for(let o=0;o<t.fields.length;o++)r[t.fields[o].name]=t.fields[o].init(e,r);return r}reconfigure(e){let t=new Ql(this.schema,e.plugins),r=t.fields,o=new Sr(t);for(let s=0;s<r.length;s++){let l=r[s].name;o[l]=this.hasOwnProperty(l)?this[l]:r[s].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],s=o.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Ql(e.schema,e.plugins),s=new Sr(o);return o.fields.forEach(l=>{if(l.name=="doc")s.doc=Sn.fromJSON(e.schema,t.doc);else if(l.name=="selection")s.selection=le.fromJSON(s.doc,t.selection);else if(l.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let c=r[a],d=c.spec.state;if(c.key==l.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[l.name]=d.fromJSON.call(c,e,t[a],s);return}}s[l.name]=l.init(e,s)}}),s}}function bd(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=bd(o,e,{})),t[r]=o}return t}class Oe{constructor(e){this.spec=e,this.props={},e.props&&bd(e.props,this,this.props),this.key=e.key?e.key.key:kd("plugin")}getState(e){return e[this.key]}}const ei=Object.create(null);function kd(n){return n in ei?n+"$"+ ++ei[n]:(ei[n]=0,n+"$")}class $e{constructor(e="key"){this.key=kd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ti=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function xd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const wd=(n,e,t)=>{let r=xd(n,t);if(!r)return!1;let o=ni(r);if(!o){let l=r.blockRange(),a=l&&Er(l);return a==null?!1:(e&&e(n.tr.lift(l,a).scrollIntoView()),!0)}let s=o.nodeBefore;if(Ad(n,o,e,-1))return!0;if(r.parent.content.size==0&&(Nr(s,"end")||ne.isSelectable(s)))for(let l=r.depth;;l--){let a=ns(n.doc,r.before(l),r.after(l),q.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=n.tr.step(a);c.setSelection(Nr(s,"end")?le.findFrom(c.doc.resolve(c.mapping.map(o.pos,-1)),-1):ne.create(c.doc,o.pos-s.nodeSize)),e(c.scrollIntoView())}return!0}if(l==1||r.node(l-1).childCount>1)break}return s.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos-s.nodeSize,o.pos).scrollIntoView()),!0):!1},Ig=(n,e,t)=>{let r=xd(n,t);if(!r)return!1;let o=ni(r);return o?Ed(n,o,e):!1},Dg=(n,e,t)=>{let r=vd(n,t);if(!r)return!1;let o=ri(r);return o?Ed(n,o,e):!1};function Ed(n,e,t){let r=e.nodeBefore,o=r,s=e.pos-1;for(;!o.isTextblock;s--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let l=e.nodeAfter,a=l,c=e.pos+1;for(;!a.isTextblock;c++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let d=ns(n.doc,s,c,q.empty);if(!d||d.from!=s||d instanceof Ge&&d.slice.size>=c-s)return!1;if(t){let u=n.tr.step(d);u.setSelection(oe.create(u.doc,s)),t(u.scrollIntoView())}return!0}function Nr(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Cd=(n,e,t)=>{let{$head:r,empty:o}=n.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=ni(r)}let l=s&&s.nodeBefore;return!l||!ne.isSelectable(l)?!1:(e&&e(n.tr.setSelection(ne.create(n.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function ni(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function vd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const _d=(n,e,t)=>{let r=vd(n,t);if(!r)return!1;let o=ri(r);if(!o)return!1;let s=o.nodeAfter;if(Ad(n,o,e,1))return!0;if(r.parent.content.size==0&&(Nr(s,"start")||ne.isSelectable(s))){let l=ns(n.doc,r.before(),r.after(),q.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Nr(s,"start")?le.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):ne.create(a.doc,a.mapping.map(o.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos,o.pos+s.nodeSize).scrollIntoView()),!0):!1},Sd=(n,e,t)=>{let{$head:r,empty:o}=n.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=ri(r)}let l=s&&s.nodeAfter;return!l||!ne.isSelectable(l)?!1:(e&&e(n.tr.setSelection(ne.create(n.doc,s.pos)).scrollIntoView()),!0)};function ri(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const Rg=(n,e)=>{let t=n.selection,r=t instanceof ne,o;if(r){if(t.node.isTextblock||!Tn(n.doc,t.from))return!1;o=t.from}else if(o=ts(n.doc,t.from,-1),o==null)return!1;if(e){let s=n.tr.join(o);r&&s.setSelection(ne.create(s.doc,o-n.doc.resolve(o).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Fg=(n,e)=>{let t=n.selection,r;if(t instanceof ne){if(t.node.isTextblock||!Tn(n.doc,t.to))return!1;r=t.to}else if(r=ts(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Pg=(n,e)=>{let{$from:t,$to:r}=n.selection,o=t.blockRange(r),s=o&&Er(o);return s==null?!1:(e&&e(n.tr.lift(o,s).scrollIntoView()),!0)},Nd=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
|
|
6
|
+
`).scrollIntoView()),!0)};function oi(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const $g=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let o=t.node(-1),s=t.indexAfter(-1),l=oi(o.contentMatchAt(s));if(!l||!o.canReplaceWith(s,s,l))return!1;if(e){let a=t.after(),c=n.tr.replaceWith(a,a,l.createAndFill());c.setSelection(le.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},Md=(n,e)=>{let t=n.selection,{$from:r,$to:o}=t;if(t instanceof Et||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=oi(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let l=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=n.tr.insert(l,s.createAndFill());a.setSelection(oe.create(a.doc,l+1)),e(a.scrollIntoView())}return!0},Td=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(un(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),o=r&&Er(r);return o==null?!1:(e&&e(n.tr.lift(r,o).scrollIntoView()),!0)};function zg(n){return(e,t)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof ne&&e.selection.node.isBlock)return!r.parentOffset||!un(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],l,a,c=!1,d=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){c=r.end(h)==r.pos+(r.depth-h),d=r.start(h)==r.pos-(r.depth-h),a=oi(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),s.unshift(c&&a?{type:a}:null),l=h;break}else{if(h==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof oe||e.selection instanceof Et)&&u.deleteSelection();let f=u.mapping.map(r.pos),p=un(u.doc,f,s.length,s);if(p||(s[0]=a?{type:a}:null,p=un(u.doc,f,s.length,s)),!p)return!1;if(u.split(f,s.length,s),!c&&d&&r.node(l).type!=a){let h=u.mapping.map(r.before(l)),m=u.doc.resolve(h);a&&r.node(l-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(l)),a)}return t&&t(u.scrollIntoView()),!0}}const Hg=zg(),jg=(n,e)=>{let{$from:t,to:r}=n.selection,o,s=t.sharedDepth(r);return s==0?!1:(o=t.before(s),e&&e(n.tr.setSelection(ne.create(n.doc,o))),!0)};function Ug(n,e,t){let r=e.nodeBefore,o=e.nodeAfter,s=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(o.isTextblock||Tn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Ad(n,e,t,r){let o=e.nodeBefore,s=e.nodeAfter,l,a,c=o.type.spec.isolating||s.type.spec.isolating;if(!c&&Ug(n,e,t))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(l=(a=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&a.matchType(l[0]||s.type).validEnd){if(t){let h=e.pos+s.nodeSize,m=I.empty;for(let b=l.length-1;b>=0;b--)m=I.from(l[b].create(null,m));m=I.from(o.copy(m));let g=n.tr.step(new Je(e.pos-1,h,e.pos,h,new q(m,1,0),l.length,!0)),y=g.doc.resolve(h+2*l.length);y.nodeAfter&&y.nodeAfter.type==o.type&&Tn(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&c?null:le.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),p=f&&Er(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(d&&Nr(s,"start",!0)&&Nr(o,"end")){let h=o,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=s,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let b=I.empty;for(let w=m.length-1;w>=0;w--)b=I.from(m[w].copy(b));let k=n.tr.step(new Je(e.pos-m.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new q(b,m.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function Bd(n){return function(e,t){let r=e.selection,o=n<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return o.node(s).isTextblock?(t&&t(e.tr.setSelection(oe.create(e.doc,n<0?o.start(s):o.end(s)))),!0):!1}}const Wg=Bd(-1),Kg=Bd(1);function qg(n,e=null){return function(t,r){let{$from:o,$to:s}=t.selection,l=o.blockRange(s),a=l&&ql(l,n,e);return a?(r&&r(t.tr.wrap(l,a).scrollIntoView()),!0):!1}}function Vd(n,e=null){return function(t,r){let o=!1;for(let s=0;s<t.selection.ranges.length&&!o;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(l,a,(c,d)=>{if(o)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)o=!0;else{let u=t.doc.resolve(d),f=u.index();o=u.parent.canReplaceWith(f,f+1,n)}})}if(!o)return!1;if(r){let s=t.tr;for(let l=0;l<t.selection.ranges.length;l++){let{$from:{pos:a},$to:{pos:c}}=t.selection.ranges[l];s.setBlockType(a,c,n,e)}r(s.scrollIntoView())}return!0}}function si(...n){return function(e,t,r){for(let o=0;o<n.length;o++)if(n[o](e,t,r))return!0;return!1}}si(ti,wd,Cd),si(ti,_d,Sd),si(Nd,Md,Td,Hg),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Gg(n,e=null){return function(t,r){let{$from:o,$to:s}=t.selection,l=o.blockRange(s);if(!l)return!1;let a=r?t.tr:null;return Jg(a,l,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Jg(n,e,t,r=null){let o=!1,s=e,l=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=l.resolve(e.start-2);s=new Jo(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Jo(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=ql(s,t,r,e);return a?(n&&Yg(n,e,a,o,t),!0):!1}function Yg(n,e,t,r,o){let s=I.empty;for(let u=t.length-1;u>=0;u--)s=I.from(t[u].type.create(t[u].attrs,s));n.step(new Je(e.start-(r?2:0),e.end,e.start,e.end,new q(s,0,0),t.length,!0));let l=0;for(let u=0;u<t.length;u++)t[u].type==o&&(l=u+1);let a=t.length-l,c=e.start+t.length-(r?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,p=!0;u<f;u++,p=!1)!p&&un(n.doc,c,a)&&(n.split(c,a),c+=2*a),c+=d.child(u).nodeSize;return n}function Xg(n){return function(e,t){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,l=>l.childCount>0&&l.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?Zg(e,t,n,s):Qg(e,t,s):!0:!1}}function Zg(n,e,t,r){let o=n.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(o.step(new Je(s-1,l,s,l,new q(I.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Jo(o.doc.resolve(r.$from.pos),o.doc.resolve(l),r.depth));const a=Er(r);if(a==null)return!1;o.lift(r,a);let c=o.doc.resolve(o.mapping.map(s,-1)-1);return Tn(o.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&o.join(c.pos),e(o.scrollIntoView()),!0}function Qg(n,e,t){let r=n.tr,o=t.parent;for(let h=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)h-=o.child(m).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(t.start),l=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,c=t.endIndex==o.childCount,d=s.node(-1),u=s.index(-1);if(!d.canReplace(u+(a?0:1),u+1,l.content.append(c?I.empty:I.from(o))))return!1;let f=s.pos,p=f+l.nodeSize;return r.step(new Je(f-(a?1:0),p+(c?1:0),f+1,p-1,new q((a?I.empty:I.from(o.copy(I.empty))).append(c?I.empty:I.from(o.copy(I.empty))),a?0:1,c?0:1),a?0:1)),e(r.scrollIntoView()),!0}function e0(n){return function(e,t){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,d=>d.childCount>0&&d.firstChild.type==n);if(!s)return!1;let l=s.startIndex;if(l==0)return!1;let a=s.parent,c=a.child(l-1);if(c.type!=n)return!1;if(t){let d=c.lastChild&&c.lastChild.type==a.type,u=I.from(d?n.create():null),f=new q(I.from(n.create(null,I.from(a.type.create(null,u)))),d?3:1,0),p=s.start,h=s.end;t(e.tr.step(new Je(p-(d?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}const et=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Mr=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let li=null;const fn=function(n,e,t){let r=li||(li=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},t0=function(){li=null},rr=function(n,e,t,r){return t&&(Ld(n,e,t,r,-1)||Ld(n,e,t,r,1))},n0=/^(img|br|input|textarea|hr)$/i;function Ld(n,e,t,r,o){for(var s;;){if(n==t&&e==r)return!0;if(e==(o<0?0:Mt(n))){let l=n.parentNode;if(!l||l.nodeType!=1||no(n)||n0.test(n.nodeName)||n.contentEditable=="false")return!1;e=et(n)+(o<0?0:1),n=l}else if(n.nodeType==1){let l=n.childNodes[e+(o<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((s=l.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=o;else return!1;else n=l,e=o<0?Mt(n):0}else return!1}}function Mt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function r0(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Mt(n)}else if(n.parentNode&&!no(n))e=et(n),n=n.parentNode;else return null}}function o0(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!no(n))e=et(n)+1,n=n.parentNode;else return null}}function s0(n,e,t){for(let r=e==0,o=e==Mt(n);r||o;){if(n==t)return!0;let s=et(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,o=o&&s==Mt(n)}}function no(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const ls=function(n){return n.focusNode&&rr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function or(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function l0(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function i0(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Mt(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Mt(r.startContainer),r.startOffset)}}}const Jt=typeof navigator<"u"?navigator:null,Od=typeof document<"u"?document:null,An=Jt&&Jt.userAgent||"",ii=/Edge\/(\d+)/.exec(An),Id=/MSIE \d/.exec(An),ai=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(An),gt=!!(Id||ai||ii),Bn=Id?document.documentMode:ai?+ai[1]:ii?+ii[1]:0,Tt=!gt&&/gecko\/(\d+)/i.test(An);Tt&&+(/Firefox\/(\d+)/.exec(An)||[0,0])[1];const ci=!gt&&/Chrome\/(\d+)/.exec(An),st=!!ci,Dd=ci?+ci[1]:0,dt=!gt&&!!Jt&&/Apple Computer/.test(Jt.vendor),Tr=dt&&(/Mobile\/\w+/.test(An)||!!Jt&&Jt.maxTouchPoints>2),At=Tr||(Jt?/Mac/.test(Jt.platform):!1),a0=Jt?/Win/.test(Jt.platform):!1,pn=/Android \d/.test(An),ro=!!Od&&"webkitFontSmoothing"in Od.documentElement.style,c0=ro?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function d0(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function hn(n,e){return typeof n=="number"?n:n[e]}function u0(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Rd(n,e,t){let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let l=t||n.dom;l;){if(l.nodeType!=1){l=Mr(l);continue}let a=l,c=a==s.body,d=c?d0(s):u0(a),u=0,f=0;if(e.top<d.top+hn(r,"top")?f=-(d.top-e.top+hn(o,"top")):e.bottom>d.bottom-hn(r,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+hn(o,"top")-d.top:e.bottom-d.bottom+hn(o,"bottom")),e.left<d.left+hn(r,"left")?u=-(d.left-e.left+hn(o,"left")):e.right>d.right-hn(r,"right")&&(u=e.right-d.right+hn(o,"right")),u||f)if(c)s.defaultView.scrollBy(u,f);else{let h=a.scrollLeft,m=a.scrollTop;f&&(a.scrollTop+=f),u&&(a.scrollLeft+=u);let g=a.scrollLeft-h,y=a.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let p=c?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(p))break;l=p=="absolute"?l.offsetParent:Mr(l)}}function f0(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let s=(e.left+e.right)/2,l=t+1;l<Math.min(innerHeight,e.bottom);l+=5){let a=n.root.elementFromPoint(s,l);if(!a||a==n.dom||!n.dom.contains(a))continue;let c=a.getBoundingClientRect();if(c.top>=t-20){r=a,o=c.top;break}}return{refDOM:r,refTop:o,stack:Fd(n.dom)}}function Fd(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Mr(r));return e}function p0({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Pd(t,r==0?0:r-e)}function Pd(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:o,left:s}=n[t];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Ar=null;function h0(n){if(n.setActive)return n.setActive();if(Ar)return n.focus(Ar);let e=Fd(n);n.focus(Ar==null?{get preventScroll(){return Ar={preventScroll:!0},!0}}:void 0),Ar||(Ar=!1,Pd(e,0))}function $d(n,e){let t,r=2e8,o,s=0,l=e.top,a=e.top,c,d;for(let u=n.firstChild,f=0;u;u=u.nextSibling,f++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=fn(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=l&&m.bottom>=a){l=Math.max(m.bottom,l),a=Math.min(m.top,a);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){t=u,r=g,o=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(s=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=f+1)}}return!t&&c&&(t=c,o=d,r=0),t&&t.nodeType==3?m0(t,o):!t||r&&t.nodeType==1?{node:n,offset:s}:$d(t,o)}function m0(n,e){let t=n.nodeValue.length,r=document.createRange();for(let o=0;o<t;o++){r.setEnd(n,o+1),r.setStart(n,o);let s=Vn(r,1);if(s.top!=s.bottom&&di(e,s))return{node:n,offset:o+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function di(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function g0(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function y0(n,e,t){let{node:r,offset:o}=$d(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let l=r.getBoundingClientRect();s=l.left!=l.right&&t.left>(l.left+l.right)/2?1:-1}return n.docView.posFromDOM(r,o,s)}function b0(n,e,t,r){let o=-1;for(let s=e,l=!1;s!=n.dom;){let a=n.docView.nearestDesc(s,!0),c;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((c=a.dom.getBoundingClientRect()).width||c.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!l&&c.left>r.left||c.top>r.top?o=a.posBefore:(!l&&c.right<r.left||c.bottom<r.top)&&(o=a.posAfter),l=!0),!a.contentDOM&&o<0&&!a.node.isText))return(a.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function zd(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=o;;){let l=n.childNodes[s];if(l.nodeType==1){let a=l.getClientRects();for(let c=0;c<a.length;c++){let d=a[c];if(di(e,d))return zd(l,e,d)}}if((s=(s+1)%r)==o)break}return n}function k0(n,e){let t=n.dom.ownerDocument,r,o=0,s=i0(t,e.left,e.top);s&&({node:r,offset:o}=s);let l=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!l||!n.dom.contains(l.nodeType!=1?l.parentNode:l)){let d=n.dom.getBoundingClientRect();if(!di(e,d)||(l=zd(n.dom,e,d),!l))return null}if(dt)for(let d=l;r&&d;d=Mr(d))d.draggable&&(r=void 0);if(l=g0(l,e),r){if(Tt&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&o++}let d;ro&&o&&r.nodeType==1&&(d=r.childNodes[o-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=b0(n,r,o,e))}a==null&&(a=y0(n,l,e));let c=n.docView.nearestDesc(l,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function Hd(n){return n.top<n.bottom||n.left<n.right}function Vn(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Hd(r))return r}return Array.prototype.find.call(t,Hd)||n.getBoundingClientRect()}const x0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function jd(n,e,t){let{node:r,offset:o,atom:s}=n.docView.domFromPos(e,t<0?-1:1),l=ro||Tt;if(r.nodeType==3)if(l&&(x0.test(r.nodeValue)||(t<0?!o:o==r.nodeValue.length))){let c=Vn(fn(r,o,o),t);if(Tt&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let d=Vn(fn(r,o-1,o-1),-1);if(d.top==c.top){let u=Vn(fn(r,o,o+1),-1);if(u.top!=c.top)return oo(u,u.left<d.left)}}return c}else{let c=o,d=o,u=t<0?1:-1;return t<0&&!o?(d++,u=-1):t>=0&&o==r.nodeValue.length?(c--,u=1):t<0?c--:d++,oo(Vn(fn(r,c,d),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(t<0||o==Mt(r))){let c=r.childNodes[o-1];if(c.nodeType==1)return ui(c.getBoundingClientRect(),!1)}if(s==null&&o<Mt(r)){let c=r.childNodes[o];if(c.nodeType==1)return ui(c.getBoundingClientRect(),!0)}return ui(r.getBoundingClientRect(),t>=0)}if(s==null&&o&&(t<0||o==Mt(r))){let c=r.childNodes[o-1],d=c.nodeType==3?fn(c,Mt(c)-(l?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return oo(Vn(d,1),!1)}if(s==null&&o<Mt(r)){let c=r.childNodes[o];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?fn(c,0,l?0:1):c.nodeType==1?c:null:null;if(d)return oo(Vn(d,-1),!0)}return oo(Vn(r.nodeType==3?fn(r):r,-t),t>=0)}function oo(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function ui(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Ud(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function w0(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return Ud(n,e,()=>{let{node:s}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let l=jd(n,o.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let c;if(a.nodeType==1)c=a.getClientRects();else if(a.nodeType==3)c=fn(a,0,a.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(t=="up"?l.top-u.top>(u.bottom-l.top)*2:u.bottom-l.bottom>(l.bottom-u.top)*2))return!1}}return!0})}const E0=/[\u0590-\u08ac]/;function C0(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,s=!o,l=o==r.parent.content.size,a=n.domSelection();return a?!E0.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:l:Ud(n,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:f}=n.domSelectionRange(),p=a.caretBidiLevel;a.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==g;try{a.collapse(u,f),c&&(c!=u||d!=f)&&a.extend&&a.extend(c,d)}catch{}return p!=null&&(a.caretBidiLevel=p),y}):r.pos==r.start()||r.pos==r.end()}let Wd=null,Kd=null,qd=!1;function v0(n,e,t){return Wd==e&&Kd==t?qd:(Wd=e,Kd=t,qd=t=="up"||t=="down"?w0(n,e,t):C0(n,e,t))}const Bt=0,Gd=1,sr=2,Yt=3;class so{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.dirty=Bt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let o=this.children[t];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,l;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(l)+l.size:this.posAtStart}else{let s,l;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(l):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=t>et(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(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!1;break}if(s.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!0;break}if(s.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let s=this.getDesc(o),l;if(s&&(!t||s.node))if(r&&(l=s.nodeDOM)&&!(l.nodeType==1?l.contains(e.nodeType==1?e:e.parentNode):l==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let s=this.getDesc(o);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let o=this.children[t],s=r+o.size;if(r==e&&s!=r){for(;!o.border&&o.children.length;)for(let l=0;l<o.children.length;l++){let a=o.children[l];if(a.size){o=a;break}}return o}if(e<s)return o.descAt(e-r-o.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let s=0;r<this.children.length;r++){let l=this.children[r],a=s+l.size;if(a>e||l instanceof Xd){o=e-s;break}s=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Jd&&s.side>=0;r--);if(t<=0){let s,l=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,l=!1);return s&&t&&l&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?et(s.dom)+1:0}}else{let s,l=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,l=!1);return s&&l&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?et(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,s=-1;for(let l=r,a=0;;a++){let c=this.children[a],d=l+c.size;if(o==-1&&e<=d){let u=l+c.border;if(e>=u&&t<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,u);e=l;for(let f=a;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){o=et(p.dom)+1;break}e-=p.size}o==-1&&(o=0)}if(o>-1&&(d>t||a==this.children.length-1)){t=d;for(let u=a+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=et(f.dom);break}t+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=d}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,o=!1){let s=Math.min(e,t),l=Math.max(e,t);for(let h=0,m=0;h<this.children.length;h++){let g=this.children[h],y=m+g.size;if(s>m&&l<y)return g.setSelection(e-m-g.border,t-m-g.border,r,o);m=y}let a=this.domFromPos(e,e?-1:1),c=t==e?a:this.domFromPos(t,t?-1:1),d=r.root.getSelection(),u=r.domSelectionRange(),f=!1;if((Tt||dt)&&e==t){let{node:h,offset:m}=a;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
|
|
7
|
+
`),f&&m==h.nodeValue.length)for(let g=h,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(a=c={node:y.parentNode,offset:et(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=h.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Tt&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||f&&dt)&&rr(a.node,a.offset,u.anchorNode,u.anchorOffset)&&rr(c.node,c.offset,u.focusNode,u.focusOffset))return;let p=!1;if((d.extend||e==t)&&!(f&&Tt)){d.collapse(a.node,a.offset);try{e!=t&&d.extend(c.node,c.offset),p=!0}catch{}}if(!p){if(e>t){let m=a;a=c,c=m}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(a.node,a.offset),d.removeAllRanges(),d.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,o=0;o<this.children.length;o++){let s=this.children[o],l=r+s.size;if(r==l?e<=l&&t>=r:e<l&&t>r){let a=r+s.border,c=l-s.border;if(e>=a&&t<=c){this.dirty=e==r||t==l?sr:Gd,e==a&&t==c&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Yt:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?sr:Yt}r=l}this.dirty=sr}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?sr:Gd;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Jd extends so{constructor(e,t,r,o){let s,l=t.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!s)return o;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(l.nodeType!=1){let a=document.createElement("span");a.appendChild(l),l=a}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(e,[],l,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==Bt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class _0 extends so{constructor(e,t,r,o){super(e,[],t,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class lr extends so{constructor(e,t,r,o,s){super(e,[],r,o),this.mark=t,this.spec=s}static create(e,t,r,o){let s=o.nodeViews[t.type.name],l=s&&s(t,o,r);return(!l||!l.dom)&&(l=tr.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new lr(e,t,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Yt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Yt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Bt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Bt}}slice(e,t,r){let o=lr.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;t<l&&(s=pi(s,t,l,r)),e>0&&(s=pi(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=o;return o.children=s,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Ln extends so{constructor(e,t,r,o,s,l,a,c,d){super(e,[],s,l),this.node=t,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(e,t,r,o,s,l){let a=s.nodeViews[t.type.name],c,d=a&&a(t,s,()=>{if(!c)return l;if(c.parent)return c.parent.posBeforeChild(c)},r,o),u=d&&d.dom,f=d&&d.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=tr.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let p=u;return u=eu(u,r,t),d?c=new S0(e,t,r,o,u,f||null,p,d,s,l+1):t.isText?new is(e,t,r,o,u,p,s):new Ln(e,t,r,o,u,f||null,p,s,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>I.empty)}return e}matchesNode(e,t,r){return this.dirty==Bt&&e.eq(this.node)&&as(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,o=t,s=e.composing?this.localCompositionInfo(e,t):null,l=s&&s.pos>-1?s:null,a=s&&s.pos<0,c=new M0(this,l&&l.node,e);B0(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,r,e):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?Se.none:this.node.child(u).marks,r,e),c.placeWidget(d,e,o)},(d,u,f,p)=>{c.syncToMarks(d.marks,r,e);let h;c.findNodeMatch(d,u,f,p)||a&&e.state.selection.from>o&&e.state.selection.to<o+d.nodeSize&&(h=c.findIndexWithChild(s.node))>-1&&c.updateNodeAt(d,u,f,h,e)||c.updateNextNode(d,u,f,e,p,o)||c.addNode(d,u,f,e,o),o+=d.nodeSize}),c.syncToMarks([],r,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==sr)&&(l&&this.protectLocalComposition(e,l),Zd(this.contentDOM,this.children,e),Tr&&V0(this.dom))}localCompositionInfo(e,t){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof oe)||r<t||o>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let l=s.nodeValue,a=L0(this.node.content,l,r-t,o-t);return a<0?null:{node:s,pos:a,text:l}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:o}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let l=new _0(this,s,t,o);e.input.compositionNodes.push(l),this.children=pi(this.children,r,r+o.length,e,l)}update(e,t,r,o){return this.dirty==Yt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,o),!0)}updateInner(e,t,r,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Bt}updateOuterDeco(e){if(as(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Qd(this.dom,this.nodeDOM,fi(this.outerDeco,this.node,t),fi(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Yd(n,e,t,r,o){eu(r,e,n);let s=new Ln(void 0,n,e,t,r,r,r,o,0);return s.contentDOM&&s.updateChildren(o,0),s}class is extends Ln{constructor(e,t,r,o,s,l,a){super(e,t,r,o,s,null,l,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,o){return this.dirty==Yt||this.dirty!=Bt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Bt||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=Bt,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let o=this.node.cut(e,t),s=document.createTextNode(o.text);return new is(this.parent,o,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Yt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Xd extends so{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Bt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class S0 extends Ln{constructor(e,t,r,o,s,l,a,c,d,u){super(e,t,r,o,s,l,a,d,u),this.spec=c}update(e,t,r,o){if(this.dirty==Yt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,o),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,o){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,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 Zd(n,e,t){let r=n.firstChild,o=!1;for(let s=0;s<e.length;s++){let l=e[s],a=l.dom;if(a.parentNode==n){for(;a!=r;)r=tu(r),o=!0;r=r.nextSibling}else o=!0,n.insertBefore(a,r);if(l instanceof lr){let c=r?r.previousSibling:n.lastChild;Zd(l.contentDOM,l.children,t),r=c?c.nextSibling:n.firstChild}}for(;r;)r=tu(r),o=!0;o&&t.trackWrites==n&&(t.trackWrites=null)}const lo=function(n){n&&(this.nodeName=n)};lo.prototype=Object.create(null);const ir=[new lo];function fi(n,e,t){if(n.length==0)return ir;let r=t?ir[0]:new lo,o=[r];for(let s=0;s<n.length;s++){let l=n[s].type.attrs;if(l){l.nodeName&&o.push(r=new lo(l.nodeName));for(let a in l){let c=l[a];c!=null&&(t&&o.length==1&&o.push(r=new lo(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+c:a=="style"?r.style=(r.style?r.style+";":"")+c:a!="nodeName"&&(r[a]=c))}}}return o}function Qd(n,e,t,r){if(t==ir&&r==ir)return e;let o=e;for(let s=0;s<r.length;s++){let l=r[s],a=t[s];if(s){let c;a&&a.nodeName==l.nodeName&&o!=n&&(c=o.parentNode)&&c.nodeName.toLowerCase()==l.nodeName||(c=document.createElement(l.nodeName),c.pmIsDeco=!0,c.appendChild(o),a=ir[0]),o=c}N0(o,a||ir[0],l)}return o}function N0(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)o.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<o.length;s++)r.indexOf(o[s])==-1&&n.classList.add(o[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)n.style.removeProperty(o[1])}t.style&&(n.style.cssText+=t.style)}}function eu(n,e,t){return Qd(n,n,ir,fi(e,t,n.nodeType!=1))}function as(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function tu(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class M0{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=T0(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let o=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;o<l&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=Bt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let c=this.index;c<Math.min(this.index+3,this.top.children.length);c++){let d=this.top.children[c];if(d.matchesMark(e[s])&&!this.isLocked(d.dom)){a=c;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let c=lr.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,o){let s=-1,l;if(o>=this.preMatch.index&&(l=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&l.matchesNode(e,t,r))s=this.top.children.indexOf(l,this.index);else for(let a=this.index,c=Math.min(this.top.children.length,a+5);a<c;a++){let d=this.top.children[a];if(d.matchesNode(e,t,r)&&!this.preMatch.matched.has(d)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,r,o,s){let l=this.top.children[o];return l.dirty==Yt&&l.dom==l.contentDOM&&(l.dirty=sr),l.update(e,t,r,s)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=t}}updateNextNode(e,t,r,o,s,l){for(let a=this.index;a<this.top.children.length;a++){let c=this.top.children[a];if(c instanceof Ln){let d=this.preMatch.matched.get(c);if(d!=null&&d!=s)return!1;let u=c.dom,f,p=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=Yt&&as(t,c.outerDeco));if(!p&&c.update(e,t,r,o))return this.destroyBetween(this.index,a),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(c,e,t,r,o,l)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=sr,f.updateChildren(o,l+1),f.dirty=Bt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,o,s,l){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!as(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=Ln.create(this.top,t,r,o,s,l);if(a.contentDOM){a.children=e.children,e.children=[];for(let c of a.children)c.parent=a}return e.destroy(),a}addNode(e,t,r,o,s){let l=Ln.create(this.top,e,t,r,o,s);l.contentDOM&&l.updateChildren(o,s+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(e,t,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let s=new Jd(this.top,e,t,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof lr;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof is)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((dt||st)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new Xd(this.top,[],r,null);t!=this.top?t.children.push(o):t.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function T0(n,e){let t=e,r=t.children.length,o=n.childCount,s=new Map,l=[];e:for(;o>0;){let a;for(;;)if(r){let d=t.children[r-1];if(d instanceof lr)t=d,r=d.children.length;else{a=d,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let c=a.node;if(c){if(c!=n.child(o-1))break;--o,s.set(a,o),l.push(a)}}return{index:o,matched:s,matches:l.reverse()}}function A0(n,e){return n.type.side-e.type.side}function B0(n,e,t,r){let o=e.locals(n),s=0;if(o.length==0){for(let d=0;d<n.childCount;d++){let u=n.child(d);r(u,o,e.forChild(s,u),d),s+=u.nodeSize}return}let l=0,a=[],c=null;for(let d=0;;){let u,f;for(;l<o.length&&o[l].to==s;){let y=o[l++];y.widget&&(u?(f||(f=[u])).push(y):u=y)}if(u)if(f){f.sort(A0);for(let y=0;y<f.length;y++)t(f[y],d,!!c)}else t(u,d,!!c);let p,h;if(c)h=-1,p=c,c=null;else if(d<n.childCount)h=d,p=n.child(d++);else break;for(let y=0;y<a.length;y++)a[y].to<=s&&a.splice(y--,1);for(;l<o.length&&o[l].from<=s&&o[l].to>s;)a.push(o[l++]);let m=s+p.nodeSize;if(p.isText){let y=m;l<o.length&&o[l].from<y&&(y=o[l].from);for(let b=0;b<a.length;b++)a[b].to<y&&(y=a[b].to);y<m&&(c=p.cut(y-s),p=p.cut(0,y-s),m=y,h=-1)}else for(;l<o.length&&o[l].to<m;)l++;let g=p.isInline&&!p.isLeaf?a.filter(y=>!y.inline):a.slice();r(p,g,e.forChild(s,p),h),s=m}}function V0(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function L0(n,e,t,r){for(let o=0,s=0;o<n.childCount&&s<=r;){let l=n.child(o++),a=s;if(s+=l.nodeSize,!l.isText)continue;let c=l.text;for(;o<n.childCount;){let d=n.child(o++);if(s+=d.nodeSize,!d.isText)break;c+=d.text}if(s>=t){if(s>=r&&c.slice(r-e.length-a,r-a)==e)return r-e.length;let d=a<r?c.lastIndexOf(e,r-a-1):-1;if(d>=0&&d+e.length+a>=t)return a+d;if(t==r&&c.length>=r+e.length-a&&c.slice(r-a,r-a+e.length)==e)return r}}return-1}function pi(n,e,t,r,o){let s=[];for(let l=0,a=0;l<n.length;l++){let c=n[l],d=a,u=a+=c.size;d>=t||u<=e?s.push(c):(d<e&&s.push(c.slice(0,e-d,r)),o&&(s.push(o),o=void 0),u>t&&s.push(c.slice(t-d,c.size,r)))}return s}function hi(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let o=n.docView.nearestDesc(t.focusNode),s=o&&o.size==0,l=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(l<0)return null;let a=r.resolve(l),c,d;if(ls(t)){for(c=l;o&&!o.node;)o=o.parent;let f=o.node;if(o&&f.isAtom&&ne.isSelectable(f)&&o.parent&&!(f.isInline&&s0(t.focusNode,t.focusOffset,o.dom))){let p=o.posBefore;d=new ne(l==p?a:r.resolve(p))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=l,p=l;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[c,l]=p==n.state.selection.anchor?[p,f]:[f,p],a=r.resolve(l)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!d){let f=e=="pointer"||n.state.selection.head<a.pos&&!s?1:-1;d=gi(n,u,a,f)}return d}function nu(n){return n.editable?n.hasFocus():cu(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function mn(n,e=!1){let t=n.state.selection;if(lu(n,t),!!nu(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&st){let r=n.domSelectionRange(),o=n.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&rr(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)I0(n);else{let{anchor:r,head:o}=t,s,l;ru&&!(t instanceof oe)&&(t.$from.parent.inlineContent||(s=ou(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(l=ou(n,t.to))),n.docView.setSelection(r,o,n,e),ru&&(s&&su(s),l&&su(l)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&O0(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const ru=dt||st&&Dd<63;function ou(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),o=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(dt&&o&&o.contentEditable=="false")return mi(o);if((!o||o.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(o)return mi(o);if(s)return mi(s)}}function mi(n){return n.contentEditable="true",dt&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function su(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function O0(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,o=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!nu(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function I0(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,et(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&>&&Bn<=11&&(t.disabled=!0,t.disabled=!1)}function lu(n,e){if(e instanceof ne){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(iu(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else iu(n)}function iu(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function gi(n,e,t,r){return n.someProp("createSelectionBetween",o=>o(n,e,t))||oe.between(e,t,r)}function au(n){return n.editable&&!n.hasFocus()?!1:cu(n)}function cu(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function D0(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return rr(e.node,e.offset,t.anchorNode,t.anchorOffset)}function yi(n,e){let{$anchor:t,$head:r}=n.selection,o=e>0?t.max(r):t.min(r),s=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return s&&le.findFrom(s,e)}function On(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function du(n,e,t){let r=n.state.selection;if(r instanceof oe)if(t.indexOf("s")>-1){let{$head:o}=r,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let l=n.state.doc.resolve(o.pos+s.nodeSize*(e<0?-1:1));return On(n,new oe(r.$anchor,l))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=yi(n.state,e);return o&&o instanceof ne?On(n,o):!1}else if(!(At&&t.indexOf("m")>-1)){let o=r.$head,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,l;if(!s||s.isText)return!1;let a=e<0?o.pos-s.nodeSize:o.pos;return s.isAtom||(l=n.docView.descAt(a))&&!l.contentDOM?ne.isSelectable(s)?On(n,new ne(e<0?n.state.doc.resolve(o.pos-s.nodeSize):o)):ro?On(n,new oe(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ne&&r.node.isInline)return On(n,new oe(e>0?r.$to:r.$from));{let o=yi(n.state,e);return o?On(n,o):!1}}}function cs(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function io(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Br(n,e){return e<0?R0(n):F0(n)}function R0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o,s,l=!1;for(Tt&&t.nodeType==1&&r<cs(t)&&io(t.childNodes[r],-1)&&(l=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(io(a,-1))o=t,s=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(uu(t))break;{let a=t.previousSibling;for(;a&&io(a,-1);)o=t.parentNode,s=et(a),a=a.previousSibling;if(a)t=a,r=cs(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}l?bi(n,t,r):o&&bi(n,o,s)}function F0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o=cs(t),s,l;for(;;)if(r<o){if(t.nodeType!=1)break;let a=t.childNodes[r];if(io(a,1))s=t,l=++r;else break}else{if(uu(t))break;{let a=t.nextSibling;for(;a&&io(a,1);)s=a.parentNode,l=et(a)+1,a=a.nextSibling;if(a)t=a,r=0,o=cs(t);else{if(t=t.parentNode,t==n.dom)break;r=o=0}}}s&&bi(n,s,l)}function uu(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function P0(n,e){for(;n&&e==n.childNodes.length&&!no(n);)e=et(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function $0(n,e){for(;n&&!e&&!no(n);)e=et(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function bi(n,e,t){if(e.nodeType!=3){let s,l;(l=P0(e,t))?(e=l,t=0):(s=$0(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(ls(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:o}=n;setTimeout(()=>{n.state==o&&mn(n)},50)}function fu(n,e){let t=n.state.doc.resolve(e);if(!(st||a0)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),l=(s.top+s.bottom)/2;if(l>o.top&&l<o.bottom&&Math.abs(s.left-o.left)>1)return s.left<o.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),l=(s.top+s.bottom)/2;if(l>o.top&&l<o.bottom&&Math.abs(s.left-o.left)>1)return s.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function pu(n,e,t){let r=n.state.selection;if(r instanceof oe&&!r.empty||t.indexOf("s")>-1||At&&t.indexOf("m")>-1)return!1;let{$from:o,$to:s}=r;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let l=yi(n.state,e);if(l&&l instanceof ne)return On(n,l)}if(!o.parent.inlineContent){let l=e<0?o:s,a=r instanceof Et?le.near(l,e):le.findFrom(l,e);return a?On(n,a):!1}return!1}function hu(n,e){if(!(n.state.selection instanceof oe))return!0;let{$head:t,$anchor:r,empty:o}=n.state.selection;if(!t.sameParent(r))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let l=n.state.tr;return e<0?l.delete(t.pos-s.nodeSize,t.pos):l.delete(t.pos,t.pos+s.nodeSize),n.dispatch(l),!0}return!1}function mu(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function z0(n){if(!dt||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;mu(n,r,"true"),setTimeout(()=>mu(n,r,"false"),20)}return!1}function H0(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function j0(n,e){let t=e.keyCode,r=H0(e);if(t==8||At&&t==72&&r=="c")return hu(n,-1)||Br(n,-1);if(t==46&&!e.shiftKey||At&&t==68&&r=="c")return hu(n,1)||Br(n,1);if(t==13||t==27)return!0;if(t==37||At&&t==66&&r=="c"){let o=t==37?fu(n,n.state.selection.from)=="ltr"?-1:1:-1;return du(n,o,r)||Br(n,o)}else if(t==39||At&&t==70&&r=="c"){let o=t==39?fu(n,n.state.selection.from)=="ltr"?1:-1:1;return du(n,o,r)||Br(n,o)}else{if(t==38||At&&t==80&&r=="c")return pu(n,-1,r)||Br(n,-1);if(t==40||At&&t==78&&r=="c")return z0(n)||pu(n,1,r)||Br(n,1);if(r==(At?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function ki(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:o,openEnd:s}=e;for(;o>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,s--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let l=n.someProp("clipboardSerializer")||tr.fromSchema(n.state.schema),a=Cu(),c=a.createElement("div");c.appendChild(l.serializeFragment(r,{document:a}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=wu[d.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=a.createElement(u[h]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${o} ${s}${f?` -${f}`:""} ${JSON.stringify(t)}`);let p=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
|
|
8
|
+
|
|
9
|
+
`);return{dom:c,text:p,slice:e}}function gu(n,e,t,r,o){let s=o.parent.type.spec.code,l,a;if(!t&&!e)return null;let c=!!e&&(r||s||!t);if(c){if(n.someProp("transformPastedText",p=>{e=p(e,s||r,n)}),s)return a=new q(I.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
10
|
+
`))),0,0),n.someProp("transformPasted",p=>{a=p(a,n,!0)}),a;let f=n.someProp("clipboardTextParser",p=>p(e,o,r,n));if(f)a=f;else{let p=o.marks(),{schema:h}=n.state,m=tr.fromSchema(h);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=l.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(h.text(g,p)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),l=q0(t),ro&&G0(l);let d=l&&l.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let p=l.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;l=p}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||wr.fromSchema(n.state.schema)).parseSlice(l,{preserveWhitespace:!!(c||u),context:o,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!U0.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)a=J0(xu(a,+u[1],+u[2]),u[4]);else if(a=q.maxOpen(W0(a.content,o),!0),a.openStart||a.openEnd){let f=0,p=0;for(let h=a.content.firstChild;f<a.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=a.content.lastChild;p<a.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);a=xu(a,f,p)}return n.someProp("transformPasted",f=>{a=f(a,n,c)}),a}const U0=/^(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 W0(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),s,l=[];if(n.forEach(a=>{if(!l)return;let c=o.findWrapping(a.type),d;if(!c)return l=null;if(d=l.length&&s.length&&bu(c,s,a,l[l.length-1],0))l[l.length-1]=d;else{l.length&&(l[l.length-1]=ku(l[l.length-1],s.length));let u=yu(a,c);l.push(u),o=o.matchType(u.type),s=c}}),l)return I.from(l)}return n}function yu(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,I.from(n));return n}function bu(n,e,t,r,o){if(o<n.length&&o<e.length&&n[o]==e[o]){let s=bu(n,e,t,r.lastChild,o+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(o==n.length-1?t.type:n[o+1]))return r.copy(r.content.append(I.from(yu(t,n,o+1))))}}function ku(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,ku(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(I.empty,!0);return n.copy(t.append(r))}function xi(n,e,t,r,o,s){let l=e<0?n.firstChild:n.lastChild,a=l.content;return n.childCount>1&&(s=0),o<r-1&&(a=xi(a,e,t,r,o+1,s)),o>=t&&(a=e<0?l.contentMatchAt(0).fillBefore(a,s<=o).append(a):a.append(l.contentMatchAt(l.childCount).fillBefore(I.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,l.copy(a))}function xu(n,e,t){return e<n.openStart&&(n=new q(xi(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new q(xi(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const wu={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 Eu=null;function Cu(){return Eu||(Eu=document.implementation.createHTMLDocument("title"))}let wi=null;function K0(n){let e=window.trustedTypes;return e?(wi||(wi=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),wi.createHTML(n)):n}function q0(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Cu().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),o;if((o=r&&wu[r[1].toLowerCase()])&&(n=o.map(s=>"<"+s+">").join("")+n+o.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=K0(n),o)for(let s=0;s<o.length;s++)t=t.querySelector(o[s])||t;return t}function G0(n){let e=n.querySelectorAll(st?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function J0(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:o,openStart:s,openEnd:l}=n;for(let a=r.length-2;a>=0;a-=2){let c=t.nodes[r[a]];if(!c||c.hasRequiredAttrs())break;o=I.from(c.create(r[a+1],o)),s++,l++}return new q(o,s,l)}const ut={},ft={},Y0={touchstart:!0,touchmove:!0};class X0{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 Z0(n){for(let e in ut){let t=ut[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{ey(n,r)&&!Ci(n,r)&&(n.editable||!(r.type in ft))&&t(n,r)},Y0[e]?{passive:!0}:void 0)}dt&&n.dom.addEventListener("input",()=>null),Ei(n)}function In(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Q0(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Ei(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Ci(n,r))})}function Ci(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function ey(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function ty(n,e){!Ci(n,e)&&ut[e.type]&&(n.editable||!(e.type in ft))&&ut[e.type](n,e)}ft.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!_u(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(pn&&st&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Tr&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",o=>o(n,or(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||j0(n,t)?t.preventDefault():In(n,"key")},ft.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},ft.keypress=(n,e)=>{let t=e;if(_u(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||At&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof oe)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",l=>l(n,r.$from.pos,r.$to.pos,o,s))&&n.dispatch(s()),t.preventDefault()}};function ds(n){return{left:n.clientX,top:n.clientY}}function ny(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function vi(n,e,t,r,o){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let l=s.depth+1;l>0;l--)if(n.someProp(e,a=>l>s.depth?a(n,t,s.nodeAfter,s.before(l),o,!0):a(n,t,s.node(l),s.before(l),o,!1)))return!0;return!1}function Vr(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function ry(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&ne.isSelectable(r)?(Vr(n,new ne(t)),!0):!1}function oy(n,e){if(e==-1)return!1;let t=n.state.selection,r,o;t instanceof ne&&(r=t.node);let s=n.state.doc.resolve(e);for(let l=s.depth+1;l>0;l--){let a=l>s.depth?s.nodeAfter:s.node(l);if(ne.isSelectable(a)){r&&t.$from.depth>0&&l>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?o=s.before(t.$from.depth):o=s.before(l);break}}return o!=null?(Vr(n,ne.create(n.state.doc,o)),!0):!1}function sy(n,e,t,r,o){return vi(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(o?oy(n,t):ry(n,t))}function ly(n,e,t,r){return vi(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",o=>o(n,e,r))}function iy(n,e,t,r){return vi(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",o=>o(n,e,r))||ay(n,t,r)}function ay(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Vr(n,oe.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s),a=o.before(s);if(l.inlineContent)Vr(n,oe.create(r,a+1,a+1+l.content.size));else if(ne.isSelectable(l))Vr(n,ne.create(r,a));else continue;return!0}}function _i(n){return us(n)}const vu=At?"metaKey":"ctrlKey";ut.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=_i(n),o=Date.now(),s="singleClick";o-n.input.lastClick.time<500&&ny(t,n.input.lastClick)&&!t[vu]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:s,button:t.button};let l=n.posAtCoords(ds(t));l&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new cy(n,l,t,!!r)):(s=="doubleClick"?ly:iy)(n,l.pos,l.inside,t)?t.preventDefault():In(n,"pointer"))};class cy{constructor(e,t,r,o){this.view=e,this.pos=t,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[vu],this.allowDefault=r.shiftKey;let s,l;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),l=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,l=u.depth?u.before():0}const a=o?null:r.target,c=a?e.docView.nearestDesc(a,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:d}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||d instanceof ne&&d.from<=l&&d.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Tt&&!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)),In(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(()=>mn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(ds(e))),this.updateAllowDefault(e),this.allowDefault||!t?In(this.view,"pointer"):sy(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||dt&&this.mightDrag&&!this.mightDrag.node.isAtom||st&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Vr(this.view,le.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):In(this.view,"pointer")}move(e){this.updateAllowDefault(e),In(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)}}ut.touchstart=n=>{n.input.lastTouch=Date.now(),_i(n),In(n,"pointer")},ut.touchmove=n=>{n.input.lastTouch=Date.now(),In(n,"pointer")},ut.contextmenu=n=>_i(n);function _u(n,e){return n.composing?!0:dt&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const dy=pn?5e3:-1;ft.compositionstart=ft.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof oe&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),us(n,!0),n.markCursor=null;else if(us(n,!e.selection.empty),Tt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let o=r.focusNode,s=r.focusOffset;o&&o.nodeType==1&&s!=0;){let l=s<0?o.lastChild:o.childNodes[s-1];if(!l)break;if(l.nodeType==3){let a=n.domSelection();a&&a.collapse(l,l.nodeValue.length);break}else o=l,s=-1}}n.input.composing=!0}Su(n,dy)},ft.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Su(n,20))};function Su(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>us(n),e))}function Nu(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=fy());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function uy(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=r0(e.focusNode,e.focusOffset),r=o0(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let o=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!o||!o.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let l=t.pmViewDesc;if(!(!l||!l.isText(t.nodeValue)))return r}}return t||r}function fy(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function us(n,e=!1){if(!(pn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Nu(n),e||n.docView&&n.docView.dirty){let t=hi(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function py(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const ao=gt&&Bn<15||Tr&&c0<604;ut.copy=ft.cut=(n,e)=>{let t=e,r=n.state.selection,o=t.type=="cut";if(r.empty)return;let s=ao?null:t.clipboardData,l=r.content(),{dom:a,text:c}=ki(n,l);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",c)):py(n,a),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function hy(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function my(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?co(n,r.value,null,o,e):co(n,r.textContent,r.innerHTML,o,e)},50)}function co(n,e,t,r,o){let s=gu(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,o,s||q.empty)))return!0;if(!s)return!1;let l=hy(s),a=l?n.state.tr.replaceSelectionWith(l,r):n.state.tr.replaceSelection(s);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Mu(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}ft.paste=(n,e)=>{let t=e;if(n.composing&&!pn)return;let r=ao?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&co(n,Mu(r),r.getData("text/html"),o,t)?t.preventDefault():my(n,t)};class Tu{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const gy=At?"altKey":"ctrlKey";function Au(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[gy]}ut.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let o=n.state.selection,s=o.empty?null:n.posAtCoords(ds(t)),l;if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof ne?o.to-1:o.to))){if(r&&r.mightDrag)l=ne.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(l=ne.create(n.state.doc,f.posBefore))}}let a=(l||n.state.selection).content(),{dom:c,text:d,slice:u}=ki(n,a);(!t.dataTransfer.files.length||!st||Dd>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(ao?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",ao||t.dataTransfer.setData("text/plain",d),n.dragging=new Tu(u,Au(n,t),l)},ut.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},ft.dragover=ft.dragenter=(n,e)=>e.preventDefault(),ft.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let o=n.posAtCoords(ds(t));if(!o)return;let s=n.state.doc.resolve(o.pos),l=r&&r.slice;l?n.someProp("transformPasted",m=>{l=m(l,n,!1)}):l=gu(n,Mu(t.dataTransfer),ao?null:t.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&Au(n,t));if(n.someProp("handleDrop",m=>m(n,t,l||q.empty,a))){t.preventDefault();return}if(!l)return;t.preventDefault();let c=l?ld(n.state.doc,s.pos,l):s.pos;c==null&&(c=s.pos);let d=n.state.tr;if(a){let{node:m}=r;m?m.replace(d):d.deleteSelection()}let u=d.mapping.map(c),f=l.openStart==0&&l.openEnd==0&&l.content.childCount==1,p=d.doc;if(f?d.replaceRangeWith(u,u,l.content.firstChild):d.replaceRange(u,u,l),d.doc.eq(p))return;let h=d.doc.resolve(u);if(f&&ne.isSelectable(l.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(l.content.firstChild))d.setSelection(new ne(h));else{let m=d.mapping.map(c);d.mapping.maps[d.mapping.maps.length-1].forEach((g,y,b,k)=>m=k),d.setSelection(gi(n,h,d.doc.resolve(m)))}n.focus(),n.dispatch(d.setMeta("uiEvent","drop"))},ut.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&mn(n)},20))},ut.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},ut.beforeinput=(n,e)=>{if(st&&pn&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,or(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in ft)ut[n]=ft[n];function uo(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class fs{constructor(e,t){this.toDOM=e,this.spec=t||ar,this.side=this.spec.side||0}map(e,t,r,o){let{pos:s,deleted:l}=e.mapResult(t.from+o,this.side<0?-1:1);return l?null:new Ye(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof fs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&uo(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Dn{constructor(e,t){this.attrs=e,this.spec=t||ar}map(e,t,r,o){let s=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-r,l=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-r;return s>=l?null:new Ye(s,l,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Dn&&uo(this.attrs,e.attrs)&&uo(this.spec,e.spec)}static is(e){return e.type instanceof Dn}destroy(){}}class Si{constructor(e,t){this.attrs=e,this.spec=t||ar}map(e,t,r,o){let s=e.mapResult(t.from+o,1);if(s.deleted)return null;let l=e.mapResult(t.to+o,-1);return l.deleted||l.pos<=s.pos?null:new Ye(s.pos-r,l.pos-r,this)}valid(e,t){let{index:r,offset:o}=e.content.findIndex(t.from),s;return o==t.from&&!(s=e.child(r)).isText&&o+s.nodeSize==t.to}eq(e){return this==e||e instanceof Si&&uo(this.attrs,e.attrs)&&uo(this.spec,e.spec)}destroy(){}}class Ye{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Ye(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Ye(e,e,new fs(t,r))}static inline(e,t,r,o){return new Ye(e,t,new Dn(r,o))}static node(e,t,r,o){return new Ye(e,t,new Si(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Dn}get widget(){return this.type instanceof fs}}const Lr=[],ar={};class Me{constructor(e,t){this.local=e.length?e:Lr,this.children=t.length?t:Lr}static create(e,t){return t.length?ps(t,e,0,ar):lt}find(e,t,r){let o=[];return this.findInner(e??0,t??1e9,o,0,r),o}findInner(e,t,r,o,s){for(let l=0;l<this.local.length;l++){let a=this.local[l];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<t&&this.children[l+1]>e){let a=this.children[l]+1;this.children[l+2].findInner(e-a,t-a,r,o+a,s)}}map(e,t,r){return this==lt||e.maps.length==0?this:this.mapInner(e,t,0,0,r||ar)}mapInner(e,t,r,o,s){let l;for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,o);c&&c.type.valid(t,c)?(l||(l=[])).push(c):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?yy(this.children,l||[],e,t,r,o,s):l?new Me(l.sort(cr),Lr):lt}add(e,t){return t.length?this==lt?Me.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let o,s=0;e.forEach((a,c)=>{let d=c+r,u;if(u=Vu(t,a,d)){for(o||(o=this.children.slice());s<o.length&&o[s]<c;)s+=3;o[s]==c?o[s+2]=o[s+2].addInner(a,u,d+1):o.splice(s,0,c,c+a.nodeSize,ps(u,a,d+1,ar)),s+=3}});let l=Bu(s?Lu(t):t,-r);for(let a=0;a<l.length;a++)l[a].type.valid(e,l[a])||l.splice(a--,1);return new Me(l.length?this.local.concat(l).sort(cr):this.local,o||this.children)}remove(e){return e.length==0||this==lt?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,o=this.local;for(let s=0;s<r.length;s+=3){let l,a=r[s]+t,c=r[s+1]+t;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>a&&f.to<c&&(e[u]=null,(l||(l=[])).push(f));if(!l)continue;r==this.children&&(r=this.children.slice());let d=r[s+2].removeInner(l,a+1);d!=lt?r[s+2]=d:(r.splice(s,3),s-=3)}if(o.length){for(let s=0,l;s<e.length;s++)if(l=e[s])for(let a=0;a<o.length;a++)o[a].eq(l,t)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new Me(o,r):lt}forChild(e,t){if(this==lt)return this;if(t.isLeaf)return Me.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,l=s+t.content.size;for(let a=0;a<this.local.length;a++){let c=this.local[a];if(c.from<l&&c.to>s&&c.type instanceof Dn){let d=Math.max(s,c.from)-s,u=Math.min(l,c.to)-s;d<u&&(o||(o=[])).push(c.copy(d,u))}}if(o){let a=new Me(o.sort(cr),Lr);return r?new Rn([a,r]):a}return r||lt}eq(e){if(this==e)return!0;if(!(e instanceof Me)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ni(this.localsInner(e))}localsInner(e){if(this==lt)return Lr;if(e.inlineContent||!this.local.some(Dn.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Dn||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Me.empty=new Me([],[]),Me.removeOverlap=Ni;const lt=Me.empty;class Rn{constructor(e){this.members=e}map(e,t){const r=this.members.map(o=>o.map(e,t,ar));return Rn.from(r)}forChild(e,t){if(t.isLeaf)return Me.empty;let r=[];for(let o=0;o<this.members.length;o++){let s=this.members[o].forChild(e,t);s!=lt&&(s instanceof Rn?r=r.concat(s.members):r.push(s))}return Rn.from(r)}eq(e){if(!(e instanceof Rn)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let o=0;o<this.members.length;o++){let s=this.members[o].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let l=0;l<s.length;l++)t.push(s[l])}}return t?Ni(r?t:t.sort(cr)):Lr}static from(e){switch(e.length){case 0:return lt;case 1:return e[0];default:return new Rn(e.every(t=>t instanceof Me)?e:e.reduce((t,r)=>t.concat(r instanceof Me?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function yy(n,e,t,r,o,s,l){let a=n.slice();for(let d=0,u=s;d<t.maps.length;d++){let f=0;t.maps[d].forEach((p,h,m,g)=>{let y=g-m-(h-p);for(let b=0;b<a.length;b+=3){let k=a[b+1];if(k<0||p>k+u-f)continue;let w=a[b]+u-f;h>=w?a[b+1]=p<=w?-2:-1:p>=u&&y&&(a[b]+=y,a[b+1]+=y)}f+=y}),u=t.maps[d].map(u,-1)}let c=!1;for(let d=0;d<a.length;d+=3)if(a[d+1]<0){if(a[d+1]==-2){c=!0,a[d+1]=-1;continue}let u=t.map(n[d]+s),f=u-o;if(f<0||f>=r.content.size){c=!0;continue}let p=t.map(n[d+1]+s,-1),h=p-o,{index:m,offset:g}=r.content.findIndex(f),y=r.maybeChild(m);if(y&&g==f&&g+y.nodeSize==h){let b=a[d+2].mapInner(t,y,u+1,n[d]+s+1,l);b!=lt?(a[d]=f,a[d+1]=h,a[d+2]=b):(a[d+1]=-2,c=!0)}else c=!0}if(c){let d=by(a,n,e,t,o,s,l),u=ps(d,r,0,l);e=u.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,p=0;f<u.children.length;f+=3){let h=u.children[f];for(;p<a.length&&a[p]<h;)p+=3;a.splice(p,0,u.children[f],u.children[f+1],u.children[f+2])}}return new Me(e.sort(cr),a)}function Bu(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let o=n[r];t.push(new Ye(o.from+e,o.to+e,o.type))}return t}function by(n,e,t,r,o,s,l){function a(c,d){for(let u=0;u<c.local.length;u++){let f=c.local[u].map(r,o,d);f?t.push(f):l.onRemove&&l.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)a(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<n.length;c+=3)n[c+1]==-1&&a(n[c+2],e[c]+s+1);return t}function Vu(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,o=null;for(let s=0,l;s<n.length;s++)(l=n[s])&&l.from>t&&l.to<r&&((o||(o=[])).push(l),n[s]=null);return o}function Lu(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ps(n,e,t,r){let o=[],s=!1;e.forEach((a,c)=>{let d=Vu(n,a,c+t);if(d){s=!0;let u=ps(d,a,t+c+1,r);u!=lt&&o.push(c,c+a.nodeSize,u)}});let l=Bu(s?Lu(n):n,-t).sort(cr);for(let a=0;a<l.length;a++)l[a].type.valid(e,l[a])||(r.onRemove&&r.onRemove(l[a].spec),l.splice(a--,1));return l.length||o.length?new Me(l,o):lt}function cr(n,e){return n.from-e.from||n.to-e.to}function Ni(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let o=t+1;o<e.length;o++){let s=e[o];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[o]=s.copy(s.from,r.to),Ou(e,o+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),Ou(e,o,r.copy(s.from,r.to)));break}}}return e}function Ou(n,e,t){for(;e<n.length&&cr(t,n[e])>0;)e++;n.splice(e,0,t)}function Mi(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=lt&&e.push(r)}),n.cursorWrapper&&e.push(Me.create(n.state.doc,[n.cursorWrapper.deco])),Rn.from(e)}const ky={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},xy=gt&&Bn<=11;class wy{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 Ey{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new wy,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]);gt&&Bn<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),xy&&(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,ky)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(au(this.view)){if(this.suppressingSelectionUpdates)return mn(this.view);if(gt&&Bn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&rr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=Mr(s))t.add(s);for(let s=e.anchorNode;s;s=Mr(s))if(t.has(s)){r=s;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 t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&au(e)&&!this.ignoreSelectionChange(r),s=-1,l=-1,a=!1,c=[];if(e.editable)for(let u=0;u<t.length;u++){let f=this.registerMutation(t[u],c);f&&(s=s<0?f.from:Math.min(f.from,s),l=l<0?f.to:Math.max(f.to,l),f.typeOver&&(a=!0))}if(Tt&&c.length){let u=c.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,p]=u;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of u){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||_y(e,f)!=h)&&p.remove()}}}let d=null;s<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ls(r)&&(d=hi(e))&&d.eq(le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,mn(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||o)&&(s>-1&&(e.docView.markDirty(s,l),Cy(e)),this.handleDOMChange(s,l,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||mn(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,s=e.nextSibling;if(gt&&Bn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:p}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(o=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(s=p)}let l=o&&o.parentNode==e.target?et(o)+1:0,a=r.localPosFromDOM(e.target,l,-1),c=s&&s.parentNode==e.target?et(s):e.target.childNodes.length,d=r.localPosFromDOM(e.target,c,1);return{from:a,to:d}}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 Iu=new WeakMap,Du=!1;function Cy(n){if(!Iu.has(n)&&(Iu.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Tt,Du)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."),Du=!0}}function Ru(n,e){let t=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,l=n.domAtPos(n.state.selection.anchor);return rr(l.node,l.offset,o,s)&&([t,r,o,s]=[o,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:o,focusOffset:s}}function vy(n,e){if(e.getComposedRanges){let o=e.getComposedRanges(n.root)[0];if(o)return Ru(n,o)}let t;function r(o){o.preventDefault(),o.stopImmediatePropagation(),t=o.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Ru(n,t):null}function _y(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function Sy(n,e,t){let{node:r,fromOffset:o,toOffset:s,from:l,to:a}=n.docView.parseRange(e,t),c=n.domSelectionRange(),d,u=c.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],ls(c)||d.push({node:c.focusNode,offset:c.focusOffset})),st&&n.input.lastKeyCode===8)for(let y=s;y>o;y--){let b=r.childNodes[y-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){s=y;break}if(!k||k.size)break}let f=n.state.doc,p=n.someProp("domParser")||wr.fromSchema(n.state.schema),h=f.resolve(l),m=null,g=p.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:Ny,context:h});if(d&&d[0].pos!=null){let y=d[0].pos,b=d[1]&&d[1].pos;b==null&&(b=y),m={anchor:y+l,head:b+l}}return{doc:g,sel:m,from:l,to:a}}function Ny(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(dt&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||dt&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const My=/^(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 Ty(n,e,t,r,o){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let C=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,A=hi(n,C);if(A&&!n.state.selection.eq(A)){if(st&&pn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",G=>G(n,or(13,"Enter"))))return;let z=n.state.tr.setSelection(A);C=="pointer"?z.setMeta("pointer",!0):C=="key"&&z.scrollIntoView(),s&&z.setMeta("composition",s),n.dispatch(z)}return}let l=n.state.doc.resolve(e),a=l.sharedDepth(t);e=l.before(a+1),t=n.state.doc.resolve(t).after(a+1);let c=n.state.selection,d=Sy(n,e,t),u=n.state.doc,f=u.slice(d.from,d.to),p,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(p=n.state.selection.to,h="end"):(p=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let m=Vy(f.content,d.doc.content,d.from,p,h);if(m&&n.input.domChangeCount++,(Tr&&n.input.lastIOSEnter>Date.now()-225||pn)&&o.some(C=>C.nodeType==1&&!My.test(C.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",C=>C(n,or(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof oe&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let C=Fu(n,n.state.doc,d.sel);if(C&&!C.eq(n.state.selection)){let A=n.state.tr.setSelection(C);s&&A.setMeta("composition",s),n.dispatch(A)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof oe&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),gt&&Bn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)==" "&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),y=d.doc.resolveNoCache(m.endB-d.from),b=u.resolve(m.start),k=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((Tr&&n.input.lastIOSEnter>Date.now()-225&&(!k||o.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!k&&g.pos<d.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(d.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",C=>C(n,or(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&By(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",C=>C(n,or(8,"Backspace")))){pn&&st&&n.domObserver.suppressSelectionUpdates();return}st&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),pn&&!k&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,y=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(C){return C(n,or(13,"Enter"))})},20));let w=m.start,x=m.endA,E=C=>{let A=C||n.state.tr.replace(w,x,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let z=Fu(n,A.doc,d.sel);z&&!(st&&n.composing&&z.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(z.head==w||z.head==A.mapping.map(x)-1)||gt&&z.empty&&z.head==w)&&A.setSelection(z)}return s&&A.setMeta("composition",s),A.scrollIntoView()},M;if(k){if(g.pos==y.pos){gt&&Bn<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>mn(n),20));let C=E(n.state.tr.delete(w,x)),A=u.resolve(m.start).marksAcross(u.resolve(m.endA));A&&C.ensureMarks(A),n.dispatch(C)}else if(m.endA==m.endB&&(M=Ay(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let C=E(n.state.tr);M.type=="add"?C.addMark(w,x,M.mark):C.removeMark(w,x,M.mark),n.dispatch(C)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let C=g.parent.textBetween(g.parentOffset,y.parentOffset),A=()=>E(n.state.tr.insertText(C,w,x));n.someProp("handleTextInput",z=>z(n,w,x,C,A))||n.dispatch(A())}}else n.dispatch(E())}function Fu(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:gi(n,e.resolve(t.anchor),e.resolve(t.head))}function Ay(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,o=t,s=r,l,a,c;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<t.length;u++)s=t[u].removeFromSet(s);if(o.length==1&&s.length==0)a=o[0],l="add",c=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&s.length==1)a=s[0],l="remove",c=u=>u.mark(a.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(I.from(d).eq(n))return{mark:a,type:l}}function By(n,e,t,r,o){if(t-e<=o.pos-r.pos||Ti(r,!0,!1)<o.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let l=n.resolve(Ti(s,!0,!0));return!l.parent.isTextblock||l.pos>t||Ti(l,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function Ti(n,e,t){let r=n.depth,o=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,o++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,o++}return o}function Vy(n,e,t,r,o){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:l,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(o=="end"){let c=Math.max(0,s-Math.min(l,a));r-=l+c-s}if(l<s&&n.size<e.size){let c=r<=s&&r>=l?s-r:0;s-=c,s&&s<e.size&&Pu(e.textBetween(s-1,s+1))&&(s+=c?1:-1),a=s+(a-l),l=s}else if(a<s){let c=r<=s&&r>=a?s-r:0;s-=c,s&&s<n.size&&Pu(n.textBetween(s-1,s+1))&&(s+=c?1:-1),l=s+(l-a),a=s}return{start:s,endA:l,endB:a}}function Pu(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class $u{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new X0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Wu),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=ju(this),Hu(this),this.nodeViews=Uu(this),this.docView=Yd(this.state.doc,zu(this),Mi(this),this.dom,this),this.domObserver=new Ey(this,(r,o,s,l)=>Ty(this,r,o,s,l)),this.domObserver.start(),Z0(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ei(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Wu),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let o=this.state,s=!1,l=!1;e.storedMarks&&this.composing&&(Nu(this),l=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Uu(this);Oy(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ei(this),this.editable=ju(this),Hu(this);let c=Mi(this),d=zu(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,d,c);(f||!e.selection.eq(o.selection))&&(l=!0);let p=u=="preserve"&&l&&this.dom.style.overflowAnchor==null&&f0(this);if(l){this.domObserver.stop();let h=f&&(gt||st)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Ly(o.selection,e.selection);if(f){let m=st?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=uy(this)),(s||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=Yd(e.doc,d,c,this.dom,this)),m&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&D0(this))?mn(this,h):(lu(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():p&&p0(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof ne){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Rd(this,t.getBoundingClientRect(),e)}else Rd(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let s=r.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(o=s)}this.dragging=new Tu(e.slice,e.move,o<0?void 0:ne.create(this.state.doc,o))}someProp(e,t){let r=this._props&&this._props[e],o;if(r!=null&&(o=t?t(r):r))return o;for(let l=0;l<this.directPlugins.length;l++){let a=this.directPlugins[l].props[e];if(a!=null&&(o=t?t(a):a))return o}let s=this.state.plugins;if(s)for(let l=0;l<s.length;l++){let a=s[l].props[e];if(a!=null&&(o=t?t(a):a))return o}}hasFocus(){if(gt){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&&h0(this.dom),mn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return k0(this,e)}coordsAtPos(e,t=1){return jd(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let o=this.docView.posFromDOM(e,t,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return v0(this,t||this.state,e)}pasteHTML(e,t){return co(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return co(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return ki(this,e)}destroy(){this.docView&&(Q0(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Mi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,t0())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return ty(this,e)}domSelectionRange(){let e=this.domSelection();return e?dt&&this.root.nodeType===11&&l0(this.dom.ownerDocument)==this.dom&&vy(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}$u.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function zu(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Ye.node(0,n.state.doc.content.size,e)]}function Hu(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Ye.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function ju(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Ly(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Uu(n){let e=Object.create(null);function t(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Oy(n,e){let t=0,r=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)r++;return t!=r}function Wu(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Fn={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:"'"},hs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Iy=typeof navigator<"u"&&/Mac/.test(navigator.platform),Dy=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),tt=0;tt<10;tt++)Fn[48+tt]=Fn[96+tt]=String(tt);for(var tt=1;tt<=24;tt++)Fn[tt+111]="F"+tt;for(var tt=65;tt<=90;tt++)Fn[tt]=String.fromCharCode(tt+32),hs[tt]=String.fromCharCode(tt);for(var Ai in Fn)hs.hasOwnProperty(Ai)||(hs[Ai]=Fn[Ai]);function Ry(n){var e=Iy&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Dy&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?hs:Fn)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Fy=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Py=typeof navigator<"u"&&/Win/.test(navigator.platform);function $y(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,o,s,l;for(let a=0;a<e.length-1;a++){let c=e[a];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))o=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))Fy?l=!0:o=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(t="Alt-"+t),o&&(t="Ctrl-"+t),l&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function zy(n){let e=Object.create(null);for(let t in n)e[$y(t)]=n[t];return e}function Bi(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Hy(n){return new Oe({props:{handleKeyDown:Vi(n)}})}function Vi(n){let e=zy(n);return function(t,r){let o=Ry(r),s,l=e[Bi(o,r)];if(l&&l(t.state,t.dispatch,t))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[Bi(o,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Py&&r.ctrlKey&&r.altKey)&&(s=Fn[r.keyCode])&&s!=o){let a=e[Bi(s,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var jy=Object.defineProperty,Li=(n,e)=>{for(var t in e)jy(n,t,{get:e[t],enumerable:!0})};function ms(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:o}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return o},get tr(){return r=t.selection,o=t.doc,s=t.storedMarks,t}}}var gs=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:o}=t,s=this.buildProps(o);return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...d)=>{const u=a(...d)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:o}=this,{view:s}=r,l=[],a=!!n,c=n||o.tr,d=()=>(!a&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(t).map(([f,p])=>[f,(...m)=>{const g=this.buildProps(c,e),y=p(...m)(g);return l.push(y),u}])),run:d};return u}createCan(n){const{rawCommands:e,state:t}=this,r=!1,o=n||t.tr,s=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([a,c])=>[a,(...d)=>c(...d)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:o}=this,{view:s}=r,l={tr:n,editor:r,view:s,state:ms({state:o,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...d)=>c(...d)(l)]))}};return l}},Ku={};Li(Ku,{blur:()=>Uy,clearContent:()=>Wy,clearNodes:()=>Ky,command:()=>qy,createParagraphNear:()=>Gy,cut:()=>Jy,deleteCurrentNode:()=>Yy,deleteNode:()=>Xy,deleteRange:()=>Zy,deleteSelection:()=>Qy,enter:()=>eb,exitCode:()=>tb,extendMarkRange:()=>nb,first:()=>rb,focus:()=>sb,forEach:()=>lb,insertContent:()=>ib,insertContentAt:()=>db,joinBackward:()=>pb,joinDown:()=>fb,joinForward:()=>hb,joinItemBackward:()=>mb,joinItemForward:()=>gb,joinTextblockBackward:()=>yb,joinTextblockForward:()=>bb,joinUp:()=>ub,keyboardShortcut:()=>xb,lift:()=>wb,liftEmptyBlock:()=>Eb,liftListItem:()=>Cb,newlineInCode:()=>vb,resetAttributes:()=>_b,scrollIntoView:()=>Sb,selectAll:()=>Nb,selectNodeBackward:()=>Mb,selectNodeForward:()=>Tb,selectParentNode:()=>Ab,selectTextblockEnd:()=>Bb,selectTextblockStart:()=>Vb,setContent:()=>Lb,setMark:()=>Yb,setMeta:()=>Xb,setNode:()=>Zb,setNodeSelection:()=>Qb,setTextSelection:()=>e1,sinkListItem:()=>t1,splitBlock:()=>n1,splitListItem:()=>r1,toggleList:()=>o1,toggleMark:()=>s1,toggleNode:()=>l1,toggleWrap:()=>i1,undoInputRule:()=>a1,unsetAllMarks:()=>c1,unsetMark:()=>d1,updateAttributes:()=>u1,wrapIn:()=>f1,wrapInList:()=>p1});var Uy=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),Wy=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),Ky=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:o}=r;return t&&o.forEach(({$from:s,$to:l})=>{n.doc.nodesBetween(s.pos,l.pos,(a,c)=>{if(a.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(c)),p=d.resolve(u.map(c+a.nodeSize)),h=f.blockRange(p);if(!h)return;const m=Er(h);if(a.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},qy=n=>e=>n(e),Gy=()=>({state:n,dispatch:e})=>Md(n,e),Jy=(n,e)=>({editor:t,tr:r})=>{const{state:o}=t,s=o.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const l=r.mapping.map(e);return r.insert(l,s.content),r.setSelection(new oe(r.doc.resolve(Math.max(l-1,0)))),!0},Yy=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const o=n.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===r.type){if(e){const a=o.before(s),c=o.after(s);n.delete(a,c).scrollIntoView()}return!0}return!1};function He(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var Xy=n=>({tr:e,state:t,dispatch:r})=>{const o=He(n,t.schema),s=e.selection.$anchor;for(let l=s.depth;l>0;l-=1)if(s.node(l).type===o){if(r){const c=s.before(l),d=s.after(l);e.delete(c,d).scrollIntoView()}return!0}return!1},Zy=n=>({tr:e,dispatch:t})=>{const{from:r,to:o}=n;return t&&e.delete(r,o),!0},Qy=()=>({state:n,dispatch:e})=>ti(n,e),eb=()=>({commands:n})=>n.keyboardShortcut("Enter"),tb=()=>({state:n,dispatch:e})=>$g(n,e);function Oi(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function ys(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>t.strict?e[o]===n[o]:Oi(e[o])?e[o].test(n[o]):e[o]===n[o]):!0}function qu(n,e,t={}){return n.find(r=>r.type===e&&ys(Object.fromEntries(Object.keys(t).map(o=>[o,r.attrs[o]])),t))}function Gu(n,e,t={}){return!!qu(n,e,t)}function Ii(n,e,t){var r;if(!n||!e)return;let o=n.parent.childAfter(n.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===e))&&(o=n.parent.childBefore(n.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===e)||(t=t||((r=o.node.marks[0])==null?void 0:r.attrs),!qu([...o.node.marks],e,t)))return;let l=o.index,a=n.start()+o.offset,c=l+1,d=a+o.node.nodeSize;for(;l>0&&Gu([...n.parent.child(l-1).marks],e,t);)l-=1,a-=n.parent.child(l).nodeSize;for(;c<n.parent.childCount&&Gu([...n.parent.child(c).marks],e,t);)d+=n.parent.child(c).nodeSize,c+=1;return{from:a,to:d}}function gn(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var nb=(n,e={})=>({tr:t,state:r,dispatch:o})=>{const s=gn(n,r.schema),{doc:l,selection:a}=t,{$from:c,from:d,to:u}=a;if(o){const f=Ii(c,s,e);if(f&&f.from<=d&&f.to>=u){const p=oe.create(l,f.from,f.to);t.setSelection(p)}}return!0},rb=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function Ju(n){return n instanceof oe}function dr(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Yu(n,e=null){if(!e)return null;const t=le.atStart(n),r=le.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const o=t.from,s=r.to;return e==="all"?oe.create(n,dr(0,o,s),dr(n.content.size,o,s)):oe.create(n,dr(e,o,s),dr(e,o,s))}function ob(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Di(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var sb=(n=null,e={})=>({editor:t,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const l=()=>{(Di()||ob())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!Ju(t.state.selection))return l(),!0;const a=Yu(o.doc,n)||t.state.selection,c=t.state.selection.eq(a);return s&&(c||o.setSelection(a),c&&o.storedMarks&&o.setStoredMarks(o.storedMarks),l()),!0},lb=(n,e)=>t=>n.every((r,o)=>e(r,{...t,index:o})),ib=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Xu=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Xu(r)}return n};function bs(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Xu(t)}function fo(n,e,t){if(n instanceof Sn||n instanceof I)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,o=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return I.fromArray(n.map(a=>e.nodeFromJSON(a)));const l=e.nodeFromJSON(n);return t.errorOnInvalidContent&&l.check(),l}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),fo("",e,t)}if(o){if(t.errorOnInvalidContent){let l=!1,a="";const c=new $c({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:d=>(l=!0,a=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?wr.fromSchema(c).parseSlice(bs(n),t.parseOptions):wr.fromSchema(c).parse(bs(n),t.parseOptions),t.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=wr.fromSchema(e);return t.slice?s.parseSlice(bs(n),t.parseOptions).content:s.parse(bs(n),t.parseOptions)}return fo("",e,t)}function ab(n,e,t){const r=n.steps.length-1;if(r<e)return;const o=n.steps[r];if(!(o instanceof Ge||o instanceof Je))return;const s=n.mapping.maps[r];let l=0;s.forEach((a,c,d,u)=>{l===0&&(l=u)}),n.setSelection(le.near(n.doc.resolve(l),t))}var cb=n=>!("type"in n),db=(n,e,t)=>({tr:r,dispatch:o,editor:s})=>{var l;if(o){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const c=y=>{s.emit("contentError",{editor:s,error:y,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{fo(e,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(y){c(y)}try{a=fo(e,s.schema,{parseOptions:d,errorOnInvalidContent:(l=t.errorOnInvalidContent)!=null?l:s.options.enableContentCheck})}catch(y){return c(y),!1}let{from:u,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((cb(a)?a:[a]).forEach(y=>{y.check(),p=p?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===f&&h){const{parent:y}=r.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,f+=1)}let g;if(p){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof I){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,f)}else{g=a;const y=r.doc.resolve(u),b=y.node(),k=y.parentOffset===0,w=b.isText||b.isTextblock,x=b.content.size>0;k&&w&&x&&(u=Math.max(0,u-1)),r.replaceWith(u,f,g)}t.updateSelection&&ab(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},ub=()=>({state:n,dispatch:e})=>Rg(n,e),fb=()=>({state:n,dispatch:e})=>Fg(n,e),pb=()=>({state:n,dispatch:e})=>wd(n,e),hb=()=>({state:n,dispatch:e})=>_d(n,e),mb=()=>({state:n,dispatch:e,tr:t})=>{try{const r=ts(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},gb=()=>({state:n,dispatch:e,tr:t})=>{try{const r=ts(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},yb=()=>({state:n,dispatch:e})=>Ig(n,e),bb=()=>({state:n,dispatch:e})=>Dg(n,e);function Zu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function kb(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,o,s,l;for(let a=0;a<e.length-1;a+=1){const c=e[a];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))o=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))Di()||Zu()?l=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(t=`Alt-${t}`),o&&(t=`Ctrl-${t}`),l&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var xb=n=>({editor:e,view:t,tr:r,dispatch:o})=>{const s=kb(n).split(/-(?!$)/),l=s.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),a=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{t.someProp("handleKeyDown",d=>d(t,a))});return c?.steps.forEach(d=>{const u=d.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function Pn(n,e,t={}){const{from:r,to:o,empty:s}=n.selection,l=e?He(e,n.schema):null,a=[];n.doc.nodesBetween(r,o,(f,p)=>{if(f.isText)return;const h=Math.max(r,p),m=Math.min(o,p+f.nodeSize);a.push({node:f,from:h,to:m})});const c=o-r,d=a.filter(f=>l?l.name===f.node.type.name:!0).filter(f=>ys(f.node.attrs,t,{strict:!1}));return s?!!d.length:d.reduce((f,p)=>f+p.to-p.from,0)>=c}var wb=(n,e={})=>({state:t,dispatch:r})=>{const o=He(n,t.schema);return Pn(t,o,e)?Pg(t,r):!1},Eb=()=>({state:n,dispatch:e})=>Td(n,e),Cb=n=>({state:e,dispatch:t})=>{const r=He(n,e.schema);return Xg(r)(e,t)},vb=()=>({state:n,dispatch:e})=>Nd(n,e);function ks(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Qu(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,o)=>(t.includes(o)||(r[o]=n[o]),r),{})}var _b=(n,e)=>({tr:t,state:r,dispatch:o})=>{let s=null,l=null;const a=ks(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=He(n,r.schema)),a==="mark"&&(l=gn(n,r.schema)),o&&t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,u)=>{s&&s===d.type&&t.setNodeMarkup(u,void 0,Qu(d.attrs,e)),l&&d.marks.length&&d.marks.forEach(f=>{l===f.type&&t.addMark(u,u+d.nodeSize,l.create(Qu(f.attrs,e)))})})}),!0):!1},Sb=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Nb=()=>({tr:n,dispatch:e})=>{if(e){const t=new Et(n.doc);n.setSelection(t)}return!0},Mb=()=>({state:n,dispatch:e})=>Cd(n,e),Tb=()=>({state:n,dispatch:e})=>Sd(n,e),Ab=()=>({state:n,dispatch:e})=>jg(n,e),Bb=()=>({state:n,dispatch:e})=>Kg(n,e),Vb=()=>({state:n,dispatch:e})=>Wg(n,e);function Ri(n,e,t={},r={}){return fo(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Lb=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:o,tr:s,dispatch:l,commands:a})=>{const{doc:c}=s;if(r.preserveWhitespace!=="full"){const d=Ri(n,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return l&&s.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!t),!0}return l&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:c.content.size},n,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function ef(n,e){const t=gn(e,n.schema),{from:r,to:o,empty:s}=n.selection,l=[];s?(n.storedMarks&&l.push(...n.storedMarks),l.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,o,c=>{l.push(...c.marks)});const a=l.find(c=>c.type.name===t.name);return a?{...a.attrs}:{}}function tf(n,e){const t=new Yl(n);return e.forEach(r=>{r.steps.forEach(o=>{t.step(o)})}),t}function Ob(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Ib(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(o,s)=>{t(o)&&r.push({node:o,pos:s})}),r}function nf(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function xs(n){return e=>nf(e.$from,n)}function te(n,e,t){return n.config[e]===void 0&&n.parent?te(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?te(n.parent,e,t):null}):n.config[e]}function Fi(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=te(e,"addExtensions",t);return r?[e,...Fi(r())]:e}).flat(10)}function Pi(n,e){const t=tr.fromSchema(e).serializeFragment(n),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(t),o.innerHTML}function rf(n){return typeof n=="function"}function ke(n,e=void 0,...t){return rf(n)?e?n.bind(e)(...t):n(...t):n}function Db(n={}){return Object.keys(n).length===0&&n.constructor===Object}function po(n){const e=n.filter(o=>o.type==="extension"),t=n.filter(o=>o.type==="node"),r=n.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function of(n){const e=[],{nodeExtensions:t,markExtensions:r}=po(n),o=[...t,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(l=>{const a={name:l.name,options:l.options,storage:l.storage,extensions:o},c=te(l,"addGlobalAttributes",a);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([p,h])=>{e.push({type:f,name:p,attribute:{...s,...h}})})})})}),o.forEach(l=>{const a={name:l.name,options:l.options,storage:l.storage},c=te(l,"addAttributes",a);if(!c)return;const d=c();Object.entries(d).forEach(([u,f])=>{const p={...s,...f};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:l.name,name:u,attribute:p})})}),e}function xe(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([o,s])=>{if(!r[o]){r[o]=s;return}if(o==="class"){const a=s?String(s).split(" "):[],c=r[o]?r[o].split(" "):[],d=a.filter(u=>!c.includes(u));r[o]=[...c,...d].join(" ")}else if(o==="style"){const a=s?s.split(";").map(u=>u.trim()).filter(Boolean):[],c=r[o]?r[o].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),a.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),r[o]=Array.from(d.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else r[o]=s}),r},{})}function ws(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>xe(t,r),{})}function Rb(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function sf(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const o=e.reduce((s,l)=>{const a=l.attribute.parseHTML?l.attribute.parseHTML(t):Rb(t.getAttribute(l.name));return a==null?s:{...s,[l.name]:a}},{});return{...r,...o}}}}function lf(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Db(t)?!1:t!=null))}function Fb(n,e){var t;const r=of(n),{nodeExtensions:o,markExtensions:s}=po(n),l=(t=o.find(d=>te(d,"topNode")))==null?void 0:t.name,a=Object.fromEntries(o.map(d=>{const u=r.filter(b=>b.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=n.reduce((b,k)=>{const w=te(k,"extendNodeSchema",f);return{...b,...w?w(d):{}}},{}),h=lf({...p,content:ke(te(d,"content",f)),marks:ke(te(d,"marks",f)),group:ke(te(d,"group",f)),inline:ke(te(d,"inline",f)),atom:ke(te(d,"atom",f)),selectable:ke(te(d,"selectable",f)),draggable:ke(te(d,"draggable",f)),code:ke(te(d,"code",f)),whitespace:ke(te(d,"whitespace",f)),linebreakReplacement:ke(te(d,"linebreakReplacement",f)),defining:ke(te(d,"defining",f)),isolating:ke(te(d,"isolating",f)),attrs:Object.fromEntries(u.map(b=>{var k,w;return[b.name,{default:(k=b?.attribute)==null?void 0:k.default,validate:(w=b?.attribute)==null?void 0:w.validate}]}))}),m=ke(te(d,"parseHTML",f));m&&(h.parseDOM=m.map(b=>sf(b,u)));const g=te(d,"renderHTML",f);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:ws(b,u)}));const y=te(d,"renderText",f);return y&&(h.toText=y),[d.name,h]})),c=Object.fromEntries(s.map(d=>{const u=r.filter(y=>y.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=n.reduce((y,b)=>{const k=te(b,"extendMarkSchema",f);return{...y,...k?k(d):{}}},{}),h=lf({...p,inclusive:ke(te(d,"inclusive",f)),excludes:ke(te(d,"excludes",f)),group:ke(te(d,"group",f)),spanning:ke(te(d,"spanning",f)),code:ke(te(d,"code",f)),attrs:Object.fromEntries(u.map(y=>{var b,k;return[y.name,{default:(b=y?.attribute)==null?void 0:b.default,validate:(k=y?.attribute)==null?void 0:k.validate}]}))}),m=ke(te(d,"parseHTML",f));m&&(h.parseDOM=m.map(y=>sf(y,u)));const g=te(d,"renderHTML",f);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:ws(y,u)})),[d.name,h]}));return new $c({topNode:l,nodes:a,marks:c})}function Pb(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function $i(n){return n.sort((t,r)=>{const o=te(t,"priority")||100,s=te(r,"priority")||100;return o>s?-1:o<s?1:0})}function af(n){const e=$i(Fi(n)),t=Pb(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function cf(n,e,t){const{from:r,to:o}=e,{blockSeparator:s=`
|
|
11
|
+
|
|
12
|
+
`,textSerializers:l={}}=t||{};let a="";return n.nodesBetween(r,o,(c,d,u,f)=>{var p;c.isBlock&&d>r&&(a+=s);const h=l?.[c.type.name];if(h)return u&&(a+=h({node:c,pos:d,parent:u,index:f,range:e})),!1;c.isText&&(a+=(p=c?.text)==null?void 0:p.slice(Math.max(r,d)-d,o-d))}),a}function $b(n,e){const t={from:0,to:n.content.size};return cf(n,t,e)}function df(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function zb(n,e){const t=He(e,n.schema),{from:r,to:o}=n.selection,s=[];n.doc.nodesBetween(r,o,a=>{s.push(a)});const l=s.reverse().find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function uf(n,e){const t=ks(typeof e=="string"?e:e.name,n.schema);return t==="node"?zb(n,e):t==="mark"?ef(n,e):{}}function Hb(n,e=JSON.stringify){const t={};return n.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(t,o)?!1:t[o]=!0})}function jb(n){const e=Hb(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,l)=>l!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function ff(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((o,s)=>{const l=[];if(o.ranges.length)o.forEach((a,c)=>{l.push({from:a,to:c})});else{const{from:a,to:c}=t[s];if(a===void 0||c===void 0)return;l.push({from:a,to:c})}l.forEach(({from:a,to:c})=>{const d=e.slice(s).map(a,-1),u=e.slice(s).map(c),f=e.invert().map(d,-1),p=e.invert().map(u);r.push({oldRange:{from:f,to:p},newRange:{from:d,to:u}})})}),jb(r)}function zi(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(o=>{const s=t.resolve(n),l=Ii(s,o.type);l&&r.push({mark:o,...l})}):t.nodesBetween(n,e,(o,s)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(l=>({from:s,to:s+o.nodeSize,mark:l})))}),r}var Ub=(n,e,t,r=20)=>{const o=n.doc.resolve(t);let s=r,l=null;for(;s>0&&l===null;){const a=o.node(s);a?.type.name===e?l=a:s-=1}return[l,s]};function Hi(n,e){return e.nodes[n]||e.marks[n]||null}function Es(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const o=n.find(s=>s.type===e&&s.name===r);return o?o.attribute.keepOnSplit:!1}))}var Wb=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(o,s,l,a)=>{var c,d;const u=((d=(c=o.type.spec).toText)==null?void 0:d.call(c,{node:o,pos:s,parent:l,index:a}))||o.textContent||"%leaf%";t+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-s))}),t};function ji(n,e,t={}){const{empty:r,ranges:o}=n.selection,s=e?gn(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>ys(f.attrs,t,{strict:!1}));let l=0;const a=[];if(o.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;n.doc.nodesBetween(h,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const b=Math.max(h,y),k=Math.min(m,y+g.nodeSize),w=k-b;l+=w,a.push(...g.marks.map(x=>({mark:x,from:b,to:k})))})}),l===0)return!1;const c=a.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>ys(f.mark.attrs,t,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),d=a.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,p)=>f+p.to-p.from,0);return(c>0?c+d:c)>=l}function Kb(n,e,t={}){if(!e)return Pn(n,null,t)||ji(n,null,t);const r=ks(e,n.schema);return r==="node"?Pn(n,e,t):r==="mark"?ji(n,e,t):!1}var qb=(n,e)=>{const{$from:t,$to:r,$anchor:o}=n.selection;if(e){const s=xs(a=>a.type.name===e)(n.selection);if(!s)return!1;const l=n.doc.resolve(s.pos+1);return o.pos+1===l.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},Gb=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function pf(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function hf(n,e){const{nodeExtensions:t}=po(e),r=t.find(l=>l.name===n);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},s=ke(te(r,"group",o));return typeof s!="string"?!1:s.split(" ").includes("list")}function Cs(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let o=!0;return n.content.forEach(s=>{o!==!1&&(Cs(s,{ignoreWhitespace:t,checkChildren:e})||(o=!1))}),o}return!1}function mf(n){return n instanceof ne}function Jb(n,e,t){var r;const{selection:o}=e;let s=null;if(Ju(o)&&(s=o.$cursor),s){const a=(r=n.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(d=>d.type.excludes(t)))}const{ranges:l}=o;return l.some(({$from:a,$to:c})=>{let d=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,c.pos,(u,f,p)=>{if(d)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));d=h&&m}return!d}),d})}var Yb=(n,e={})=>({tr:t,state:r,dispatch:o})=>{const{selection:s}=t,{empty:l,ranges:a}=s,c=gn(n,r.schema);if(o)if(l){const d=ef(r,c);t.addStoredMark(c.create({...d,...e}))}else a.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;r.doc.nodesBetween(u,f,(p,h)=>{const m=Math.max(h,u),g=Math.min(h+p.nodeSize,f);p.marks.find(b=>b.type===c)?p.marks.forEach(b=>{c===b.type&&t.addMark(m,g,c.create({...b.attrs,...e}))}):t.addMark(m,g,c.create(e))})});return Jb(r,t,c)},Xb=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Zb=(n,e={})=>({state:t,dispatch:r,chain:o})=>{const s=He(n,t.schema);let l;return t.selection.$anchor.sameParent(t.selection.$head)&&(l=t.selection.$anchor.parent.attrs),s.isTextblock?o().command(({commands:a})=>Vd(s,{...l,...e})(t)?!0:a.clearNodes()).command(({state:a})=>Vd(s,{...l,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Qb=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,o=dr(n,0,r.content.size),s=ne.create(r,o);e.setSelection(s)}return!0},e1=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:o,to:s}=typeof n=="number"?{from:n,to:n}:n,l=oe.atStart(r).from,a=oe.atEnd(r).to,c=dr(o,l,a),d=dr(s,l,a),u=oe.create(r,c,d);e.setSelection(u)}return!0},t1=n=>({state:e,dispatch:t})=>{const r=He(n,e.schema);return e0(r)(e,t)};function gf(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(o=>e?.includes(o.type.name));n.tr.ensureMarks(r)}}var n1=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:o})=>{const{selection:s,doc:l}=e,{$from:a,$to:c}=s,d=o.extensionManager.attributes,u=Es(d,a.node().type.name,a.node().attrs);if(s instanceof ne&&s.node.isBlock)return!a.parentOffset||!un(l,a.pos)?!1:(r&&(n&&gf(t,o.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,p=a.depth===0?void 0:Ob(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=f&&p?[{type:p,attrs:u}]:void 0,m=un(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!m&&un(e.doc,e.mapping.map(a.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:u}]:void 0),r){if(m&&(s instanceof oe&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),p&&!f&&!a.parentOffset&&a.parent.type!==p)){const g=e.mapping.map(a.before()),y=e.doc.resolve(g);a.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&e.setNodeMarkup(e.mapping.map(a.before()),p)}n&&gf(t,o.extensionManager.splittableMarks),e.scrollIntoView()}return m},r1=(n,e={})=>({tr:t,state:r,dispatch:o,editor:s})=>{var l;const a=He(n,r.schema),{$from:c,$to:d}=r.selection,u=r.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const f=c.node(-1);if(f.type!==a)return!1;const p=s.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==a||c.index(-2)!==c.node(-2).childCount-1)return!1;if(o){let b=I.empty;const k=c.index(-1)?1:c.index(-2)?2:3;for(let A=c.depth-k;A>=c.depth-3;A-=1)b=I.from(c.node(A).copy(b));const w=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,x={...Es(p,c.node().type.name,c.node().attrs),...e},E=((l=a.contentMatch.defaultType)==null?void 0:l.createAndFill(x))||void 0;b=b.append(I.from(a.createAndFill(null,E)||void 0));const M=c.before(c.depth-(k-1));t.replace(M,c.after(-w),new q(b,4-k,0));let C=-1;t.doc.nodesBetween(M,t.doc.content.size,(A,z)=>{if(C>-1)return!1;A.isTextblock&&A.content.size===0&&(C=z+1)}),C>-1&&t.setSelection(oe.near(t.doc.resolve(C))),t.scrollIntoView()}return!0}const h=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...Es(p,f.type.name,f.attrs),...e},g={...Es(p,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,d.pos);const y=h?[{type:a,attrs:m},{type:h,attrs:g}]:[{type:a,attrs:m}];if(!un(t.doc,c.pos,2))return!1;if(o){const{selection:b,storedMarks:k}=r,{splittableMarks:w}=s.extensionManager,x=k||b.$to.parentOffset&&b.$from.marks();if(t.split(c.pos,2,y).scrollIntoView(),!x||!o)return!0;const E=x.filter(M=>w.includes(M.type.name));t.ensureMarks(E)}return!0},Ui=(n,e)=>{const t=xs(l=>l.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const o=n.doc.nodeAt(r);return t.node.type===o?.type&&Tn(n.doc,t.pos)&&n.join(t.pos),!0},Wi=(n,e)=>{const t=xs(l=>l.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const o=n.doc.nodeAt(r);return t.node.type===o?.type&&Tn(n.doc,r)&&n.join(r),!0},o1=(n,e,t,r={})=>({editor:o,tr:s,state:l,dispatch:a,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:p}=o.extensionManager,h=He(n,l.schema),m=He(e,l.schema),{selection:g,storedMarks:y}=l,{$from:b,$to:k}=g,w=b.blockRange(k),x=y||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const E=xs(M=>hf(M.type.name,f))(g);if(w.depth>=1&&E&&w.depth-E.depth<=1){if(E.node.type===h)return d.liftListItem(m);if(hf(E.node.type.name,f)&&h.validContent(E.node.content)&&a)return c().command(()=>(s.setNodeMarkup(E.pos,h),!0)).command(()=>Ui(s,h)).command(()=>Wi(s,h)).run()}return!t||!x||!a?c().command(()=>u().wrapInList(h,r)?!0:d.clearNodes()).wrapInList(h,r).command(()=>Ui(s,h)).command(()=>Wi(s,h)).run():c().command(()=>{const M=u().wrapInList(h,r),C=x.filter(A=>p.includes(A.type.name));return s.ensureMarks(C),M?!0:d.clearNodes()}).wrapInList(h,r).command(()=>Ui(s,h)).command(()=>Wi(s,h)).run()},s1=(n,e={},t={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=t,l=gn(n,r.schema);return ji(r,l,e)?o.unsetMark(l,{extendEmptyMarkRange:s}):o.setMark(l,e)},l1=(n,e,t={})=>({state:r,commands:o})=>{const s=He(n,r.schema),l=He(e,r.schema),a=Pn(r,s,t);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),a?o.setNode(l,c):o.setNode(s,{...c,...t})},i1=(n,e={})=>({state:t,commands:r})=>{const o=He(n,t.schema);return Pn(t,o,e)?r.lift(o):r.wrapIn(o,e)},a1=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const o=t[r];let s;if(o.spec.isInputRules&&(s=o.getState(n))){if(e){const l=n.tr,a=s.transform;for(let c=a.steps.length-1;c>=0;c-=1)l.step(a.steps[c].invert(a.docs[c]));if(s.text){const c=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,n.schema.text(s.text,c))}else l.delete(s.from,s.to)}return!0}}return!1},c1=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:o}=t;return r||e&&o.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},d1=(n,e={})=>({tr:t,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:l=!1}=e,{selection:a}=t,c=gn(n,r.schema),{$from:d,empty:u,ranges:f}=a;if(!o)return!0;if(u&&l){let{from:p,to:h}=a;const m=(s=d.marks().find(y=>y.type===c))==null?void 0:s.attrs,g=Ii(d,c,m);g&&(p=g.from,h=g.to),t.removeMark(p,h,c)}else f.forEach(p=>{t.removeMark(p.$from.pos,p.$to.pos,c)});return t.removeStoredMark(c),!0},u1=(n,e={})=>({tr:t,state:r,dispatch:o})=>{let s=null,l=null;const a=ks(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=He(n,r.schema)),a==="mark"&&(l=gn(n,r.schema)),o&&t.selection.ranges.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;let f,p,h,m;t.selection.empty?r.doc.nodesBetween(d,u,(g,y)=>{s&&s===g.type&&(h=Math.max(y,d),m=Math.min(y+g.nodeSize,u),f=y,p=g)}):r.doc.nodesBetween(d,u,(g,y)=>{y<d&&s&&s===g.type&&(h=Math.max(y,d),m=Math.min(y+g.nodeSize,u),f=y,p=g),y>=d&&y<=u&&(s&&s===g.type&&t.setNodeMarkup(y,void 0,{...g.attrs,...e}),l&&g.marks.length&&g.marks.forEach(b=>{if(l===b.type){const k=Math.max(y,d),w=Math.min(y+g.nodeSize,u);t.addMark(k,w,l.create({...b.attrs,...e}))}}))}),p&&(f!==void 0&&t.setNodeMarkup(f,void 0,{...p.attrs,...e}),l&&p.marks.length&&p.marks.forEach(g=>{l===g.type&&t.addMark(h,m,l.create({...g.attrs,...e}))}))}),!0):!1},f1=(n,e={})=>({state:t,dispatch:r})=>{const o=He(n,t.schema);return qg(o,e)(t,r)},p1=(n,e={})=>({state:t,dispatch:r})=>{const o=He(n,t.schema);return Gg(o,e)(t,r)},h1=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},vs=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},m1=(n,e)=>{if(Oi(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function _s(n){var e;const{editor:t,from:r,to:o,text:s,rules:l,plugin:a}=n,{view:c}=t;if(c.composing)return!1;const d=c.state.doc.resolve(r);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const f=Wb(d)+s;return l.forEach(p=>{if(u)return;const h=m1(f,p.find);if(!h)return;const m=c.state.tr,g=ms({state:c.state,transaction:m}),y={from:r-(h[0].length-s.length),to:o},{commands:b,chain:k,can:w}=new gs({editor:t,state:g});p.handler({state:g,range:y,match:h,commands:b,chain:k,can:w})===null||!m.steps.length||(p.undoable&&m.setMeta(a,{transform:m,from:r,to:o,text:s}),c.dispatch(m),u=!0)}),u}function g1(n){const{editor:e,rules:t}=n,r=new Oe({state:{init(){return null},apply(o,s,l){const a=o.getMeta(r);if(a)return a;const c=o.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=Pi(I.from(u),l.schema);const{from:f}=c,p=f+u.length;_s({editor:e,from:f,to:p,text:u,rules:t,plugin:r})}),o.selectionSet||o.docChanged?null:s}},props:{handleTextInput(o,s,l,a){return _s({editor:e,from:s,to:l,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:s}=o.state.selection;s&&_s({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(o,s){if(s.key!=="Enter")return!1;const{$cursor:l}=o.state.selection;return l?_s({editor:e,from:l.pos,to:l.pos,text:`
|
|
13
|
+
`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function y1(n){return Object.prototype.toString.call(n).slice(8,-1)}function Ss(n){return y1(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function yf(n,e){const t={...n};return Ss(n)&&Ss(e)&&Object.keys(e).forEach(r=>{Ss(e[r])&&Ss(n[r])?t[r]=yf(n[r],e[r]):t[r]=e[r]}),t}var Ki=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...ke(te(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ke(te(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>yf(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},Ht=class Rm extends Ki{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Rm(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const l=o.marks();if(!!!l.find(d=>d?.type.name===t.name))return!1;const c=l.find(d=>d?.type.name===t.name);return c&&r.removeStoredMark(c),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function b1(n){return typeof n=="number"}var k1=class{constructor(n){this.find=n.find,this.handler=n.handler}},x1=(n,e,t)=>{if(Oi(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(o=>{const s=[o.text];return s.index=o.index,s.input=n,s.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(o.replaceWith)),s}):[]};function w1(n){const{editor:e,state:t,from:r,to:o,rule:s,pasteEvent:l,dropEvent:a}=n,{commands:c,chain:d,can:u}=new gs({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,o,(h,m)=>{var g,y,b,k,w;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const x=(w=(k=(b=h.content)==null?void 0:b.size)!=null?k:h.nodeSize)!=null?w:0,E=Math.max(r,m),M=Math.min(o,m+x);if(E>=M)return;const C=h.isText?h.text||"":h.textBetween(E-m,M-m,void 0,"");x1(C,s.find,l).forEach(z=>{if(z.index===void 0)return;const G=E+z.index+1,V=G+z[0].length,O={from:t.tr.mapping.map(G),to:t.tr.mapping.map(V)},Y=s.handler({state:t,range:O,match:z,commands:c,chain:d,can:u,pasteEvent:l,dropEvent:a});f.push(Y)})}),f.every(h=>h!==null)}var Ns=null,E1=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function C1(n){const{editor:e,rules:t}=n;let r=null,o=!1,s=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const c=({state:u,from:f,to:p,rule:h,pasteEvt:m})=>{const g=u.tr,y=ms({state:u,transaction:g});if(!(!w1({editor:e,state:y,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(u=>new Oe({view(f){const p=m=>{var g;r=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,r&&(Ns=e)},h=()=>{Ns&&(Ns=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(s=r===f.dom.parentElement,a=p,!s){const h=Ns;h?.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,p)=>{var h;const m=(h=p.clipboardData)==null?void 0:h.getData("text/html");return l=p,o=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!o,y=m.getMeta("uiEvent")==="drop"&&!s,b=m.getMeta("applyPasteRules"),k=!!b;if(!g&&!y&&!k)return;if(k){let{text:E}=b;typeof E=="string"?E=E:E=Pi(I.from(E),h.schema);const{from:M}=b,C=M+E.length,A=E1(E);return c({rule:u,state:h,from:M,to:{b:C},pasteEvt:A})}const w=p.doc.content.findDiffStart(h.doc.content),x=p.doc.content.findDiffEnd(h.doc.content);if(!(!b1(w)||!x||w===x.b))return c({rule:u,state:h,from:w,to:x,pasteEvt:l})}}))}var Ms=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=af(n),this.schema=Fb(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Hi(e.name,this.schema)},r=te(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return $i([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Hi(r.name,this.schema)},s=[],l=te(r,"addKeyboardShortcuts",o);let a={};if(r.type==="mark"&&te(r,"exitable",o)&&(a.ArrowRight=()=>Ht.handleExit({editor:n,mark:r})),l){const p=Object.fromEntries(Object.entries(l()).map(([h,m])=>[h,()=>m({editor:n})]));a={...a,...p}}const c=Hy(a);s.push(c);const d=te(r,"addInputRules",o);if(pf(r,n.options.enableInputRules)&&d){const p=d();if(p&&p.length){const h=g1({editor:n,rules:p}),m=Array.isArray(h)?h:[h];s.push(...m)}}const u=te(r,"addPasteRules",o);if(pf(r,n.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const h=C1({editor:n,rules:p});s.push(...h)}}const f=te(r,"addProseMirrorPlugins",o);if(f){const p=f();s.push(...p)}return s})}get attributes(){return of(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=po(this.extensions);return Object.fromEntries(e.filter(t=>!!te(t,"addNodeView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),o={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:He(t.name,this.schema)},s=te(t,"addNodeView",o);if(!s)return[];const l=(a,c,d,u,f)=>{const p=ws(a,r);return s()({node:a,view:c,getPos:d,decorations:u,innerDecorations:f,editor:n,extension:t,HTMLAttributes:p})};return[t.name,l]}))}get markViews(){const{editor:n}=this,{markExtensions:e}=po(this.extensions);return Object.fromEntries(e.filter(t=>!!te(t,"addMarkView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),o={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:gn(t.name,this.schema)},s=te(t,"addMarkView",o);if(!s)return[];const l=(a,c,d)=>{const u=ws(a,r);return s()({mark:a,view:c,inline:d,editor:n,extension:t,HTMLAttributes:u,updateAttributes:f=>{F1(a,n,f)}})};return[t.name,l]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Hi(e.name,this.schema)};e.type==="mark"&&((t=ke(te(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const o=te(e,"onBeforeCreate",r),s=te(e,"onCreate",r),l=te(e,"onUpdate",r),a=te(e,"onSelectionUpdate",r),c=te(e,"onTransaction",r),d=te(e,"onFocus",r),u=te(e,"onBlur",r),f=te(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),s&&this.editor.on("create",s),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}};Ms.resolve=af,Ms.sort=$i,Ms.flatten=Fi;var v1={};Li(v1,{ClipboardTextSerializer:()=>bf,Commands:()=>kf,Delete:()=>xf,Drop:()=>wf,Editable:()=>Ef,FocusEvents:()=>vf,Keymap:()=>_f,Paste:()=>Sf,Tabindex:()=>Nf,focusEventsPluginKey:()=>Cf});var Ee=class Fm extends Ki{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Fm(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},bf=Ee.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Oe({key:new $e("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:o}=e,{ranges:s}=o,l=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),c=df(t);return cf(r,{from:l,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),kf=Ee.create({name:"commands",addCommands(){return{...Ku}}}),xf=Ee.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,o;const s=()=>{var l,a,c,d;if((d=(c=(a=(l=this.editor.options.coreExtensionOptions)==null?void 0:l.delete)==null?void 0:a.filterTransaction)==null?void 0:c.call(a,n))!=null?d:n.getMeta("y-sync$"))return;const u=tf(n.before,[n,...e]);ff(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,(m,g)=>{const y=g+m.nodeSize-2,b=h.oldRange.from<=g&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:u.mapping.map(g),newTo:u.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:u})})});const p=u.mapping;u.steps.forEach((h,m)=>{var g,y;if(h instanceof zt){const b=p.slice(m).map(h.from,-1),k=p.slice(m).map(h.to),w=p.invert().map(b,-1),x=p.invert().map(k),E=(g=u.doc.nodeAt(b-1))==null?void 0:g.marks.some(C=>C.eq(h.mark)),M=(y=u.doc.nodeAt(k))==null?void 0:y.marks.some(C=>C.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:x},newRange:{from:b,to:k},partial:!!(M||E),editor:this.editor,transaction:n,combinedTransform:u})}})};(o=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||o?setTimeout(s,0):s()}}),wf=Ee.create({name:"drop",addProseMirrorPlugins(){return[new Oe({key:new $e("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Ef=Ee.create({name:"editable",addProseMirrorPlugins(){return[new Oe({key:new $e("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Cf=new $e("focusEvents"),vf=Ee.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Oe({key:Cf,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),_f=Ee.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:a})=>{const{selection:c,doc:d}=a,{empty:u,$anchor:f}=c,{pos:p,parent:h}=f,m=f.parent.isTextblock&&p>0?a.doc.resolve(p-1):f,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,b=g&&m.parent.childCount===1?y===f.pos:le.atStart(d).from===p;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&f.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Di()||Zu()?s:o},addProseMirrorPlugins(){return[new Oe({key:new $e("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const r=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),o=n.some(g=>g.getMeta("preventClearDocument"));if(!r||o)return;const{empty:s,from:l,to:a}=e.selection,c=le.atStart(e.doc).from,d=le.atEnd(e.doc).to;if(s||!(l===c&&a===d)||!Cs(t.doc))return;const p=t.tr,h=ms({state:t,transaction:p}),{commands:m}=new gs({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),Sf=Ee.create({name:"paste",addProseMirrorPlugins(){return[new Oe({key:new $e("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Nf=Ee.create({name:"tabindex",addProseMirrorPlugins(){return[new Oe({key:new $e("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),_1=class Kr{constructor(e,t,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,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 t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Kr(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Kr(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 Kr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const o=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,l=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!o&&a.depth<=this.depth)return;const c=new Kr(a,this.editor,o,o?t:null);o&&(c.actualDepth=this.depth+1),e.push(new Kr(a,this.editor,o,o?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(t).length>0){const s=o.node.attrs,l=Object.keys(t);for(let a=0;a<l.length;a+=1){const c=l[a];if(s[c]!==t[c])break}}else r=o;o=o.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const s=Object.keys(t);return this.children.forEach(l=>{r&&o.length>0||(l.node.type.name===e&&s.every(c=>t[c]===l.node.attrs[c])&&o.push(l),!(r&&o.length>0)&&(o=o.concat(l.querySelectorAll(e,t,r))))}),o}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},S1=`.ProseMirror {
|
|
14
14
|
position: relative;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -80,51 +80,67 @@ img.ProseMirror-separator {
|
|
|
80
80
|
|
|
81
81
|
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
82
82
|
display: block;
|
|
83
|
-
}`;function
|
|
83
|
+
}`;function N1(n,e,t){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=n,document.getElementsByTagName("head")[0].appendChild(o),o}var M1=class extends h1{constructor(e={}){super(),this.css=null,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:o})=>{throw o},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),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:o,slice:s,moved:l})=>this.options.onDrop(o,s,l)),this.on("paste",({event:o,slice:s})=>this.options.onPaste(o,s)),this.on("delete",this.options.onDelete);const t=this.createDoc(),r=Yu(t,this.options.autofocus);this.editorState=Sr.create({doc:t,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){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(e),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 e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}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=N1(S1,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&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:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const r=rf(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(s=>{const l=typeof s=="string"?`${s}$`:s.key;r=r.filter(a=>!a.key.startsWith(l))}),t.length===r.length)return;const o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}createExtensionManager(){var e,t;const o=[...this.options.enableCoreExtensions?[Ef,bf.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),kf,vf,_f,Nf,wf,Sf,xf].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new Ms(o,this)}createCommandManager(){this.commandManager=new gs({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Ri(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,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(r=>r.name!=="collaboration"),this.createExtensionManager()}}),e=Ri(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new $u(e,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)==null?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.prependClass(),this.injectCSS();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(u)});return}const{state:t,transactions:r}=this.state.applyTransaction(e),o=!this.state.selection.eq(t.selection),s=r.includes(e),l=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!s)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),o&&this.emit("selectionUpdate",{editor:this,transaction:e});const a=r.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),c=a?.getMeta("focus"),d=a?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:a}),d&&this.emit("blur",{editor:this,event:d.event,transaction:a}),!(e.getMeta("preventUpdate")||!r.some(u=>u.docChanged)||l.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return uf(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,o=typeof e=="string"?t:e;return Kb(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Pi(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
84
84
|
|
|
85
|
-
`,textSerializers:r={}}=e||{};return C0(this.state.doc,{blockSeparator:n,textSerializers:{...Qd(this.schema),...r}})}get isEmpty(){return vo(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,n;return(n=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?n:!0}$node(e,n){var r;return((r=this.$doc)==null?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new Xy(n,this)}get $doc(){return this.$pos(0)}};function Cn(t){return new _o({find:t.find,handler:({state:e,range:n,match:r})=>{const o=Q(t.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:s}=e,i=r[r.length-1],l=r[0];if(i){const a=l.search(/\S/),c=n.from+l.indexOf(i),d=c+i.length;if(Vi(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>c).length)return null;d<n.to&&s.delete(d,n.to),c>n.from&&s.delete(n.from+a,c);const h=n.from+a+i.length;s.addMark(n.from+a,h,t.type.create(o||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function Su(t){return new _o({find:t.find,handler:({state:e,range:n,match:r})=>{const o=Q(t.getAttributes,void 0,r)||{},{tr:s}=e,i=n.from;let l=n.to;const a=t.type.create(o);if(r[1]){const c=r[0].lastIndexOf(r[1]);let d=i+c;d>l?d=l:l=d+r[1].length;const u=r[0][r[0].length-1];s.insertText(u,i+r[0].length-1),s.replaceWith(d,l,a)}else if(r[0]){const c=t.type.isInline?i:i-1;s.insert(c,t.type.create(o)).delete(s.mapping.map(i),s.mapping.map(l))}s.scrollIntoView()},undoable:t.undoable})}function Ki(t){return new _o({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),s=Q(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,s)},undoable:t.undoable})}function Gn(t){return new _o({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const s=Q(t.getAttributes,void 0,r)||{},i=e.tr.delete(n.from,n.to),a=i.doc.resolve(n.from).blockRange(),c=a&&qs(a,t.type,s);if(!c)return null;if(i.wrap(a,c),t.keepMarks&&t.editor){const{selection:u,storedMarks:h}=e,{splittableMarks:p}=t.editor.extensionManager,m=h||u.$to.parentOffset&&u.$from.marks();if(m){const g=m.filter(y=>p.includes(y.type.name));i.ensureMarks(g)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(u,s).run()}const d=i.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&Ht(i.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,d))&&i.join(n.from-1)},undoable:t.undoable})}function tb(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof $){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let o=r.depth;for(;o>=0;){const s=r.index(o);if(r.node(o).contentMatchAt(s).matchType(e))return!0;o-=1}return!1}function nb(t,e,n={}){const{state:r}=e,{doc:o,tr:s}=r,i=t;o.descendants((l,a)=>{const c=s.mapping.map(a),d=s.mapping.map(a)+l.nodeSize;let u=null;if(l.marks.forEach(p=>{if(p!==i)return!1;u=p}),!u)return;let h=!1;if(Object.keys(n).forEach(p=>{n[p]!==u.attrs[p]&&(h=!0)}),h){const p=t.type.create({...t.attrs,...n});s.removeMark(c,d,t.type),s.addMark(c,d,p)}}),s.docChanged&&e.view.dispatch(s)}var Ce=class up extends zi{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new up(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Qt(t){return new B0({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const s=Q(t.getAttributes,void 0,r,o);if(s===!1||s===null)return null;const{tr:i}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const d=a.search(/\S/),u=n.from+a.indexOf(l),h=u+l.length;if(Vi(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===t.type&&y!==m.mark.type)).filter(m=>m.to>u).length)return null;h<n.to&&i.delete(h,n.to),u>n.from&&i.delete(n.from+d,u),c=n.from+d+l.length,i.addMark(n.from+d,c,t.type.create(s||{})),i.removeStoredMark(t.type)}}})}function Tu(t){return f.customRef((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}var rb=class extends eb{constructor(t={}){return super(t),this.contentComponent=null,this.appContext=null,this.reactiveState=Tu(this.view.state),this.reactiveExtensionStorage=Tu(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),f.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(t,e){const n=super.registerPlugin(t,e);return this.reactiveState&&(this.reactiveState.value=n),n}unregisterPlugin(t){const e=super.unregisterPlugin(t);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},Nu=f.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=f.ref(),n=f.getCurrentInstance();return f.watchEffect(()=>{const r=t.editor;r&&r.options.element&&e.value&&f.nextTick(()=>{var o;if(!e.value||!((o=r.view.dom)!=null&&o.firstChild))return;const s=f.unref(e.value);e.value.append(r.view.dom),r.contentComponent=n.ctx._,n&&(r.appContext={...n.appContext,provides:n.provides}),r.setOptions({element:s}),r.createNodeViews()})}),f.onBeforeUnmount(()=>{const r=t.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return f.h("div",{ref:t=>{this.rootEl=t}})}});f.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return f.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),f.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return f.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(t=this.$slots).default)==null?void 0:e.call(t))}});var ob=(t={})=>{const e=f.shallowRef();return f.onMounted(()=>{e.value=new rb(t)}),f.onBeforeUnmount(()=>{var n,r,o;const s=(n=e.value)==null?void 0:n.view.dom,i=s?.cloneNode(!0);(r=s?.parentNode)==null||r.replaceChild(i,s),(o=e.value)==null||o.destroy()}),e};f.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return f.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var sb=20,vu=(t,e=0)=>{const n=[];return!t.children.length||e>sb||Array.from(t.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...vu(r,e+1))}),n},ib=t=>{if(!t.children.length)return;const e=vu(t);e&&e.forEach(n=>{var r,o;const s=n.getAttribute("style"),i=(o=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:o.getAttribute("style");n.setAttribute("style",`${i};${s}`)})},qi=dt.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&ib(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",ee(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(s=>!!s))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),lb=te.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const s=r[o].split(":");if(s.length>=2){const i=s[0].trim().toLowerCase(),l=s.slice(1).join(":").trim();if(i==="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()}}}),ab=te.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const s=r[o].split(":");if(s.length>=2){const i=s[0].trim().toLowerCase(),l=s.slice(1).join(":").trim();if(i==="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()}}}),cb=te.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),db=te.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),ub=te.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}}),fb=te.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(lb.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(ab.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(cb.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(db.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(ub.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(qi.configure(this.options.textStyle)),t}}),Gi,Ji;if(typeof WeakMap<"u"){let t=new WeakMap;Gi=e=>t.get(e),Ji=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Gi=r=>{for(let o=0;o<t.length;o+=2)if(t[o]==r)return t[o+1]},Ji=(r,o)=>(n==10&&(n=0),t[n++]=r,t[n++]=o)}var pe=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,o=e/this.width|0;let s=r+1,i=o+1;for(let l=1;s<this.width&&this.map[e+l]==n;l++)s++;for(let l=1;i<this.height&&this.map[e+this.width*l]==n;l++)i++;return{left:r,top:o,right:s,bottom:i}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:o,top:s,bottom:i}=this.findCell(t);return e=="horiz"?(n<0?r==0:o==this.width)?null:this.map[s*this.width+(n<0?r-1:o)]:(n<0?s==0:i==this.height)?null:this.map[r+this.width*(n<0?s-1:i)]}rectBetween(t,e){const{left:n,right:r,top:o,bottom:s}=this.findCell(t),{left:i,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(n,i),top:Math.min(o,a),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let o=t.left;o<t.right;o++){const s=r*this.width+o,i=this.map[s];n[i]||(n[i]=!0,!(o==t.left&&o&&this.map[s-1]==i||r==t.top&&r&&this.map[s-this.width]==i)&&e.push(i))}return e}positionAt(t,e,n){for(let r=0,o=0;;r++){const s=o+n.child(r).nodeSize;if(r==t){let i=e+t*this.width;const l=(t+1)*this.width;for(;i<l&&this.map[i]<o;)i++;return i==l?s-1:this.map[i]}o=s}}static get(t){return Gi(t)||Ji(t,hb(t))}};function hb(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=pb(t),n=t.childCount,r=[];let o=0,s=null;const i=[];for(let c=0,d=e*n;c<d;c++)r[c]=0;for(let c=0,d=0;c<n;c++){const u=t.child(c);d++;for(let m=0;;m++){for(;o<r.length&&r[o]!=0;)o++;if(m==u.childCount)break;const g=u.child(m),{colspan:y,rowspan:b,colwidth:k}=g.attrs;for(let w=0;w<b;w++){if(w+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:d,n:b-w});break}const C=o+w*e;for(let T=0;T<y;T++){r[C+T]==0?r[C+T]=d:(s||(s=[])).push({type:"collision",row:c,pos:d,n:y-T});const _=k&&k[T];if(_){const S=(C+T)%e*2,I=i[S];I==null||I!=_&&i[S+1]==1?(i[S]=_,i[S+1]=1):I==_&&i[S+1]++}}}o+=y,d+=g.nodeSize}const h=(c+1)*e;let p=0;for(;o<h;)r[o++]==0&&p++;p&&(s||(s=[])).push({type:"missing",row:c,n:p}),d++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new pe(e,n,r,s);let a=!1;for(let c=0;!a&&c<i.length;c+=2)i[c]!=null&&i[c+1]<n&&(a=!0);return a&&mb(l,i,t),l}function pb(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const o=t.child(r);let s=0;if(n)for(let i=0;i<r;i++){const l=t.child(i);for(let a=0;a<l.childCount;a++){const c=l.child(a);i+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let i=0;i<o.childCount;i++){const l=o.child(i);s+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function mb(t,e,n){t.problems||(t.problems=[]);const r={};for(let o=0;o<t.map.length;o++){const s=t.map[o];if(r[s])continue;r[s]=!0;const i=n.nodeAt(s);if(!i)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=i.attrs;for(let c=0;c<a.colspan;c++){const d=(o+c)%t.width,u=e[d*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=gb(a)))[c]=u)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function gb(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Pe(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var Zt=new ye("selectingCells");function Jn(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function yb(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function ut(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Io(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Jn(e.$head)||bb(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function bb(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Yi(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function kb(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Xi(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function _u(t,e,n){const r=t.node(-1),o=pe.get(r),s=t.start(-1),i=o.nextCell(t.pos-s,e,n);return i==null?null:t.node(0).resolve(s+i)}function Sn(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function Mu(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<n;o++)r.colwidth.splice(e,0,0)}return r}function xb(t,e,n){const r=Pe(e.type.schema).header_cell;for(let o=0;o<t.height;o++)if(e.nodeAt(t.map[n+o*t.width]).type!=r)return!1;return!0}var le=class Bt extends z{constructor(e,n=e){const r=e.node(-1),o=pe.get(r),s=e.start(-1),i=o.rectBetween(e.pos-s,n.pos-s),l=e.node(0),a=o.cellsInRect(i).filter(d=>d!=n.pos-s);a.unshift(n.pos-s);const c=a.map(d=>{const u=r.nodeAt(d);if(!u)throw RangeError(`No cell with offset ${d} found`);const h=s+d+1;return new lc(l.resolve(h),l.resolve(h+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),o=e.resolve(n.map(this.$headCell.pos));if(Yi(r)&&Yi(o)&&Xi(r,o)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Bt.rowSelection(r,o):s&&this.isColSelection()?Bt.colSelection(r,o):new Bt(r,o)}return H.between(r,o)}content(){const e=this.$anchorCell.node(-1),n=pe.get(e),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},i=[];for(let a=o.top;a<o.bottom;a++){const c=[];for(let d=a*n.width+o.left,u=o.left;u<o.right;u++,d++){const h=n.map[d];if(s[h])continue;s[h]=!0;const p=n.findCell(h);let m=e.nodeAt(h);if(!m)throw RangeError(`No cell with offset ${h} found`);const g=o.left-p.left,y=p.right-o.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=Sn(b,0,g)),y>0&&(b=Sn(b,b.colspan-y,y)),p.left<o.left){if(m=m.type.createAndFill(b),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(p.top<o.top||p.bottom>o.bottom){const b={...m.attrs,rowspan:Math.min(p.bottom,o.bottom)-Math.max(p.top,o.top)};p.top<o.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}c.push(m)}i.push(e.child(a).copy(v.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:i;return new L(v.from(l),1,1)}replace(e,n=L.empty){const r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){const{$from:l,$to:a}=o[i],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),i?L.empty:n)}const s=z.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new L(v.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=pe.get(n),o=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let i=0;i<s.length;i++)e(n.nodeAt(s[i]),o+s[i])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),o=pe.get(r),s=e.start(-1),i=o.findCell(e.pos-s),l=o.findCell(n.pos-s),a=e.node(0);return i.top<=l.top?(i.top>0&&(e=a.resolve(s+o.map[i.left])),l.bottom<o.height&&(n=a.resolve(s+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(s+o.map[l.left])),i.bottom<o.height&&(e=a.resolve(s+o.map[o.width*(o.height-1)+i.right-1]))),new Bt(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=pe.get(e),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(o,s)>0)return!1;const i=o+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,l)==n.width}eq(e){return e instanceof Bt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),o=pe.get(r),s=e.start(-1),i=o.findCell(e.pos-s),l=o.findCell(n.pos-s),a=e.node(0);return i.left<=l.left?(i.left>0&&(e=a.resolve(s+o.map[i.top*o.width])),l.right<o.width&&(n=a.resolve(s+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(s+o.map[l.top*o.width])),i.right<o.width&&(e=a.resolve(s+o.map[o.width*(i.top+1)-1]))),new Bt(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Bt(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Bt(e.resolve(n),e.resolve(r))}getBookmark(){return new Eb(this.$anchorCell.pos,this.$headCell.pos)}};le.prototype.visible=!1,z.jsonID("cell",le);var Eb=class fp{constructor(e,n){this.anchor=e,this.head=n}map(e){return new fp(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Xi(n,r)?new le(n,r):z.near(r,1)}};function wb(t){if(!(t.selection instanceof le))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(ve.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ie.create(t.doc,e)}function Cb({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(o).type.spec.tableRole)}function Sb({$from:t,$to:e}){let n,r;for(let o=t.depth;o>0;o--){const s=t.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let o=e.depth;o>0;o--){const s=e.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function Tb(t,e,n){const r=(e||t).selection,o=(e||t).doc;let s,i;if(r instanceof $&&(i=r.node.type.spec.tableRole)){if(i=="cell"||i=="header_cell")s=le.create(o,r.from);else if(i=="row"){const l=o.resolve(r.from+1);s=le.rowSelection(l,l)}else if(!n){const l=pe.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];s=le.create(o,a+1,c)}}else r instanceof H&&Cb(r)?s=H.create(o,r.from):r instanceof H&&Sb(r)&&(s=H.create(o,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}var Nb=new ye("fix-tables");function Au(t,e,n,r){const o=t.childCount,s=e.childCount;e:for(let i=0,l=0;i<s;i++){const a=e.child(i);for(let c=l,d=Math.min(o,i+3);c<d;c++)if(t.child(c)==a){l=c+1,n+=a.nodeSize;continue e}r(a,n),l<o&&t.child(l).sameMarkup(a)?Au(t.child(l),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function Ou(t,e){let n;const r=(o,s)=>{o.type.spec.tableRole=="table"&&(n=vb(t,o,s,n))};return e?e.doc!=t.doc&&Au(e.doc,t.doc,0,r):t.doc.descendants(r),n}function vb(t,e,n,r){const o=pe.get(e);if(!o.problems)return r;r||(r=t.tr);const s=[];for(let a=0;a<o.height;a++)s.push(0);for(let a=0;a<o.problems.length;a++){const c=o.problems[a];if(c.type=="collision"){const d=e.nodeAt(c.pos);if(!d)continue;const u=d.attrs;for(let h=0;h<u.rowspan;h++)s[c.row+h]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Sn(u,u.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const d=r.mapping.map(n);r.delete(d,d+e.nodeSize)}}let i,l;for(let a=0;a<s.length;a++)s[a]&&(i==null&&(i=a),l=a);for(let a=0,c=n+1;a<o.height;a++){const d=e.child(a),u=c+d.nodeSize,h=s[a];if(h>0){let p="cell";d.firstChild&&(p=d.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<h;y++){const b=Pe(t.schema)[p].createAndFill();b&&m.push(b)}const g=(a==0||i==a-1)&&l==a?c+1:u-1;r.insert(r.mapping.map(g),m)}c=u}return r.setMeta(Nb,{fixTables:!0})}function bt(t){const e=t.selection,n=Io(t),r=n.node(-1),o=n.start(-1),s=pe.get(r);return{...e instanceof le?s.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):s.findCell(n.pos-o),tableStart:o,map:s,table:r}}function Lu(t,{map:e,tableStart:n,table:r},o){let s=o>0?-1:0;xb(e,r,o+s)&&(s=o==0||o==e.width?null:0);for(let i=0;i<e.height;i++){const l=i*e.width+o;if(o>0&&o<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);t.setNodeMarkup(t.mapping.map(n+a),null,Mu(c.attrs,o-e.colCount(a))),i+=c.attrs.rowspan-1}else{const a=s==null?Pe(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,c=e.positionAt(i,o,r);t.insert(t.mapping.map(n+c),a.createAndFill())}}return t}function _b(t,e){if(!ut(t))return!1;if(e){const n=bt(t);e(Lu(t.tr,n,n.left))}return!0}function Mb(t,e){if(!ut(t))return!1;if(e){const n=bt(t);e(Lu(t.tr,n,n.right))}return!0}function Ab(t,{map:e,table:n,tableStart:r},o){const s=t.mapping.maps.length;for(let i=0;i<e.height;){const l=i*e.width+o,a=e.map[l],c=n.nodeAt(a),d=c.attrs;if(o>0&&e.map[l-1]==a||o<e.width-1&&e.map[l+1]==a)t.setNodeMarkup(t.mapping.slice(s).map(r+a),null,Sn(d,o-e.colCount(a)));else{const u=t.mapping.slice(s).map(r+a);t.delete(u,u+c.nodeSize)}i+=d.rowspan}}function Ob(t,e){if(!ut(t))return!1;if(e){const n=bt(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let o=n.right-1;Ab(r,n,o),o!=n.left;o--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw RangeError("No table found");n.table=s,n.map=pe.get(s)}e(r)}return!0}function Lb(t,e,n){var r;const o=Pe(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))==null?void 0:r.type)!=o)return!1;return!0}function Iu(t,{map:e,tableStart:n,table:r},o){var s;let i=n;for(let c=0;c<o;c++)i+=r.child(c).nodeSize;const l=[];let a=o>0?-1:0;Lb(e,r,o+a)&&(a=o==0||o==e.height?null:0);for(let c=0,d=e.width*o;c<e.width;c++,d++)if(o>0&&o<e.height&&e.map[d]==e.map[d-e.width]){const u=e.map[d],h=r.nodeAt(u).attrs;t.setNodeMarkup(n+u,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{const u=a==null?Pe(r.type.schema).cell:(s=r.nodeAt(e.map[d+a*e.width]))==null?void 0:s.type,h=u?.createAndFill();h&&l.push(h)}return t.insert(i,Pe(r.type.schema).row.create(null,l)),t}function Ib(t,e){if(!ut(t))return!1;if(e){const n=bt(t);e(Iu(t.tr,n,n.top))}return!0}function Db(t,e){if(!ut(t))return!1;if(e){const n=bt(t);e(Iu(t.tr,n,n.bottom))}return!0}function Rb(t,{map:e,table:n,tableStart:r},o){let s=0;for(let c=0;c<o;c++)s+=n.child(c).nodeSize;const i=s+n.child(o).nodeSize,l=t.mapping.maps.length;t.delete(s+r,i+r);const a=new Set;for(let c=0,d=o*e.width;c<e.width;c++,d++){const u=e.map[d];if(!a.has(u)){if(a.add(u),o>0&&u==e.map[d-e.width]){const h=n.nodeAt(u).attrs;t.setNodeMarkup(t.mapping.slice(l).map(u+r),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(o<e.height&&u==e.map[d+e.width]){const h=n.nodeAt(u),p=h.attrs,m=h.type.create({...p,rowspan:h.attrs.rowspan-1},h.content),g=e.positionAt(o+1,c,n);t.insert(t.mapping.slice(l).map(r+g),m),c+=p.colspan-1}}}}function Pb(t,e){if(!ut(t))return!1;if(e){const n=bt(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let o=n.bottom-1;Rb(r,n,o),o!=n.top;o--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw RangeError("No table found");n.table=s,n.map=pe.get(n.table)}e(r)}return!0}function Du(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function Bb({width:t,height:e,map:n},r){let o=r.top*t+r.left,s=o,i=(r.bottom-1)*t+r.left,l=o+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[l]==n[l+1])return!0;s+=t,l+=t}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[o]==n[o-t]||r.bottom<e&&n[i]==n[i+t])return!0;o++,i++}return!1}function Ru(t,e){const n=t.selection;if(!(n instanceof le)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=bt(t),{map:o}=r;if(Bb(o,r))return!1;if(e){const s=t.tr,i={};let l=v.empty,a,c;for(let d=r.top;d<r.bottom;d++)for(let u=r.left;u<r.right;u++){const h=o.map[d*o.width+u],p=r.table.nodeAt(h);if(!(i[h]||!p))if(i[h]=!0,a==null)a=h,c=p;else{Du(p)||(l=l.append(p.content));const m=s.mapping.map(h+r.tableStart);s.delete(m,m+p.nodeSize)}}if(a==null||c==null)return!0;if(s.setNodeMarkup(a+r.tableStart,null,{...Mu(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const d=a+1+c.content.size,u=Du(c)?a+1:d;s.replaceWith(u+r.tableStart,d+r.tableStart,l)}s.setSelection(new le(s.doc.resolve(a+r.tableStart))),e(s)}return!0}function Pu(t,e){const n=Pe(t.schema);return Fb(({node:r})=>n[r.type.spec.tableRole])(t,e)}function Fb(t){return(e,n)=>{var r;const o=e.selection;let s,i;if(o instanceof le){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;s=o.$anchorCell.nodeAfter,i=o.$anchorCell.pos}else{if(s=yb(o.$from),!s)return!1;i=(r=Jn(o.$from))==null?void 0:r.pos}if(s==null||i==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let l=s.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const d=bt(e),u=e.tr;for(let p=0;p<d.right-d.left;p++)a.push(c?{...l,colwidth:c&&c[p]?[c[p]]:null}:l);let h;for(let p=d.top;p<d.bottom;p++){let m=d.map.positionAt(p,d.left,d.table);p==d.top&&(m+=s.nodeSize);for(let g=d.left,y=0;g<d.right;g++,y++)g==d.left&&p==d.top||u.insert(h=u.mapping.map(m+d.tableStart,1),t({node:s,row:p,col:g}).createAndFill(a[y]))}u.setNodeMarkup(i,t({node:s,row:d.top,col:d.left}),a[0]),o instanceof le&&u.setSelection(new le(u.doc.resolve(o.$anchorCell.pos),h?u.doc.resolve(h):void 0)),n(u)}return!0}}function Vb(t,e){return function(n,r){if(!ut(n))return!1;const o=Io(n);if(o.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof le?n.selection.forEachCell((i,l)=>{i.attrs[t]!==e&&s.setNodeMarkup(l,null,{...i.attrs,[t]:e})}):s.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function $b(t){return function(e,n){if(!ut(e))return!1;if(n){const r=Pe(e.schema),o=bt(e),s=e.tr,i=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=i.map(a=>o.table.nodeAt(a));for(let a=0;a<i.length;a++)l[a].type==r.header_cell&&s.setNodeMarkup(o.tableStart+i[a],r.cell,l[a].attrs);if(s.steps.length==0)for(let a=0;a<i.length;a++)s.setNodeMarkup(o.tableStart+i[a],r.header_cell,l[a].attrs);n(s)}return!0}}function Bu(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let o=0;o<r.length;o++){const s=e.table.nodeAt(r[o]);if(s&&s.type!==n.header_cell)return!1}return!0}function Tr(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?$b(t):function(n,r){if(!ut(n))return!1;if(r){const o=Pe(n.schema),s=bt(n),i=n.tr,l=Bu("row",s,o),a=Bu("column",s,o),d=(t==="column"?l:t==="row"?a:!1)?1:0,u=t=="column"?{left:0,top:d,right:1,bottom:s.map.height}:t=="row"?{left:d,top:0,right:s.map.width,bottom:1}:s,h=t=="column"?a?o.cell:o.header_cell:t=="row"?l?o.cell:o.header_cell:o.cell;s.map.cellsInRect(u).forEach(p=>{const m=p+s.tableStart,g=i.doc.nodeAt(m);g&&i.setNodeMarkup(m,h,g.attrs)}),r(i)}return!0}}Tr("row",{useDeprecatedLogic:!0}),Tr("column",{useDeprecatedLogic:!0});var Hb=Tr("cell",{useDeprecatedLogic:!0});function zb(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,o=t.before();r>=0;r--){const s=t.node(-1).child(r),i=s.lastChild;if(i)return o-1-i.nodeSize;o-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),o=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return o+1;o+=s.nodeSize}}return null}function Fu(t){return function(e,n){if(!ut(e))return!1;const r=zb(Io(e),t);if(r==null)return!1;if(n){const o=e.doc.resolve(r);n(e.tr.setSelection(H.between(o,kb(o))).scrollIntoView())}return!0}}function Ub(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Do(t,e){const n=t.selection;if(!(n instanceof le))return!1;if(e){const r=t.tr,o=Pe(t.schema).cell.createAndFill().content;n.forEachCell((s,i)=>{s.content.eq(o)||r.replace(r.mapping.map(i+1),r.mapping.map(i+s.nodeSize-1),new L(o,0,0))}),r.docChanged&&e(r)}return!0}function jb(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const o=e.child(0),s=o.type.spec.tableRole,i=o.type.schema,l=[];if(s=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const d=a?0:Math.max(0,n-1),u=a<e.childCount-1?0:Math.max(0,r-1);(d||u)&&(c=Qi(Pe(i).row,new L(c,d,u)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?Qi(Pe(i).row,new L(e,n,r)).content:e);else return null;return Wb(i,l)}function Wb(t,e){const n=[];for(let o=0;o<e.length;o++){const s=e[o];for(let i=s.childCount-1;i>=0;i--){const{rowspan:l,colspan:a}=s.child(i).attrs;for(let c=o;c<o+l;c++)n[c]=(n[c]||0)+a}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=e.length&&e.push(v.empty),n[o]<r){const s=Pe(t).cell.createAndFill(),i=[];for(let l=n[o];l<r;l++)i.push(s);e[o]=e[o].append(v.from(i))}return{height:e.length,width:r,rows:e}}function Qi(t,e){const n=t.createAndFill();return new Ys(n).replace(0,n.content.size,e).doc}function Kb({width:t,height:e,rows:n},r,o){if(t!=r){const s=[],i=[];for(let l=0;l<n.length;l++){const a=n[l],c=[];for(let d=s[l]||0,u=0;d<r;u++){let h=a.child(u%a.childCount);d+h.attrs.colspan>r&&(h=h.type.createChecked(Sn(h.attrs,h.attrs.colspan,d+h.attrs.colspan-r),h.content)),c.push(h),d+=h.attrs.colspan;for(let p=1;p<h.attrs.rowspan;p++)s[l+p]=(s[l+p]||0)+h.attrs.colspan}i.push(v.from(c))}n=i,t=r}if(e!=o){const s=[];for(let i=0,l=0;i<o;i++,l++){const a=[],c=n[l%e];for(let d=0;d<c.childCount;d++){let u=c.child(d);i+u.attrs.rowspan>o&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,o-u.attrs.rowspan)},u.content)),a.push(u)}s.push(v.from(a))}n=s,e=o}return{width:t,height:e,rows:n}}function qb(t,e,n,r,o,s,i){const l=t.doc.type.schema,a=Pe(l);let c,d;if(o>e.width)for(let u=0,h=0;u<e.height;u++){const p=n.child(u);h+=p.nodeSize;const m=[];let g;p.lastChild==null||p.lastChild.type==a.cell?g=c||(c=a.cell.createAndFill()):g=d||(d=a.header_cell.createAndFill());for(let y=e.width;y<o;y++)m.push(g);t.insert(t.mapping.slice(i).map(h-1+r),m)}if(s>e.height){const u=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,o);m++){const y=m>=e.width?!1:n.nodeAt(e.map[g+m]).type==a.header_cell;u.push(y?d||(d=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const h=a.row.create(null,v.from(u)),p=[];for(let m=e.height;m<s;m++)p.push(h);t.insert(t.mapping.slice(i).map(r+n.nodeSize-2),p)}return!!(c||d)}function Vu(t,e,n,r,o,s,i,l){if(i==0||i==e.height)return!1;let a=!1;for(let c=o;c<s;c++){const d=i*e.width+c,u=e.map[d];if(e.map[d-e.width]==u){a=!0;const h=n.nodeAt(u),{top:p,left:m}=e.findCell(u);t.setNodeMarkup(t.mapping.slice(l).map(u+r),null,{...h.attrs,rowspan:i-p}),t.insert(t.mapping.slice(l).map(e.positionAt(i,m,n)),h.type.createAndFill({...h.attrs,rowspan:p+h.attrs.rowspan-i})),c+=h.attrs.colspan-1}}return a}function $u(t,e,n,r,o,s,i,l){if(i==0||i==e.width)return!1;let a=!1;for(let c=o;c<s;c++){const d=c*e.width+i,u=e.map[d];if(e.map[d-1]==u){a=!0;const h=n.nodeAt(u),p=e.colCount(u),m=t.mapping.slice(l).map(u+r);t.setNodeMarkup(m,null,Sn(h.attrs,i-p,h.attrs.colspan-(i-p))),t.insert(m+h.nodeSize,h.type.createAndFill(Sn(h.attrs,0,i-p))),c+=h.attrs.rowspan-1}}return a}function Hu(t,e,n,r,o){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let i=pe.get(s);const{top:l,left:a}=r,c=a+o.width,d=l+o.height,u=t.tr;let h=0;function p(){if(s=n?u.doc.nodeAt(n-1):u.doc,!s)throw new Error("No table found");i=pe.get(s),h=u.mapping.maps.length}qb(u,i,s,n,c,d,h)&&p(),Vu(u,i,s,n,a,c,l,h)&&p(),Vu(u,i,s,n,a,c,d,h)&&p(),$u(u,i,s,n,l,d,a,h)&&p(),$u(u,i,s,n,l,d,c,h)&&p();for(let m=l;m<d;m++){const g=i.positionAt(m,a,s),y=i.positionAt(m,c,s);u.replace(u.mapping.slice(h).map(g+n),u.mapping.slice(h).map(y+n),new L(o.rows[m-l],0,0))}p(),u.setSelection(new le(u.doc.resolve(n+i.positionAt(l,a,s)),u.doc.resolve(n+i.positionAt(d-1,c-1,s)))),e(u)}var Gb=vi({ArrowLeft:Po("horiz",-1),ArrowRight:Po("horiz",1),ArrowUp:Po("vert",-1),ArrowDown:Po("vert",1),"Shift-ArrowLeft":Bo("horiz",-1),"Shift-ArrowRight":Bo("horiz",1),"Shift-ArrowUp":Bo("vert",-1),"Shift-ArrowDown":Bo("vert",1),Backspace:Do,"Mod-Backspace":Do,Delete:Do,"Mod-Delete":Do});function Ro(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Po(t,e){return(n,r,o)=>{if(!o)return!1;const s=n.selection;if(s instanceof le)return Ro(n,r,z.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const i=zu(o,t,e);if(i==null)return!1;if(t=="horiz")return Ro(n,r,z.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(i),a=_u(l,t,e);let c;return a?c=z.near(a,1):e<0?c=z.near(n.doc.resolve(l.before(-1)),-1):c=z.near(n.doc.resolve(l.after(-1)),1),Ro(n,r,c)}}}function Bo(t,e){return(n,r,o)=>{if(!o)return!1;const s=n.selection;let i;if(s instanceof le)i=s;else{const a=zu(o,t,e);if(a==null)return!1;i=new le(n.doc.resolve(a))}const l=_u(i.$headCell,t,e);return l?Ro(n,r,new le(i.$anchorCell,l)):!1}}function Jb(t,e){const n=t.state.doc,r=Jn(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new le(r))),!0):!1}function Yb(t,e,n){if(!ut(t.state))return!1;let r=jb(n);const o=t.state.selection;if(o instanceof le){r||(r={width:1,height:1,rows:[v.from(Qi(Pe(t.state.schema).cell,n))]});const s=o.$anchorCell.node(-1),i=o.$anchorCell.start(-1),l=pe.get(s).rectBetween(o.$anchorCell.pos-i,o.$headCell.pos-i);return r=Kb(r,l.right-l.left,l.bottom-l.top),Hu(t.state,t.dispatch,i,l,r),!0}else if(r){const s=Io(t.state),i=s.start(-1);return Hu(t.state,t.dispatch,i,pe.get(s.node(-1)).findCell(s.pos-i),r),!0}else return!1}function Xb(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=Uu(t,e.target);let o;if(e.shiftKey&&t.state.selection instanceof le)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Jn(t.state.selection.$anchor))!=null&&((n=Zi(t,e))==null?void 0:n.pos)!=o.pos)s(o,e),e.preventDefault();else if(!r)return;function s(a,c){let d=Zi(t,c);const u=Zt.getState(t.state)==null;if(!d||!Xi(a,d))if(u)d=a;else return;const h=new le(a,d);if(u||!t.state.selection.eq(h)){const p=t.state.tr.setSelection(h);u&&p.setMeta(Zt,a.pos),t.dispatch(p)}}function i(){t.root.removeEventListener("mouseup",i),t.root.removeEventListener("dragstart",i),t.root.removeEventListener("mousemove",l),Zt.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Zt,-1))}function l(a){const c=a,d=Zt.getState(t.state);let u;if(d!=null)u=t.state.doc.resolve(d);else if(Uu(t,c.target)!=r&&(u=Zi(t,e),!u))return i();u&&s(u,c)}t.root.addEventListener("mouseup",i),t.root.addEventListener("dragstart",i),t.root.addEventListener("mousemove",l)}function zu(t,e,n){if(!(t.state.selection instanceof H))return null;const{$head:r}=t.state.selection;for(let o=r.depth-1;o>=0;o--){const s=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(o),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?l:null}}return null}function Uu(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Zi(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Jn(t.state.doc.resolve(n.pos)):null}var Qb=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),el(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,el(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function el(t,e,n,r,o,s){var i;let l=0,a=!0,c=e.firstChild;const d=t.firstChild;if(d){for(let u=0,h=0;u<d.childCount;u++){const{colspan:p,colwidth:m}=d.child(u).attrs;for(let g=0;g<p;g++,h++){const y=o==h?s:m&&m[g],b=y?y+"px":"";if(l+=y||r,y||(a=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else{const k=document.createElement("col");k.style.width=b,e.appendChild(k)}}}for(;c;){const u=c.nextSibling;(i=c.parentNode)==null||i.removeChild(c),c=u}a?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var Xe=new ye("tableColumnResizing");function Zb({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=Qb,lastColumnResizable:o=!0}={}){const s=new ue({key:Xe,state:{init(i,l){var a,c;const d=(c=(a=s.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,u=Pe(l.schema).table.name;return r&&d&&(d[u]=(h,p)=>new r(h,n,p)),new e1(-1,!1)},apply(i,l){return l.apply(i)}},props:{attributes:i=>{const l=Xe.getState(i);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(i,l)=>{t1(i,l,t,o)},mouseleave:i=>{n1(i)},mousedown:(i,l)=>{r1(i,l,e,n)}},decorations:i=>{const l=Xe.getState(i);if(l&&l.activeHandle>-1)return a1(i,l.activeHandle)},nodeViews:{}}});return s}var e1=class Bs{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Xe);if(r&&r.setHandle!=null)return new Bs(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Bs(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return Yi(e.doc.resolve(o))||(o=-1),new Bs(o,n.dragging)}return n}};function t1(t,e,n,r){if(!t.editable)return;const o=Xe.getState(t.state);if(o&&!o.dragging){const s=s1(e.target);let i=-1;if(s){const{left:l,right:a}=s.getBoundingClientRect();e.clientX-l<=n?i=ju(t,e,"left",n):a-e.clientX<=n&&(i=ju(t,e,"right",n))}if(i!=o.activeHandle){if(!r&&i!==-1){const l=t.state.doc.resolve(i),a=l.node(-1),c=pe.get(a),d=l.start(-1);if(c.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Ku(t,i)}}}function n1(t){if(!t.editable)return;const e=Xe.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Ku(t,-1)}function r1(t,e,n,r){var o;if(!t.editable)return!1;const s=(o=t.dom.ownerDocument.defaultView)!=null?o:window,i=Xe.getState(t.state);if(!i||i.activeHandle==-1||i.dragging)return!1;const l=t.state.doc.nodeAt(i.activeHandle),a=o1(t,i.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Xe,{setDragging:{startX:e.clientX,startWidth:a}}));function c(u){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",d);const h=Xe.getState(t.state);h?.dragging&&(i1(t,h.activeHandle,Wu(h.dragging,u,n)),t.dispatch(t.state.tr.setMeta(Xe,{setDragging:null})))}function d(u){if(!u.which)return c(u);const h=Xe.getState(t.state);if(h&&h.dragging){const p=Wu(h.dragging,u,n);qu(t,h.activeHandle,p,r)}}return qu(t,i.activeHandle,a,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",d),e.preventDefault(),!0}function o1(t,e,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const s=t.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,a=n;if(r)for(let c=0;c<n;c++)r[c]&&(l-=r[c],a--);return l/a}function s1(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function ju(t,e,n,r){const o=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!s)return-1;const{pos:i}=s,l=Jn(t.state.doc.resolve(i));if(!l)return-1;if(n=="right")return l.pos;const a=pe.get(l.node(-1)),c=l.start(-1),d=a.map.indexOf(l.pos-c);return d%a.width==0?-1:c+a.map[d-1]}function Wu(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Ku(t,e){t.dispatch(t.state.tr.setMeta(Xe,{setHandle:e}))}function i1(t,e,n){const r=t.state.doc.resolve(e),o=r.node(-1),s=pe.get(o),i=r.start(-1),l=s.colCount(r.pos-i)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let c=0;c<s.height;c++){const d=c*s.width+l;if(c&&s.map[d]==s.map[d-s.width])continue;const u=s.map[d],h=o.nodeAt(u).attrs,p=h.colspan==1?0:l-s.colCount(u);if(h.colwidth&&h.colwidth[p]==n)continue;const m=h.colwidth?h.colwidth.slice():l1(h.colspan);m[p]=n,a.setNodeMarkup(i+u,null,{...h,colwidth:m})}a.docChanged&&t.dispatch(a)}function qu(t,e,n,r){const o=t.state.doc.resolve(e),s=o.node(-1),i=o.start(-1),l=pe.get(s).colCount(o.pos-i)+o.nodeAfter.attrs.colspan-1;let a=t.domAtPos(o.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&el(s,a.firstChild,a,r,l,n)}function l1(t){return Array(t).fill(0)}function a1(t,e){var n;const r=[],o=t.doc.resolve(e),s=o.node(-1);if(!s)return ie.empty;const i=pe.get(s),l=o.start(-1),a=i.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){const d=a+c*i.width;if((a==i.width-1||i.map[d]!=i.map[d+1])&&(c==0||i.map[d]!=i.map[d-i.width])){const u=i.map[d],h=l+u+s.nodeAt(u).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",(n=Xe.getState(t))!=null&&n.dragging&&r.push(ve.node(l+u,l+u+s.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),r.push(ve.widget(h,p))}}return ie.create(t.doc,r)}function c1({allowTableNodeSelection:t=!1}={}){return new ue({key:Zt,state:{init(){return null},apply(e,n){const r=e.getMeta(Zt);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:o,pos:s}=e.mapping.mapResult(n);return o?null:s}},props:{decorations:wb,handleDOMEvents:{mousedown:Xb},createSelectionBetween(e){return Zt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Jb,handleKeyDown:Gb,handlePaste:Yb},appendTransaction(e,n,r){return Tb(r,Ou(r,n),t)}})}var d1=Ce.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const r=t.getAttribute("colwidth"),o=r?r.split(",").map(s=>parseInt(s,10)):null;if(!o){const s=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),i=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(i&&i>-1&&s&&s[i]){const l=s[i].getAttribute("width");return l?[parseInt(l,10)]:null}}return o}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",ee(this.options.HTMLAttributes,t),0]}}),u1=Ce.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",ee(this.options.HTMLAttributes,t),0]}}),f1=Ce.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",ee(this.options.HTMLAttributes,t),0]}});function tl(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Gu(t,e,n,r,o,s){var i;let l=0,a=!0,c=e.firstChild;const d=t.firstChild;if(d!==null)for(let u=0,h=0;u<d.childCount;u+=1){const{colspan:p,colwidth:m}=d.child(u).attrs;for(let g=0;g<p;g+=1,h+=1){const y=o===h?s:m&&m[g],b=y?`${y}px`:"";if(l+=y||r,y||(a=!1),c){if(c.style.width!==b){const[k,w]=tl(r,y);c.style.setProperty(k,w)}c=c.nextSibling}else{const k=document.createElement("col"),[w,C]=tl(r,y);k.style.setProperty(w,C),e.appendChild(k)}}}for(;c;){const u=c.nextSibling;(i=c.parentNode)==null||i.removeChild(c),c=u}a?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}var h1=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Gu(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,Gu(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function p1(t,e,n,r){let o=0,s=!0;const i=[],l=t.firstChild;if(!l)return{};for(let u=0,h=0;u<l.childCount;u+=1){const{colspan:p,colwidth:m}=l.child(u).attrs;for(let g=0;g<p;g+=1,h+=1){const y=n===h?r:m&&m[g];o+=y||e,y||(s=!1);const[b,k]=tl(e,y);i.push(["col",{style:`${b}: ${k}`}])}}const a=s?`${o}px`:"",c=s?"":`${o}px`;return{colgroup:["colgroup",{},...i],tableWidth:a,tableMinWidth:c}}function Ju(t,e){return t.createAndFill()}function m1(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function g1(t,e,n,r,o){const s=m1(t),i=[],l=[];for(let c=0;c<n;c+=1){const d=Ju(s.cell);if(d&&l.push(d),r){const u=Ju(s.header_cell);u&&i.push(u)}}const a=[];for(let c=0;c<e;c+=1)a.push(s.row.createChecked(null,r&&c===0?i:l));return s.table.createChecked(null,a)}function y1(t){return t instanceof le}var Fo=({editor:t})=>{const{selection:e}=t.state;if(!y1(e))return!1;let n=0;const r=Wd(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},b1=Ce.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:h1,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:o}=p1(t,this.options.cellMinWidth);return["table",ee(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:o,editor:s})=>{const i=g1(s.schema,t,e,n);if(o){const l=r.selection.from+1;r.replaceSelectionWith(i).scrollIntoView().setSelection(H.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>_b(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Mb(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Ob(t,e),addRowBefore:()=>({state:t,dispatch:e})=>Ib(t,e),addRowAfter:()=>({state:t,dispatch:e})=>Db(t,e),deleteRow:()=>({state:t,dispatch:e})=>Pb(t,e),deleteTable:()=>({state:t,dispatch:e})=>Ub(t,e),mergeCells:()=>({state:t,dispatch:e})=>Ru(t,e),splitCell:()=>({state:t,dispatch:e})=>Pu(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Tr("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Tr("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>Hb(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Ru(t,e)?!0:Pu(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Vb(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Fu(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Fu(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Ou(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=le.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Fo,"Mod-Backspace":Fo,Delete:Fo,"Mod-Delete":Fo}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Zb({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],c1({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Q(V(t,"tableRole",e))}}}),k1=te.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(b1.configure(this.options.table)),this.options.tableCell!==!1&&t.push(d1.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(u1.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(f1.configure(this.options.tableRow)),t}}),x1=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,E1=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,w1=dt.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",ee(this.options.HTMLAttributes,t),0]},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[Cn({find:x1,type:this.type})]},addPasteRules(){return[Qt({find:E1,type:this.type})]}}),C1=dt.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",ee(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()}}}),S1=dt.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",ee(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()}}}),Vo=(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]},T1=/^\s*>\s$/,N1=Ce.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Vo("blockquote",{...ee(this.options.HTMLAttributes,t),children:Vo("slot",{})})},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[Gn({find:T1,type:this.type})]}}),v1=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_1=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,M1=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,A1=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,O1=dt.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 Vo("strong",{...ee(this.options.HTMLAttributes,t),children:Vo("slot",{})})},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[Cn({find:v1,type:this.type}),Cn({find:M1,type:this.type})]},addPasteRules(){return[Qt({find:_1,type:this.type}),Qt({find:A1,type:this.type})]}}),L1=/(^|[^`])`([^`]+)`(?!`)$/,I1=/(^|[^`])`([^`]+)`(?!`)/g,D1=dt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",ee(this.options.HTMLAttributes,t),0]},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[Cn({find:L1,type:this.type})]},addPasteRules(){return[Qt({find:I1,type:this.type})]}}),R1=/^```([a-z]+)?[\s\n]$/,P1=/^~~~([a-z]+)?[\s\n]$/,B1=Ce.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,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,s=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(i=>i.startsWith(n)).map(i=>i.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",ee(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},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})=>{if(!this.options.enableTabIndentation)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(r.parent.type!==this.type)return!1;const s=" ".repeat(this.options.tabSize);return o?t.commands.insertContent(s):t.commands.command(({tr:i})=>{const{from:l,to:a}=n,u=e.doc.textBetween(l,a,`
|
|
85
|
+
`,textSerializers:r={}}=e||{};return $b(this.state.doc,{blockSeparator:t,textSerializers:{...df(this.schema),...r}})}get isEmpty(){return Cs(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new _1(t,this)}get $doc(){return this.$pos(0)}};function ur(n){return new vs({find:n.find,handler:({state:e,range:t,match:r})=>{const o=ke(n.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:s}=e,l=r[r.length-1],a=r[0];if(l){const c=a.search(/\S/),d=t.from+a.indexOf(l),u=d+l.length;if(zi(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>d).length)return null;u<t.to&&s.delete(u,t.to),d>t.from&&s.delete(t.from+c,d);const p=t.from+c+l.length;s.addMark(t.from+c,p,n.type.create(o||{})),s.removeStoredMark(n.type)}},undoable:n.undoable})}function Mf(n){return new vs({find:n.find,handler:({state:e,range:t,match:r})=>{const o=ke(n.getAttributes,void 0,r)||{},{tr:s}=e,l=t.from;let a=t.to;const c=n.type.create(o);if(r[1]){const d=r[0].lastIndexOf(r[1]);let u=l+d;u>a?u=a:a=u+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,l+r[0].length-1),s.replaceWith(u,a,c)}else if(r[0]){const d=n.type.isInline?l:l-1;s.insert(d,n.type.create(o)).delete(s.mapping.map(l),s.mapping.map(a))}s.scrollIntoView()},undoable:n.undoable})}function qi(n){return new vs({find:n.find,handler:({state:e,range:t,match:r})=>{const o=e.doc.resolve(t.from),s=ke(n.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)},undoable:n.undoable})}function Or(n){return new vs({find:n.find,handler:({state:e,range:t,match:r,chain:o})=>{const s=ke(n.getAttributes,void 0,r)||{},l=e.tr.delete(t.from,t.to),c=l.doc.resolve(t.from).blockRange(),d=c&&ql(c,n.type,s);if(!d)return null;if(l.wrap(c,d),n.keepMarks&&n.editor){const{selection:f,storedMarks:p}=e,{splittableMarks:h}=n.editor.extensionManager,m=p||f.$to.parentOffset&&f.$from.marks();if(m){const g=m.filter(y=>h.includes(y.type.name));l.ensureMarks(g)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(f,s).run()}const u=l.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Tn(l.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&l.join(t.from-1)},undoable:n.undoable})}function T1(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof ne){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let o=r.depth;for(;o>=0;){const s=r.index(o);if(r.node(o).contentMatchAt(s).matchType(e))return!0;o-=1}return!1}var A1={};Li(A1,{createAtomBlockMarkdownSpec:()=>B1,createBlockMarkdownSpec:()=>V1,createInlineMarkdownSpec:()=>I1,parseAttributes:()=>Gi,parseIndentedBlocks:()=>D1,renderNestedMarkdownContent:()=>R1,serializeAttributes:()=>Ji});function Gi(n){if(!n?.trim())return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,d=>(t.push(d),`__QUOTED_${t.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const d=o.map(u=>u.trim().slice(1));e.class=d.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const l=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(l)).forEach(([,d,u])=>{var f;const p=parseInt(((f=u.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),h=t[p];h&&(e[d]=h.slice(1,-1))});const c=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 c&&c.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Ji(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function B1(n){const{nodeName:e,name:t,parseAttributes:r=Gi,serializeAttributes:o=Ji,defaultAttributes:s={},requiredAttributes:l=[],allowedAttributes:a}=n,c=t||e,d=u=>{if(!a)return u;const f={};return a.forEach(p=>{p in u&&(f[p]=u[p])}),f};return{parseMarkdown:(u,f)=>{const p={...s,...u.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(u){var f;const p=new RegExp(`^:::${c}(?:\\s|$)`,"m"),h=(f=u.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(u,f,p){const h=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(h);if(!m)return;const g=m[1]||"",y=r(g);if(!l.find(k=>!(k in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:u=>{const f=d(u.attrs||{}),p=o(f),h=p?` {${p}}`:"";return`:::${c}${h} :::`}}}function V1(n){const{nodeName:e,name:t,getContent:r,parseAttributes:o=Gi,serializeAttributes:s=Ji,defaultAttributes:l={},content:a="block",allowedAttributes:c}=n,d=t||e,u=f=>{if(!c)return f;const p={};return c.forEach(h=>{h in f&&(p[h]=f[h])}),p};return{parseMarkdown:(f,p)=>{let h;if(r){const g=r(f);h=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...l,...f.attributes};return p.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(f){var p;const h=new RegExp(`^:::${d}`,"m"),m=(p=f.match(h))==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,p,h){var m;const g=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[b,k=""]=y,w=o(k);let x=1;const E=b.length;let M="";const C=/^:::([\w-]*)(\s.*)?/gm,A=f.slice(E);for(C.lastIndex=0;;){const z=C.exec(A);if(z===null)break;const G=z.index,V=z[1];if(!((m=z[2])!=null&&m.endsWith(":::"))){if(V)x+=1;else if(x-=1,x===0){const O=A.slice(0,G);M=O.trim();const Y=f.slice(0,E+G+z[0].length);let Q=[];if(M)if(a==="block")for(Q=h.blockTokens(O),Q.forEach(P=>{P.text&&(!P.tokens||P.tokens.length===0)&&(P.tokens=h.inlineTokens(P.text))});Q.length>0;){const P=Q[Q.length-1];if(P.type==="paragraph"&&(!P.text||P.text.trim()===""))Q.pop();else break}else Q=h.inlineTokens(M);return{type:e,raw:Y,attributes:w,content:M,tokens:Q}}}}}},renderMarkdown:(f,p)=>{const h=u(f.attrs||{}),m=s(h),g=m?` {${m}}`:"",y=p.renderChildren(f.content||[],`
|
|
86
|
+
|
|
87
|
+
`);return`:::${d}${g}
|
|
88
|
+
|
|
89
|
+
${y}
|
|
90
|
+
|
|
91
|
+
:::`}}}function L1(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,o,s,l]=r;e[o]=s||l,r=t.exec(n)}return e}function O1(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function I1(n){const{nodeName:e,name:t,getContent:r,parseAttributes:o=L1,serializeAttributes:s=O1,defaultAttributes:l={},selfClosing:a=!1,allowedAttributes:c}=n,d=t||e,u=p=>{if(!c)return p;const h={};return c.forEach(m=>{m in p&&(h[m]=p[m])}),h},f=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,h)=>{const m={...l,...p.attributes};if(a)return h.createNode(e,m);const g=r?r(p):p.content||"";return g?h.createNode(e,m,[h.createTextNode(g)]):h.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(p){const h=a?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=p.match(h),g=m?.index;return g!==void 0?g:-1},tokenize(p,h,m){const g=a?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=p.match(g);if(!y)return;let b="",k="";if(a){const[,x]=y;k=x}else{const[,x,E]=y;k=x,b=E||""}const w=o(k.trim());return{type:e,raw:y[0],content:b.trim(),attributes:w}}},renderMarkdown:p=>{let h="";r?h=r(p):p.content&&p.content.length>0&&(h=p.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const m=u(p.attrs||{}),g=s(m),y=g?` ${g}`:"";return a?`[${d}${y}]`:`[${d}${y}]${h}[/${d}]`}}}function D1(n,e,t){var r,o,s,l;const a=n.split(`
|
|
92
|
+
`),c=[];let d="",u=0;const f=e.baseIndentSize||2;for(;u<a.length;){const p=a[u],h=p.match(e.itemPattern);if(!h){if(c.length>0)break;if(p.trim()===""){u+=1;continue}else return}const m=e.extractItemData(h),{indentLevel:g,mainContent:y}=m;d=`${d}${p}
|
|
93
|
+
`;const b=[y];for(u+=1;u<a.length;){const E=a[u];if(E.trim()===""){const C=a.slice(u+1).findIndex(G=>G.trim()!=="");if(C===-1)break;if((((o=(r=a[u+1+C].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>g){b.push(E),d=`${d}${E}
|
|
94
|
+
`,u+=1;continue}else break}if((((l=(s=E.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:l.length)||0)>g)b.push(E),d=`${d}${E}
|
|
95
|
+
`,u+=1;else break}let k;const w=b.slice(1);if(w.length>0){const E=w.map(M=>M.slice(g+f)).join(`
|
|
96
|
+
`);E.trim()&&(e.customNestedParser?k=e.customNestedParser(E):k=t.blockTokens(E))}const x=e.createToken(m,k);c.push(x)}if(c.length!==0)return{items:c,raw:d.trim()}}function R1(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const o=typeof t=="function"?t(r):t,[s,...l]=n.content,a=e.renderChildren([s]),c=[`${o}${a}`];return l&&l.length>0&&l.forEach(d=>{const u=e.renderChildren([d]);if(u){const f=u.split(`
|
|
97
|
+
`).map(p=>p?e.indent(p):"").join(`
|
|
98
|
+
`);c.push(f)}}),c.join(`
|
|
99
|
+
`)}function F1(n,e,t={}){const{state:r}=e,{doc:o,tr:s}=r,l=n;o.descendants((a,c)=>{const d=s.mapping.map(c),u=s.mapping.map(c)+a.nodeSize;let f=null;if(a.marks.forEach(h=>{if(h!==l)return!1;f=h}),!f)return;let p=!1;if(Object.keys(t).forEach(h=>{t[h]!==f.attrs[h]&&(p=!0)}),p){const h=n.type.create({...n.attrs,...t});s.removeMark(d,u,n.type),s.addMark(d,u,h)}}),s.docChanged&&e.view.dispatch(s)}var Ue=class Pm extends Ki{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Pm(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function $n(n){return new k1({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:o})=>{const s=ke(n.getAttributes,void 0,r,o);if(s===!1||s===null)return null;const{tr:l}=e,a=r[r.length-1],c=r[0];let d=t.to;if(a){const u=c.search(/\S/),f=t.from+c.indexOf(a),p=f+a.length;if(zi(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===n.type&&y!==m.mark.type)).filter(m=>m.to>f).length)return null;p<t.to&&l.delete(p,t.to),f>t.from&&l.delete(t.from+u,f),d=t.from+u+a.length,l.addMark(t.from+u,d,n.type.create(s||{})),l.removeStoredMark(n.type)}}})}function Tf(n){return i.customRef((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var P1=class extends M1{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=Tf(this.view.state),this.reactiveExtensionStorage=Tf(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),i.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(n,e){const t=super.registerPlugin(n,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(n){const e=super.unregisterPlugin(n);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},Af=i.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=i.ref(),t=i.getCurrentInstance();return i.watchEffect(()=>{const r=n.editor;r&&r.options.element&&e.value&&i.nextTick(()=>{var o;if(!e.value||!((o=r.view.dom)!=null&&o.firstChild))return;const s=i.unref(e.value);e.value.append(r.view.dom),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:s}),r.createNodeViews()})}),i.onBeforeUnmount(()=>{const r=n.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return i.h("div",{ref:n=>{this.rootEl=n}})}});i.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return i.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),i.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return i.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}});var $1=(n={})=>{const e=i.shallowRef();return i.onMounted(()=>{e.value=new P1(n)}),i.onBeforeUnmount(()=>{var t,r,o;const s=(t=e.value)==null?void 0:t.view.dom,l=s?.cloneNode(!0);(r=s?.parentNode)==null||r.replaceChild(l,s),(o=e.value)==null||o.destroy()}),e};i.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return i.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var z1=20,Bf=(n,e=0)=>{const t=[];return!n.children.length||e>z1||Array.from(n.children).forEach(r=>{r.tagName==="SPAN"?t.push(r):r.children.length&&t.push(...Bf(r,e+1))}),t},H1=n=>{if(!n.children.length)return;const e=Bf(n);e&&e.forEach(t=>{var r,o;const s=t.getAttribute("style"),l=(o=(r=t.parentElement)==null?void 0:r.closest("span"))==null?void 0:o.getAttribute("style");t.setAttribute("style",`${l};${s}`)})},Yi=Ht.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&H1(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleTextStyle:n=>({commands:e})=>e.toggleMark(this.name,n),removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(s=>!!s))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),j1=Ee.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const s=r[o].split(":");if(s.length>=2){const l=s[0].trim().toLowerCase(),a=s.slice(1).join(":").trim();if(l==="background-color")return a.replace(/['"]+/g,"")}}}return(e=n.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:e})=>e().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),U1=Ee.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const s=r[o].split(":");if(s.length>=2){const l=s[0].trim().toLowerCase(),a=s.slice(1).join(":").trim();if(l==="color")return a.replace(/['"]+/g,"")}}}return(e=n.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),W1=Ee.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>n.style.fontFamily,renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),K1=Ee.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>n.style.fontSize,renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),q1=Ee.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:n=>n.style.lineHeight,renderHTML:n=>n.lineHeight?{style:`line-height: ${n.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:n=>({chain:e})=>e().setMark("textStyle",{lineHeight:n}).run(),unsetLineHeight:()=>({chain:n})=>n().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}}),G1=Ee.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(j1.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(U1.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(W1.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(K1.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(q1.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(Yi.configure(this.options.textStyle)),n}}),Xi,Zi;if(typeof WeakMap<"u"){let n=new WeakMap;Xi=e=>n.get(e),Zi=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;Xi=r=>{for(let o=0;o<n.length;o+=2)if(n[o]==r)return n[o+1]},Zi=(r,o)=>(t==10&&(t=0),n[t++]=r,n[t++]=o)}var De=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,o=e/this.width|0;let s=r+1,l=o+1;for(let a=1;s<this.width&&this.map[e+a]==t;a++)s++;for(let a=1;l<this.height&&this.map[e+this.width*a]==t;a++)l++;return{left:r,top:o,right:s,bottom:l}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:o,top:s,bottom:l}=this.findCell(n);return e=="horiz"?(t<0?r==0:o==this.width)?null:this.map[s*this.width+(t<0?r-1:o)]:(t<0?s==0:l==this.height)?null:this.map[r+this.width*(t<0?s-1:l)]}rectBetween(n,e){const{left:t,right:r,top:o,bottom:s}=this.findCell(n),{left:l,right:a,top:c,bottom:d}=this.findCell(e);return{left:Math.min(t,l),top:Math.min(o,c),right:Math.max(r,a),bottom:Math.max(s,d)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let o=n.left;o<n.right;o++){const s=r*this.width+o,l=this.map[s];t[l]||(t[l]=!0,!(o==n.left&&o&&this.map[s-1]==l||r==n.top&&r&&this.map[s-this.width]==l)&&e.push(l))}return e}positionAt(n,e,t){for(let r=0,o=0;;r++){const s=o+t.child(r).nodeSize;if(r==n){let l=e+n*this.width;const a=(n+1)*this.width;for(;l<a&&this.map[l]<o;)l++;return l==a?s-1:this.map[l]}o=s}}static get(n){return Xi(n)||Zi(n,J1(n))}};function J1(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=Y1(n),t=n.childCount,r=[];let o=0,s=null;const l=[];for(let d=0,u=e*t;d<u;d++)r[d]=0;for(let d=0,u=0;d<t;d++){const f=n.child(d);u++;for(let m=0;;m++){for(;o<r.length&&r[o]!=0;)o++;if(m==f.childCount)break;const g=f.child(m),{colspan:y,rowspan:b,colwidth:k}=g.attrs;for(let w=0;w<b;w++){if(w+d>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:b-w});break}const x=o+w*e;for(let E=0;E<y;E++){r[x+E]==0?r[x+E]=u:(s||(s=[])).push({type:"collision",row:d,pos:u,n:y-E});const M=k&&k[E];if(M){const C=(x+E)%e*2,A=l[C];A==null||A!=M&&l[C+1]==1?(l[C]=M,l[C+1]=1):A==M&&l[C+1]++}}}o+=y,u+=g.nodeSize}const p=(d+1)*e;let h=0;for(;o<p;)r[o++]==0&&h++;h&&(s||(s=[])).push({type:"missing",row:d,n:h}),u++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new De(e,t,r,s);let c=!1;for(let d=0;!c&&d<l.length;d+=2)l[d]!=null&&l[d+1]<t&&(c=!0);return c&&X1(a,l,n),a}function Y1(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const o=n.child(r);let s=0;if(t)for(let l=0;l<r;l++){const a=n.child(l);for(let c=0;c<a.childCount;c++){const d=a.child(c);l+d.attrs.rowspan>r&&(s+=d.attrs.colspan)}}for(let l=0;l<o.childCount;l++){const a=o.child(l);s+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function X1(n,e,t){n.problems||(n.problems=[]);const r={};for(let o=0;o<n.map.length;o++){const s=n.map[o];if(r[s])continue;r[s]=!0;const l=t.nodeAt(s);if(!l)throw new RangeError(`No cell with offset ${s} found`);let a=null;const c=l.attrs;for(let d=0;d<c.colspan;d++){const u=(o+d)%n.width,f=e[u*2];f!=null&&(!c.colwidth||c.colwidth[d]!=f)&&((a||(a=Z1(c)))[d]=f)}a&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function Z1(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function it(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var zn=new $e("selectingCells");function Ir(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function Q1(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function jt(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function Ts(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Ir(e.$head)||ek(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function ek(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Qi(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function tk(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function ea(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Vf(n,e,t){const r=n.node(-1),o=De.get(r),s=n.start(-1),l=o.nextCell(n.pos-s,e,t);return l==null?null:n.node(0).resolve(s+l)}function fr(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function Lf(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<t;o++)r.colwidth.splice(e,0,0)}return r}function nk(n,e,t){const r=it(e.type.schema).header_cell;for(let o=0;o<n.height;o++)if(e.nodeAt(n.map[t+o*n.width]).type!=r)return!1;return!0}var Te=class _n extends le{constructor(e,t=e){const r=e.node(-1),o=De.get(r),s=e.start(-1),l=o.rectBetween(e.pos-s,t.pos-s),a=e.node(0),c=o.cellsInRect(l).filter(u=>u!=t.pos-s);c.unshift(t.pos-s);const d=c.map(u=>{const f=r.nodeAt(u);if(!f)throw RangeError(`No cell with offset ${u} found`);const p=s+u+1;return new ud(a.resolve(p),a.resolve(p+f.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(Qi(r)&&Qi(o)&&ea(r,o)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?_n.rowSelection(r,o):s&&this.isColSelection()?_n.colSelection(r,o):new _n(r,o)}return oe.between(r,o)}content(){const e=this.$anchorCell.node(-1),t=De.get(e),r=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},l=[];for(let c=o.top;c<o.bottom;c++){const d=[];for(let u=c*t.width+o.left,f=o.left;f<o.right;f++,u++){const p=t.map[u];if(s[p])continue;s[p]=!0;const h=t.findCell(p);let m=e.nodeAt(p);if(!m)throw RangeError(`No cell with offset ${p} found`);const g=o.left-h.left,y=h.right-o.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=fr(b,0,g)),y>0&&(b=fr(b,b.colspan-y,y)),h.left<o.left){if(m=m.type.createAndFill(b),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(h.top<o.top||h.bottom>o.bottom){const b={...m.attrs,rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)};h.top<o.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}d.push(m)}l.push(e.child(c).copy(I.from(d)))}const a=this.isColSelection()&&this.isRowSelection()?e:l;return new q(I.from(a),1,1)}replace(e,t=q.empty){const r=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){const{$from:a,$to:c}=o[l],d=e.mapping.slice(r);e.replace(d.map(a.pos),d.map(c.pos),l?q.empty:t)}const s=le.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new q(I.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=De.get(t),o=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let l=0;l<s.length;l++)e(t.nodeAt(s[l]),o+s[l])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),o=De.get(r),s=e.start(-1),l=o.findCell(e.pos-s),a=o.findCell(t.pos-s),c=e.node(0);return l.top<=a.top?(l.top>0&&(e=c.resolve(s+o.map[l.left])),a.bottom<o.height&&(t=c.resolve(s+o.map[o.width*(o.height-1)+a.right-1]))):(a.top>0&&(t=c.resolve(s+o.map[a.left])),l.bottom<o.height&&(e=c.resolve(s+o.map[o.width*(o.height-1)+l.right-1]))),new _n(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=De.get(e),r=this.$anchorCell.start(-1),o=t.colCount(this.$anchorCell.pos-r),s=t.colCount(this.$headCell.pos-r);if(Math.min(o,s)>0)return!1;const l=o+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,a)==t.width}eq(e){return e instanceof _n&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),o=De.get(r),s=e.start(-1),l=o.findCell(e.pos-s),a=o.findCell(t.pos-s),c=e.node(0);return l.left<=a.left?(l.left>0&&(e=c.resolve(s+o.map[l.top*o.width])),a.right<o.width&&(t=c.resolve(s+o.map[o.width*(a.top+1)-1]))):(a.left>0&&(t=c.resolve(s+o.map[a.top*o.width])),l.right<o.width&&(e=c.resolve(s+o.map[o.width*(l.top+1)-1]))),new _n(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new _n(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new _n(e.resolve(t),e.resolve(r))}getBookmark(){return new rk(this.$anchorCell.pos,this.$headCell.pos)}};Te.prototype.visible=!1,le.jsonID("cell",Te);var rk=class $m{constructor(e,t){this.anchor=e,this.head=t}map(e){return new $m(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&ea(t,r)?new Te(t,r):le.near(r,1)}};function ok(n){if(!(n.selection instanceof Te))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(Ye.node(r,r+t.nodeSize,{class:"selectedCell"}))}),Me.create(n.doc,e)}function sk({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,o=n.depth;for(;o>=0&&!(n.after(o+1)<n.end(o));o--,t++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return t==r&&/row|table/.test(n.node(o).type.spec.tableRole)}function lk({$from:n,$to:e}){let t,r;for(let o=n.depth;o>0;o--){const s=n.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){t=s;break}}for(let o=e.depth;o>0;o--){const s=e.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return t!==r&&e.parentOffset===0}function ik(n,e,t){const r=(e||n).selection,o=(e||n).doc;let s,l;if(r instanceof ne&&(l=r.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=Te.create(o,r.from);else if(l=="row"){const a=o.resolve(r.from+1);s=Te.rowSelection(a,a)}else if(!t){const a=De.get(r.node),c=r.from+1,d=c+a.map[a.width*a.height-1];s=Te.create(o,c+1,d)}}else r instanceof oe&&sk(r)?s=oe.create(o,r.from):r instanceof oe&&lk(r)&&(s=oe.create(o,r.$from.start(),r.$from.end()));return s&&(e||(e=n.tr)).setSelection(s),e}var ak=new $e("fix-tables");function Of(n,e,t,r){const o=n.childCount,s=e.childCount;e:for(let l=0,a=0;l<s;l++){const c=e.child(l);for(let d=a,u=Math.min(o,l+3);d<u;d++)if(n.child(d)==c){a=d+1,t+=c.nodeSize;continue e}r(c,t),a<o&&n.child(a).sameMarkup(c)?Of(n.child(a),c,t+1,r):c.nodesBetween(0,c.content.size,r,t+1),t+=c.nodeSize}}function If(n,e){let t;const r=(o,s)=>{o.type.spec.tableRole=="table"&&(t=ck(n,o,s,t))};return e?e.doc!=n.doc&&Of(e.doc,n.doc,0,r):n.doc.descendants(r),t}function ck(n,e,t,r){const o=De.get(e);if(!o.problems)return r;r||(r=n.tr);const s=[];for(let c=0;c<o.height;c++)s.push(0);for(let c=0;c<o.problems.length;c++){const d=o.problems[c];if(d.type=="collision"){const u=e.nodeAt(d.pos);if(!u)continue;const f=u.attrs;for(let p=0;p<f.rowspan;p++)s[d.row+p]+=d.n;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,fr(f,f.colspan-d.n,d.n))}else if(d.type=="missing")s[d.row]+=d.n;else if(d.type=="overlong_rowspan"){const u=e.nodeAt(d.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const u=e.nodeAt(d.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,{...u.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const u=r.mapping.map(t);r.delete(u,u+e.nodeSize)}}let l,a;for(let c=0;c<s.length;c++)s[c]&&(l==null&&(l=c),a=c);for(let c=0,d=t+1;c<o.height;c++){const u=e.child(c),f=d+u.nodeSize,p=s[c];if(p>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<p;y++){const b=it(n.schema)[h].createAndFill();b&&m.push(b)}const g=(c==0||l==c-1)&&a==c?d+1:f-1;r.insert(r.mapping.map(g),m)}d=f}return r.setMeta(ak,{fixTables:!0})}function Xt(n){const e=n.selection,t=Ts(n),r=t.node(-1),o=t.start(-1),s=De.get(r);return{...e instanceof Te?s.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):s.findCell(t.pos-o),tableStart:o,map:s,table:r}}function Df(n,{map:e,tableStart:t,table:r},o){let s=o>0?-1:0;nk(e,r,o+s)&&(s=o==0||o==e.width?null:0);for(let l=0;l<e.height;l++){const a=l*e.width+o;if(o>0&&o<e.width&&e.map[a-1]==e.map[a]){const c=e.map[a],d=r.nodeAt(c);n.setNodeMarkup(n.mapping.map(t+c),null,Lf(d.attrs,o-e.colCount(c))),l+=d.attrs.rowspan-1}else{const c=s==null?it(r.type.schema).cell:r.nodeAt(e.map[a+s]).type,d=e.positionAt(l,o,r);n.insert(n.mapping.map(t+d),c.createAndFill())}}return n}function dk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(Df(n.tr,t,t.left))}return!0}function uk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(Df(n.tr,t,t.right))}return!0}function fk(n,{map:e,table:t,tableStart:r},o){const s=n.mapping.maps.length;for(let l=0;l<e.height;){const a=l*e.width+o,c=e.map[a],d=t.nodeAt(c),u=d.attrs;if(o>0&&e.map[a-1]==c||o<e.width-1&&e.map[a+1]==c)n.setNodeMarkup(n.mapping.slice(s).map(r+c),null,fr(u,o-e.colCount(c)));else{const f=n.mapping.slice(s).map(r+c);n.delete(f,f+d.nodeSize)}l+=u.rowspan}}function pk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let o=t.right-1;fk(r,t,o),o!=t.left;o--){const s=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!s)throw RangeError("No table found");t.table=s,t.map=De.get(s)}e(r)}return!0}function hk(n,e,t){var r;const o=it(e.type.schema).header_cell;for(let s=0;s<n.width;s++)if(((r=e.nodeAt(n.map[s+t*n.width]))==null?void 0:r.type)!=o)return!1;return!0}function Rf(n,{map:e,tableStart:t,table:r},o){var s;let l=t;for(let d=0;d<o;d++)l+=r.child(d).nodeSize;const a=[];let c=o>0?-1:0;hk(e,r,o+c)&&(c=o==0||o==e.height?null:0);for(let d=0,u=e.width*o;d<e.width;d++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){const f=e.map[u],p=r.nodeAt(f).attrs;n.setNodeMarkup(t+f,null,{...p,rowspan:p.rowspan+1}),d+=p.colspan-1}else{const f=c==null?it(r.type.schema).cell:(s=r.nodeAt(e.map[u+c*e.width]))==null?void 0:s.type,p=f?.createAndFill();p&&a.push(p)}return n.insert(l,it(r.type.schema).row.create(null,a)),n}function mk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(Rf(n.tr,t,t.top))}return!0}function gk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(Rf(n.tr,t,t.bottom))}return!0}function yk(n,{map:e,table:t,tableStart:r},o){let s=0;for(let d=0;d<o;d++)s+=t.child(d).nodeSize;const l=s+t.child(o).nodeSize,a=n.mapping.maps.length;n.delete(s+r,l+r);const c=new Set;for(let d=0,u=o*e.width;d<e.width;d++,u++){const f=e.map[u];if(!c.has(f)){if(c.add(f),o>0&&f==e.map[u-e.width]){const p=t.nodeAt(f).attrs;n.setNodeMarkup(n.mapping.slice(a).map(f+r),null,{...p,rowspan:p.rowspan-1}),d+=p.colspan-1}else if(o<e.height&&f==e.map[u+e.width]){const p=t.nodeAt(f),h=p.attrs,m=p.type.create({...h,rowspan:p.attrs.rowspan-1},p.content),g=e.positionAt(o+1,d,t);n.insert(n.mapping.slice(a).map(r+g),m),d+=h.colspan-1}}}}function bk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let o=t.bottom-1;yk(r,t,o),o!=t.top;o--){const s=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!s)throw RangeError("No table found");t.table=s,t.map=De.get(t.table)}e(r)}return!0}function Ff(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function kk({width:n,height:e,map:t},r){let o=r.top*n+r.left,s=o,l=(r.bottom-1)*n+r.left,a=o+(r.right-r.left-1);for(let c=r.top;c<r.bottom;c++){if(r.left>0&&t[s]==t[s-1]||r.right<n&&t[a]==t[a+1])return!0;s+=n,a+=n}for(let c=r.left;c<r.right;c++){if(r.top>0&&t[o]==t[o-n]||r.bottom<e&&t[l]==t[l+n])return!0;o++,l++}return!1}function Pf(n,e){const t=n.selection;if(!(t instanceof Te)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=Xt(n),{map:o}=r;if(kk(o,r))return!1;if(e){const s=n.tr,l={};let a=I.empty,c,d;for(let u=r.top;u<r.bottom;u++)for(let f=r.left;f<r.right;f++){const p=o.map[u*o.width+f],h=r.table.nodeAt(p);if(!(l[p]||!h))if(l[p]=!0,c==null)c=p,d=h;else{Ff(h)||(a=a.append(h.content));const m=s.mapping.map(p+r.tableStart);s.delete(m,m+h.nodeSize)}}if(c==null||d==null)return!0;if(s.setNodeMarkup(c+r.tableStart,null,{...Lf(d.attrs,d.attrs.colspan,r.right-r.left-d.attrs.colspan),rowspan:r.bottom-r.top}),a.size){const u=c+1+d.content.size,f=Ff(d)?c+1:u;s.replaceWith(f+r.tableStart,u+r.tableStart,a)}s.setSelection(new Te(s.doc.resolve(c+r.tableStart))),e(s)}return!0}function $f(n,e){const t=it(n.schema);return xk(({node:r})=>t[r.type.spec.tableRole])(n,e)}function xk(n){return(e,t)=>{var r;const o=e.selection;let s,l;if(o instanceof Te){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;s=o.$anchorCell.nodeAfter,l=o.$anchorCell.pos}else{if(s=Q1(o.$from),!s)return!1;l=(r=Ir(o.$from))==null?void 0:r.pos}if(s==null||l==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(t){let a=s.attrs;const c=[],d=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const u=Xt(e),f=e.tr;for(let h=0;h<u.right-u.left;h++)c.push(d?{...a,colwidth:d&&d[h]?[d[h]]:null}:a);let p;for(let h=u.top;h<u.bottom;h++){let m=u.map.positionAt(h,u.left,u.table);h==u.top&&(m+=s.nodeSize);for(let g=u.left,y=0;g<u.right;g++,y++)g==u.left&&h==u.top||f.insert(p=f.mapping.map(m+u.tableStart,1),n({node:s,row:h,col:g}).createAndFill(c[y]))}f.setNodeMarkup(l,n({node:s,row:u.top,col:u.left}),c[0]),o instanceof Te&&f.setSelection(new Te(f.doc.resolve(o.$anchorCell.pos),p?f.doc.resolve(p):void 0)),t(f)}return!0}}function wk(n,e){return function(t,r){if(!jt(t))return!1;const o=Ts(t);if(o.nodeAfter.attrs[n]===e)return!1;if(r){const s=t.tr;t.selection instanceof Te?t.selection.forEachCell((l,a)=>{l.attrs[n]!==e&&s.setNodeMarkup(a,null,{...l.attrs,[n]:e})}):s.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[n]:e}),r(s)}return!0}}function Ek(n){return function(e,t){if(!jt(e))return!1;if(t){const r=it(e.schema),o=Xt(e),s=e.tr,l=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=l.map(c=>o.table.nodeAt(c));for(let c=0;c<l.length;c++)a[c].type==r.header_cell&&s.setNodeMarkup(o.tableStart+l[c],r.cell,a[c].attrs);if(s.steps.length==0)for(let c=0;c<l.length;c++)s.setNodeMarkup(o.tableStart+l[c],r.header_cell,a[c].attrs);t(s)}return!0}}function zf(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let o=0;o<r.length;o++){const s=e.table.nodeAt(r[o]);if(s&&s.type!==t.header_cell)return!1}return!0}function ho(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Ek(n):function(t,r){if(!jt(t))return!1;if(r){const o=it(t.schema),s=Xt(t),l=t.tr,a=zf("row",s,o),c=zf("column",s,o),u=(n==="column"?a:n==="row"?c:!1)?1:0,f=n=="column"?{left:0,top:u,right:1,bottom:s.map.height}:n=="row"?{left:u,top:0,right:s.map.width,bottom:1}:s,p=n=="column"?c?o.cell:o.header_cell:n=="row"?a?o.cell:o.header_cell:o.cell;s.map.cellsInRect(f).forEach(h=>{const m=h+s.tableStart,g=l.doc.nodeAt(m);g&&l.setNodeMarkup(m,p,g.attrs)}),r(l)}return!0}}ho("row",{useDeprecatedLogic:!0}),ho("column",{useDeprecatedLogic:!0});var Ck=ho("cell",{useDeprecatedLogic:!0});function vk(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,o=n.before();r>=0;r--){const s=n.node(-1).child(r),l=s.lastChild;if(l)return o-1-l.nodeSize;o-=s.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),o=n.after();r<t.childCount;r++){const s=t.child(r);if(s.childCount)return o+1;o+=s.nodeSize}}return null}function Hf(n){return function(e,t){if(!jt(e))return!1;const r=vk(Ts(e),n);if(r==null)return!1;if(t){const o=e.doc.resolve(r);t(e.tr.setSelection(oe.between(o,tk(o))).scrollIntoView())}return!0}}function _k(n,e){const t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function As(n,e){const t=n.selection;if(!(t instanceof Te))return!1;if(e){const r=n.tr,o=it(n.schema).cell.createAndFill().content;t.forEachCell((s,l)=>{s.content.eq(o)||r.replace(r.mapping.map(l+1),r.mapping.map(l+s.nodeSize-1),new q(o,0,0))}),r.docChanged&&e(r)}return!0}function Sk(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const o=e.child(0),s=o.type.spec.tableRole,l=o.type.schema,a=[];if(s=="row")for(let c=0;c<e.childCount;c++){let d=e.child(c).content;const u=c?0:Math.max(0,t-1),f=c<e.childCount-1?0:Math.max(0,r-1);(u||f)&&(d=ta(it(l).row,new q(d,u,f)).content),a.push(d)}else if(s=="cell"||s=="header_cell")a.push(t||r?ta(it(l).row,new q(e,t,r)).content:e);else return null;return Nk(l,a)}function Nk(n,e){const t=[];for(let o=0;o<e.length;o++){const s=e[o];for(let l=s.childCount-1;l>=0;l--){const{rowspan:a,colspan:c}=s.child(l).attrs;for(let d=o;d<o+a;d++)t[d]=(t[d]||0)+c}}let r=0;for(let o=0;o<t.length;o++)r=Math.max(r,t[o]);for(let o=0;o<t.length;o++)if(o>=e.length&&e.push(I.empty),t[o]<r){const s=it(n).cell.createAndFill(),l=[];for(let a=t[o];a<r;a++)l.push(s);e[o]=e[o].append(I.from(l))}return{height:e.length,width:r,rows:e}}function ta(n,e){const t=n.createAndFill();return new Yl(t).replace(0,t.content.size,e).doc}function Mk({width:n,height:e,rows:t},r,o){if(n!=r){const s=[],l=[];for(let a=0;a<t.length;a++){const c=t[a],d=[];for(let u=s[a]||0,f=0;u<r;f++){let p=c.child(f%c.childCount);u+p.attrs.colspan>r&&(p=p.type.createChecked(fr(p.attrs,p.attrs.colspan,u+p.attrs.colspan-r),p.content)),d.push(p),u+=p.attrs.colspan;for(let h=1;h<p.attrs.rowspan;h++)s[a+h]=(s[a+h]||0)+p.attrs.colspan}l.push(I.from(d))}t=l,n=r}if(e!=o){const s=[];for(let l=0,a=0;l<o;l++,a++){const c=[],d=t[a%e];for(let u=0;u<d.childCount;u++){let f=d.child(u);l+f.attrs.rowspan>o&&(f=f.type.create({...f.attrs,rowspan:Math.max(1,o-f.attrs.rowspan)},f.content)),c.push(f)}s.push(I.from(c))}t=s,e=o}return{width:n,height:e,rows:t}}function Tk(n,e,t,r,o,s,l){const a=n.doc.type.schema,c=it(a);let d,u;if(o>e.width)for(let f=0,p=0;f<e.height;f++){const h=t.child(f);p+=h.nodeSize;const m=[];let g;h.lastChild==null||h.lastChild.type==c.cell?g=d||(d=c.cell.createAndFill()):g=u||(u=c.header_cell.createAndFill());for(let y=e.width;y<o;y++)m.push(g);n.insert(n.mapping.slice(l).map(p-1+r),m)}if(s>e.height){const f=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,o);m++){const y=m>=e.width?!1:t.nodeAt(e.map[g+m]).type==c.header_cell;f.push(y?u||(u=c.header_cell.createAndFill()):d||(d=c.cell.createAndFill()))}const p=c.row.create(null,I.from(f)),h=[];for(let m=e.height;m<s;m++)h.push(p);n.insert(n.mapping.slice(l).map(r+t.nodeSize-2),h)}return!!(d||u)}function jf(n,e,t,r,o,s,l,a){if(l==0||l==e.height)return!1;let c=!1;for(let d=o;d<s;d++){const u=l*e.width+d,f=e.map[u];if(e.map[u-e.width]==f){c=!0;const p=t.nodeAt(f),{top:h,left:m}=e.findCell(f);n.setNodeMarkup(n.mapping.slice(a).map(f+r),null,{...p.attrs,rowspan:l-h}),n.insert(n.mapping.slice(a).map(e.positionAt(l,m,t)),p.type.createAndFill({...p.attrs,rowspan:h+p.attrs.rowspan-l})),d+=p.attrs.colspan-1}}return c}function Uf(n,e,t,r,o,s,l,a){if(l==0||l==e.width)return!1;let c=!1;for(let d=o;d<s;d++){const u=d*e.width+l,f=e.map[u];if(e.map[u-1]==f){c=!0;const p=t.nodeAt(f),h=e.colCount(f),m=n.mapping.slice(a).map(f+r);n.setNodeMarkup(m,null,fr(p.attrs,l-h,p.attrs.colspan-(l-h))),n.insert(m+p.nodeSize,p.type.createAndFill(fr(p.attrs,0,l-h))),d+=p.attrs.rowspan-1}}return c}function Wf(n,e,t,r,o){let s=t?n.doc.nodeAt(t-1):n.doc;if(!s)throw new Error("No table found");let l=De.get(s);const{top:a,left:c}=r,d=c+o.width,u=a+o.height,f=n.tr;let p=0;function h(){if(s=t?f.doc.nodeAt(t-1):f.doc,!s)throw new Error("No table found");l=De.get(s),p=f.mapping.maps.length}Tk(f,l,s,t,d,u,p)&&h(),jf(f,l,s,t,c,d,a,p)&&h(),jf(f,l,s,t,c,d,u,p)&&h(),Uf(f,l,s,t,a,u,c,p)&&h(),Uf(f,l,s,t,a,u,d,p)&&h();for(let m=a;m<u;m++){const g=l.positionAt(m,c,s),y=l.positionAt(m,d,s);f.replace(f.mapping.slice(p).map(g+t),f.mapping.slice(p).map(y+t),new q(o.rows[m-a],0,0))}h(),f.setSelection(new Te(f.doc.resolve(t+l.positionAt(a,c,s)),f.doc.resolve(t+l.positionAt(u-1,d-1,s)))),e(f)}var Ak=Vi({ArrowLeft:Vs("horiz",-1),ArrowRight:Vs("horiz",1),ArrowUp:Vs("vert",-1),ArrowDown:Vs("vert",1),"Shift-ArrowLeft":Ls("horiz",-1),"Shift-ArrowRight":Ls("horiz",1),"Shift-ArrowUp":Ls("vert",-1),"Shift-ArrowDown":Ls("vert",1),Backspace:As,"Mod-Backspace":As,Delete:As,"Mod-Delete":As});function Bs(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Vs(n,e){return(t,r,o)=>{if(!o)return!1;const s=t.selection;if(s instanceof Te)return Bs(t,r,le.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const l=Kf(o,n,e);if(l==null)return!1;if(n=="horiz")return Bs(t,r,le.near(t.doc.resolve(s.head+e),e));{const a=t.doc.resolve(l),c=Vf(a,n,e);let d;return c?d=le.near(c,1):e<0?d=le.near(t.doc.resolve(a.before(-1)),-1):d=le.near(t.doc.resolve(a.after(-1)),1),Bs(t,r,d)}}}function Ls(n,e){return(t,r,o)=>{if(!o)return!1;const s=t.selection;let l;if(s instanceof Te)l=s;else{const c=Kf(o,n,e);if(c==null)return!1;l=new Te(t.doc.resolve(c))}const a=Vf(l.$headCell,n,e);return a?Bs(t,r,new Te(l.$anchorCell,a)):!1}}function Bk(n,e){const t=n.state.doc,r=Ir(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new Te(r))),!0):!1}function Vk(n,e,t){if(!jt(n.state))return!1;let r=Sk(t);const o=n.state.selection;if(o instanceof Te){r||(r={width:1,height:1,rows:[I.from(ta(it(n.state.schema).cell,t))]});const s=o.$anchorCell.node(-1),l=o.$anchorCell.start(-1),a=De.get(s).rectBetween(o.$anchorCell.pos-l,o.$headCell.pos-l);return r=Mk(r,a.right-a.left,a.bottom-a.top),Wf(n.state,n.dispatch,l,a,r),!0}else if(r){const s=Ts(n.state),l=s.start(-1);return Wf(n.state,n.dispatch,l,De.get(s.node(-1)).findCell(s.pos-l),r),!0}else return!1}function Lk(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=qf(n,e.target);let o;if(e.shiftKey&&n.state.selection instanceof Te)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Ir(n.state.selection.$anchor))!=null&&((t=na(n,e))==null?void 0:t.pos)!=o.pos)s(o,e),e.preventDefault();else if(!r)return;function s(c,d){let u=na(n,d);const f=zn.getState(n.state)==null;if(!u||!ea(c,u))if(f)u=c;else return;const p=new Te(c,u);if(f||!n.state.selection.eq(p)){const h=n.state.tr.setSelection(p);f&&h.setMeta(zn,c.pos),n.dispatch(h)}}function l(){n.root.removeEventListener("mouseup",l),n.root.removeEventListener("dragstart",l),n.root.removeEventListener("mousemove",a),zn.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(zn,-1))}function a(c){const d=c,u=zn.getState(n.state);let f;if(u!=null)f=n.state.doc.resolve(u);else if(qf(n,d.target)!=r&&(f=na(n,e),!f))return l();f&&s(f,d)}n.root.addEventListener("mouseup",l),n.root.addEventListener("dragstart",l),n.root.addEventListener("mousemove",a)}function Kf(n,e,t){if(!(n.state.selection instanceof oe))return null;const{$head:r}=n.state.selection;for(let o=r.depth-1;o>=0;o--){const s=r.node(o);if((t<0?r.index(o):r.indexAfter(o))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const a=r.before(o),c=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(c)?a:null}}return null}function qf(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function na(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?Ir(n.state.doc.resolve(t.pos)):null}var Ok=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ra(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,ra(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ra(n,e,t,r,o,s){var l;let a=0,c=!0,d=e.firstChild;const u=n.firstChild;if(u){for(let f=0,p=0;f<u.childCount;f++){const{colspan:h,colwidth:m}=u.child(f).attrs;for(let g=0;g<h;g++,p++){const y=o==p?s:m&&m[g],b=y?y+"px":"";if(a+=y||r,y||(c=!1),d)d.style.width!=b&&(d.style.width=b),d=d.nextSibling;else{const k=document.createElement("col");k.style.width=b,e.appendChild(k)}}}for(;d;){const f=d.nextSibling;(l=d.parentNode)==null||l.removeChild(d),d=f}c?(t.style.width=a+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=a+"px")}}var Ct=new $e("tableColumnResizing");function Ik({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=Ok,lastColumnResizable:o=!0}={}){const s=new Oe({key:Ct,state:{init(l,a){var c,d;const u=(d=(c=s.spec)==null?void 0:c.props)==null?void 0:d.nodeViews,f=it(a.schema).table.name;return r&&u&&(u[f]=(p,h)=>new r(p,t,h)),new Dk(-1,!1)},apply(l,a){return a.apply(l)}},props:{attributes:l=>{const a=Ct.getState(l);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,a)=>{Rk(l,a,n,o)},mouseleave:l=>{Fk(l)},mousedown:(l,a)=>{Pk(l,a,e,t)}},decorations:l=>{const a=Ct.getState(l);if(a&&a.activeHandle>-1)return Uk(l,a.activeHandle)},nodeViews:{}}});return s}var Dk=class Rl{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(Ct);if(r&&r.setHandle!=null)return new Rl(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Rl(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return Qi(e.doc.resolve(o))||(o=-1),new Rl(o,t.dragging)}return t}};function Rk(n,e,t,r){if(!n.editable)return;const o=Ct.getState(n.state);if(o&&!o.dragging){const s=zk(e.target);let l=-1;if(s){const{left:a,right:c}=s.getBoundingClientRect();e.clientX-a<=t?l=Gf(n,e,"left",t):c-e.clientX<=t&&(l=Gf(n,e,"right",t))}if(l!=o.activeHandle){if(!r&&l!==-1){const a=n.state.doc.resolve(l),c=a.node(-1),d=De.get(c),u=a.start(-1);if(d.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==d.width-1)return}Yf(n,l)}}}function Fk(n){if(!n.editable)return;const e=Ct.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Yf(n,-1)}function Pk(n,e,t,r){var o;if(!n.editable)return!1;const s=(o=n.dom.ownerDocument.defaultView)!=null?o:window,l=Ct.getState(n.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const a=n.state.doc.nodeAt(l.activeHandle),c=$k(n,l.activeHandle,a.attrs);n.dispatch(n.state.tr.setMeta(Ct,{setDragging:{startX:e.clientX,startWidth:c}}));function d(f){s.removeEventListener("mouseup",d),s.removeEventListener("mousemove",u);const p=Ct.getState(n.state);p?.dragging&&(Hk(n,p.activeHandle,Jf(p.dragging,f,t)),n.dispatch(n.state.tr.setMeta(Ct,{setDragging:null})))}function u(f){if(!f.which)return d(f);const p=Ct.getState(n.state);if(p&&p.dragging){const h=Jf(p.dragging,f,t);Xf(n,p.activeHandle,h,r)}}return Xf(n,l.activeHandle,c,r),s.addEventListener("mouseup",d),s.addEventListener("mousemove",u),e.preventDefault(),!0}function $k(n,e,{colspan:t,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const s=n.domAtPos(e);let a=s.node.childNodes[s.offset].offsetWidth,c=t;if(r)for(let d=0;d<t;d++)r[d]&&(a-=r[d],c--);return a/c}function zk(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Gf(n,e,t,r){const o=t=="right"?-r:r,s=n.posAtCoords({left:e.clientX+o,top:e.clientY});if(!s)return-1;const{pos:l}=s,a=Ir(n.state.doc.resolve(l));if(!a)return-1;if(t=="right")return a.pos;const c=De.get(a.node(-1)),d=a.start(-1),u=c.map.indexOf(a.pos-d);return u%c.width==0?-1:d+c.map[u-1]}function Jf(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function Yf(n,e){n.dispatch(n.state.tr.setMeta(Ct,{setHandle:e}))}function Hk(n,e,t){const r=n.state.doc.resolve(e),o=r.node(-1),s=De.get(o),l=r.start(-1),a=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,c=n.state.tr;for(let d=0;d<s.height;d++){const u=d*s.width+a;if(d&&s.map[u]==s.map[u-s.width])continue;const f=s.map[u],p=o.nodeAt(f).attrs,h=p.colspan==1?0:a-s.colCount(f);if(p.colwidth&&p.colwidth[h]==t)continue;const m=p.colwidth?p.colwidth.slice():jk(p.colspan);m[h]=t,c.setNodeMarkup(l+f,null,{...p,colwidth:m})}c.docChanged&&n.dispatch(c)}function Xf(n,e,t,r){const o=n.state.doc.resolve(e),s=o.node(-1),l=o.start(-1),a=De.get(s).colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;let c=n.domAtPos(o.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&ra(s,c.firstChild,c,r,a,t)}function jk(n){return Array(n).fill(0)}function Uk(n,e){var t;const r=[],o=n.doc.resolve(e),s=o.node(-1);if(!s)return Me.empty;const l=De.get(s),a=o.start(-1),c=l.colCount(o.pos-a)+o.nodeAfter.attrs.colspan-1;for(let d=0;d<l.height;d++){const u=c+d*l.width;if((c==l.width-1||l.map[u]!=l.map[u+1])&&(d==0||l.map[u]!=l.map[u-l.width])){const f=l.map[u],p=a+f+s.nodeAt(f).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",(t=Ct.getState(n))!=null&&t.dragging&&r.push(Ye.node(a+f,a+f+s.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),r.push(Ye.widget(p,h))}}return Me.create(n.doc,r)}function Wk({allowTableNodeSelection:n=!1}={}){return new Oe({key:zn,state:{init(){return null},apply(e,t){const r=e.getMeta(zn);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:o,pos:s}=e.mapping.mapResult(t);return o?null:s}},props:{decorations:ok,handleDOMEvents:{mousedown:Lk},createSelectionBetween(e){return zn.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Bk,handleKeyDown:Ak,handlePaste:Vk},appendTransaction(e,t,r){return ik(r,If(r,t),n)}})}var Kk=Ue.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{var e,t;const r=n.getAttribute("colwidth"),o=r?r.split(",").map(s=>parseInt(s,10)):null;if(!o){const s=(e=n.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),l=Array.from(((t=n.parentElement)==null?void 0:t.children)||[]).indexOf(n);if(l&&l>-1&&s&&s[l]){const a=s[l].getAttribute("width");return a?[parseInt(a,10)]:null}}return o}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",xe(this.options.HTMLAttributes,n),0]}}),qk=Ue.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",xe(this.options.HTMLAttributes,n),0]}}),Gk=Ue.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",xe(this.options.HTMLAttributes,n),0]}});function oa(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function Zf(n,e,t,r,o,s){var l;let a=0,c=!0,d=e.firstChild;const u=n.firstChild;if(u!==null)for(let f=0,p=0;f<u.childCount;f+=1){const{colspan:h,colwidth:m}=u.child(f).attrs;for(let g=0;g<h;g+=1,p+=1){const y=o===p?s:m&&m[g],b=y?`${y}px`:"";if(a+=y||r,y||(c=!1),d){if(d.style.width!==b){const[k,w]=oa(r,y);d.style.setProperty(k,w)}d=d.nextSibling}else{const k=document.createElement("col"),[w,x]=oa(r,y);k.style.setProperty(w,x),e.appendChild(k)}}}for(;d;){const f=d.nextSibling;(l=d.parentNode)==null||l.removeChild(d),d=f}c?(t.style.width=`${a}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${a}px`)}var Jk=class{constructor(n,e){this.node=n,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Zf(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!==this.node.type?!1:(this.node=n,Zf(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){const e=n.target,t=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(t&&!r&&(n.type==="attributes"||n.type==="childList"||n.type==="characterData"))}};function Yk(n,e,t,r){let o=0,s=!0;const l=[],a=n.firstChild;if(!a)return{};for(let f=0,p=0;f<a.childCount;f+=1){const{colspan:h,colwidth:m}=a.child(f).attrs;for(let g=0;g<h;g+=1,p+=1){const y=t===p?r:m&&m[g];o+=y||e,y||(s=!1);const[b,k]=oa(e,y);l.push(["col",{style:`${b}: ${k}`}])}}const c=s?`${o}px`:"",d=s?"":`${o}px`;return{colgroup:["colgroup",{},...l],tableWidth:c,tableMinWidth:d}}function Qf(n,e){return n.createAndFill()}function Xk(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function Zk(n,e,t,r,o){const s=Xk(n),l=[],a=[];for(let d=0;d<t;d+=1){const u=Qf(s.cell);if(u&&a.push(u),r){const f=Qf(s.header_cell);f&&l.push(f)}}const c=[];for(let d=0;d<e;d+=1)c.push(s.row.createChecked(null,r&&d===0?l:a));return s.table.createChecked(null,c)}function Qk(n){return n instanceof Te}var Os=({editor:n})=>{const{selection:e}=n.state;if(!Qk(e))return!1;let t=0;const r=nf(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},ex=Ue.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:Jk,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:r,tableMinWidth:o}=Yk(n,this.options.cellMinWidth);return["table",xe(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:o,editor:s})=>{const l=Zk(s.schema,n,e,t);if(o){const a=r.selection.from+1;r.replaceSelectionWith(l).scrollIntoView().setSelection(oe.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>dk(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>uk(n,e),deleteColumn:()=>({state:n,dispatch:e})=>pk(n,e),addRowBefore:()=>({state:n,dispatch:e})=>mk(n,e),addRowAfter:()=>({state:n,dispatch:e})=>gk(n,e),deleteRow:()=>({state:n,dispatch:e})=>bk(n,e),deleteTable:()=>({state:n,dispatch:e})=>_k(n,e),mergeCells:()=>({state:n,dispatch:e})=>Pf(n,e),splitCell:()=>({state:n,dispatch:e})=>$f(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>ho("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>ho("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>Ck(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Pf(n,e)?!0:$f(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>wk(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>Hf(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>Hf(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&If(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=Te.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Os,"Mod-Backspace":Os,Delete:Os,"Mod-Delete":Os}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Ik({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Wk({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:ke(te(n,"tableRole",e))}}}),tx=Ee.create({name:"tableKit",addExtensions(){const n=[];return this.options.table!==!1&&n.push(ex.configure(this.options.table)),this.options.tableCell!==!1&&n.push(Kk.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push(qk.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push(Gk.configure(this.options.tableRow)),n}}),nx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,rx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,ox=Ht.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[ur({find:nx,type:this.type})]},addPasteRules(){return[$n({find:rx,type:this.type})]}}),sx=Ht.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),lx=Ht.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),Is=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},ix=/^\s*>\s$/,ax=Ue.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Is("blockquote",{...xe(this.options.HTMLAttributes,n),children:Is("slot",{})})},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Or({find:ix,type:this.type})]}}),cx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,dx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ux=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,fx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,px=Ht.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return Is("strong",{...xe(this.options.HTMLAttributes,n),children:Is("slot",{})})},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ur({find:cx,type:this.type}),ur({find:ux,type:this.type})]},addPasteRules(){return[$n({find:dx,type:this.type}),$n({find:fx,type:this.type})]}}),hx=/(^|[^`])`([^`]+)`(?!`)$/,mx=/(^|[^`])`([^`]+)`(?!`)/g,gx=Ht.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ur({find:hx,type:this.type})]},addPasteRules(){return[$n({find:mx,type:this.type})]}}),yx=/^```([a-z]+)?[\s\n]$/,bx=/^~~~([a-z]+)?[\s\n]$/,kx=Ue.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,s=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(l=>l.startsWith(t)).map(l=>l.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",xe(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{if(!this.options.enableTabIndentation)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:o}=t;if(r.parent.type!==this.type)return!1;const s=" ".repeat(this.options.tabSize);return o?n.commands.insertContent(s):n.commands.command(({tr:l})=>{const{from:a,to:c}=t,f=e.doc.textBetween(a,c,`
|
|
86
100
|
`,`
|
|
87
101
|
`).split(`
|
|
88
|
-
`).map(
|
|
89
|
-
`);return
|
|
102
|
+
`).map(p=>s+p).join(`
|
|
103
|
+
`);return l.replaceWith(a,c,e.schema.text(f)),!0})},"Shift-Tab":({editor:n})=>{if(!this.options.enableTabIndentation)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:o}=t;return r.parent.type!==this.type?!1:o?n.commands.command(({tr:s})=>{var l;const{pos:a}=r,c=r.start(),d=r.end(),f=e.doc.textBetween(c,d,`
|
|
90
104
|
`,`
|
|
91
105
|
`).split(`
|
|
92
|
-
`);let
|
|
106
|
+
`);let p=0,h=0;const m=a-c;for(let x=0;x<f.length;x+=1){if(h+f[x].length>=m){p=x;break}h+=f[x].length+1}const y=((l=f[p].match(/^ */))==null?void 0:l[0])||"",b=Math.min(y.length,this.options.tabSize);if(b===0)return!0;let k=c;for(let x=0;x<p;x+=1)k+=f[x].length+1;return s.delete(k,k+b),a-k<=b&&s.setSelection(oe.create(s.doc,k)),!0}):n.commands.command(({tr:s})=>{const{from:l,to:a}=t,u=e.doc.textBetween(l,a,`
|
|
93
107
|
`,`
|
|
94
108
|
`).split(`
|
|
95
|
-
`).map(
|
|
96
|
-
`);return s.replaceWith(
|
|
109
|
+
`).map(f=>{var p;const h=((p=f.match(/^ */))==null?void 0:p[0])||"",m=Math.min(h.length,this.options.tabSize);return f.slice(m)}).join(`
|
|
110
|
+
`);return s.replaceWith(l,a,e.schema.text(u)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:o}=t;if(!o||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,l=r.parent.textContent.endsWith(`
|
|
97
111
|
|
|
98
|
-
`);return!s||!
|
|
99
|
-
`));return
|
|
100
|
-
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:s}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:l}=r.extensionManager,a=s||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&i){const u=a.filter(h=>l.includes(h.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Yu=Ce.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]}`,ee(this.options.HTMLAttributes,e),0]},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=>Ki({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),$1=Ce.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ee(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!tb(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,o=t();return iu(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:i})=>{var l;if(i){const{$to:a}=s.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(H.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection($.create(s.doc,a.pos)):s.setSelection(H.create(s.doc,a.pos));else{const d=(l=a.parent.type.contentMatch.defaultType)==null?void 0:l.create();d&&(s.insert(c,d),s.setSelection(H.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Su({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),H1=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,z1=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,U1=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,j1=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,W1=dt.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",ee(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)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Cn({find:H1,type:this.type}),Cn({find:U1,type:this.type})]},addPasteRules(){return[Qt({find:z1,type:this.type}),Qt({find:j1,type:this.type})]}});const K1="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",q1="ελ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",nl="numeric",rl="ascii",ol="alpha",Nr="asciinumeric",vr="alphanumeric",sl="domain",Xu="emoji",G1="scheme",J1="slashscheme",il="whitespace";function Y1(t,e){return t in e||(e[t]=[]),e[t]}function Tn(t,e,n){e[nl]&&(e[Nr]=!0,e[vr]=!0),e[rl]&&(e[Nr]=!0,e[ol]=!0),e[Nr]&&(e[vr]=!0),e[ol]&&(e[vr]=!0),e[vr]&&(e[sl]=!0),e[Xu]&&(e[sl]=!0);for(const r in e){const o=Y1(r,n);o.indexOf(t)<0&&o.push(t)}}function X1(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Ke(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Ke.groups={},Ke.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],s=e.jr[r][1];if(s&&o.test(t))return s}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||Ke.groups;let o;return e&&e.j?o=e:(o=new Ke(e),n&&r&&Tn(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const s=t.length;if(!s)return o;for(let i=0;i<s-1;i++)o=o.tt(t[i]);return o.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||Ke.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const s=e;let i,l=o.go(t);if(l?(i=new Ke,Object.assign(i.j,l.j),i.jr.push.apply(i.jr,l.jr),i.jd=l.jd,i.t=l.t):i=new Ke,s){if(r)if(i.t&&typeof i.t=="string"){const a=Object.assign(X1(i.t,r),n);Tn(s,a,r)}else n&&Tn(s,n,r);i.t=s}return o.j[t]=i,i}};const j=(t,e,n,r,o)=>t.ta(e,n,r,o),me=(t,e,n,r,o)=>t.tr(e,n,r,o),Qu=(t,e,n,r,o)=>t.ts(e,n,r,o),A=(t,e,n,r,o)=>t.tt(e,n,r,o),Lt="WORD",ll="UWORD",Zu="ASCIINUMERICAL",ef="ALPHANUMERICAL",_r="LOCALHOST",al="TLD",cl="UTLD",$o="SCHEME",Yn="SLASH_SCHEME",dl="NUM",ul="WS",fl="NL",Mr="OPENBRACE",Ar="CLOSEBRACE",Ho="OPENBRACKET",zo="CLOSEBRACKET",Uo="OPENPAREN",jo="CLOSEPAREN",Wo="OPENANGLEBRACKET",Ko="CLOSEANGLEBRACKET",qo="FULLWIDTHLEFTPAREN",Go="FULLWIDTHRIGHTPAREN",Jo="LEFTCORNERBRACKET",Yo="RIGHTCORNERBRACKET",Xo="LEFTWHITECORNERBRACKET",Qo="RIGHTWHITECORNERBRACKET",Zo="FULLWIDTHLESSTHAN",es="FULLWIDTHGREATERTHAN",ts="AMPERSAND",ns="APOSTROPHE",rs="ASTERISK",en="AT",ss="BACKSLASH",is="BACKTICK",ls="CARET",tn="COLON",hl="COMMA",as="DOLLAR",kt="DOT",cs="EQUALS",pl="EXCLAMATION",rt="HYPHEN",Or="PERCENT",ds="PIPE",us="PLUS",fs="POUND",Lr="QUERY",ml="QUOTE",tf="FULLWIDTHMIDDLEDOT",gl="SEMI",xt="SLASH",Ir="TILDE",hs="UNDERSCORE",nf="EMOJI",ps="SYM";var rf=Object.freeze({__proto__:null,ALPHANUMERICAL:ef,AMPERSAND:ts,APOSTROPHE:ns,ASCIINUMERICAL:Zu,ASTERISK:rs,AT:en,BACKSLASH:ss,BACKTICK:is,CARET:ls,CLOSEANGLEBRACKET:Ko,CLOSEBRACE:Ar,CLOSEBRACKET:zo,CLOSEPAREN:jo,COLON:tn,COMMA:hl,DOLLAR:as,DOT:kt,EMOJI:nf,EQUALS:cs,EXCLAMATION:pl,FULLWIDTHGREATERTHAN:es,FULLWIDTHLEFTPAREN:qo,FULLWIDTHLESSTHAN:Zo,FULLWIDTHMIDDLEDOT:tf,FULLWIDTHRIGHTPAREN:Go,HYPHEN:rt,LEFTCORNERBRACKET:Jo,LEFTWHITECORNERBRACKET:Xo,LOCALHOST:_r,NL:fl,NUM:dl,OPENANGLEBRACKET:Wo,OPENBRACE:Mr,OPENBRACKET:Ho,OPENPAREN:Uo,PERCENT:Or,PIPE:ds,PLUS:us,POUND:fs,QUERY:Lr,QUOTE:ml,RIGHTCORNERBRACKET:Yo,RIGHTWHITECORNERBRACKET:Qo,SCHEME:$o,SEMI:gl,SLASH:xt,SLASH_SCHEME:Yn,SYM:ps,TILDE:Ir,TLD:al,UNDERSCORE:hs,UTLD:cl,UWORD:ll,WORD:Lt,WS:ul});const It=/[a-z]/,Dr=new RegExp("\\p{L}","u"),yl=new RegExp("\\p{Emoji}","u"),Dt=/\d/,bl=/\s/,of="\r",kl=`
|
|
101
|
-
`,
|
|
112
|
+
`);return!s||!l?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:o,empty:s}=t;if(!s||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const a=o.after();return a===void 0?!1:r.nodeAt(a)?n.commands.command(({tr:d})=>(d.setSelection(le.near(r.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[qi({find:yx,type:this.type,getAttributes:n=>({language:n[1]})}),qi({find:bx,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Oe({key:new $e("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,s=o?.mode;if(!t||!s)return!1;const{tr:l,schema:a}=n.state,c=a.text(t.replace(/\r\n?/g,`
|
|
113
|
+
`));return l.replaceSelectionWith(this.type.create({language:s},c)),l.selection.$from.parent.type!==this.type&&l.setSelection(oe.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),n.dispatch(l),!0}}})]}}),xx=Ue.create({name:"doc",topNode:!0,content:"block+"}),wx=Ue.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",xe(this.options.HTMLAttributes,n)]},renderText(){return`
|
|
114
|
+
`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:o,storedMarks:s}=t;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:a}=r.extensionManager,c=s||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&l){const f=c.filter(p=>a.includes(p.type.name));d.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),ep=Ue.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,xe(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>qi({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),Ex=Ue.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",xe(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!T1(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,o=n();return mf(t)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:l})=>{var a;if(l){const{$to:c}=s.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(oe.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(ne.create(s.doc,c.pos)):s.setSelection(oe.create(s.doc,c.pos));else{const u=(a=c.parent.type.contentMatch.defaultType)==null?void 0:a.create();u&&(s.insert(d,u),s.setSelection(oe.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Mf({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Cx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,vx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,_x=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Sx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Nx=Ht.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ur({find:Cx,type:this.type}),ur({find:_x,type:this.type})]},addPasteRules(){return[$n({find:vx,type:this.type}),$n({find:Sx,type:this.type})]}});const Mx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Tx="ελ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",sa="numeric",la="ascii",ia="alpha",mo="asciinumeric",go="alphanumeric",aa="domain",tp="emoji",Ax="scheme",Bx="slashscheme",ca="whitespace";function Vx(n,e){return n in e||(e[n]=[]),e[n]}function pr(n,e,t){e[sa]&&(e[mo]=!0,e[go]=!0),e[la]&&(e[mo]=!0,e[ia]=!0),e[mo]&&(e[go]=!0),e[ia]&&(e[go]=!0),e[go]&&(e[aa]=!0),e[tp]&&(e[aa]=!0);for(const r in e){const o=Vx(r,t);o.indexOf(n)<0&&o.push(n)}}function Lx(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function yt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}yt.groups={},yt.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],s=e.jr[r][1];if(s&&o.test(n))return s}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let o=0;o<n.length;o++)this.tt(n[o],e,t,r)},tr(n,e,t,r){r=r||yt.groups;let o;return e&&e.j?o=e:(o=new yt(e),t&&r&&pr(e,t,r)),this.jr.push([n,o]),o},ts(n,e,t,r){let o=this;const s=n.length;if(!s)return o;for(let l=0;l<s-1;l++)o=o.tt(n[l]);return o.tt(n[s-1],e,t,r)},tt(n,e,t,r){r=r||yt.groups;const o=this;if(e&&e.j)return o.j[n]=e,e;const s=e;let l,a=o.go(n);if(a?(l=new yt,Object.assign(l.j,a.j),l.jr.push.apply(l.jr,a.jr),l.jd=a.jd,l.t=a.t):l=new yt,s){if(r)if(l.t&&typeof l.t=="string"){const c=Object.assign(Lx(l.t,r),t);pr(s,c,r)}else t&&pr(s,t,r);l.t=s}return o.j[n]=l,l}};const ue=(n,e,t,r,o)=>n.ta(e,t,r,o),Re=(n,e,t,r,o)=>n.tr(e,t,r,o),np=(n,e,t,r,o)=>n.ts(e,t,r,o),$=(n,e,t,r,o)=>n.tt(e,t,r,o),yn="WORD",da="UWORD",rp="ASCIINUMERICAL",op="ALPHANUMERICAL",yo="LOCALHOST",ua="TLD",fa="UTLD",Ds="SCHEME",Dr="SLASH_SCHEME",pa="NUM",ha="WS",ma="NL",bo="OPENBRACE",ko="CLOSEBRACE",Rs="OPENBRACKET",Fs="CLOSEBRACKET",Ps="OPENPAREN",$s="CLOSEPAREN",zs="OPENANGLEBRACKET",Hs="CLOSEANGLEBRACKET",js="FULLWIDTHLEFTPAREN",Us="FULLWIDTHRIGHTPAREN",Ws="LEFTCORNERBRACKET",Ks="RIGHTCORNERBRACKET",qs="LEFTWHITECORNERBRACKET",Gs="RIGHTWHITECORNERBRACKET",Js="FULLWIDTHLESSTHAN",Ys="FULLWIDTHGREATERTHAN",Xs="AMPERSAND",Zs="APOSTROPHE",Qs="ASTERISK",Hn="AT",el="BACKSLASH",tl="BACKTICK",nl="CARET",jn="COLON",ga="COMMA",rl="DOLLAR",Zt="DOT",ol="EQUALS",ya="EXCLAMATION",Vt="HYPHEN",xo="PERCENT",sl="PIPE",ll="PLUS",il="POUND",wo="QUERY",ba="QUOTE",sp="FULLWIDTHMIDDLEDOT",ka="SEMI",Qt="SLASH",Eo="TILDE",al="UNDERSCORE",lp="EMOJI",cl="SYM";var ip=Object.freeze({__proto__:null,ALPHANUMERICAL:op,AMPERSAND:Xs,APOSTROPHE:Zs,ASCIINUMERICAL:rp,ASTERISK:Qs,AT:Hn,BACKSLASH:el,BACKTICK:tl,CARET:nl,CLOSEANGLEBRACKET:Hs,CLOSEBRACE:ko,CLOSEBRACKET:Fs,CLOSEPAREN:$s,COLON:jn,COMMA:ga,DOLLAR:rl,DOT:Zt,EMOJI:lp,EQUALS:ol,EXCLAMATION:ya,FULLWIDTHGREATERTHAN:Ys,FULLWIDTHLEFTPAREN:js,FULLWIDTHLESSTHAN:Js,FULLWIDTHMIDDLEDOT:sp,FULLWIDTHRIGHTPAREN:Us,HYPHEN:Vt,LEFTCORNERBRACKET:Ws,LEFTWHITECORNERBRACKET:qs,LOCALHOST:yo,NL:ma,NUM:pa,OPENANGLEBRACKET:zs,OPENBRACE:bo,OPENBRACKET:Rs,OPENPAREN:Ps,PERCENT:xo,PIPE:sl,PLUS:ll,POUND:il,QUERY:wo,QUOTE:ba,RIGHTCORNERBRACKET:Ks,RIGHTWHITECORNERBRACKET:Gs,SCHEME:Ds,SEMI:ka,SLASH:Qt,SLASH_SCHEME:Dr,SYM:cl,TILDE:Eo,TLD:ua,UNDERSCORE:al,UTLD:fa,UWORD:da,WORD:yn,WS:ha});const bn=/[a-z]/,Co=new RegExp("\\p{L}","u"),xa=new RegExp("\\p{Emoji}","u"),kn=/\d/,wa=/\s/,ap="\r",Ea=`
|
|
115
|
+
`,Ox="️",Ix="",Ca="";let dl=null,ul=null;function Dx(n=[]){const e={};yt.groups=e;const t=new yt;dl==null&&(dl=dp(Mx)),ul==null&&(ul=dp(Tx)),$(t,"'",Zs),$(t,"{",bo),$(t,"}",ko),$(t,"[",Rs),$(t,"]",Fs),$(t,"(",Ps),$(t,")",$s),$(t,"<",zs),$(t,">",Hs),$(t,"(",js),$(t,")",Us),$(t,"「",Ws),$(t,"」",Ks),$(t,"『",qs),$(t,"』",Gs),$(t,"<",Js),$(t,">",Ys),$(t,"&",Xs),$(t,"*",Qs),$(t,"@",Hn),$(t,"`",tl),$(t,"^",nl),$(t,":",jn),$(t,",",ga),$(t,"$",rl),$(t,".",Zt),$(t,"=",ol),$(t,"!",ya),$(t,"-",Vt),$(t,"%",xo),$(t,"|",sl),$(t,"+",ll),$(t,"#",il),$(t,"?",wo),$(t,'"',ba),$(t,"/",Qt),$(t,";",ka),$(t,"~",Eo),$(t,"_",al),$(t,"\\",el),$(t,"・",sp);const r=Re(t,kn,pa,{[sa]:!0});Re(r,kn,r);const o=Re(r,bn,rp,{[mo]:!0}),s=Re(r,Co,op,{[go]:!0}),l=Re(t,bn,yn,{[la]:!0});Re(l,kn,o),Re(l,bn,l),Re(o,kn,o),Re(o,bn,o);const a=Re(t,Co,da,{[ia]:!0});Re(a,bn),Re(a,kn,s),Re(a,Co,a),Re(s,kn,s),Re(s,bn),Re(s,Co,s);const c=$(t,Ea,ma,{[ca]:!0}),d=$(t,ap,ha,{[ca]:!0}),u=Re(t,wa,ha,{[ca]:!0});$(t,Ca,u),$(d,Ea,c),$(d,Ca,u),Re(d,wa,u),$(u,ap),$(u,Ea),Re(u,wa,u),$(u,Ca,u);const f=Re(t,xa,lp,{[tp]:!0});$(f,"#"),Re(f,xa,f),$(f,Ox,f);const p=$(f,Ix);$(p,"#"),Re(p,xa,f);const h=[[bn,l],[kn,o]],m=[[bn,null],[Co,a],[kn,s]];for(let g=0;g<dl.length;g++)Un(t,dl[g],ua,yn,h);for(let g=0;g<ul.length;g++)Un(t,ul[g],fa,da,m);pr(ua,{tld:!0,ascii:!0},e),pr(fa,{utld:!0,alpha:!0},e),Un(t,"file",Ds,yn,h),Un(t,"mailto",Ds,yn,h),Un(t,"http",Dr,yn,h),Un(t,"https",Dr,yn,h),Un(t,"ftp",Dr,yn,h),Un(t,"ftps",Dr,yn,h),pr(Ds,{scheme:!0,ascii:!0},e),pr(Dr,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],k=n[g][1]?{[Ax]:!0}:{[Bx]:!0};y.indexOf("-")>=0?k[aa]=!0:bn.test(y)?kn.test(y)?k[mo]=!0:k[la]=!0:k[sa]=!0,np(t,y,y,k)}return np(t,"localhost",yo,{ascii:!0}),t.jd=new yt(cl),{start:t,tokens:Object.assign({groups:e},ip)}}function cp(n,e){const t=Rx(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,o=[];let s=0,l=0;for(;l<r;){let a=n,c=null,d=0,u=null,f=-1,p=-1;for(;l<r&&(c=a.go(t[l]));)a=c,a.accepts()?(f=0,p=0,u=a):f>=0&&(f+=t[l].length,p++),d+=t[l].length,s+=t[l].length,l++;s-=f,l-=p,d-=f,o.push({t:u.t,v:e.slice(s-d,s),s:s-d,e:s})}return o}function Rx(n){const e=[],t=n.length;let r=0;for(;r<t;){let o=n.charCodeAt(r),s,l=o<55296||o>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(l),r+=l.length}return e}function Un(n,e,t,r,o){let s;const l=e.length;for(let a=0;a<l-1;a++){const c=e[a];n.j[c]?s=n.j[c]:(s=new yt(r),s.jr=o.slice(),n.j[c]=s),n=s}return s=new yt(t),s.jr=o.slice(),n.j[e[l-1]]=s,s}function dp(n){const e=[],t=[];let r=0,o="0123456789";for(;r<n.length;){let s=0;for(;o.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let l=parseInt(n.substring(r,r+s),10);l>0;l--)t.pop();r+=s}else t.push(n[r]),r++}return e}const vo={defaultProtocol:"http",events:null,format:up,formatHref:up,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function va(n,e=null){let t=Object.assign({},vo);n&&(t=Object.assign(t,n instanceof va?n.o:n));const r=t.ignoreTags,o=[];for(let s=0;s<r.length;s++)o.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=o}va.prototype={o:vo,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let o=this.o[n];return o&&(typeof o=="object"?(o=t.t in o?o[t.t]:vo[n],typeof o=="function"&&r&&(o=o(e,t))):typeof o=="function"&&r&&(o=o(e,t.t,t)),o)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function up(n){return n}function fp(n,e){this.t="token",this.v=n,this.tk=e}fp.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=vo.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),o=n.get("tagName",t,e),s=this.toFormattedString(n),l={},a=n.get("className",t,e),c=n.get("target",t,e),d=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return l.href=r,a&&(l.class=a),c&&(l.target=c),d&&(l.rel=d),u&&Object.assign(l,u),{tagName:o,attributes:l,content:s,eventListeners:f}}};function fl(n,e){class t extends fp{constructor(o,s){super(o,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const pp=fl("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),hp=fl("text"),Fx=fl("nl"),pl=fl("url",{isLink:!0,toHref(n=vo.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==yo&&n[1].t===jn}}),Lt=n=>new yt(n);function Px({groups:n}){const e=n.domain.concat([Xs,Qs,Hn,el,tl,nl,rl,ol,Vt,pa,xo,sl,ll,il,Qt,cl,Eo,al]),t=[Zs,jn,ga,Zt,ya,xo,wo,ba,ka,zs,Hs,bo,ko,Fs,Rs,Ps,$s,js,Us,Ws,Ks,qs,Gs,Js,Ys],r=[Xs,Zs,Qs,el,tl,nl,rl,ol,Vt,bo,ko,xo,sl,ll,il,wo,Qt,cl,Eo,al],o=Lt(),s=$(o,Eo);ue(s,r,s),ue(s,n.domain,s);const l=Lt(),a=Lt(),c=Lt();ue(o,n.domain,l),ue(o,n.scheme,a),ue(o,n.slashscheme,c),ue(l,r,s),ue(l,n.domain,l);const d=$(l,Hn);$(s,Hn,d),$(a,Hn,d),$(c,Hn,d);const u=$(s,Zt);ue(u,r,s),ue(u,n.domain,s);const f=Lt();ue(d,n.domain,f),ue(f,n.domain,f);const p=$(f,Zt);ue(p,n.domain,f);const h=Lt(pp);ue(p,n.tld,h),ue(p,n.utld,h),$(d,yo,h);const m=$(f,Vt);$(m,Vt,m),ue(m,n.domain,f),ue(h,n.domain,f),$(h,Zt,p),$(h,Vt,m);const g=$(h,jn);ue(g,n.numeric,pp);const y=$(l,Vt),b=$(l,Zt);$(y,Vt,y),ue(y,n.domain,l),ue(b,r,s),ue(b,n.domain,l);const k=Lt(pl);ue(b,n.tld,k),ue(b,n.utld,k),ue(k,n.domain,l),ue(k,r,s),$(k,Zt,b),$(k,Vt,y),$(k,Hn,d);const w=$(k,jn),x=Lt(pl);ue(w,n.numeric,x);const E=Lt(pl),M=Lt();ue(E,e,E),ue(E,t,M),ue(M,e,E),ue(M,t,M),$(k,Qt,E),$(x,Qt,E);const C=$(a,jn),A=$(c,jn),z=$(A,Qt),G=$(z,Qt);ue(a,n.domain,l),$(a,Zt,b),$(a,Vt,y),ue(c,n.domain,l),$(c,Zt,b),$(c,Vt,y),ue(C,n.domain,E),$(C,Qt,E),$(C,wo,E),ue(G,n.domain,E),ue(G,e,E),$(G,Qt,E);const V=[[bo,ko],[Rs,Fs],[Ps,$s],[zs,Hs],[js,Us],[Ws,Ks],[qs,Gs],[Js,Ys]];for(let O=0;O<V.length;O++){const[Y,Q]=V[O],P=$(E,Y);$(M,Y,P),$(P,Q,E);const K=Lt(pl);ue(P,e,K);const U=Lt();ue(P,t),ue(K,e,K),ue(K,t,U),ue(U,e,K),ue(U,t,U),$(K,Q,E),$(U,Q,E)}return $(o,yo,k),$(o,ma,Fx),{start:o,tokens:ip}}function $x(n,e,t){let r=t.length,o=0,s=[],l=[];for(;o<r;){let a=n,c=null,d=null,u=0,f=null,p=-1;for(;o<r&&!(c=a.go(t[o].t));)l.push(t[o++]);for(;o<r&&(d=c||a.go(t[o].t));)c=null,a=d,a.accepts()?(p=0,f=a):p>=0&&p++,o++,u++;if(p<0)o-=u,o<r&&(l.push(t[o]),o++);else{l.length>0&&(s.push(_a(hp,e,l)),l=[]),o-=p,u-=p;const h=f.t,m=t.slice(o-u,o);s.push(_a(h,e,m))}}return l.length>0&&s.push(_a(hp,e,l)),s}function _a(n,e,t){const r=t[0].s,o=t[t.length-1].e,s=e.slice(r,o);return new n(s,t)}const zx=typeof console<"u"&&console&&console.warn||(()=>{}),Hx="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ve={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function jx(){return yt.groups={},Ve.scanner=null,Ve.parser=null,Ve.tokenQueue=[],Ve.pluginQueue=[],Ve.customSchemes=[],Ve.initialized=!1,Ve}function mp(n,e=!1){if(Ve.initialized&&zx(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Hx}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
|
102
116
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
103
117
|
2. Cannot start or end with "-"
|
|
104
|
-
3. "-" cannot repeat`);ce.customSchemes.push([t,e])}function ak(){ce.scanner=ek(ce.customSchemes);for(let t=0;t<ce.tokenQueue.length;t++)ce.tokenQueue[t][1]({scanner:ce.scanner});ce.parser=rk(ce.scanner.tokens);for(let t=0;t<ce.pluginQueue.length;t++)ce.pluginQueue[t][1]({scanner:ce.scanner,parser:ce.parser});return ce.initialized=!0,ce}function Cl(t){return ce.initialized||ak(),ok(ce.parser.start,t,sf(ce.scanner.start,t))}Cl.scan=sf;function hf(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 El(n),o=Cl(t),s=[];for(let i=0;i<o.length;i++){const l=o[i];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}var Sl="[\0- -\u2029 ]",ck=new RegExp(Sl),dk=new RegExp(`${Sl}$`),uk=new RegExp(Sl,"g");function fk(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function hk(t){return new ue({key:new ye("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!o||s)return;const{tr:i}=r,l=Ud(n.doc,[...e]);if(tu(l).forEach(({newRange:c})=>{const d=b0(r.doc,c,p=>p.isTextblock);let u,h;if(d.length>1)u=d[0],h=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){const p=r.doc.textBetween(c.from,c.to," "," ");if(!dk.test(p))return;u=d[0],h=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&h){const p=h.split(ck).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],g=u.pos+h.lastIndexOf(m);if(!m)return!1;const y=Cl(m).map(b=>b.toObject(t.defaultProtocol));if(!fk(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+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=>{Vi(b.from,b.to,r.doc).some(k=>k.mark.type===t.type)||i.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!i.steps.length)return i}})}function pk(t){return new ue({key:new ye("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,s;if(r.button!==0||!e.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let d=r.target;const u=[];for(;d.nodeName!=="DIV";)u.push(d),d=d.parentNode;i=u.find(h=>h.nodeName==="A")}if(!i)return!1;const l=eu(e.state,t.type.name),a=(o=i?.href)!=null?o:l.href,c=(s=i?.target)!=null?s:l.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),i&&a?(window.open(a,c),!0):!1}}})}function mk(t){return new ue({key:new ye("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:s}=o,{empty:i}=s;if(i)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=hf(l,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a?!1:t.editor.commands.setMark(t.type,{href:a.href})}}})}function Nn(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(uk,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var pf=dt.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"){ff(t);return}ff(t.scheme,t.optionalSlashes)})},onDestroy(){lk()},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)=>!!Nn(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=>!!Nn(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=>!!Nn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ee(this.options.HTMLAttributes,t),0]:["a",ee(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Nn(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=>!!Nn(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[Qt({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=hf(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:i=>!!Nn(i,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.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(hk({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Nn(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(pk({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(mk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),gk=Object.defineProperty,yk=(t,e)=>{for(var n in e)gk(t,n,{get:e[n],enumerable:!0})},bk="listItem",mf="textStyle",gf=/^\s*([-+*])\s$/,yf=Ce.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",ee(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(bk,this.editor.getAttributes(mf)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Gn({find:gf,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Gn({find:gf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(mf),editor:this.editor})),[t]}}),bf=Ce.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ee(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),kk={};yk(kk,{findListItemPos:()=>Pr,getNextListDepth:()=>Tl,handleBackspace:()=>Nl,handleDelete:()=>vl,hasListBefore:()=>kf,hasListItemAfter:()=>xk,hasListItemBefore:()=>xf,listItemHasSubList:()=>Ef,nextListIsDeeper:()=>wf,nextListIsHigher:()=>Cf});var Pr=(t,e)=>{const{$from:n}=e.selection,r=Ee(t,e.schema);let o=null,s=n.depth,i=n.pos,l=null;for(;s>0&&l===null;)o=n.node(s),o.type===r?l=s:(s-=1,i-=1);return l===null?null:{$pos:e.doc.resolve(i),depth:l}},Tl=(t,e)=>{const n=Pr(t,e);if(!n)return!1;const[,r]=v0(e,t,n.$pos.pos+4);return r},kf=(t,e,n)=>{const{$anchor:r}=t.selection,o=Math.max(0,r.pos-2),s=t.doc.resolve(o).node();return!(!s||!n.includes(s.type.name))},xf=(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)},Ef=(t,e,n)=>{if(!n)return!1;const r=Ee(t,e.schema);let o=!1;return n.descendants(s=>{s.type===r&&(o=!0)}),o},Nl=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Xt(t.state,e)&&kf(t.state,e,n)){const{$anchor:l}=t.state.selection,a=t.state.doc.resolve(l.before()-1),c=[];a.node().descendants((h,p)=>{h.type.name===e&&c.push({node:h,pos:p})});const d=c.at(-1);if(!d)return!1;const u=t.state.doc.resolve(a.start()+d.pos+1);return t.chain().cut({from:l.start()-1,to:l.end()+1},u.end()).joinForward().run()}if(!Xt(t.state,e)||!O0(t.state))return!1;const r=Pr(e,t.state);if(!r)return!1;const s=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=Ef(e,t.state,s);return xf(e,t.state)&&!i?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},wf=(t,e)=>{const n=Tl(t,e),r=Pr(t,e);return!r||!n?!1:n>r.depth},Cf=(t,e)=>{const n=Tl(t,e),r=Pr(t,e);return!r||!n?!1:n<r.depth},vl=(t,e)=>{if(!Xt(t.state,e)||!A0(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:o}=n;return!n.empty&&r.sameParent(o)?!1:wf(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():Cf(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},xk=(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)},Sf=te.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&vl(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&&vl(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&&Nl(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&&Nl(t,n,r)&&(e=!0)}),e}}}}),Ek="listItem",Tf="textStyle",Nf=/^(\d+)\.\s$/,vf=Ce.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",ee(this.options.HTMLAttributes,n),0]:["ol",ee(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Ek,this.editor.getAttributes(Tf)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Gn({find:Nf,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=Gn({find:Nf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Tf)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),wk=/^\s*(\[([( |x])?\])\s$/,Ck=Ce.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",ee(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},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"),s=document.createElement("label"),i=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=d=>{var u,h;l.ariaLabel=((h=(u=this.options.a11y)==null?void 0:u.checkboxLabel)==null?void 0:h.call(u,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};return c(t),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:u}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=n();if(typeof p!="number")return!1;const m=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...m?.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,u)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,u])=>{o.setAttribute(d,u)}),o.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,s.append(l,i),o.append(s,a),Object.entries(e).forEach(([d,u])=>{o.setAttribute(d,u)}),{dom:o,contentDOM:a,update:d=>d.type!==this.type?!1:(o.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d),!0)}}},addInputRules(){return[Gn({find:wk,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Sk=Ce.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",ee(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});te.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(yf.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(bf.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Sf.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(vf.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Ck.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Sk.configure(this.options.taskList)),t}});var _f=Ce.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ee(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Tk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Nk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,vk=dt.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",ee(this.options.HTMLAttributes,t),0]},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[Cn({find:Tk,type:this.type})]},addPasteRules(){return[Qt({find:Nk,type:this.type})]}}),_k=Ce.create({name:"text",group:"inline"}),Mk=dt.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",ee(this.options.HTMLAttributes,t),0]},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 Ak(t={}){return new ue({view(e){return new Ok(e,t)}})}class Ok{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 s=i=>{this[o](i)};return e.dom.addEventListener(o,s),{name:o,handler:s}})}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,s=o.getBoundingClientRect(),i=s.width/o.offsetWidth,l=s.height/o.offsetHeight;if(n){let u=e.nodeBefore,h=e.nodeAfter;if(u||h){let p=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=u?m.bottom:m.top;u&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*i;r={left:u.left-h,right:u.left+h,top:u.top,bottom:u.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,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=a.getBoundingClientRect(),h=u.width/a.offsetWidth,p=u.height/a.offsetHeight;c=u.left-a.scrollLeft*h,d=u.top-a.scrollTop*p}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-d)/l+"px",this.element.style.width=(r.right-r.left)/i+"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,s=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!s){let i=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=nc(this.editorView.state.doc,i,this.editorView.dragging.slice);l!=null&&(i=l)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ge extends z{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ge.valid(r)?new ge(r):z.near(r)}content(){return L.empty}eq(e){return e instanceof ge&&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 ge(e.resolve(n.pos))}getBookmark(){return new _l(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Lk(e)||!Ik(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&&ge.valid(e))return e;let o=e.pos,s=null;for(let i=e.depth;;i--){let l=e.node(i);if(n>0?e.indexAfter(i)<l.childCount:e.index(i)>0){s=l.child(n>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;o+=n;let a=e.doc.resolve(o);if(ge.valid(a))return a}for(;;){let i=n>0?s.firstChild:s.lastChild;if(!i){if(s.isAtom&&!s.isText&&!$.isSelectable(s)){e=e.doc.resolve(o+s.nodeSize*n),r=!1;continue e}break}s=i,o+=n;let l=e.doc.resolve(o);if(ge.valid(l))return l}return null}}}ge.prototype.visible=!1,ge.findFrom=ge.findGapCursorFrom,z.jsonID("gapcursor",ge);class _l{constructor(e){this.pos=e}map(e){return new _l(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ge.valid(n)?new ge(n):z.near(n)}}function Lk(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||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function Ik(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||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function Dk(){return new ue({props:{decorations:Fk,createSelectionBetween(t,e,n){return e.pos==n.pos&&ge.valid(n)?new ge(n):null},handleClick:Pk,handleKeyDown:Rk,handleDOMEvents:{beforeinput:Bk}}})}const Rk=vi({ArrowLeft:ks("horiz",-1),ArrowRight:ks("horiz",1),ArrowUp:ks("vert",-1),ArrowDown:ks("vert",1)});function ks(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,s){let i=r.selection,l=e>0?i.$to:i.$from,a=i.empty;if(i instanceof H){if(!s.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=ge.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new ge(c))),!0):!1}}function Pk(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ge.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&$.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ge(r))),!0)}function Bk(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ge))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=v.empty;for(let i=r.length-1;i>=0;i--)o=v.from(r[i].createAndFill(null,o));let s=t.state.tr.replace(n.pos,n.pos,new L(o,0,0));return s.setSelection(H.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function Fk(t){if(!(t.selection instanceof ge))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ie.create(t.doc,[ve.widget(t.selection.head,e,{key:"gapcursor"})])}var xs=200,_e=function(){};_e.prototype.append=function(e){return e.length?(e=_e.from(e),!this.length&&e||e.length<xs&&this.leafAppend(e)||this.length<xs&&e.leafPrepend(this)||this.appendInner(e)):this},_e.prototype.prepend=function(e){return e.length?_e.from(e).append(this):this},_e.prototype.appendInner=function(e){return new Vk(this,e)},_e.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?_e.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},_e.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},_e.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)},_e.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(s,i){return o.push(e(s,i))},n,r),o},_e.from=function(e){return e instanceof _e?e:e&&e.length?new Mf(e):_e.empty};var Mf=(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,s){return o==0&&s==this.length?this:new e(this.values.slice(o,s))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,s,i,l){for(var a=s;a<i;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,s,i,l){for(var a=s-1;a>=i;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=xs)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=xs)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})(_e);_e.empty=new Mf([]);var Vk=(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,s,i){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(s,l),i)===!1||s>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,s)-l,i+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,s,i){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(s,l)-l,i+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(o,l),s,i)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var s=this.left.length;return o<=s?this.left.slice(r,o):r>=s?this.right.slice(r-s,o-s):this.left.slice(r,s).append(this.right.slice(0,o-s))},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})(_e);const $k=500;class ft{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,s;n&&(o=this.remapping(r,this.items.length),s=o.maps.length);let i=e.tr,l,a,c=[],d=[];return this.items.forEach((u,h)=>{if(!u.step){o||(o=this.remapping(r,h+1),s=o.maps.length),s--,d.push(u);return}if(o){d.push(new Et(u.map));let p=u.step.map(o.slice(s)),m;p&&i.maybeStep(p).doc&&(m=i.mapping.maps[i.mapping.maps.length-1],c.push(new Et(m,void 0,void 0,c.length+d.length))),s--,m&&o.appendMap(m,s)}else i.maybeStep(u.step);if(u.selection)return l=o?u.selection.map(o.slice(s)):u.selection,a=new ft(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:i,selection:l}}addTransform(e,n,r,o){let s=[],i=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),h=new Et(e.mapping.maps[d],u,n),p;(p=a&&a.merge(h))&&(h=p,d?s.pop():l=l.slice(0,l.length-1)),s.push(h),n&&(i++,n=void 0),o||(a=h)}let c=i-r.depth;return c>zk&&(l=Hk(l,c),i-=c),new ft(l.append(s),i)}remapping(e,n){let r=new cr;return this.items.forEach((o,s)=>{let i=o.mirrorOffset!=null&&s-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,i)},e,n),r}addMaps(e){return this.eventCount==0?this:new ft(this.items.append(e.map(n=>new Et(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),s=e.mapping,i=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},o);let a=n;this.items.forEach(h=>{let p=s.getMirror(--a);if(p==null)return;i=Math.min(i,p);let m=s.maps[p];if(h.step){let g=e.steps[p].invert(e.docs[p]),y=h.selection&&h.selection.map(s.slice(a+1,p));y&&l++,r.push(new Et(m,g,y))}else r.push(new Et(m))},o);let c=[];for(let h=n;h<i;h++)c.push(new Et(s.maps[h]));let d=this.items.slice(0,o).append(c).append(r),u=new ft(d,l);return u.emptyItemCount()>$k&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],s=0;return this.items.forEach((i,l)=>{if(l>=e)o.push(i),i.selection&&s++;else if(i.step){let a=i.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let d=i.selection&&i.selection.map(n.slice(r));d&&s++;let u=new Et(c.invert(),a,d),h,p=o.length-1;(h=o.length&&o[p].merge(u))?o[p]=h:o.push(u)}}else i.map&&r--},this.items.length,0),new ft(_e.from(o.reverse()),s)}}ft.empty=new ft(_e.empty,0);function Hk(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class Et{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 Et(n.getMap().invert(),n,this.selection)}}}class rn{constructor(e,n,r,o,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const zk=20;function Uk(t,e,n,r){let o=n.getMeta(vn),s;if(o)return o.historyState;n.getMeta(Kk)&&(t=new rn(t.done,t.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(i&&i.getMeta(vn))return i.getMeta(vn).redo?new rn(t.done.addTransform(n,void 0,r,Es(e)),t.undone,Af(n.mapping.maps),t.prevTime,t.prevComposition):new rn(t.done,t.undone.addTransform(n,void 0,r,Es(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!i&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!jk(n,t.prevRanges)),c=i?Ml(t.prevRanges,n.mapping):Af(n.mapping.maps);return new rn(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Es(e)),ft.empty,c,n.time,l??t.prevComposition)}else return(s=n.getMeta("rebased"))?new rn(t.done.rebased(n,s),t.undone.rebased(n,s),Ml(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new rn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Ml(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function jk(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&o>=e[s]&&(n=!0)}),n}function Af(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,s,i)=>e.push(s,i));return e}function Ml(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),s=e.map(t[r+1],-1);o<=s&&n.push(o,s)}return n}function Wk(t,e,n){let r=Es(e),o=vn.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let i=s.selection.resolve(s.transform.doc),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),o,r),a=new rn(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(i).setMeta(vn,{redo:n,historyState:a})}let Al=!1,Of=null;function Es(t){let e=t.plugins;if(Of!=e){Al=!1,Of=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Al=!0;break}}return Al}const vn=new ye("history"),Kk=new ye("closeHistory");function qk(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ue({key:vn,state:{init(){return new rn(ft.empty,ft.empty,null,0,-1)},apply(e,n,r){return Uk(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?If:r=="historyRedo"?Df:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function Lf(t,e){return(n,r)=>{let o=vn.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let s=Wk(o,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const If=Lf(!1,!0),Df=Lf(!0,!0);te.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new ue({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 s=this.storage.characters({node:r.doc});if(s>o){const i=s-o,l=0,a=i;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}),s=this.storage.characters({node:e.doc});if(s<=r||o>r&&s>r&&s<=o)return!0;if(o>r&&s>r&&s>o||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=s-r,c=l-a,d=l;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var Gk=te.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Ak(this.options)]}});te.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ue({key:new ye("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,s=[];if(!n||!r)return ie.create(t,[]);let i=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(a.isText)return;if(!(o>=c&&o<=c+a.nodeSize-1))return!1;i+=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"&&i-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(ve.node(c,c+a.nodeSize,{class:this.options.className}))}),ie.create(t,s)}}})]}});var Jk=te.create({name:"gapCursor",addProseMirrorPlugins(){return[Dk()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Q(V(t,"allowGapCursor",n)))!=null?e:null}}});te.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ue({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 s=this.editor.isEmpty;return t.descendants((i,l)=>{const a=r>=l&&r<=l+i.nodeSize,c=!i.isLeaf&&vo(i);if((a||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const u=ve.node(l,l+i.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:l,hasAnchor:a}):this.options.placeholder});o.push(u)}return this.options.includeChildren}),ie.create(t,o)}}})]}}),te.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new ue({key:new ye("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||iu(n.selection)||t.view.dragging?null:ie.create(n.doc,[ve.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Rf({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var Yk=te.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const t=new ye(this.name),e=Object.entries(this.editor.schema.nodes).map(([,n])=>n).filter(n=>(this.options.notAfter||[]).concat(this.options.node).includes(n.name));return[new ue({key:t,appendTransaction:(n,r,o)=>{const{doc:s,tr:i,schema:l}=o,a=t.getState(o),c=s.content.size,d=l.nodes[this.options.node];if(a)return i.insert(c,d.create())},state:{init:(n,r)=>{const o=r.tr.doc.lastChild;return!Rf({node:o,types:e})},apply:(n,r)=>{if(!n.docChanged)return r;const o=n.doc.lastChild;return!Rf({node:o,types:e})}}})]}}),Xk=te.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>If(t,e),redo:()=>({state:t,dispatch:e})=>Df(t,e)}},addProseMirrorPlugins(){return[qk(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()}}}),Qk=te.create({name:"starterKit",addExtensions(){var t,e,n,r;const o=[];return this.options.bold!==!1&&o.push(O1.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(N1.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(yf.configure(this.options.bulletList)),this.options.code!==!1&&o.push(D1.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(B1.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(F1.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(Gk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(Jk.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(V1.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(Yu.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(Xk.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push($1.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(W1.configure(this.options.italic)),this.options.listItem!==!1&&o.push(bf.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(Sf.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(pf.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(vf.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(_f.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(vk.configure(this.options.strike)),this.options.text!==!1&&o.push(_k.configure(this.options.text)),this.options.underline!==!1&&o.push(Mk.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(Yk.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),Zk=Qk,ex=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,tx=Ce.create({name:"image",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},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",ee(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[Su({find:ex,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),nx=te.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).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")}}});const rx=async t=>{try{const e=new FormData;return e.append("unique","true"),e.append("file",t),(await(await fetch("/file/upload/uploads?id=&form=&table=",{method:"POST",body:e})).json())?.result}catch(e){console.error(e)}},ox=async(t,e)=>{const n=e.clipboardData?.items;if(n){const r=e.clipboardData?.getData("text/html"),o=e.clipboardData?.getData("text/plain");if(r){const{state:s,dispatch:i}=t,{tr:l}=s,a=Rn.fromSchema(t.state.schema),c=new DOMParser().parseFromString(r,"text/html").body,d=a.parse(c),u=l.replaceSelectionWith(d);return i(u),e.preventDefault(),!0}if(o){const{state:s,dispatch:i}=t,{tr:l}=s,a=l.insertText(o,s.selection.from,s.selection.to);return i(a),e.preventDefault(),!0}for(let s=0;s<n.length;s++){const i=n[s];if(i.type.startsWith("image/")){const l=i.getAsFile();if(l){const a=await rx(l),{schema:c}=t.state,d=c.nodes.image.create({src:a?.file_path}),u=t.state.tr.replaceSelectionWith(d);return t.dispatch(u),e.preventDefault(),!0}}}}return!1},sx={1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"},ix=Yu.extend({addOptions(){return{...this.parent?.(),levels:[1,2,3,4,5,6]}}}).extend({addAttributes(){return{...this.parent?.(),level:{default:1,renderHTML:t=>{const e=t.level||1;return{class:`heading-level-${e}`,style:sx[e-1]}}}}}}),lx=_f.configure({HTMLAttributes:{style:"min-height: 1rem;"}}),ax=qi.extend({addAttributes(){return{...this.parent?.(),fontFamily:{default:null,parseHTML:t=>t.style.fontFamily?.replace(/['"]/g,""),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()}}}),cx=qi.extend({addAttributes(){return{...this.parent?.(),fontSize:{default:null,parseHTML:t=>t.style.fontSize?.replace(/['"]/g,""),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()}}}),dx=Ce.create({name:"iframe",group:"block",inline:!1,atom:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:"100%"},height:{default:"280"},frameborder:{default:"0"},allow:{default:null},allowfullscreen:{default:null},referrerpolicy:{default:null},loading:{default:null},class:{default:null},title:{default:null},style:{default:null}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:t}){return["iframe",t]}});function Pf(t){let e=!1;const n=ob({content:t.modelValue,extensions:[Zk.configure({history:{depth:100,newGroupDelay:500},code:{HTMLAttributes:{class:"editor-code"}},codeBlock:{HTMLAttributes:{class:"editor-codeblock"}},paragraph:!1,heading:!1,link:!1}),S1,C1,fb,ax,cx,lx,ix,w1,tx,nx.configure({types:["heading","paragraph"]}),pf.configure({HTMLAttributes:{class:"editor-link"},openOnClick:!1,autolink:!0}),k1.configure({table:{HTMLAttributes:{class:"editor-content"},resizable:!0}}),dx],editorProps:{handlePaste:ox,handleKeyDown:(s,i)=>{if(i.key==="Tab"){const l=s.state,{selection:a}=l,{$anchor:c}=a;let d=!1;for(let u=c.depth;u>0;u--){const h=c.node(u);if(h&&(h.type.name==="bulletList"||h.type.name==="orderedList")){d=!0;break}}return d?!1:(i.preventDefault(),!0)}return!1}}}),r=f.computed(()=>n.value||null);return f.watch(n,s=>{s&&n.value.on("update",i=>{if(!e){e=!0;const l=i.editor.getHTML();t.modelValue,setTimeout(()=>{e=!1},10)}})}),{editor:n,editorInstance:r,focusEditor:()=>{n.value&&!n.value.isFocused&&n.value.commands.focus()}}}function Bf(t,e){const n=f.ref(!1),r=f.ref(""),o=f.ref(null);return{isHtmlMode:n,htmlContent:r,htmlTextarea:o,toggleHtmlMode:l=>{n.value=l,l?(t.value&&(r.value=t.value.getHTML()),f.nextTick(()=>{o.value&&(o.value.focus(),setTimeout(()=>{o.value.formatCode()},100))})):t.value&&r.value&&t.value.commands.setContent(r.value,!0)},onHtmlInput:l=>{r.value=l,e&&e("update:modelValue",l)}}}function Ff(){const t=f.ref(!1);return{isFullscreen:t,toggleFullscreen:()=>{t.value=!t.value}}}const de=(t,e)=>{const n=t.__vccOpts||t;for(const[r,o]of e)n[r]=o;return n},ux={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function fx(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("button",{title:"Blockquote",onClick:e[0]||(e[0]=(...i)=>s.toggleBlockquote&&s.toggleBlockquote(...i)),class:f.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":n.editor?.isActive("blockquote")}])},[...e[1]||(e[1]=[f.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[f.createElementVNode("path",{"fill-rule":"evenodd",d:"M6 6a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3H5a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2H6Zm9 0a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3h-1a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3Z"})],-1)])],2)}const hx=de(ux,[["render",fx]]),px={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function mx(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("button",{title:"Bullet List",onClick:e[0]||(e[0]=(...i)=>s.toggleBulletList&&s.toggleBulletList(...i)),class:f.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("bulletList")}])},[...e[1]||(e[1]=[f.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)])],2)}const gx=de(px,[["render",mx]]),yx={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function bx(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("button",{title:"Ordered List",onClick:e[0]||(e[0]=(...i)=>s.toggleOrderedList&&s.toggleOrderedList(...i)),class:f.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("orderedList")}])},[...e[1]||(e[1]=[f.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"})],-1)])],2)}const kx=de(yx,[["render",bx]]),xx={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function Ex(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("button",{title:"Code Block",onClick:e[0]||(e[0]=(...i)=>s.toggleCodeBlock&&s.toggleCodeBlock(...i)),class:f.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("codeBlock")}])},[...e[1]||(e[1]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8-4 4 4 4m8 0 4-4-4-4m-2-3-4 14"})],-1)])],2)}const wx=de(xx,[["render",Ex]]),Cx={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.commands.toggleBold()}}};function Sx(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("button",{title:"Bold Text",onClick:e[0]||(e[0]=(...i)=>s.toggleBold&&s.toggleBold(...i)),class:f.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("bold")}])},[...e[1]||(e[1]=[f.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 5h4.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0-7H6m2 7h6.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0 0H6"})],-1),f.createElementVNode("span",{class:"sr-only"},"Bold",-1)])],2)}const Tx=de(Cx,[["render",Sx]]),Nx={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function vx(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("button",{title:"Italic Text",onClick:e[0]||(e[0]=(...i)=>s.toggleItalic&&s.toggleItalic(...i)),class:f.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("italic")}])},[...e[1]||(e[1]=[f.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8.874 19 6.143-14M6 19h6.33m-.66-14H18"})],-1),f.createElementVNode("span",{class:"sr-only"},"Italic",-1)])],2)}const _x=de(Nx,[["render",vx]]),Mx={__name:"vs-editor-underline",props:{editor:Object},setup(t){const e=t,n=()=>{e.editor&&e.editor.chain().focus().toggleUnderline().run()};return(r,o)=>(f.openBlock(),f.createElementBlock("button",{title:"Underline",onClick:n,class:f.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[t.editor?.isActive("underline")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...o[0]||(o[0]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{d:"M6 4v6a6 6 0 0 0 12 0V4"}),f.createElementVNode("line",{x1:"4",x2:"20",y1:"20",y2:"20"})],-1)])],2))}},Ax={__name:"vs-editor-strike",props:{editor:Object},setup(t){const e=t,n=()=>{e.editor&&e.editor.chain().focus().toggleStrike().run()};return(r,o)=>(f.openBlock(),f.createElementBlock("button",{title:"Strikethrough",onClick:n,class:f.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[t.editor?.isActive("strike")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...o[0]||(o[0]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-strikethrough"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M5 12l14 0"}),f.createElementVNode("path",{d:"M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5"})],-1)])],2))}},Ox={props:{visible:{type:Boolean,default:()=>!1},modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""},closeClickBack:{type:Boolean,default:()=>!1}},emits:["update:visible","update:modelValue","onClose","confirm","cancel"],inheritAttrs:!1,name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){return!!this.$slots?.footer},checkSize(){return this.size==="small"?"md:w-5/12 w-9/12":this.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:t}){t==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("update:modelValue",!1),this.$emit("onClose")},handleConfirm(){this.$emit("confirm"),this.handleClose()},handleCancel(){this.$emit("cancel"),this.handleClose()},closeByClickBack(t,e){e&&t.target.classList.contains("vs-dialog-overlay")&&this.handleClose()}}},Lx={key:0,class:"vsTailwind ui-dialog__wrapper"},Ix={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},Dx={class:"font-medium text-gray-800 dark:text-[#ffffff]"},Rx={class:"ui-dialog__content p-4"},Px={key:0,class:"flex justify-end gap-x-2"};function Bx(t,e,n,r,o,s){return f.openBlock(),f.createBlock(f.Teleport,{to:"body"},[n.visible||n.modelValue?(f.openBlock(),f.createElementBlock("div",Lx,[f.createElementVNode("div",{onMousedown:e[1]||(e[1]=i=>s.closeByClickBack(i,n.closeClickBack)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[100001] bg-black bg-opacity-50"},[f.createVNode(f.Transition,{name:"content",appear:""},{default:f.withCtx(()=>[f.createElementVNode("div",{class:f.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[s.checkSize]])},[f.createElementVNode("div",Ix,[f.createElementVNode("h3",Dx,f.toDisplayString(n.title),1),f.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:e[0]||(e[0]=(...i)=>s.handleClose&&s.handleClose(...i))},[...e[2]||(e[2]=[f.createElementVNode("span",{class:"sr-only"},"Close",-1),f.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{d:"M18 6 6 18"}),f.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),f.createElementVNode("div",Rx,[f.renderSlot(t.$slots,"default",{},void 0,!0)]),s.hasSlot?(f.openBlock(),f.createElementBlock("div",Px,[f.renderSlot(t.$slots,"footer",{handleClose:s.handleClose,handleConfirm:s.handleConfirm,handleCancel:s.handleCancel},void 0,!0)])):f.createCommentVNode("",!0)],2)]),_:3})],32)])):f.createCommentVNode("",!0)])}const Vf=de(Ox,[["render",Bx],["__scopeId","data-v-6d0970a6"]]),Fx={},Vx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function $x(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("svg",Vx,[...e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),f.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const Hx=de(Fx,[["render",$x]]),zx={},Ux={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search"};function jx(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("svg",Ux,[...e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),f.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)])])}const Wx=de(zx,[["render",jx]]),Kx={},qx={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-mail"};function Gx(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("svg",qx,[...e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"},null,-1),f.createElementVNode("path",{d:"M3 7l9 6l9 -6"},null,-1)])])}const Jx=de(Kx,[["render",Gx]]),Yx=f.defineComponent({components:{IconClose:Hx,IconSearch:Wx,IconEmail:Jx},inheritAttrs:!1,props:{icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"},type:{type:String,default:()=>"text"},style:{type:Object,default:()=>null},size:{type:String,default:()=>"md"},attrs:{type:Object,default:()=>{}}},emits:["onInput","update:modelValue","blur","focus"],computed:{checkSize(){if((this.style?.size||this.size)==="xs")return"h-[32px] text-sm";if((this.style?.size||this.size)==="md")return"h-[38px] text-sm";this.style?.size||this.size},value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t.trim())}},clearIconStyle(){return[{"right-8":this.icon&&this.iconPosition==="right","right-3":!this.icon||this.iconPosition!=="right","pointer-events-none":this.disabled}]},iconStylePosition(){return[{"left-3":this.icon&&this.iconPosition==="left","right-3":this.icon&&this.iconPosition==="right"}]},inputStyle(){return[{"!pr-8":this.clearable&&!this.icon,"!pr-7":this.clearable,"!pr-16":this.clearable&&this.icon&&this.iconPosition==="right","!pl-8":this.icon&&this.iconPosition==="left","!pr-[50px]":this.clearable&&this.value&&this.icon&&this.iconPosition==="right","!cursor-not-allowed bg-slate-100":this.disabled,"bg-white":!this.disabled}]}},methods:{handleInput(){this.$emit("onInput",this.modelValue)},handleBlur(){this.$emit("blur")},handleFocus(){this.$emit("focus")},clearInput(){this.$emit("update:modelValue",""),this.$emit("onInput","")},async inputFocus(){const{vsText:t}=await this.$refs;await t.focus()}}}),Xx={class:"vs-form-text relative bg-white rounded-lg"},Qx={key:2,class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},Zx=["disabled","type","placeholder"];function eE(t,e,n,r,o,s){const i=f.resolveComponent("IconClose"),l=f.resolveComponent("IconSearch"),a=f.resolveComponent("IconEmail");return f.openBlock(),f.createElementBlock("div",Xx,[t.clearable&&t.value?(f.openBlock(),f.createElementBlock("div",{key:0,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[0]||(e[0]=(...c)=>t.clearInput&&t.clearInput(...c))},[f.createVNode(i,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):f.createCommentVNode("",!0),t.icon&&t.icon==="search"?(f.openBlock(),f.createElementBlock("div",{key:1,class:f.normalizeClass(["absolute bottom-2/4 translate-y-2/4 cursor-pointer",t.iconStylePosition])},[f.createVNode(l,{width:"15px",height:"15px",class:"stroke-gray-500 transition-all"})],2)):t.icon&&t.icon==="email"?(f.openBlock(),f.createElementBlock("div",Qx,[f.createVNode(a,{width:"16",height:"16",class:"stroke-gray-500 transition-all"})])):(f.openBlock(),f.createElementBlock("i",{key:3,class:f.normalizeClass(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer",["ti "+t.icon,t.iconStylePosition]])},null,2)),t.clearable&&t.value?(f.openBlock(),f.createElementBlock("div",{key:4,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[1]||(e[1]=(...c)=>t.clearInput&&t.clearInput(...c))},[f.createVNode(i,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):f.createCommentVNode("",!0),f.withDirectives(f.createElementVNode("input",f.mergeProps({ref:"vsText",disabled:t.disabled,type:t.type,onInput:e[2]||(e[2]=(...c)=>t.handleInput&&t.handleInput(...c)),placeholder:t.placeholder,"onUpdate:modelValue":e[3]||(e[3]=c=>t.value=c)},t.style?.attrs||t.attrs||{},{onFocus:e[4]||(e[4]=(...c)=>t.handleFocus&&t.handleFocus(...c)),onBlur:e[5]||(e[5]=(...c)=>t.handleBlur&&t.handleBlur(...c)),class:[[t.inputStyle,t.checkSize],"py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"]}),null,16,Zx),[[f.vModelDynamic,t.value]])])}const $f=de(Yx,[["render",eE],["__scopeId","data-v-749b581f"]]);function Ol(){const t=f.ref("en");return{t:n=>({en:{type_tag:"Type Tag",heading_1:"Heading 1",heading_2:"Heading 2",heading_3:"Heading 3",paragraph:"Paragraph",createTable:"Create Table",addColumn:"Add Column",addRow:"Add Row",deleteColumn:"Delete Column",deleteRow:"Delete Row",deleteTable:"Delete Table",mergeCells:"Merge Cells",splitCells:"Split Cells",linkTitle:"Enter Link"},uk:{type_tag:"Тип тегу",heading_1:"Заголовок 1",heading_2:"Заголовок 2",heading_3:"Заголовок 3",paragraph:"Параграф",createTable:"Створити Таблицю",addColumn:"Додати Колону",addRow:"Додати Рядок",deleteColumn:"Вилучити Колону",deleteRow:"Вилучити Рядок",deleteTable:"Вилучити Таблицю",mergeCells:"Об'єднати Клітинки",splitCells:"Розділити Клітинки",linkTitle:"Введіть Посилання"}})[t.value]?.[n]||n,locale:t}}const tE={class:"flex flex-col gap-3 p-[20px]"},nE={class:"relative flex items-center gap-2"},rE={class:"flex-1"},oE={key:0,class:"flex items-center gap-2 flex-shrink-0"},sE={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},iE=Object.assign({inheritAttrs:!1},{__name:"vs-editor-link",props:{editor:Object},setup(t){const{t:e}=Ol(),n=t,r=f.ref(!1),o=f.ref(""),s=f.ref(!1),i=()=>{if(!n.editor)return;n.editor.chain().focus().extendMarkRange("link").run();const u=n.editor.getAttributes("link");u.href?(s.value=!0,o.value=u.href):(s.value=!1,o.value=""),r.value=!0},l=()=>{r.value=!1,o.value="",s.value=!1},a=()=>{if(!n.editor||!o.value.trim())return;let u=o.value.trim();u.match(/^https?:\/\//i)||(u="https://"+u),n.editor.chain().focus().setLink({href:u}).run(),l()},c=()=>{n.editor&&(n.editor.chain().focus().unsetLink().run(),l())},d=()=>{if(!o.value)return;let u=o.value.trim();u.match(/^https?:\/\//i)||(u="https://"+u),window.open(u,"_blank","noopener,noreferrer")};return(u,h)=>(f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("button",{title:"Link",onClick:i,class:f.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":t.editor?.isActive("link")}])},[...h[2]||(h[2]=[f.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[f.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13.213 9.787a3.391 3.391 0 0 0-4.795 0l-3.425 3.426a3.39 3.39 0 0 0 4.795 4.794l.321-.304m-.321-4.49a3.39 3.39 0 0 0 4.795 0l3.424-3.426a3.39 3.39 0 0 0-4.794-4.795l-1.028.961"})],-1)])],2),f.createVNode(Vf,{title:s.value?f.unref(e)("editLink")||"Edit Link":f.unref(e)("linkTitle")||"Add Link",visible:r.value,"onUpdate:visible":h[1]||(h[1]=p=>r.value=p),size:"small"},{footer:f.withCtx(()=>[f.createElementVNode("div",sE,[f.createElementVNode("button",{style:{border:"1px solid #000"},onClick:l,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"},f.toDisplayString(f.unref(e)("cancel")||"Cancel"),1),f.createElementVNode("button",{onClick:a,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"},f.toDisplayString(s.value?f.unref(e)("update")||"Update":f.unref(e)("create")||"Create"),1)])]),default:f.withCtx(()=>[f.createElementVNode("div",tE,[f.createElementVNode("div",nE,[f.createElementVNode("div",rE,[f.createVNode($f,{modelValue:o.value,"onUpdate:modelValue":h[0]||(h[0]=p=>o.value=p),placeholder:f.unref(e)("linkUrl")||"Enter URL",class:"w-full"},null,8,["modelValue","placeholder"])]),s.value?(f.openBlock(),f.createElementBlock("div",oE,[f.createElementVNode("button",{onClick:d,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none transition-colors",title:"Open link"},[...h[3]||(h[3]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[f.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4M14 4h6m0 0v6m0-6L10 14"})],-1)])]),f.createElementVNode("button",{onClick:c,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-red-600 hover:bg-red-50 focus:outline-none transition-colors",title:"Remove link"},[...h[4]||(h[4]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[f.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)])])])):f.createCommentVNode("",!0)])])]),_:1},8,["title","visible"])],64))}}),Br=async(t,e,n,r=10)=>{if(!e||!n)return;await f.nextTick();const o=await n?.getBoundingClientRect(),s=await e?.getBoundingClientRect();if(!s||!o)return;const i=await parseInt(e?.getBoundingClientRect()?.height),l=await parseInt(e?.getBoundingClientRect()?.width),a=await parseInt(n?.getBoundingClientRect()?.height),c=await parseInt(n?.getBoundingClientRect()?.width),d=await window.innerHeight,u=await window.innerWidth;let h=0,p=0;const m=s.bottom+r+a;switch(t){case"top":s.top-o.height-r<0?h=s.top-o.height+r+a+i:h=s.top-o.height-r,u>c+s.right+30?p=s.left-o.width/2+s.width/2:p=u-30-c;break;case"bottom":d>m?h=s.bottom+r:h=s.bottom-r-a-i,p=s.left-o.width/2+s.width/2;break;case"left":h=s.top-o.height/2+s.height/2,s.left-o.width-r>0?p=s.left-o.width-r:p=10;break;case"right":h=s.top-o.height/2+s.height/2,u-l>c?p=s.right+r:p=u-30-c;break;case"top-right":s.top-o.height-r<0?h=s.top-o.height+r+a+i:h=s.top-o.height-r,u-l>c?p=s.right+r:p=u-30-c;break;case"top-left":s.top-o.height-r<0?h=s.top-o.height+r+a+i:h=s.top-o.height-r,s.left-o.width-r>0?p=s.left-o.width-r:p=10;break;case"top-start":s.top-o.height-r<0?h=s.top-o.height+r+a+i:h=s.top-o.height-r,s.left>0?p=s.left:p=10;break;case"bottom-right":d>m?h=s.bottom+r:h=s.bottom-r-a-i,u-l>c?p=s.left:p=u-30-c;break;case"bottom-left":d>m?h=s.bottom+r:h=s.bottom-r-a-i,s.left>0?p=s.right-c:p=10;break;case"bottom-start":d>m?h=s.bottom+r:h=s.bottom-r-a-i,s.left>0?p=s.left:p=10;break}h+a>d?h=d-a-r:h<0&&(h=r),p+c>u?p=u-c-r:p<0&&(p=r),n instanceof HTMLElement&&(n.style.top=`${h}px`,n.style.left=`${p}px`,n.style.position="fixed")},lE={class:"text-center"},aE={class:"py-2 px-4 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},on=Object.assign({inheritAttrs:!1},{__name:"vs-popover",props:{isOpen:{type:Boolean,default:()=>!1},placement:{type:String,default:"top"},gap:{type:Number,default:8},width:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},trigger:{type:String,default:"click"},teleport:{type:String,default:"body"}},emits:["isvisible"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=f.ref(!1),i=f.ref([]),l=f.ref(null),a=f.ref(null),c=f.ref(null);f.watch(s,w=>{w?(d(),window.addEventListener("resize",()=>Br(r.placement,a.value,c.value)),Br(r.placement,a.value,c.value)):window.removeEventListener("resize",()=>Br(r.placement,a.value,c.value)),o("isvisible",w)}),f.onMounted(()=>{window.addEventListener("click",y),window.addEventListener("popstate",b),window.addEventListener("scroll",k,!0),d()}),f.onBeforeUnmount(()=>{window.removeEventListener("click",y),window.removeEventListener("popstate",b),u()});const d=()=>{let w=l.value;for(;w&&w!==document.body;)(w.scrollHeight>w.clientHeight||w.scrollWidth>w.clientWidth)&&(w.addEventListener("scroll",g),i.value.push(w)),w=w.parentElement;document.body&&(document.body.addEventListener("scroll",g),i.value.push(document.body))},u=()=>{i.value.forEach(w=>{w.removeEventListener("scroll",g)}),i.value=[]},h=()=>{s.value=!0,Br(r.placement,a.value,c.value)},p=()=>{s.value=!1},m=async()=>{await Br(r.placement,a.value,c.value),s.value=!s.value},g=()=>{s.value=!1},y=w=>{if(!w){s.value=!1;return}a.value?.contains(w.target)||c.value?.contains(w.target)||(s.value=!1)},b=()=>{s.value&&(s.value=!1)},k=w=>{s.value&&c.value&&!c.value.contains(w.target)&&(s.value=!1)};return e({togglePopover:m}),(w,C)=>(f.openBlock(),f.createElementBlock("div",{ref_key:"popover",ref:l,class:"vs-popover inline-block"},[f.createElementVNode("div",lE,[t.trigger==="click"?(f.openBlock(),f.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:a,onClick:m,class:f.normalizeClass({"pointer-events-none":t.disabled})},[f.renderSlot(w.$slots,"reference",{},()=>[C[0]||(C[0]=f.createElementVNode("button",null,"Click me!",-1))])],2)):f.createCommentVNode("",!0),t.trigger==="hover"?(f.openBlock(),f.createElementBlock("div",{key:1,ref_key:"popoverRef",ref:a,onMouseover:h,onMouseleave:p,class:f.normalizeClass({"pointer-events-none":t.disabled})},[f.renderSlot(w.$slots,"reference",{},()=>[C[1]||(C[1]=f.createElementVNode("button",null,"Click me!",-1))])],34)):f.createCommentVNode("",!0),(f.openBlock(),f.createBlock(f.Teleport,{to:t.teleport},[f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>[f.withDirectives(f.createElementVNode("div",{class:f.normalizeClass(["vsTailwind vs-popover__content",t.placement]),ref_key:"contentPop",ref:c,style:f.normalizeStyle({width:t.width?t.width+"px":"fit-content",zIndex:100001})},[f.createElementVNode("div",aE,[f.renderSlot(w.$slots,"default",{},()=>[C[2]||(C[2]=f.createElementVNode("span",null,"Popover content",-1))])])],6),[[f.vShow,s.value]])]),_:3})],8,["to"]))])],512))}}),cE={class:"flex flex-col gap-[2px] p-[2px]"},dE=["onClick"],uE={__name:"vs-editor-table",props:{editor:Object},setup(t){const{t:e}=Ol(),n=t,r=f.ref(!1),o=f.ref("popover"),s=()=>{n.editor&&(n.editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),o.value.togglePopover())},i=()=>{n.editor&&(n.editor.chain().focus().addColumnAfter().run(),o.value.togglePopover())},l=()=>{n.editor&&(n.editor.chain().focus().addRowAfter().run(),o.value.togglePopover())},a=()=>{n.editor&&(n.editor.chain().focus().deleteColumn().run(),o.value.togglePopover())},c=()=>{n.editor&&(n.editor.chain().focus().deleteRow().run(),o.value.togglePopover())},d=()=>{n.editor&&(n.editor.chain().focus().deleteTable().run(),o.value.togglePopover())},u=()=>{n.editor&&(n.editor.chain().focus().mergeCells().run(),o.value.togglePopover())},h=()=>{n.editor&&(n.editor.chain().focus().splitCell().run(),o.value.togglePopover())},p=f.computed(()=>[{text:e("createTable"),function:s},{text:e("addColumn"),function:i},{text:e("addRow"),function:l},{text:e("deleteColumn"),function:a},{text:e("deleteRow"),function:c},{text:e("deleteTable"),function:d},{text:e("mergeCells"),function:u},{text:e("splitCells"),function:h}]);return(m,g)=>(f.openBlock(),f.createBlock(on,{ref_key:"popover",ref:o,placement:"bottom",onIsvisible:g[0]||(g[0]=y=>r.value=y)},{reference:f.withCtx(()=>[f.createElementVNode("button",{title:"Table",class:f.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...g[1]||(g[1]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-table"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"}),f.createElementVNode("path",{d:"M3 10h18"}),f.createElementVNode("path",{d:"M10 3v18"})],-1)])],2)]),default:f.withCtx(()=>[f.createElementVNode("div",cE,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(p.value,(y,b)=>(f.openBlock(),f.createElementBlock("button",{key:b,onClick:y?.function,class:"px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded"},f.toDisplayString(y.text),9,dE))),128))])]),_:1},512))}},fE={},hE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-center"};function pE(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("svg",hE,[...e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M4 6l16 0"},null,-1),f.createElementVNode("path",{d:"M8 12l8 0"},null,-1),f.createElementVNode("path",{d:"M6 18l12 0"},null,-1)])])}const mE=de(fE,[["render",pE]]),gE={},yE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-right"};function bE(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("svg",yE,[...e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M4 6l16 0"},null,-1),f.createElementVNode("path",{d:"M10 12l10 0"},null,-1),f.createElementVNode("path",{d:"M6 18l14 0"},null,-1)])])}const kE=de(gE,[["render",bE]]),xE={},EE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-left"};function wE(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("svg",EE,[...e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M4 6l16 0"},null,-1),f.createElementVNode("path",{d:"M4 12l10 0"},null,-1),f.createElementVNode("path",{d:"M4 18l14 0"},null,-1)])])}const CE=de(xE,[["render",wE]]),SE={},TE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-justify"};function NE(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("svg",TE,[...e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M4 6h16"},null,-1),f.createElementVNode("path",{d:"M4 12h16"},null,-1),f.createElementVNode("path",{d:"M4 18h16"},null,-1)])])}const Hf={left:CE,center:mE,right:kE,justify:de(SE,[["render",NE]])},vE={class:"flex gap-[4px] p-1"},_E=["title","onClick"],ME={__name:"vs-editor-align",props:{editor:Object},setup(t){const e=t,n=f.ref(!1),r=f.ref("popover"),o=f.ref("left"),s=f.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"left"})||e.editor.isActive("heading",{textAlign:"left"}):!1),i=f.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"right"})||e.editor.isActive("heading",{textAlign:"right"}):!1),l=f.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"center"})||e.editor.isActive("heading",{textAlign:"center"}):!1),a=f.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"justify"})||e.editor.isActive("heading",{textAlign:"justify"}):!1),c=f.computed(()=>s.value||i.value||l.value||a.value),d=()=>{i.value?o.value="right":l.value?o.value="center":a.value?o.value="justify":o.value="left"};f.watch([s,i,l,a],()=>{d()},{immediate:!0}),f.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",d),e.editor.on("update",d))}),f.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",d),e.editor.off("update",d))});const u=p=>{e.editor&&(e.editor.chain().focus().setTextAlign(p).run(),o.value=p)},h=f.ref([{id:"left",isActive:s},{id:"center",isActive:l},{id:"right",isActive:i},{id:"justify",isActive:a}]);return(p,m)=>(f.openBlock(),f.createBlock(on,{ref_key:"popover",ref:r,placement:"bottom",onIsvisible:m[0]||(m[0]=g=>n.value=g)},{reference:f.withCtx(()=>[f.createElementVNode("button",{title:"Text Align",class:f.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[c.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(f.unref(Hf)[o.value]),{height:"16",width:"16"}))],2)]),default:f.withCtx(()=>[f.createElementVNode("div",vE,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(h.value,g=>(f.openBlock(),f.createElementBlock("button",{title:"Text align "+g?.id,class:f.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":g?.isActive}]),key:g?.id,onClick:y=>u(g?.id)},[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(f.unref(Hf)[g?.id]),{height:"16",width:"16"}))],10,_E))),128))])]),_:1},512))}},AE={class:"flex flex-col gap-[2px] p-[2px]"},OE=["onClick"],LE={__name:"vs-editor-type-tag",props:{editor:Object},setup(t){const{t:e}=Ol(),n=t,r=f.ref(!1),o=f.ref("popover"),s=()=>{n.editor&&(n.editor?.chain().focus().setParagraph().run(),o.value.togglePopover())},i=a=>{n.editor&&(n.editor?.chain().focus().toggleHeading({level:a}).run(),o.value.togglePopover())},l=f.computed(()=>[{text:e("richtext.heading1"),id:1,style:"font-[700] text-[30px]"},{text:e("richtext.heading2"),id:2,style:"font-[700] text-[26px]"},{text:e("richtext.heading3"),id:3,style:"font-[700] text-[22px]"},{text:e("richtext.heading4"),id:4,style:"font-[700] text-[18px]"},{text:e("richtext.heading5"),id:5,style:"font-[500] text-[16px]"},{text:e("richtext.heading6"),id:6,style:"font-[400] text-[14px]"}]);return(a,c)=>(f.openBlock(),f.createBlock(on,{ref_key:"popover",ref:o,placement:"bottom",onIsvisible:c[0]||(c[0]=d=>r.value=d)},{reference:f.withCtx(()=>[f.createElementVNode("button",{title:"Type Tag",class:f.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...c[1]||(c[1]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-text-size"},[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f.createElementVNode("path",{d:"M3 7v-2h13v2"}),f.createElementVNode("path",{d:"M10 5v14"}),f.createElementVNode("path",{d:"M12 19h-4"}),f.createElementVNode("path",{d:"M15 13v-1h6v1"}),f.createElementVNode("path",{d:"M18 12v7"}),f.createElementVNode("path",{d:"M17 19h2"})],-1)])],2)]),default:f.withCtx(()=>[f.createElementVNode("div",AE,[f.createElementVNode("button",{onClick:s,class:f.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded",[t.editor?.isActive("paragraph")?"bg-gray-100":""]])},f.toDisplayString(f.unref(e)("richtext.paragraph")),3),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(l.value,(d,u)=>(f.openBlock(),f.createElementBlock("button",{key:u,onClick:h=>i(d?.id),class:f.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded leading-[100%]",[d?.style,t.editor?.isActive("heading",{level:d?.id})?"bg-gray-100":""]])},f.toDisplayString(f.unref(e)(`richtext.heading${d?.id}`)),11,OE))),128))])]),_:1},512))}},IE={},DE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function RE(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("svg",DE,[...e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const Fr=de(IE,[["render",RE]]),PE={components:{VsText:$f},inheritAttrs:!1,events:["update:modelValue"],props:{modelValue:{type:String},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},isTextInputShown:{type:Boolean,default:()=>!0}},computed:{value:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}}},BE={class:"flex items-center w-full max-w-[182px]"},FE=["disabled"];function VE(t,e,n,r,o,s){const i=f.resolveComponent("vs-text");return f.openBlock(),f.createElementBlock("div",BE,[f.withDirectives(f.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=l=>s.value=l),type:"color",class:f.normalizeClass(["w-[38px] h-[38px] min-h-[38px] min-w-[38px] py-[2px] px-[3px] -ml-1 dark:bg-neutral-800 border dark:border-neutral-700 border-stone-200 rounded-lg",n.disabled?"cursor-not-allowed":"cursor-pointer"]),disabled:n.disabled},null,10,FE),[[f.vModelText,s.value]]),n.isTextInputShown?(f.openBlock(),f.createBlock(i,{key:0,modelValue:s.value,"onUpdate:modelValue":e[1]||(e[1]=l=>s.value=l),class:"ml-2 w-full",disabled:n.disabled,clearable:n.clearable},null,8,["modelValue","disabled","clearable"])):f.createCommentVNode("",!0)])}const zf=de(PE,[["render",VE]]),$E={class:"flex gap-[4px] mb-[8px]"},HE={class:"grid grid-rows-3 grid-cols-7"},zE={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},UE=["onClick","title"],jE={__name:"vs-editor-color",props:{editor:Object},setup(t){const e=t,n=f.ref("popover"),r=f.ref("#000000"),o=f.computed(()=>e.editor&&e.editor.getAttributes("textStyle").color||"#000000"),s=f.computed(()=>o.value!=="#000000"),i=()=>{e.editor&&(r.value=o.value)};f.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",i),e.editor.on("update",i),i())}),f.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",i),e.editor.off("update",i))});const l=f.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),a=u=>{e.editor&&(e.editor.chain().focus().setColor(u).run(),r.value=u,n.value&&n.value.togglePopover())},c=()=>{a(r.value)},d=u=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple","#FFFFFF":"White","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[u]||u;return(u,h)=>(f.openBlock(),f.createBlock(on,{ref_key:"popover",ref:n,placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",{title:"Text Color",class:f.normalizeClass(["flex flex-col h-[30px] min-w-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":s.value}])},[h[1]||(h[1]=f.createElementVNode("span",{class:"leading-none"},"A",-1)),f.createElementVNode("span",{class:"block h-1 w-5",style:f.normalizeStyle({backgroundColor:r.value})},null,4)],2)]),default:f.withCtx(()=>[f.createElementVNode("div",null,[f.createElementVNode("div",$E,[f.createVNode(zf,{modelValue:r.value,"onUpdate:modelValue":h[0]||(h[0]=p=>r.value=p)},null,8,["modelValue"]),f.createElementVNode("button",{onClick:c,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[f.createVNode(Fr,{class:"h-[24px] w-[24px] text-white"})])]),f.createElementVNode("div",HE,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(l.value,p=>(f.openBlock(),f.createElementBlock("div",{key:p,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[f.createElementVNode("div",zE,[f.createElementVNode("button",{class:"flex items-center justify-center w-full h-full",style:f.normalizeStyle({backgroundColor:p}),onClick:m=>a(p),title:d(p)},[r.value===p?(f.openBlock(),f.createBlock(Fr,{key:0,class:"h-5 w-5 text-gray-500"})):f.createCommentVNode("",!0)],12,UE)])]))),128))])])]),_:1},512))}},WE={class:"flex gap-[4px] mb-[8px]"},KE={class:"grid grid-rows-3 grid-cols-7"},qE={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},GE=["onClick","title"],JE=["onClick","title"],YE={__name:"vs-editor-background-color",props:{editor:Object},setup(t){const e=t,n=f.ref("popover"),r=f.ref("transparent"),o=f.computed(()=>e.editor&&e.editor.getAttributes("textStyle").backgroundColor||"transparent"),s=f.computed(()=>o.value!=="transparent"&&o.value!==""),i=()=>{e.editor&&(r.value=o.value)};f.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",i),e.editor.on("update",i),i())}),f.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",i),e.editor.off("update",i))});const l=f.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),a=u=>{e.editor&&(e.editor.chain().focus().setBackgroundColor(u).run(),r.value=u,n.value&&n.value.togglePopover())},c=()=>{a(r.value)},d=u=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple",transparent:"Transparent","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[u]||u;return(u,h)=>(f.openBlock(),f.createBlock(on,{ref_key:"popover",ref:n,placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",{title:"Background Color",class:f.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":s.value}])},[h[2]||(h[2]=f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z"}),f.createElementVNode("path",{d:"m5 2 5 5"}),f.createElementVNode("path",{d:"M2 13h15"}),f.createElementVNode("path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z"})],-1)),f.createElementVNode("span",{class:"block h-1 w-5",style:f.normalizeStyle({backgroundColor:r.value})},null,4)],2)]),default:f.withCtx(()=>[f.createElementVNode("div",null,[f.createElementVNode("div",WE,[f.createVNode(zf,{modelValue:r.value,"onUpdate:modelValue":h[0]||(h[0]=p=>r.value=p)},null,8,["modelValue"]),f.createElementVNode("button",{onClick:c,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[f.createVNode(Fr,{class:"h-[24px] w-[24px] text-white"})])]),f.createElementVNode("div",KE,[f.createElementVNode("button",{onClick:h[1]||(h[1]=p=>a("transparent")),class:"col-span-7 flex items-center justify-center gap-2 bg-gray-100 rounded-md py-1 mb-2 hover:bg-gray-200"},[...h[3]||(h[3]=[f.createElementVNode("svg",{fill:"#000000",width:"16",height:"16",viewBox:"0 0 52 52","data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg"},[f.createElementVNode("g",{id:"SVGRepo_bgCarrier","stroke-width":"0"}),f.createElementVNode("g",{id:"SVGRepo_tracerCarrier","stroke-linecap":"round","stroke-linejoin":"round"}),f.createElementVNode("g",{id:"SVGRepo_iconCarrier"},[f.createElementVNode("path",{d:"M48.5,5.6,46.4,3.5a1.67,1.67,0,0,0-2.4.3L32.59,15.21c-.77-1.3-1.51-2.61-2.21-4a36.5,36.5,0,0,1-3.15-8.36c-.13-.53-.39-.91-1-.89s-.86.4-1,.93c-.06.26-.11.51-.17.76A48.3,48.3,0,0,1,21,13.7,97.47,97.47,0,0,1,14.13,25a16,16,0,0,0-3,11.12c0,.14,0,.29.06.43L3.8,44a1.87,1.87,0,0,0-.3,2.4l2.1,2.1A1.67,1.67,0,0,0,8,48.2L48.2,8A1.67,1.67,0,0,0,48.5,5.6Z"}),f.createElementVNode("path",{d:"M38.42,23.79l-22,22.31A14.47,14.47,0,0,0,26.22,50a15.48,15.48,0,0,0,7-1.44c4.94-2.51,8.11-6.4,8.94-12A15.22,15.22,0,0,0,39,24.66C38.87,24.44,38.58,24,38.42,23.79Z"})])],-1),f.createElementVNode("p",null,"no color",-1)])]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(l.value,p=>(f.openBlock(),f.createElementBlock("div",{key:p,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[f.createElementVNode("div",qE,[p!=="transparent"?(f.openBlock(),f.createElementBlock("button",{key:0,class:"flex items-center justify-center w-full h-full",style:f.normalizeStyle({backgroundColor:p}),onClick:m=>a(p),title:d(p)},[r.value===p?(f.openBlock(),f.createBlock(Fr,{key:0,class:"h-5 w-5 text-gray-500"})):f.createCommentVNode("",!0)],12,GE)):f.createCommentVNode("",!0),p==="transparent"?(f.openBlock(),f.createElementBlock("button",{key:1,class:"flex items-center justify-center w-full h-full",onClick:m=>a(p),title:d(p)},[r.value===p?(f.openBlock(),f.createBlock(Fr,{key:0,class:"h-5 w-5 text-gray-500"})):f.createCommentVNode("",!0)],8,JE)):f.createCommentVNode("",!0)])]))),128))])])]),_:1},512))}},XE={__name:"vs-editor-highlight",props:{editor:Object},setup(t){const e=t,n=f.computed(()=>e.editor?.isActive("highlight")),r=()=>{e.editor&&e.editor.chain().focus().toggleHighlight().run()};return(o,s)=>(f.openBlock(),f.createElementBlock("button",{title:"Highlight",onClick:r,class:f.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-200":n.value}])},[...s[0]||(s[0]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{d:"m9 11-6 6v3h9l3-3"}),f.createElementVNode("path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"})],-1)])],2))}},QE={class:"truncate"},ZE={class:"w-[200px]"},ew={class:"max-h-[200px] overflow-y-auto"},tw=["onClick"],nw={__name:"vs-editor-font-family",props:{editor:Object},setup(t){const e=t,n=f.ref("popover"),r=f.ref(!1),o=f.ref([{label:"Arial",value:"Arial, sans-serif"},{label:"Helvetica",value:"Helvetica, sans-serif"},{label:"Times New Roman",value:"Times New Roman, serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Courier New",value:"Courier New, monospace"},{label:"Comic Sans MS",value:"Comic Sans MS, cursive"},{label:"Impact",value:"Impact, sans-serif"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Palatino",value:"Palatino, serif"}]),s=f.computed(()=>{if(!e.editor)return"Arial, sans-serif";for(const c of o.value)if(e.editor.isActive("textStyle",{fontFamily:c.value}))return c.value;return"Arial, sans-serif"}),i=f.computed(()=>o.value.find(d=>d.value===s.value)?.label||"Arial"),l=c=>e.editor?e.editor.isActive("textStyle",{fontFamily:c}):!1,a=c=>{e.editor&&(e.editor.chain().focus().setFontFamily(c).run(),n.value&&n.value.togglePopover())};return(c,d)=>(f.openBlock(),f.createBlock(on,{ref_key:"popover",ref:n,placement:"bottom",onIsvisible:d[0]||(d[0]=u=>r.value=u)},{reference:f.withCtx(()=>[f.createElementVNode("button",{title:"Font Family",class:f.normalizeClass(["h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm",[r.value?"bg-gray-100 text-gray-900":"text-gray-700"]]),style:f.normalizeStyle({fontFamily:s.value})},[f.createElementVNode("span",QE,f.toDisplayString(i.value),1),d[1]||(d[1]=f.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))],6)]),default:f.withCtx(()=>[f.createElementVNode("div",ZE,[f.createElementVNode("ul",ew,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(o.value,u=>(f.openBlock(),f.createElementBlock("li",{key:u.value,class:f.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",{"bg-gray-100":l(u.value)}]),style:f.normalizeStyle({fontFamily:u.value}),onClick:h=>a(u.value)},f.toDisplayString(u.label),15,tw))),128))])])]),_:1},512))}},rw={class:"w-[120px]"},ow={class:"max-h-[200px] overflow-y-auto"},sw=["onClick"],iw={__name:"vs-editor-font-size",props:{editor:Object},setup(t){const e=t,n=f.ref("popover"),r=f.ref("14px"),o=f.computed(()=>e.editor&&e.editor.getAttributes("textStyle").fontSize||"14px"),s=f.computed(()=>o.value!=="14px"),i=()=>{e.editor&&(r.value=o.value)};f.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",i),e.editor.on("update",i),i())}),f.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",i),e.editor.off("update",i))});const l=f.ref([{label:"8px",value:"8px"},{label:"9px",value:"9px"},{label:"10px",value:"10px"},{label:"11px",value:"11px"},{label:"12px",value:"12px"},{label:"14px",value:"14px"},{label:"16px",value:"16px"},{label:"18px",value:"18px"},{label:"20px",value:"20px"},{label:"24px",value:"24px"},{label:"28px",value:"28px"},{label:"32px",value:"32px"},{label:"36px",value:"36px"},{label:"48px",value:"48px"},{label:"72px",value:"72px"}]),a=c=>{e.editor&&(e.editor.chain().focus().setFontSize(c).run(),r.value=c,n.value&&n.value.togglePopover())};return(c,d)=>(f.openBlock(),f.createBlock(on,{ref_key:"popover",ref:n,placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",{title:"Font Size",class:f.normalizeClass(["h-[30px] px-2 min-w-[30px] rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700 space-x-1",{"bg-gray-100 text-gray-900":s.value}])},[...d[0]||(d[0]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-alarge-small-icon lucide-a-large-small"},[f.createElementVNode("path",{d:"m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16"}),f.createElementVNode("path",{d:"M15.697 14h5.606"}),f.createElementVNode("path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16"}),f.createElementVNode("path",{d:"M3.304 13h6.392"})],-1),f.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1)])],2)]),default:f.withCtx(()=>[f.createElementVNode("div",rw,[f.createElementVNode("ul",ow,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(l.value,u=>(f.openBlock(),f.createElementBlock("li",{key:u.value,class:"px-3 py-2 hover:bg-gray-100 cursor-pointer",onClick:h=>a(u.value)},f.toDisplayString(u.label),9,sw))),128))])])]),_:1},512))}},lw={props:{editor:Object},methods:{toggleSuperscript(){this.editor&&this.editor.commands.toggleSuperscript()}}};function aw(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("button",{title:"Superscript",onClick:e[0]||(e[0]=(...i)=>s.toggleSuperscript&&s.toggleSuperscript(...i)),class:f.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("superscript")}])},[...e[1]||(e[1]=[f.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-superscript-icon lucide-superscript"><path d="m4 19 8-8"></path><path d="m12 19-8-8"></path><path d="M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06"></path></svg><span class="sr-only">Superscript</span>',2)])],2)}const cw=de(lw,[["render",aw]]),dw={props:{editor:Object},methods:{toggleSubscript(){this.editor&&this.editor.commands.toggleSubscript()}}};function uw(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("button",{title:"Subscript",onClick:e[0]||(e[0]=(...i)=>s.toggleSubscript&&s.toggleSubscript(...i)),class:f.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("subscript")}])},[...e[1]||(e[1]=[f.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-subscript-icon lucide-subscript"><path d="m4 5 8 8"></path><path d="m12 5-8 8"></path><path d="M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07"></path></svg><span class="sr-only">Subscript</span>',2)])],2)}const fw=de(dw,[["render",uw]]),hw={title:"Heading",class:"h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700"},pw={class:"truncate"},mw={class:"max-h-[200px] overflow-y-auto"},gw=["onClick"],yw=de({__name:"vs-editor-heading",props:{editor:Object},setup(t){const e=t,n=f.ref("popover"),r=f.ref([{label:"Heading 1",value:1},{label:"Heading 2",value:2},{label:"Heading 3",value:3},{label:"Heading 4",value:4},{label:"Heading 5",value:5},{label:"Heading 6",value:6}]),o=f.computed(()=>{if(!e.editor)return"Paragraph";for(let a=1;a<=6;a++)if(e.editor.isActive("heading",{level:a}))return`H ${a}`;return"P"}),s=a=>({1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"})[a]||"",i=a=>{e.editor&&(e.editor.chain().focus().setHeading({level:a}).run(),n.value&&n.value.togglePopover())},l=()=>{e.editor&&(e.editor.chain().focus().setParagraph().run(),n.value&&n.value.togglePopover())};return(a,c)=>(f.openBlock(),f.createBlock(on,{ref_key:"popover",ref:n,placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",hw,[f.createElementVNode("span",pw,f.toDisplayString(o.value),1),c[0]||(c[0]=f.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))])]),default:f.withCtx(()=>[f.createElementVNode("div",null,[f.createElementVNode("ul",mw,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.value,d=>(f.openBlock(),f.createElementBlock("li",{key:d.value,class:f.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",`heading-level-${d.value}`]),style:f.normalizeStyle(s(d.value)),onClick:u=>i(d.value)},f.toDisplayString(d.label),15,gw))),128)),f.createElementVNode("li",{class:"px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm border-t border-gray-200 mt-1 pt-2",onClick:l}," Paragraph ")])])]),_:1},512))}},[["__scopeId","data-v-ef7c378e"]]),bw={props:{editor:Object},methods:{clearFormatting(){this.editor&&this.editor.commands.unsetAllMarks()}}};function kw(t,e,n,r,o,s){return f.openBlock(),f.createElementBlock("button",{title:"Clear Formatting",onClick:e[0]||(e[0]=(...i)=>s.clearFormatting&&s.clearFormatting(...i)),class:"h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100"},[...e[1]||(e[1]=[f.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-remove-formatting-icon lucide-remove-formatting"><path d="M4 7V4h16v3"></path><path d="M5 20h6"></path><path d="M13 4 8 20"></path><path d="m15 15 5 5"></path><path d="m20 15-5 5"></path></svg><span class="sr-only">Clear Formatting</span>',2)])])}const xw=de(bw,[["render",kw]]),Ew={class:"relative"},ww={class:"space-y-4"},Cw={key:0,class:"mt-4"},Sw=["src","alt","title"],Tw={key:0,class:"text-sm text-red-500"},Nw=Object.assign({inheritAttrs:!1},{__name:"vs-editor-image",props:{editor:{type:Object,required:!0}},setup(t){const e=t,n=f.ref(!1),r=f.ref(!1),o=f.ref({src:"",alt:"",title:""}),s=()=>{o.value={src:"",alt:"",title:""},r.value=!1,n.value=!0},i=()=>{n.value=!1,r.value=!1},l=()=>{if(!o.value.src){alert("Please enter an image URL");return}e.editor&&e.editor.chain().focus().setImage({src:o.value.src,alt:o.value.alt||"",title:o.value.title||""}).run(),i()},a=()=>{l()},c=()=>{i()};return f.watch(()=>o.value.src,()=>{r.value=!1}),(d,u)=>(f.openBlock(),f.createElementBlock("div",Ew,[f.createElementVNode("button",{onClick:s,class:f.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",t.editor?.isActive("image")?"bg-gray-200 text-gray-900":""]),title:"Add Image"},[...u[5]||(u[5]=[f.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"></rect><circle cx="9" cy="9" r="2"></circle><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"></path></svg><span class="sr-only">Add Image</span>',2)])],2),f.createVNode(Vf,{modelValue:n.value,"onUpdate:modelValue":u[4]||(u[4]=h=>n.value=h),title:"Add Image"},{footer:f.withCtx(()=>[f.createElementVNode("button",{onClick:c,type:"button",class:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"}," Cancel "),f.createElementVNode("button",{onClick:a,type:"button",class:"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500"}," Add Image ")]),default:f.withCtx(()=>[f.createElementVNode("div",ww,[f.createElementVNode("div",null,[u[6]||(u[6]=f.createElementVNode("label",{for:"imageUrl",class:"block text-sm font-medium text-gray-700 mb-1"}," Image URL ",-1)),f.withDirectives(f.createElementVNode("input",{id:"imageUrl","onUpdate:modelValue":u[0]||(u[0]=h=>o.value.src=h),type:"url",placeholder:"https://example.com/image.png",class:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",required:""},null,512),[[f.vModelText,o.value.src]])]),f.createElementVNode("div",null,[u[7]||(u[7]=f.createElementVNode("label",{for:"imageAlt",class:"block text-sm font-medium text-gray-700 mb-1"}," Alt Text ",-1)),f.withDirectives(f.createElementVNode("input",{id:"imageAlt","onUpdate:modelValue":u[1]||(u[1]=h=>o.value.alt=h),type:"text",placeholder:"Description of the image",class:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"},null,512),[[f.vModelText,o.value.alt]])]),f.createElementVNode("div",null,[u[8]||(u[8]=f.createElementVNode("label",{for:"imageTitle",class:"block text-sm font-medium text-gray-700 mb-1"}," Title (optional) ",-1)),f.withDirectives(f.createElementVNode("input",{id:"imageTitle","onUpdate:modelValue":u[2]||(u[2]=h=>o.value.title=h),type:"text",placeholder:"Image title",class:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"},null,512),[[f.vModelText,o.value.title]])]),o.value.src?(f.openBlock(),f.createElementBlock("div",Cw,[u[9]||(u[9]=f.createElementVNode("p",{class:"text-sm text-gray-600 mb-2"},"Preview:",-1)),f.withDirectives(f.createElementVNode("img",{src:o.value.src,alt:o.value.alt||"Image preview",title:o.value.title,class:"max-w-full h-auto max-h-32 rounded border",onError:u[3]||(u[3]=h=>r.value=!0)},null,40,Sw),[[f.vShow,!r.value]]),r.value?(f.openBlock(),f.createElementBlock("p",Tw," Failed to load image preview ")):f.createCommentVNode("",!0)])):f.createCommentVNode("",!0)])]),_:1},8,["modelValue"])]))}}),vw={class:"flex items-center"},_w=["disabled"],Mw=["disabled"],Aw=de(Object.assign({inheritAttrs:!1},{__name:"vs-editor-history",props:{editor:Object},setup(t){const e=t,n=()=>{e.editor?.can().undo()&&e.editor.chain().focus().undo().run()},r=()=>{e.editor?.can().redo()&&e.editor.chain().focus().redo().run()};return(o,s)=>(f.openBlock(),f.createElementBlock("div",vw,[f.createElementVNode("button",{onClick:n,class:f.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-l-full hover:text-gray-900 hover:bg-gray-100 border-r border-gray-200",[t.editor?.can().undo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!t.editor?.can().undo(),title:"Undo (Ctrl+Z)"},[...s[0]||(s[0]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{d:"M3 7v6h6"}),f.createElementVNode("path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"})],-1)])],10,_w),f.createElementVNode("button",{onClick:r,class:f.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-r-full hover:text-gray-900 hover:bg-gray-100",[t.editor?.can().redo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!t.editor?.can().redo(),title:"Redo (Ctrl+Y)"},[...s[1]||(s[1]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{d:"M21 7v6h-6"}),f.createElementVNode("path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"})],-1)])],10,Mw)]))}}),[["__scopeId","data-v-b5a7cc5a"]]),Ow={class:"relative"},Lw=de(Object.assign({inheritAttrs:!1},{__name:"vs-editor-help",props:{editor:Object},setup(t){const e=f.ref(!1),n=f.ref(null),r=()=>{e.value=!e.value},o=()=>{e.value=!1};return(s,i)=>(f.openBlock(),f.createElementBlock("div",Ow,[f.createElementVNode("button",{ref_key:"helpButton",ref:n,onClick:r,class:f.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 text-gray-500",[e.value?"bg-gray-100 text-gray-900":"text-gray-500"]]),title:"Markdown Shortcuts Help"},[...i[1]||(i[1]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),f.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),f.createElementVNode("line",{x1:"12",x2:"12.01",y1:"17",y2:"17"})],-1)])],2),e.value?(f.openBlock(),f.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[100001]",onClick:o},[f.createElementVNode("div",{class:"bg-white rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] overflow-y-auto",onClick:i[0]||(i[0]=f.withModifiers(()=>{},["stop"]))},[f.createElementVNode("div",{class:"p-6"},[f.createElementVNode("div",{class:"flex justify-between items-center mb-4"},[i[3]||(i[3]=f.createElementVNode("h2",{class:"text-xl font-semibold text-gray-900"},"Common Markdown Syntax & Shortcuts",-1)),f.createElementVNode("button",{onClick:o,class:"text-gray-400 hover:text-gray-600 transition-colors"},[...i[2]||(i[2]=[f.createElementVNode("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[f.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),i[4]||(i[4]=f.createStaticVNode('<div class="space-y-6" data-v-72ce3024><div data-v-72ce3024><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-72ce3024>Markdown Syntax</h3><div class="overflow-x-auto" data-v-72ce3024><table class="w-full border-collapse" data-v-72ce3024><thead data-v-72ce3024><tr class="bg-gray-50" data-v-72ce3024><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Element</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Example</th></tr></thead><tbody class="text-sm" data-v-72ce3024><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Bold</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>**bold text**</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>__bold text__</code></td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Italics</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>*italic text*</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>_italic text_</code></td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Strikethrough</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>~strikethrough text~</code></td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Headings</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024># Heading 1</code>, <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>## Heading 2</code>, etc., up to <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>###### Heading 6</code></td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Unordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use an asterisk (*), dash (-), or plus sign (+) followed by a space. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Ordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use a number followed by a period and a space (e.g., <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>1. First item</code>). </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Blockquotes</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Start with a greater-than sign (>) followed by a space. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Inline Code</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Surround with backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>`</code>). </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Code Blocks</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Enclose with three backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>```</code>) before and after the code. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Images</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024></code> syntax. </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Links</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>[Link Text](url)</code> syntax. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Checklists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Create a list item with <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>- [ ]</code> for an incomplete task or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>- [x]</code> for a completed one. </td></tr></tbody></table></div></div><div data-v-72ce3024><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-72ce3024>Common Editing Shortcuts</h3><div class="overflow-x-auto" data-v-72ce3024><table class="w-full border-collapse" data-v-72ce3024><thead data-v-72ce3024><tr class="bg-gray-50" data-v-72ce3024><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Shortcut</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Action</th></tr></thead><tbody class="text-sm" data-v-72ce3024><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+A</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Select all text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+B</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Apply bold formatting</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+C</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Copy selected text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+I</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Apply italic formatting</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+K</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Open the insert link dialog</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+S</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Save the current document</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+V</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Paste copied text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+X</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Cut selected text</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+Y</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Redo the last action</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Alt+Shift+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Redo the last action</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+Z</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Undo the last action</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Alt+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Undo the last action</td></tr></tbody></table></div></div></div>',1))])])])):f.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-72ce3024"]]),Iw={__name:"vs-editor-horizontal-rule",props:{editor:Object},setup(t){const e=t,n=()=>{e.editor&&e.editor.chain().focus().setHorizontalRule().run()};return(r,o)=>(f.openBlock(),f.createElementBlock("button",{title:"Horizontal Rule",onClick:n,class:"flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex"},[...o[0]||(o[0]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("line",{x1:"3",x2:"21",y1:"12",y2:"12"})],-1)])]))}},Dw={__name:"vs-editor-fullscreen",props:{editor:Object},emits:["toggle-fullscreen"],setup(t,{emit:e}){const n=e,r=()=>{n("toggle-fullscreen")};return(o,s)=>(f.openBlock(),f.createElementBlock("button",{title:"Fullscreen",onClick:r,class:"w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100"},[...s[0]||(s[0]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})],-1)])]))}},Rw=["title"],Pw={class:"vs-editor-html-mode__text"},Uf={bold:Tx,italic:_x,color:jE,background_color:YE,highlight:XE,bullet_list:gx,ordered_list:kx,blockquote:hx,codeblock:wx,underline:Mx,strike:Ax,link:iE,table:uE,text_align:ME,type_tag:LE,font_family:nw,font_size:iw,superscript:cw,subscript:fw,heading:yw,clear_formatting:xw,image:Nw,history:Aw,help:Lw,horizontal_rule:Iw,fullscreen:Dw,html_mode:de({__name:"vs-editor-html-mode",props:{editor:{type:Object,required:!0}},emits:["toggle-html-mode"],setup(t,{emit:e}){const n=e,r=f.ref(!1),o=()=>{r.value=!r.value,n("toggle-html-mode",r.value)};return(s,i)=>(f.openBlock(),f.createElementBlock("button",{onClick:o,class:f.normalizeClass([{"is-active":r.value},"vs-editor-html-mode"]),type:"button",title:r.value?"Switch to Rich Text Mode":"Switch to HTML Mode"},[i[0]||(i[0]=f.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[f.createElementVNode("polyline",{points:"16,18 22,12 16,6"}),f.createElementVNode("polyline",{points:"8,6 2,12 8,18"})],-1)),f.createElementVNode("span",Pw,f.toDisplayString((r.value,"HTML")),1)],10,Rw))}},[["__scopeId","data-v-99a48167"]]),tab:Object.assign({inheritAttrs:!1},{__name:"vs-editor-tab",props:{editor:{type:Object,required:!0}},setup(t){const e=t,n=()=>{e.editor&&(e.editor.isActive("bulletList")||e.editor.isActive("orderedList"))&&e.editor.chain().focus().sinkListItem("listItem").run()};return(r,o)=>(f.openBlock(),f.createElementBlock("button",{title:"Tab (Increase List Indent)",onClick:n,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none"},[...o[0]||(o[0]=[f.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-indent-increase"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M20 6l-11 0"></path><path d="M20 12l-7 0"></path><path d="M20 18l-11 0"></path><path d="M4 8l4 4l-4 4"></path></svg>',1)])]))}})},ws={basic:["history","font_family","font_size","bold","italic","underline","strike","text_align","bullet_list","ordered_list","link","image","clear_formatting","help"],default:["history","heading","font_family","font_size","bold","italic","underline","strike","superscript","subscript","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","clear_formatting","fullscreen","help","html_mode"],full:["history","heading","font_family","font_size","bold","italic","underline","strike","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","superscript","subscript","clear_formatting","fullscreen","help","html_mode"]},Bw=de({__name:"monaco-editor",props:{modelValue:{type:String,default:""},height:{type:String,default:"280px"},language:{type:String,default:"html"},theme:{type:String,default:"vs"}},emits:["update:modelValue","change"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=f.ref(null);let i=null,l=null,a=!1,c=null;const d=()=>{const P=document.querySelector("link[data-monaco-editor-css]");if(!P)return!1;try{return P.sheet||P.styleSheet||P.href}catch{return!1}},u=()=>d()?new Promise(P=>setTimeout(P,50)):new Promise((P,D)=>{const K=document.createElement("link");K.rel="stylesheet",K.href="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/editor/editor.main.css",K.setAttribute("data-monaco-editor-css","true");const re=()=>{const je=()=>{d()?setTimeout(()=>P(),100):setTimeout(je,50)};je()};K.addEventListener?(K.addEventListener("load",re),K.addEventListener("error",()=>D(new Error("Failed to load Monaco Editor CSS")))):(K.onload=re,K.onerror=()=>D(new Error("Failed to load Monaco Editor CSS"))),document.head.appendChild(K);let Z=0;const Ue=20,Me=setInterval(()=>{Z++,d()?(clearInterval(Me),setTimeout(()=>P(),100)):Z>=Ue&&(clearInterval(Me),setTimeout(()=>P(),100))},50)}),h=()=>document.querySelector("script[data-monaco-editor-loader]")?Promise.resolve():new Promise((D,K)=>{const re=document.createElement("script");re.src="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/loader.js",re.setAttribute("data-monaco-editor-loader","true"),re.onload=()=>D(),re.onerror=()=>K(new Error("Failed to load Monaco Editor loader")),document.head.appendChild(re)}),p=()=>c||(window.monaco&&window.monaco.editor?(l=window.monaco,Promise.resolve(l)):(c=new Promise((P,D)=>{if(a){const K=setInterval(()=>{window.monaco&&window.monaco.editor&&(clearInterval(K),l=window.monaco,P(l))},50);return}a=!0,u().then(()=>h()).then(()=>{const K=setInterval(()=>{window.require&&(clearInterval(K),window.require.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}}),window.require(["vs/editor/editor.main"],()=>{l=window.monaco,a=!1,P(l)},re=>{a=!1,console.error("Failed to load Monaco Editor:",re),D(re)}))},50);setTimeout(()=>{clearInterval(K),a=!1,D(new Error("Monaco Editor loader not found"))},1e4)}).catch(K=>{a=!1,D(K)})}),c)),m=P=>{try{const D=document.createElement("div");D.innerHTML=P;const K=(Z,Ue=0)=>{const Me=" ".repeat(Ue);let je="";if(Z.nodeType===Node.TEXT_NODE){const at=Z.textContent.trim();return at&&(je+=Me+at+`
|
|
105
|
-
`),je}if(Z.nodeType===Node.ELEMENT_NODE){const at=Z.tagName.toLowerCase(),Ve=Array.from(Z.attributes).map(cn=>`${cn.name}="${cn.value}"`).join(" "),an=Z.children.length>0;Z.textContent.trim()&&!an?je+=Me+`<${at}${Ve?" "+Ve:""}>${Z.textContent}</${at}>
|
|
106
|
-
`:an?(je+=Me+`<${at}${Ve?" "+Ve:""}>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
`}return je};let re="";return Array.from(D.childNodes).forEach(Z=>{re+=K(Z)}),re.trim()}catch(D){return console.warn("HTML formatting error:",D),P}},g=async()=>{if(!s.value)return;if(!l)try{await p();let D=!1,K=0;for(;!D&&K<10;){const re=document.querySelector("link[data-monaco-editor-css]");if(re&&(re.sheet||re.styleSheet))try{const Z=re.sheet||re.styleSheet;Z&&Z.cssRules&&Z.cssRules.length>0&&(D=!0)}catch{D=!0}D||(await new Promise(Z=>setTimeout(Z,50)),K++)}}catch(D){console.error("Failed to load Monaco Editor:",D);return}const P=r.language;if(i=l.editor.create(s.value,{value:r.modelValue,language:P,theme:r.theme,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on",lineNumbers:"on",folding:!0,lineDecorationsWidth:0,lineNumbersMinChars:3,renderLineHighlight:"line",selectOnLineNumbers:!0,roundedSelection:!1,readOnly:!1,cursorStyle:"line",cursorBlinking:"blink",cursorSmoothCaretAnimation:!0,cursorWidth:1,fontFamily:"'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace",fontSize:13,lineHeight:1.5,tabSize:2,insertSpaces:!0,detectIndentation:!1,trimAutoWhitespace:!0,formatOnPaste:!0,formatOnType:!0,autoClosingBrackets:"always",autoClosingQuotes:"always",autoSurround:"languageDefined",bracketPairColorization:{enabled:!0},guides:{bracketPairs:!0,indentation:!0},fixedOverflowWidgets:!1,overflowWidgetsDomNode:s.value,suggest:{showKeywords:!0,showSnippets:!0,showClasses:!0,showFunctions:!0,showVariables:!0,showModules:!0,showProperties:!0,showEvents:!0,showOperators:!0,showUnits:!0,showValues:!0,showColors:!0,showFiles:!0,showReferences:!0,showFolders:!0,showTypeParameters:!0,showIssues:!0,showUsers:!0,showWords:!0,showCustomcolors:!0,showInterfaces:!0,showText:!0,showEnums:!0,showStructs:!0,showTypeAliases:!0,showConstants:!0,showConstructors:!0,showFields:!0,showMethods:!0,showNamespaces:!0,showPackages:!0,showSymbols:!0,showTypeParameters:!0},quickSuggestions:{other:!0,comments:!1,strings:!0},html:{format:{enable:!0,tabSize:2,insertSpaces:!0,wrapLineLength:120,unformatted:"default",contentUnformatted:"pre,code,textarea",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:2,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},suggest:{html5:!0,angular1:!1,ionic:!1},validate:{scripts:!0,styles:!0}},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8,useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,verticalSliderSize:4,horizontalSliderSize:4,arrowSize:0,verticalSliderHasArrows:!1,horizontalSliderHasArrows:!1}}),r.language==="html"){l.languages.register({id:"html"}),l.languages.setMonarchTokensProvider("html",{tokenizer:{root:[[/<!--/,"comment","@comment"],[/<[^>]+>/,"tag"],[/\w+\s*=\s*"[^"]*"/,"attribute"],[/\w+\s*=\s*'[^']*'/,"attribute"],[/"[^"]*"/,"string"],[/'[^']*'/,"string"],[/\b(doctype|html|head|body|title|meta|link|script|style|div|span|p|h1|h2|h3|h4|h5|h6|ul|ol|li|table|tr|td|th|form|input|button|img|a|br|hr)\b/i,"keyword"],[/\d+/,"number"],[/\s+/,"white"],[/./,"text"]],comment:[[/-->/,"comment","@pop"],[/./,"comment"]]}});try{l.languages.setLanguageConfiguration("html",{wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{blockComment:["<!--","-->"]},brackets:[["<",">"],["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"<",close:">",notIn:["string"]},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string"]}],surroundingPairs:[{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"}]})}catch(D){console.warn("HTML language configuration failed:",D)}}i.onDidChangeModelContent(()=>{const D=i.getValue();o("update:modelValue",D),o("change",D)})},y=P=>{i&&P!==i.getValue()&&i.setValue(P)},b=P=>{if(i&&l)if(r.language==="html"){const D=P==="vs-dark"||P==="hc-black";l.editor.defineTheme("html-custom",{base:D?"vs-dark":"vs",inherit:!0,rules:[{token:"tag",foreground:D?"#4FC1FF":"#0066CC",fontStyle:"bold"},{token:"attribute",foreground:D?"#9CDCFE":"#0000FF"},{token:"string",foreground:D?"#FF6B6B":"#CC0000"},{token:"comment",foreground:D?"#6A9955":"#008000",fontStyle:"italic"},{token:"keyword",foreground:D?"#FFA500":"#FF6600",fontStyle:"bold"},{token:"number",foreground:D?"#B5CEA8":"#098658"},{token:"text",foreground:D?"#D4D4D4":"#000000"},{token:"white",foreground:D?"#D4D4D4":"#000000"}],colors:{"editor.background":D?"#1e1e1e":"#ffffff","editor.foreground":D?"#d4d4d4":"#000000"}}),l.editor.setTheme("html-custom")}else l.editor.setTheme(P)},k=P=>{i&&l&&l.editor.setModelLanguage(i.getModel(),P)},w=()=>{i&&i.focus()},C=()=>i?i.getPosition():null,T=P=>{i&&P&&(i.setPosition(P),i.revealPosition(P))},_=()=>{if(i){const P=i.getSelection();return i.getModel().getValueInRange(P)}return""},S=P=>{if(i){const D=i.getSelection();i.executeEdits("replace-selection",[{range:D,text:P,forceMoveMarkers:!0}])}},I=()=>{if(i){const P=i.getValue(),D=m(P);D!==P&&(i.setValue(D),i.setPosition({lineNumber:1,column:1}))}},F=()=>{if(r.language==="html"&&l)try{l.languages.registerCompletionItemProvider("html",{provideCompletionItems:(P,D)=>({suggestions:[{label:"class",kind:l.languages.CompletionItemKind.Property,insertText:'class="$1"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"CSS class attribute"},{label:"id",kind:l.languages.CompletionItemKind.Property,insertText:'id="$1"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Unique identifier"},{label:"style",kind:l.languages.CompletionItemKind.Property,insertText:'style="$1"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Inline CSS styles"},{label:"data-*",kind:l.languages.CompletionItemKind.Property,insertText:'data-$1="$2"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Custom data attribute"}]})})}catch(P){console.warn("HTML completion provider failed:",P)}},J=()=>{i&&i.layout()};return f.onMounted(async()=>{await f.nextTick();try{await p(),await f.nextTick(),await g(),F(),window.addEventListener("resize",J)}catch(P){console.error("Failed to initialize Monaco Editor:",P)}}),f.onUnmounted(()=>{i&&i.dispose(),window.removeEventListener("resize",J)}),f.watch(()=>r.modelValue,y),f.watch(()=>r.theme,b),f.watch(()=>r.language,k),f.watch(()=>r.height,()=>{f.nextTick(()=>{J()})}),e({editor:i,focus:w,getPosition:C,setPosition:T,getSelectedText:_,replaceSelection:S,formatCode:I}),(P,D)=>(f.openBlock(),f.createElementBlock("div",{ref_key:"monacoContainer",ref:s,class:"monaco-editor-container",style:f.normalizeStyle({height:t.height})},null,4))}},[["__scopeId","data-v-b1d773a1"]]),Fw={class:"flex align-middle gap-x-0.5 border-b flex-wrap border-b-gray-200 px-[10px] py-[6px] border-solid border-transparent"},Vw={key:1,class:"html-source-editor"},Cs=Object.assign({inheritAttrs:!1},{__name:"vs-richtext",props:f.mergeModels({modelValue:{type:String,default:()=>""},height:{type:String,default:()=>"300px"},toolbar:{type:[Array,String],default:()=>"default"}},{modelValue:{},modelModifiers:{}}),emits:f.mergeModels(["update:modelValue"],["update:modelValue"]),setup(t){const e=t,n=f.useModel(t,"modelValue"),{editor:r,editorInstance:o,focusEditor:s}=Pf(e),{isHtmlMode:i,htmlContent:l,htmlTextarea:a,toggleHtmlMode:c,onHtmlInput:d}=Bf(r,(g,y)=>{g==="update:modelValue"&&(n.value=y)}),{isFullscreen:u,toggleFullscreen:h}=Ff(),p=f.computed(()=>typeof e.toolbar=="string"?ws[e.toolbar]||ws.default:e.toolbar),m=f.computed(()=>p.value.map(g=>Uf[g]).filter(Boolean));return f.watch(()=>e.modelValue,g=>{if(r.value){const y=g||"",b=r.value.getHTML();y!==b&&y!=="<p></p>"&&r.value.commands.setContent(y,!1)}},{immediate:!0}),f.watch(r,g=>{g&&r.value.on("update",y=>{const b=y.editor.getHTML();b!==e.modelValue&&b!=="<p></p>"&&(n.value=b)})}),(g,y)=>(f.openBlock(),f.createElementBlock("div",{class:f.normalizeClass(["bg-white border border border-solid border-gray-200 rounded-xl w-full",{"fixed left-0 right-0 top-0 bottom-0 z-[100000]":f.unref(u)}])},[f.createElementVNode("div",Fw,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(m.value,b=>(f.openBlock(),f.createElementBlock(f.Fragment,{key:b},[f.unref(r)?(f.openBlock(),f.createBlock(f.resolveDynamicComponent(b),{key:0,editor:f.unref(o),onToggleFullscreen:f.unref(h),onToggleHtmlMode:f.unref(c)},null,40,["editor","onToggleFullscreen","onToggleHtmlMode"])):f.createCommentVNode("",!0)],64))),128))]),f.createElementVNode("div",{onClick:y[2]||(y[2]=(...b)=>f.unref(s)&&f.unref(s)(...b)),class:"relative w-full px-4 py-2 bg-white rounded-b-lg editor-content dark:bg-gray-800",style:f.normalizeStyle({height:f.unref(u)?"95vh":t.height})},[f.unref(i)?(f.openBlock(),f.createElementBlock("div",Vw,[f.createVNode(Bw,{ref_key:"htmlTextarea",ref:a,modelValue:f.unref(l),"onUpdate:modelValue":y[0]||(y[0]=b=>f.isRef(l)?l.value=b:null),height:f.unref(u)?"calc(95vh - 100px)":"100%",language:"html",theme:"vs",onChange:y[1]||(y[1]=b=>f.unref(d)(b))},null,8,["modelValue","height"])])):(f.openBlock(),f.createBlock(f.unref(Nu),{key:0,editor:f.unref(r),class:"relative w-full"},null,8,["editor"]))],4)],2))}}),$w={class:"bg-white border-b flex-wrap border-b-gray-200 px-[10px] py-3 border-solid border-transparent"},Hw={class:"flex flex-col mx-auto max-w-6xl"},zw={class:"flex justify-center gap-x-2"},jf=Object.assign({inheritAttrs:!1},{__name:"vs-richtext-page",props:f.mergeModels({modelValue:{type:String,default:()=>""},height:{type:String,default:()=>"min-h-[800px]"},width:{type:String,default:()=>"max-w-4xl"}},{modelValue:{},modelModifiers:{}}),emits:f.mergeModels(["update:modelValue"],["update:modelValue"]),setup(t){const e=t,n=f.useModel(t,"modelValue"),r=["history","heading","font_family","font_size","bold","italic","underline","strike","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table"],{editor:o,editorInstance:s,focusEditor:i}=Pf(e),{toggleHtmlMode:l}=Bf(o,(u,h)=>{u==="update:modelValue"&&(n.value=h)}),{toggleFullscreen:a}=Ff(),c=f.computed(()=>typeof r=="string"?ws[r]||ws.default:r),d=f.computed(()=>c.value.map(u=>Uf[u]).filter(Boolean));return f.watch(()=>e.modelValue,u=>{if(o.value){const h=u||"",p=o.value.getHTML();h!==p&&h!=="<p></p>"&&o.value.commands.setContent(h,!1)}},{immediate:!0}),f.watch(o,u=>{u&&o.value.on("update",h=>{const p=h.editor.getHTML();p!==e.modelValue&&p!=="<p></p>"&&(n.value=p)})}),(u,h)=>(f.openBlock(),f.createElementBlock("div",f.mergeProps(u.$attrs,{class:["w-full bg-[#f1f5f9] flex flex-col overflow-hidden",t.height]}),[f.createElementVNode("div",$w,[f.createElementVNode("div",Hw,[f.renderSlot(u.$slots,"header"),f.createElementVNode("div",zw,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(d.value,p=>(f.openBlock(),f.createElementBlock(f.Fragment,{key:p},[f.unref(o)?(f.openBlock(),f.createBlock(f.resolveDynamicComponent(p),{key:0,editor:f.unref(s),onToggleFullscreen:f.unref(a),onToggleHtmlMode:f.unref(l)},null,40,["editor","onToggleFullscreen","onToggleHtmlMode"])):f.createCommentVNode("",!0)],64))),128))])])]),f.createElementVNode("div",{onClick:h[0]||(h[0]=(...p)=>f.unref(i)&&f.unref(i)(...p)),class:"relative w-full h-full px-6 py-8 flex justify-center rounded-b-lg editor-page-content dark:bg-gray-800 max-h-[95vh]"},[f.createVNode(f.unref(Nu),{editor:f.unref(o),class:f.normalizeClass(["relative w-full bg-white shadow-lg rounded-lg min-h-[800px] h-[fit-content] p-16",[t.width]])},null,8,["editor","class"])])],16))}});/*!
|
|
118
|
+
3. "-" cannot repeat`);Ve.customSchemes.push([n,e])}function Ux(){Ve.scanner=Dx(Ve.customSchemes);for(let n=0;n<Ve.tokenQueue.length;n++)Ve.tokenQueue[n][1]({scanner:Ve.scanner});Ve.parser=Px(Ve.scanner.tokens);for(let n=0;n<Ve.pluginQueue.length;n++)Ve.pluginQueue[n][1]({scanner:Ve.scanner,parser:Ve.parser});return Ve.initialized=!0,Ve}function Sa(n){return Ve.initialized||Ux(),$x(Ve.parser.start,n,cp(Ve.scanner.start,n))}Sa.scan=cp;function gp(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new va(t),o=Sa(n),s=[];for(let l=0;l<o.length;l++){const a=o[l];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var Na="[\0- -\u2029 ]",Wx=new RegExp(Na),Kx=new RegExp(`${Na}$`),qx=new RegExp(Na,"g");function Gx(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function Jx(n){return new Oe({key:new $e("autolink"),appendTransaction:(e,t,r)=>{const o=e.some(d=>d.docChanged)&&!t.doc.eq(r.doc),s=e.some(d=>d.getMeta("preventAutolink"));if(!o||s)return;const{tr:l}=r,a=tf(t.doc,[...e]);if(ff(a).forEach(({newRange:d})=>{const u=Ib(r.doc,d,h=>h.isTextblock);let f,p;if(u.length>1)f=u[0],p=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(d.from,d.to," "," ");if(!Kx.test(h))return;f=u[0],p=r.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(Wx).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],g=f.pos+p.lastIndexOf(m);if(!m)return!1;const y=Sa(m).map(b=>b.toObject(n.defaultProtocol));if(!Gx(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{zi(b.from,b.to,r.doc).some(k=>k.mark.type===n.type)||l.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!l.steps.length)return l}})}function Yx(n){return new Oe({key:new $e("handleClickLink"),props:{handleClick:(e,t,r)=>{var o,s;if(r.button!==0||!e.editable)return!1;let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{let u=r.target;const f=[];for(;u.nodeName!=="DIV";)f.push(u),u=u.parentNode;l=f.find(p=>p.nodeName==="A")}if(!l)return!1;const a=uf(e.state,n.type.name),c=(o=l?.href)!=null?o:a.href,d=(s=l?.target)!=null?s:a.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),l&&c?(window.open(c,d),!0):!1}}})}function Xx(n){return new Oe({key:new $e("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(d=>{a+=d.textContent});const c=gp(a,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!c?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function hr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&t.push(o)}),!n||n.replace(qx,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var yp=Ht.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){mp(n);return}mp(n.scheme,n.optionalSlashes)})},onDestroy(){jx()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!hr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!hr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!hr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",xe(this.options.HTMLAttributes,n),0]:["a",xe(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!hr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!hr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[$n({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,o=gp(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!hr(l,t),protocols:t,defaultProtocol:r}));o.length&&o.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(Jx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!hr(o,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(Yx({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Xx({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),Zx=Object.defineProperty,Qx=(n,e)=>{for(var t in e)Zx(n,t,{get:e[t],enumerable:!0})},ew="listItem",bp="textStyle",kp=/^\s*([-+*])\s$/,xp=Ue.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ew,this.editor.getAttributes(bp)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Or({find:kp,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Or({find:kp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(bp),editor:this.editor})),[n]}}),wp=Ue.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",xe(this.options.HTMLAttributes,n),0]},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:()=>_o,getNextListDepth:()=>Ma,handleBackspace:()=>Ta,handleDelete:()=>Aa,hasListBefore:()=>Ep,hasListItemAfter:()=>nw,hasListItemBefore:()=>Cp,listItemHasSubList:()=>vp,nextListIsDeeper:()=>_p,nextListIsHigher:()=>Sp});var _o=(n,e)=>{const{$from:t}=e.selection,r=He(n,e.schema);let o=null,s=t.depth,l=t.pos,a=null;for(;s>0&&a===null;)o=t.node(s),o.type===r?a=s:(s-=1,l-=1);return a===null?null:{$pos:e.doc.resolve(l),depth:a}},Ma=(n,e)=>{const t=_o(n,e);if(!t)return!1;const[,r]=Ub(e,n,t.$pos.pos+4);return r},Ep=(n,e,t)=>{const{$anchor:r}=n.selection,o=Math.max(0,r.pos-2),s=n.doc.resolve(o).node();return!(!s||!t.includes(s.type.name))},Cp=(n,e)=>{var t;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-2);return!(o.index()===0||((t=o.nodeBefore)==null?void 0:t.type.name)!==n)},vp=(n,e,t)=>{if(!t)return!1;const r=He(n,e.schema);let o=!1;return t.descendants(s=>{s.type===r&&(o=!0)}),o},Ta=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Pn(n.state,e)&&Ep(n.state,e,t)){const{$anchor:a}=n.state.selection,c=n.state.doc.resolve(a.before()-1),d=[];c.node().descendants((p,h)=>{p.type.name===e&&d.push({node:p,pos:h})});const u=d.at(-1);if(!u)return!1;const f=n.state.doc.resolve(c.start()+u.pos+1);return n.chain().cut({from:a.start()-1,to:a.end()+1},f.end()).joinForward().run()}if(!Pn(n.state,e)||!Gb(n.state))return!1;const r=_o(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=vp(e,n.state,s);return Cp(e,n.state)&&!l?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},_p=(n,e)=>{const t=Ma(n,e),r=_o(n,e);return!r||!t?!1:t>r.depth},Sp=(n,e)=>{const t=Ma(n,e),r=_o(n,e);return!r||!t?!1:t<r.depth},Aa=(n,e)=>{if(!Pn(n.state,e)||!qb(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:o}=t;return!t.empty&&r.sameParent(o)?!1:_p(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Sp(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},nw=(n,e)=>{var t;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((t=o.nodeAfter)==null?void 0:t.type.name)!==n)},Np=Ee.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Aa(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Aa(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Ta(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Ta(n,t,r)&&(e=!0)}),e}}}}),rw="listItem",Mp="textStyle",Tp=/^(\d+)\.\s$/,Ap=Ue.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",xe(this.options.HTMLAttributes,t),0]:["ol",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(rw,this.editor.getAttributes(Mp)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Or({find:Tp,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Or({find:Tp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Mp)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),ow=/^\s*(\[([( |x])?\])\s$/,sw=Ue.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",xe(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const o=document.createElement("li"),s=document.createElement("label"),l=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div"),d=u=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:p.call(f,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return d(n),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const h=t();if(typeof h!="number")return!1;const m=p.doc.nodeAt(h);return p.setNodeMarkup(h,void 0,{...m?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{o.setAttribute(u,f)}),o.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,s.append(a,l),o.append(s,c),Object.entries(e).forEach(([u,f])=>{o.setAttribute(u,f)}),{dom:o,contentDOM:c,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,d(u),!0)}}},addInputRules(){return[Or({find:ow,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),lw=Ue.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",xe(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ee.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(xp.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(wp.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Np.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Ap.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(sw.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(lw.configure(this.options.taskList)),n}});var Bp=Ue.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),iw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,aw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,cw=Ht.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ur({find:iw,type:this.type})]},addPasteRules(){return[$n({find:aw,type:this.type})]}}),dw=Ue.create({name:"text",group:"inline"}),uw=Ht.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function fw(n={}){return new Oe({view(e){return new pw(e,n)}})}class pw{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let s=l=>{this[o](l)};return e.dom.addEventListener(o,s),{name:o,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,o=this.editorView.dom,s=o.getBoundingClientRect(),l=s.width/o.offsetWidth,a=s.height/o.offsetHeight;if(t){let f=e.nodeBefore,p=e.nodeAfter;if(f||p){let h=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(h){let m=h.getBoundingClientRect(),g=f?m.bottom:m.top;f&&p&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*l;r={left:f.left-p,right:f.left+p,top:f.top,bottom:f.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!c||c==document.body&&getComputedStyle(c).position=="static")d=-pageXOffset,u=-pageYOffset;else{let f=c.getBoundingClientRect(),p=f.width/c.offsetWidth,h=f.height/c.offsetHeight;d=f.left-c.scrollLeft*p,u=f.top-c.scrollTop*h}this.element.style.left=(r.left-d)/l+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),o=r&&r.type.spec.disableDropCursor,s=typeof o=="function"?o(this.editorView,t,e):o;if(t&&!s){let l=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=ld(this.editorView.state.doc,l,this.editorView.dragging.slice);a!=null&&(l=a)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Fe extends le{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Fe.valid(r)?new Fe(r):le.near(r)}content(){return q.empty}eq(e){return e instanceof Fe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Fe(e.resolve(t.pos))}getBookmark(){return new Ba(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!hw(e)||!mw(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Fe.valid(e))return e;let o=e.pos,s=null;for(let l=e.depth;;l--){let a=e.node(l);if(t>0?e.indexAfter(l)<a.childCount:e.index(l)>0){s=a.child(t>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;o+=t;let c=e.doc.resolve(o);if(Fe.valid(c))return c}for(;;){let l=t>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!ne.isSelectable(s)){e=e.doc.resolve(o+s.nodeSize*t),r=!1;continue e}break}s=l,o+=t;let a=e.doc.resolve(o);if(Fe.valid(a))return a}return null}}}Fe.prototype.visible=!1,Fe.findFrom=Fe.findGapCursorFrom,le.jsonID("gapcursor",Fe);class Ba{constructor(e){this.pos=e}map(e){return new Ba(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Fe.valid(t)?new Fe(t):le.near(t)}}function hw(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function mw(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function gw(){return new Oe({props:{decorations:xw,createSelectionBetween(n,e,t){return e.pos==t.pos&&Fe.valid(t)?new Fe(t):null},handleClick:bw,handleKeyDown:yw,handleDOMEvents:{beforeinput:kw}}})}const yw=Vi({ArrowLeft:hl("horiz",-1),ArrowRight:hl("horiz",1),ArrowUp:hl("vert",-1),ArrowDown:hl("vert",1)});function hl(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,s){let l=r.selection,a=e>0?l.$to:l.$from,c=l.empty;if(l instanceof oe){if(!s.endOfTextblock(t)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let d=Fe.findGapCursorFrom(a,e,c);return d?(o&&o(r.tr.setSelection(new Fe(d))),!0):!1}}function bw(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Fe.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&ne.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Fe(r))),!0)}function kw(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Fe))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let o=I.empty;for(let l=r.length-1;l>=0;l--)o=I.from(r[l].createAndFill(null,o));let s=n.state.tr.replace(t.pos,t.pos,new q(o,0,0));return s.setSelection(oe.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function xw(n){if(!(n.selection instanceof Fe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Me.create(n.doc,[Ye.widget(n.selection.head,e,{key:"gapcursor"})])}var ml=200,Xe=function(){};Xe.prototype.append=function(e){return e.length?(e=Xe.from(e),!this.length&&e||e.length<ml&&this.leafAppend(e)||this.length<ml&&e.leafPrepend(this)||this.appendInner(e)):this},Xe.prototype.prepend=function(e){return e.length?Xe.from(e).append(this):this},Xe.prototype.appendInner=function(e){return new ww(this,e)},Xe.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Xe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Xe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Xe.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},Xe.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(s,l){return o.push(e(s,l))},t,r),o},Xe.from=function(e){return e instanceof Xe?e:e&&e.length?new Vp(e):Xe.empty};var Vp=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,s){return o==0&&s==this.length?this:new e(this.values.slice(o,s))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,s,l,a){for(var c=s;c<l;c++)if(o(this.values[c],a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(o,s,l,a){for(var c=s-1;c>=l;c--)if(o(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=ml)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=ml)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Xe);Xe.empty=new Vp([]);var ww=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,s,l){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(s,a),l)===!1||s>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,s)-a,l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,s,l){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(s,a)-a,l+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(o,a),s,l)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var s=this.left.length;return o<=s?this.left.slice(r,o):r>=s?this.right.slice(r-s,o-s):this.left.slice(r,s).append(this.right.slice(0,o-s))},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})(Xe);const Ew=500;class Ut{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,s;t&&(o=this.remapping(r,this.items.length),s=o.maps.length);let l=e.tr,a,c,d=[],u=[];return this.items.forEach((f,p)=>{if(!f.step){o||(o=this.remapping(r,p+1),s=o.maps.length),s--,u.push(f);return}if(o){u.push(new en(f.map));let h=f.step.map(o.slice(s)),m;h&&l.maybeStep(h).doc&&(m=l.mapping.maps[l.mapping.maps.length-1],d.push(new en(m,void 0,void 0,d.length+u.length))),s--,m&&o.appendMap(m,s)}else l.maybeStep(f.step);if(f.selection)return a=o?f.selection.map(o.slice(s)):f.selection,c=new Ut(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:l,selection:a}}addTransform(e,t,r,o){let s=[],l=this.eventCount,a=this.items,c=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),p=new en(e.mapping.maps[u],f,t),h;(h=c&&c.merge(p))&&(p=h,u?s.pop():a=a.slice(0,a.length-1)),s.push(p),t&&(l++,t=void 0),o||(c=p)}let d=l-r.depth;return d>vw&&(a=Cw(a,d),l-=d),new Ut(a.append(s),l)}remapping(e,t){let r=new Xr;return this.items.forEach((o,s)=>{let l=o.mirrorOffset!=null&&s-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,l)},e,t),r}addMaps(e){return this.eventCount==0?this:new Ut(this.items.append(e.map(t=>new en(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-t),s=e.mapping,l=e.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},o);let c=t;this.items.forEach(p=>{let h=s.getMirror(--c);if(h==null)return;l=Math.min(l,h);let m=s.maps[h];if(p.step){let g=e.steps[h].invert(e.docs[h]),y=p.selection&&p.selection.map(s.slice(c+1,h));y&&a++,r.push(new en(m,g,y))}else r.push(new en(m))},o);let d=[];for(let p=t;p<l;p++)d.push(new en(s.maps[p]));let u=this.items.slice(0,o).append(d).append(r),f=new Ut(u,a);return f.emptyItemCount()>Ew&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,o=[],s=0;return this.items.forEach((l,a)=>{if(a>=e)o.push(l),l.selection&&s++;else if(l.step){let c=l.step.map(t.slice(r)),d=c&&c.getMap();if(r--,d&&t.appendMap(d,r),c){let u=l.selection&&l.selection.map(t.slice(r));u&&s++;let f=new en(d.invert(),c,u),p,h=o.length-1;(p=o.length&&o[h].merge(f))?o[h]=p:o.push(f)}}else l.map&&r--},this.items.length,0),new Ut(Xe.from(o.reverse()),s)}}Ut.empty=new Ut(Xe.empty,0);function Cw(n,e){let t;return n.forEach((r,o)=>{if(r.selection&&e--==0)return t=o,!1}),n.slice(t)}class en{constructor(e,t,r,o){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new en(t.getMap().invert(),t,this.selection)}}}class Wn{constructor(e,t,r,o,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const vw=20;function _w(n,e,t,r){let o=t.getMeta(mr),s;if(o)return o.historyState;t.getMeta(Mw)&&(n=new Wn(n.done,n.undone,null,0,-1));let l=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(l&&l.getMeta(mr))return l.getMeta(mr).redo?new Wn(n.done.addTransform(t,void 0,r,gl(e)),n.undone,Lp(t.mapping.maps),n.prevTime,n.prevComposition):new Wn(n.done,n.undone.addTransform(t,void 0,r,gl(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),c=n.prevTime==0||!l&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Sw(t,n.prevRanges)),d=l?Va(n.prevRanges,t.mapping):Lp(t.mapping.maps);return new Wn(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,gl(e)),Ut.empty,d,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Wn(n.done.rebased(t,s),n.undone.rebased(t,s),Va(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Wn(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Va(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Sw(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,o)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&o>=e[s]&&(t=!0)}),t}function Lp(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,o,s,l)=>e.push(s,l));return e}function Va(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let o=e.map(n[r],1),s=e.map(n[r+1],-1);o<=s&&t.push(o,s)}return t}function Nw(n,e,t){let r=gl(e),o=mr.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let l=s.selection.resolve(s.transform.doc),a=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),o,r),c=new Wn(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(l).setMeta(mr,{redo:t,historyState:c})}let La=!1,Op=null;function gl(n){let e=n.plugins;if(Op!=e){La=!1,Op=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){La=!0;break}}return La}const mr=new $e("history"),Mw=new $e("closeHistory");function Tw(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Oe({key:mr,state:{init(){return new Wn(Ut.empty,Ut.empty,null,0,-1)},apply(e,t,r){return _w(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,o=r=="historyUndo"?Dp:r=="historyRedo"?Rp:null;return o?(t.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function Ip(n,e){return(t,r)=>{let o=mr.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(r){let s=Nw(o,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const Dp=Ip(!1,!0),Rp=Ip(!0,!0);Ee.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new Oe({key:new $e("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const o=this.options.limit;if(o==null||o===0){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>o){const l=s-o,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(a,c);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=r||o>r&&s>r&&s<=o)return!0;if(o>r&&s>r&&s>o||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,c=s-r,d=a-c,u=a;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>r)}})]}});var Aw=Ee.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[fw(this.options)]}});Ee.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Oe({key:new $e("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:o}=e,s=[];if(!t||!r)return Me.create(n,[]);let l=0;this.options.mode==="deepest"&&n.descendants((c,d)=>{if(c.isText)return;if(!(o>=d&&o<=d+c.nodeSize-1))return!1;l+=1});let a=0;return n.descendants((c,d)=>{if(c.isText||!(o>=d&&o<=d+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&l-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(Ye.node(d,d+c.nodeSize,{class:this.options.className}))}),Me.create(n,s)}}})]}});var Bw=Ee.create({name:"gapCursor",addProseMirrorPlugins(){return[gw()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ke(te(n,"allowGapCursor",t)))!=null?e:null}}});Ee.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Oe({key:new $e("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!t)return null;const s=this.editor.isEmpty;return n.descendants((l,a)=>{const c=r>=a&&r<=a+l.nodeSize,d=!l.isLeaf&&Cs(l);if((c||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];s&&u.push(this.options.emptyEditorClass);const f=Ye.node(a,a+l.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:a,hasAnchor:c}):this.options.placeholder});o.push(f)}return this.options.includeChildren}),Me.create(n,o)}}})]}}),Ee.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Oe({key:new $e("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||mf(t.selection)||n.view.dragging?null:Me.create(t.doc,[Ye.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Fp({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var Vw=Ee.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const n=new $e(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>(this.options.notAfter||[]).concat(this.options.node).includes(t.name));return[new Oe({key:n,appendTransaction:(t,r,o)=>{const{doc:s,tr:l,schema:a}=o,c=n.getState(o),d=s.content.size,u=a.nodes[this.options.node];if(c)return l.insert(d,u.create())},state:{init:(t,r)=>{const o=r.tr.doc.lastChild;return!Fp({node:o,types:e})},apply:(t,r)=>{if(!t.docChanged)return r;const o=t.doc.lastChild;return!Fp({node:o,types:e})}}})]}}),Lw=Ee.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Dp(n,e),redo:()=>({state:n,dispatch:e})=>Rp(n,e)}},addProseMirrorPlugins(){return[Tw(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()}}}),Ow=Ee.create({name:"starterKit",addExtensions(){var n,e,t,r;const o=[];return this.options.bold!==!1&&o.push(px.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(ax.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(xp.configure(this.options.bulletList)),this.options.code!==!1&&o.push(gx.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(kx.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(xx.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(Aw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(Bw.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(wx.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(ep.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(Lw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(Ex.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(Nx.configure(this.options.italic)),this.options.listItem!==!1&&o.push(wp.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(Np.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&o.push(yp.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(Ap.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(Bp.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(cw.configure(this.options.strike)),this.options.text!==!1&&o.push(dw.configure(this.options.text)),this.options.underline!==!1&&o.push(uw.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&o.push(Vw.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),Iw=Ow,Dw=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Rw=Ue.create({name:"image",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},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",xe(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Mf({find:Dw,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),Fw=Ee.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});const Pw=async n=>{try{const e=new FormData;return e.append("unique","true"),e.append("file",n),(await(await fetch("/file/upload/uploads?id=&form=&table=",{method:"POST",body:e})).json())?.result}catch(e){console.error(e)}},$w=async(n,e)=>{const t=e.clipboardData?.items;if(t){const r=e.clipboardData?.getData("text/html"),o=e.clipboardData?.getData("text/plain");if(r){const{state:s,dispatch:l}=n,{tr:a}=s,c=wr.fromSchema(n.state.schema),d=new DOMParser().parseFromString(r,"text/html").body,u=c.parse(d),f=a.replaceSelectionWith(u);return l(f),e.preventDefault(),!0}if(o){const{state:s,dispatch:l}=n,{tr:a}=s,c=a.insertText(o,s.selection.from,s.selection.to);return l(c),e.preventDefault(),!0}for(let s=0;s<t.length;s++){const l=t[s];if(l.type.startsWith("image/")){const a=l.getAsFile();if(a){const c=await Pw(a),{schema:d}=n.state,u=d.nodes.image.create({src:c?.file_path}),f=n.state.tr.replaceSelectionWith(u);return n.dispatch(f),e.preventDefault(),!0}}}}return!1},zw={1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"},Hw=ep.extend({addOptions(){return{...this.parent?.(),levels:[1,2,3,4,5,6]}}}).extend({addAttributes(){return{...this.parent?.(),level:{default:1,renderHTML:n=>{const e=n.level||1;return{class:`heading-level-${e}`,style:zw[e-1]}}}}}}),jw=Bp.configure({HTMLAttributes:{style:"min-height: 1rem;"}}),Uw=Yi.extend({addAttributes(){return{...this.parent?.(),fontFamily:{default:null,parseHTML:n=>n.style.fontFamily?.replace(/['"]/g,""),renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Ww=Yi.extend({addAttributes(){return{...this.parent?.(),fontSize:{default:null,parseHTML:n=>n.style.fontSize?.replace(/['"]/g,""),renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Kw=Ue.create({name:"iframe",group:"block",inline:!1,atom:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:"100%"},height:{default:"280"},frameborder:{default:"0"},allow:{default:null},allowfullscreen:{default:null},referrerpolicy:{default:null},loading:{default:null},class:{default:null},title:{default:null},style:{default:null}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:n}){return["iframe",n]}});function Pp(n){let e=!1;const t=$1({content:n.modelValue,extensions:[Iw.configure({history:{depth:100,newGroupDelay:500},code:{HTMLAttributes:{class:"editor-code"}},codeBlock:{HTMLAttributes:{class:"editor-codeblock"}},paragraph:!1,heading:!1,link:!1}),lx,sx,G1,Uw,Ww,jw,Hw,ox,Rw,Fw.configure({types:["heading","paragraph"]}),yp.configure({HTMLAttributes:{class:"editor-link"},openOnClick:!1,autolink:!0}),tx.configure({table:{HTMLAttributes:{class:"editor-content"},resizable:!0}}),Kw],editorProps:{handlePaste:$w,handleKeyDown:(s,l)=>{if(l.key==="Tab"){const a=s.state,{selection:c}=a,{$anchor:d}=c;let u=!1;for(let f=d.depth;f>0;f--){const p=d.node(f);if(p&&(p.type.name==="bulletList"||p.type.name==="orderedList")){u=!0;break}}return u?!1:(l.preventDefault(),!0)}return!1}}}),r=i.computed(()=>t.value||null);return i.watch(t,s=>{s&&t.value.on("update",l=>{if(!e){e=!0;const a=l.editor.getHTML();n.modelValue,setTimeout(()=>{e=!1},10)}})}),{editor:t,editorInstance:r,focusEditor:()=>{t.value&&!t.value.isFocused&&t.value.commands.focus()}}}function $p(n,e){const t=i.ref(!1),r=i.ref(""),o=i.ref(null);return{isHtmlMode:t,htmlContent:r,htmlTextarea:o,toggleHtmlMode:a=>{t.value=a,a?(n.value&&(r.value=n.value.getHTML()),i.nextTick(()=>{o.value&&(o.value.focus(),setTimeout(()=>{o.value.formatCode()},100))})):n.value&&r.value&&n.value.commands.setContent(r.value,!0)},onHtmlInput:a=>{r.value=a,e&&e("update:modelValue",a)}}}function zp(){const n=i.ref(!1);return{isFullscreen:n,toggleFullscreen:()=>{n.value=!n.value}}}const Le=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},qw={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function Gw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Blockquote",onClick:e[0]||(e[0]=(...l)=>s.toggleBlockquote&&s.toggleBlockquote(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":t.editor?.isActive("blockquote")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[i.createElementVNode("path",{"fill-rule":"evenodd",d:"M6 6a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3H5a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2H6Zm9 0a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3h-1a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3Z"})],-1)])],2)}const Jw=Le(qw,[["render",Gw]]),Yw={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function Xw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Bullet List",onClick:e[0]||(e[0]=(...l)=>s.toggleBulletList&&s.toggleBulletList(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("bulletList")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)])],2)}const Zw=Le(Yw,[["render",Xw]]),Qw={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function eE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Ordered List",onClick:e[0]||(e[0]=(...l)=>s.toggleOrderedList&&s.toggleOrderedList(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("orderedList")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"})],-1)])],2)}const tE=Le(Qw,[["render",eE]]),nE={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function rE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Code Block",onClick:e[0]||(e[0]=(...l)=>s.toggleCodeBlock&&s.toggleCodeBlock(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("codeBlock")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8-4 4 4 4m8 0 4-4-4-4m-2-3-4 14"})],-1)])],2)}const oE=Le(nE,[["render",rE]]),sE={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.commands.toggleBold()}}};function lE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Bold Text",onClick:e[0]||(e[0]=(...l)=>s.toggleBold&&s.toggleBold(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("bold")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 5h4.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0-7H6m2 7h6.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0 0H6"})],-1),i.createElementVNode("span",{class:"sr-only"},"Bold",-1)])],2)}const iE=Le(sE,[["render",lE]]),aE={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function cE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Italic Text",onClick:e[0]||(e[0]=(...l)=>s.toggleItalic&&s.toggleItalic(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("italic")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8.874 19 6.143-14M6 19h6.33m-.66-14H18"})],-1),i.createElementVNode("span",{class:"sr-only"},"Italic",-1)])],2)}const dE=Le(aE,[["render",cE]]),uE={__name:"vs-editor-underline",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().toggleUnderline().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Underline",onClick:t,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.isActive("underline")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...o[0]||(o[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M6 4v6a6 6 0 0 0 12 0V4"}),i.createElementVNode("line",{x1:"4",x2:"20",y1:"20",y2:"20"})],-1)])],2))}},fE={__name:"vs-editor-strike",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().toggleStrike().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Strikethrough",onClick:t,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.isActive("strike")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...o[0]||(o[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-strikethrough"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElementVNode("path",{d:"M5 12l14 0"}),i.createElementVNode("path",{d:"M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5"})],-1)])],2))}},pE={props:{visible:{type:Boolean,default:()=>!1},modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""},closeClickBack:{type:Boolean,default:()=>!1}},emits:["update:visible","update:modelValue","onClose","confirm","cancel"],inheritAttrs:!1,name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){return!!this.$slots?.footer},checkSize(){return this.size==="small"?"md:w-5/12 w-9/12":this.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:n}){n==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("update:modelValue",!1),this.$emit("onClose")},handleConfirm(){this.$emit("confirm"),this.handleClose()},handleCancel(){this.$emit("cancel"),this.handleClose()},closeByClickBack(n,e){e&&n.target.classList.contains("vs-dialog-overlay")&&this.handleClose()}}},hE={key:0,class:"vsTailwind ui-dialog__wrapper"},mE={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},gE={class:"font-medium text-gray-800 dark:text-[#ffffff]"},yE={class:"ui-dialog__content p-4"},bE={key:0,class:"flex justify-end gap-x-2"};function kE(n,e,t,r,o,s){return i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[t.visible||t.modelValue?(i.openBlock(),i.createElementBlock("div",hE,[i.createElementVNode("div",{onMousedown:e[1]||(e[1]=l=>s.closeByClickBack(l,t.closeClickBack)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[100001] bg-black bg-opacity-50"},[i.createVNode(i.Transition,{name:"content",appear:""},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[s.checkSize]])},[i.createElementVNode("div",mE,[i.createElementVNode("h3",gE,i.toDisplayString(t.title),1),i.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:e[0]||(e[0]=(...l)=>s.handleClose&&s.handleClose(...l))},[...e[2]||(e[2]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),i.createElementVNode("div",yE,[i.renderSlot(n.$slots,"default",{},void 0,!0)]),s.hasSlot?(i.openBlock(),i.createElementBlock("div",bE,[i.renderSlot(n.$slots,"footer",{handleClose:s.handleClose,handleConfirm:s.handleConfirm,handleCancel:s.handleCancel},void 0,!0)])):i.createCommentVNode("",!0)],2)]),_:3})],32)])):i.createCommentVNode("",!0)])}const Hp=Le(pE,[["render",kE],["__scopeId","data-v-6d0970a6"]]),xE={},wE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function EE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",wE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),i.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const CE=Le(xE,[["render",EE]]),vE={},_E={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search"};function SE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",_E,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),i.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)])])}const NE=Le(vE,[["render",SE]]),ME={},TE={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-mail"};function AE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",TE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"},null,-1),i.createElementVNode("path",{d:"M3 7l9 6l9 -6"},null,-1)])])}const BE=Le(ME,[["render",AE]]),VE=i.defineComponent({components:{IconClose:CE,IconSearch:NE,IconEmail:BE},inheritAttrs:!1,props:{icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"},type:{type:String,default:()=>"text"},style:{type:Object,default:()=>null},size:{type:String,default:()=>"md"},attrs:{type:Object,default:()=>{}}},emits:["onInput","update:modelValue","blur","focus"],computed:{checkSize(){if((this.style?.size||this.size)==="xs")return"h-[32px] text-sm";if((this.style?.size||this.size)==="md")return"h-[38px] text-sm";this.style?.size||this.size},value:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n.trim())}},clearIconStyle(){return[{"right-8":this.icon&&this.iconPosition==="right","right-3":!this.icon||this.iconPosition!=="right","pointer-events-none":this.disabled}]},iconStylePosition(){return[{"left-3":this.icon&&this.iconPosition==="left","right-3":this.icon&&this.iconPosition==="right"}]},inputStyle(){return[{"!pr-8":this.clearable&&!this.icon,"!pr-7":this.clearable,"!pr-16":this.clearable&&this.icon&&this.iconPosition==="right","!pl-8":this.icon&&this.iconPosition==="left","!pr-[50px]":this.clearable&&this.value&&this.icon&&this.iconPosition==="right","!cursor-not-allowed bg-slate-100":this.disabled,"bg-white":!this.disabled}]}},methods:{handleInput(){this.$emit("onInput",this.modelValue)},handleBlur(){this.$emit("blur")},handleFocus(){this.$emit("focus")},clearInput(){this.$emit("update:modelValue",""),this.$emit("onInput","")},async inputFocus(){const{vsText:n}=await this.$refs;await n.focus()}}}),LE={class:"vs-form-text relative bg-white rounded-lg"},OE={key:2,class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},IE=["disabled","type","placeholder"];function DE(n,e,t,r,o,s){const l=i.resolveComponent("IconClose"),a=i.resolveComponent("IconSearch"),c=i.resolveComponent("IconEmail");return i.openBlock(),i.createElementBlock("div",LE,[n.clearable&&n.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[0]||(e[0]=(...d)=>n.clearInput&&n.clearInput(...d))},[i.createVNode(l,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):i.createCommentVNode("",!0),n.icon&&n.icon==="search"?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["absolute bottom-2/4 translate-y-2/4 cursor-pointer",n.iconStylePosition])},[i.createVNode(a,{width:"15px",height:"15px",class:"stroke-gray-500 transition-all"})],2)):n.icon&&n.icon==="email"?(i.openBlock(),i.createElementBlock("div",OE,[i.createVNode(c,{width:"16",height:"16",class:"stroke-gray-500 transition-all"})])):(i.openBlock(),i.createElementBlock("i",{key:3,class:i.normalizeClass(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer",["ti "+n.icon,n.iconStylePosition]])},null,2)),n.clearable&&n.value?(i.openBlock(),i.createElementBlock("div",{key:4,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[1]||(e[1]=(...d)=>n.clearInput&&n.clearInput(...d))},[i.createVNode(l,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("input",i.mergeProps({ref:"vsText",disabled:n.disabled,type:n.type,onInput:e[2]||(e[2]=(...d)=>n.handleInput&&n.handleInput(...d)),placeholder:n.placeholder,"onUpdate:modelValue":e[3]||(e[3]=d=>n.value=d)},n.style?.attrs||n.attrs||{},{onFocus:e[4]||(e[4]=(...d)=>n.handleFocus&&n.handleFocus(...d)),onBlur:e[5]||(e[5]=(...d)=>n.handleBlur&&n.handleBlur(...d)),class:[[n.inputStyle,n.checkSize],"py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"]}),null,16,IE),[[i.vModelDynamic,n.value]])])}const jp=Le(VE,[["render",DE],["__scopeId","data-v-749b581f"]]);function Oa(){const n=i.ref("en");return{t:t=>({en:{type_tag:"Type Tag",heading_1:"Heading 1",heading_2:"Heading 2",heading_3:"Heading 3",paragraph:"Paragraph",createTable:"Create Table",addColumn:"Add Column",addRow:"Add Row",deleteColumn:"Delete Column",deleteRow:"Delete Row",deleteTable:"Delete Table",mergeCells:"Merge Cells",splitCells:"Split Cells",linkTitle:"Enter Link"},uk:{type_tag:"Тип тегу",heading_1:"Заголовок 1",heading_2:"Заголовок 2",heading_3:"Заголовок 3",paragraph:"Параграф",createTable:"Створити Таблицю",addColumn:"Додати Колону",addRow:"Додати Рядок",deleteColumn:"Вилучити Колону",deleteRow:"Вилучити Рядок",deleteTable:"Вилучити Таблицю",mergeCells:"Об'єднати Клітинки",splitCells:"Розділити Клітинки",linkTitle:"Введіть Посилання"}})[n.value]?.[t]||t,locale:n}}const RE={class:"flex flex-col gap-3 p-[20px]"},FE={class:"relative flex items-center gap-2"},PE={class:"flex-1"},$E={key:0,class:"flex items-center gap-2 flex-shrink-0"},zE={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},HE=Object.assign({inheritAttrs:!1},{__name:"vs-editor-link",props:{editor:Object},setup(n){const{t:e}=Oa(),t=n,r=i.ref(!1),o=i.ref(""),s=i.ref(!1),l=()=>{if(!t.editor)return;t.editor.chain().focus().extendMarkRange("link").run();const f=t.editor.getAttributes("link");f.href?(s.value=!0,o.value=f.href):(s.value=!1,o.value=""),r.value=!0},a=()=>{r.value=!1,o.value="",s.value=!1},c=()=>{if(!t.editor||!o.value.trim())return;let f=o.value.trim();f.match(/^https?:\/\//i)||(f="https://"+f),t.editor.chain().focus().setLink({href:f}).run(),a()},d=()=>{t.editor&&(t.editor.chain().focus().unsetLink().run(),a())},u=()=>{if(!o.value)return;let f=o.value.trim();f.match(/^https?:\/\//i)||(f="https://"+f),window.open(f,"_blank","noopener,noreferrer")};return(f,p)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("button",{title:"Link",onClick:l,class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":n.editor?.isActive("link")}])},[...p[2]||(p[2]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13.213 9.787a3.391 3.391 0 0 0-4.795 0l-3.425 3.426a3.39 3.39 0 0 0 4.795 4.794l.321-.304m-.321-4.49a3.39 3.39 0 0 0 4.795 0l3.424-3.426a3.39 3.39 0 0 0-4.794-4.795l-1.028.961"})],-1)])],2),i.createVNode(Hp,{title:s.value?i.unref(e)("editLink")||"Edit Link":i.unref(e)("linkTitle")||"Add Link",visible:r.value,"onUpdate:visible":p[1]||(p[1]=h=>r.value=h),size:"small"},{footer:i.withCtx(()=>[i.createElementVNode("div",zE,[i.createElementVNode("button",{style:{border:"1px solid #000"},onClick:a,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"},i.toDisplayString(i.unref(e)("cancel")||"Cancel"),1),i.createElementVNode("button",{onClick:c,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"},i.toDisplayString(s.value?i.unref(e)("update")||"Update":i.unref(e)("create")||"Create"),1)])]),default:i.withCtx(()=>[i.createElementVNode("div",RE,[i.createElementVNode("div",FE,[i.createElementVNode("div",PE,[i.createVNode(jp,{modelValue:o.value,"onUpdate:modelValue":p[0]||(p[0]=h=>o.value=h),placeholder:i.unref(e)("linkUrl")||"Enter URL",class:"w-full"},null,8,["modelValue","placeholder"])]),s.value?(i.openBlock(),i.createElementBlock("div",$E,[i.createElementVNode("button",{onClick:u,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none transition-colors",title:"Open link"},[...p[3]||(p[3]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4M14 4h6m0 0v6m0-6L10 14"})],-1)])]),i.createElementVNode("button",{onClick:d,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-red-600 hover:bg-red-50 focus:outline-none transition-colors",title:"Remove link"},[...p[4]||(p[4]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)])])])):i.createCommentVNode("",!0)])])]),_:1},8,["title","visible"])],64))}}),So=async(n,e,t,r=10)=>{if(!e||!t)return;await i.nextTick();const o=await t?.getBoundingClientRect(),s=await e?.getBoundingClientRect();if(!s||!o)return;const l=await parseInt(e?.getBoundingClientRect()?.height),a=await parseInt(e?.getBoundingClientRect()?.width),c=await parseInt(t?.getBoundingClientRect()?.height),d=await parseInt(t?.getBoundingClientRect()?.width),u=await window.innerHeight,f=await window.innerWidth;let p=0,h=0;const m=s.bottom+r+c;switch(n){case"top":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,f>d+s.right+30?h=s.left-o.width/2+s.width/2:h=f-30-d;break;case"bottom":u>m?p=s.bottom+r:p=s.bottom-r-c-l,h=s.left-o.width/2+s.width/2;break;case"left":p=s.top-o.height/2+s.height/2,s.left-o.width-r>0?h=s.left-o.width-r:h=10;break;case"right":p=s.top-o.height/2+s.height/2,f-a>d?h=s.right+r:h=f-30-d;break;case"top-right":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,f-a>d?h=s.right+r:h=f-30-d;break;case"top-left":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,s.left-o.width-r>0?h=s.left-o.width-r:h=10;break;case"top-start":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,s.left>0?h=s.left:h=10;break;case"bottom-right":u>m?p=s.bottom+r:p=s.bottom-r-c-l,f-a>d?h=s.left:h=f-30-d;break;case"bottom-left":u>m?p=s.bottom+r:p=s.bottom-r-c-l,s.left>0?h=s.right-d:h=10;break;case"bottom-start":u>m?p=s.bottom+r:p=s.bottom-r-c-l,s.left>0?h=s.left:h=10;break}p+c>u?p=u-c-r:p<0&&(p=r),h+d>f?h=f-d-r:h<0&&(h=r),t instanceof HTMLElement&&(t.style.top=`${p}px`,t.style.left=`${h}px`,t.style.position="fixed")},jE={class:"text-center"},UE={class:"py-2 px-4 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},Kn=Object.assign({inheritAttrs:!1},{__name:"vs-popover",props:{isOpen:{type:Boolean,default:()=>!1},placement:{type:String,default:"top"},gap:{type:Number,default:8},width:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},trigger:{type:String,default:"click"},teleport:{type:String,default:"body"}},emits:["isvisible"],setup(n,{expose:e,emit:t}){const r=n,o=t,s=i.ref(!1),l=i.ref([]),a=i.ref(null),c=i.ref(null),d=i.ref(null);i.watch(s,w=>{w?(u(),window.addEventListener("resize",()=>So(r.placement,c.value,d.value)),So(r.placement,c.value,d.value)):window.removeEventListener("resize",()=>So(r.placement,c.value,d.value)),o("isvisible",w)}),i.onMounted(()=>{window.addEventListener("click",y),window.addEventListener("popstate",b),window.addEventListener("scroll",k,!0),u()}),i.onBeforeUnmount(()=>{window.removeEventListener("click",y),window.removeEventListener("popstate",b),f()});const u=()=>{let w=a.value;for(;w&&w!==document.body;)(w.scrollHeight>w.clientHeight||w.scrollWidth>w.clientWidth)&&(w.addEventListener("scroll",g),l.value.push(w)),w=w.parentElement;document.body&&(document.body.addEventListener("scroll",g),l.value.push(document.body))},f=()=>{l.value.forEach(w=>{w.removeEventListener("scroll",g)}),l.value=[]},p=()=>{s.value=!0,So(r.placement,c.value,d.value)},h=()=>{s.value=!1},m=async()=>{await So(r.placement,c.value,d.value),s.value=!s.value},g=()=>{s.value=!1},y=w=>{if(!w){s.value=!1;return}c.value?.contains(w.target)||d.value?.contains(w.target)||(s.value=!1)},b=()=>{s.value&&(s.value=!1)},k=w=>{s.value&&d.value&&!d.value.contains(w.target)&&(s.value=!1)};return e({togglePopover:m}),(w,x)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"popover",ref:a,class:"vs-popover inline-block"},[i.createElementVNode("div",jE,[n.trigger==="click"?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:c,onClick:m,class:i.normalizeClass({"pointer-events-none":n.disabled})},[i.renderSlot(w.$slots,"reference",{},()=>[x[0]||(x[0]=i.createElementVNode("button",null,"Click me!",-1))])],2)):i.createCommentVNode("",!0),n.trigger==="hover"?(i.openBlock(),i.createElementBlock("div",{key:1,ref_key:"popoverRef",ref:c,onMouseover:p,onMouseleave:h,class:i.normalizeClass({"pointer-events-none":n.disabled})},[i.renderSlot(w.$slots,"reference",{},()=>[x[1]||(x[1]=i.createElementVNode("button",null,"Click me!",-1))])],34)):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.Teleport,{to:n.teleport},[i.createVNode(i.Transition,{name:"fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",{class:i.normalizeClass(["vsTailwind vs-popover__content",n.placement]),ref_key:"contentPop",ref:d,style:i.normalizeStyle({width:n.width?n.width+"px":"fit-content",zIndex:100001})},[i.createElementVNode("div",UE,[i.renderSlot(w.$slots,"default",{},()=>[x[2]||(x[2]=i.createElementVNode("span",null,"Popover content",-1))])])],6),[[i.vShow,s.value]])]),_:3})],8,["to"]))])],512))}}),WE={class:"flex flex-col gap-[2px] p-[2px]"},KE=["onClick"],qE={__name:"vs-editor-table",props:{editor:Object},setup(n){const{t:e}=Oa(),t=n,r=i.ref(!1),o=i.ref("popover"),s=()=>{t.editor&&(t.editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),o.value.togglePopover())},l=()=>{t.editor&&(t.editor.chain().focus().addColumnAfter().run(),o.value.togglePopover())},a=()=>{t.editor&&(t.editor.chain().focus().addRowAfter().run(),o.value.togglePopover())},c=()=>{t.editor&&(t.editor.chain().focus().deleteColumn().run(),o.value.togglePopover())},d=()=>{t.editor&&(t.editor.chain().focus().deleteRow().run(),o.value.togglePopover())},u=()=>{t.editor&&(t.editor.chain().focus().deleteTable().run(),o.value.togglePopover())},f=()=>{t.editor&&(t.editor.chain().focus().mergeCells().run(),o.value.togglePopover())},p=()=>{t.editor&&(t.editor.chain().focus().splitCell().run(),o.value.togglePopover())},h=i.computed(()=>[{text:e("createTable"),function:s},{text:e("addColumn"),function:l},{text:e("addRow"),function:a},{text:e("deleteColumn"),function:c},{text:e("deleteRow"),function:d},{text:e("deleteTable"),function:u},{text:e("mergeCells"),function:f},{text:e("splitCells"),function:p}]);return(m,g)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:o,placement:"bottom",onIsvisible:g[0]||(g[0]=y=>r.value=y)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Table",class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...g[1]||(g[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-table"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElementVNode("path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"}),i.createElementVNode("path",{d:"M3 10h18"}),i.createElementVNode("path",{d:"M10 3v18"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",WE,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(y,b)=>(i.openBlock(),i.createElementBlock("button",{key:b,onClick:y?.function,class:"px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded"},i.toDisplayString(y.text),9,KE))),128))])]),_:1},512))}},GE={},JE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-center"};function YE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",JE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M8 12l8 0"},null,-1),i.createElementVNode("path",{d:"M6 18l12 0"},null,-1)])])}const XE=Le(GE,[["render",YE]]),ZE={},QE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-right"};function e2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",QE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M10 12l10 0"},null,-1),i.createElementVNode("path",{d:"M6 18l14 0"},null,-1)])])}const t2=Le(ZE,[["render",e2]]),n2={},r2={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-left"};function o2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",r2,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M4 12l10 0"},null,-1),i.createElementVNode("path",{d:"M4 18l14 0"},null,-1)])])}const s2=Le(n2,[["render",o2]]),l2={},i2={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-justify"};function a2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",i2,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6h16"},null,-1),i.createElementVNode("path",{d:"M4 12h16"},null,-1),i.createElementVNode("path",{d:"M4 18h16"},null,-1)])])}const Up={left:s2,center:XE,right:t2,justify:Le(l2,[["render",a2]])},c2={class:"flex gap-[4px] p-1"},d2=["title","onClick"],u2={__name:"vs-editor-align",props:{editor:Object},setup(n){const e=n,t=i.ref(!1),r=i.ref("popover"),o=i.ref("left"),s=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"left"})||e.editor.isActive("heading",{textAlign:"left"}):!1),l=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"right"})||e.editor.isActive("heading",{textAlign:"right"}):!1),a=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"center"})||e.editor.isActive("heading",{textAlign:"center"}):!1),c=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"justify"})||e.editor.isActive("heading",{textAlign:"justify"}):!1),d=i.computed(()=>s.value||l.value||a.value||c.value),u=()=>{l.value?o.value="right":a.value?o.value="center":c.value?o.value="justify":o.value="left"};i.watch([s,l,a,c],()=>{u()},{immediate:!0}),i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",u),e.editor.on("update",u))}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",u),e.editor.off("update",u))});const f=h=>{e.editor&&(e.editor.chain().focus().setTextAlign(h).run(),o.value=h)},p=i.ref([{id:"left",isActive:s},{id:"center",isActive:a},{id:"right",isActive:l},{id:"justify",isActive:c}]);return(h,m)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:r,placement:"bottom",onIsvisible:m[0]||(m[0]=g=>t.value=g)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Text Align",class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[d.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(Up)[o.value]),{height:"16",width:"16"}))],2)]),default:i.withCtx(()=>[i.createElementVNode("div",c2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(p.value,g=>(i.openBlock(),i.createElementBlock("button",{title:"Text align "+g?.id,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":g?.isActive}]),key:g?.id,onClick:y=>f(g?.id)},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(Up)[g?.id]),{height:"16",width:"16"}))],10,d2))),128))])]),_:1},512))}},f2={class:"flex flex-col gap-[2px] p-[2px]"},p2=["onClick"],h2={__name:"vs-editor-type-tag",props:{editor:Object},setup(n){const{t:e}=Oa(),t=n,r=i.ref(!1),o=i.ref("popover"),s=()=>{t.editor&&(t.editor?.chain().focus().setParagraph().run(),o.value.togglePopover())},l=c=>{t.editor&&(t.editor?.chain().focus().toggleHeading({level:c}).run(),o.value.togglePopover())},a=i.computed(()=>[{text:e("richtext.heading1"),id:1,style:"font-[700] text-[30px]"},{text:e("richtext.heading2"),id:2,style:"font-[700] text-[26px]"},{text:e("richtext.heading3"),id:3,style:"font-[700] text-[22px]"},{text:e("richtext.heading4"),id:4,style:"font-[700] text-[18px]"},{text:e("richtext.heading5"),id:5,style:"font-[500] text-[16px]"},{text:e("richtext.heading6"),id:6,style:"font-[400] text-[14px]"}]);return(c,d)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:o,placement:"bottom",onIsvisible:d[0]||(d[0]=u=>r.value=u)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Type Tag",class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...d[1]||(d[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-text-size"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElementVNode("path",{d:"M3 7v-2h13v2"}),i.createElementVNode("path",{d:"M10 5v14"}),i.createElementVNode("path",{d:"M12 19h-4"}),i.createElementVNode("path",{d:"M15 13v-1h6v1"}),i.createElementVNode("path",{d:"M18 12v7"}),i.createElementVNode("path",{d:"M17 19h2"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",f2,[i.createElementVNode("button",{onClick:s,class:i.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded",[n.editor?.isActive("paragraph")?"bg-gray-100":""]])},i.toDisplayString(i.unref(e)("richtext.paragraph")),3),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,(u,f)=>(i.openBlock(),i.createElementBlock("button",{key:f,onClick:p=>l(u?.id),class:i.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded leading-[100%]",[u?.style,n.editor?.isActive("heading",{level:u?.id})?"bg-gray-100":""]])},i.toDisplayString(i.unref(e)(`richtext.heading${u?.id}`)),11,p2))),128))])]),_:1},512))}},m2={},g2={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function y2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",g2,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const No=Le(m2,[["render",y2]]),b2={components:{VsText:jp},inheritAttrs:!1,events:["update:modelValue"],props:{modelValue:{type:String},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},isTextInputShown:{type:Boolean,default:()=>!0}},computed:{value:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n)}}}},k2={class:"flex items-center w-full max-w-[182px]"},x2=["disabled"];function w2(n,e,t,r,o,s){const l=i.resolveComponent("vs-text");return i.openBlock(),i.createElementBlock("div",k2,[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=a=>s.value=a),type:"color",class:i.normalizeClass(["w-[38px] h-[38px] min-h-[38px] min-w-[38px] py-[2px] px-[3px] -ml-1 dark:bg-neutral-800 border dark:border-neutral-700 border-stone-200 rounded-lg",t.disabled?"cursor-not-allowed":"cursor-pointer"]),disabled:t.disabled},null,10,x2),[[i.vModelText,s.value]]),t.isTextInputShown?(i.openBlock(),i.createBlock(l,{key:0,modelValue:s.value,"onUpdate:modelValue":e[1]||(e[1]=a=>s.value=a),class:"ml-2 w-full",disabled:t.disabled,clearable:t.clearable},null,8,["modelValue","disabled","clearable"])):i.createCommentVNode("",!0)])}const Wp=Le(b2,[["render",w2]]),E2={class:"flex gap-[4px] mb-[8px]"},C2={class:"grid grid-rows-3 grid-cols-7"},v2={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},_2=["onClick","title"],S2={__name:"vs-editor-color",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("#000000"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").color||"#000000"),s=i.computed(()=>o.value!=="#000000"),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),c=f=>{e.editor&&(e.editor.chain().focus().setColor(f).run(),r.value=f,t.value&&t.value.togglePopover())},d=()=>{c(r.value)},u=f=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple","#FFFFFF":"White","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[f]||f;return(f,p)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Text Color",class:i.normalizeClass(["flex flex-col h-[30px] min-w-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":s.value}])},[p[1]||(p[1]=i.createElementVNode("span",{class:"leading-none"},"A",-1)),i.createElementVNode("span",{class:"block h-1 w-5",style:i.normalizeStyle({backgroundColor:r.value})},null,4)],2)]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("div",E2,[i.createVNode(Wp,{modelValue:r.value,"onUpdate:modelValue":p[0]||(p[0]=h=>r.value=h)},null,8,["modelValue"]),i.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[i.createVNode(No,{class:"h-[24px] w-[24px] text-white"})])]),i.createElementVNode("div",C2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,h=>(i.openBlock(),i.createElementBlock("div",{key:h,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[i.createElementVNode("div",v2,[i.createElementVNode("button",{class:"flex items-center justify-center w-full h-full",style:i.normalizeStyle({backgroundColor:h}),onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],12,_2)])]))),128))])])]),_:1},512))}},N2={class:"flex gap-[4px] mb-[8px]"},M2={class:"grid grid-rows-3 grid-cols-7"},T2={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},A2=["onClick","title"],B2=["onClick","title"],V2={__name:"vs-editor-background-color",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("transparent"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").backgroundColor||"transparent"),s=i.computed(()=>o.value!=="transparent"&&o.value!==""),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),c=f=>{e.editor&&(e.editor.chain().focus().setBackgroundColor(f).run(),r.value=f,t.value&&t.value.togglePopover())},d=()=>{c(r.value)},u=f=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple",transparent:"Transparent","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[f]||f;return(f,p)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Background Color",class:i.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":s.value}])},[p[2]||(p[2]=i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z"}),i.createElementVNode("path",{d:"m5 2 5 5"}),i.createElementVNode("path",{d:"M2 13h15"}),i.createElementVNode("path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z"})],-1)),i.createElementVNode("span",{class:"block h-1 w-5",style:i.normalizeStyle({backgroundColor:r.value})},null,4)],2)]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("div",N2,[i.createVNode(Wp,{modelValue:r.value,"onUpdate:modelValue":p[0]||(p[0]=h=>r.value=h)},null,8,["modelValue"]),i.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[i.createVNode(No,{class:"h-[24px] w-[24px] text-white"})])]),i.createElementVNode("div",M2,[i.createElementVNode("button",{onClick:p[1]||(p[1]=h=>c("transparent")),class:"col-span-7 flex items-center justify-center gap-2 bg-gray-100 rounded-md py-1 mb-2 hover:bg-gray-200"},[...p[3]||(p[3]=[i.createElementVNode("svg",{fill:"#000000",width:"16",height:"16",viewBox:"0 0 52 52","data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg"},[i.createElementVNode("g",{id:"SVGRepo_bgCarrier","stroke-width":"0"}),i.createElementVNode("g",{id:"SVGRepo_tracerCarrier","stroke-linecap":"round","stroke-linejoin":"round"}),i.createElementVNode("g",{id:"SVGRepo_iconCarrier"},[i.createElementVNode("path",{d:"M48.5,5.6,46.4,3.5a1.67,1.67,0,0,0-2.4.3L32.59,15.21c-.77-1.3-1.51-2.61-2.21-4a36.5,36.5,0,0,1-3.15-8.36c-.13-.53-.39-.91-1-.89s-.86.4-1,.93c-.06.26-.11.51-.17.76A48.3,48.3,0,0,1,21,13.7,97.47,97.47,0,0,1,14.13,25a16,16,0,0,0-3,11.12c0,.14,0,.29.06.43L3.8,44a1.87,1.87,0,0,0-.3,2.4l2.1,2.1A1.67,1.67,0,0,0,8,48.2L48.2,8A1.67,1.67,0,0,0,48.5,5.6Z"}),i.createElementVNode("path",{d:"M38.42,23.79l-22,22.31A14.47,14.47,0,0,0,26.22,50a15.48,15.48,0,0,0,7-1.44c4.94-2.51,8.11-6.4,8.94-12A15.22,15.22,0,0,0,39,24.66C38.87,24.44,38.58,24,38.42,23.79Z"})])],-1),i.createElementVNode("p",null,"no color",-1)])]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,h=>(i.openBlock(),i.createElementBlock("div",{key:h,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[i.createElementVNode("div",T2,[h!=="transparent"?(i.openBlock(),i.createElementBlock("button",{key:0,class:"flex items-center justify-center w-full h-full",style:i.normalizeStyle({backgroundColor:h}),onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],12,A2)):i.createCommentVNode("",!0),h==="transparent"?(i.openBlock(),i.createElementBlock("button",{key:1,class:"flex items-center justify-center w-full h-full",onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],8,B2)):i.createCommentVNode("",!0)])]))),128))])])]),_:1},512))}},L2={__name:"vs-editor-highlight",props:{editor:Object},setup(n){const e=n,t=i.computed(()=>e.editor?.isActive("highlight")),r=()=>{e.editor&&e.editor.chain().focus().toggleHighlight().run()};return(o,s)=>(i.openBlock(),i.createElementBlock("button",{title:"Highlight",onClick:r,class:i.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-200":t.value}])},[...s[0]||(s[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"m9 11-6 6v3h9l3-3"}),i.createElementVNode("path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"})],-1)])],2))}},O2={class:"truncate"},I2={class:"w-[200px]"},D2={class:"max-h-[200px] overflow-y-auto"},R2=["onClick"],F2={__name:"vs-editor-font-family",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref(!1),o=i.ref([{label:"Arial",value:"Arial, sans-serif"},{label:"Helvetica",value:"Helvetica, sans-serif"},{label:"Times New Roman",value:"Times New Roman, serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Courier New",value:"Courier New, monospace"},{label:"Comic Sans MS",value:"Comic Sans MS, cursive"},{label:"Impact",value:"Impact, sans-serif"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Palatino",value:"Palatino, serif"}]),s=i.computed(()=>{if(!e.editor)return"Arial, sans-serif";for(const d of o.value)if(e.editor.isActive("textStyle",{fontFamily:d.value}))return d.value;return"Arial, sans-serif"}),l=i.computed(()=>o.value.find(u=>u.value===s.value)?.label||"Arial"),a=d=>e.editor?e.editor.isActive("textStyle",{fontFamily:d}):!1,c=d=>{e.editor&&(e.editor.chain().focus().setFontFamily(d).run(),t.value&&t.value.togglePopover())};return(d,u)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom",onIsvisible:u[0]||(u[0]=f=>r.value=f)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Font Family",class:i.normalizeClass(["h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm",[r.value?"bg-gray-100 text-gray-900":"text-gray-700"]]),style:i.normalizeStyle({fontFamily:s.value})},[i.createElementVNode("span",O2,i.toDisplayString(l.value),1),u[1]||(u[1]=i.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))],6)]),default:i.withCtx(()=>[i.createElementVNode("div",I2,[i.createElementVNode("ul",D2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,f=>(i.openBlock(),i.createElementBlock("li",{key:f.value,class:i.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",{"bg-gray-100":a(f.value)}]),style:i.normalizeStyle({fontFamily:f.value}),onClick:p=>c(f.value)},i.toDisplayString(f.label),15,R2))),128))])])]),_:1},512))}},P2={class:"w-[120px]"},$2={class:"max-h-[200px] overflow-y-auto"},z2=["onClick"],H2={__name:"vs-editor-font-size",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("14px"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").fontSize||"14px"),s=i.computed(()=>o.value!=="14px"),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.ref([{label:"8px",value:"8px"},{label:"9px",value:"9px"},{label:"10px",value:"10px"},{label:"11px",value:"11px"},{label:"12px",value:"12px"},{label:"14px",value:"14px"},{label:"16px",value:"16px"},{label:"18px",value:"18px"},{label:"20px",value:"20px"},{label:"24px",value:"24px"},{label:"28px",value:"28px"},{label:"32px",value:"32px"},{label:"36px",value:"36px"},{label:"48px",value:"48px"},{label:"72px",value:"72px"}]),c=d=>{e.editor&&(e.editor.chain().focus().setFontSize(d).run(),r.value=d,t.value&&t.value.togglePopover())};return(d,u)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Font Size",class:i.normalizeClass(["h-[30px] px-2 min-w-[30px] rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700 space-x-1",{"bg-gray-100 text-gray-900":s.value}])},[...u[0]||(u[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-alarge-small-icon lucide-a-large-small"},[i.createElementVNode("path",{d:"m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16"}),i.createElementVNode("path",{d:"M15.697 14h5.606"}),i.createElementVNode("path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16"}),i.createElementVNode("path",{d:"M3.304 13h6.392"})],-1),i.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",P2,[i.createElementVNode("ul",$2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,f=>(i.openBlock(),i.createElementBlock("li",{key:f.value,class:"px-3 py-2 hover:bg-gray-100 cursor-pointer",onClick:p=>c(f.value)},i.toDisplayString(f.label),9,z2))),128))])])]),_:1},512))}},j2={props:{editor:Object},methods:{toggleSuperscript(){this.editor&&this.editor.commands.toggleSuperscript()}}};function U2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Superscript",onClick:e[0]||(e[0]=(...l)=>s.toggleSuperscript&&s.toggleSuperscript(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("superscript")}])},[...e[1]||(e[1]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-superscript-icon lucide-superscript"><path d="m4 19 8-8"></path><path d="m12 19-8-8"></path><path d="M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06"></path></svg><span class="sr-only">Superscript</span>',2)])],2)}const W2=Le(j2,[["render",U2]]),K2={props:{editor:Object},methods:{toggleSubscript(){this.editor&&this.editor.commands.toggleSubscript()}}};function q2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Subscript",onClick:e[0]||(e[0]=(...l)=>s.toggleSubscript&&s.toggleSubscript(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("subscript")}])},[...e[1]||(e[1]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-subscript-icon lucide-subscript"><path d="m4 5 8 8"></path><path d="m12 5-8 8"></path><path d="M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07"></path></svg><span class="sr-only">Subscript</span>',2)])],2)}const G2=Le(K2,[["render",q2]]),J2={title:"Heading",class:"h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700"},Y2={class:"truncate"},X2={class:"max-h-[200px] overflow-y-auto"},Z2=["onClick"],Q2=Le({__name:"vs-editor-heading",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref([{label:"Heading 1",value:1},{label:"Heading 2",value:2},{label:"Heading 3",value:3},{label:"Heading 4",value:4},{label:"Heading 5",value:5},{label:"Heading 6",value:6}]),o=i.computed(()=>{if(!e.editor)return"Paragraph";for(let c=1;c<=6;c++)if(e.editor.isActive("heading",{level:c}))return`H ${c}`;return"P"}),s=c=>({1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"})[c]||"",l=c=>{e.editor&&(e.editor.chain().focus().setHeading({level:c}).run(),t.value&&t.value.togglePopover())},a=()=>{e.editor&&(e.editor.chain().focus().setParagraph().run(),t.value&&t.value.togglePopover())};return(c,d)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",J2,[i.createElementVNode("span",Y2,i.toDisplayString(o.value),1),d[0]||(d[0]=i.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))])]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("ul",X2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,u=>(i.openBlock(),i.createElementBlock("li",{key:u.value,class:i.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",`heading-level-${u.value}`]),style:i.normalizeStyle(s(u.value)),onClick:f=>l(u.value)},i.toDisplayString(u.label),15,Z2))),128)),i.createElementVNode("li",{class:"px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm border-t border-gray-200 mt-1 pt-2",onClick:a}," Paragraph ")])])]),_:1},512))}},[["__scopeId","data-v-ef7c378e"]]),eC={props:{editor:Object},methods:{clearFormatting(){this.editor&&this.editor.commands.unsetAllMarks()}}};function tC(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Clear Formatting",onClick:e[0]||(e[0]=(...l)=>s.clearFormatting&&s.clearFormatting(...l)),class:"h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100"},[...e[1]||(e[1]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-remove-formatting-icon lucide-remove-formatting"><path d="M4 7V4h16v3"></path><path d="M5 20h6"></path><path d="M13 4 8 20"></path><path d="m15 15 5 5"></path><path d="m20 15-5 5"></path></svg><span class="sr-only">Clear Formatting</span>',2)])])}const nC=Le(eC,[["render",tC]]),Mo=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t};i.defineComponent({props:{modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1}},data(){return{}},mounted(){this.modelValue||this.$emit("update:modelValue",!1)},computed:{modelState:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n)}},labelCursorClasses(){return[{"cursor-not-allowed":this.disabled},{"cursor-pointer":!this.disabled}]}},methods:{handleEnterDown(n){const{keyCode:e}=n;e===13&&(this.modelState=!this.modelState)},addKeyHandler(){window.addEventListener("keydown",this.handleEnterDown)},removeKeyHandler(){window.removeEventListener("keydown",this.handleEnterDown)}}});const rC={key:0,class:"vsTailwind ui-dialog__wrapper text-gray-800"},oC={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},sC={class:"font-medium text-gray-800 dark:text-[#ffffff]"},lC={class:"ui-dialog__content p-4"},iC={key:0,class:"flex justify-end gap-x-2"},aC={key:1,class:"flex justify-end items-center gap-x-2 py-3 px-4 border-t border-gray-200 dark:border-neutral-700"},cC=i.defineComponent({__name:"vs-modal",props:{title:{default:""},template:{},visible:{type:Boolean,default:!1},size:{default:"small"},closeClickBack:{type:Boolean,default:!1},content:{},buttonText:{},contentProps:{},teleport:{default:"body"}},emits:["update:visible","close","done"],setup(n,{emit:e}){const t=n,r=e,o=i.computed(()=>t.size==="small"?"md:w-5/12 w-9/12":t.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"),s=i.useAttrs();function l(){r("done")}function a(){r("update:visible",!1),r("close")}function c(u){u.key==="Escape"&&a()}function d(u,f){f&&u.target.classList.contains("vs-dialog-overlay")&&a()}return i.onMounted(()=>{window.addEventListener("keydown",c)}),i.onUnmounted(()=>{window.removeEventListener("keydown",c)}),(u,f)=>(i.openBlock(),i.createBlock(i.Teleport,{to:u.teleport},[u.visible?(i.openBlock(),i.createElementBlock("div",rC,[i.createElementVNode("div",{onMousedown:f[0]||(f[0]=p=>d(p,u.closeClickBack)),class:i.normalizeClass(["vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 bg-black bg-opacity-50",[i.unref(s).class]])},[i.createVNode(i.Transition,{name:"content",appear:""},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",o.value])},[i.createElementVNode("div",oC,[i.createElementVNode("h3",sC,i.toDisplayString(u.title),1),i.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:a},[...f[1]||(f[1]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),i.createElementVNode("div",lC,[i.renderSlot(u.$slots,"default",{},void 0,!0)]),u.$slots.footer?(i.openBlock(),i.createElementBlock("div",iC,[i.renderSlot(u.$slots,"footer",{handleClose:a},void 0,!0)])):i.createCommentVNode("",!0),u.buttonText?(i.openBlock(),i.createElementBlock("div",aC,[i.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:a}," Close "),i.createElementVNode("button",{type:"button",onClick:l,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 focus:outline-hidden focus:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none"},i.toDisplayString(u.buttonText),1)])):i.createCommentVNode("",!0)],2)]),_:3})],34)])):i.createCommentVNode("",!0)],8,["to"]))}}),Ia=Mo(cC,[["__scopeId","data-v-a6807cab"]]),dC={},uC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6 text-green-600"};function fC(n,e){return i.openBlock(),i.createElementBlock("svg",uC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])])}const pC=Mo(dC,[["render",fC]]),hC={},mC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"orange",class:"size-6 text-orange-600"};function gC(n,e){return i.openBlock(),i.createElementBlock("svg",mC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])])}const yC=Mo(hC,[["render",gC]]),bC={},kC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6 text-blue-600"};function xC(n,e){return i.openBlock(),i.createElementBlock("svg",kC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"},null,-1)])])}const wC=Mo(bC,[["render",xC]]),EC={},CC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"red",class:"size-6 text-red-600"};function vC(n,e){return i.openBlock(),i.createElementBlock("svg",CC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)])])}const _C=Mo(EC,[["render",vC]]),SC={class:"rounded-md border border-gray-300 bg-white p-4 shadow-sm"},NC={class:"flex items-start gap-4 opacity-100 scale-5 transition-all duration-300"},MC={class:"flex-1"},TC={class:"font-medium text-gray-900"},AC={class:"mt-0.5 text-sm text-gray-700"},BC=i.defineComponent({__name:"vs-notify",props:{type:{},title:{},message:{}},setup(n){const e={success:pC,warning:yC,error:_C,info:wC};return(t,r)=>(i.openBlock(),i.createElementBlock("div",SC,[i.createElementVNode("div",NC,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(e[t.type]))),i.createElementVNode("div",MC,[i.createElementVNode("strong",TC,i.toDisplayString(t.title),1),i.createElementVNode("p",AC,i.toDisplayString(t.message),1)]),r[0]||(r[0]=i.createElementVNode("button",{class:"m-3 rounded-full p-1.5 text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700",type:"button","aria-label":"Dismiss notify"},[i.createElementVNode("span",{class:"sr-only"},"Dismiss popup"),i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-5"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})])],-1))])]))}});i.reactive({visible:!0});const VC=n=>{const{template:e="",title:t="",content:r,contentProps:o={},size:s="medium"}=n||{},l=document.querySelector("body");if(!l)return console.error('Modal root element with id "#modal" not found!'),{close:()=>{}};const a=document.createElement("div");l.appendChild(a);const c={title:t,template:e,visible:!0,size:s,closeClickBack:!0,onClose:u},d=i.createApp({render(){return i.h(Ia,c,{default:()=>[r?i.h(r,o):i.h("p",e)]})}});function u(){d.unmount(),a.remove()}return d.mount(a),{close:u}},yl={top:"top-4 left-1/2 transform -translate-x-1/2","left-bottom":"bottom-4 left-4 transform","right-bottom":"bottom-4 right-4 transform",bottom:"bottom-4 left-1/2 transform -translate-x-1/2"},Pe=n=>{const{type:e="info",title:t,message:r,position:o="right-bottom"}=n||{};let s=document.querySelector("#notify-root");s||(s=document.createElement("div"),s.id="notify-root",s.className=`fixed z-[2000] flex flex-col gap-3 ${yl[o]} p-6 max-w-md mx-auto font-sans antialiased`,document.body.appendChild(s)),s.className.includes(yl[o])||(Object.values(yl).forEach(c=>{s.classList.remove(...c.split(" "))}),s.classList.add(...yl[o].split(" ")));const l=document.createElement("div");s.appendChild(l);const a=i.createApp({render(){return i.h(BC,{type:e,title:t,message:r,onClose:()=>{a.unmount(),l.remove()}})}});a.mount(l),l.querySelector("button")?.addEventListener("click",()=>{l.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{a.unmount(),l.remove()},350)}),setTimeout(()=>{l.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{a.unmount(),l.remove()},350)},3500)},LC={class:"w-full relative"},OC={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},IC={class:"opacity-100"},DC={key:0,class:"text-red-500 text-[14px]"},RC={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},FC=i.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){const e=i.ref("uk"),t=r=>{r.detail.key==="locale"&&(e.value=r.detail.newValue)};return i.onMounted(()=>{e.value=localStorage.locale,window.addEventListener("storage",t)}),i.onUnmounted(()=>{window.removeEventListener("resize",t)}),(r,o)=>(i.openBlock(),i.createElementBlock("div",LC,[r.ua||r.label?(i.openBlock(),i.createElementBlock("div",OC,[i.createElementVNode("span",IC,i.toDisplayString(r.item[e.value]||r.ua||r.label),1),r.item?.rules?.includes("required")?(i.openBlock(),i.createElementBlock("span",DC,"*")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.renderSlot(r.$slots,"default",i.mergeProps(r.$attrs,{class:{"opacity-60":r.item.disabled}})),r.error?(i.openBlock(),i.createElementBlock("span",RC,i.toDisplayString(r.error),1)):i.createCommentVNode("",!0)]))}}),PC={class:"w-full relative flex flex-row items-center gap-2"},$C={key:0,class:"text-red-500 text-[14px]"},zC={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},HC=i.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(n){const e=n,t=i.computed(()=>e.columns??{container:12,label:3}),r=i.computed(()=>{const{container:a,label:c}=t.value;return!a||a<=0?0:Math.min(Math.max(c??0,0),a)/a}),o=i.computed(()=>e.item?.type==="html"||r.value<=0?!1:!!(e.ua||e.label)),s=i.computed(()=>{if(!o.value)return{};const a=`${r.value*100}%`;return{flexBasis:a,maxWidth:a}}),l=i.computed(()=>{const{container:a,label:c}=t.value;if(!a||a<=0)return{};if(e.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!o.value)return{flexBasis:"100%",maxWidth:"100%"};const d=Math.max(a-Math.max(c??0,0),0)/a;if(!d)return{};const u=`${d*100}%`;return{flexBasis:u,maxWidth:u}});return(a,c)=>(i.openBlock(),i.createElementBlock("div",PC,[o.value?(i.openBlock(),i.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:i.normalizeStyle(s.value)},[i.createTextVNode(i.toDisplayString(a.ua||a.label)+" ",1),a.item?.rules?.includes("required")&&(a.ua||a.label)?(i.openBlock(),i.createElementBlock("span",$C,"*")):i.createCommentVNode("",!0)],4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"flex-1 min-w-0",style:i.normalizeStyle(l.value)},[i.renderSlot(a.$slots,"default",i.normalizeProps(i.guardReactiveProps(a.$attrs)))],4),a.error?(i.openBlock(),i.createElementBlock("span",zC,i.toDisplayString(a.error),1)):i.createCommentVNode("",!0)]))}}),jC={class:"w-full relative"},UC={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},WC=i.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",jC,[i.renderSlot(e.$slots,"default",i.normalizeProps(i.guardReactiveProps(e.$attrs))),e.error?(i.openBlock(),i.createElementBlock("span",UC,i.toDisplayString(e.error),1)):i.createCommentVNode("",!0)]))}}),KC={class:"flex-1 min-w-0"},qC={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},GC={class:"truncate"},JC={key:0,class:"text-red-500 text-[14px]"},YC={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},XC={key:0,class:"mt-1 text-xs text-red-500"},ZC=i.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){const e=n,t=i.ref("uk");i.computed(()=>(e.item??{})?.[t.value]??e.ua??e.label??"");const r=i.computed(()=>e.item?.description??""),o=i.computed(()=>Array.isArray(e.item?.rules)&&e.item.rules.includes("required")),s=i.computed(()=>(typeof e.error=="string"?e.error:"")??""),l=a=>{a.key==="locale"&&(t.value=a.newValue??"uk")};return i.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(t.value=localStorage.locale)}catch{}window.addEventListener("storage",l)}),i.onUnmounted(()=>{window.removeEventListener("storage",l)}),(a,c)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["w-full relative",{"opacity-60":a.item?.disabled}])},[i.createElementVNode("div",{class:i.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(a.item.type)?"flex flex-col":""]])},[i.createElementVNode("div",KC,[a.ua||a.label?(i.openBlock(),i.createElementBlock("p",qC,[i.createElementVNode("span",GC,i.toDisplayString(a.item[t.value]||a.ua||a.label),1),o.value?(i.openBlock(),i.createElementBlock("span",JC,"*")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("p",YC,i.toDisplayString(r.value),1)):i.createCommentVNode("",!0)]),i.createElementVNode("div",{class:i.normalizeClass(["w-full",["select","native-select"].includes(a.item.type)?"md:w-[30%]":"md:w-auto"])},[i.renderSlot(a.$slots,"default",i.normalizeProps(i.guardReactiveProps(a.$attrs)))],2)],2),s.value?(i.openBlock(),i.createElementBlock("p",XC,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0)],2))}}),QC={default:FC,horizontal:HC,inline:WC,settings:ZC};function vt(n){return{inputClass:i.computed(()=>{const e=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${n?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return n?.size==="sm"?`${e}h-[32px]`:`${e}h-[38px]`})}}const ev=["placeholder","disabled"],tv=i.defineComponent({__name:"vs-input-password",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"password","onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,ev)),[[i.vModelText,r.value]])}}),nv=["placeholder","disabled"],bl=i.defineComponent({__name:"vs-input-text",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"text","onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,nv)),[[i.vModelText,r.value]])}}),rv=["placeholder","disabled","min","max"],ov=i.defineComponent({__name:"vs-input-number",props:i.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled);return(s,l)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":l[0]||(l[0]=a=>r.value=a),placeholder:s.placeholder,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"},min:s.min,max:s.max},null,10,rv)),[[i.vModelText,r.value]])}}),ge=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},sv={},lv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function iv(n,e){return i.openBlock(),i.createElementBlock("svg",lv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const av=ge(sv,[["render",iv]]),cv={class:"flex items-center gap-[4px]"},dv=["value","id","disabled"],uv=["for"],fv={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},pv=i.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=e,r=n,o=i.computed({get:()=>r.modelValue,set:l=>t("update:modelValue",l)}),s=i.computed(()=>!!r.disabled);return(l,a)=>(i.openBlock(),i.createElementBlock("div",cv,[i.withDirectives(i.createElementVNode("input",{type:"checkbox",value:l.value,"onUpdate:modelValue":a[0]||(a[0]=c=>o.value=c),class:i.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":s.value}]),id:l.id,disabled:s.value},null,10,dv),[[i.vModelCheckbox,o.value]]),i.createElementVNode("label",{for:l.id,class:i.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":s.value}])},[i.createElementVNode("div",{class:i.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",l.error?"border-red-600":""]])},[i.createVNode(av,{height:"12",width:"12"})],2),i.createElementVNode("span",fv,[i.renderSlot(l.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(l.label),1)])])],10,uv)]))}}),hv=["name","value","disabled"],mv={class:"flex items-center gap-[6px] text-[14px]"},gv={key:0,class:"text-[16px]"},yv=["src"],bv=i.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=i.computed({get:()=>t.modelValue,set:a=>{r("update:modelValue",a)}}),s=i.computed(()=>Array.isArray(o.value)?o.value.includes(t.value):o.value===!0||o.value===t.value),l=i.computed(()=>t.style?.size==="xs"?"p-1.5 text-xs":t.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(a,c)=>(i.openBlock(),i.createElementBlock("label",{class:i.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[l.value,s.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[i.withDirectives(i.createElementVNode("input",{type:"checkbox",class:"hidden",name:a.id,value:a.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:a.disabled},null,8,hv),[[i.vModelCheckbox,o.value]]),i.createElementVNode("span",mv,[a.icon||a.imgUrl?(i.openBlock(),i.createElementBlock("span",gv,[a.icon?(i.openBlock(),i.createElementBlock("i",{key:0,class:i.normalizeClass(a.icon)},null,2)):i.createCommentVNode("",!0),a.imgUrl?(i.openBlock(),i.createElementBlock("img",{key:1,src:a.imgUrl,width:"16",height:"16",alt:"icon"},null,8,yv)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(a.label),1)])])],2))}}),kv={class:"flex items-center"},Da=i.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=`radio-${Math.floor(Math.random()*1e4)}`,s=i.computed({get:()=>Array.isArray(t.modelValue)?Array.isArray(t.modelValue)&&t.modelValue.includes(t.value):t.modelValue,set:a=>{if(Array.isArray(t.modelValue)){let c=[...t.modelValue];a?c.includes(t.value)||c.push(t.value):c=c.filter(d=>d!==t.value),r("update:modelValue",c)}else r("update:modelValue",a)}}),l=i.ref(`vs-checkbox-${t.view||"default"}`);return(a,c)=>(i.openBlock(),i.createElementBlock("div",kv,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(l.value==="vs-checkbox-buttons"?i.unref(bv):i.unref(pv)),{value:a.value,label:a.label,info:a.option?.info,disabled:a.disabled,modelValue:s.value,"onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),id:o,icon:a.icon,imgUrl:a.imgUrl,style:i.normalizeStyle(a.style),error:a.error},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(a.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),xv={},wv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function Ev(n,e){return i.openBlock(),i.createElementBlock("svg",wv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const Cv=ge(xv,[["render",Ev]]),vv={},_v={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function Sv(n,e){return i.openBlock(),i.createElementBlock("svg",_v,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),i.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const Nv=ge(vv,[["render",Sv]]),Mv={},Tv={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Av(n,e){return i.openBlock(),i.createElementBlock("svg",Tv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M12 9h.01"},null,-1),i.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),i.createElementVNode("path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"},null,-1)]))}const Bv=ge(Mv,[["render",Av]]),Vv={key:0,class:"flex items-start gap-x-1"},Lv={key:0,class:"text-red-500 text-[14px]"},Ov=["title"],Iv=["disabled"],Kp=i.defineComponent({__name:"vs-input-switcher",props:i.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue");return(r,o)=>e.view==="checkbox"?(i.openBlock(),i.createElementBlock("div",Vv,[i.createVNode(Da,{modelValue:t.value,"onUpdate:modelValue":o[0]||(o[0]=s=>t.value=s),label:r.text,error:r.error||""},null,8,["modelValue","label","error"]),r.rules?.includes("required")?(i.openBlock(),i.createElementBlock("span",Lv,"*")):i.createCommentVNode("",!0),r.i?(i.openBlock(),i.createElementBlock("button",{key:1,class:"cursor-pointer",title:r.i,onClick:o[1]||(o[1]=i.withModifiers(()=>{},["prevent"]))},[i.createVNode(i.unref(Bv),{class:"text-gray-500 w-[14px] h-[14px]"})],8,Ov)):i.createCommentVNode("",!0)])):(i.openBlock(),i.createElementBlock("button",{key:1,type:"button",class:i.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[t.value?`bg-${r.style?.primaryColor||"blue"}-500`:"bg-stone-200",r.customClass]]),disabled:r.disabled,onClick:o[2]||(o[2]=s=>t.value=!t.value)},[i.createElementVNode("span",{"data-state":"checked",class:i.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[t.value?"translate-x-4":"translate-x-0"]])},null,2)],10,Iv))}}),Dv=["id","innerHTML"],qp=i.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",{id:e.name,class:i.normalizeClass(["text-gray-900",e.customClass]),innerHTML:e.html?e.html:e.text},null,10,Dv))}}),Rv=["placeholder","disabled","name"],Fv=i.defineComponent({__name:"vs-input-mask",props:i.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.ref(null);let s=null;return i.onMounted(async()=>{if(o.value){const{default:l}=await Promise.resolve().then(()=>dO);s=l(o.value,{mask:e.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),s.on("accept",()=>{r.value=e.unmask?s.unmaskedValue:s.value}),s.on("complete",()=>{r.value=e.unmask?s.unmaskedValue:s.value}),s.value=r.value??""}}),i.onBeforeUnmount(()=>{s?.destroy()}),i.watch(()=>e.mask,l=>{s&&s.updateOptions({mask:l,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),i.watch(r,l=>{s&&s.unmaskedValue!==l&&(s.value=l||"")}),(l,a)=>(i.openBlock(),i.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:l.placeholder,disabled:l.disabled,name:l.name,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,Rv))}}),Pv={class:"relative w-full bg-white rounded-lg"},$v=["placeholder","disabled"],zv=i.defineComponent({__name:"vs-input-email",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=vt(e.style),r=i.useModel(n,"modelValue");return(o,s)=>(i.openBlock(),i.createElementBlock("div",Pv,[s[1]||(s[1]=i.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),i.withDirectives(i.createElementVNode("input",{type:"email","onUpdate:modelValue":s[0]||(s[0]=l=>r.value=l),placeholder:o.placeholder,disabled:o.disabled,class:i.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,$v),[[i.vModelText,r.value]])]))}}),Hv=["value","disabled"],jv={class:"text-[13px] text-gray-700"},Uv=i.defineComponent({__name:"vs-input-radio-default",props:i.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>!!e.disabled);return(o,s)=>(i.openBlock(),i.createElementBlock("label",{class:i.normalizeClass(["flex items-center gap-0",[e.customClass,r.value?"cursor-not-allowed opacity-60":""]])},[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),type:"radio",value:e.value,disabled:r.value,class:"hidden"},null,8,Hv),[[i.vModelRadio,t.value]]),i.createElementVNode("span",{class:i.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${e.style?.primaryColor||"blue"}-500`,r.value?"opacity-50 cursor-not-allowed":""]])},[t.value==e.value?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${e.style?.primaryColor||"blue"}-500`]])},null,2)):i.createCommentVNode("",!0)],2),i.createElementVNode("span",jv,i.toDisplayString(e.text),1)],2))}}),Wv=["value","disabled"],Kv={class:"text-[13px] text-gray-700"},qv=i.defineComponent({__name:"vs-input-radio-buttons",props:i.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>!!e.disabled);return(o,s)=>(i.openBlock(),i.createElementBlock("label",{class:i.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[t.value==e.value?`ring-2 ring-ring ring-${e.style?.primaryColor||"blue"}-500`:"",e.customClass,r.value?"cursor-not-allowed opacity-60":""]])},[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),type:"radio",value:e.value,disabled:r.value,class:"hidden"},null,8,Wv),[[i.vModelRadio,t.value]]),i.createElementVNode("span",Kv,i.toDisplayString(e.text),1)],2))}}),Gv={"vs-input-radio-default":Uv,"vs-input-radio-buttons":qv},Gp=i.defineComponent({__name:"vs-input-radio",props:i.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>Gv[`vs-input-radio-${e.view}`]);return(o,s)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.options,l=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.value),i.mergeProps({key:l?.id,text:l.text,value:l.id.toString(),checked:t.value===l.id,modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=a=>t.value=a)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Jv={key:1,class:"w-full flex flex-col gap-4"},Yv={key:0,class:"text-sm font-medium text-muted-foreground my-2"},Xv="Без категорії",Zv=i.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=i.ref([]),s=i.reactive({}),l=h=>h?.value||h?.id||h?.text||h,a=h=>h.text||String(h),c=h=>`lg:col-span-${h||12}`,d=i.computed(()=>[t.position==="vertical"?"flex flex-col":"",t.colSpan?"grid":"flex justify-start"]),u=h=>h==null||h===""?null:typeof h=="string"||typeof h=="number"?h:String(h),f=i.computed(()=>{if(!t.group)return[];const h=new Map;o.value.forEach(k=>{const w=k[t.group],x=u(w);h.has(x)||h.set(x,[]),h.get(x)?.push(k)});const m=[];t.values?.length&&t.values.forEach(k=>{const w=u(k);m.push(w)});const g=new Set,y=k=>{const w=h.get(k)||[];if(!w.length)return null;const x=k===null?"group-null":`group-${String(k)}`,E=k===null?Xv:String(k);return g.add(k),{key:x,label:E,options:w}},b=[];return m.forEach(k=>{const w=y(k);w&&b.push(w)}),h.forEach((k,w)=>{if(g.has(w))return;const x=y(w);x&&b.push(x)}),b}),p=async()=>{try{const h=await fetch(`/api/suggest/${t.data}`).then(m=>m.json());o.value=h?.data||h}catch(h){console.error(h)}};return i.watch(()=>t.modelValue,h=>{if(typeof h=="boolean"&&o.value.length===1){const m=l(o.value[0]);s[m]=h}else if(Array.isArray(h)){const m=new Set(h);o.value.forEach(g=>{if(!g.disabled){const y=l(g);s[y]=m.has(y)}})}},{immediate:!0}),i.watch(s,()=>{if(!o.value.length){r("update:modelValue",null);return}const h=Object.entries(s).filter(([,m])=>m).map(([m])=>m);r("update:modelValue",h.length===0?[]:h)},{deep:!0}),i.onMounted(()=>{if(t.data)p().then(()=>{if(typeof t.modelValue=="boolean"&&o.value.length===1){const h=l(o.value[0]);s[h]=t.modelValue}else if(Array.isArray(t.modelValue)){const h=new Set(t.modelValue);o.value.forEach(m=>{if(!m.disabled){const g=l(m);s[g]=h.has(g)}})}});else if(o.value=t.options,typeof t.modelValue=="boolean"&&o.value.length===1){const h=l(o.value[0]);s[h]=t.modelValue}else if(Array.isArray(t.modelValue)){const h=new Set(t.modelValue);o.value.forEach(m=>{if(!m.disabled){const g=l(m);s[g]=h.has(g)}})}}),(h,m)=>t.group?(i.openBlock(),i.createElementBlock("div",Jv,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(f.value,g=>(i.openBlock(),i.createElementBlock("div",{key:g.key,class:"flex flex-col gap-2"},[g.label?(i.openBlock(),i.createElementBlock("span",Yv,i.toDisplayString(g.label),1)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(g.options,y=>(i.openBlock(),i.createBlock(Da,{modelValue:s[l(y)],"onUpdate:modelValue":b=>s[l(y)]=b,value:l(y),class:i.normalizeClass(c(h.colSpan)),disabled:t.disabled||y.disabled,label:a(y),key:`${g.key}-${l(y)}`,icon:y?.icon,imgUrl:y?.imgUrl,option:y,view:h.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,g=>(i.openBlock(),i.createBlock(Da,{modelValue:s[l(g)],"onUpdate:modelValue":y=>s[l(g)]=y,value:l(g),class:i.normalizeClass(c(h.colSpan)),disabled:t.disabled||g.disabled,label:a(g),key:l(g),icon:g?.icon,imgUrl:g?.imgUrl,option:g,view:h.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),Qv=ge(Zv,[["__scopeId","data-v-8e66207e"]]),e_=["type","placeholder","disabled"],t_=i.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},mode:{default:"date"}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n;function r(u){return u?t.mode==="datetime"?(u.includes("T")?u:null)||u+(u.includes(" ")?"":"T00:00"):u?.split(" ")[0]:null}const{inputClass:o}=vt(t.style),s=e,l=i.computed({get:()=>r(t.modelValue),set:u=>s("update:modelValue",u)}),a=i.computed(()=>t.mode==="datetime"?"datetime-local":t.mode),c=i.computed(()=>!!t.disabled),d=i.computed(()=>t.placeholder??"");return(u,f)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:a.value,"onUpdate:modelValue":f[0]||(f[0]=p=>l.value=p),placeholder:d.value,disabled:c.value,ref:"date",class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[u.modelValue?"":"text-opacity-50",i.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,e_)),[[i.vModelDynamic,l.value]])}}),Jp=async(n,e,t,r)=>{try{const o=new FormData;return o.append("unique","true"),o.append("file",n),(await fetch(`/file/upload/uploads?id=${e||""}&form=${t||""}&table=${r||""}`,{method:"POST",body:o}).then(s=>s.json()))?.result}catch(o){return Pe({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",o),null}},n_=async n=>{try{return await fetch(`file/delete${n}`),!0}catch(e){return console.error(e),!1}},Yp=async n=>{try{const e=await fetch(`file/download/files/uploads${n}`),t=await e.arrayBuffer(),r=e.headers["content-type"],o=new TextDecoder("utf-8").decode(t),s=new Blob([o],{type:r}),l=document.createElement("a");l.setAttribute("download",n),l.href=window.URL.createObjectURL(s),l.click()}catch(e){console.error(e.message)}},r_={},o_={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function s_(n,e){return i.openBlock(),i.createElementBlock("svg",o_,e[0]||(e[0]=[i.createElementVNode("path",{d:"M5 12h14"},null,-1),i.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const To=ge(r_,[["render",s_]]),l_={},i_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-text",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function a_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",i_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>',6)]))}const c_=ge(l_,[["render",a_]]),d_={},u_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-table",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function f_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",u_,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),i.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),i.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const p_=ge(d_,[["render",f_]]),h_={},m_={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function g_(n,e){return i.openBlock(),i.createElementBlock("svg",m_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)]))}const Xp=ge(h_,[["render",g_]]),y_={},b_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-zip",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function k_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",b_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>',9)]))}const x_=ge(y_,[["render",k_]]),w_={},E_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-code",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function C_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",E_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>',5)]))}const v_=ge(w_,[["render",C_]]),__=n=>{if(!n)return"";const e=n?.split(".");return e[e.length-1]},S_=n=>{const e=__(n),t={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return t.imageFormat.includes(e)?"img":t.sheetsFormat.includes(e)?p_:t.textsFormat.includes(e)?v_:t.documentsFormat.includes(e)?c_:t.archivesFormat.includes(e)?x_:Xp},N_={},M_={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function T_(n,e){return i.openBlock(),i.createElementBlock("svg",M_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const kl=ge(N_,[["render",T_]]),A_={},B_={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function V_(n,e){return i.openBlock(),i.createElementBlock("svg",B_,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Zp=ge(A_,[["render",V_]]),L_=["title"],O_={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},I_=i.defineComponent({__name:"vs-input-file-list-item",props:i.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(n){const e=i.useModel(n,"value"),t=i.useModel(n,"item"),r=n;return(o,s)=>(i.openBlock(),i.createElementBlock("div",{title:t.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(S_)(t.value)),{src:t.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:s[0]||(s[0]=l=>i.unref(Yp)(t.value))},null,8,["src"])),i.createElementVNode("div",O_,[i.createElementVNode("button",{type:"button",onClick:s[1]||(s[1]=l=>{i.unref(n_)(t.value),e.value=r.multiple?e.value?.filter(a=>a!==t.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[i.createVNode(kl,{class:"w-4 h-4"})]),i.createElementVNode("button",{type:"button",onClick:s[2]||(s[2]=l=>i.unref(Yp)(t.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[i.createVNode(Zp,{class:"w-4 h-4"})])])],8,L_))}}),Qp=ge(I_,[["__scopeId","data-v-286cdbc0"]]),D_={class:"flex items-center gap-x-2"},R_=["multiple","disabled"],F_={key:1,class:"flex items-center flex-wrap gap-2"},P_={key:1,class:"loader"},$_={key:1,class:"loader"},z_=i.defineComponent({__name:"vs-input-file",props:i.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:i.mergeModels(["change"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=i.useModel(n,"modelValue"),o=e,s=i.ref(null),l=i.ref(!1),a=u=>Array.isArray(r.value)&&r.value[u]||"",c=u=>{if(t.max_size&&u.size>t.max_size*1024*1024){const f=(u.size/1048576).toFixed(2);return Pe({type:"error",title:"Помилка!",message:`Файл "${u.name}" занадто великий. Максимальний розмір: ${t.max_size} МБ, розмір файлу: ${f} МБ`,position:"right-bottom"}),!1}return!0},d=async u=>{const{files:f}=u.target;if(!f||f.length===0)return;const p=Array.from(f);if(t.max_size&&p.filter(h=>!c(h)).length>0){s.value&&(s.value.value="");return}l.value=!0;try{if(t.multiple){const h=Array.from(f).map(async g=>t.format&&!g.name.endsWith(t.format)?null:await Jp(g,"1","form","table")),m=(await Promise.all(h)).filter(g=>g!==null).map(g=>g?.file_path).filter(Boolean);r.value=[...r.value||[],...m],o("change",r.value)}else{const h=f[0];if(t.format&&!h.name.endsWith(t.format))return;const m=await Jp(h,"1","form","table");r.value=m?.file_path,o("change",r.value||"")}}finally{l.value=!1,s.value&&(s.value.value="")}};return(u,f)=>(i.openBlock(),i.createElementBlock("div",D_,[i.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:s,type:"file",multiple:u.multiple,onChange:d,disabled:l.value||u.disabled},null,40,R_),!u.multiple&&r.value?(i.openBlock(),i.createBlock(Qp,{key:0,item:r.value,"onUpdate:item":f[0]||(f[0]=p=>r.value=p),value:r.value,"onUpdate:value":f[1]||(f[1]=p=>r.value=p)},null,8,["item","value"])):u.multiple?(i.openBlock(),i.createElementBlock("div",F_,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,(p,h)=>(i.openBlock(),i.createBlock(Qp,{multiple:u.multiple,key:h,value:r.value,"onUpdate:value":f[2]||(f[2]=m=>r.value=m),item:a(h)},null,8,["multiple","value","item"]))),128)),i.createElementVNode("div",{onClick:f[3]||(f[3]=p=>!u.disabled&&!l.value&&s.value?.click()),class:i.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",u.disabled||l.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[l.value?(i.openBlock(),i.createElementBlock("div",P_)):(i.openBlock(),i.createBlock(To,{key:0,class:"w-6 h-6"}))],2)])):i.createCommentVNode("",!0),u.multiple?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",{key:2,onClick:f[4]||(f[4]=p=>s.value?.click()),class:i.normalizeClass([u.disabled||l.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[l.value?(i.openBlock(),i.createElementBlock("div",$_)):(i.openBlock(),i.createBlock(To,{key:0,class:"w-6 h-6"}))],2))]))}}),H_=ge(z_,[["__scopeId","data-v-e613a523"]]),j_={class:"max-w-[55vw]"},U_={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},W_={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},K_={class:"px-[5px]"},q_={class:""},xl=i.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(n){const e=n,t=i.computed(()=>{try{return new Date(e.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function r(o){if(o<1024)return`${o} B`;const s=o/1024;return s<1024?`${s.toFixed(2)} KB`:`${(s/1024).toFixed(2)} MB`}return(o,s)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[s[1]||(s[1]=i.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),i.createElementVNode("div",j_,[i.createElementVNode("p",U_,i.toDisplayString(o.item?.uploaded_name),1),i.createElementVNode("p",W_,[i.createElementVNode("span",null,i.toDisplayString(o.item?.username),1),i.withDirectives(i.createElementVNode("span",K_,"|",512),[[i.vShow,o.item?.username]]),i.createElementVNode("span",null,i.toDisplayString(t.value),1),s[0]||(s[0]=i.createElementVNode("span",{class:"px-[5px]"},"|",-1)),i.createElementVNode("span",q_,i.toDisplayString(r(o.item?.size)),1)])])],64))}}),G_={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},J_={key:0,class:"flex w-full gap-x-3 items-center"},Y_={key:1,class:"flex gap-x-3 w-full items-center"},X_={key:2,class:"flex gap-x-3 w-full items-center"},Z_=["href"],Q_={key:3,class:"flex gap-x-3 w-full items-center"},eS={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},tS={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},nS={class:"inline-block"},rS={class:"inline-block"},oS=i.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(n,{emit:e}){const t=n,r=e;function o(u){return["pdf","json"].includes(u.ext)}function s(u){return["ppt","pptx","doc","docx","xls","xlsx"].includes(u.ext)}function l(u){const f=document.createElement("a");f.setAttribute("download",u?.uploaded_name),f.href=u?.file_path,f.click()}async function a(){try{await fetch(`${t.prefix}/widget/file/${t.item.entity_id}/${t.item.file_id}`),r("update")}catch(u){console.error(u)}}function c(){r("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:a,updateListOnConfirm:!0})}function d(u){(t.item.ext==="jpg"||t.item.ext==="png")&&r("openLightbox",{item:t.item,index:u})}return(u,f)=>(i.openBlock(),i.createElementBlock("div",G_,[u.item.ext==="jpg"||u.item.ext==="png"?(i.openBlock(),i.createElementBlock("div",J_,[i.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:f[0]||(f[0]=p=>d(u.index))},[i.createVNode(xl,{item:u.item},null,8,["item"])])])):o(u.item)?(i.openBlock(),i.createElementBlock("div",Y_,[i.createVNode(xl,{item:u.item},null,8,["item"])])):s(u.item)?(i.openBlock(),i.createElementBlock("div",X_,[i.createElementVNode("a",{href:`/api/file-preview?id=${u.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[i.createVNode(xl,{item:u.item},null,8,["item"])],8,Z_)])):(i.openBlock(),i.createElementBlock("div",Q_,[i.createVNode(xl,{item:u.item},null,8,["item"])])),i.createElementVNode("div",eS,[i.createElementVNode("div",tS,[i.createElementVNode("div",nS,[i.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:f[1]||(f[1]=p=>l(u.item))},[i.createVNode(Zp,{height:"14",width:"14"})])]),f[3]||(f[3]=i.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),i.createElementVNode("div",rS,[i.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:f[2]||(f[2]=p=>c())},[i.createVNode(kl,{height:"14",width:"14"})])])])])]))}}),sS={},lS={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function iS(n,e){return i.openBlock(),i.createElementBlock("svg",lS,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const aS=ge(sS,[["render",iS]]),cS={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},dS={class:"flex w-full mb-[12px] items-center gap-x-2"},uS={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},fS={class1:"ml-auto"},pS={class:"py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},hS={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},mS={class:"relative"},gS={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},yS={key:0},bS=i.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update"],setup(n,{emit:e}){const t=n,r=i.inject("form"),o=i.computed(()=>r.value.formId),s=i.ref(!1),l=i.ref(0),a=e,c=i.ref(!1),d=i.ref({}),u=i.ref([]),f=i.ref(""),p=i.computed(()=>Array.isArray(u.value)?u.value.filter(w=>w.ext==="jpg"||w.ext==="png").map(w=>w?.file_path):[]),h=i.computed(()=>f.value===""?u.value:u.value.filter(w=>w?.uploaded_name?.includes(f.value))),m=w=>{const x=p.value.findIndex(E=>E===w.item.file_path);x!==-1&&(s.value=!0,l.value=x)},g=async()=>{try{const w=await fetch(`${t.prefix}/widget/file/${o.value}`).then(x=>x.json());u.value=w?.rows}catch(w){console.error(w)}},y=async w=>{await Promise.all(Array.from(w.target.files).map(async x=>{const E=new FormData;E.append("file",x);try{const M=`${t.prefix}/widget/file/${o.value}`,C=await fetch(M,{method:"POST",body:E});return C.ok?(a("update","file-list"),x):(Pe({type:C.status>=400&&C.status<500?"warning":"error",title:"Error",message:`Error code: ${C.status}`}),null)}catch(M){return Pe({type:"error",title:"Error",message:M.message||"Unknown error"}),console.error(M),null}})),await g()},b=w=>{const x={...w};return w.cancel||(x.cancel=()=>{c.value=!1}),w.updateListOnConfirm&&(x.confirm=async()=>{await w.confirm(),c.value=!1,g()}),x},k=w=>{d.value=b(w),c.value=!0};return i.watch(o,w=>{w&&g()}),i.onMounted(()=>{o.value&&g()}),(w,x)=>{const E=i.resolveComponent("Lightbox"),M=i.resolveComponent("MessageBox");return i.openBlock(),i.createElementBlock("div",cS,[i.createElementVNode("div",dS,[i.createElementVNode("h2",uS," Файлів: "+i.toDisplayString(u.value?.length),1),i.createElementVNode("div",fS,[i.createElementVNode("label",null,[i.createElementVNode("input",{type:"file",class:"hidden",onChange:x[0]||(x[0]=C=>y(C))},null,32),i.createElementVNode("div",pS,[i.createVNode(aS,{height:"16",width:"16"})])])])]),u.value?.length>4?(i.openBlock(),i.createElementBlock("div",hS,[i.createElementVNode("div",null,[i.createElementVNode("div",mS,[x[8]||(x[8]=i.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[i.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),i.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":x[1]||(x[1]=C=>f.value=C),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[i.vModelText,f.value,void 0,{trim:!0}]])])])])):i.createCommentVNode("",!0),u.value?.length?(i.openBlock(),i.createElementBlock("div",gS,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(C,A)=>(i.openBlock(),i.createBlock(oS,{key:A,prefix:w.prefix,item:C,index:A,onUpdate:x[2]||(x[2]=z=>w.$emit("update","file-list")),onOpenModal:x[3]||(x[3]=z=>k(z)),onOpenLightbox:x[4]||(x[4]=z=>m(z))},null,8,["prefix","item","index"]))),128)),h.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",yS,x[9]||(x[9]=[i.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):i.createCommentVNode("",!0),i.createVNode(E,{modelValue:s.value,"onUpdate:modelValue":x[5]||(x[5]=C=>s.value=C),startIndex:l.value,"onUpdate:index":x[6]||(x[6]=C=>l.value=C),images:p.value},null,8,["modelValue","startIndex","images"]),i.createVNode(M,i.mergeProps({modelValue:c.value,"onUpdate:modelValue":x[7]||(x[7]=C=>c.value=C),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),kS={class:"flex items-center justify-between"},xS={class:"text-[16px] text-gray-900 font-medium"},wS={class:"grid gap-3"},ES=i.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(n){const e=n,t=i.ref(e.isOpen);return i.watch(()=>e.isOpen,r=>{t.value=r}),(r,o)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",kS,[i.createElementVNode("p",xS,i.toDisplayString(n.title),1),i.createVNode(Kp,{modelValue:t.value,"onUpdate:modelValue":o[0]||(o[0]=s=>t.value=s),style:i.normalizeStyle(n.style)},null,8,["modelValue","style"])]),i.createVNode(i.Transition,{name:"slide-fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",wS,[i.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[i.vShow,t.value]])]),_:3})]))}}),CS=ge(ES,[["__scopeId","data-v-90320b87"]]),vS={class:"text-[16px] text-gray-900 font-medium"},_S={class:"grid gap-3"},SS=i.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(n){const e=n,t=i.ref(e.isOpen);return i.watch(()=>e.isOpen,r=>{t.value=r}),(r,o)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=s=>t.value=!t.value),class:"flex items-center gap-2"},[i.createVNode(i.unref(Cv),{class:i.normalizeClass(["h-4 w-4 duration-300",[t.value?"-rotate-180":""]])},null,8,["class"]),i.createElementVNode("span",vS,i.toDisplayString(n.title),1)]),i.createVNode(i.Transition,{name:"slide-fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",_S,[i.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[i.vShow,t.value]])]),_:3})]))}}),NS=ge(SS,[["__scopeId","data-v-590eff11"]]),MS={class:"flex items-center justify-between"},TS=i.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",MS,[i.createElementVNode("p",null,i.toDisplayString(n.title),1)]),i.renderSlot(e.$slots,"default")]))}}),AS={switcher:CS,accordion:NS,default:TS},Ot={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},BS=(n,e)=>String(n)===String(e),VS=(n,e)=>String(n)!==String(e),LS=(n,e)=>n>e,OS=(n,e)=>n>=e,IS=(n,e)=>n<e,DS=(n,e)=>n<=e,RS=(n,e)=>Array.isArray(e)&&e.length===2?n>=e[0]&&n<=e[1]:!1,FS=(n,e)=>String(n).startsWith(String(e)),PS=(n,e)=>String(n).endsWith(String(e)),$S=(n,e)=>String(n).includes(String(e)),zS=(n,e)=>Array.isArray(e)?e.includes(n):!1,HS=(n,e)=>Array.isArray(e)?!e.includes(n):!0,eh=(n,e)=>{if(!e)return!0;switch(e?.[1]){case Ot.Equal:return BS(n,e?.[2]);case Ot.Inequal:return VS(n,e?.[2]);case Ot.Higer:return LS(n,e?.[2]);case Ot.HigerOrEqual:return OS(n,e?.[2]);case Ot.Lower:return IS(n,e?.[2]);case Ot.LowerOrEqual:return DS(n,e?.[2]);case Ot.Between:return RS(n,e?.[2]);case Ot.StartWith:return FS(n,e?.[2]);case Ot.EndWith:return PS(n,e?.[2]);case Ot.Contain:return $S(n,e?.[2]);case Ot.In:return zS(n,e?.[2]);case Ot.NotIn:return HS(n,e?.[2]);default:return!0}},jS=i.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(n){const e=n,t=i.inject("values",i.ref({})),r=i.inject("form"),o=i.computed(()=>e.schema?.filter(a=>{const c=a?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,u=e.name?t.value?.[e.name]?.[d]??t.value?.[d]:t.value?.[d];return eh(u,c)})),s=i.computed(()=>AS[e.view]),l=i.computed(()=>{if(t.value||(t.value={}),!e.name)return t.value;const a=t.value[e.name];if(a)return a;const c={};return t.value={...t.value,[e.name]:c},c});return(a,c)=>n.schema?.length?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value),{key:0,title:n.title,style:i.normalizeStyle(n.style)},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,d=>(i.openBlock(),i.createBlock(rh,i.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:l.value[d.name],"onUpdate:modelValue":u=>l.value[d.name]=u,style:n.style,error:i.unref(r)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):i.createCommentVNode("",!0)}}),US=["aria-expanded","data-focus"],WS={key:0,class:"flex flex-wrap items-center gap-1 overflow-y-auto min-w-0 flex-1"},KS={class:"flex items-center min-w-0"},qS=["title"],GS=["innerHTML"],JS=["onClick"],YS={class:"flex-1 min-w-[2px]"},XS=["placeholder"],ZS=["title"],QS=["innerHTML"],eN={key:2,class:"flex-1 min-w-[2px]"},tN=["placeholder"],nN={class:"flex items-center shrink-0"},rN=["disabled"],oN=["disabled","title"],sN=["aria-disabled","onClick"],lN=["innerHTML"],iN={key:1,class:"px-3 py-2 text-center text-gray-500"},aN=["disabled"],th=i.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=i.computed(()=>t.multiple),s=i.computed(()=>t.disabled);vt(t.style);const l=i.computed({get:()=>t.modelValue,set:T=>r("update:modelValue",T)});!l.value&&t.defaultValue&&(l.value=t.defaultValue);const a=i.ref(null),c=i.ref(null),d=i.ref(null),u=i.ref(null),f=i.ref(!1),p=i.ref(!1),h=i.ref(null),m=i.ref([]),g=i.ref(-1),y=i.ref([]),b=i.ref(""),k=i.ref(null),w=i.ref("bottom"),x=i.ref({}),E=i.ref([]),M=i.computed(()=>{if(!E.value.length)return[];const T=m.value,R=new Map(T.map(j=>[j.id?.toString(),j]));return E.value.map(j=>R.get(j?.toString())).filter(j=>!!j)}),C=i.computed(()=>t.placeholder||"Select..."),A=i.computed(()=>U(h.value));i.computed(()=>o.value?!E.value.length&&b.value==="":!A.value&&b.value==="");const z=i.computed(()=>s.value?!1:o.value?E.value.length>0:!!l.value),G=T=>o.value?E.value.some(R=>R?.toString()===T?.toString()):l.value?.toString()===T?.toString(),V=i.computed(()=>{let T=m.value??[];if(!t.data&&b.value.trim()!==""){const R=b.value.toLowerCase();T=T.filter(j=>{const ae=U(j).toLowerCase(),_e=j.text?.toLowerCase?.()||"";return ae.includes(R)||_e.includes(R)})}if(o.value&&E.value.length){const R=new Set(E.value.map(j=>j?.toString()));T=T.filter(j=>!R.has(j.id?.toString()))}return T}),O=i.inject("values"),Y=/\{\{\s*([^}]+?)\s*\}\}/g,Q=T=>(T?String(T):"").replace(/<[^>]*>/g,"").trim(),P=i.computed(()=>t.slot??t?.optionTemplate??""),K=T=>{if(!T)return"";const R=P.value;return R?R.replace(Y,(j,ae)=>{const _e=ae.trim(),Ze=T[_e];return Ze!=null?String(Ze):""}):T.text??""},U=T=>{if(!T)return"";if(!P.value)return T.text??"";const R=K(T);return Q(R)||T.text||""},re=T=>{t.set&&O?.value&&Object.entries(t.set).forEach(([R,j])=>{if(!R)return;const ae=T?T[j]:null;O.value[R]=ae??null})},se=i.computed(()=>t.parent?O?.value?.[t.parent]?.toString()??null:null),ve=async T=>{if(!t.data){let R=t.options??[];if(T?.trim()){const j=T.toLowerCase();R=R.filter(ae=>{const _e=U(ae).toLowerCase(),Ze=ae.text?.toLowerCase?.()||"";return _e.includes(j)||Ze.includes(j)})}return R}try{const R=t.host??"",j=t.prefix??"api",ae=t.api??`/${j}/suggest/${t.data}`,_e=`${R}${ae}`,Ze=new URLSearchParams;return Ze.set("json","1"),T&&Ze.set("key",T),se.value!==void 0&&se.value!==null&&se.value!==""&&Ze.set("parent",se.value),(await fetch(`${_e}?${Ze.toString()}`).then(Nt=>Nt.json()))?.data??[]}catch{return[]}},pt=async()=>{t.data?m.value=await ve(b.value):m.value=t.options?[...t.options]:[]},St=async T=>{if(T==null)return null;const R=m.value?.find(j=>j?.id?.toString()===String(T));if(R)return R;if(t.data)try{const j=t.host??"",ae=t.prefix??"api",_e=t.api??`/${ae}/suggest/${t.data}`,Ze=`${j}${_e}`,Nt=new URLSearchParams;return Nt.set("json","1"),Nt.set("val",String(T)),se.value!==void 0&&se.value!==null&&se.value!==""&&Nt.set("parent",se.value),((await fetch(`${Ze}?${Nt.toString()}`).then(Wr=>Wr.json()))?.data??[])?.[0]??null}catch{return null}return null},Ft=async T=>{const R=new Set(m.value.map(ae=>ae.id?.toString())),j=T.filter(ae=>!R.has(ae?.toString()));j.length&&await j.reduce(async(ae,_e)=>{await ae;const Ze=await St(_e);Ze&&m.value.push(Ze)},Promise.resolve())},Ke=async()=>{s.value||(f.value=!0,await pt(),await i.nextTick(()=>{$t(),k.value?.focus(),V.value.length?g.value=0:g.value=-1}))},ht=()=>{f.value=!1,g.value=-1},En=async T=>{s.value||(f.value?ht():await Ke())},Cn=async()=>{f.value?k.value?.focus():await Ke()},vn=()=>{o.value?(E.value=[],l.value=[],r("change",[])):(h.value=null,l.value=null,r("change",null)),re(null),b.value="",i.nextTick(()=>k.value?.focus())},xr=T=>{o.value&&(E.value=E.value.filter(R=>R?.toString()!==T?.toString()),l.value=[...E.value],r("change",l.value),i.nextTick(()=>k.value?.focus()))},mt=T=>{o.value?(G(T.id)||(E.value=[...E.value,T.id],l.value=[...E.value],r("change",l.value)),b.value="",i.nextTick(()=>{k.value?.focus(),g.value=Math.min(g.value,V.value.length-1)}),re(null)):(h.value=T,l.value=T.id,r("change",l.value),b.value="",ht(),re(T))},Pt=T=>{G(T.id)||mt(T)},cn=(T,R)=>{if(!T||!R)return;const j=T.offsetTop,ae=j+T.offsetHeight,_e=R.scrollTop,Ze=_e+R.clientHeight;let Nt=R.scrollTop;j<_e?Nt=j-80:ae>Ze&&(Nt=ae-R.clientHeight+4);const Wr=R;Wr.scrollTop=Nt},qe=T=>{let R=T.parentElement;for(;R;){if(R.classList.contains("ui-dialog__content"))return R;const j=window.getComputedStyle(R),ae=j.overflow+j.overflowY+j.overflowX;if(ae.includes("auto")||ae.includes("scroll")||R===document.body||R===document.documentElement)return R;R=R.parentElement}return document.body},$t=()=>{if(!c.value)return;const T=c.value.getBoundingClientRect(),R=window.innerHeight||document.documentElement.clientHeight,j=window.innerWidth||document.documentElement.clientWidth,ae=8,_e=8,Ze=t.maxHeight||300,Nt=R-T.bottom-_e-ae,Wr=T.top-_e-ae,Dl=Nt>=Wr,bc=Math.max(j-ae*2,0);let{width:jo}=T;bc>0&&jo>bc&&(jo=bc);let{left:Uo}=T;Uo+jo+ae>j&&(Uo=j-jo-ae),Uo=Math.max(Uo,ae);const uO=Math.min(Ze,Math.max(Dl?Nt:Wr,50));w.value=Dl?"bottom":"top",x.value={position:"fixed",left:`${Uo}px`,width:`${jo}px`,minWidth:"300px",maxHeight:`${uO}px`,transform:Dl?"none":"translateY(-100%)",top:Dl?`${T.bottom+_e}px`:`${T.top-_e}px`}},qt=async T=>{s.value||!f.value&&(T.key==="ArrowDown"||T.key==="ArrowUp")&&(T.preventDefault(),await Ke())},dn=T=>{if(!f.value)return;const{key:R}=T;if(R==="ArrowDown")T.preventDefault(),g.value+1<V.value.length&&(g.value+=1,cn(y.value[g.value],d.value));else if(R==="ArrowUp")T.preventDefault(),g.value>0&&(g.value-=1,cn(y.value[g.value],d.value));else if(R==="Enter"){T.preventDefault();const j=V.value[g.value];j&&mt(j),k.value?.blur()}else R==="Escape"?(T.preventDefault(),ht()):R==="Backspace"?o.value&&b.value===""&&E.value.length&&(E.value=E.value.slice(0,-1),l.value=[...E.value],r("change",l.value)):R==="Home"?(g.value=0,cn(y.value[0],d.value)):R==="End"?(g.value=V.value.length-1,cn(y.value[g.value],d.value)):R==="Tab"&&ht()},Xn=()=>{s.value||(p.value=!0)},_=()=>{p.value=!1,b.value=""},S=T=>{T.key==="Escape"&&f.value&&ht()},D=T=>{const R=T.target;a.value?.contains(R)||u.value?.contains(R)||ht()},X=T=>{f.value&&d.value&&!d.value.contains(T.target)&&$t()},we=()=>{f.value&&$t()},Be=()=>{f.value&&$t()};i.watch(()=>t.options,T=>{T?.length&&(m.value=[...T],pe())},{immediate:!0});async function pe(){if(o.value)Array.isArray(l.value)?E.value=[...l.value]:(E.value=l.value==null?[]:[l.value],l.value=[...E.value]),t.data&&E.value.length&&(await Ft(E.value),await i.nextTick());else{if(Array.isArray(l.value)){const T=l.value[0]??null;l.value=T??null}l.value!=null&&(h.value=await St(l.value)),re(h.value??null)}}i.watch(l,()=>{pe()}),i.onMounted(async()=>{addEventListener("keydown",S),addEventListener("scroll",X,!0),addEventListener("resize",we),document.addEventListener("click",D,!0),c.value&&qe(c.value).addEventListener("scroll",Be,!0),t.options?.length&&!t.data?m.value=[...t.options]:t.data&&(m.value=await ve("")),await pe(),fe.value=!1}),i.onUnmounted(()=>{removeEventListener("keydown",S),removeEventListener("scroll",X,!0),removeEventListener("resize",we),document.removeEventListener("click",D,!0),c.value&&qe(c.value).removeEventListener("scroll",Be,!0)});const B=i.ref(!1),F=i.ref({}),he=i.ref([]),v=i.ref(null);async function N(){if(!t.add?.token||v?.value.validate())return;const T=t.add.api??`/api/table/${t.add.token}`,{id:R}=await fetch(T,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F.value)}).then(j=>j.json());if(!t.options?.length&&t.data){const{data:j}=await fetch(`${t.api??`/api/suggest/${t.data}`}?val=${R}`).then(ae=>ae.json());h.value=j[0],m.value.push(j[0]),l.value=R}B.value=!1,Pe({title:"Success!",message:"Object created."})}async function H(){if(!t.add)return null;const T=await fetch(`/api/template/form/${t.add.form}`).then(R=>R.json());return he.value=T.schema,B.value=!0,null}function W(T,R=200){let j;return(...ae)=>{j&&clearTimeout(j),j=window.setTimeout(()=>T(...ae),R)}}const Z=W(async T=>{m.value=await ve(T)},200);i.watch(b,T=>{t.data&&Z(T.trim())}),i.watch(()=>t.options,T=>{!t.data&&T?.length&&(m.value=[...T],pe())},{immediate:!0}),i.watch(()=>t.parent??t.parentValue,()=>{t.data&&pt()});const fe=i.ref(!0);return i.watch(se,async()=>{if(t.data&&(fe.value||(o.value?(E.value=[],l.value=[],r("change",[])):(h.value=null,l.value=null,r("change",null))),await pt(),t.auto===1&&se.value&&m.value.length>0)){const T=m.value[0];T&&mt(T)}}),(T,R)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(i.unref(Ia),{visible:B.value,"onUpdate:visible":R[1]||(R[1]=j=>B.value=j),title:"Додати",buttonText:"Додати",onDone:N,teleport:T.teleport},{default:i.withCtx(()=>[i.createVNode(Rr,{schema:he.value,modelValue:F.value,"onUpdate:modelValue":R[0]||(R[0]=j=>F.value=j),ref_key:"addForm",ref:v},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),i.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:a,onClick:R[5]||(R[5]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:i.normalizeClass(["relative w-full font-sans",t.customClass])},[R[10]||(R[10]=i.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),R[11]||(R[11]=i.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),i.createElementVNode("div",{class:i.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",f.value||p.value?"border-blue-500 ring-1 ring-blue-500":"",s.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":f.value,"aria-haspopup":"listbox",onKeydown:qt,onClick:Cn,"data-focus":f.value||p.value?"true":"false"},[i.createElementVNode("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full",ref_key:"triggerRef",ref:c},[o.value?(i.openBlock(),i.createElementBlock("div",WS,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(M.value,j=>(i.openBlock(),i.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:j.id},[i.createElementVNode("div",KS,[j?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:i.normalizeStyle({backgroundColor:j?.color})},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"truncate text-gray-900 overflow-hidden max-w-[200px] px-0.5 py-[2px] pl-1.5",title:U(j)},[P.value?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:K(j)},null,8,GS)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(j.text),1)],64))],8,qS)]),i.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b] flex-shrink-0",onClick:i.withModifiers(ae=>xr(j.id),["stop"])},R[6]||(R[6]=[i.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,JS)]))),128)),i.createElementVNode("div",YS,[!s.value&&T.search?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:E.value.length?" ":C.value,"onUpdate:modelValue":R[2]||(R[2]=j=>b.value=j),onFocus:Xn,onBlur:_,onKeydown:dn},null,40,XS)),[[i.vModelText,b.value]]):i.createCommentVNode("",!0)])])):!o.value&&!p.value&&A.value&&b.value===""?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["truncate text-gray-900"]),title:A.value},[h.value?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:i.normalizeStyle({backgroundColor:h.value?.color})},null,4)):i.createCommentVNode("",!0),P.value?(i.openBlock(),i.createElementBlock("span",{key:1,class:i.normalizeClass({"pl-5":h.value?.color}),innerHTML:K(h.value)},null,10,QS)):(i.openBlock(),i.createElementBlock("span",{key:2,class:i.normalizeClass({"pl-5":h.value?.color})},i.toDisplayString(h.value?.text),3))],8,ZS)):i.createCommentVNode("",!0),o.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",eN,[!s.value&&T.search?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:A.value?" ":C.value,"onUpdate:modelValue":R[3]||(R[3]=j=>b.value=j),onFocus:Xn,onBlur:_,onKeydown:dn},null,40,tN)),[[i.vModelText,b.value]]):i.createCommentVNode("",!0)]))],512),i.createElementVNode("div",nN,[z.value?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:s.value,onClick:i.withModifiers(vn,["stop"])},R[7]||(R[7]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,rN)):i.createCommentVNode("",!0),R[9]||(R[9]=i.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),i.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:s.value,onClick:R[4]||(R[4]=i.withModifiers(j=>En(),["stop"])),title:f.value?"Закрити список":"Відкрити список"},R[8]||(R[8]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)]),8,oN)])],42,US),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[f.value?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:i.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:i.normalizeStyle(x.value),role:"listbox"},[i.createElementVNode("div",{class:"overflow-y-auto py-1",style:i.normalizeStyle({maxHeight:x.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[V.value.length?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(V.value,(j,ae)=>(i.openBlock(),i.createElementBlock("div",{key:j.id,ref_for:!0,ref:_e=>y.value[ae]=_e,class:i.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",G(j.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",g.value===ae&&!G(j.id)?"bg-blue-100":""]),"aria-disabled":G(j.id)?"true":"false",role:"option",tabindex:"-1",onClick:_e=>Pt(j)},[j?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:i.normalizeStyle({backgroundColor:j?.color})},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["leading-[19px]",g.value===j.id?"text-white":"",(g.value,"")])},[P.value?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:K(j)},null,8,lN)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(j.text),1)],64))],2)],10,sN))),128)):(i.openBlock(),i.createElementBlock("div",iN," No options "))],4)],4)):i.createCommentVNode("",!0)]))],2),t.add?(i.openBlock(),i.createElementBlock("button",{key:0,onClick:H,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:s.value,type:"button"},[i.createVNode(To,{width:"16",height:"16"}),R[12]||(R[12]=i.createElementVNode("span",null,"Додати",-1))],8,aN)):i.createCommentVNode("",!0)],512)],64))}}),cN=["placeholder","disabled"],dN=i.defineComponent({__name:"vs-input-textarea",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("textarea",{"onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,row:"2",class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,cN)),[[i.vModelText,r.value]])}}),uN={},fN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function pN(n,e){return i.openBlock(),i.createElementBlock("svg",fN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),i.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const hN=ge(uN,[["render",pN]]),mN={},gN={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function yN(n,e){return i.openBlock(),i.createElementBlock("svg",gN,e[0]||(e[0]=[i.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),i.createElementVNode("path",{d:"M7 20V4"},null,-1),i.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),i.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const bN=ge(mN,[["render",yN]]),kN={},xN={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function wN(n,e){return i.openBlock(),i.createElementBlock("svg",xN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const EN=ge(kN,[["render",wN]]),CN={},vN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _N(n,e){return i.openBlock(),i.createElementBlock("svg",vN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const SN=ge(CN,[["render",_N]]),NN={},MN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function TN(n,e){return i.openBlock(),i.createElementBlock("svg",MN,e[0]||(e[0]=[i.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)]))}const nh=ge(NN,[["render",TN]]),AN={},BN={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function VN(n,e){return i.openBlock(),i.createElementBlock("svg",BN,e[0]||(e[0]=[i.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)]))}const LN=ge(AN,[["render",VN]]),ON={},IN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function DN(n,e){return i.openBlock(),i.createElementBlock("svg",IN,e[0]||(e[0]=[i.createElementVNode("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"},null,-1)]))}const RN=ge(ON,[["render",DN]]),FN={class:"vs-datatable border rounded-xl w-full flex-grow"},PN={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},$N={class:"relative w-full"},zN={class:"table-wrapper flex gap-2"},HN={class:"vs-popover inline-block text-slate-700"},jN={class:"text-center"},UN={class:""},WN={class:"py-1 px-0 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},KN={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},qN={class:"text-sm items-center text-gray-800 flex gap-1"},GN={class:"w-full overflow-x-auto"},JN={class:"w-full table-auto caption-bottom text-sm"},YN={class:"[&_tr]:border-b"},XN={class:"border-b data-[state=selected]:bg-muted bg-slate-50/50 dark:bg-slate-700/50 hover:bg-slate-50/80 dark:hover:bg-slate-700/80 transition-colors"},ZN={class:"h-10 px-2 align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] w-12 text-center"},QN={key:0,colspan:"100%",class:"text-center"},eM={class:"w-full"},tM={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},nM=["onDragstart","onDragover","onDrop"],rM={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},oM={class:"flex items-center justify-center"},sM={key:0,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},lM={key:0},iM=["src"],aM={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},cM=["innerHTML"],dM={key:2,class:"line-clamp-2 rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},uM={key:3,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},fM={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},pM={class:"flex items-center justify-center gap-2"},hM=["onClick"],mM=["onClick"],gM={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},yM=i.defineComponent({__name:"vs-input-datatable",props:i.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.ref({}),o=i.ref(""),s=i.computed(()=>{if(!o.value)return t.value??[];const P=o.value.toLowerCase();return t.value.filter(K=>e.colModel?.some(U=>{const re=K[U.key];return re?Array.isArray(re)?re.join(", ").toLowerCase().includes(P):String(re).toLowerCase().includes(P):!1}))}),l=i.ref(null),a=i.ref(null),c=i.ref(!1),d=i.ref(null),u=i.ref({top:0,left:0}),f=P=>{l.value=P},p=P=>{a.value=P},h=P=>{if(l.value===null||l.value===P){l.value=null,a.value=null;return}const K=[...t.value],[U]=K.splice(l.value,1);K.splice(P,0,U),t.value=K,l.value=null,a.value=null},m=P=>{const K=P.currentTarget.getBoundingClientRect();u.value={top:K.bottom+window.scrollY,left:K.left+window.scrollX},c.value=!c.value},g=()=>{d.value&&d.value.click()},y=P=>{const K=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],U=P.toLowerCase();return K.some(re=>U.endsWith(re))},b=P=>{const K=P.target.files?.[0];if(!K)return;const U=new FileReader;U.onload=re=>{try{const se=re.target?.result;if(typeof se=="string"){const ve=JSON.parse(se);Array.isArray(ve)&&t.value.push(...ve)}}catch(se){console.error("Error parsing file:",se)}},U.readAsText(K)},k=()=>{const P=JSON.stringify(t.value,null,2),K=new Blob([P],{type:"application/json"}),U=URL.createObjectURL(K),re=document.createElement("a");re.href=U,re.download="data.json",re.click(),URL.revokeObjectURL(U)};i.onMounted(async()=>{const P=e.colModel?.filter(K=>K.data);P?.length&&Promise.all(P.map(async K=>{const U=await(await fetch(`/api/suggest/${K.data}`)).json();r.value[K.key]=U.data}))});const w=i.ref(""),x=i.ref(!1);let E="edit",M=0;const C=i.ref({}),A=i.ref({});async function z(){w.value="Додати",x.value=!0,E="add",C.value={}}function G(P,K){const U=K.key||K.name;return r.value[U]&&P[U]?r.value[U].find(re=>re.id.toString()===P[U].toString())?.text??P[U]:P[U]||"-"}async function V(P,K){w.value="Редагувати",x.value=!0,E="edit",M=K,C.value={...P}}function O(){const P=A.value.validate();if(P){Pe({type:"warning",title:"Помилка валідації",message:Object.entries(P).map(([K,U])=>`${K}: ${U}`).join(`
|
|
119
|
+
`)});return}E==="add"?Array.isArray(t.value)?t.value=[...t.value,C.value]:t.value=[C.value]:t.value=t.value.map((K,U)=>U===M?C.value:K),x.value=!1}function Y(P){t.value=t.value.filter((K,U)=>U!==P)}function Q(){x.value=!1}return(P,K)=>(i.openBlock(),i.createElementBlock("div",FN,[i.createElementVNode("div",PN,[i.createElementVNode("div",$N,[i.createVNode(hN,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":K[0]||(K[0]=U=>o.value=U),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[i.vModelText,o.value]])]),i.createElementVNode("div",zN,[i.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:b,class:"hidden",accept:".json",type:"file"},null,544),i.createElementVNode("div",HN,[i.createElementVNode("div",jN,[i.createElementVNode("div",UN,[i.createElementVNode("button",{onClick:m,class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[i.createVNode(bN,{height:"16",width:"16"})])])])])]),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[c.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:i.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:u.value.top+"px",left:u.value.left+"px"}])},[i.createElementVNode("div",WN,[i.createElementVNode("div",KN,[i.createElementVNode("button",{onClick:g,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[i.createVNode(EN,{class:"text-black",width:"14",height:"14"}),K[4]||(K[4]=i.createTextVNode(" Імпортувати ",-1))]),i.createElementVNode("button",{onClick:k,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[i.createElementVNode("span",qN,[i.createVNode(SN,{class:"text-black",width:"14",height:"14"}),K[5]||(K[5]=i.createTextVNode(" Експортувати ",-1))])])])])],4)):i.createCommentVNode("",!0)])),i.createElementVNode("button",{onClick:z,class:"text-slate-700 bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[i.createVNode(To),K[6]||(K[6]=i.createTextVNode(" Додати ",-1))])]),i.createElementVNode("div",GN,[i.createElementVNode("table",JN,[i.createElementVNode("thead",YN,[i.createElementVNode("tr",XN,[i.createElementVNode("th",ZN,[i.createVNode(nh,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(P.colModel,U=>(i.openBlock(),i.createElementBlock("th",{key:U.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},i.toDisplayString(U.ua||U.label),1))),128)),K[7]||(K[7]=i.createElementVNode("th",{class:"h-10 px-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 text-center"}," Дії ",-1))])]),i.createElementVNode("tbody",{class:i.normalizeClass({"[&_tr:last-child]:border-0":!a.value})},[s.value.length===0?(i.openBlock(),i.createElementBlock("td",QN,[i.createElementVNode("div",eM,[i.createElementVNode("div",tM,[i.createVNode(LN,{class:"w-48 mx-auto"}),K[8]||(K[8]=i.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[i.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),i.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(U,re)=>(i.openBlock(),i.createElementBlock("tr",{key:U.id,class:i.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":l.value===re,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":a.value===re}]),draggable:"true",onDragstart:se=>f(re),onDragover:i.withModifiers(se=>p(re),["prevent"]),onDrop:se=>h(re)},[i.createElementVNode("td",rM,[i.createElementVNode("div",oM,[i.createVNode(nh,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(P.colModel,se=>(i.openBlock(),i.createElementBlock("td",{key:se.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[se.type==="file"?(i.openBlock(),i.createElementBlock("div",sM,[y(G(U,se))?(i.openBlock(),i.createElementBlock("div",lM,[i.createElementVNode("img",{src:G(U,se),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,iM)])):(i.openBlock(),i.createElementBlock("div",aM,[i.createVNode(Xp,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):se.type==="tiptap-editor"?(i.openBlock(),i.createElementBlock("div",{key:1,class:"rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors line-clamp-3",innerHTML:G(U,se)},null,8,cM)):se.type==="reference"?(i.openBlock(),i.createElementBlock("div",dM,i.toDisplayString(G(U,se)),1)):(i.openBlock(),i.createElementBlock("div",uM,i.toDisplayString(G(U,se)),1))]))),128)),i.createElementVNode("td",fM,[i.createElementVNode("div",pM,[i.createElementVNode("button",{onClick:se=>V(U,re),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-blue-50 dark:hover:bg-slate-600 hover:border-blue-300 dark:hover:border-slate-500 hover:text-blue-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[i.createVNode(RN,{width:"24",height:"24",class:"w-3 h-3"})],8,hM),i.createElementVNode("button",{onClick:se=>Y(re),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[i.createVNode(kl,{width:"24",height:"24",class:"w-3 h-3"})],8,mM)])])],42,nM))),128))],2)])]),i.createVNode(i.unref(Ia),{teleport:"#modal",visible:x.value,title:w.value,size:"lg",onClose:Q},{default:i.withCtx(()=>[i.createVNode(Rr,{schema:e.colModel,values:C.value,"onUpdate:values":K[1]||(K[1]=U=>C.value=U),form:A.value,"onUpdate:form":K[2]||(K[2]=U=>A.value=U)},null,8,["schema","values","form"]),i.createElementVNode("div",gM,[i.createElementVNode("button",{type:"button",onClick:K[3]||(K[3]=U=>x.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),i.createElementVNode("button",{onClick:O,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),bM={draw:{toolbar:{actions:{title:"Скасувати малювання",text:"Скасувати"},finish:{title:"Завершити малювання",text:"Завершити"},undo:{title:"Видалити останню точку",text:"Видалити останню"},buttons:{polyline:"Намалювати лінію",polygon:"Намалювати полігон",rectangle:"Намалювати прямокутник",circle:"Намалювати коло",marker:"Додати точку",circlemarker:"Додати маркер-коло"}},handlers:{circle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати коло",end:"Відпустіть кнопку миші, щоб завершити"},radius:"Радіус"},circlemarker:{tooltip:{start:"Клацніть на карту, щоб додати маркер-коло"}},marker:{tooltip:{start:"Клацніть на карту, щоб додати точку"}},polygon:{tooltip:{start:"Клацніть, щоб почати малювати полігон",cont:"Клацайте, щоб продовжити малювати полігон",end:"Клацніть першу точку, щоб завершити полігон"}},polyline:{error:"<strong>Помилка:</strong> лінія не може перетинатися сама з собою",tooltip:{start:"Клацніть, щоб почати малювати лінію",cont:"Клацайте, щоб продовжити малювати лінію",end:"Клацніть останню точку, щоб завершити лінію"}},rectangle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати прямокутник",end:"Відпустіть кнопку миші, щоб завершити"}},simpleshape:{tooltip:{end:"Відпустіть кнопку миші, щоб завершити"}}}},edit:{toolbar:{actions:{save:{title:"Зберегти зміни",text:"Зберегти"},cancel:{title:"Скасувати редагування",text:"Скасувати"},clearAll:{title:"Очистити всі шари",text:"Очистити все"}},buttons:{edit:"Редагувати шари",editDisabled:"Немає шарів для редагування",remove:"Видалити шари",removeDisabled:"Немає шарів для видалення"}},handlers:{edit:{tooltip:{text:"Перетягніть маркери, щоб редагувати шари",subtext:"Натисніть 'Скасувати', щоб повернутися"}},remove:{tooltip:{text:"Клацніть на шари, щоб видалити їх"}}}}};function Ao(n){return n?n.type==="Polygon"?{type:"MultiPolygon",coordinates:[n.coordinates]}:n.type==="Feature"?{...n,geometry:Ao(n.geometry)}:n.type==="FeatureCollection"?{...n,features:(n.features||[]).map(e=>Ao(e)).filter(Boolean)}:n:null}function kM(n){return n?n.type==="FeatureCollection"||n.type==="Feature"?Ao(n):n.geom?{type:"Feature",geometry:Ao({type:n.geom.type,coordinates:n.geom.coordinates}),properties:{}}:n.type&&n.coordinates?{type:"Feature",geometry:Ao(n),properties:{}}:null:null}const xM={},wM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map-pin"};function EM(n,e){return i.openBlock(),i.createElementBlock("svg",wM,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),i.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)]))}const CM=ge(xM,[["render",EM]]),vM={},_M={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-line"};function SM(n,e){return i.openBlock(),i.createElementBlock("svg",_M,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),i.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),i.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const NM=ge(vM,[["render",SM]]),MM={},TM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function AM(n,e){return i.openBlock(),i.createElementBlock("svg",TM,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)]))}const BM=ge(MM,[["render",AM]]),VM={},LM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function OM(n,e){return i.openBlock(),i.createElementBlock("svg",LM,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)]))}const IM=ge(VM,[["render",OM]]),DM={},RM={version:"1.1",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg","xmlns:sketch":"http://www.bohemiancoding.com/sketch/ns","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"fullscreen-icon"};function FM(n,e){return i.openBlock(),i.createElementBlock("svg",RM,e[0]||(e[0]=[i.createElementVNode("title",null,null,-1),i.createElementVNode("desc",null,null,-1),i.createElementVNode("defs",null,null,-1),i.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[i.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[i.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[i.createElementVNode("path",{d:"M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z",id:"Shape"})])])],-1)]))}const PM=ge(DM,[["render",FM]]),$M={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},zM={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},HM=["onClick"],jM={class:"relative flex-1 min-w-[140px]"},UM=["placeholder"],WM="https://data.softpro.ua/api-user/gis-url-proxy",KM="https://geo.rv.ua/api-user/dzk.api",qM=i.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(n,{emit:e}){const t=n,r=e,o=["here","xy","parcel"],s=i.computed(()=>{const x=t.config?.tools?.filter(E=>o.includes(E));return x&&x.length?x:o}),l=i.computed(()=>t.config?.placeholder?.trim()||"Пошук…"),a=i.ref(s.value[0]??o[0]);i.watch(s,x=>{x.includes(a.value)||(a.value=x[0])});const c=i.ref(""),d=i.ref(!1),u=i.ref(null);i.watch(a,()=>{c.value="",d.value=!1});function f(x){a.value=x}function p(x){if(!d.value)return;const E=u.value;E&&!E.contains(x.target)&&(d.value=!1)}i.onMounted(()=>{window.addEventListener("click",p,!0)}),i.onBeforeUnmount(()=>{window.removeEventListener("click",p,!0)});function h(x){return x==="xy"?"Координати":x==="parcel"?"Кадастр":"Адреси"}function m(x){const E=x.replace(/[,]+/g," ").trim();if(!E)return null;const M=E.split(/\s+/).filter(Boolean);if(M.length<2)return null;const C=M.slice(0,2).map(Number);if(!C.every(Q=>Number.isFinite(Q)))return null;let[A,z]=C,G=A,V=z;const O=Q=>Math.abs(Q)<=90,Y=Q=>Math.abs(Q)<=180;if(!O(G)||!Y(V))if(O(V)&&Y(G))G=z,V=A;else return null;return{lat:G,lng:V}}function g(x){return(x?.items||[]).map((E,M)=>({id:String(E?.id??M),title:E?.title||E?.address?.label||"Знайдений обʼєкт",lat:Number(E?.position?.lat),lng:Number(E?.position?.lng)})).filter(E=>Number.isFinite(E.lat)&&Number.isFinite(E.lng))}function y(x){const E=x?.result||x?.data||x;if(!E)return[];const M=E.geom_centroid;if(!M||!Array.isArray(M.coordinates))return[];const[C,A]=M.coordinates;return!Number.isFinite(A)||!Number.isFinite(C)?[]:[{id:"parcel",title:E.cadnum||E.cad_num||"Земельна ділянка",lat:A,lng:C}]}function b(x){const E=x.replace(/\s+/g,"").split(":");if(E.length!==4)return!1;const M=[10,2,3,4];return E.every((C,A)=>C.length===M[A]&&/^\d+$/.test(C))}function k(x){r("goToCoordinates",[x.lat,x.lng])}async function w(){const x=c.value.trim();if(x){if(a.value==="xy"){const E=m(x);if(!E){Pe({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}k(E),c.value="";return}try{const E=new URL(a.value==="here"?WM:KM);if(a.value==="here")E.searchParams.set("searchtext",x);else{if(!b(x)){Pe({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}E.searchParams.set("cad_num",x)}const M=await fetch(E.toString());if(!M.ok)throw new Error(`HTTP ${M.status}`);const C=await M.json(),A=a.value==="here"?g(C):y(C);if(!A.length)Pe({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const z=A[0];k(z),c.value=""}}catch(E){const M=E?.message||"Помилка пошуку";Pe({type:"error",title:"Пошук",message:M})}}}return(x,E)=>(i.openBlock(),i.createElementBlock("div",$M,[i.createElementVNode("form",{class:"flex gap-2",onSubmit:i.withModifiers(w,["prevent"])},[s.value.length>1?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:"relative search-type w-[140px]"},[i.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:E[0]||(E[0]=M=>d.value=!d.value)},[i.createElementVNode("span",null,i.toDisplayString(h(a.value)),1),(i.openBlock(),i.createElementBlock("svg",{class:i.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":d.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},E[2]||(E[2]=[i.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),d.value?(i.openBlock(),i.createElementBlock("div",zM,[i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,M=>(i.openBlock(),i.createElementBlock("li",{key:M,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:C=>f(M)},i.toDisplayString(h(M)),9,HM))),128))])])):i.createCommentVNode("",!0)],512)):i.createCommentVNode("",!0),i.createElementVNode("div",jM,[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":E[1]||(E[1]=M=>c.value=M),placeholder:l.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,UM),[[i.vModelText,c.value,void 0,{trim:!0}]]),E[3]||(E[3]=i.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),GM=ge(qM,[["__scopeId","data-v-3048520a"]]),JM={class:"bg-white/30 p-1 rounded-md shadow"},YM={class:"flex gap-2"},XM=["onClick","title"],ZM=["src"],QM=i.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(n,{emit:e}){const t=i.ref(Object.keys(n.basemaps)[0]),r=e;function o(s){r("onLayerChange",s),t.value=s}return(s,l)=>(i.openBlock(),i.createElementBlock("div",JM,[i.createElementVNode("div",YM,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.basemaps,(a,c)=>(i.openBlock(),i.createElementBlock("div",{key:c,class:i.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":t.value===c}]),onClick:d=>o(c),title:a.name||c,role:"button",tabindex:"0"},[i.createElementVNode("img",{src:a.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,ZM)],10,XM))),128))])]))}}),eT={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},tT={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},nT={class:"text-sm font-medium"},rT={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},oT={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},sT={class:"flex items-center gap-1"},lT=["disabled"],iT=["disabled"],aT=["disabled"],cT={class:"absolute top-4 right-4 z-[1000]"},dT={class:"flex flex-col gap-[2px]"},uT=["disabled"],fT=["disabled"],pT=["disabled"],hT=["disabled"],mT={class:"flex flex-col gap-2"},gT={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},yT={class:"flex flex-col gap-1"},bT=["checked","disabled","onChange"],kT={class:"text-gray-700 text-xs font-medium"},xT={class:"absolute bottom-0 left-0 right-0 z-[1000] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},wT={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},ET={class:"shrink-0"},CT={class:"font-bold"},vT={class:"flex items-center"},_T={class:"text-xs mr-2"},ST={key:0,class:"text-xs"},NT={key:1,class:"text-xs"},MT=["disabled"],TT=["disabled"],AT=i.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},layers:{default:()=>[]},api:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=i.getCurrentInstance(),r=n,o=e,s=i.computed(()=>{const v={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!r.tools||!r.tools.length)return v;const N=new Set(r.tools.map(H=>H.toLowerCase()));return{search:N.has("search"),import:N.has("import"),export:N.has("export"),point:N.has("point"),line:N.has("line"),polygon:N.has("polygon"),rectangle:N.has("rectangle")}}),l=i.computed(()=>!!r.disabled),a=i.ref(!1),c=i.ref(null),d=i.ref(null),u=i.ref(!1),f=i.ref(""),p=i.reactive({}),h=i.ref([]),m=i.computed(()=>h.value.map(v=>p[v]).filter(v=>!!v)),g=i.computed(()=>Array.isArray(r.layers)&&r.layers.some(v=>`${v?.service??""}`.toLowerCase()==="vtile"));let y,b,k;function w(){return navigator.platform.toUpperCase().indexOf("MAC")>=0,/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}const x=i.ref(null),E=i.ref(null);let M=null;const C=i.ref(null),A=v=>{v.ctrlKey&&v.preventDefault()};function z(v,N){return v?.id?String(v.id):v?.url?`${v.url}-${N}`:`layer-${N}`}function G(v){if(!v)return"";if(/^https?:\/\//i.test(v))return v.replace(/\/+$/,"");const N=v.replace(/^\/+/,"").replace(/\/+$/,"");return N?`/${N}`:""}function V(v){const N=v?.url??"";if(!N||/^https?:\/\//i.test(N))return N;const H=typeof window<"u"&&window.location?.origin?window.location.origin:"";if(N.startsWith("/"))return H?`${H}${N}`:N;const W=G(v?.prefix),Z=G(r.prefix),fe=W||Z,T=N.replace(/^\/+/,""),R=fe?`${fe.replace(/\/$/,"")}/${T}`:`/${T}`;return H?`${H}${R}`:R}function O(v){const N=v?.style??{};return H=>{const W=N.colorAttr,Z=N.colorSet??{},fe=typeof W=="string"?Z?.[H?.[W]]??N.color??"#3388ff":N.color??"#3388ff",T=N.stroke??fe;return{weight:N.width??1,color:T,opacity:N.opacity??1,fill:N.type?N.type!=="polyline":!0,fillColor:fe,fillOpacity:N.opacity??.5}}}function Y(v){const N=v?.colorSet||v?.colors;if(v?.colorAttr&&N){const H=Object.entries(N).flat();return["match",["get",v.colorAttr],...H,v.color??"#94a3b8"]}return v?.color??"#3388ff"}function Q(v,N,H){if(!v)return[];const W=[],Z=Y(v);return v.icon&&W.push({id:`${N}-icon`,type:"symbol",source:N,"source-layer":H,minzoom:v.iconZoom||0,layout:{"icon-image":v.icon,"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}}),v.pointZoom&&W.push({id:`${N}-point`,type:"circle",source:N,"source-layer":H,maxzoom:v.pointZoom,paint:{"circle-stroke-color":v.stroke||"#fff","circle-opacity":v.opacity??1,"circle-color":Z,"circle-stroke-width":v.width??1,"circle-radius":v.radius??5}}),v.type==="polygon"?W.push({id:`${N}-fill`,type:"fill",source:N,"source-layer":H,minzoom:v.pointZoom||0,paint:{"fill-color":Z,"fill-opacity":v.opacity??.5,"fill-outline-color":v.stroke||Z}}):v.type==="line"?W.push({id:`${N}-line`,type:"line",source:N,"source-layer":H,paint:{"line-color":Z,"line-opacity":v.opacity??1,"line-width":v.width??1.5}}):v.icon||W.push({id:`${N}-circle`,type:"circle",source:N,"source-layer":H,paint:{"circle-stroke-color":v.stroke||"#fff","circle-opacity":v.opacity??1,"circle-color":Z,"circle-stroke-width":v.width??1,"circle-radius":v.radius??5}}),W}function P(v,N){const H=v.id||`source-${Math.random().toString(36).slice(2,8)}`,W=v.sourceLayer||v.layer||v.service_layer||v.service_key||v.map_key||v.dataset?.layer||v.id||v.table_name||H,Z=Q(v.style||{},H,W||H);return Z.length?{version:8,glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{[H]:{type:"vector",tiles:[N],minzoom:v.minzoom??0,maxzoom:v.maxzoom??19}},layers:Z}:null}function K(v){const N=(v?.service??"").toLowerCase(),H=V(v),W=v.sourceLayer||v.layer||v.service_layer||v.service_key||v.map_key||v.dataset?.layer||v.id||v.table_name;if(console.info("[vs-input-map] create overlay layer",{id:v.id,service:N,url:H,sourceLayer:W,hasSourceLayer:!!W}),N==="vtile"){if(L?.vectorGrid?.protobuf&&!L?.maplibreGL)return console.info("[vs-input-map] using Leaflet.vectorGrid"),L.vectorGrid.protobuf(H,{interactive:!0,vectorTileLayerStyles:{default:O(v)}});if(L?.maplibreGL&&window?.maplibregl){console.info("[vs-input-map] using maplibre-gl-leaflet");const Z=P(v,H);return Z?L.maplibreGL({style:Z,interactive:!1,pane:"overlayPane"}):(console.warn("[vs-input-map] maplibre spec is empty",v.id),null)}return null}return N==="tile"||/^https?:\/\//i.test(H)||H.includes("{z}")?L.tileLayer(H,{opacity:v?.style?.opacity??1}):L.tileLayer(H,{opacity:v?.style?.opacity??1})}function U(){y&&h.value.forEach(v=>{const N=p[v];N&&(N.visible?(N.layer||(N.layer=K(N.config)),N.layer&&!y.hasLayer(N.layer)?(console.info("[vs-input-map] add overlay layer to map",N.id),N.layer.addTo(y)):N.layer||console.warn("[vs-input-map] overlay layer is null",N.id)):N.layer&&y.hasLayer(N.layer)&&(console.info("[vs-input-map] remove overlay layer from map",N.id),y.removeLayer(N.layer)))})}function re(v){if(l.value)return;const N=p[v];N&&(N.visible=!N.visible,y&&(console.info("[vs-input-map] toggle overlay",{id:v,nextVisible:N.visible,hasLayerInstance:!!N.layer}),N.visible?(N.layer||(N.layer=K(N.config)),N.layer&&!y.hasLayer(N.layer)&&(console.info("[vs-input-map] add overlay layer to map",N.id),N.layer.addTo(y))):N.layer&&y.hasLayer(N.layer)&&y.removeLayer(N.layer)))}function se(){if(!r.handleZoom)return null;let v;const N=W=>{const Z=W.ctrlKey||W.metaKey,fe=W.shiftKey;if(!Z&&!fe){u.value=!0,f.value=w(),clearTimeout(v),v=window.setTimeout(()=>{u.value=!1},1e3);return}u.value=!1,y.scrollWheelZoom.enable(),setTimeout(()=>{y.scrollWheelZoom.disable()},100)},H=W=>{if(W.touches.length===1){u.value=!0,f.value=w(),clearTimeout(v),v=window.setTimeout(()=>{u.value=!1},3e3);return}u.value=!1};return E.value&&(E.value.addEventListener("wheel",N,{passive:!1}),E.value.addEventListener("touchstart",H,{passive:!0})),y&&y.on("wheel",W=>{const Z=W.originalEvent.ctrlKey||W.originalEvent.metaKey,fe=W.originalEvent.shiftKey;!Z&&!fe&&(W.originalEvent.preventDefault(),W.originalEvent.stopPropagation())}),()=>{E.value&&(E.value.removeEventListener("wheel",N),E.value.removeEventListener("touchstart",H)),y&&y.off("wheel"),clearTimeout(v)}}const ve=i.ref(null),pt=i.ref(6),St=i.ref(0),Ft=i.ref(t?.appContext.config.globalProperties.$settings?.center||[50,30]),Ke=i.ref(null),ht=F();let En;const Cn=i.ref("topo100");function vn(v){return v?v.type==="Polygon"?{type:"MultiPolygon",coordinates:[v.coordinates]}:(v.type,v):null}function xr(){return new Promise((v,N)=>{window.L&&window.L.Draw&&v(0);const H=fe=>{if(Array.from(document.styleSheets).some(R=>R?.href?.includes(fe)))return;const T=document.createElement("link");T.rel="stylesheet",T.href=fe,document.head.appendChild(T)},W=fe=>new Promise((T,R)=>{const j=Array.from(document.scripts).find(_e=>_e.src===fe);if(j){j.addEventListener("load",()=>T()),j.addEventListener("error",_e=>R(_e));return}const ae=document.createElement("script");ae.src=fe,ae.async=!0,ae.onload=()=>T(),ae.onerror=_e=>R(_e),document.body.appendChild(ae)});H("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),H("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),g.value&&H("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.css");let Z=W("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>W("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js"));g.value?Z=Z.then(()=>W("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.js")).then(()=>(window.maplibregl&&!window.mapboxgl&&(window.mapboxgl=window.maplibregl),W("https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.0.20/leaflet-maplibre-gl.js"))):Z=Z.then(()=>W("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js").catch(()=>Promise.resolve())),Z.then(()=>v(0)).catch(N)})}function mt(){const v=b.toGeoJSON(),N=[];let H=null;const W=fe=>{if(fe)switch(fe.type){case"Point":H=fe;break;case"Polygon":N.push(fe.coordinates);break;case"MultiPolygon":N.push(...fe.coordinates);break;case"GeometryCollection":(fe.geometries||[]).forEach(W);break}};(v?.features||[]).forEach(fe=>W(fe.geometry));const Z=H||(N.length?{type:"MultiPolygon",coordinates:N}:null);o("update:modelValue",Z?vn(Z):null),St.value=b.getLayers().length}function Pt(v=30){const N=b.getLayers();if(!N.length)return;const H=L.featureGroup(N).getBounds();H&&H.isValid()&&y.fitBounds(H,{padding:[v,v]})}function cn(){l.value||C.value?.click()}const qe=i.ref("");i.watch(s,v=>{qe.value&&!Object.entries(v).filter(([N,H])=>H).map(([N])=>N).includes(qe.value)&&(k?.disable&&k.disable(),qe.value="")}),i.watch(()=>r.layers,v=>{const N=Array.isArray(v)?v:[],H=[],W=new Set;N.forEach((Z,fe)=>{if(!Z)return;const T=z(Z,fe);H.push(T),W.add(T),console.info("[vs-input-map] overlay register",{id:T,service:Z?.service,url:Z?.url});const R=p[T];R?p[T]={...R,config:{...Z,id:T}}:p[T]={id:T,config:{...Z,id:T},visible:Z?.overlay!==!1,layer:null}}),Object.keys(p).forEach(Z=>{if(W.has(Z))return;const fe=p[Z];fe?.layer&&y?.hasLayer&&y.hasLayer(fe.layer)&&y.removeLayer(fe.layer),delete p[Z]}),h.value=H,U()},{immediate:!0,deep:!0}),i.watch(l,v=>{v&&k&&(k.disable(),qe.value=""),b&&b.eachLayer(N=>{v?N.dragging?.disable?.():N.dragging?.enable&&(N.dragging.enable(),N.dragging.enabled?.())})});function $t(v){return v instanceof L.Circle?"Circle":v instanceof L.Rectangle?"Rectangle":v instanceof L.Polygon&&!(v instanceof L.Rectangle)?"Polygon":v instanceof L.Polyline&&!(v instanceof L.Polygon)?"Polyline":v instanceof L.Marker?"Point":"Feature"}function qt(v){if(v instanceof L.Circle){const N=v.getRadius();return Math.PI*(N*N)/1e6}if(v instanceof L.Polygon||v instanceof L.Rectangle)try{const N=v.getLatLngs(),H=Array.isArray(N[0])?N[0]:N,W=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(H):0;return W?W/1e6:0}catch{return null}return null}function dn(v){return v instanceof L.Circle?v.getLatLng():v.getBounds?v.getBounds().getCenter():v.getLatLng?v.getLatLng():y.getCenter()}async function Xn(v,N){if(x.value="",!r.api?.length)return;const[H,W]=r.api;try{const Z=new URL(H);Z.searchParams.set("lat",String(v)),Z.searchParams.set("lon",String(N));const fe=await fetch(Z.toString());if(!fe.ok)throw new Error("Request failed");const T=await fe.json();W&&T[W]!==void 0?x.value=String(T[W]):x.value=JSON.stringify(T)}catch(Z){console.error("[vs-input-map] reverse geocode failed:",Z),x.value=null}}function _(){const v=b.getLayers();if(!v.length){Ke.value=null,St.value=0;return}const N=v[v.length-1],H=$t(N),W=dn(N),Z=qt(N);Ke.value={type:H,center:W,areaKm2:Z,layer:N},St.value=v.length,Xn(W.lat,W.lng)}function S(){if(l.value)return;const v=Ke.value?.layer;v&&(v instanceof L.Circle&&v.getBounds?y.fitBounds(v.getBounds(),{padding:[30,30]}):v.getBounds?y.fitBounds(v.getBounds(),{padding:[30,30]}):v.getLatLng&&y.setView(v.getLatLng(),Math.max(pt.value,14)))}function D(){if(l.value)return;const v=Ke.value?.layer;v&&(b.removeLayer(v),mt(),_())}i.onMounted(async()=>{document.addEventListener("wheel",A,{passive:!1}),await xr(),L.drawLocal=bM;const v=r.handleZoom;y=L.map(E.value,{zoomControl:!1,scrollWheelZoom:!v}).setView(Ft.value,10),setTimeout(()=>{M=se()},100),L.control.zoom({position:"bottomright"}).addTo(y),Cn.value=Object.keys(ht)[0],En=L.tileLayer(ht[Cn.value].url,{maxZoom:19,minZoom:6}).addTo(y),b=new L.FeatureGroup().addTo(y),y.on(L.Draw.Event.CREATED,W=>{if(l.value)return;const{layer:Z}=W;b.clearLayers(),b.addLayer(Z),mt(),Pt(),qe.value=""}),y.on(L.Draw.Event.EDITED,()=>{l.value||(mt(),_(),Pt())}),y.on(L.Draw.Event.DELETED,()=>{l.value||(mt(),_(),Pt())});let N=!1;y.on("mousemove",W=>{N||(y.invalidateSize(),N=!0),ve.value=W.latlng}),y.on("zoomend",()=>{pt.value=y.getZoom()});const H=kM(r.modelValue);if(H){const W=[];L.geoJSON(H).eachLayer(Z=>W.push(Z)),W.length&&b.addLayer(W[0]),mt(),_(),Pt()}U()}),i.onUnmounted(()=>{document.removeEventListener("wheel",A),M&&M(),Object.values(p).forEach(v=>{v?.layer&&(y?.hasLayer?.(v.layer)&&y.removeLayer(v.layer),typeof v.layer.remove=="function"&&v.layer.remove())})});function X(v){if(!l.value&&y){switch(k&&k.disable(),v){case"marker":k=new L.Draw.Marker(y);break;case"polyline":k=new L.Draw.Polyline(y);break;case"polygon":k=new L.Draw.Polygon(y);break;case"rectangle":k=new L.Draw.Rectangle(y);break;default:k=new L.Draw.Rectangle(y);break}k&&(k.enable(),qe.value=v)}}function we(){if(l.value)return;const v=b.toGeoJSON(),N=new Blob([JSON.stringify(v,null,2)],{type:"application/json"}),H=URL.createObjectURL(N),W=document.createElement("a");W.href=H,W.download="data.geojson",W.click(),URL.revokeObjectURL(H)}function Be(v){if(l.value)return;const N=v.target,H=N.files?.[0];if(!H)return;const W=new FileReader;W.onload=()=>{if(typeof W.result=="string")try{const Z=JSON.parse(W.result);b.clearLayers(),Z&&L.geoJSON({type:"Feature",geometry:Z}).eachLayer(fe=>{b.addLayer(fe)}),mt(),_(),Pt()}finally{N.value=""}},W.readAsText(H)}function pe(v){y&&(En&&y.removeLayer(En),En=L.tileLayer(ht[v].url,{maxZoom:19,minZoom:6}).addTo(y),Cn.value=v)}function B(v){const N=L.latLng(v[0],v[1]);y.setView(N,13)}i.watch(()=>r.modelValue,v=>{const N=vn(v);if(v&&N!==v){o("update:modelValue",N);return}b.clearLayers(),N&&L.geoJSON({type:"Feature",geometry:N}).eachLayer(H=>{if(b.addLayer(H),l.value){H.dragging?.disable?.();return}H.dragging?.enable?.(),H.dragging?.enabled?.(),H.on("dragend",W=>{const Z=W.target.getLatLng();o("update:modelValue",{type:"Point",coordinates:[Z.lng,Z.lat]})})}),St.value=b.getLayers().length,_(),Pt()});function F(){return t?.appContext.config.globalProperties.$settings?.basemaps?t?.appContext.config.globalProperties.$settings?.basemaps.map((v,N)=>Object.assign(v,{key:`b${N}`,preview:v.preview||v.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((v,N)=>({...v,[N.key]:N}),{}):{topo100:{url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}}}const he=i.ref(!1);return i.watch(he,()=>{setTimeout(()=>{y.invalidateSize()},50)}),i.watch(a,async v=>{if(!v||!d.value){c.value=null;return}await i.nextTick();const N=d.value.getBoundingClientRect();c.value={top:N.bottom+6,left:N.left}}),i.onUnmounted(()=>{a.value=!1,c.value=null}),(v,N)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:he.value}])},[i.createElementVNode("div",{ref_key:"mapContainer",ref:E,class:"w-full h-full"},null,512),i.createVNode(i.Transition,{name:"zoom-instructions","enter-active-class":"transition-all duration-200 ease-out","leave-active-class":"transition-all duration-500 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:i.withCtx(()=>[u.value&&r.handleZoom?(i.openBlock(),i.createElementBlock("div",eT,[i.createElementVNode("div",tT,[i.createElementVNode("p",nT,i.toDisplayString(f.value),1)])])):i.createCommentVNode("",!0)]),_:1}),s.value.search||s.value.import||s.value.export?(i.openBlock(),i.createElementBlock("div",rT,[s.value.search?(i.openBlock(),i.createBlock(GM,{key:0,onGoToCoordinates:B})):i.createCommentVNode("",!0),s.value.import||s.value.export?(i.openBlock(),i.createElementBlock("div",oT,[i.createElementVNode("div",sT,[s.value.import?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:cn,disabled:l.value}," Import ",8,lT)):i.createCommentVNode("",!0),s.value.export?(i.openBlock(),i.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:we,disabled:l.value||St.value===0}," Export ",8,iT)):i.createCommentVNode("",!0)]),i.createElementVNode("input",{ref_key:"importRef",ref:C,type:"file",onChange:Be,accept:".json,.geojson",class:"hidden",disabled:l.value},null,40,aT)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.createElementVNode("div",cT,[i.createElementVNode("div",dT,[s.value.point?(i.openBlock(),i.createElementBlock("button",{key:0,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="marker"}]),title:"Point",onClick:N[0]||(N[0]=H=>X("marker")),disabled:l.value},[i.createVNode(CM)],10,uT)):i.createCommentVNode("",!0),s.value.line?(i.openBlock(),i.createElementBlock("button",{key:1,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="polyline"}]),title:"Line",onClick:N[1]||(N[1]=H=>X("polyline")),disabled:l.value},[i.createVNode(NM)],10,fT)):i.createCommentVNode("",!0),s.value.polygon?(i.openBlock(),i.createElementBlock("button",{key:2,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="polygon"}]),title:"Polygon",onClick:N[2]||(N[2]=H=>X("polygon")),disabled:l.value},[i.createVNode(BM)],10,pT)):i.createCommentVNode("",!0),s.value.rectangle?(i.openBlock(),i.createElementBlock("button",{key:3,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="rectangle"}]),title:"Rectangle",onClick:N[3]||(N[3]=H=>X("rectangle")),disabled:l.value},[i.createVNode(IM)],10,hT)):i.createCommentVNode("",!0),i.createElementVNode("button",{class:"vs-btn mt-5",onClick:N[4]||(N[4]=H=>he.value=!he.value),title:"Full Screen"},[i.createVNode(PM,{style:{width:"12px",height:"12px"}})])])]),i.createElementVNode("div",{class:i.normalizeClass(["absolute left-4 z-[1000]",Ke.value?"bottom-8":"bottom-4"])},[i.createElementVNode("div",mT,[i.createVNode(QM,{basemaps:i.unref(ht),onOnLayerChange:pe},null,8,["basemaps"]),m.value.length?(i.openBlock(),i.createElementBlock("div",gT,[N[9]||(N[9]=i.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Layers",-1)),i.createElementVNode("div",yT,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(m.value,H=>(i.openBlock(),i.createElementBlock("label",{key:H.id,class:"flex items-center gap-2 cursor-pointer select-none"},[i.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:H.visible,disabled:l.value,onChange:W=>re(H.id)},null,40,bT),i.createElementVNode("span",kT,i.toDisplayString(H.config.title||H.config.name||H.id),1)]))),128))])])):i.createCommentVNode("",!0)])],2),i.createElementVNode("div",xT,[Ke.value?(i.openBlock(),i.createElementBlock("div",wT,[i.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:N[5]||(N[5]=H=>a.value=!0),onMouseleave:N[6]||(N[6]=H=>a.value=!1)},[i.createElementVNode("div",ET,[N[10]||(N[10]=i.createTextVNode(" Type: ",-1)),i.createElementVNode("span",CT,i.toDisplayString(Ke.value.type),1)]),x.value?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"addressEl",ref:d,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+i.toDisplayString(x.value),513)):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[a.value&&x.value&&c.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"fixed z-[99999] pointer-events-none bg-gray-800 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap",style:i.normalizeStyle({top:c.value.top+"px",left:c.value.left+"px"})},i.toDisplayString(x.value),5)):i.createCommentVNode("",!0)]))],32),i.createElementVNode("div",vT,[i.createElementVNode("div",_T,[N[11]||(N[11]=i.createTextVNode(" Center: ",-1)),i.createElementVNode("b",null,i.toDisplayString(Ke.value.center.lat.toFixed(5))+", "+i.toDisplayString(Ke.value.center.lng.toFixed(5)),1)]),Ke.value.areaKm2!==null?(i.openBlock(),i.createElementBlock("div",ST,[N[12]||(N[12]=i.createTextVNode(" Area: ",-1)),i.createElementVNode("b",null,i.toDisplayString(Ke.value.areaKm2.toFixed(1))+" km²",1)])):(i.openBlock(),i.createElementBlock("div",NT,N[13]||(N[13]=[i.createTextVNode("Area: ",-1),i.createElementVNode("b",null,"—",-1)]))),i.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:N[7]||(N[7]=H=>S()),disabled:l.value},N[14]||(N[14]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-3 h-3" data-v-150e767b><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-150e767b></path><path d="M7 10l6 0" data-v-150e767b></path><path d="M10 7l0 6" data-v-150e767b></path><path d="M21 21l-6 -6" data-v-150e767b></path></svg>',1)]),8,MT),i.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:N[8]||(N[8]=H=>D()),disabled:l.value},[i.createVNode(kl,{class:"w-3 h-3"})],8,TT)])])):i.createCommentVNode("",!0)])],2))}}),BT=ge(AT,[["__scopeId","data-v-150e767b"]]),VT=["data-focus"],LT={class:"flex items-center"},OT={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},IT=["onClick","aria-label"],DT={key:0,class:"absolute text-gray-500 truncate pl-2"},RT={class:"flex-1 min-w-[2px]"},FT=["placeholder"],PT={class:"flex items-center shrink-0"},$T=["disabled"],zT=i.defineComponent({__name:"vs-input-tag",props:i.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=e;vt(t.style);const o=i.ref(null),s=i.ref(null),l=i.ref(null),a=i.ref(!1),c=i.ref(""),d=i.useModel(n,"modelValue"),u=i.computed(()=>t.placeholder||"Add tag…"),f=i.computed(()=>d.value?.length===0&&c.value===""),p=i.computed(()=>!t.disabled&&d.value?.length>0),h=i.computed(()=>t.disabled),m=async()=>{h.value||await i.nextTick(()=>l.value?.focus())},g=M=>{const C=M.trim();C!==""&&(!d.value||!Array.isArray(d.value)?d.value=[C]:t.unique?d.value.includes(C)||(d.value=[...d.value,C]):d.value=[...d.value,C],c.value="")},y=()=>{const M=c.value;M.trim()!==""&&g(M),c.value=""},b=M=>{const C=d.value.slice();C.splice(M,1),r("update:modelValue",C)},k=()=>{r("update:modelValue",[])},w=()=>{h.value||(a.value=!0)},x=()=>{a.value=!1,!h.value&&y()},E=M=>{const{key:C}=M;C==="Enter"?(M.preventDefault(),y()):C==="Backspace"&&c.value===""&&d.value.length>0&&b(d.value.length-1)};return(M,C)=>(i.openBlock(),i.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:C[1]||(C[1]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:i.normalizeClass(["relative w-full font-sans",t.customClass]),role:"group","aria-label":"Tag input"},[i.createElementVNode("div",{class:i.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",a.value?"border-blue-500 ring-1 ring-blue-500":"",h.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":a.value?"true":"false",onClick:m},[i.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:s},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value,(A,z)=>(i.openBlock(),i.createElementBlock("div",{key:z,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[i.createElementVNode("div",LT,[i.createElementVNode("div",OT,i.toDisplayString(A),1)]),i.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:i.withModifiers(G=>b(z),["stop"]),"aria-label":`Remove ${A}`},C[2]||(C[2]=[i.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,IT)]))),128)),f.value?(i.openBlock(),i.createElementBlock("div",DT,i.toDisplayString(u.value),1)):i.createCommentVNode("",!0),i.createElementVNode("div",RT,[h.value?i.createCommentVNode("",!0):i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref_key:"inputRef",ref:l,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":C[0]||(C[0]=A=>c.value=A),onFocus:w,onBlur:x,onKeydown:E,placeholder:d.value&&d.value.length?"":void 0},null,40,FT)),[[i.vModelText,c.value]])])],512),i.createElementVNode("div",PT,[p.value?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:h.value,onClick:i.withModifiers(k,["stop"])},C[3]||(C[3]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,$T)):i.createCommentVNode("",!0)])],10,VT)],2)],512))}}),HT={class:"relative flex gap-1 bg-white w-full"},jT=["disabled","placeholder"],UT=i.defineComponent({__name:"vs-input-slug",props:i.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=i.inject("values"),t=n,r=i.useModel(n,"modelValue");function o(l){const a={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return l.toLowerCase().split("").map(c=>a[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const s=()=>{const l=e?.value?.[t.parent||""]?.toString(),a=o(l);r.value=a.toString()};return(l,a)=>(i.openBlock(),i.createElementBlock("div",HT,[i.withDirectives(i.createElementVNode("input",{ref:"vsText",disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,jT),[[i.vModelText,r.value]]),i.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:s}," Gen ")]))}}),WT=ge(UT,[["__scopeId","data-v-b0eba370"]]),KT={class:"relative flex gap-1 bg-white w-full"},qT=["disabled","placeholder"],GT=["disabled"],JT={key:0},YT={key:1},XT=i.defineComponent({__name:"vs-input-codegen",props:i.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.ref(!1),o=i.computed(()=>e.init!==!1),s=i.computed(()=>!!e.table&&!!e.code),l=()=>{if(!s.value)return"";const d=encodeURIComponent(String(e.table)),u=encodeURIComponent(String(e.code));return`/api/code-gen/${d}/${u}`},a=async()=>{if(!s.value||r.value)return;const d=l();if(d){r.value=!0;try{const u=await(await fetch(d)).text();t.value=u}finally{r.value=!1}}},c=()=>{o.value&&(t.value||a())};return i.onMounted(()=>{c()}),i.watch(()=>[e.table,e.code,e.init],()=>{c()}),(d,u)=>(i.openBlock(),i.createElementBlock("div",KT,[i.withDirectives(i.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":u[0]||(u[0]=f=>t.value=f),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,qT),[[i.vModelText,t.value]]),i.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:r.value||d.disabled||!s.value,onClick:a},[r.value?(i.openBlock(),i.createElementBlock("span",YT,"...")):(i.openBlock(),i.createElementBlock("span",JT,"Gen"))],8,GT)]))}}),ZT=ge(XT,[["__scopeId","data-v-6ee5237d"]]),QT={class:"w-full"},eA={ref:"sortableContainer",class:"flex flex-col gap-1"},tA=["onDragstart","onDrop"],nA={class:"w-1/3"},rA={class:"w-2/3"},oA=["onClick"],sA={key:0,class:"text-[14px] text-gray-700"},lA={class:"mt-2 w-full flex items-center"},iA=["disabled"],aA=i.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=g=>`${g}-${Math.random().toString(36).substring(2,15)}`,r=i.inject("values"),o=n,s=e,l=o.addButtonText??"Додати",a=o.ignore??[],c=i.ref([]),d=i.ref(null);(()=>{const g=o.parent&&r?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(g).filter(([y])=>!a.includes(y)).map(([y,b])=>({id:t("key-value-"),key:y,value:b}))})();function u(g){d.value=g}function f(g){if(d.value===null||d.value===g)return;const y=c.value.splice(d.value,1)[0];c.value.splice(g,0,y),d.value=null}const p=i.computed(()=>c.value.some(g=>g.key&&!g.value||!g.key&&g.value)),h=()=>{c.value.push({id:t("key-value-"),key:"",value:""})},m=g=>{c.value=c.value.filter(y=>y.id!==g)};return i.watch(c,g=>{const y={};g.forEach(k=>{k.key&&k.value!==void 0&&(y[k.key]=k.value)});const b={};a.length&&a.forEach(k=>{b[k]=o.parent?r?.value?.[o.parent]?.[k]:void 0}),r?.value&&o.parent&&(r.value[o.parent]={...b,...y}),s("update:modelValue",y)},{deep:!0}),(g,y)=>(i.openBlock(),i.createElementBlock("div",QT,[i.createElementVNode("div",eA,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,(b,k)=>(i.openBlock(),i.createElementBlock("div",{key:b.id,class:i.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===k}]),draggable:"true",onDragstart:w=>u(k),onDragover:y[0]||(y[0]=i.withModifiers(()=>{},["prevent"])),onDrop:w=>f(k)},[y[1]||(y[1]=i.createStaticVNode('<button class="cursor-move" data-v-a0f7fbfc><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-a0f7fbfc><circle cx="15" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="18" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="18" r="1.5" data-v-a0f7fbfc></circle></svg></button>',1)),i.createElementVNode("div",nA,[i.createVNode(bl,{modelValue:b.key,"onUpdate:modelValue":w=>b.key=w,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),i.createElementVNode("div",rA,[i.createVNode(bl,{modelValue:b.value,"onUpdate:modelValue":w=>b.value=w,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),i.createElementVNode("button",{onClick:w=>m(b.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[i.createVNode(i.unref(Nv),{height:"16",width:"16"})],8,oA)],42,tA))),128))],512),c.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",sA," Дані для відображення відсутні ")),i.createElementVNode("div",lA,[i.createElementVNode("button",{type:"button",onClick:h,disabled:p.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[i.createVNode(To,{height:"14",width:"14"}),i.createTextVNode(" "+i.toDisplayString(i.unref(l)),1)],8,iA)])]))}}),cA=ge(aA,[["__scopeId","data-v-a0f7fbfc"]]),dA={class:"flex items-center gap-2 w-full"},uA=["disabled"],fA=["disabled"],pA=i.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,{inputClass:r}=vt(t.style),o=e,s=i.computed({get:()=>t.modelValue||"#000000",set:a=>o("update:modelValue",a)}),l=i.computed(()=>!!t.disabled);return(a,c)=>(i.openBlock(),i.createElementBlock("div",dA,[i.withDirectives(i.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),disabled:l.value,ref:"color",class:i.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[a.modelValue?"":"text-opacity-50",i.unref(r)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,uA),[[i.vModelText,s.value]]),i.withDirectives(i.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":c[1]||(c[1]=d=>s.value=d),disabled:l.value},null,8,fA),[[i.vModelText,s.value]])]))}}),hA={class:"flex items-center gap-2 w-full"},mA=["min","max","step","disabled"],gA=["disabled"],yA=i.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,{inputClass:r}=vt(t.style),o=e,s=i.computed({get:()=>Number(t.modelValue??t.min),set:a=>o("update:modelValue",Number(a))}),l=i.computed(()=>!!t.disabled);return(a,c)=>(i.openBlock(),i.createElementBlock("div",hA,[i.withDirectives(i.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),min:a.min,max:a.max,step:a.step,disabled:l.value,ref:"range",class:i.normalizeClass(["w-full cursor-pointer accent-blue-500",[a.modelValue?"":"text-opacity-50",i.unref(r)].join(" ")])},null,10,mA),[[i.vModelText,s.value]]),i.withDirectives(i.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":c[1]||(c[1]=d=>s.value=d),disabled:l.value},null,8,gA),[[i.vModelText,s.value]])]))}}),bA=["type","value","onInput","placeholder","disabled"],kA=i.defineComponent({__name:"vs-input-array",props:i.mergeModels({count:{default:1},limit:{default:n=>n.count??1},inputType:{default:"text"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");i.watchEffect(()=>{const a=r.value?.length??0;a<e.count&&(r.value=[...r.value??[],...Array(e.count-a)])});function l(a,c){if(o.value)return;const d=a.target.value,u=[...r.value];u[c]=e.inputType==="text"?d:Number(d),r.value=u}return(a,c)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["grid gap-2",`grid-cols-${a.limit}`])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.count,d=>(i.openBlock(),i.createElementBlock("input",{type:a.inputType,value:r.value?.[d-1]??"",onInput:u=>l(u,d-1),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,bA))),256))],2))}}),xA={class:"flex items-center gap-2 w-full"},wA={class:"relative flex-1"},EA=["placeholder","disabled","onKeydown"],CA=["disabled"],vA={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},_A={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},SA={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},NA={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},MA={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},TA=["onClick"],AA={key:0,class:"p-4 text-sm text-gray-500"},BA=i.defineComponent({__name:"vs-input-address",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},api:{default:""},geom:{default:""},includes:{default:()=>[]}},{modelValue:{default:""},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=e,{inputClass:o}=vt(t.style),s=i.useModel(n,"modelValue"),l=i.computed({get:()=>s.value,set:b=>{s.value=b}}),a=i.ref(!1),c=i.ref([]),d=i.ref(!1),u=i.computed(()=>t.placeholder??""),f=i.computed(()=>!!t.disabled),p=i.inject("values");function h(){!f.value&&l.value.trim()&&m()}async function m(){const b=(l.value||"").trim();if(!b)return;let k=b;if(t.includes?.length&&p?.value){const x=t.includes.map(E=>p.value?.[E]).filter(Boolean);x.length&&(k=`${x.join(", ")}, ${b}`)}const w=t.api.replace("{{value}}",encodeURIComponent(k));a.value=!0;try{const x=await(await fetch(w)).json();c.value=Array.isArray(x)?x:[],d.value=!0}catch(x){console.error("Address search error:",x)}finally{a.value=!1}}function g(){d.value=!d.value}function y(b){if(!b)return;d.value=!1;const k=parseFloat(b.lat),w={type:"Point",coordinates:[parseFloat(b.lon),k]};t.geom&&p?.value&&(p.value[t.geom]=w),r("update:geom",w)}return(b,k)=>(i.openBlock(),i.createElementBlock("div",xA,[i.createElementVNode("div",wA,[i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":k[0]||(k[0]=w=>l.value=w),placeholder:u.value,disabled:f.value,class:i.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[i.unref(o),{"!border-red-600":t.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:i.withKeys(i.withModifiers(h,["prevent"]),["enter"])},null,42,EA),[[i.vModelText,l.value]]),c.value.length?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:g,title:"Show search results"},k[2]||(k[2]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),i.createElementVNode("path",{d:"M12 16v-4"}),i.createElementVNode("path",{d:"M12 8h.01"})],-1)]))):i.createCommentVNode("",!0)]),i.createElementVNode("button",{type:"button",onClick:m,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:a.value||!l.value?.trim()},[a.value?(i.openBlock(),i.createElementBlock("svg",_A,k[4]||(k[4]=[i.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),i.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(i.openBlock(),i.createElementBlock("svg",vA,k[3]||(k[3]=[i.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),i.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])))],8,CA),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[d.value?(i.openBlock(),i.createElementBlock("div",SA,[i.createElementVNode("div",NA,[i.createElementVNode("div",MA,[k[6]||(k[6]=i.createElementVNode("span",null,"Search results",-1)),i.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:k[1]||(k[1]=w=>d.value=!1),title:"Close"},k[5]||(k[5]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)]))]),i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,(w,x)=>(i.openBlock(),i.createElementBlock("li",{key:x,onClick:E=>y(w),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},i.toDisplayString(w.display_name),9,TA))),128))]),c.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",AA," No results found "))])])):i.createCommentVNode("",!0)]))]))}}),VA={VsInputText:bl,VsInputRadio:Gp,"vs-input-text":bl,"vs-input-password":tv,"vs-input-textarea":dN,"vs-input-mask":Fv,"vs-input-number":ov,"vs-input-radio":Gp,"vs-input-select":th,"vs-input-switcher":Kp,"vs-input-static":qp,"vs-input-container":jS,"vs-input-date":t_,"vs-input-checkbox":Qv,"vs-input-file":H_,"vs-input-html":qp,"vs-input-email":zv,"vs-input-datatable":yM,"vs-input-map":BT,"vs-input-file-list":bS,"vs-input-tags":zT,"vs-input-slug":WT,"vs-input-codegen":ZT,"vs-input-key-value":cA,"vs-input-range":yA,"vs-input-color":pA,"vs-input-native-select":th,"vs-input-array":kA,"vs-input-address":BA},LA=i.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(n){const e=n,t=i.inject("values");async function r(){try{if(!e.api)return;const o=e.api.replace("{{value}}",e.value),s=await fetch(o);if(!s.ok){Pe({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const l=await s.json();if(!e.set||!t)return;for(const[a,c]of Object.entries(e.set))t.value[a]=l.result[c]}catch(o){console.error(e.error,o)}}return(o,s)=>(i.openBlock(),i.createElementBlock("button",{onClick:r,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},i.toDisplayString(o.button),1))}}),OA={class:"flex flex-col gap-1 w-full"},IA={key:0,class:"text-sm text-gray-500"},rh=i.defineComponent({__name:"vs-compact-form-layout",props:i.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>QC[`${e.layout}`]),o=i.computed(()=>VA?.[`vs-input-${e.item.type}`]),s=i.computed(()=>{const a=i.unref(o);if(!a)return new Set;const c=a.props??a.__vccOpts?.props;if(!c)return new Set;const d=Array.isArray(c)?c:Object.keys(c);return new Set(d)}),l=i.computed(()=>{const a=e.item??{},c=s.value;return c.size?Object.fromEntries(Object.entries(a).filter(([d])=>c.has(d))):{}});return(a,c)=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.value),{ua:e.item.ua,error:e.error||"",item:a.item,columns:e.columns,label:e.item.label},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["flex w-full",`${e.item.type}-component`])},[i.createElementVNode("div",OA,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(o.value),i.mergeProps(l.value,{modelValue:t.value,"onUpdate:modelValue":c[0]||(c[0]=d=>t.value=d)}),null,16,["modelValue"])),a.item.description&&e.layout!=="settings"?(i.openBlock(),i.createElementBlock("p",IA,i.toDisplayString(a.item.description),1)):i.createCommentVNode("",!0)]),a.item.behavior?.api&&a.item.behavior?.button?(i.openBlock(),i.createBlock(LA,i.mergeProps({key:0},a.item.behavior,{value:t.value}),null,16,["value"])):i.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),DA={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},RA={class:"vs-compact-form-navigation__rail mt-[6px]"},FA=["onClick"],PA=i.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(n,{expose:e}){const t=n,r=i.ref([]),o=i.ref(""),s=i.ref(""),l=i.computed(()=>!!t.enabled),a=i.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),c=i.computed(()=>{const V=t.width;if(V==null)return{};const O=typeof V=="number"?`${V}px`:`${V}`;return{width:O,minWidth:O}});let d=null,u=0,f=0,p=null,h=null,m=null;const g=()=>z(),y=()=>k();i.watch(()=>t.target,async V=>{if(M(),!V){p=null,r.value=[],o.value="";return}p=V,l.value&&(await i.nextTick(),E(V),k())},{immediate:!0}),i.watch(()=>t.scrollContainer,V=>{if(!l.value){h=V??null;return}b(V??null),i.nextTick(()=>k())},{immediate:!0}),i.onMounted(()=>{t.scrollContainer||b(null),k()}),i.onBeforeUnmount(()=>{M(),b(null,!0),p=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),f&&window.cancelAnimationFrame(f))});function b(V,O=!1){if(m&&(m(),m=null),O){h=null;return}if(h=V??null,typeof window>"u")return;const Y=V??window,Q=window;Y.addEventListener("scroll",g,{passive:!0}),Q.addEventListener("resize",y),m=()=>{Y.removeEventListener("scroll",g),Q.removeEventListener("resize",y)}}function k(){if(!l.value||!p)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const V=()=>{w(),u=0};typeof window>"u"?V():u=window.requestAnimationFrame(V)}function w(){if(!l.value||!p)return;const V=Array.from(p.querySelectorAll("h1, h2")),O=new Set,Y=[];V.forEach((Q,P)=>{const K=Q.textContent?.trim()??"";if(!K)return;let U=(Q.getAttribute("id")??"").trim();U||(U=x(K)||`heading-${P+1}`);let re=U,se=1;for(;O.has(re);)re=`${U}-${se+=1}`;Q.id!==re&&Object.assign(Q,{id:re}),O.add(re),Y.push({id:re,text:K,level:Q.tagName.toLowerCase()==="h1"?1:2})}),r.value=Y,Y.length||(o.value=""),A()}function x(V){return V.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function E(V){!V||!l.value||typeof MutationObserver>"u"||(M(),d=new MutationObserver(()=>k()),d.observe(V,{childList:!0,subtree:!0}))}function M(){d&&(d.disconnect(),d=null)}function C(V){const O=h;if(!O)return typeof window>"u"?V.offsetTop:V.getBoundingClientRect().top+window.scrollY;const Y=V.getBoundingClientRect(),Q=O.getBoundingClientRect();return Y.top-Q.top+O.scrollTop}function A(){if(!l.value||!r.value.length)return;const V=h,O=(V?V.scrollTop:null)||(typeof window<"u"?window.scrollY:0),Y=(V?V.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Q=O+Y;let P=null;for(let U=0;U<r.value.length;U+=1){const re=r.value[U],se=document.getElementById(re.id);if(se){const ve=C(se);ve+se.offsetHeight>O&&ve<Q&&(P=re.id)}}!P&&s.value&&(P=s.value),P&&(s.value=P);const K=V?V.scrollHeight-V.clientHeight:document.documentElement.scrollHeight-window.innerHeight;O+5>=K&&(P=r.value[r.value.length-1].id),P&&(o.value=P)}function z(){l.value&&(f&&window.cancelAnimationFrame(f),f=window.requestAnimationFrame(()=>{A(),f=0}))}function G(V){if(!l.value)return;const O=document.getElementById(V);if(!O)return;const Y=h,Q=Math.max(0,C(O));Y?Y.scrollTo({top:Q,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Q,behavior:"smooth"})}return e({refresh:k}),(V,O)=>l.value&&r.value.length?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(a.value),style:i.normalizeStyle(c.value)},[i.createElementVNode("h2",DA,i.toDisplayString(V.title),1),i.createElementVNode("div",RA,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,Y=>(i.openBlock(),i.createElementBlock("div",{key:Y.id,class:i.normalizeClass(["vs-compact-form-navigation__item relative",Y.level===2?"vs-compact-form-navigation__item--nested":"",Y.id===o.value?"vs-compact-form-navigation__item--active":""])},[i.createElementVNode("button",{type:"button",onClick:Q=>G(Y.id),class:i.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",Y.level===2?"pl-[15px]":"pl-[18px]",Y.id===o.value?"text-gray-800":"text-gray-500"])},[i.createElementVNode("span",null,i.toDisplayString(Y.text),1)],10,FA)],2))),128))])],6)):i.createCommentVNode("",!0)}}),$A=ge(PA,[["__scopeId","data-v-1584a562"]]),oh={required:"Це поле є обов’язковим",email:"Неправильний email"},zA=n=>n?!1:oh.required,HA=n=>n?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?!1:oh.email:!1,jA=(n,e)=>{const t=e.pattern??e.regexp;return!(typeof t=="string"?new RegExp(t):t).test(n)&&n?e.message:!1},UA=(n,e)=>!1,WA=(n,e)=>{switch(typeof e=="string"?e:e.type){case"required":return zA(n);case"email":return HA(n);case"regexp":return jA(n,e);case"custom":return UA();default:return!1}},KA={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file",dropzone:"file"};function sh(n){const e=n.toLowerCase();return KA[e]||e}function Ra(n,e=!1){if(Array.isArray(n)){const r=[];return n.forEach(o=>{const s={...o};s.name=(o.name||o.id||o.key||"").toString(),s.type=sh(o.type),s.label=o.label||o.ua,s.rules=o.rules||o.validators,s.type==="email"&&!s.rules&&(s.rules=["email"]),o.data&&(s.api=`/api/suggest/${o.data}`),s.disabled=e||s.disabled,Array.isArray(s.schema)&&(s.schema=Ra(s.schema,s.disabled)),r.push(s)}),r}const t=[];return Object.entries(n).forEach(r=>{const o={name:r[0],...r[1],type:sh(r[1].type),label:r[1].label||r[1].ua,rules:r[1].rules||r[1].validators,disabled:e};o.type==="email"&&!o.rules&&(o.rules=["email"]),r[1].type.includes("list")&&(o.multiple=!0),!o.api&&r[1].data&&(o.api=`/api/suggest/${r[1].data}`),Array.isArray(o.schema)&&(o.schema=Ra(o.schema,o.disabled)),t.push(o)}),t}function qA(n,e,t=!1){const r=i.computed(()=>Ra(e,typeof t=="boolean"?t:t.value)),o=i.ref({});function s(c){const d=c?.conditions;if(!d)return!0;const u=Array.isArray(d)?d[0]:d,f=n?.value?.[u];return eh(f,d)}const l=(c=r.value,d=!0)=>(c.forEach(u=>{if(u.rules){if(!s(u)){delete o.value[u.name];return}let f=!1,p=null;u.rules.forEach(h=>{const m=WA(n.value[u.name],h);m&&(f=!0,!p&&typeof m=="string"&&(p=m))}),f&&p?o.value[u.name]=p:delete o.value[u.name]}u.schema&&l(u.schema,!1)}),d&&Object.values(o.value).some(Boolean)?o.value:null),a=i.computed(()=>r.value?.filter(c=>c.hidden!==!0&&s(c)));return{errors:o,validate:l,reset:()=>{n.value={},o.value={}},visibleSchema:a}}const GA={class:"flex w-full h-full min-h-0 gap-6"},JA={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},Rr=i.defineComponent({__name:"vs-compact-form",props:i.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:i.mergeModels(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(n,{expose:e,emit:t}){const r=t,o=n,s=i.useModel(n,"form"),l=i.useModel(n,"values"),{errors:a,validate:c,reset:d,visibleSchema:u}=qA(l,o.schema,i.toRef(o,"disabled")),f=i.ref(null),p=i.ref(null),h=i.computed(()=>o.navigation),m=i.computed(()=>o.navWidth),g=i.computed(()=>o.style?.columns),y=Object.freeze({container:12,label:3}),b=i.computed(()=>o.columns??g.value??y),k=i.computed(()=>o.columns!=null||g.value!=null),w=i.computed(()=>k.value?"horizontal":o.layout),x=A=>A?.columns?"horizontal":w.value,E=A=>A?.columns??b.value,M=()=>{r("update:modelValue",l.value),c(),r("handle-submit",l.value)};e({validate:c,reset:d,errors:a}),i.onMounted(()=>{o.modelValue&&(l.value=o.modelValue),s.value={value:l.value,errors:a.value,reset:d,validate:c,formId:o.formId}});function C(A,z){if(A===z)return!0;if(typeof A!="object"||typeof z!="object"||!A||!z)return!1;const G=Object.keys(A),V=Object.keys(z);return G.length!==V.length?!1:G.every(O=>A[O]===z[O])}return i.provide("form",s),i.provide("values",l),(A,z)=>(i.openBlock(),i.createElementBlock("div",GA,[i.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:p},[i.createElementVNode("form",{ref_key:"formRef",ref:f,onSubmit:i.withModifiers(M,["prevent"]),class:i.normalizeClass(["grid grid-cols-12 p-1",w.value==="default"?"gap-6":"gap-4"])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(u),(G,V)=>(i.openBlock(),i.createElementBlock("div",{key:G.name,class:i.normalizeClass(x(G)==="horizontal"?"col-span-12":`col-span-${G.col||12}`)},[i.createVNode(rh,{style:i.normalizeStyle(A.style),item:G,layout:x(G),columns:E(G),"model-value":l.value[G.name],"onUpdate:modelValue":O=>{const Y=l.value[G.name];C(Y,O)||(l.value[G.name]=O)},error:i.unref(a)[G.name]},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),x(G)==="settings"&&V+1!==i.unref(u).length?(i.openBlock(),i.createElementBlock("div",JA)):i.createCommentVNode("",!0)],2))),128))],34)],512),i.createVNode($A,{target:f.value,"scroll-container":p.value,enabled:h.value,width:m.value},null,8,["target","scroll-container","enabled","width"])]))}}),YA={class:"relative"},XA={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},ZA={class:"m-[10px] fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 min-h-0 h-fit max-h-[80vh] overflow-hidden opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl lg:w-7/12 w-11/12"},QA={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},eB={class:"font-medium text-gray-800 dark:text-[#ffffff]"},tB={class:"p-4 mim-h-0 h-full overflow-auto"},nB=i.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(n,{emit:e}){const t=n,r=e,o=i.ref(t.schema),s=i.ref(t.defaultValue?JSON.parse(JSON.stringify(t.defaultValue)):{}),l=i.ref({}),a=i.ref(),c=i.ref(t.mode);async function d(){const f=l.value.validate();if(f){Pe({type:"warning",title:"Помилка валідації",message:Object.entries(f).map(([p,h])=>`${p}: ${h}`).join(`
|
|
120
|
+
`)});return}if(a.value)try{const p=await fetch(`/api/table/${a.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s.value)});if(p.ok)await p.json(),Pe({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),r("save",s.value);else if(p.status===400){const h=await p.json().catch(()=>({}));Pe({type:"warning",title:"Помилка валідації",message:h.message||"Некоректні дані (400)"})}else p.status===500?Pe({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):Pe({type:"error",title:"Помилка",message:`Статус: ${p.status}`})}catch(p){Pe({type:"error",title:"Помилка з’єднання",message:p.message||"Не вдалося виконати запит"})}}function u(){r("close")}return i.onMounted(async()=>{try{if(t.form){const f=await fetch(`/api/template/form/${t.form}`);if(!f.ok){Pe({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const p=await f.json();o.value=p.schema,a.value=p.token}else if(t.token){a.value=t.token;const f=await fetch(`/api/form/${a.value}`);if(!f.ok){Pe({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const p=await f.json();o.value=p.schema,p.data?s.value=p.data:c.value="add"}}catch(f){Pe({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,p)=>(i.openBlock(),i.createElementBlock("div",YA,[i.createElementVNode("div",XA,[i.createElementVNode("div",ZA,[i.createElementVNode("div",QA,[i.createElementVNode("h3",eB,i.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),i.createElementVNode("button",{onClick:u,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},p[2]||(p[2]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),i.createElementVNode("div",tB,[o.value?(i.openBlock(),i.createBlock(Rr,{key:0,schema:o.value,values:s.value,"onUpdate:values":p[0]||(p[0]=h=>s.value=h),form:l.value,"onUpdate:form":p[1]||(p[1]=h=>l.value=h)},null,8,["schema","values","form"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[i.createElementVNode("button",{type:"button",onClick:u,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),i.createElementVNode("button",{onClick:d,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),lh=(n={mode:"edit",schema:null})=>new Promise(e=>{const{close:t}=VC({title:n.mode==="add"?"Додати":"Редагувати",template:"",size:"medium",content:nB,contentProps:{...n,onClose:()=>{e(null),t()},onSave:r=>{e(r),t()}}})});Rr.install=function(n){n.component("VForm",Rr),Object.assign(n.config.globalProperties,{$form:lh}),n.provide("form",lh),window.v3plugin||(window.v3plugin={})};const rB={class:"relative"},oB={key:0,class:"mt-4"},sB=["src","alt","title"],lB={key:0,class:"text-sm text-red-500"},iB=Object.assign({inheritAttrs:!1},{__name:"vs-editor-image",props:{editor:{type:Object,required:!0}},setup(n){const e=n,t=i.ref(!1),r=i.ref(!1),o=i.ref({}),s=i.ref({src:"",alt:"",title:""}),l=i.computed(()=>[{name:"src",label:"URL зображення",type:"text",required:!0,placeholder:"https://example.com/image.png"},{name:"file",label:"Файл",type:"file",required:!1,placeholder:"Шлях до файлу зображення"},{name:"width",label:"Ширина",type:"number",required:!1,placeholder:"Ширина зображення"},{name:"height",label:"Висота",type:"number",required:!1,placeholder:"Висота зображення"},{name:"alt",label:"Альтернативний текст",type:"text",required:!1,placeholder:"Опис зображення"},{name:"title",label:"Заголовок (необов'язково)",type:"text",required:!1,placeholder:"Заголовок зображення"}]),a=()=>{s.value={src:"",alt:"",title:""},r.value=!1,t.value=!0},c=()=>{t.value=!1,r.value=!1},d=async()=>{if(await o.value.validate()){Pe({type:"warning",title:"Попередження",message:"Будь ласка, заповніть всі обов'язкові поля"});return}if(!s.value.src){Pe({type:"warning",title:"Попередження",message:"Будь ласка, введіть URL зображення"});return}e.editor&&e.editor.chain().focus().setImage({src:s.value.src||s.value.file,alt:s.value.alt||"",title:s.value.title||"",width:s.value.width||"",height:s.value.height||""}).run(),c()},u=async()=>{await d()},f=()=>{c()};return i.watch(()=>s.value.src,()=>{r.value=!1}),(p,h)=>(i.openBlock(),i.createElementBlock("div",rB,[i.createElementVNode("button",{onClick:a,class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",n.editor?.isActive("image")?"bg-gray-200 text-gray-900":""]),title:"Додати зображення"},[...h[4]||(h[4]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"></rect><circle cx="9" cy="9" r="2"></circle><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"></path></svg><span class="sr-only">Додати зображення</span>',2)])],2),i.createVNode(Hp,{modelValue:t.value,"onUpdate:modelValue":h[3]||(h[3]=m=>t.value=m),title:"Додати зображення"},{footer:i.withCtx(()=>[i.createElementVNode("div",{class:"flex justify-end gap-x-2 p-[20px]"},[i.createElementVNode("button",{onClick:f,type:"button",class:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"}," Скасувати "),i.createElementVNode("button",{onClick:u,type:"button",class:"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500"}," Додати зображення ")])]),default:i.withCtx(()=>[i.createVNode(i.unref(Rr),{modelValue:s.value,"onUpdate:modelValue":h[0]||(h[0]=m=>s.value=m),schema:l.value,form:o.value,"onUpdate:form":h[1]||(h[1]=m=>o.value=m)},null,8,["modelValue","schema","form"]),s.value.src?(i.openBlock(),i.createElementBlock("div",oB,[h[5]||(h[5]=i.createElementVNode("p",{class:"text-sm text-gray-600 mb-2"},"Попередній перегляд:",-1)),i.withDirectives(i.createElementVNode("img",{src:s.value.src,alt:s.value.alt||"Попередній перегляд зображення",title:s.value.title,class:"max-w-full h-auto max-h-32 rounded border",onError:h[2]||(h[2]=m=>r.value=!0)},null,40,sB),[[i.vShow,!r.value]]),r.value?(i.openBlock(),i.createElementBlock("p",lB," Не вдалося завантажити попередній перегляд зображення ")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),_:1},8,["modelValue"])]))}}),aB={class:"flex items-center"},cB=["disabled"],dB=["disabled"],uB=Le(Object.assign({inheritAttrs:!1},{__name:"vs-editor-history",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor?.can().undo()&&e.editor.chain().focus().undo().run()},r=()=>{e.editor?.can().redo()&&e.editor.chain().focus().redo().run()};return(o,s)=>(i.openBlock(),i.createElementBlock("div",aB,[i.createElementVNode("button",{onClick:t,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-l-full hover:text-gray-900 hover:bg-gray-100 border-r border-gray-200",[n.editor?.can().undo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!n.editor?.can().undo(),title:"Undo (Ctrl+Z)"},[...s[0]||(s[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M3 7v6h6"}),i.createElementVNode("path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"})],-1)])],10,cB),i.createElementVNode("button",{onClick:r,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-r-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.can().redo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!n.editor?.can().redo(),title:"Redo (Ctrl+Y)"},[...s[1]||(s[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M21 7v6h-6"}),i.createElementVNode("path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"})],-1)])],10,dB)]))}}),[["__scopeId","data-v-b5a7cc5a"]]),fB={class:"relative"},pB=Le(Object.assign({inheritAttrs:!1},{__name:"vs-editor-help",props:{editor:Object},setup(n){const e=i.ref(!1),t=i.ref(null),r=()=>{e.value=!e.value},o=()=>{e.value=!1};return(s,l)=>(i.openBlock(),i.createElementBlock("div",fB,[i.createElementVNode("button",{ref_key:"helpButton",ref:t,onClick:r,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 text-gray-500",[e.value?"bg-gray-100 text-gray-900":"text-gray-500"]]),title:"Markdown Shortcuts Help"},[...l[1]||(l[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),i.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i.createElementVNode("line",{x1:"12",x2:"12.01",y1:"17",y2:"17"})],-1)])],2),e.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[100001]",onClick:o},[i.createElementVNode("div",{class:"bg-white rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] overflow-y-auto",onClick:l[0]||(l[0]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:"p-6"},[i.createElementVNode("div",{class:"flex justify-between items-center mb-4"},[l[3]||(l[3]=i.createElementVNode("h2",{class:"text-xl font-semibold text-gray-900"},"Common Markdown Syntax & Shortcuts",-1)),i.createElementVNode("button",{onClick:o,class:"text-gray-400 hover:text-gray-600 transition-colors"},[...l[2]||(l[2]=[i.createElementVNode("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),l[4]||(l[4]=i.createStaticVNode('<div class="space-y-6" data-v-72ce3024><div data-v-72ce3024><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-72ce3024>Markdown Syntax</h3><div class="overflow-x-auto" data-v-72ce3024><table class="w-full border-collapse" data-v-72ce3024><thead data-v-72ce3024><tr class="bg-gray-50" data-v-72ce3024><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Element</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Example</th></tr></thead><tbody class="text-sm" data-v-72ce3024><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Bold</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>**bold text**</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>__bold text__</code></td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Italics</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>*italic text*</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>_italic text_</code></td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Strikethrough</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>~strikethrough text~</code></td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Headings</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024># Heading 1</code>, <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>## Heading 2</code>, etc., up to <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>###### Heading 6</code></td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Unordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use an asterisk (*), dash (-), or plus sign (+) followed by a space. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Ordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use a number followed by a period and a space (e.g., <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>1. First item</code>). </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Blockquotes</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Start with a greater-than sign (>) followed by a space. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Inline Code</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Surround with backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>`</code>). </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Code Blocks</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Enclose with three backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>```</code>) before and after the code. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Images</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024></code> syntax. </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Links</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>[Link Text](url)</code> syntax. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Checklists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Create a list item with <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>- [ ]</code> for an incomplete task or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>- [x]</code> for a completed one. </td></tr></tbody></table></div></div><div data-v-72ce3024><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-72ce3024>Common Editing Shortcuts</h3><div class="overflow-x-auto" data-v-72ce3024><table class="w-full border-collapse" data-v-72ce3024><thead data-v-72ce3024><tr class="bg-gray-50" data-v-72ce3024><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Shortcut</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Action</th></tr></thead><tbody class="text-sm" data-v-72ce3024><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+A</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Select all text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+B</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Apply bold formatting</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+C</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Copy selected text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+I</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Apply italic formatting</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+K</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Open the insert link dialog</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+S</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Save the current document</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+V</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Paste copied text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+X</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Cut selected text</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+Y</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Redo the last action</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Alt+Shift+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Redo the last action</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+Z</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Undo the last action</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Alt+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Undo the last action</td></tr></tbody></table></div></div></div>',1))])])])):i.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-72ce3024"]]),hB={__name:"vs-editor-horizontal-rule",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().setHorizontalRule().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Horizontal Rule",onClick:t,class:"flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex"},[...o[0]||(o[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("line",{x1:"3",x2:"21",y1:"12",y2:"12"})],-1)])]))}},mB={__name:"vs-editor-fullscreen",props:{editor:Object},emits:["toggle-fullscreen"],setup(n,{emit:e}){const t=e,r=()=>{t("toggle-fullscreen")};return(o,s)=>(i.openBlock(),i.createElementBlock("button",{title:"Fullscreen",onClick:r,class:"w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100"},[...s[0]||(s[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})],-1)])]))}},gB=["title"],yB={class:"vs-editor-html-mode__text"},ih={bold:iE,italic:dE,color:S2,background_color:V2,highlight:L2,bullet_list:Zw,ordered_list:tE,blockquote:Jw,codeblock:oE,underline:uE,strike:fE,link:HE,table:qE,text_align:u2,type_tag:h2,font_family:F2,font_size:H2,superscript:W2,subscript:G2,heading:Q2,clear_formatting:nC,image:iB,history:uB,help:pB,horizontal_rule:hB,fullscreen:mB,html_mode:Le({__name:"vs-editor-html-mode",props:{editor:{type:Object,required:!0}},emits:["toggle-html-mode"],setup(n,{emit:e}){const t=e,r=i.ref(!1),o=()=>{r.value=!r.value,t("toggle-html-mode",r.value)};return(s,l)=>(i.openBlock(),i.createElementBlock("button",{onClick:o,class:i.normalizeClass([{"is-active":r.value},"vs-editor-html-mode"]),type:"button",title:r.value?"Switch to Rich Text Mode":"Switch to HTML Mode"},[l[0]||(l[0]=i.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"16,18 22,12 16,6"}),i.createElementVNode("polyline",{points:"8,6 2,12 8,18"})],-1)),i.createElementVNode("span",yB,i.toDisplayString((r.value,"HTML")),1)],10,gB))}},[["__scopeId","data-v-99a48167"]]),tab:Object.assign({inheritAttrs:!1},{__name:"vs-editor-tab",props:{editor:{type:Object,required:!0}},setup(n){const e=n,t=()=>{e.editor&&(e.editor.isActive("bulletList")||e.editor.isActive("orderedList"))&&e.editor.chain().focus().sinkListItem("listItem").run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Tab (Increase List Indent)",onClick:t,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none"},[...o[0]||(o[0]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-indent-increase"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M20 6l-11 0"></path><path d="M20 12l-7 0"></path><path d="M20 18l-11 0"></path><path d="M4 8l4 4l-4 4"></path></svg>',1)])]))}})},wl={basic:["history","font_family","font_size","bold","italic","underline","strike","text_align","bullet_list","ordered_list","link","image","clear_formatting","help"],default:["history","heading","font_family","font_size","bold","italic","underline","strike","superscript","subscript","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","clear_formatting","fullscreen","help","html_mode"],full:["history","heading","font_family","font_size","bold","italic","underline","strike","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","superscript","subscript","clear_formatting","fullscreen","help","html_mode"]},bB=Le({__name:"monaco-editor",props:{modelValue:{type:String,default:""},height:{type:String,default:"280px"},language:{type:String,default:"html"},theme:{type:String,default:"vs"}},emits:["update:modelValue","change"],setup(n,{expose:e,emit:t}){const r=n,o=t,s=i.ref(null);let l=null,a=null,c=!1,d=null;const u=()=>{const V=document.querySelector("link[data-monaco-editor-css]");if(!V)return!1;try{return V.sheet||V.styleSheet||V.href}catch{return!1}},f=()=>u()?new Promise(V=>setTimeout(V,50)):new Promise((V,O)=>{const Y=document.createElement("link");Y.rel="stylesheet",Y.href="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/editor/editor.main.css",Y.setAttribute("data-monaco-editor-css","true");const Q=()=>{const re=()=>{u()?setTimeout(()=>V(),100):setTimeout(re,50)};re()};Y.addEventListener?(Y.addEventListener("load",Q),Y.addEventListener("error",()=>O(new Error("Failed to load Monaco Editor CSS")))):(Y.onload=Q,Y.onerror=()=>O(new Error("Failed to load Monaco Editor CSS"))),document.head.appendChild(Y);let P=0;const K=20,U=setInterval(()=>{P++,u()?(clearInterval(U),setTimeout(()=>V(),100)):P>=K&&(clearInterval(U),setTimeout(()=>V(),100))},50)}),p=()=>document.querySelector("script[data-monaco-editor-loader]")?Promise.resolve():new Promise((O,Y)=>{const Q=document.createElement("script");Q.src="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/loader.js",Q.setAttribute("data-monaco-editor-loader","true"),Q.onload=()=>O(),Q.onerror=()=>Y(new Error("Failed to load Monaco Editor loader")),document.head.appendChild(Q)}),h=()=>d||(window.monaco&&window.monaco.editor?(a=window.monaco,Promise.resolve(a)):(d=new Promise((V,O)=>{if(c){const Y=setInterval(()=>{window.monaco&&window.monaco.editor&&(clearInterval(Y),a=window.monaco,V(a))},50);return}c=!0,f().then(()=>p()).then(()=>{const Y=setInterval(()=>{window.require&&(clearInterval(Y),window.require.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}}),window.require(["vs/editor/editor.main"],()=>{a=window.monaco,c=!1,V(a)},Q=>{c=!1,console.error("Failed to load Monaco Editor:",Q),O(Q)}))},50);setTimeout(()=>{clearInterval(Y),c=!1,O(new Error("Monaco Editor loader not found"))},1e4)}).catch(Y=>{c=!1,O(Y)})}),d)),m=V=>{try{const O=document.createElement("div");O.innerHTML=V;const Y=(P,K=0)=>{const U=" ".repeat(K);let re="";if(P.nodeType===Node.TEXT_NODE){const se=P.textContent.trim();return se&&(re+=U+se+`
|
|
121
|
+
`),re}if(P.nodeType===Node.ELEMENT_NODE){const se=P.tagName.toLowerCase(),ve=Array.from(P.attributes).map(Ft=>`${Ft.name}="${Ft.value}"`).join(" "),pt=P.children.length>0;P.textContent.trim()&&!pt?re+=U+`<${se}${ve?" "+ve:""}>${P.textContent}</${se}>
|
|
122
|
+
`:pt?(re+=U+`<${se}${ve?" "+ve:""}>
|
|
123
|
+
`,Array.from(P.childNodes).forEach(Ft=>{re+=Y(Ft,K+1)}),re+=U+`</${se}>
|
|
124
|
+
`):re+=U+`<${se}${ve?" "+ve:""} />
|
|
125
|
+
`}return re};let Q="";return Array.from(O.childNodes).forEach(P=>{Q+=Y(P)}),Q.trim()}catch(O){return console.warn("HTML formatting error:",O),V}},g=async()=>{if(!s.value)return;if(!a)try{await h();let O=!1,Y=0;for(;!O&&Y<10;){const Q=document.querySelector("link[data-monaco-editor-css]");if(Q&&(Q.sheet||Q.styleSheet))try{const P=Q.sheet||Q.styleSheet;P&&P.cssRules&&P.cssRules.length>0&&(O=!0)}catch{O=!0}O||(await new Promise(P=>setTimeout(P,50)),Y++)}}catch(O){console.error("Failed to load Monaco Editor:",O);return}const V=r.language;if(l=a.editor.create(s.value,{value:r.modelValue,language:V,theme:r.theme,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on",lineNumbers:"on",folding:!0,lineDecorationsWidth:0,lineNumbersMinChars:3,renderLineHighlight:"line",selectOnLineNumbers:!0,roundedSelection:!1,readOnly:!1,cursorStyle:"line",cursorBlinking:"blink",cursorSmoothCaretAnimation:!0,cursorWidth:1,fontFamily:"'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace",fontSize:13,lineHeight:1.5,tabSize:2,insertSpaces:!0,detectIndentation:!1,trimAutoWhitespace:!0,formatOnPaste:!0,formatOnType:!0,autoClosingBrackets:"always",autoClosingQuotes:"always",autoSurround:"languageDefined",bracketPairColorization:{enabled:!0},guides:{bracketPairs:!0,indentation:!0},fixedOverflowWidgets:!1,overflowWidgetsDomNode:s.value,suggest:{showKeywords:!0,showSnippets:!0,showClasses:!0,showFunctions:!0,showVariables:!0,showModules:!0,showProperties:!0,showEvents:!0,showOperators:!0,showUnits:!0,showValues:!0,showColors:!0,showFiles:!0,showReferences:!0,showFolders:!0,showTypeParameters:!0,showIssues:!0,showUsers:!0,showWords:!0,showCustomcolors:!0,showInterfaces:!0,showText:!0,showEnums:!0,showStructs:!0,showTypeAliases:!0,showConstants:!0,showConstructors:!0,showFields:!0,showMethods:!0,showNamespaces:!0,showPackages:!0,showSymbols:!0,showTypeParameters:!0},quickSuggestions:{other:!0,comments:!1,strings:!0},html:{format:{enable:!0,tabSize:2,insertSpaces:!0,wrapLineLength:120,unformatted:"default",contentUnformatted:"pre,code,textarea",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:2,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},suggest:{html5:!0,angular1:!1,ionic:!1},validate:{scripts:!0,styles:!0}},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8,useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,verticalSliderSize:4,horizontalSliderSize:4,arrowSize:0,verticalSliderHasArrows:!1,horizontalSliderHasArrows:!1}}),r.language==="html"){a.languages.register({id:"html"}),a.languages.setMonarchTokensProvider("html",{tokenizer:{root:[[/<!--/,"comment","@comment"],[/<[^>]+>/,"tag"],[/\w+\s*=\s*"[^"]*"/,"attribute"],[/\w+\s*=\s*'[^']*'/,"attribute"],[/"[^"]*"/,"string"],[/'[^']*'/,"string"],[/\b(doctype|html|head|body|title|meta|link|script|style|div|span|p|h1|h2|h3|h4|h5|h6|ul|ol|li|table|tr|td|th|form|input|button|img|a|br|hr)\b/i,"keyword"],[/\d+/,"number"],[/\s+/,"white"],[/./,"text"]],comment:[[/-->/,"comment","@pop"],[/./,"comment"]]}});try{a.languages.setLanguageConfiguration("html",{wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{blockComment:["<!--","-->"]},brackets:[["<",">"],["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"<",close:">",notIn:["string"]},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string"]}],surroundingPairs:[{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"}]})}catch(O){console.warn("HTML language configuration failed:",O)}}l.onDidChangeModelContent(()=>{const O=l.getValue();o("update:modelValue",O),o("change",O)})},y=V=>{l&&V!==l.getValue()&&l.setValue(V)},b=V=>{if(l&&a)if(r.language==="html"){const O=V==="vs-dark"||V==="hc-black";a.editor.defineTheme("html-custom",{base:O?"vs-dark":"vs",inherit:!0,rules:[{token:"tag",foreground:O?"#4FC1FF":"#0066CC",fontStyle:"bold"},{token:"attribute",foreground:O?"#9CDCFE":"#0000FF"},{token:"string",foreground:O?"#FF6B6B":"#CC0000"},{token:"comment",foreground:O?"#6A9955":"#008000",fontStyle:"italic"},{token:"keyword",foreground:O?"#FFA500":"#FF6600",fontStyle:"bold"},{token:"number",foreground:O?"#B5CEA8":"#098658"},{token:"text",foreground:O?"#D4D4D4":"#000000"},{token:"white",foreground:O?"#D4D4D4":"#000000"}],colors:{"editor.background":O?"#1e1e1e":"#ffffff","editor.foreground":O?"#d4d4d4":"#000000"}}),a.editor.setTheme("html-custom")}else a.editor.setTheme(V)},k=V=>{l&&a&&a.editor.setModelLanguage(l.getModel(),V)},w=()=>{l&&l.focus()},x=()=>l?l.getPosition():null,E=V=>{l&&V&&(l.setPosition(V),l.revealPosition(V))},M=()=>{if(l){const V=l.getSelection();return l.getModel().getValueInRange(V)}return""},C=V=>{if(l){const O=l.getSelection();l.executeEdits("replace-selection",[{range:O,text:V,forceMoveMarkers:!0}])}},A=()=>{if(l){const V=l.getValue(),O=m(V);O!==V&&(l.setValue(O),l.setPosition({lineNumber:1,column:1}))}},z=()=>{if(r.language==="html"&&a)try{a.languages.registerCompletionItemProvider("html",{provideCompletionItems:(V,O)=>({suggestions:[{label:"class",kind:a.languages.CompletionItemKind.Property,insertText:'class="$1"',insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"CSS class attribute"},{label:"id",kind:a.languages.CompletionItemKind.Property,insertText:'id="$1"',insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Unique identifier"},{label:"style",kind:a.languages.CompletionItemKind.Property,insertText:'style="$1"',insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Inline CSS styles"},{label:"data-*",kind:a.languages.CompletionItemKind.Property,insertText:'data-$1="$2"',insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Custom data attribute"}]})})}catch(V){console.warn("HTML completion provider failed:",V)}},G=()=>{l&&l.layout()};return i.onMounted(async()=>{await i.nextTick();try{await h(),await i.nextTick(),await g(),z(),window.addEventListener("resize",G)}catch(V){console.error("Failed to initialize Monaco Editor:",V)}}),i.onUnmounted(()=>{l&&l.dispose(),window.removeEventListener("resize",G)}),i.watch(()=>r.modelValue,y),i.watch(()=>r.theme,b),i.watch(()=>r.language,k),i.watch(()=>r.height,()=>{i.nextTick(()=>{G()})}),e({editor:l,focus:w,getPosition:x,setPosition:E,getSelectedText:M,replaceSelection:C,formatCode:A}),(V,O)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"monacoContainer",ref:s,class:"monaco-editor-container",style:i.normalizeStyle({height:n.height})},null,4))}},[["__scopeId","data-v-b1d773a1"]]),kB={class:"flex align-middle gap-x-0.5 border-b flex-wrap border-b-gray-200 px-[10px] py-[6px] border-solid border-transparent"},xB={key:1,class:"html-source-editor"},El=Object.assign({inheritAttrs:!1},{__name:"vs-richtext",props:i.mergeModels({modelValue:{type:String,default:()=>""},height:{type:String,default:()=>"300px"},toolbar:{type:[Array,String],default:()=>"default"}},{modelValue:{},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue"],["update:modelValue"]),setup(n){const e=n,t=i.useModel(n,"modelValue"),{editor:r,editorInstance:o,focusEditor:s}=Pp(e),{isHtmlMode:l,htmlContent:a,htmlTextarea:c,toggleHtmlMode:d,onHtmlInput:u}=$p(r,(g,y)=>{g==="update:modelValue"&&(t.value=y)}),{isFullscreen:f,toggleFullscreen:p}=zp(),h=i.computed(()=>typeof e.toolbar=="string"?wl[e.toolbar]||wl.default:e.toolbar),m=i.computed(()=>h.value.map(g=>ih[g]).filter(Boolean));return i.watch(()=>e.modelValue,g=>{if(r.value){const y=g||"",b=r.value.getHTML();y!==b&&y!=="<p></p>"&&r.value.commands.setContent(y,!1)}},{immediate:!0}),i.watch(r,g=>{g&&r.value.on("update",y=>{const b=y.editor.getHTML();b!==e.modelValue&&b!=="<p></p>"&&(t.value=b)})}),(g,y)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["bg-white border border border-solid border-gray-200 rounded-xl w-full",{"fixed left-0 right-0 top-0 bottom-0 z-[100000]":i.unref(f)}])},[i.createElementVNode("div",kB,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(m.value,b=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:b},[i.unref(r)?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(b),{key:0,editor:i.unref(o),onToggleFullscreen:i.unref(p),onToggleHtmlMode:i.unref(d)},null,40,["editor","onToggleFullscreen","onToggleHtmlMode"])):i.createCommentVNode("",!0)],64))),128))]),i.createElementVNode("div",{onClick:y[2]||(y[2]=(...b)=>i.unref(s)&&i.unref(s)(...b)),class:"relative w-full px-4 py-2 bg-white rounded-b-lg editor-content dark:bg-gray-800",style:i.normalizeStyle({height:i.unref(f)?"95vh":n.height})},[i.unref(l)?(i.openBlock(),i.createElementBlock("div",xB,[i.createVNode(bB,{ref_key:"htmlTextarea",ref:c,modelValue:i.unref(a),"onUpdate:modelValue":y[0]||(y[0]=b=>i.isRef(a)?a.value=b:null),height:i.unref(f)?"calc(95vh - 100px)":"100%",language:"html",theme:"vs",onChange:y[1]||(y[1]=b=>i.unref(u)(b))},null,8,["modelValue","height"])])):(i.openBlock(),i.createBlock(i.unref(Af),{key:0,editor:i.unref(r),class:"relative w-full"},null,8,["editor"]))],4)],2))}}),wB={class:"bg-white border-b flex-wrap border-b-gray-200 px-[10px] py-3 border-solid border-transparent"},EB={class:"flex flex-col mx-auto max-w-6xl"},CB={class:"flex justify-center gap-x-2"},ah=Object.assign({inheritAttrs:!1},{__name:"vs-richtext-page",props:i.mergeModels({modelValue:{type:String,default:()=>""},height:{type:String,default:()=>"min-h-[800px]"},width:{type:String,default:()=>"max-w-4xl"}},{modelValue:{},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue"],["update:modelValue"]),setup(n){const e=n,t=i.useModel(n,"modelValue"),r=["history","heading","font_family","font_size","bold","italic","underline","strike","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table"],{editor:o,editorInstance:s,focusEditor:l}=Pp(e),{toggleHtmlMode:a}=$p(o,(f,p)=>{f==="update:modelValue"&&(t.value=p)}),{toggleFullscreen:c}=zp(),d=i.computed(()=>typeof r=="string"?wl[r]||wl.default:r),u=i.computed(()=>d.value.map(f=>ih[f]).filter(Boolean));return i.watch(()=>e.modelValue,f=>{if(o.value){const p=f||"",h=o.value.getHTML();p!==h&&p!=="<p></p>"&&o.value.commands.setContent(p,!1)}},{immediate:!0}),i.watch(o,f=>{f&&o.value.on("update",p=>{const h=p.editor.getHTML();h!==e.modelValue&&h!=="<p></p>"&&(t.value=h)})}),(f,p)=>(i.openBlock(),i.createElementBlock("div",i.mergeProps(f.$attrs,{class:["w-full bg-[#f1f5f9] flex flex-col overflow-hidden",n.height]}),[i.createElementVNode("div",wB,[i.createElementVNode("div",EB,[i.renderSlot(f.$slots,"header"),i.createElementVNode("div",CB,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(u.value,h=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:h},[i.unref(o)?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(h),{key:0,editor:i.unref(s),onToggleFullscreen:i.unref(c),onToggleHtmlMode:i.unref(a)},null,40,["editor","onToggleFullscreen","onToggleHtmlMode"])):i.createCommentVNode("",!0)],64))),128))])])]),i.createElementVNode("div",{onClick:p[0]||(p[0]=(...h)=>i.unref(l)&&i.unref(l)(...h)),class:"relative w-full h-full px-6 py-8 flex justify-center rounded-b-lg editor-page-content dark:bg-gray-800 max-h-[95vh]"},[i.createVNode(i.unref(Af),{editor:i.unref(o),class:i.normalizeClass(["relative w-full bg-white shadow-lg rounded-lg min-h-[800px] h-[fit-content] p-16",[n.width]])},null,8,["editor","class"])])],16))}});/*!
|
|
110
126
|
* shared v11.1.12
|
|
111
127
|
* (c) 2025 kazuya kawaguchi
|
|
112
128
|
* Released under the MIT License.
|
|
113
|
-
*/function
|
|
114
|
-
`)}function
|
|
129
|
+
*/function tn(n,e){typeof console<"u"&&(console.warn("[intlify] "+n),e&&console.warn(e.stack))}const ch={};function Fa(n){ch[n]||(ch[n]=!0,tn(n))}const Wt=typeof window<"u";let _t,gr;if(process.env.NODE_ENV!=="production"){const n=Wt&&window.performance;n&&n.mark&&n.measure&&n.clearMarks&&n.clearMeasures&&(_t=e=>{n.mark(e)},gr=(e,t,r)=>{n.measure(e,t,r),n.clearMarks(t),n.clearMarks(r)})}const vB=/\{([0-9a-zA-Z]+)\}/g;function Cl(n,...e){return e.length===1&&ye(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),n.replace(vB,(t,r)=>e.hasOwnProperty(r)?e[r]:"")}const nn=(n,e=!1)=>e?Symbol.for(n):Symbol(n),_B=(n,e,t)=>SB({l:n,k:e,s:t}),SB=n=>JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),je=n=>typeof n=="number"&&isFinite(n),NB=n=>Pa(n)==="[object Date]",Fr=n=>Pa(n)==="[object RegExp]",vl=n=>me(n)&&Object.keys(n).length===0,We=Object.assign,MB=Object.create,Ce=(n=null)=>MB(n);let dh;const yr=()=>dh||(dh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Ce());function uh(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/").replace(/=/g,"=")}function fh(n){return n.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function TB(n){return n=n.replace(/(\w+)\s*=\s*"([^"]*)"/g,(r,o,s)=>`${o}="${fh(s)}"`),n=n.replace(/(\w+)\s*=\s*'([^']*)'/g,(r,o,s)=>`${o}='${fh(s)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(n)&&(process.env.NODE_ENV!=="production"&&tn("Potentially dangerous event handlers detected in translation. Consider removing onclick, onerror, etc. from your translation messages."),n=n.replace(/(\s+)(on)(\w+\s*=)/gi,"$1on$3")),[/(\s+(?:href|src|action|formaction)\s*=\s*["']?)\s*javascript:/gi,/(style\s*=\s*["'][^"']*url\s*\(\s*)javascript:/gi].forEach(r=>{n=n.replace(r,"$1javascript:")}),n}const AB=Object.prototype.hasOwnProperty;function Kt(n,e){return AB.call(n,e)}const Ie=Array.isArray,Ne=n=>typeof n=="function",J=n=>typeof n=="string",be=n=>typeof n=="boolean",ye=n=>n!==null&&typeof n=="object",BB=n=>ye(n)&&Ne(n.then)&&Ne(n.catch),ph=Object.prototype.toString,Pa=n=>ph.call(n),me=n=>Pa(n)==="[object Object]",VB=n=>n==null?"":Ie(n)||me(n)&&n.toString===ph?JSON.stringify(n,null,2):String(n);function $a(n,e=""){return n.reduce((t,r,o)=>o===0?t+r:t+e+r,"")}const hh=2;function LB(n,e=0,t=n.length){const r=n.split(/\r?\n/);let o=0;const s=[];for(let l=0;l<r.length;l++)if(o+=r[l].length+1,o>=e){for(let a=l-hh;a<=l+hh||t>o;a++){if(a<0||a>=r.length)continue;const c=a+1;s.push(`${c}${" ".repeat(3-String(c).length)}| ${r[a]}`);const d=r[a].length;if(a===l){const u=e-(o-d)+1,f=Math.max(1,t>o?d-u:t-e);s.push(" | "+" ".repeat(u)+"^".repeat(f))}else if(a>l){if(t>o){const u=Math.max(Math.min(t-o,d),1);s.push(" | "+"^".repeat(u))}o+=d+1}}break}return s.join(`
|
|
130
|
+
`)}function za(){const n=new Map;return{events:n,on(t,r){const o=n.get(t);o&&o.push(r)||n.set(t,[r])},off(t,r){const o=n.get(t);o&&o.splice(o.indexOf(r)>>>0,1)},emit(t,r){(n.get(t)||[]).slice().map(o=>o(r)),(n.get("*")||[]).slice().map(o=>o(t,r))}}}const _l=n=>!ye(n)||Ie(n);function Sl(n,e){if(_l(n)||_l(e))throw new Error("Invalid value");const t=[{src:n,des:e}];for(;t.length;){const{src:r,des:o}=t.pop();Object.keys(r).forEach(s=>{s!=="__proto__"&&(ye(r[s])&&!ye(o[s])&&(o[s]=Array.isArray(r[s])?[]:Ce()),_l(o[s])||_l(r[s])?o[s]=r[s]:t.push({src:r[s],des:o[s]}))})}}/*!
|
|
115
131
|
* message-compiler v11.1.12
|
|
116
132
|
* (c) 2025 kazuya kawaguchi
|
|
117
133
|
* Released under the MIT License.
|
|
118
|
-
*/function
|
|
119
|
-
`,iC="\u2028",lC="\u2029";function aC(t){const e=t;let n=0,r=1,o=1,s=0;const i=S=>e[S]===sC&&e[S+1]===Be,l=S=>e[S]===Be,a=S=>e[S]===lC,c=S=>e[S]===iC,d=S=>i(S)||l(S)||a(S)||c(S),u=()=>n,h=()=>r,p=()=>o,m=()=>s,g=S=>i(S)||a(S)||c(S)?Be:e[S],y=()=>g(n),b=()=>g(n+s);function k(){return s=0,d(n)&&(r++,o=0),i(n)&&n++,n++,o++,e[n]}function w(){return i(n+s)&&s++,s++,e[n+s]}function C(){n=0,r=1,o=1,s=0}function T(S=0){s=S}function _(){const S=n+s;for(;S!==n;)k();s=0}return{index:u,line:h,column:p,peekOffset:m,charAt:g,currentChar:y,currentPeek:b,next:k,peek:w,reset:C,resetPeek:T,skipToPeek:_}}const Rt=void 0,cC=".",Xf="'",dC="tokenizer";function uC(t,e={}){const n=e.location!==!1,r=aC(t),o=()=>r.index(),s=()=>Zw(r.line(),r.column(),r.index()),i=s(),l=o(),a={currentType:13,offset:l,startLoc:i,endLoc:i,lastType:13,lastOffset:l,lastStartLoc:i,lastEndLoc:i,braceNest:0,inLinked:!1,text:""},c=()=>a,{onError:d}=e;function u(x,E,M,...B){const fe=c();if(E.column+=M,E.offset+=M,d){const be=n?Pl(fe.startLoc,E):null,Y=Qn(x,be,{domain:dC,args:B});d(Y)}}function h(x,E,M){x.endLoc=s(),x.currentType=E;const B={type:E};return n&&(B.loc=Pl(x.startLoc,x.endLoc)),M!=null&&(B.value=M),B}const p=x=>h(x,13);function m(x,E){return x.currentChar()===E?(x.next(),E):(u(U.EXPECTED_TOKEN,s(),0,E),"")}function g(x){let E="";for(;x.currentPeek()===St||x.currentPeek()===Be;)E+=x.currentPeek(),x.peek();return E}function y(x){const E=g(x);return x.skipToPeek(),E}function b(x){if(x===Rt)return!1;const E=x.charCodeAt(0);return E>=97&&E<=122||E>=65&&E<=90||E===95}function k(x){if(x===Rt)return!1;const E=x.charCodeAt(0);return E>=48&&E<=57}function w(x,E){const{currentType:M}=E;if(M!==2)return!1;g(x);const B=b(x.currentPeek());return x.resetPeek(),B}function C(x,E){const{currentType:M}=E;if(M!==2)return!1;g(x);const B=x.currentPeek()==="-"?x.peek():x.currentPeek(),fe=k(B);return x.resetPeek(),fe}function T(x,E){const{currentType:M}=E;if(M!==2)return!1;g(x);const B=x.currentPeek()===Xf;return x.resetPeek(),B}function _(x,E){const{currentType:M}=E;if(M!==7)return!1;g(x);const B=x.currentPeek()===".";return x.resetPeek(),B}function S(x,E){const{currentType:M}=E;if(M!==8)return!1;g(x);const B=b(x.currentPeek());return x.resetPeek(),B}function I(x,E){const{currentType:M}=E;if(!(M===7||M===11))return!1;g(x);const B=x.currentPeek()===":";return x.resetPeek(),B}function F(x,E){const{currentType:M}=E;if(M!==9)return!1;const B=()=>{const be=x.currentPeek();return be==="{"?b(x.peek()):be==="@"||be==="|"||be===":"||be==="."||be===St||!be?!1:be===Be?(x.peek(),B()):P(x,!1)},fe=B();return x.resetPeek(),fe}function J(x){g(x);const E=x.currentPeek()==="|";return x.resetPeek(),E}function P(x,E=!0){const M=(fe=!1,be="")=>{const Y=x.currentPeek();return Y==="{"||Y==="@"||!Y?fe:Y==="|"?!(be===St||be===Be):Y===St?(x.peek(),M(!0,St)):Y===Be?(x.peek(),M(!0,Be)):!0},B=M();return E&&x.resetPeek(),B}function D(x,E){const M=x.currentChar();return M===Rt?Rt:E(M)?(x.next(),M):null}function K(x){const E=x.charCodeAt(0);return E>=97&&E<=122||E>=65&&E<=90||E>=48&&E<=57||E===95||E===36}function re(x){return D(x,K)}function Z(x){const E=x.charCodeAt(0);return E>=97&&E<=122||E>=65&&E<=90||E>=48&&E<=57||E===95||E===36||E===45}function Ue(x){return D(x,Z)}function Me(x){const E=x.charCodeAt(0);return E>=48&&E<=57}function je(x){return D(x,Me)}function at(x){const E=x.charCodeAt(0);return E>=48&&E<=57||E>=65&&E<=70||E>=97&&E<=102}function Ve(x){return D(x,at)}function an(x){let E="",M="";for(;E=je(x);)M+=E;return M}function Is(x){let E="";for(;;){const M=x.currentChar();if(M==="{"||M==="}"||M==="@"||M==="|"||!M)break;if(M===St||M===Be)if(P(x))E+=M,x.next();else{if(J(x))break;E+=M,x.next()}else E+=M,x.next()}return E}function cn(x){y(x);let E="",M="";for(;E=Ue(x);)M+=E;const B=x.currentChar();if(B&&B!=="}"&&B!==Rt&&B!==St&&B!==Be&&B!==" "){const fe=Rs(x);return u(U.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,M+fe),M+fe}return x.currentChar()===Rt&&u(U.UNTERMINATED_CLOSING_BRACE,s(),0),M}function aa(x){y(x);let E="";return x.currentChar()==="-"?(x.next(),E+=`-${an(x)}`):E+=an(x),x.currentChar()===Rt&&u(U.UNTERMINATED_CLOSING_BRACE,s(),0),E}function ca(x){return x!==Xf&&x!==Be}function ip(x){y(x),m(x,"'");let E="",M="";for(;E=D(x,ca);)E==="\\"?M+=da(x):M+=E;const B=x.currentChar();return B===Be||B===Rt?(u(U.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,s(),0),B===Be&&(x.next(),m(x,"'")),M):(m(x,"'"),M)}function da(x){const E=x.currentChar();switch(E){case"\\":case"'":return x.next(),`\\${E}`;case"u":return Ds(x,E,4);case"U":return Ds(x,E,6);default:return u(U.UNKNOWN_ESCAPE_SEQUENCE,s(),0,E),""}}function Ds(x,E,M){m(x,E);let B="";for(let fe=0;fe<M;fe++){const be=Ve(x);if(!be){u(U.INVALID_UNICODE_ESCAPE_SEQUENCE,s(),0,`\\${E}${B}${x.currentChar()}`);break}B+=be}return`\\${E}${B}`}function ua(x){return x!=="{"&&x!=="}"&&x!==St&&x!==Be}function Rs(x){y(x);let E="",M="";for(;E=D(x,ua);)M+=E;return M}function fa(x){let E="",M="";for(;E=re(x);)M+=E;return M}function ha(x){const E=M=>{const B=x.currentChar();return B==="{"||B==="@"||B==="|"||B==="("||B===")"||!B||B===St?M:(M+=B,x.next(),E(M))};return E("")}function Kr(x){y(x);const E=m(x,"|");return y(x),E}function qr(x,E){let M=null;switch(x.currentChar()){case"{":return E.braceNest>=1&&u(U.NOT_ALLOW_NEST_PLACEHOLDER,s(),0),x.next(),M=h(E,2,"{"),y(x),E.braceNest++,M;case"}":return E.braceNest>0&&E.currentType===2&&u(U.EMPTY_PLACEHOLDER,s(),0),x.next(),M=h(E,3,"}"),E.braceNest--,E.braceNest>0&&y(x),E.inLinked&&E.braceNest===0&&(E.inLinked=!1),M;case"@":return E.braceNest>0&&u(U.UNTERMINATED_CLOSING_BRACE,s(),0),M=Ln(x,E)||p(E),E.braceNest=0,M;default:{let fe=!0,be=!0,Y=!0;if(J(x))return E.braceNest>0&&u(U.UNTERMINATED_CLOSING_BRACE,s(),0),M=h(E,1,Kr(x)),E.braceNest=0,E.inLinked=!1,M;if(E.braceNest>0&&(E.currentType===4||E.currentType===5||E.currentType===6))return u(U.UNTERMINATED_CLOSING_BRACE,s(),0),E.braceNest=0,Gr(x,E);if(fe=w(x,E))return M=h(E,4,cn(x)),y(x),M;if(be=C(x,E))return M=h(E,5,aa(x)),y(x),M;if(Y=T(x,E))return M=h(E,6,ip(x)),y(x),M;if(!fe&&!be&&!Y)return M=h(E,12,Rs(x)),u(U.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,M.value),y(x),M;break}}return M}function Ln(x,E){const{currentType:M}=E;let B=null;const fe=x.currentChar();switch((M===7||M===8||M===11||M===9)&&(fe===Be||fe===St)&&u(U.INVALID_LINKED_FORMAT,s(),0),fe){case"@":return x.next(),B=h(E,7,"@"),E.inLinked=!0,B;case".":return y(x),x.next(),h(E,8,".");case":":return y(x),x.next(),h(E,9,":");default:return J(x)?(B=h(E,1,Kr(x)),E.braceNest=0,E.inLinked=!1,B):_(x,E)||I(x,E)?(y(x),Ln(x,E)):S(x,E)?(y(x),h(E,11,fa(x))):F(x,E)?(y(x),fe==="{"?qr(x,E)||B:h(E,10,ha(x))):(M===7&&u(U.INVALID_LINKED_FORMAT,s(),0),E.braceNest=0,E.inLinked=!1,Gr(x,E))}}function Gr(x,E){let M={type:13};if(E.braceNest>0)return qr(x,E)||p(E);if(E.inLinked)return Ln(x,E)||p(E);switch(x.currentChar()){case"{":return qr(x,E)||p(E);case"}":return u(U.UNBALANCED_CLOSING_BRACE,s(),0),x.next(),h(E,3,"}");case"@":return Ln(x,E)||p(E);default:{if(J(x))return M=h(E,1,Kr(x)),E.braceNest=0,E.inLinked=!1,M;if(P(x))return h(E,0,Is(x));break}}return M}function pa(){const{currentType:x,offset:E,startLoc:M,endLoc:B}=a;return a.lastType=x,a.lastOffset=E,a.lastStartLoc=M,a.lastEndLoc=B,a.offset=o(),a.startLoc=s(),r.currentChar()===Rt?h(a,13):Gr(r,a)}return{nextToken:pa,currentOffset:o,currentPosition:s,context:c}}const fC="parser",hC=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function pC(t,e,n){switch(t){case"\\\\":return"\\";case"\\'":return"'";default:{const r=parseInt(e||n,16);return r<=55295||r>=57344?String.fromCodePoint(r):"�"}}}function mC(t={}){const e=t.location!==!1,{onError:n}=t;function r(b,k,w,C,...T){const _=b.currentPosition();if(_.offset+=C,_.column+=C,n){const S=e?Pl(w,_):null,I=Qn(k,S,{domain:fC,args:T});n(I)}}function o(b,k,w){const C={type:b};return e&&(C.start=k,C.end=k,C.loc={start:w,end:w}),C}function s(b,k,w,C){e&&(b.end=k,b.loc&&(b.loc.end=w))}function i(b,k){const w=b.context(),C=o(3,w.offset,w.startLoc);return C.value=k,s(C,b.currentOffset(),b.currentPosition()),C}function l(b,k){const w=b.context(),{lastOffset:C,lastStartLoc:T}=w,_=o(5,C,T);return _.index=parseInt(k,10),b.nextToken(),s(_,b.currentOffset(),b.currentPosition()),_}function a(b,k){const w=b.context(),{lastOffset:C,lastStartLoc:T}=w,_=o(4,C,T);return _.key=k,b.nextToken(),s(_,b.currentOffset(),b.currentPosition()),_}function c(b,k){const w=b.context(),{lastOffset:C,lastStartLoc:T}=w,_=o(9,C,T);return _.value=k.replace(hC,pC),b.nextToken(),s(_,b.currentOffset(),b.currentPosition()),_}function d(b){const k=b.nextToken(),w=b.context(),{lastOffset:C,lastStartLoc:T}=w,_=o(8,C,T);return k.type!==11?(r(b,U.UNEXPECTED_EMPTY_LINKED_MODIFIER,w.lastStartLoc,0),_.value="",s(_,C,T),{nextConsumeToken:k,node:_}):(k.value==null&&r(b,U.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,Tt(k)),_.value=k.value||"",s(_,b.currentOffset(),b.currentPosition()),{node:_})}function u(b,k){const w=b.context(),C=o(7,w.offset,w.startLoc);return C.value=k,s(C,b.currentOffset(),b.currentPosition()),C}function h(b){const k=b.context(),w=o(6,k.offset,k.startLoc);let C=b.nextToken();if(C.type===8){const T=d(b);w.modifier=T.node,C=T.nextConsumeToken||b.nextToken()}switch(C.type!==9&&r(b,U.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Tt(C)),C=b.nextToken(),C.type===2&&(C=b.nextToken()),C.type){case 10:C.value==null&&r(b,U.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Tt(C)),w.key=u(b,C.value||"");break;case 4:C.value==null&&r(b,U.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Tt(C)),w.key=a(b,C.value||"");break;case 5:C.value==null&&r(b,U.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Tt(C)),w.key=l(b,C.value||"");break;case 6:C.value==null&&r(b,U.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Tt(C)),w.key=c(b,C.value||"");break;default:{r(b,U.UNEXPECTED_EMPTY_LINKED_KEY,k.lastStartLoc,0);const T=b.context(),_=o(7,T.offset,T.startLoc);return _.value="",s(_,T.offset,T.startLoc),w.key=_,s(w,T.offset,T.startLoc),{nextConsumeToken:C,node:w}}}return s(w,b.currentOffset(),b.currentPosition()),{node:w}}function p(b){const k=b.context(),w=k.currentType===1?b.currentOffset():k.offset,C=k.currentType===1?k.endLoc:k.startLoc,T=o(2,w,C);T.items=[];let _=null;do{const F=_||b.nextToken();switch(_=null,F.type){case 0:F.value==null&&r(b,U.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Tt(F)),T.items.push(i(b,F.value||""));break;case 5:F.value==null&&r(b,U.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Tt(F)),T.items.push(l(b,F.value||""));break;case 4:F.value==null&&r(b,U.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Tt(F)),T.items.push(a(b,F.value||""));break;case 6:F.value==null&&r(b,U.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Tt(F)),T.items.push(c(b,F.value||""));break;case 7:{const J=h(b);T.items.push(J.node),_=J.nextConsumeToken||null;break}}}while(k.currentType!==13&&k.currentType!==1);const S=k.currentType===1?k.lastOffset:b.currentOffset(),I=k.currentType===1?k.lastEndLoc:b.currentPosition();return s(T,S,I),T}function m(b,k,w,C){const T=b.context();let _=C.items.length===0;const S=o(1,k,w);S.cases=[],S.cases.push(C);do{const I=p(b);_||(_=I.items.length===0),S.cases.push(I)}while(T.currentType!==13);return _&&r(b,U.MUST_HAVE_MESSAGES_IN_PLURAL,w,0),s(S,b.currentOffset(),b.currentPosition()),S}function g(b){const k=b.context(),{offset:w,startLoc:C}=k,T=p(b);return k.currentType===13?T:m(b,w,C,T)}function y(b){const k=uC(b,Se({},t)),w=k.context(),C=o(0,w.offset,w.startLoc);return e&&C.loc&&(C.loc.source=b),C.body=g(k),t.onCacheKey&&(C.cacheKey=t.onCacheKey(b)),w.currentType!==13&&r(k,U.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,b[w.offset]||""),s(C,k.currentOffset(),k.currentPosition()),C}return{parse:y}}function Tt(t){if(t.type===13)return"EOF";const e=(t.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function gC(t,e={}){const n={ast:t,helpers:new Set};return{context:()=>n,helper:s=>(n.helpers.add(s),s)}}function Qf(t,e){for(let n=0;n<t.length;n++)Bl(t[n],e)}function Bl(t,e){switch(t.type){case 1:Qf(t.cases,e),e.helper("plural");break;case 2:Qf(t.items,e);break;case 6:{Bl(t.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function yC(t,e={}){const n=gC(t);n.helper("normalize"),t.body&&Bl(t.body,n);const r=n.context();t.helpers=Array.from(r.helpers)}function bC(t){const e=t.body;return e.type===2?Zf(e):e.cases.forEach(n=>Zf(n)),t}function Zf(t){if(t.items.length===1){const e=t.items[0];(e.type===3||e.type===9)&&(t.static=e.value,delete e.value)}else{const e=[];for(let n=0;n<t.items.length;n++){const r=t.items[n];if(!(r.type===3||r.type===9)||r.value==null)break;e.push(r.value)}if(e.length===t.items.length){t.static=Dl(e);for(let n=0;n<t.items.length;n++){const r=t.items[n];(r.type===3||r.type===9)&&delete r.value}}}}const kC="minifier";function Zn(t){switch(t.t=t.type,t.type){case 0:{const e=t;Zn(e.body),e.b=e.body,delete e.body;break}case 1:{const e=t,n=e.cases;for(let r=0;r<n.length;r++)Zn(n[r]);e.c=n,delete e.cases;break}case 2:{const e=t,n=e.items;for(let r=0;r<n.length;r++)Zn(n[r]);e.i=n,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=t;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=t;Zn(e.key),e.k=e.key,delete e.key,e.modifier&&(Zn(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=t;e.i=e.index,delete e.index;break}case 4:{const e=t;e.k=e.key,delete e.key;break}default:if(process.env.NODE_ENV!=="production")throw Qn(U.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:kC,args:[t.type]})}delete t.type}const xC="parser";function EC(t,e){const{filename:n,breakLineCode:r,needIndent:o}=e,s=e.location!==!1,i={filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:o,indentLevel:0};s&&t.loc&&(i.source=t.loc.source);const l=()=>i;function a(g,y){i.code+=g}function c(g,y=!0){const b=y?r:"";a(o?b+" ".repeat(g):b)}function d(g=!0){const y=++i.indentLevel;g&&c(y)}function u(g=!0){const y=--i.indentLevel;g&&c(y)}function h(){c(i.indentLevel)}return{context:l,push:a,indent:d,deindent:u,newline:h,helper:g=>`_${g}`,needIndent:()=>i.needIndent}}function wC(t,e){const{helper:n}=t;t.push(`${n("linked")}(`),er(t,e.key),e.modifier?(t.push(", "),er(t,e.modifier),t.push(", _type")):t.push(", undefined, _type"),t.push(")")}function CC(t,e){const{helper:n,needIndent:r}=t;t.push(`${n("normalize")}([`),t.indent(r());const o=e.items.length;for(let s=0;s<o&&(er(t,e.items[s]),s!==o-1);s++)t.push(", ");t.deindent(r()),t.push("])")}function SC(t,e){const{helper:n,needIndent:r}=t;if(e.cases.length>1){t.push(`${n("plural")}([`),t.indent(r());const o=e.cases.length;for(let s=0;s<o&&(er(t,e.cases[s]),s!==o-1);s++)t.push(", ");t.deindent(r()),t.push("])")}}function TC(t,e){e.body?er(t,e.body):t.push("null")}function er(t,e){const{helper:n}=t;switch(e.type){case 0:TC(t,e);break;case 1:SC(t,e);break;case 2:CC(t,e);break;case 6:wC(t,e);break;case 8:t.push(JSON.stringify(e.value),e);break;case 7:t.push(JSON.stringify(e.value),e);break;case 5:t.push(`${n("interpolate")}(${n("list")}(${e.index}))`,e);break;case 4:t.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:t.push(JSON.stringify(e.value),e);break;case 3:t.push(JSON.stringify(e.value),e);break;default:if(process.env.NODE_ENV!=="production")throw Qn(U.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:xC,args:[e.type]})}}const NC=(t,e={})=>{const n=R(e.mode)?e.mode:"normal",r=R(e.filename)?e.filename:"message.intl";e.sourceMap;const o=e.breakLineCode!=null?e.breakLineCode:n==="arrow"?";":`
|
|
120
|
-
`,s=e.needIndent?e.needIndent:
|
|
134
|
+
*/function OB(n,e,t){return{line:n,column:e,offset:t}}function Ha(n,e,t){return{start:n,end:e}}const ie={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16},IB=17,DB={[ie.EXPECTED_TOKEN]:"Expected token: '{0}'",[ie.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[ie.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[ie.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[ie.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[ie.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[ie.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[ie.EMPTY_PLACEHOLDER]:"Empty placeholder",[ie.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[ie.INVALID_LINKED_FORMAT]:"Invalid linked format",[ie.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[ie.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[ie.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[ie.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[ie.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[ie.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function Pr(n,e,t={}){const{domain:r,messages:o,args:s}=t,l=process.env.NODE_ENV!=="production"?Cl((o||DB)[n]||"",...s||[]):n,a=new SyntaxError(String(l));return a.code=n,e&&(a.location=e),a.domain=r,a}function RB(n){throw n}const FB=/<\/?[\w\s="/.':;#-\/]+>/,PB=n=>FB.test(n),rn=" ",$B="\r",at=`
|
|
135
|
+
`,zB="\u2028",HB="\u2029";function jB(n){const e=n;let t=0,r=1,o=1,s=0;const l=C=>e[C]===$B&&e[C+1]===at,a=C=>e[C]===at,c=C=>e[C]===HB,d=C=>e[C]===zB,u=C=>l(C)||a(C)||c(C)||d(C),f=()=>t,p=()=>r,h=()=>o,m=()=>s,g=C=>l(C)||c(C)||d(C)?at:e[C],y=()=>g(t),b=()=>g(t+s);function k(){return s=0,u(t)&&(r++,o=0),l(t)&&t++,t++,o++,e[t]}function w(){return l(t+s)&&s++,s++,e[t+s]}function x(){t=0,r=1,o=1,s=0}function E(C=0){s=C}function M(){const C=t+s;for(;C!==t;)k();s=0}return{index:f,line:p,column:h,peekOffset:m,charAt:g,currentChar:y,currentPeek:b,next:k,peek:w,reset:x,resetPeek:E,skipToPeek:M}}const xn=void 0,UB=".",mh="'",WB="tokenizer";function KB(n,e={}){const t=e.location!==!1,r=jB(n),o=()=>r.index(),s=()=>OB(r.line(),r.column(),r.index()),l=s(),a=o(),c={currentType:13,offset:a,startLoc:l,endLoc:l,lastType:13,lastOffset:a,lastStartLoc:l,lastEndLoc:l,braceNest:0,inLinked:!1,text:""},d=()=>c,{onError:u}=e;function f(_,S,D,...X){const we=d();if(S.column+=D,S.offset+=D,u){const Be=t?Ha(we.startLoc,S):null,pe=Pr(_,Be,{domain:WB,args:X});u(pe)}}function p(_,S,D){_.endLoc=s(),_.currentType=S;const X={type:S};return t&&(X.loc=Ha(_.startLoc,_.endLoc)),D!=null&&(X.value=D),X}const h=_=>p(_,13);function m(_,S){return _.currentChar()===S?(_.next(),S):(f(ie.EXPECTED_TOKEN,s(),0,S),"")}function g(_){let S="";for(;_.currentPeek()===rn||_.currentPeek()===at;)S+=_.currentPeek(),_.peek();return S}function y(_){const S=g(_);return _.skipToPeek(),S}function b(_){if(_===xn)return!1;const S=_.charCodeAt(0);return S>=97&&S<=122||S>=65&&S<=90||S===95}function k(_){if(_===xn)return!1;const S=_.charCodeAt(0);return S>=48&&S<=57}function w(_,S){const{currentType:D}=S;if(D!==2)return!1;g(_);const X=b(_.currentPeek());return _.resetPeek(),X}function x(_,S){const{currentType:D}=S;if(D!==2)return!1;g(_);const X=_.currentPeek()==="-"?_.peek():_.currentPeek(),we=k(X);return _.resetPeek(),we}function E(_,S){const{currentType:D}=S;if(D!==2)return!1;g(_);const X=_.currentPeek()===mh;return _.resetPeek(),X}function M(_,S){const{currentType:D}=S;if(D!==7)return!1;g(_);const X=_.currentPeek()===".";return _.resetPeek(),X}function C(_,S){const{currentType:D}=S;if(D!==8)return!1;g(_);const X=b(_.currentPeek());return _.resetPeek(),X}function A(_,S){const{currentType:D}=S;if(!(D===7||D===11))return!1;g(_);const X=_.currentPeek()===":";return _.resetPeek(),X}function z(_,S){const{currentType:D}=S;if(D!==9)return!1;const X=()=>{const Be=_.currentPeek();return Be==="{"?b(_.peek()):Be==="@"||Be==="|"||Be===":"||Be==="."||Be===rn||!Be?!1:Be===at?(_.peek(),X()):V(_,!1)},we=X();return _.resetPeek(),we}function G(_){g(_);const S=_.currentPeek()==="|";return _.resetPeek(),S}function V(_,S=!0){const D=(we=!1,Be="")=>{const pe=_.currentPeek();return pe==="{"||pe==="@"||!pe?we:pe==="|"?!(Be===rn||Be===at):pe===rn?(_.peek(),D(!0,rn)):pe===at?(_.peek(),D(!0,at)):!0},X=D();return S&&_.resetPeek(),X}function O(_,S){const D=_.currentChar();return D===xn?xn:S(D)?(_.next(),D):null}function Y(_){const S=_.charCodeAt(0);return S>=97&&S<=122||S>=65&&S<=90||S>=48&&S<=57||S===95||S===36}function Q(_){return O(_,Y)}function P(_){const S=_.charCodeAt(0);return S>=97&&S<=122||S>=65&&S<=90||S>=48&&S<=57||S===95||S===36||S===45}function K(_){return O(_,P)}function U(_){const S=_.charCodeAt(0);return S>=48&&S<=57}function re(_){return O(_,U)}function se(_){const S=_.charCodeAt(0);return S>=48&&S<=57||S>=65&&S<=70||S>=97&&S<=102}function ve(_){return O(_,se)}function pt(_){let S="",D="";for(;S=re(_);)D+=S;return D}function St(_){let S="";for(;;){const D=_.currentChar();if(D==="{"||D==="}"||D==="@"||D==="|"||!D)break;if(D===rn||D===at)if(V(_))S+=D,_.next();else{if(G(_))break;S+=D,_.next()}else S+=D,_.next()}return S}function Ft(_){y(_);let S="",D="";for(;S=K(_);)D+=S;const X=_.currentChar();if(X&&X!=="}"&&X!==xn&&X!==rn&&X!==at&&X!==" "){const we=mt(_);return f(ie.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,D+we),D+we}return _.currentChar()===xn&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),D}function Ke(_){y(_);let S="";return _.currentChar()==="-"?(_.next(),S+=`-${pt(_)}`):S+=pt(_),_.currentChar()===xn&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),S}function ht(_){return _!==mh&&_!==at}function En(_){y(_),m(_,"'");let S="",D="";for(;S=O(_,ht);)S==="\\"?D+=Cn(_):D+=S;const X=_.currentChar();return X===at||X===xn?(f(ie.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,s(),0),X===at&&(_.next(),m(_,"'")),D):(m(_,"'"),D)}function Cn(_){const S=_.currentChar();switch(S){case"\\":case"'":return _.next(),`\\${S}`;case"u":return vn(_,S,4);case"U":return vn(_,S,6);default:return f(ie.UNKNOWN_ESCAPE_SEQUENCE,s(),0,S),""}}function vn(_,S,D){m(_,S);let X="";for(let we=0;we<D;we++){const Be=ve(_);if(!Be){f(ie.INVALID_UNICODE_ESCAPE_SEQUENCE,s(),0,`\\${S}${X}${_.currentChar()}`);break}X+=Be}return`\\${S}${X}`}function xr(_){return _!=="{"&&_!=="}"&&_!==rn&&_!==at}function mt(_){y(_);let S="",D="";for(;S=O(_,xr);)D+=S;return D}function Pt(_){let S="",D="";for(;S=Q(_);)D+=S;return D}function cn(_){const S=D=>{const X=_.currentChar();return X==="{"||X==="@"||X==="|"||X==="("||X===")"||!X||X===rn?D:(D+=X,_.next(),S(D))};return S("")}function qe(_){y(_);const S=m(_,"|");return y(_),S}function $t(_,S){let D=null;switch(_.currentChar()){case"{":return S.braceNest>=1&&f(ie.NOT_ALLOW_NEST_PLACEHOLDER,s(),0),_.next(),D=p(S,2,"{"),y(_),S.braceNest++,D;case"}":return S.braceNest>0&&S.currentType===2&&f(ie.EMPTY_PLACEHOLDER,s(),0),_.next(),D=p(S,3,"}"),S.braceNest--,S.braceNest>0&&y(_),S.inLinked&&S.braceNest===0&&(S.inLinked=!1),D;case"@":return S.braceNest>0&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),D=qt(_,S)||h(S),S.braceNest=0,D;default:{let we=!0,Be=!0,pe=!0;if(G(_))return S.braceNest>0&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),D=p(S,1,qe(_)),S.braceNest=0,S.inLinked=!1,D;if(S.braceNest>0&&(S.currentType===4||S.currentType===5||S.currentType===6))return f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),S.braceNest=0,dn(_,S);if(we=w(_,S))return D=p(S,4,Ft(_)),y(_),D;if(Be=x(_,S))return D=p(S,5,Ke(_)),y(_),D;if(pe=E(_,S))return D=p(S,6,En(_)),y(_),D;if(!we&&!Be&&!pe)return D=p(S,12,mt(_)),f(ie.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,D.value),y(_),D;break}}return D}function qt(_,S){const{currentType:D}=S;let X=null;const we=_.currentChar();switch((D===7||D===8||D===11||D===9)&&(we===at||we===rn)&&f(ie.INVALID_LINKED_FORMAT,s(),0),we){case"@":return _.next(),X=p(S,7,"@"),S.inLinked=!0,X;case".":return y(_),_.next(),p(S,8,".");case":":return y(_),_.next(),p(S,9,":");default:return G(_)?(X=p(S,1,qe(_)),S.braceNest=0,S.inLinked=!1,X):M(_,S)||A(_,S)?(y(_),qt(_,S)):C(_,S)?(y(_),p(S,11,Pt(_))):z(_,S)?(y(_),we==="{"?$t(_,S)||X:p(S,10,cn(_))):(D===7&&f(ie.INVALID_LINKED_FORMAT,s(),0),S.braceNest=0,S.inLinked=!1,dn(_,S))}}function dn(_,S){let D={type:13};if(S.braceNest>0)return $t(_,S)||h(S);if(S.inLinked)return qt(_,S)||h(S);switch(_.currentChar()){case"{":return $t(_,S)||h(S);case"}":return f(ie.UNBALANCED_CLOSING_BRACE,s(),0),_.next(),p(S,3,"}");case"@":return qt(_,S)||h(S);default:{if(G(_))return D=p(S,1,qe(_)),S.braceNest=0,S.inLinked=!1,D;if(V(_))return p(S,0,St(_));break}}return D}function Xn(){const{currentType:_,offset:S,startLoc:D,endLoc:X}=c;return c.lastType=_,c.lastOffset=S,c.lastStartLoc=D,c.lastEndLoc=X,c.offset=o(),c.startLoc=s(),r.currentChar()===xn?p(c,13):dn(r,c)}return{nextToken:Xn,currentOffset:o,currentPosition:s,context:d}}const qB="parser",GB=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function JB(n,e,t){switch(n){case"\\\\":return"\\";case"\\'":return"'";default:{const r=parseInt(e||t,16);return r<=55295||r>=57344?String.fromCodePoint(r):"�"}}}function YB(n={}){const e=n.location!==!1,{onError:t}=n;function r(b,k,w,x,...E){const M=b.currentPosition();if(M.offset+=x,M.column+=x,t){const C=e?Ha(w,M):null,A=Pr(k,C,{domain:qB,args:E});t(A)}}function o(b,k,w){const x={type:b};return e&&(x.start=k,x.end=k,x.loc={start:w,end:w}),x}function s(b,k,w,x){e&&(b.end=k,b.loc&&(b.loc.end=w))}function l(b,k){const w=b.context(),x=o(3,w.offset,w.startLoc);return x.value=k,s(x,b.currentOffset(),b.currentPosition()),x}function a(b,k){const w=b.context(),{lastOffset:x,lastStartLoc:E}=w,M=o(5,x,E);return M.index=parseInt(k,10),b.nextToken(),s(M,b.currentOffset(),b.currentPosition()),M}function c(b,k){const w=b.context(),{lastOffset:x,lastStartLoc:E}=w,M=o(4,x,E);return M.key=k,b.nextToken(),s(M,b.currentOffset(),b.currentPosition()),M}function d(b,k){const w=b.context(),{lastOffset:x,lastStartLoc:E}=w,M=o(9,x,E);return M.value=k.replace(GB,JB),b.nextToken(),s(M,b.currentOffset(),b.currentPosition()),M}function u(b){const k=b.nextToken(),w=b.context(),{lastOffset:x,lastStartLoc:E}=w,M=o(8,x,E);return k.type!==11?(r(b,ie.UNEXPECTED_EMPTY_LINKED_MODIFIER,w.lastStartLoc,0),M.value="",s(M,x,E),{nextConsumeToken:k,node:M}):(k.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,on(k)),M.value=k.value||"",s(M,b.currentOffset(),b.currentPosition()),{node:M})}function f(b,k){const w=b.context(),x=o(7,w.offset,w.startLoc);return x.value=k,s(x,b.currentOffset(),b.currentPosition()),x}function p(b){const k=b.context(),w=o(6,k.offset,k.startLoc);let x=b.nextToken();if(x.type===8){const E=u(b);w.modifier=E.node,x=E.nextConsumeToken||b.nextToken()}switch(x.type!==9&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),x=b.nextToken(),x.type===2&&(x=b.nextToken()),x.type){case 10:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),w.key=f(b,x.value||"");break;case 4:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),w.key=c(b,x.value||"");break;case 5:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),w.key=a(b,x.value||"");break;case 6:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),w.key=d(b,x.value||"");break;default:{r(b,ie.UNEXPECTED_EMPTY_LINKED_KEY,k.lastStartLoc,0);const E=b.context(),M=o(7,E.offset,E.startLoc);return M.value="",s(M,E.offset,E.startLoc),w.key=M,s(w,E.offset,E.startLoc),{nextConsumeToken:x,node:w}}}return s(w,b.currentOffset(),b.currentPosition()),{node:w}}function h(b){const k=b.context(),w=k.currentType===1?b.currentOffset():k.offset,x=k.currentType===1?k.endLoc:k.startLoc,E=o(2,w,x);E.items=[];let M=null;do{const z=M||b.nextToken();switch(M=null,z.type){case 0:z.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(z)),E.items.push(l(b,z.value||""));break;case 5:z.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(z)),E.items.push(a(b,z.value||""));break;case 4:z.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(z)),E.items.push(c(b,z.value||""));break;case 6:z.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(z)),E.items.push(d(b,z.value||""));break;case 7:{const G=p(b);E.items.push(G.node),M=G.nextConsumeToken||null;break}}}while(k.currentType!==13&&k.currentType!==1);const C=k.currentType===1?k.lastOffset:b.currentOffset(),A=k.currentType===1?k.lastEndLoc:b.currentPosition();return s(E,C,A),E}function m(b,k,w,x){const E=b.context();let M=x.items.length===0;const C=o(1,k,w);C.cases=[],C.cases.push(x);do{const A=h(b);M||(M=A.items.length===0),C.cases.push(A)}while(E.currentType!==13);return M&&r(b,ie.MUST_HAVE_MESSAGES_IN_PLURAL,w,0),s(C,b.currentOffset(),b.currentPosition()),C}function g(b){const k=b.context(),{offset:w,startLoc:x}=k,E=h(b);return k.currentType===13?E:m(b,w,x,E)}function y(b){const k=KB(b,We({},n)),w=k.context(),x=o(0,w.offset,w.startLoc);return e&&x.loc&&(x.loc.source=b),x.body=g(k),n.onCacheKey&&(x.cacheKey=n.onCacheKey(b)),w.currentType!==13&&r(k,ie.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,b[w.offset]||""),s(x,k.currentOffset(),k.currentPosition()),x}return{parse:y}}function on(n){if(n.type===13)return"EOF";const e=(n.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function XB(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:s=>(t.helpers.add(s),s)}}function gh(n,e){for(let t=0;t<n.length;t++)ja(n[t],e)}function ja(n,e){switch(n.type){case 1:gh(n.cases,e),e.helper("plural");break;case 2:gh(n.items,e);break;case 6:{ja(n.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function ZB(n,e={}){const t=XB(n);t.helper("normalize"),n.body&&ja(n.body,t);const r=t.context();n.helpers=Array.from(r.helpers)}function QB(n){const e=n.body;return e.type===2?yh(e):e.cases.forEach(t=>yh(t)),n}function yh(n){if(n.items.length===1){const e=n.items[0];(e.type===3||e.type===9)&&(n.static=e.value,delete e.value)}else{const e=[];for(let t=0;t<n.items.length;t++){const r=n.items[t];if(!(r.type===3||r.type===9)||r.value==null)break;e.push(r.value)}if(e.length===n.items.length){n.static=$a(e);for(let t=0;t<n.items.length;t++){const r=n.items[t];(r.type===3||r.type===9)&&delete r.value}}}}const eV="minifier";function $r(n){switch(n.t=n.type,n.type){case 0:{const e=n;$r(e.body),e.b=e.body,delete e.body;break}case 1:{const e=n,t=e.cases;for(let r=0;r<t.length;r++)$r(t[r]);e.c=t,delete e.cases;break}case 2:{const e=n,t=e.items;for(let r=0;r<t.length;r++)$r(t[r]);e.i=t,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=n;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=n;$r(e.key),e.k=e.key,delete e.key,e.modifier&&($r(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=n;e.i=e.index,delete e.index;break}case 4:{const e=n;e.k=e.key,delete e.key;break}default:if(process.env.NODE_ENV!=="production")throw Pr(ie.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:eV,args:[n.type]})}delete n.type}const tV="parser";function nV(n,e){const{filename:t,breakLineCode:r,needIndent:o}=e,s=e.location!==!1,l={filename:t,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:o,indentLevel:0};s&&n.loc&&(l.source=n.loc.source);const a=()=>l;function c(g,y){l.code+=g}function d(g,y=!0){const b=y?r:"";c(o?b+" ".repeat(g):b)}function u(g=!0){const y=++l.indentLevel;g&&d(y)}function f(g=!0){const y=--l.indentLevel;g&&d(y)}function p(){d(l.indentLevel)}return{context:a,push:c,indent:u,deindent:f,newline:p,helper:g=>`_${g}`,needIndent:()=>l.needIndent}}function rV(n,e){const{helper:t}=n;n.push(`${t("linked")}(`),zr(n,e.key),e.modifier?(n.push(", "),zr(n,e.modifier),n.push(", _type")):n.push(", undefined, _type"),n.push(")")}function oV(n,e){const{helper:t,needIndent:r}=n;n.push(`${t("normalize")}([`),n.indent(r());const o=e.items.length;for(let s=0;s<o&&(zr(n,e.items[s]),s!==o-1);s++)n.push(", ");n.deindent(r()),n.push("])")}function sV(n,e){const{helper:t,needIndent:r}=n;if(e.cases.length>1){n.push(`${t("plural")}([`),n.indent(r());const o=e.cases.length;for(let s=0;s<o&&(zr(n,e.cases[s]),s!==o-1);s++)n.push(", ");n.deindent(r()),n.push("])")}}function lV(n,e){e.body?zr(n,e.body):n.push("null")}function zr(n,e){const{helper:t}=n;switch(e.type){case 0:lV(n,e);break;case 1:sV(n,e);break;case 2:oV(n,e);break;case 6:rV(n,e);break;case 8:n.push(JSON.stringify(e.value),e);break;case 7:n.push(JSON.stringify(e.value),e);break;case 5:n.push(`${t("interpolate")}(${t("list")}(${e.index}))`,e);break;case 4:n.push(`${t("interpolate")}(${t("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:n.push(JSON.stringify(e.value),e);break;case 3:n.push(JSON.stringify(e.value),e);break;default:if(process.env.NODE_ENV!=="production")throw Pr(ie.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:tV,args:[e.type]})}}const iV=(n,e={})=>{const t=J(e.mode)?e.mode:"normal",r=J(e.filename)?e.filename:"message.intl";e.sourceMap;const o=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":`
|
|
136
|
+
`,s=e.needIndent?e.needIndent:t!=="arrow",l=n.helpers||[],a=nV(n,{filename:r,breakLineCode:o,needIndent:s});a.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),a.indent(s),l.length>0&&(a.push(`const { ${$a(l.map(u=>`${u}: _${u}`),", ")} } = ctx`),a.newline()),a.push("return "),zr(a,n),a.deindent(s),a.push("}"),delete n.helpers;const{code:c,map:d}=a.context();return{ast:n,code:c,map:d?d.toJSON():void 0}};function aV(n,e={}){const t=We({},e),r=!!t.jit,o=!!t.minify,s=t.optimize==null?!0:t.optimize,a=YB(t).parse(n);return r?(s&&QB(a),o&&$r(a),{ast:a,code:""}):(ZB(a,t),iV(a,t))}/*!
|
|
121
137
|
* core-base v11.1.12
|
|
122
138
|
* (c) 2025 kazuya kawaguchi
|
|
123
139
|
* Released under the MIT License.
|
|
124
|
-
*/function _C(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(Mn().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(Mn().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function st(t){return q(t)&&Fl(t)===0&&(pt(t,"b")||pt(t,"body"))}const eh=["b","body"];function MC(t){return sn(t,eh)}const th=["c","cases"];function AC(t){return sn(t,th,[])}const nh=["s","static"];function OC(t){return sn(t,nh)}const rh=["i","items"];function LC(t){return sn(t,rh,[])}const oh=["t","type"];function Fl(t){return sn(t,oh)}const sh=["v","value"];function _s(t,e){const n=sn(t,sh);if(n!=null)return n;throw Vr(e)}const ih=["m","modifier"];function IC(t){return sn(t,ih)}const lh=["k","key"];function DC(t){const e=sn(t,lh);if(e)return e;throw Vr(6)}function sn(t,e,n){for(let r=0;r<e.length;r++){const o=e[r];if(pt(t,o)&&t[o]!=null)return t[o]}return n}const ah=[...eh,...th,...nh,...rh,...lh,...ih,...sh,...oh];function Vr(t){return new Error(`unhandled node type: ${t}`)}function Vl(t){return n=>RC(n,t)}function RC(t,e){const n=MC(e);if(n==null)throw Vr(0);if(Fl(n)===1){const s=AC(n);return t.plural(s.reduce((i,l)=>[...i,ch(t,l)],[]))}else return ch(t,n)}function ch(t,e){const n=OC(e);if(n!=null)return t.type==="text"?n:t.normalize([n]);{const r=LC(e).reduce((o,s)=>[...o,$l(t,s)],[]);return t.normalize(r)}}function $l(t,e){const n=Fl(e);switch(n){case 3:return _s(e,n);case 9:return _s(e,n);case 4:{const r=e;if(pt(r,"k")&&r.k)return t.interpolate(t.named(r.k));if(pt(r,"key")&&r.key)return t.interpolate(t.named(r.key));throw Vr(n)}case 5:{const r=e;if(pt(r,"i")&&we(r.i))return t.interpolate(t.list(r.i));if(pt(r,"index")&&we(r.index))return t.interpolate(t.list(r.index));throw Vr(n)}case 6:{const r=e,o=IC(r),s=DC(r);return t.linked($l(t,s),o?$l(t,o):void 0,t.type)}case 7:return _s(e,n);case 8:return _s(e,n);default:throw new Error(`unhandled node on format message part: ${n}`)}}const PC="Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.";function BC(t,e){e&&oC(t)&&wt(Ss(PC,{source:t}))}const FC=t=>t;let Ms=ne();function VC(t,e={}){let n=!1;const r=e.onError||nC;return e.onError=o=>{n=!0,r(o)},{...vC(t,e),detectError:n}}function $C(t,e){if(!__INTLIFY_DROP_MESSAGE_COMPILER__&&R(t)){const n=G(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&BC(t,n);const o=(e.onCacheKey||FC)(t),s=Ms[o];if(s)return s;const{ast:i,detectError:l}=VC(t,{...e,location:process.env.NODE_ENV!=="production",jit:!0}),a=Vl(i);return l?a:Ms[o]=a}else{if(process.env.NODE_ENV!=="production"&&!st(t))return wt(`the message that is resolve with key '${e.key}' is not supported for jit compilation`),(()=>t);const n=t.cacheKey;if(n){const r=Ms[n];return r||(Ms[n]=Vl(t))}else return Vl(t)}}let $r=null;function HC(t){$r=t}function zC(t,e,n){$r&&$r.emit("i18n:init",{timestamp:Date.now(),i18n:t,version:e,meta:n})}const UC=jC("function:translate");function jC(t){return e=>$r&&$r.emit(t,e)}const Fe={INVALID_ARGUMENT:eC,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},WC=24;function Pt(t){return Qn(t,null,process.env.NODE_ENV!=="production"?{messages:KC}:void 0)}const KC={[Fe.INVALID_ARGUMENT]:"Invalid arguments",[Fe.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[Fe.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[Fe.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[Fe.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[Fe.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[Fe.NOT_SUPPORT_LOCALE_TYPE]:"cannot support locale type"};function Hl(t,e){return e.locale!=null?dh(e.locale):dh(t.locale)}let zl;function dh(t){if(R(t))return t;if(se(t)){if(t.resolvedOnce&&zl!=null)return zl;if(t.constructor.name==="Function"){const e=t();if(Yw(e))throw Pt(Fe.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return zl=e}else throw Pt(Fe.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw Pt(Fe.NOT_SUPPORT_LOCALE_TYPE)}function qC(t,e,n){return[...new Set([n,...he(e)?e:q(e)?Object.keys(e):R(e)?[e]:[n]])]}function uh(t,e,n){const r=R(n)?n:Hr,o=t;o.__localeChainCache||(o.__localeChainCache=new Map);let s=o.__localeChainCache.get(r);if(!s){s=[];let i=[n];for(;he(i);)i=fh(s,i,e);const l=he(e)||!W(e)?e:e.default?e.default:null;i=R(l)?[l]:l,he(i)&&fh(s,i,!1),o.__localeChainCache.set(r,s)}return s}function fh(t,e,n){let r=!0;for(let o=0;o<e.length&&G(r);o++){const s=e[o];R(s)&&(r=GC(t,e[o],n))}return r}function GC(t,e,n){let r;const o=e.split("-");do{const s=o.join("-");r=JC(t,s,n),o.splice(-1,1)}while(o.length&&r===!0);return r}function JC(t,e,n){let r=!1;if(!t.includes(e)&&(r=!0,e)){r=e[e.length-1]!=="!";const o=e.replace(/!/g,"");t.push(o),(he(n)||W(n))&&n[o]&&(r=n[o])}return r}const ln=[];ln[0]={w:[0],i:[3,0],"[":[4],o:[7]},ln[1]={w:[1],".":[2],"[":[4],o:[7]},ln[2]={w:[2],i:[3,0],0:[3,0]},ln[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},ln[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},ln[5]={"'":[4,0],o:8,l:[5,0]},ln[6]={'"':[4,0],o:8,l:[6,0]};const YC=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function XC(t){return YC.test(t)}function QC(t){const e=t.charCodeAt(0),n=t.charCodeAt(t.length-1);return e===n&&(e===34||e===39)?t.slice(1,-1):t}function ZC(t){if(t==null)return"o";switch(t.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return t;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function eS(t){const e=t.trim();return t.charAt(0)==="0"&&isNaN(parseInt(t))?!1:XC(e)?QC(e):"*"+e}function tS(t){const e=[];let n=-1,r=0,o=0,s,i,l,a,c,d,u;const h=[];h[0]=()=>{i===void 0?i=l:i+=l},h[1]=()=>{i!==void 0&&(e.push(i),i=void 0)},h[2]=()=>{h[0](),o++},h[3]=()=>{if(o>0)o--,r=4,h[0]();else{if(o=0,i===void 0||(i=eS(i),i===!1))return!1;h[1]()}};function p(){const m=t[n+1];if(r===5&&m==="'"||r===6&&m==='"')return n++,l="\\"+m,h[0](),!0}for(;r!==null;)if(n++,s=t[n],!(s==="\\"&&p())){if(a=ZC(s),u=ln[r],c=u[a]||u.l||8,c===8||(r=c[0],c[1]!==void 0&&(d=h[c[1]],d&&(l=s,d()===!1))))return;if(r===7)return e}}const hh=new Map;function nS(t,e){return q(t)?t[e]:null}function rS(t,e){if(!q(t))return null;let n=hh.get(e);if(n||(n=tS(e),n&&hh.set(e,n)),!n)return null;const r=n.length;let o=t,s=0;for(;s<r;){const i=n[s];if(ah.includes(i)&&st(o))return null;const l=o[i];if(l===void 0||se(o))return null;o=l,s++}return o}const qe={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},oS=8,sS={[qe.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[qe.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[qe.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[qe.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[qe.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[qe.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[qe.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]:"This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future."};function An(t,...e){return Ss(sS[t],...e)}const iS="11.1.12",As=-1,Hr="en-US",Os="",ph=t=>`${t.charAt(0).toLocaleUpperCase()}${t.substr(1)}`;function lS(){return{upper:(t,e)=>e==="text"&&R(t)?t.toUpperCase():e==="vnode"&&q(t)&&"__v_isVNode"in t?t.children.toUpperCase():t,lower:(t,e)=>e==="text"&&R(t)?t.toLowerCase():e==="vnode"&&q(t)&&"__v_isVNode"in t?t.children.toLowerCase():t,capitalize:(t,e)=>e==="text"&&R(t)?ph(t):e==="vnode"&&q(t)&&"__v_isVNode"in t?ph(t.children):t}}let mh;function aS(t){mh=t}let gh;function cS(t){gh=t}let yh;function dS(t){yh=t}let bh=null;const uS=t=>{bh=t},fS=()=>bh;let kh=null;const xh=t=>{kh=t},hS=()=>kh;let Eh=0;function pS(t={}){const e=se(t.onWarn)?t.onWarn:wt,n=R(t.version)?t.version:iS,r=R(t.locale)||se(t.locale)?t.locale:Hr,o=se(r)?Hr:r,s=he(t.fallbackLocale)||W(t.fallbackLocale)||R(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:o,i=W(t.messages)?t.messages:Ul(o),l=W(t.datetimeFormats)?t.datetimeFormats:Ul(o),a=W(t.numberFormats)?t.numberFormats:Ul(o),c=Se(ne(),t.modifiers,lS()),d=t.pluralRules||ne(),u=se(t.missing)?t.missing:null,h=G(t.missingWarn)||Xn(t.missingWarn)?t.missingWarn:!0,p=G(t.fallbackWarn)||Xn(t.fallbackWarn)?t.fallbackWarn:!0,m=!!t.fallbackFormat,g=!!t.unresolving,y=se(t.postTranslation)?t.postTranslation:null,b=W(t.processor)?t.processor:null,k=G(t.warnHtmlMessage)?t.warnHtmlMessage:!0,w=!!t.escapeParameter,C=se(t.messageCompiler)?t.messageCompiler:mh;process.env.NODE_ENV!=="production"&&se(t.messageCompiler)&&Ll(An(qe.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const T=se(t.messageResolver)?t.messageResolver:gh||nS,_=se(t.localeFallbacker)?t.localeFallbacker:yh||qC,S=q(t.fallbackContext)?t.fallbackContext:void 0,I=t,F=q(I.__datetimeFormatters)?I.__datetimeFormatters:new Map,J=q(I.__numberFormatters)?I.__numberFormatters:new Map,P=q(I.__meta)?I.__meta:{};Eh++;const D={version:n,cid:Eh,locale:r,fallbackLocale:s,messages:i,modifiers:c,pluralRules:d,missing:u,missingWarn:h,fallbackWarn:p,fallbackFormat:m,unresolving:g,postTranslation:y,processor:b,warnHtmlMessage:k,escapeParameter:w,messageCompiler:C,messageResolver:T,localeFallbacker:_,fallbackContext:S,onWarn:e,__meta:P};return D.datetimeFormats=l,D.numberFormats=a,D.__datetimeFormatters=F,D.__numberFormatters=J,process.env.NODE_ENV!=="production"&&(D.__v_emitter=I.__v_emitter!=null?I.__v_emitter:void 0),(process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__)&&zC(D,n,P),D}const Ul=t=>({[t]:ne()});function Ls(t,e){return t instanceof RegExp?t.test(e):t}function wh(t,e){return t instanceof RegExp?t.test(e):t}function jl(t,e,n,r,o){const{missing:s,onWarn:i}=t;if(process.env.NODE_ENV!=="production"){const l=t.__v_emitter;l&&l.emit("missing",{locale:n,key:e,type:o,groupId:`${o}:${e}`})}if(s!==null){const l=s(t,n,e,o);return R(l)?l:e}else return process.env.NODE_ENV!=="production"&&wh(r,e)&&i(An(qe.NOT_FOUND_KEY,{key:e,locale:n})),e}function zr(t,e,n){const r=t;r.__localeChainCache=new Map,t.localeFallbacker(t,n,e)}function Ch(t,e){return t===e?!1:t.split("-")[0]===e.split("-")[0]}function mS(t,e){const n=e.indexOf(t);if(n===-1)return!1;for(let r=n+1;r<e.length;r++)if(Ch(t,e[r]))return!0;return!1}const Sh=typeof Intl<"u",Th={dateTimeFormat:Sh&&typeof Intl.DateTimeFormat<"u",numberFormat:Sh&&typeof Intl.NumberFormat<"u"};function Nh(t,...e){const{datetimeFormats:n,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:i}=t,{__datetimeFormatters:l}=t;if(process.env.NODE_ENV!=="production"&&!Th.dateTimeFormat)return s(An(qe.CANNOT_FORMAT_DATE)),Os;const[a,c,d,u]=Wl(...e),h=G(d.missingWarn)?d.missingWarn:t.missingWarn,p=G(d.fallbackWarn)?d.fallbackWarn:t.fallbackWarn,m=!!d.part,g=Hl(t,d),y=i(t,o,g);if(!R(a)||a==="")return new Intl.DateTimeFormat(g,u).format(c);let b={},k,w=null,C=g,T=null;const _="datetime format";for(let F=0;F<y.length;F++){if(k=T=y[F],process.env.NODE_ENV!=="production"&&g!==k&&Ls(p,a)&&s(An(qe.FALLBACK_TO_DATE_FORMAT,{key:a,target:k})),process.env.NODE_ENV!=="production"&&g!==k){const J=t.__v_emitter;J&&J.emit("fallback",{type:_,key:a,from:C,to:T,groupId:`${_}:${a}`})}if(b=n[k]||{},w=b[a],W(w))break;jl(t,a,k,h,_),C=T}if(!W(w)||!R(k))return r?As:a;let S=`${k}__${a}`;Ts(u)||(S=`${S}__${JSON.stringify(u)}`);let I=l.get(S);return I||(I=new Intl.DateTimeFormat(k,Se({},w,u)),l.set(S,I)),m?I.formatToParts(c):I.format(c)}const vh=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function Wl(...t){const[e,n,r,o]=t,s=ne();let i=ne(),l;if(R(e)){const a=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!a)throw Pt(Fe.INVALID_ISO_DATE_ARGUMENT);const c=a[3]?a[3].trim().startsWith("T")?`${a[1].trim()}${a[3].trim()}`:`${a[1].trim()}T${a[3].trim()}`:a[1].trim();l=new Date(c);try{l.toISOString()}catch{throw Pt(Fe.INVALID_ISO_DATE_ARGUMENT)}}else if(Kw(e)){if(isNaN(e.getTime()))throw Pt(Fe.INVALID_DATE_ARGUMENT);l=e}else if(we(e))l=e;else throw Pt(Fe.INVALID_ARGUMENT);return R(n)?s.key=n:W(n)&&Object.keys(n).forEach(a=>{vh.includes(a)?i[a]=n[a]:s[a]=n[a]}),R(r)?s.locale=r:W(r)&&(i=r),W(o)&&(i=o),[s.key||"",l,s,i]}function _h(t,e,n){const r=t;for(const o in n){const s=`${e}__${o}`;r.__datetimeFormatters.has(s)&&r.__datetimeFormatters.delete(s)}}function Mh(t,...e){const{numberFormats:n,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:i}=t,{__numberFormatters:l}=t;if(process.env.NODE_ENV!=="production"&&!Th.numberFormat)return s(An(qe.CANNOT_FORMAT_NUMBER)),Os;const[a,c,d,u]=Kl(...e),h=G(d.missingWarn)?d.missingWarn:t.missingWarn,p=G(d.fallbackWarn)?d.fallbackWarn:t.fallbackWarn,m=!!d.part,g=Hl(t,d),y=i(t,o,g);if(!R(a)||a==="")return new Intl.NumberFormat(g,u).format(c);let b={},k,w=null,C=g,T=null;const _="number format";for(let F=0;F<y.length;F++){if(k=T=y[F],process.env.NODE_ENV!=="production"&&g!==k&&Ls(p,a)&&s(An(qe.FALLBACK_TO_NUMBER_FORMAT,{key:a,target:k})),process.env.NODE_ENV!=="production"&&g!==k){const J=t.__v_emitter;J&&J.emit("fallback",{type:_,key:a,from:C,to:T,groupId:`${_}:${a}`})}if(b=n[k]||{},w=b[a],W(w))break;jl(t,a,k,h,_),C=T}if(!W(w)||!R(k))return r?As:a;let S=`${k}__${a}`;Ts(u)||(S=`${S}__${JSON.stringify(u)}`);let I=l.get(S);return I||(I=new Intl.NumberFormat(k,Se({},w,u)),l.set(S,I)),m?I.formatToParts(c):I.format(c)}const Ah=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Kl(...t){const[e,n,r,o]=t,s=ne();let i=ne();if(!we(e))throw Pt(Fe.INVALID_ARGUMENT);const l=e;return R(n)?s.key=n:W(n)&&Object.keys(n).forEach(a=>{Ah.includes(a)?i[a]=n[a]:s[a]=n[a]}),R(r)?s.locale=r:W(r)&&(i=r),W(o)&&(i=o),[s.key||"",l,s,i]}function Oh(t,e,n){const r=t;for(const o in n){const s=`${e}__${o}`;r.__numberFormatters.has(s)&&r.__numberFormatters.delete(s)}}const gS=t=>t,yS=t=>"",bS="text",kS=t=>t.length===0?"":Dl(t),xS=Xw;function Lh(t,e){return t=Math.abs(t),e===2?t?t>1?1:0:1:t?Math.min(t,2):0}function ES(t){const e=we(t.pluralIndex)?t.pluralIndex:-1;return t.named&&(we(t.named.count)||we(t.named.n))?we(t.named.count)?t.named.count:we(t.named.n)?t.named.n:e:e}function wS(t,e){e.count||(e.count=t),e.n||(e.n=t)}function CS(t={}){const e=t.locale,n=ES(t),r=q(t.pluralRules)&&R(e)&&se(t.pluralRules[e])?t.pluralRules[e]:Lh,o=q(t.pluralRules)&&R(e)&&se(t.pluralRules[e])?Lh:void 0,s=b=>b[r(n,b.length,o)],i=t.list||[],l=b=>i[b],a=t.named||ne();we(t.pluralIndex)&&wS(n,a);const c=b=>a[b];function d(b,k){const w=se(t.messages)?t.messages(b,!!k):q(t.messages)?t.messages[b]:!1;return w||(t.parent?t.parent.message(b):yS)}const u=b=>t.modifiers?t.modifiers[b]:gS,h=W(t.processor)&&se(t.processor.normalize)?t.processor.normalize:kS,p=W(t.processor)&&se(t.processor.interpolate)?t.processor.interpolate:xS,m=W(t.processor)&&R(t.processor.type)?t.processor.type:bS,y={list:l,named:c,plural:s,linked:(b,...k)=>{const[w,C]=k;let T="text",_="";k.length===1?q(w)?(_=w.modifier||_,T=w.type||T):R(w)&&(_=w||_):k.length===2&&(R(w)&&(_=w||_),R(C)&&(T=C||T));const S=d(b,!0)(y),I=T==="vnode"&&he(S)&&_?S[0]:S;return _?u(_)(I,T):I},message:d,type:m,interpolate:p,normalize:h,values:Se(ne(),i,a)};return y}const Ih=()=>"",it=t=>se(t);function Dh(t,...e){const{fallbackFormat:n,postTranslation:r,unresolving:o,messageCompiler:s,fallbackLocale:i,messages:l}=t,[a,c]=ql(...e),d=G(c.missingWarn)?c.missingWarn:t.missingWarn,u=G(c.fallbackWarn)?c.fallbackWarn:t.fallbackWarn,h=G(c.escapeParameter)?c.escapeParameter:t.escapeParameter,p=!!c.resolvedMessage,m=R(c.default)||G(c.default)?G(c.default)?s?a:()=>a:c.default:n?s?a:()=>a:null,g=n||m!=null&&(R(m)||se(m)),y=Hl(t,c);h&&SS(c);let[b,k,w]=p?[a,y,l[y]||ne()]:Rh(t,a,y,i,u,d),C=b,T=a;if(!p&&!(R(C)||st(C)||it(C))&&g&&(C=m,T=C),!p&&(!(R(C)||st(C)||it(C))||!R(k)))return o?As:a;if(process.env.NODE_ENV!=="production"&&R(C)&&t.messageCompiler==null)return wt(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${a}'.`),a;let _=!1;const S=()=>{_=!0},I=it(C)?C:Ph(t,a,k,C,T,S);if(_)return C;const F=_S(t,k,w,c),J=CS(F),P=TS(t,I,J);let D=r?r(P,a):P;if(h&&R(D)&&(D=Gw(D)),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const K={timestamp:Date.now(),key:R(a)?a:it(C)?C.key:"",locale:k||(it(C)?C.locale:""),format:R(C)?C:it(C)?C.source:"",message:D};K.meta=Se({},t.__meta,fS()||{}),UC(K)}return D}function SS(t){he(t.list)?t.list=t.list.map(e=>R(e)?qf(e):e):q(t.named)&&Object.keys(t.named).forEach(e=>{R(t.named[e])&&(t.named[e]=qf(t.named[e]))})}function Rh(t,e,n,r,o,s){const{messages:i,onWarn:l,messageResolver:a,localeFallbacker:c}=t,d=c(t,r,n);let u=ne(),h,p=null,m=n,g=null;const y="translate";for(let b=0;b<d.length;b++){if(h=g=d[b],process.env.NODE_ENV!=="production"&&n!==h&&!Ch(n,h)&&Ls(o,e)&&l(An(qe.FALLBACK_TO_TRANSLATE,{key:e,target:h})),process.env.NODE_ENV!=="production"&&n!==h){const T=t.__v_emitter;T&&T.emit("fallback",{type:y,key:e,from:m,to:g,groupId:`${y}:${e}`})}u=i[h]||ne();let k=null,w,C;if(process.env.NODE_ENV!=="production"&&ht&&(k=window.performance.now(),w="intlify-message-resolve-start",C="intlify-message-resolve-end",Qe&&Qe(w)),(p=a(u,e))===null&&(p=u[e]),process.env.NODE_ENV!=="production"&&ht){const T=window.performance.now(),_=t.__v_emitter;_&&k&&p&&_.emit("message-resolve",{type:"message-resolve",key:e,message:p,time:T-k,groupId:`${y}:${e}`}),w&&C&&Qe&&_n&&(Qe(C),_n("intlify message resolve",w,C))}if(R(p)||st(p)||it(p))break;if(!mS(h,d)){const T=jl(t,e,h,s,y);T!==e&&(p=T)}m=g}return[p,h,u]}function Ph(t,e,n,r,o,s){const{messageCompiler:i,warnHtmlMessage:l}=t;if(it(r)){const h=r;return h.locale=h.locale||n,h.key=h.key||e,h}if(i==null){const h=(()=>r);return h.locale=n,h.key=e,h}let a=null,c,d;process.env.NODE_ENV!=="production"&&ht&&(a=window.performance.now(),c="intlify-message-compilation-start",d="intlify-message-compilation-end",Qe&&Qe(c));const u=i(r,NS(t,n,o,r,l,s));if(process.env.NODE_ENV!=="production"&&ht){const h=window.performance.now(),p=t.__v_emitter;p&&a&&p.emit("message-compilation",{type:"message-compilation",message:r,time:h-a,groupId:`translate:${e}`}),c&&d&&Qe&&_n&&(Qe(d),_n("intlify message compilation",c,d))}return u.locale=n,u.key=e,u.source=r,u}function TS(t,e,n){let r=null,o,s;process.env.NODE_ENV!=="production"&&ht&&(r=window.performance.now(),o="intlify-message-evaluation-start",s="intlify-message-evaluation-end",Qe&&Qe(o));const i=e(n);if(process.env.NODE_ENV!=="production"&&ht){const l=window.performance.now(),a=t.__v_emitter;a&&r&&a.emit("message-evaluation",{type:"message-evaluation",value:i,time:l-r,groupId:`translate:${e.key}`}),o&&s&&Qe&&_n&&(Qe(s),_n("intlify message evaluation",o,s))}return i}function ql(...t){const[e,n,r]=t,o=ne();if(!R(e)&&!we(e)&&!it(e)&&!st(e))throw Pt(Fe.INVALID_ARGUMENT);const s=we(e)?String(e):(it(e),e);return we(n)?o.plural=n:R(n)?o.default=n:W(n)&&!Ts(n)?o.named=n:he(n)&&(o.list=n),we(r)?o.plural=r:R(r)?o.default=r:W(r)&&Se(o,r),[s,o]}function NS(t,e,n,r,o,s){return{locale:e,key:n,warnHtmlMessage:o,onError:i=>{if(s&&s(i),process.env.NODE_ENV!=="production"){const l=vS(r),a=`Message compilation error: ${i.message}`,c=i.location&&l&&Qw(l,i.location.start.offset,i.location.end.offset),d=t.__v_emitter;d&&l&&d.emit("compile-error",{message:l,error:i.message,start:i.location&&i.location.start.offset,end:i.location&&i.location.end.offset,groupId:`translate:${n}`}),console.error(c?`${a}
|
|
125
|
-
${
|
|
140
|
+
*/function cV(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(yr().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(yr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function It(n){return ye(n)&&Ua(n)===0&&(Kt(n,"b")||Kt(n,"body"))}const bh=["b","body"];function dV(n){return qn(n,bh)}const kh=["c","cases"];function uV(n){return qn(n,kh,[])}const xh=["s","static"];function fV(n){return qn(n,xh)}const wh=["i","items"];function pV(n){return qn(n,wh,[])}const Eh=["t","type"];function Ua(n){return qn(n,Eh)}const Ch=["v","value"];function Nl(n,e){const t=qn(n,Ch);if(t!=null)return t;throw Bo(e)}const vh=["m","modifier"];function hV(n){return qn(n,vh)}const _h=["k","key"];function mV(n){const e=qn(n,_h);if(e)return e;throw Bo(6)}function qn(n,e,t){for(let r=0;r<e.length;r++){const o=e[r];if(Kt(n,o)&&n[o]!=null)return n[o]}return t}const Sh=[...bh,...kh,...xh,...wh,..._h,...vh,...Ch,...Eh];function Bo(n){return new Error(`unhandled node type: ${n}`)}function Wa(n){return t=>gV(t,n)}function gV(n,e){const t=dV(e);if(t==null)throw Bo(0);if(Ua(t)===1){const s=uV(t);return n.plural(s.reduce((l,a)=>[...l,Nh(n,a)],[]))}else return Nh(n,t)}function Nh(n,e){const t=fV(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const r=pV(e).reduce((o,s)=>[...o,Ka(n,s)],[]);return n.normalize(r)}}function Ka(n,e){const t=Ua(e);switch(t){case 3:return Nl(e,t);case 9:return Nl(e,t);case 4:{const r=e;if(Kt(r,"k")&&r.k)return n.interpolate(n.named(r.k));if(Kt(r,"key")&&r.key)return n.interpolate(n.named(r.key));throw Bo(t)}case 5:{const r=e;if(Kt(r,"i")&&je(r.i))return n.interpolate(n.list(r.i));if(Kt(r,"index")&&je(r.index))return n.interpolate(n.list(r.index));throw Bo(t)}case 6:{const r=e,o=hV(r),s=mV(r);return n.linked(Ka(n,s),o?Ka(n,o):void 0,n.type)}case 7:return Nl(e,t);case 8:return Nl(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const yV="Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.";function bV(n,e){e&&PB(n)&&tn(Cl(yV,{source:n}))}const kV=n=>n;let Ml=Ce();function xV(n,e={}){let t=!1;const r=e.onError||RB;return e.onError=o=>{t=!0,r(o)},{...aV(n,e),detectError:t}}function wV(n,e){if(!__INTLIFY_DROP_MESSAGE_COMPILER__&&J(n)){const t=be(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&bV(n,t);const o=(e.onCacheKey||kV)(n),s=Ml[o];if(s)return s;const{ast:l,detectError:a}=xV(n,{...e,location:process.env.NODE_ENV!=="production",jit:!0}),c=Wa(l);return a?c:Ml[o]=c}else{if(process.env.NODE_ENV!=="production"&&!It(n))return tn(`the message that is resolve with key '${e.key}' is not supported for jit compilation`),(()=>n);const t=n.cacheKey;if(t){const r=Ml[t];return r||(Ml[t]=Wa(n))}else return Wa(n)}}let Vo=null;function EV(n){Vo=n}function CV(n,e,t){Vo&&Vo.emit("i18n:init",{timestamp:Date.now(),i18n:n,version:e,meta:t})}const vV=_V("function:translate");function _V(n){return e=>Vo&&Vo.emit(n,e)}const ct={INVALID_ARGUMENT:IB,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},SV=24;function wn(n){return Pr(n,null,process.env.NODE_ENV!=="production"?{messages:NV}:void 0)}const NV={[ct.INVALID_ARGUMENT]:"Invalid arguments",[ct.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[ct.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[ct.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[ct.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[ct.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[ct.NOT_SUPPORT_LOCALE_TYPE]:"cannot support locale type"};function qa(n,e){return e.locale!=null?Mh(e.locale):Mh(n.locale)}let Ga;function Mh(n){if(J(n))return n;if(Ne(n)){if(n.resolvedOnce&&Ga!=null)return Ga;if(n.constructor.name==="Function"){const e=n();if(BB(e))throw wn(ct.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Ga=e}else throw wn(ct.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw wn(ct.NOT_SUPPORT_LOCALE_TYPE)}function MV(n,e,t){return[...new Set([t,...Ie(e)?e:ye(e)?Object.keys(e):J(e)?[e]:[t]])]}function Th(n,e,t){const r=J(t)?t:Lo,o=n;o.__localeChainCache||(o.__localeChainCache=new Map);let s=o.__localeChainCache.get(r);if(!s){s=[];let l=[t];for(;Ie(l);)l=Ah(s,l,e);const a=Ie(e)||!me(e)?e:e.default?e.default:null;l=J(a)?[a]:a,Ie(l)&&Ah(s,l,!1),o.__localeChainCache.set(r,s)}return s}function Ah(n,e,t){let r=!0;for(let o=0;o<e.length&&be(r);o++){const s=e[o];J(s)&&(r=TV(n,e[o],t))}return r}function TV(n,e,t){let r;const o=e.split("-");do{const s=o.join("-");r=AV(n,s,t),o.splice(-1,1)}while(o.length&&r===!0);return r}function AV(n,e,t){let r=!1;if(!n.includes(e)&&(r=!0,e)){r=e[e.length-1]!=="!";const o=e.replace(/!/g,"");n.push(o),(Ie(t)||me(t))&&t[o]&&(r=t[o])}return r}const Gn=[];Gn[0]={w:[0],i:[3,0],"[":[4],o:[7]},Gn[1]={w:[1],".":[2],"[":[4],o:[7]},Gn[2]={w:[2],i:[3,0],0:[3,0]},Gn[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Gn[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Gn[5]={"'":[4,0],o:8,l:[5,0]},Gn[6]={'"':[4,0],o:8,l:[6,0]};const BV=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function VV(n){return BV.test(n)}function LV(n){const e=n.charCodeAt(0),t=n.charCodeAt(n.length-1);return e===t&&(e===34||e===39)?n.slice(1,-1):n}function OV(n){if(n==null)return"o";switch(n.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return n;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function IV(n){const e=n.trim();return n.charAt(0)==="0"&&isNaN(parseInt(n))?!1:VV(e)?LV(e):"*"+e}function DV(n){const e=[];let t=-1,r=0,o=0,s,l,a,c,d,u,f;const p=[];p[0]=()=>{l===void 0?l=a:l+=a},p[1]=()=>{l!==void 0&&(e.push(l),l=void 0)},p[2]=()=>{p[0](),o++},p[3]=()=>{if(o>0)o--,r=4,p[0]();else{if(o=0,l===void 0||(l=IV(l),l===!1))return!1;p[1]()}};function h(){const m=n[t+1];if(r===5&&m==="'"||r===6&&m==='"')return t++,a="\\"+m,p[0](),!0}for(;r!==null;)if(t++,s=n[t],!(s==="\\"&&h())){if(c=OV(s),f=Gn[r],d=f[c]||f.l||8,d===8||(r=d[0],d[1]!==void 0&&(u=p[d[1]],u&&(a=s,u()===!1))))return;if(r===7)return e}}const Bh=new Map;function RV(n,e){return ye(n)?n[e]:null}function FV(n,e){if(!ye(n))return null;let t=Bh.get(e);if(t||(t=DV(e),t&&Bh.set(e,t)),!t)return null;const r=t.length;let o=n,s=0;for(;s<r;){const l=t[s];if(Sh.includes(l)&&It(o))return null;const a=o[l];if(a===void 0||Ne(o))return null;o=a,s++}return o}const bt={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},PV=8,$V={[bt.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[bt.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[bt.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[bt.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[bt.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[bt.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[bt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]:"This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future."};function br(n,...e){return Cl($V[n],...e)}const zV="11.1.12",Tl=-1,Lo="en-US",Al="",Vh=n=>`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function HV(){return{upper:(n,e)=>e==="text"&&J(n)?n.toUpperCase():e==="vnode"&&ye(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&J(n)?n.toLowerCase():e==="vnode"&&ye(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&J(n)?Vh(n):e==="vnode"&&ye(n)&&"__v_isVNode"in n?Vh(n.children):n}}let Lh;function jV(n){Lh=n}let Oh;function UV(n){Oh=n}let Ih;function WV(n){Ih=n}let Dh=null;const KV=n=>{Dh=n},qV=()=>Dh;let Rh=null;const Fh=n=>{Rh=n},GV=()=>Rh;let Ph=0;function JV(n={}){const e=Ne(n.onWarn)?n.onWarn:tn,t=J(n.version)?n.version:zV,r=J(n.locale)||Ne(n.locale)?n.locale:Lo,o=Ne(r)?Lo:r,s=Ie(n.fallbackLocale)||me(n.fallbackLocale)||J(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:o,l=me(n.messages)?n.messages:Ja(o),a=me(n.datetimeFormats)?n.datetimeFormats:Ja(o),c=me(n.numberFormats)?n.numberFormats:Ja(o),d=We(Ce(),n.modifiers,HV()),u=n.pluralRules||Ce(),f=Ne(n.missing)?n.missing:null,p=be(n.missingWarn)||Fr(n.missingWarn)?n.missingWarn:!0,h=be(n.fallbackWarn)||Fr(n.fallbackWarn)?n.fallbackWarn:!0,m=!!n.fallbackFormat,g=!!n.unresolving,y=Ne(n.postTranslation)?n.postTranslation:null,b=me(n.processor)?n.processor:null,k=be(n.warnHtmlMessage)?n.warnHtmlMessage:!0,w=!!n.escapeParameter,x=Ne(n.messageCompiler)?n.messageCompiler:Lh;process.env.NODE_ENV!=="production"&&Ne(n.messageCompiler)&&Fa(br(bt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const E=Ne(n.messageResolver)?n.messageResolver:Oh||RV,M=Ne(n.localeFallbacker)?n.localeFallbacker:Ih||MV,C=ye(n.fallbackContext)?n.fallbackContext:void 0,A=n,z=ye(A.__datetimeFormatters)?A.__datetimeFormatters:new Map,G=ye(A.__numberFormatters)?A.__numberFormatters:new Map,V=ye(A.__meta)?A.__meta:{};Ph++;const O={version:t,cid:Ph,locale:r,fallbackLocale:s,messages:l,modifiers:d,pluralRules:u,missing:f,missingWarn:p,fallbackWarn:h,fallbackFormat:m,unresolving:g,postTranslation:y,processor:b,warnHtmlMessage:k,escapeParameter:w,messageCompiler:x,messageResolver:E,localeFallbacker:M,fallbackContext:C,onWarn:e,__meta:V};return O.datetimeFormats=a,O.numberFormats=c,O.__datetimeFormatters=z,O.__numberFormatters=G,process.env.NODE_ENV!=="production"&&(O.__v_emitter=A.__v_emitter!=null?A.__v_emitter:void 0),(process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__)&&CV(O,t,V),O}const Ja=n=>({[n]:Ce()});function Bl(n,e){return n instanceof RegExp?n.test(e):n}function $h(n,e){return n instanceof RegExp?n.test(e):n}function Ya(n,e,t,r,o){const{missing:s,onWarn:l}=n;if(process.env.NODE_ENV!=="production"){const a=n.__v_emitter;a&&a.emit("missing",{locale:t,key:e,type:o,groupId:`${o}:${e}`})}if(s!==null){const a=s(n,t,e,o);return J(a)?a:e}else return process.env.NODE_ENV!=="production"&&$h(r,e)&&l(br(bt.NOT_FOUND_KEY,{key:e,locale:t})),e}function Oo(n,e,t){const r=n;r.__localeChainCache=new Map,n.localeFallbacker(n,t,e)}function zh(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function YV(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let r=t+1;r<e.length;r++)if(zh(n,e[r]))return!0;return!1}const Hh=typeof Intl<"u",jh={dateTimeFormat:Hh&&typeof Intl.DateTimeFormat<"u",numberFormat:Hh&&typeof Intl.NumberFormat<"u"};function Uh(n,...e){const{datetimeFormats:t,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:l}=n,{__datetimeFormatters:a}=n;if(process.env.NODE_ENV!=="production"&&!jh.dateTimeFormat)return s(br(bt.CANNOT_FORMAT_DATE)),Al;const[c,d,u,f]=Xa(...e),p=be(u.missingWarn)?u.missingWarn:n.missingWarn,h=be(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn,m=!!u.part,g=qa(n,u),y=l(n,o,g);if(!J(c)||c==="")return new Intl.DateTimeFormat(g,f).format(d);let b={},k,w=null,x=g,E=null;const M="datetime format";for(let z=0;z<y.length;z++){if(k=E=y[z],process.env.NODE_ENV!=="production"&&g!==k&&Bl(h,c)&&s(br(bt.FALLBACK_TO_DATE_FORMAT,{key:c,target:k})),process.env.NODE_ENV!=="production"&&g!==k){const G=n.__v_emitter;G&&G.emit("fallback",{type:M,key:c,from:x,to:E,groupId:`${M}:${c}`})}if(b=t[k]||{},w=b[c],me(w))break;Ya(n,c,k,p,M),x=E}if(!me(w)||!J(k))return r?Tl:c;let C=`${k}__${c}`;vl(f)||(C=`${C}__${JSON.stringify(f)}`);let A=a.get(C);return A||(A=new Intl.DateTimeFormat(k,We({},w,f)),a.set(C,A)),m?A.formatToParts(d):A.format(d)}const Wh=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function Xa(...n){const[e,t,r,o]=n,s=Ce();let l=Ce(),a;if(J(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw wn(ct.INVALID_ISO_DATE_ARGUMENT);const d=c[3]?c[3].trim().startsWith("T")?`${c[1].trim()}${c[3].trim()}`:`${c[1].trim()}T${c[3].trim()}`:c[1].trim();a=new Date(d);try{a.toISOString()}catch{throw wn(ct.INVALID_ISO_DATE_ARGUMENT)}}else if(NB(e)){if(isNaN(e.getTime()))throw wn(ct.INVALID_DATE_ARGUMENT);a=e}else if(je(e))a=e;else throw wn(ct.INVALID_ARGUMENT);return J(t)?s.key=t:me(t)&&Object.keys(t).forEach(c=>{Wh.includes(c)?l[c]=t[c]:s[c]=t[c]}),J(r)?s.locale=r:me(r)&&(l=r),me(o)&&(l=o),[s.key||"",a,s,l]}function Kh(n,e,t){const r=n;for(const o in t){const s=`${e}__${o}`;r.__datetimeFormatters.has(s)&&r.__datetimeFormatters.delete(s)}}function qh(n,...e){const{numberFormats:t,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:l}=n,{__numberFormatters:a}=n;if(process.env.NODE_ENV!=="production"&&!jh.numberFormat)return s(br(bt.CANNOT_FORMAT_NUMBER)),Al;const[c,d,u,f]=Za(...e),p=be(u.missingWarn)?u.missingWarn:n.missingWarn,h=be(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn,m=!!u.part,g=qa(n,u),y=l(n,o,g);if(!J(c)||c==="")return new Intl.NumberFormat(g,f).format(d);let b={},k,w=null,x=g,E=null;const M="number format";for(let z=0;z<y.length;z++){if(k=E=y[z],process.env.NODE_ENV!=="production"&&g!==k&&Bl(h,c)&&s(br(bt.FALLBACK_TO_NUMBER_FORMAT,{key:c,target:k})),process.env.NODE_ENV!=="production"&&g!==k){const G=n.__v_emitter;G&&G.emit("fallback",{type:M,key:c,from:x,to:E,groupId:`${M}:${c}`})}if(b=t[k]||{},w=b[c],me(w))break;Ya(n,c,k,p,M),x=E}if(!me(w)||!J(k))return r?Tl:c;let C=`${k}__${c}`;vl(f)||(C=`${C}__${JSON.stringify(f)}`);let A=a.get(C);return A||(A=new Intl.NumberFormat(k,We({},w,f)),a.set(C,A)),m?A.formatToParts(d):A.format(d)}const Gh=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Za(...n){const[e,t,r,o]=n,s=Ce();let l=Ce();if(!je(e))throw wn(ct.INVALID_ARGUMENT);const a=e;return J(t)?s.key=t:me(t)&&Object.keys(t).forEach(c=>{Gh.includes(c)?l[c]=t[c]:s[c]=t[c]}),J(r)?s.locale=r:me(r)&&(l=r),me(o)&&(l=o),[s.key||"",a,s,l]}function Jh(n,e,t){const r=n;for(const o in t){const s=`${e}__${o}`;r.__numberFormatters.has(s)&&r.__numberFormatters.delete(s)}}const XV=n=>n,ZV=n=>"",QV="text",eL=n=>n.length===0?"":$a(n),tL=VB;function Yh(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function nL(n){const e=je(n.pluralIndex)?n.pluralIndex:-1;return n.named&&(je(n.named.count)||je(n.named.n))?je(n.named.count)?n.named.count:je(n.named.n)?n.named.n:e:e}function rL(n,e){e.count||(e.count=n),e.n||(e.n=n)}function oL(n={}){const e=n.locale,t=nL(n),r=ye(n.pluralRules)&&J(e)&&Ne(n.pluralRules[e])?n.pluralRules[e]:Yh,o=ye(n.pluralRules)&&J(e)&&Ne(n.pluralRules[e])?Yh:void 0,s=b=>b[r(t,b.length,o)],l=n.list||[],a=b=>l[b],c=n.named||Ce();je(n.pluralIndex)&&rL(t,c);const d=b=>c[b];function u(b,k){const w=Ne(n.messages)?n.messages(b,!!k):ye(n.messages)?n.messages[b]:!1;return w||(n.parent?n.parent.message(b):ZV)}const f=b=>n.modifiers?n.modifiers[b]:XV,p=me(n.processor)&&Ne(n.processor.normalize)?n.processor.normalize:eL,h=me(n.processor)&&Ne(n.processor.interpolate)?n.processor.interpolate:tL,m=me(n.processor)&&J(n.processor.type)?n.processor.type:QV,y={list:a,named:d,plural:s,linked:(b,...k)=>{const[w,x]=k;let E="text",M="";k.length===1?ye(w)?(M=w.modifier||M,E=w.type||E):J(w)&&(M=w||M):k.length===2&&(J(w)&&(M=w||M),J(x)&&(E=x||E));const C=u(b,!0)(y),A=E==="vnode"&&Ie(C)&&M?C[0]:C;return M?f(M)(A,E):A},message:u,type:m,interpolate:h,normalize:p,values:We(Ce(),l,c)};return y}const Xh=()=>"",Dt=n=>Ne(n);function Zh(n,...e){const{fallbackFormat:t,postTranslation:r,unresolving:o,messageCompiler:s,fallbackLocale:l,messages:a}=n,[c,d]=Qa(...e),u=be(d.missingWarn)?d.missingWarn:n.missingWarn,f=be(d.fallbackWarn)?d.fallbackWarn:n.fallbackWarn,p=be(d.escapeParameter)?d.escapeParameter:n.escapeParameter,h=!!d.resolvedMessage,m=J(d.default)||be(d.default)?be(d.default)?s?c:()=>c:d.default:t?s?c:()=>c:null,g=t||m!=null&&(J(m)||Ne(m)),y=qa(n,d);p&&sL(d);let[b,k,w]=h?[c,y,a[y]||Ce()]:Qh(n,c,y,l,f,u),x=b,E=c;if(!h&&!(J(x)||It(x)||Dt(x))&&g&&(x=m,E=x),!h&&(!(J(x)||It(x)||Dt(x))||!J(k)))return o?Tl:c;if(process.env.NODE_ENV!=="production"&&J(x)&&n.messageCompiler==null)return tn(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${c}'.`),c;let M=!1;const C=()=>{M=!0},A=Dt(x)?x:em(n,c,k,x,E,C);if(M)return x;const z=cL(n,k,w,d),G=oL(z),V=lL(n,A,G);let O=r?r(V,c):V;if(p&&J(O)&&(O=TB(O)),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const Y={timestamp:Date.now(),key:J(c)?c:Dt(x)?x.key:"",locale:k||(Dt(x)?x.locale:""),format:J(x)?x:Dt(x)?x.source:"",message:O};Y.meta=We({},n.__meta,qV()||{}),vV(Y)}return O}function sL(n){Ie(n.list)?n.list=n.list.map(e=>J(e)?uh(e):e):ye(n.named)&&Object.keys(n.named).forEach(e=>{J(n.named[e])&&(n.named[e]=uh(n.named[e]))})}function Qh(n,e,t,r,o,s){const{messages:l,onWarn:a,messageResolver:c,localeFallbacker:d}=n,u=d(n,r,t);let f=Ce(),p,h=null,m=t,g=null;const y="translate";for(let b=0;b<u.length;b++){if(p=g=u[b],process.env.NODE_ENV!=="production"&&t!==p&&!zh(t,p)&&Bl(o,e)&&a(br(bt.FALLBACK_TO_TRANSLATE,{key:e,target:p})),process.env.NODE_ENV!=="production"&&t!==p){const E=n.__v_emitter;E&&E.emit("fallback",{type:y,key:e,from:m,to:g,groupId:`${y}:${e}`})}f=l[p]||Ce();let k=null,w,x;if(process.env.NODE_ENV!=="production"&&Wt&&(k=window.performance.now(),w="intlify-message-resolve-start",x="intlify-message-resolve-end",_t&&_t(w)),(h=c(f,e))===null&&(h=f[e]),process.env.NODE_ENV!=="production"&&Wt){const E=window.performance.now(),M=n.__v_emitter;M&&k&&h&&M.emit("message-resolve",{type:"message-resolve",key:e,message:h,time:E-k,groupId:`${y}:${e}`}),w&&x&&_t&&gr&&(_t(x),gr("intlify message resolve",w,x))}if(J(h)||It(h)||Dt(h))break;if(!YV(p,u)){const E=Ya(n,e,p,s,y);E!==e&&(h=E)}m=g}return[h,p,f]}function em(n,e,t,r,o,s){const{messageCompiler:l,warnHtmlMessage:a}=n;if(Dt(r)){const p=r;return p.locale=p.locale||t,p.key=p.key||e,p}if(l==null){const p=(()=>r);return p.locale=t,p.key=e,p}let c=null,d,u;process.env.NODE_ENV!=="production"&&Wt&&(c=window.performance.now(),d="intlify-message-compilation-start",u="intlify-message-compilation-end",_t&&_t(d));const f=l(r,iL(n,t,o,r,a,s));if(process.env.NODE_ENV!=="production"&&Wt){const p=window.performance.now(),h=n.__v_emitter;h&&c&&h.emit("message-compilation",{type:"message-compilation",message:r,time:p-c,groupId:`translate:${e}`}),d&&u&&_t&&gr&&(_t(u),gr("intlify message compilation",d,u))}return f.locale=t,f.key=e,f.source=r,f}function lL(n,e,t){let r=null,o,s;process.env.NODE_ENV!=="production"&&Wt&&(r=window.performance.now(),o="intlify-message-evaluation-start",s="intlify-message-evaluation-end",_t&&_t(o));const l=e(t);if(process.env.NODE_ENV!=="production"&&Wt){const a=window.performance.now(),c=n.__v_emitter;c&&r&&c.emit("message-evaluation",{type:"message-evaluation",value:l,time:a-r,groupId:`translate:${e.key}`}),o&&s&&_t&&gr&&(_t(s),gr("intlify message evaluation",o,s))}return l}function Qa(...n){const[e,t,r]=n,o=Ce();if(!J(e)&&!je(e)&&!Dt(e)&&!It(e))throw wn(ct.INVALID_ARGUMENT);const s=je(e)?String(e):(Dt(e),e);return je(t)?o.plural=t:J(t)?o.default=t:me(t)&&!vl(t)?o.named=t:Ie(t)&&(o.list=t),je(r)?o.plural=r:J(r)?o.default=r:me(r)&&We(o,r),[s,o]}function iL(n,e,t,r,o,s){return{locale:e,key:t,warnHtmlMessage:o,onError:l=>{if(s&&s(l),process.env.NODE_ENV!=="production"){const a=aL(r),c=`Message compilation error: ${l.message}`,d=l.location&&a&&LB(a,l.location.start.offset,l.location.end.offset),u=n.__v_emitter;u&&a&&u.emit("compile-error",{message:a,error:l.message,start:l.location&&l.location.start.offset,end:l.location&&l.location.end.offset,groupId:`translate:${t}`}),console.error(d?`${c}
|
|
141
|
+
${d}`:c)}else throw l},onCacheKey:l=>_B(e,t,l)}}function aL(n){if(J(n))return n;if(n.loc&&n.loc.source)return n.loc.source}function cL(n,e,t,r){const{modifiers:o,pluralRules:s,messageResolver:l,fallbackLocale:a,fallbackWarn:c,missingWarn:d,fallbackContext:u}=n,p={locale:e,modifiers:o,pluralRules:s,messages:(h,m)=>{let g=l(t,h);if(g==null&&(u||m)){const[,,y]=Qh(u||n,h,e,a,c,d);g=l(y,h)}if(J(g)||It(g)){let y=!1;const k=em(n,h,e,g,h,()=>{y=!0});return y?Xh:k}else return Dt(g)?g:Xh}};return n.processor&&(p.processor=n.processor),r.list&&(p.list=r.list),r.named&&(p.named=r.named),je(r.plural)&&(p.pluralIndex=r.plural),p}cV();function dL(){return tm().__VUE_DEVTOOLS_GLOBAL_HOOK__}function tm(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const uL=typeof Proxy=="function",fL="devtools-plugin:setup",pL="plugin:settings:set";let Hr,ec;function hL(){var n;return Hr!==void 0||(typeof window<"u"&&window.performance?(Hr=!0,ec=window.performance):typeof globalThis<"u"&&(!((n=globalThis.perf_hooks)===null||n===void 0)&&n.performance)?(Hr=!0,ec=globalThis.perf_hooks.performance):Hr=!1),Hr}function mL(){return hL()?ec.now():Date.now()}class gL{constructor(e,t){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=t;const r={};if(e.settings)for(const l in e.settings){const a=e.settings[l];r[l]=a.defaultValue}const o=`__vue-devtools-plugin-settings__${e.id}`;let s=Object.assign({},r);try{const l=localStorage.getItem(o),a=JSON.parse(l);Object.assign(s,a)}catch{}this.fallbacks={getSettings(){return s},setSettings(l){try{localStorage.setItem(o,JSON.stringify(l))}catch{}s=l},now(){return mL()}},t&&t.on(pL,(l,a)=>{l===this.plugin.id&&this.fallbacks.setSettings(a)}),this.proxiedOn=new Proxy({},{get:(l,a)=>this.target?this.target.on[a]:(...c)=>{this.onQueue.push({method:a,args:c})}}),this.proxiedTarget=new Proxy({},{get:(l,a)=>this.target?this.target[a]:a==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(a)?(...c)=>(this.targetQueue.push({method:a,args:c,resolve:()=>{}}),this.fallbacks[a](...c)):(...c)=>new Promise(d=>{this.targetQueue.push({method:a,args:c,resolve:d})})})}async setRealTarget(e){this.target=e;for(const t of this.onQueue)this.target.on[t.method](...t.args);for(const t of this.targetQueue)t.resolve(await this.target[t.method](...t.args))}}function yL(n,e){const t=n,r=tm(),o=dL(),s=uL&&t.enableEarlyProxy;if(o&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!s))o.emit(fL,n,e);else{const l=s?new gL(t,o):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:t,setupFn:e,proxy:l}),l&&e(l.proxiedTarget)}}/*!
|
|
126
142
|
* vue-i18n v11.1.12
|
|
127
143
|
* (c) 2025 kazuya kawaguchi
|
|
128
144
|
* Released under the MIT License.
|
|
129
|
-
*/const
|
|
130
|
-
About how to use the Composition API mode, see https://vue-i18n.intlify.dev/guide/advanced/composition.html`,[lt.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE]:"'v-t' has been deprecated in v11. Use translate APIs ('t' or '$t') instead.",[lt.DUPLICATE_USE_I18N_CALLING]:"Duplicate `useI18n` calling by local scope. Please don't call it on local scope, due to it does not work properly in component."};function nr(t,...e){return Ss($S[t],...e)}function jr(t){if(!q(t)||st(t))return t;for(const e in t)if(pt(t,e))if(!e.includes("."))q(t[e])&&jr(t[e]);else{const n=e.split("."),r=n.length-1;let o=t,s=!1;for(let i=0;i<r;i++){if(n[i]==="__proto__")throw new Error(`unsafe key: ${n[i]}`);if(n[i]in o||(o[n[i]]=ne()),!q(o[n[i]])){process.env.NODE_ENV!=="production"&&wt(nr(lt.IGNORE_OBJ_FLATTEN,{key:n[i]})),s=!0;break}o=o[n[i]]}if(s||(st(o)?ah.includes(n[r])||delete t[e]:(o[n[r]]=t[e],delete t[e])),!st(o)){const i=o[n[r]];q(i)&&jr(i)}}return t}function Zl(t,e){const{messages:n,__i18n:r,messageResolver:o,flatJson:s}=e,i=W(n)?n:he(r)?ne():{[t]:ne()};if(he(r)&&r.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:a,resource:c}=l;a?(i[a]=i[a]||ne(),vs(c,i[a])):vs(c,i)}else R(l)&&vs(JSON.parse(l),i)}),o==null&&s)for(const l in i)pt(i,l)&&jr(i[l]);return i}function $h(t){return t.type}function Hh(t,e,n){let r=q(e.messages)?e.messages:ne();"__i18nGlobal"in n&&(r=Zl(t.locale.value,{messages:r,__i18n:n.__i18nGlobal}));const o=Object.keys(r);o.length&&o.forEach(s=>{t.mergeLocaleMessage(s,r[s])});{if(q(e.datetimeFormats)){const s=Object.keys(e.datetimeFormats);s.length&&s.forEach(i=>{t.mergeDateTimeFormat(i,e.datetimeFormats[i])})}if(q(e.numberFormats)){const s=Object.keys(e.numberFormats);s.length&&s.forEach(i=>{t.mergeNumberFormat(i,e.numberFormats[i])})}}}function zh(t){return f.createVNode(f.Text,null,t,0)}const Uh="__INTLIFY_META__",jh=()=>[],HS=()=>!1;let Wh=0;function Kh(t){return((e,n,r,o)=>t(n,r,f.getCurrentInstance()||void 0,o))}const zS=()=>{const t=f.getCurrentInstance();let e=null;return t&&(e=$h(t)[Uh])?{[Uh]:e}:null};function ea(t={}){const{__root:e,__injectWithOption:n}=t,r=e===void 0,o=t.flatJson,s=ht?f.ref:f.shallowRef;let i=G(t.inheritLocale)?t.inheritLocale:!0;const l=s(e&&i?e.locale.value:R(t.locale)?t.locale:Hr),a=s(e&&i?e.fallbackLocale.value:R(t.fallbackLocale)||he(t.fallbackLocale)||W(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:l.value),c=s(Zl(l.value,t)),d=s(W(t.datetimeFormats)?t.datetimeFormats:{[l.value]:{}}),u=s(W(t.numberFormats)?t.numberFormats:{[l.value]:{}});let h=e?e.missingWarn:G(t.missingWarn)||Xn(t.missingWarn)?t.missingWarn:!0,p=e?e.fallbackWarn:G(t.fallbackWarn)||Xn(t.fallbackWarn)?t.fallbackWarn:!0,m=e?e.fallbackRoot:G(t.fallbackRoot)?t.fallbackRoot:!0,g=!!t.fallbackFormat,y=se(t.missing)?t.missing:null,b=se(t.missing)?Kh(t.missing):null,k=se(t.postTranslation)?t.postTranslation:null,w=e?e.warnHtmlMessage:G(t.warnHtmlMessage)?t.warnHtmlMessage:!0,C=!!t.escapeParameter;const T=e?e.modifiers:W(t.modifiers)?t.modifiers:{};let _=t.pluralRules||e&&e.pluralRules,S;S=(()=>{r&&xh(null);const N={version:BS,locale:l.value,fallbackLocale:a.value,messages:c.value,modifiers:T,pluralRules:_,missing:b===null?void 0:b,missingWarn:h,fallbackWarn:p,fallbackFormat:g,unresolving:!0,postTranslation:k===null?void 0:k,warnHtmlMessage:w,escapeParameter:C,messageResolver:t.messageResolver,messageCompiler:t.messageCompiler,__meta:{framework:"vue"}};N.datetimeFormats=d.value,N.numberFormats=u.value,N.__datetimeFormatters=W(S)?S.__datetimeFormatters:void 0,N.__numberFormatters=W(S)?S.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(N.__v_emitter=W(S)?S.__v_emitter:void 0);const O=pS(N);return r&&xh(O),O})(),zr(S,l.value,a.value);function F(){return[l.value,a.value,c.value,d.value,u.value]}const J=f.computed({get:()=>l.value,set:N=>{S.locale=N,l.value=N}}),P=f.computed({get:()=>a.value,set:N=>{S.fallbackLocale=N,a.value=N,zr(S,l.value,N)}}),D=f.computed(()=>c.value),K=f.computed(()=>d.value),re=f.computed(()=>u.value);function Z(){return se(k)?k:null}function Ue(N){k=N,S.postTranslation=N}function Me(){return y}function je(N){N!==null&&(b=Kh(N)),y=N,S.missing=b}function at(N,O){return N!=="translate"||!O.resolvedMessage}const Ve=(N,O,X,ke,In,Ps)=>{F();let rr;try{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(S.fallbackContext=e?hS():void 0),rr=N(S)}finally{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(S.fallbackContext=void 0)}if(X!=="translate exists"&&we(rr)&&rr===As||X==="translate exists"&&!rr){const[Dn,TT]=O();if(process.env.NODE_ENV!=="production"&&e&&R(Dn)&&at(X,TT)&&(m&&(Ls(p,Dn)||wh(h,Dn))&&wt(nr(lt.FALLBACK_TO_ROOT,{key:Dn,type:X})),process.env.NODE_ENV!=="production")){const{__v_emitter:lp}=S;lp&&m&&lp.emit("fallback",{type:X,key:Dn,to:"global",groupId:`${X}:${Dn}`})}return e&&m?ke(e):In(Dn)}else{if(Ps(rr))return rr;throw Ge(ae.UNEXPECTED_RETURN_TYPE)}};function an(...N){return Ve(O=>Reflect.apply(Dh,null,[O,...N]),()=>ql(...N),"translate",O=>Reflect.apply(O.t,O,[...N]),O=>O,O=>R(O))}function Is(...N){const[O,X,ke]=N;if(ke&&!q(ke))throw Ge(ae.INVALID_ARGUMENT);return an(O,X,Se({resolvedMessage:!0},ke||{}))}function cn(...N){return Ve(O=>Reflect.apply(Nh,null,[O,...N]),()=>Wl(...N),"datetime format",O=>Reflect.apply(O.d,O,[...N]),()=>Os,O=>R(O)||he(O))}function aa(...N){return Ve(O=>Reflect.apply(Mh,null,[O,...N]),()=>Kl(...N),"number format",O=>Reflect.apply(O.n,O,[...N]),()=>Os,O=>R(O)||he(O))}function ca(N){return N.map(O=>R(O)||we(O)||G(O)?zh(String(O)):O)}const da={normalize:ca,interpolate:N=>N,type:"vnode"};function Ds(...N){return Ve(O=>{let X;const ke=O;try{ke.processor=da,X=Reflect.apply(Dh,null,[ke,...N])}finally{ke.processor=null}return X},()=>ql(...N),"translate",O=>O[Jl](...N),O=>[zh(O)],O=>he(O))}function ua(...N){return Ve(O=>Reflect.apply(Mh,null,[O,...N]),()=>Kl(...N),"number format",O=>O[Xl](...N),jh,O=>R(O)||he(O))}function Rs(...N){return Ve(O=>Reflect.apply(Nh,null,[O,...N]),()=>Wl(...N),"datetime format",O=>O[Yl](...N),jh,O=>R(O)||he(O))}function fa(N){_=N,S.pluralRules=_}function ha(N,O){return Ve(()=>{if(!N)return!1;const X=R(O)?O:l.value,ke=Ln(X),In=S.messageResolver(ke,N);return st(In)||it(In)||R(In)},()=>[N],"translate exists",X=>Reflect.apply(X.te,X,[N,O]),HS,X=>G(X))}function Kr(N){let O=null;const X=uh(S,a.value,l.value);for(let ke=0;ke<X.length;ke++){const In=c.value[X[ke]]||{},Ps=S.messageResolver(In,N);if(Ps!=null){O=Ps;break}}return O}function qr(N){const O=Kr(N);return O??(e?e.tm(N)||{}:{})}function Ln(N){return c.value[N]||{}}function Gr(N,O){if(o){const X={[N]:O};for(const ke in X)pt(X,ke)&&jr(X[ke]);O=X[N]}c.value[N]=O,S.messages=c.value}function pa(N,O){c.value[N]=c.value[N]||{};const X={[N]:O};if(o)for(const ke in X)pt(X,ke)&&jr(X[ke]);O=X[N],vs(O,c.value[N]),S.messages=c.value}function x(N){return d.value[N]||{}}function E(N,O){d.value[N]=O,S.datetimeFormats=d.value,_h(S,N,O)}function M(N,O){d.value[N]=Se(d.value[N]||{},O),S.datetimeFormats=d.value,_h(S,N,O)}function B(N){return u.value[N]||{}}function fe(N,O){u.value[N]=O,S.numberFormats=u.value,Oh(S,N,O)}function be(N,O){u.value[N]=Se(u.value[N]||{},O),S.numberFormats=u.value,Oh(S,N,O)}Wh++,e&&ht&&(f.watch(e.locale,N=>{i&&(l.value=N,S.locale=N,zr(S,l.value,a.value))}),f.watch(e.fallbackLocale,N=>{i&&(a.value=N,S.fallbackLocale=N,zr(S,l.value,a.value))}));const Y={id:Wh,locale:J,fallbackLocale:P,get inheritLocale(){return i},set inheritLocale(N){i=N,N&&e&&(l.value=e.locale.value,a.value=e.fallbackLocale.value,zr(S,l.value,a.value))},get availableLocales(){return Object.keys(c.value).sort()},messages:D,get modifiers(){return T},get pluralRules(){return _||{}},get isGlobal(){return r},get missingWarn(){return h},set missingWarn(N){h=N,S.missingWarn=h},get fallbackWarn(){return p},set fallbackWarn(N){p=N,S.fallbackWarn=p},get fallbackRoot(){return m},set fallbackRoot(N){m=N},get fallbackFormat(){return g},set fallbackFormat(N){g=N,S.fallbackFormat=g},get warnHtmlMessage(){return w},set warnHtmlMessage(N){w=N,S.warnHtmlMessage=N},get escapeParameter(){return C},set escapeParameter(N){C=N,S.escapeParameter=N},t:an,getLocaleMessage:Ln,setLocaleMessage:Gr,mergeLocaleMessage:pa,getPostTranslationHandler:Z,setPostTranslationHandler:Ue,getMissingHandler:Me,setMissingHandler:je,[Fh]:fa};return Y.datetimeFormats=K,Y.numberFormats=re,Y.rt=Is,Y.te=ha,Y.tm=qr,Y.d=cn,Y.n=aa,Y.getDateTimeFormat=x,Y.setDateTimeFormat=E,Y.mergeDateTimeFormat=M,Y.getNumberFormat=B,Y.setNumberFormat=fe,Y.mergeNumberFormat=be,Y[Vh]=n,Y[Jl]=Ds,Y[Yl]=Rs,Y[Xl]=ua,process.env.NODE_ENV!=="production"&&(Y[On]=N=>{S.__v_emitter=N},Y[Ur]=()=>{S.__v_emitter=void 0}),Y}const qh="vue-i18n: composer properties",ta={"vue-devtools-plugin-vue-i18n":"Vue I18n DevTools","vue-i18n-resource-inspector":"Vue I18n DevTools","vue-i18n-timeline":"Vue I18n"},US={"vue-i18n-resource-inspector":"Search for scopes ..."},jS={"vue-i18n-timeline":16764185};let na;async function WS(t,e){return new Promise((n,r)=>{try{PS({id:"vue-devtools-plugin-vue-i18n",label:ta["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[qh],app:t},o=>{na=o,o.on.visitComponentTree(({componentInstance:i,treeNode:l})=>{KS(i,l,e)}),o.on.inspectComponent(({componentInstance:i,instanceData:l})=>{i.vnode.el&&i.vnode.el.__VUE_I18N__&&l&&(e.mode==="legacy"?i.vnode.el.__VUE_I18N__!==e.global.__composer&&Jh(l,i.vnode.el.__VUE_I18N__):Jh(l,i.vnode.el.__VUE_I18N__))}),o.addInspector({id:"vue-i18n-resource-inspector",label:ta["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:US["vue-i18n-resource-inspector"]}),o.on.getInspectorTree(i=>{i.app===t&&i.inspectorId==="vue-i18n-resource-inspector"&&XS(i,e)});const s=new Map;o.on.getInspectorState(async i=>{if(i.app===t&&i.inspectorId==="vue-i18n-resource-inspector")if(o.unhighlightElement(),ZS(i,e),i.nodeId==="global"){if(!s.has(i.app)){const[l]=await o.getComponentInstances(i.app);s.set(i.app,l)}o.highlightElement(s.get(i.app))}else{const l=QS(i.nodeId,e);l&&o.highlightElement(l)}}),o.on.editInspectorState(i=>{i.app===t&&i.inspectorId==="vue-i18n-resource-inspector"&&tT(i,e)}),o.addTimelineLayer({id:"vue-i18n-timeline",label:ta["vue-i18n-timeline"],color:jS["vue-i18n-timeline"]}),n(!0)})}catch(o){console.error(o),r(!1)}})}function Gh(t){return t.type.name||t.type.displayName||t.type.__file||"Anonymous"}function KS(t,e,n){const r=n.mode==="composition"?n.global:n.global.__composer;if(t&&t.vnode.el&&t.vnode.el.__VUE_I18N__&&t.vnode.el.__VUE_I18N__!==r){const o={label:`i18n (${Gh(t)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(o)}}function Jh(t,e){const n=qh;t.state.push({type:n,key:"locale",editable:!0,value:e.locale.value}),t.state.push({type:n,key:"availableLocales",editable:!1,value:e.availableLocales}),t.state.push({type:n,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),t.state.push({type:n,key:"inheritLocale",editable:!0,value:e.inheritLocale}),t.state.push({type:n,key:"messages",editable:!1,value:ra(e.messages.value)}),t.state.push({type:n,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),t.state.push({type:n,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function ra(t){const e={};return Object.keys(t).forEach(n=>{const r=t[n];se(r)&&"source"in r?e[n]=YS(r):st(r)&&r.loc&&r.loc.source?e[n]=r.loc.source:q(r)?e[n]=ra(r):e[n]=r}),e}const qS={"<":"<",">":">",'"':""","&":"&"};function GS(t){return t.replace(/[<>"&]/g,JS)}function JS(t){return qS[t]||t}function YS(t){return{_custom:{type:"function",display:`<span>ƒ</span> ${t.source?`("${GS(t.source)}")`:"(?)"}`}}}function XS(t,e){t.rootNodes.push({id:"global",label:"Global Scope"});const n=e.mode==="composition"?e.global:e.global.__composer;for(const[r,o]of e.__instances){const s=e.mode==="composition"?o:o.__composer;n!==s&&t.rootNodes.push({id:s.id.toString(),label:`${Gh(r)} Scope`})}}function QS(t,e){let n=null;if(t!=="global"){for(const[r,o]of e.__instances.entries())if(o.id.toString()===t){n=r;break}}return n}function Yh(t,e){if(t==="global")return e.mode==="composition"?e.global:e.global.__composer;{const n=Array.from(e.__instances.values()).find(r=>r.id.toString()===t);return n?e.mode==="composition"?n:n.__composer:null}}function ZS(t,e){const n=Yh(t.nodeId,e);return n&&(t.state=eT(n)),null}function eT(t){const e={},n="Locale related info",r=[{type:n,key:"locale",editable:!0,value:t.locale.value},{type:n,key:"fallbackLocale",editable:!0,value:t.fallbackLocale.value},{type:n,key:"availableLocales",editable:!1,value:t.availableLocales},{type:n,key:"inheritLocale",editable:!0,value:t.inheritLocale}];e[n]=r;const o="Locale messages info",s=[{type:o,key:"messages",editable:!1,value:ra(t.messages.value)}];e[o]=s;{const i="Datetime formats info",l=[{type:i,key:"datetimeFormats",editable:!1,value:t.datetimeFormats.value}];e[i]=l;const a="Datetime formats info",c=[{type:a,key:"numberFormats",editable:!1,value:t.numberFormats.value}];e[a]=c}return e}function Wr(t,e){if(na){let n;e&&"groupId"in e&&(n=e.groupId,delete e.groupId),na.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:t,groupId:n,time:Date.now(),meta:{},data:e||{},logType:t==="compile-error"?"error":t==="fallback"||t==="missing"?"warning":"default"}})}}function tT(t,e){const n=Yh(t.nodeId,e);if(n){const[r]=t.path;r==="locale"&&R(t.state.value)?n.locale.value=t.state.value:r==="fallbackLocale"&&(R(t.state.value)||he(t.state.value)||q(t.state.value))?n.fallbackLocale.value=t.state.value:r==="inheritLocale"&&G(t.state.value)&&(n.inheritLocale=t.state.value)}}function nT(t){const e=R(t.locale)?t.locale:Hr,n=R(t.fallbackLocale)||he(t.fallbackLocale)||W(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:e,r=se(t.missing)?t.missing:void 0,o=G(t.silentTranslationWarn)||Xn(t.silentTranslationWarn)?!t.silentTranslationWarn:!0,s=G(t.silentFallbackWarn)||Xn(t.silentFallbackWarn)?!t.silentFallbackWarn:!0,i=G(t.fallbackRoot)?t.fallbackRoot:!0,l=!!t.formatFallbackMessages,a=W(t.modifiers)?t.modifiers:{},c=t.pluralizationRules,d=se(t.postTranslation)?t.postTranslation:void 0,u=R(t.warnHtmlInMessage)?t.warnHtmlInMessage!=="off":!0,h=!!t.escapeParameterHtml,p=G(t.sync)?t.sync:!0;let m=t.messages;if(W(t.sharedMessages)){const T=t.sharedMessages;m=Object.keys(T).reduce((S,I)=>{const F=S[I]||(S[I]={});return Se(F,T[I]),S},m||{})}const{__i18n:g,__root:y,__injectWithOption:b}=t,k=t.datetimeFormats,w=t.numberFormats,C=t.flatJson;return{locale:e,fallbackLocale:n,messages:m,flatJson:C,datetimeFormats:k,numberFormats:w,missing:r,missingWarn:o,fallbackWarn:s,fallbackRoot:i,fallbackFormat:l,modifiers:a,pluralRules:c,postTranslation:d,warnHtmlMessage:u,escapeParameter:h,messageResolver:t.messageResolver,inheritLocale:p,__i18n:g,__root:y,__injectWithOption:b}}function oa(t={}){const e=ea(nT(t)),{__extender:n}=t,r={id:e.id,get locale(){return e.locale.value},set locale(o){e.locale.value=o},get fallbackLocale(){return e.fallbackLocale.value},set fallbackLocale(o){e.fallbackLocale.value=o},get messages(){return e.messages.value},get datetimeFormats(){return e.datetimeFormats.value},get numberFormats(){return e.numberFormats.value},get availableLocales(){return e.availableLocales},get missing(){return e.getMissingHandler()},set missing(o){e.setMissingHandler(o)},get silentTranslationWarn(){return G(e.missingWarn)?!e.missingWarn:e.missingWarn},set silentTranslationWarn(o){e.missingWarn=G(o)?!o:o},get silentFallbackWarn(){return G(e.fallbackWarn)?!e.fallbackWarn:e.fallbackWarn},set silentFallbackWarn(o){e.fallbackWarn=G(o)?!o:o},get modifiers(){return e.modifiers},get formatFallbackMessages(){return e.fallbackFormat},set formatFallbackMessages(o){e.fallbackFormat=o},get postTranslation(){return e.getPostTranslationHandler()},set postTranslation(o){e.setPostTranslationHandler(o)},get sync(){return e.inheritLocale},set sync(o){e.inheritLocale=o},get warnHtmlInMessage(){return e.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(o){e.warnHtmlMessage=o!=="off"},get escapeParameterHtml(){return e.escapeParameter},set escapeParameterHtml(o){e.escapeParameter=o},get pluralizationRules(){return e.pluralRules||{}},__composer:e,t(...o){return Reflect.apply(e.t,e,[...o])},rt(...o){return Reflect.apply(e.rt,e,[...o])},te(o,s){return e.te(o,s)},tm(o){return e.tm(o)},getLocaleMessage(o){return e.getLocaleMessage(o)},setLocaleMessage(o,s){e.setLocaleMessage(o,s)},mergeLocaleMessage(o,s){e.mergeLocaleMessage(o,s)},d(...o){return Reflect.apply(e.d,e,[...o])},getDateTimeFormat(o){return e.getDateTimeFormat(o)},setDateTimeFormat(o,s){e.setDateTimeFormat(o,s)},mergeDateTimeFormat(o,s){e.mergeDateTimeFormat(o,s)},n(...o){return Reflect.apply(e.n,e,[...o])},getNumberFormat(o){return e.getNumberFormat(o)},setNumberFormat(o,s){e.setNumberFormat(o,s)},mergeNumberFormat(o,s){e.mergeNumberFormat(o,s)}};return r.__extender=n,process.env.NODE_ENV!=="production"&&(r.__enableEmitter=o=>{const s=e;s[On]&&s[On](o)},r.__disableEmitter=()=>{const o=e;o[Ur]&&o[Ur]()}),r}function rT(t,e,n){return{beforeCreate(){const r=f.getCurrentInstance();if(!r)throw Ge(ae.UNEXPECTED_ERROR);const o=this.$options;if(o.i18n){const s=o.i18n;if(o.__i18n&&(s.__i18n=o.__i18n),s.__root=e,this===this.$root)this.$i18n=Xh(t,s);else{s.__injectWithOption=!0,s.__extender=n.__vueI18nExtend,this.$i18n=oa(s);const i=this.$i18n;i.__extender&&(i.__disposer=i.__extender(this.$i18n))}}else if(o.__i18n)if(this===this.$root)this.$i18n=Xh(t,o);else{this.$i18n=oa({__i18n:o.__i18n,__injectWithOption:!0,__extender:n.__vueI18nExtend,__root:e});const s=this.$i18n;s.__extender&&(s.__disposer=s.__extender(this.$i18n))}else this.$i18n=t;o.__i18nGlobal&&Hh(e,o,o),this.$t=(...s)=>this.$i18n.t(...s),this.$rt=(...s)=>this.$i18n.rt(...s),this.$te=(s,i)=>this.$i18n.te(s,i),this.$d=(...s)=>this.$i18n.d(...s),this.$n=(...s)=>this.$i18n.n(...s),this.$tm=s=>this.$i18n.tm(s),n.__setInstance(r,this.$i18n)},mounted(){if(process.env.NODE_ENV!=="production"&&this.$el&&this.$i18n){const r=this.$i18n;this.$el.__VUE_I18N__=r.__composer;const o=this.__v_emitter=Rl();r.__enableEmitter&&r.__enableEmitter(o),o.on("*",Wr)}},unmounted(){const r=f.getCurrentInstance();if(!r)throw Ge(ae.UNEXPECTED_ERROR);const o=this.$i18n;process.env.NODE_ENV!=="production"&&this.$el&&this.$el.__VUE_I18N__&&(this.__v_emitter&&(this.__v_emitter.off("*",Wr),delete this.__v_emitter),this.$i18n&&(o.__disableEmitter&&o.__disableEmitter(),delete this.$el.__VUE_I18N__)),delete this.$t,delete this.$rt,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,o.__disposer&&(o.__disposer(),delete o.__disposer,delete o.__extender),n.__deleteInstance(r),delete this.$i18n}}}function Xh(t,e){t.locale=e.locale||t.locale,t.fallbackLocale=e.fallbackLocale||t.fallbackLocale,t.missing=e.missing||t.missing,t.silentTranslationWarn=e.silentTranslationWarn||t.silentFallbackWarn,t.silentFallbackWarn=e.silentFallbackWarn||t.silentFallbackWarn,t.formatFallbackMessages=e.formatFallbackMessages||t.formatFallbackMessages,t.postTranslation=e.postTranslation||t.postTranslation,t.warnHtmlInMessage=e.warnHtmlInMessage||t.warnHtmlInMessage,t.escapeParameterHtml=e.escapeParameterHtml||t.escapeParameterHtml,t.sync=e.sync||t.sync,t.__composer[Fh](e.pluralizationRules||t.pluralizationRules);const n=Zl(t.locale,{messages:e.messages,__i18n:e.__i18n});return Object.keys(n).forEach(r=>t.mergeLocaleMessage(r,n[r])),e.datetimeFormats&&Object.keys(e.datetimeFormats).forEach(r=>t.mergeDateTimeFormat(r,e.datetimeFormats[r])),e.numberFormats&&Object.keys(e.numberFormats).forEach(r=>t.mergeNumberFormat(r,e.numberFormats[r])),t}const sa={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:t=>t==="parent"||t==="global",default:"parent"},i18n:{type:Object}};function oT({slots:t},e){return e.length===1&&e[0]==="default"?(t.default?t.default():[]).reduce((r,o)=>[...r,...o.type===f.Fragment?o.children:[o]],[]):e.reduce((n,r)=>{const o=t[r];return o&&(n[r]=o()),n},ne())}function Qh(){return f.Fragment}const Zh=f.defineComponent({name:"i18n-t",props:Se({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:t=>we(t)||!isNaN(t)}},sa),setup(t,e){const{slots:n,attrs:r}=e,o=t.i18n||ia({useScope:t.scope,__useComponent:!0});return()=>{const s=Object.keys(n).filter(u=>u[0]!=="_"),i=ne();t.locale&&(i.locale=t.locale),t.plural!==void 0&&(i.plural=R(t.plural)?+t.plural:t.plural);const l=oT(e,s),a=o[Jl](t.keypath,l,i),c=Se(ne(),r),d=R(t.tag)||q(t.tag)?t.tag:Qh();return f.h(d,c,a)}}});function sT(t){return he(t)&&!R(t[0])}function ep(t,e,n,r){const{slots:o,attrs:s}=e;return()=>{const i={part:!0};let l=ne();t.locale&&(i.locale=t.locale),R(t.format)?i.key=t.format:q(t.format)&&(R(t.format.key)&&(i.key=t.format.key),l=Object.keys(t.format).reduce((h,p)=>n.includes(p)?Se(ne(),h,{[p]:t.format[p]}):h,ne()));const a=r(t.value,i,l);let c=[i.key];he(a)?c=a.map((h,p)=>{const m=o[h.type],g=m?m({[h.type]:h.value,index:p,parts:a}):[h.value];return sT(g)&&(g[0].key=`${h.type}-${p}`),g}):R(a)&&(c=[a]);const d=Se(ne(),s),u=R(t.tag)||q(t.tag)?t.tag:Qh();return f.h(u,d,c)}}const tp=f.defineComponent({name:"i18n-n",props:Se({value:{type:Number,required:!0},format:{type:[String,Object]}},sa),setup(t,e){const n=t.i18n||ia({useScope:t.scope,__useComponent:!0});return ep(t,e,Ah,(...r)=>n[Xl](...r))}});function iT(t,e){const n=t;if(t.mode==="composition")return n.__getInstance(e)||t.global;{const r=n.__getInstance(e);return r!=null?r.__composer:t.global.__composer}}function lT(t){const e=i=>{process.env.NODE_ENV!=="production"&&Ll(nr(lt.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE));const{instance:l,value:a}=i;if(!l||!l.$)throw Ge(ae.UNEXPECTED_ERROR);const c=iT(t,l.$),d=np(a);return[Reflect.apply(c.t,c,[...rp(d)]),c]};return{created:(i,l)=>{const[a,c]=e(l);ht&&t.global===c&&(i.__i18nWatcher=f.watch(c.locale,()=>{l.instance&&l.instance.$forceUpdate()})),i.__composer=c,i.textContent=a},unmounted:i=>{ht&&i.__i18nWatcher&&(i.__i18nWatcher(),i.__i18nWatcher=void 0,delete i.__i18nWatcher),i.__composer&&(i.__composer=void 0,delete i.__composer)},beforeUpdate:(i,{value:l})=>{if(i.__composer){const a=i.__composer,c=np(l);i.textContent=Reflect.apply(a.t,a,[...rp(c)])}},getSSRProps:i=>{const[l]=e(i);return{textContent:l}}}}function np(t){if(R(t))return{path:t};if(W(t)){if(!("path"in t))throw Ge(ae.REQUIRED_VALUE,"path");return t}else throw Ge(ae.INVALID_VALUE)}function rp(t){const{path:e,locale:n,args:r,choice:o,plural:s}=t,i={},l=r||{};return R(n)&&(i.locale=n),we(o)&&(i.plural=o),we(s)&&(i.plural=s),[e,l,i]}function aT(t,e,...n){const r=W(n[0])?n[0]:{};(G(r.globalInstall)?r.globalInstall:!0)&&([Zh.name,"I18nT"].forEach(s=>t.component(s,Zh)),[tp.name,"I18nN"].forEach(s=>t.component(s,tp)),[sp.name,"I18nD"].forEach(s=>t.component(s,sp))),t.directive("t",lT(e))}const cT=Ct("global-vue-i18n");function dT(t={}){const e=__VUE_I18N_LEGACY_API__&&G(t.legacy)?t.legacy:__VUE_I18N_LEGACY_API__;process.env.NODE_ENV!=="production"&&e&&Ll(nr(lt.DEPRECATE_LEGACY_MODE));const n=G(t.globalInjection)?t.globalInjection:!0,r=new Map,[o,s]=uT(t,e),i=Ct(process.env.NODE_ENV!=="production"?"vue-i18n":"");function l(u){return r.get(u)||null}function a(u,h){r.set(u,h)}function c(u){r.delete(u)}const d={get mode(){return __VUE_I18N_LEGACY_API__&&e?"legacy":"composition"},async install(u,...h){if(process.env.NODE_ENV!=="production"&&(u.__VUE_I18N__=d),u.__VUE_I18N_SYMBOL__=i,u.provide(u.__VUE_I18N_SYMBOL__,d),W(h[0])){const g=h[0];d.__composerExtend=g.__composerExtend,d.__vueI18nExtend=g.__vueI18nExtend}let p=null;!e&&n&&(p=kT(u,d.global)),__VUE_I18N_FULL_INSTALL__&&aT(u,d,...h),__VUE_I18N_LEGACY_API__&&e&&u.mixin(rT(s,s.__composer,d));const m=u.unmount;if(u.unmount=()=>{p&&p(),d.dispose(),m()},process.env.NODE_ENV!=="production"){if(!await WS(u,d))throw Ge(ae.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const y=Rl();if(e){const b=s;b.__enableEmitter&&b.__enableEmitter(y)}else{const b=s;b[On]&&b[On](y)}y.on("*",Wr)}},get global(){return s},dispose(){o.stop()},__instances:r,__getInstance:l,__setInstance:a,__deleteInstance:c};return d}function ia(t={}){const e=f.getCurrentInstance();if(e==null)throw Ge(ae.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Ge(ae.NOT_INSTALLED);const n=fT(e),r=pT(n),o=$h(e),s=hT(t,o);if(s==="global")return Hh(r,t,o),r;if(s==="parent"){let a=mT(n,e,t.__useComponent);return a==null&&(process.env.NODE_ENV!=="production"&&wt(nr(lt.NOT_FOUND_PARENT_SCOPE)),a=r),a}const i=n;let l=i.__getInstance(e);if(l==null){const a=Se({},t);"__i18n"in o&&(a.__i18n=o.__i18n),r&&(a.__root=r),l=ea(a),i.__composerExtend&&(l[Ql]=i.__composerExtend(l)),yT(i,e,l),i.__setInstance(e,l)}else process.env.NODE_ENV!=="production"&&s==="local"&&wt(nr(lt.DUPLICATE_USE_I18N_CALLING));return l}function uT(t,e){const n=f.effectScope(),r=__VUE_I18N_LEGACY_API__&&e?n.run(()=>oa(t)):n.run(()=>ea(t));if(r==null)throw Ge(ae.UNEXPECTED_ERROR);return[n,r]}function fT(t){const e=f.inject(t.isCE?cT:t.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Ge(t.isCE?ae.NOT_INSTALLED_WITH_PROVIDE:ae.UNEXPECTED_ERROR);return e}function hT(t,e){return Ts(t)?"__i18n"in e?"local":"global":t.useScope?t.useScope:"local"}function pT(t){return t.mode==="composition"?t.global:t.global.__composer}function mT(t,e,n=!1){let r=null;const o=e.root;let s=gT(e,n);for(;s!=null;){const i=t;if(t.mode==="composition")r=i.__getInstance(s);else if(__VUE_I18N_LEGACY_API__){const l=i.__getInstance(s);l!=null&&(r=l.__composer,n&&r&&!r[Vh]&&(r=null))}if(r!=null||o===s)break;s=s.parent}return r}function gT(t,e=!1){return t==null?null:e&&t.vnode.ctx||t.parent}function yT(t,e,n){let r=null;f.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=n,r=Rl();const o=n;o[On]&&o[On](r),r.on("*",Wr)}},e),f.onUnmounted(()=>{const o=n;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(r&&r.off("*",Wr),o[Ur]&&o[Ur](),delete e.vnode.el.__VUE_I18N__),t.__deleteInstance(e);const s=o[Ql];s&&(s(),delete o[Ql])},e)}const bT=["locale","fallbackLocale","availableLocales"],op=["t","rt","d","n","tm","te"];function kT(t,e){const n=Object.create(null);return bT.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s)throw Ge(ae.UNEXPECTED_ERROR);const i=f.isRef(s.value)?{get(){return s.value.value},set(l){s.value.value=l}}:{get(){return s.get&&s.get()}};Object.defineProperty(n,o,i)}),t.config.globalProperties.$i18n=n,op.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s||!s.value)throw Ge(ae.UNEXPECTED_ERROR);Object.defineProperty(t.config.globalProperties,`$${o}`,s)}),()=>{delete t.config.globalProperties.$i18n,op.forEach(o=>{delete t.config.globalProperties[`$${o}`]})}}const sp=f.defineComponent({name:"i18n-d",props:Se({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},sa),setup(t,e){const n=t.i18n||ia({useScope:t.scope,__useComponent:!0});return ep(t,e,vh,(...r)=>n[Yl](...r))}});if(FS(),aS($C),cS(rS),dS(uh),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const t=Mn();t.__INTLIFY__=!0,HC(t.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const xT={},ET={},wT={paragraph:"Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",createTable:"Create Table",addColumn:"Add Column",addRow:"Add Row",deleteColumn:"Delete Column",deleteRow:"Delete Row",deleteTable:"Delete Table",linkTitle:"Enter Link",create:"Create",cancel:"Cancel"},CT={paragraph:"Звичайний текст",heading1:"Заголовок 1",heading2:"Заголовок 2",heading3:"Заголовок 3",heading4:"Заголовок 4",heading5:"Заголовок 5",heading6:"Заголовок 6",createTable:"Створити таблицю",addColumn:"Додати колонку",addRow:"Додати рядок",deleteColumn:"Видалити колонку",deleteRow:"Видалити рядок",deleteTable:"Видалити таблицю",linkTitle:"Введіть посилання",create:"Створити",cancel:"Скасувати"},la=dT({legacy:!1,locale:"uk",fallbackLocale:"en",messages:{en:{...xT,tiptap:wT},uk:{...ET,tiptap:CT}}}),ST={install:(t,e={})=>{if(e.i18nConfig){const n=e.i18nConfig,r=la.global?.messages?.value||la.messages;r&&n.global?.messages?.value&&Object.keys(r).forEach(o=>{n.global.mergeLocaleMessage?n.global.mergeLocaleMessage(o,r[o]):n.global.setLocaleMessage(o,r[o])})}else t.use(la);t.component("vs-richtext",Cs),t.component("vs-richtext-md",Cs),t.component("vs-richtext-page",jf)}};mt.VsRichtext=Cs,mt.VsRichtextMd=Cs,mt.VsRichtextPage=jf,mt.default=ST,Object.defineProperties(mt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
145
|
+
*/const bL="11.1.12";function kL(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(yr().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(yr().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(yr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(yr().__INTLIFY_PROD_DEVTOOLS__=!1)}const Ae={UNEXPECTED_RETURN_TYPE:SV,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:30,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32,NOT_COMPATIBLE_LEGACY_VUE_I18N:33,NOT_AVAILABLE_COMPOSITION_IN_LEGACY:34};function kt(n,...e){return Pr(n,null,process.env.NODE_ENV!=="production"?{messages:xL,args:e}:void 0)}const xL={[Ae.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[Ae.INVALID_ARGUMENT]:"Invalid argument",[Ae.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[Ae.NOT_INSTALLED]:"Need to install with `app.use` function",[Ae.UNEXPECTED_ERROR]:"Unexpected error",[Ae.REQUIRED_VALUE]:"Required in value: {0}",[Ae.INVALID_VALUE]:"Invalid value",[Ae.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[Ae.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[Ae.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[Ae.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},tc=nn("__translateVNode"),nc=nn("__datetimeParts"),rc=nn("__numberParts"),kr=nn("__enableEmitter"),Io=nn("__disableEmitter"),nm=nn("__setPluralRules"),rm=nn("__injectWithOption"),oc=nn("__dispose"),Rt={FALLBACK_TO_ROOT:PV,NOT_FOUND_PARENT_SCOPE:9,IGNORE_OBJ_FLATTEN:10,DEPRECATE_LEGACY_MODE:11,DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE:12,DUPLICATE_USE_I18N_CALLING:13},wL={[Rt.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[Rt.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[Rt.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[Rt.DEPRECATE_LEGACY_MODE]:`Legacy API mode has been deprecated in v11. Use Composition API mode instead.
|
|
146
|
+
About how to use the Composition API mode, see https://vue-i18n.intlify.dev/guide/advanced/composition.html`,[Rt.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE]:"'v-t' has been deprecated in v11. Use translate APIs ('t' or '$t') instead.",[Rt.DUPLICATE_USE_I18N_CALLING]:"Duplicate `useI18n` calling by local scope. Please don't call it on local scope, due to it does not work properly in component."};function jr(n,...e){return Cl(wL[n],...e)}function Do(n){if(!ye(n)||It(n))return n;for(const e in n)if(Kt(n,e))if(!e.includes("."))ye(n[e])&&Do(n[e]);else{const t=e.split("."),r=t.length-1;let o=n,s=!1;for(let l=0;l<r;l++){if(t[l]==="__proto__")throw new Error(`unsafe key: ${t[l]}`);if(t[l]in o||(o[t[l]]=Ce()),!ye(o[t[l]])){process.env.NODE_ENV!=="production"&&tn(jr(Rt.IGNORE_OBJ_FLATTEN,{key:t[l]})),s=!0;break}o=o[t[l]]}if(s||(It(o)?Sh.includes(t[r])||delete n[e]:(o[t[r]]=n[e],delete n[e])),!It(o)){const l=o[t[r]];ye(l)&&Do(l)}}return n}function sc(n,e){const{messages:t,__i18n:r,messageResolver:o,flatJson:s}=e,l=me(t)?t:Ie(r)?Ce():{[n]:Ce()};if(Ie(r)&&r.forEach(a=>{if("locale"in a&&"resource"in a){const{locale:c,resource:d}=a;c?(l[c]=l[c]||Ce(),Sl(d,l[c])):Sl(d,l)}else J(a)&&Sl(JSON.parse(a),l)}),o==null&&s)for(const a in l)Kt(l,a)&&Do(l[a]);return l}function om(n){return n.type}function sm(n,e,t){let r=ye(e.messages)?e.messages:Ce();"__i18nGlobal"in t&&(r=sc(n.locale.value,{messages:r,__i18n:t.__i18nGlobal}));const o=Object.keys(r);o.length&&o.forEach(s=>{n.mergeLocaleMessage(s,r[s])});{if(ye(e.datetimeFormats)){const s=Object.keys(e.datetimeFormats);s.length&&s.forEach(l=>{n.mergeDateTimeFormat(l,e.datetimeFormats[l])})}if(ye(e.numberFormats)){const s=Object.keys(e.numberFormats);s.length&&s.forEach(l=>{n.mergeNumberFormat(l,e.numberFormats[l])})}}}function lm(n){return i.createVNode(i.Text,null,n,0)}const im="__INTLIFY_META__",am=()=>[],EL=()=>!1;let cm=0;function dm(n){return((e,t,r,o)=>n(t,r,i.getCurrentInstance()||void 0,o))}const CL=()=>{const n=i.getCurrentInstance();let e=null;return n&&(e=om(n)[im])?{[im]:e}:null};function lc(n={}){const{__root:e,__injectWithOption:t}=n,r=e===void 0,o=n.flatJson,s=Wt?i.ref:i.shallowRef;let l=be(n.inheritLocale)?n.inheritLocale:!0;const a=s(e&&l?e.locale.value:J(n.locale)?n.locale:Lo),c=s(e&&l?e.fallbackLocale.value:J(n.fallbackLocale)||Ie(n.fallbackLocale)||me(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:a.value),d=s(sc(a.value,n)),u=s(me(n.datetimeFormats)?n.datetimeFormats:{[a.value]:{}}),f=s(me(n.numberFormats)?n.numberFormats:{[a.value]:{}});let p=e?e.missingWarn:be(n.missingWarn)||Fr(n.missingWarn)?n.missingWarn:!0,h=e?e.fallbackWarn:be(n.fallbackWarn)||Fr(n.fallbackWarn)?n.fallbackWarn:!0,m=e?e.fallbackRoot:be(n.fallbackRoot)?n.fallbackRoot:!0,g=!!n.fallbackFormat,y=Ne(n.missing)?n.missing:null,b=Ne(n.missing)?dm(n.missing):null,k=Ne(n.postTranslation)?n.postTranslation:null,w=e?e.warnHtmlMessage:be(n.warnHtmlMessage)?n.warnHtmlMessage:!0,x=!!n.escapeParameter;const E=e?e.modifiers:me(n.modifiers)?n.modifiers:{};let M=n.pluralRules||e&&e.pluralRules,C;C=(()=>{r&&Fh(null);const B={version:bL,locale:a.value,fallbackLocale:c.value,messages:d.value,modifiers:E,pluralRules:M,missing:b===null?void 0:b,missingWarn:p,fallbackWarn:h,fallbackFormat:g,unresolving:!0,postTranslation:k===null?void 0:k,warnHtmlMessage:w,escapeParameter:x,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};B.datetimeFormats=u.value,B.numberFormats=f.value,B.__datetimeFormatters=me(C)?C.__datetimeFormatters:void 0,B.__numberFormatters=me(C)?C.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(B.__v_emitter=me(C)?C.__v_emitter:void 0);const F=JV(B);return r&&Fh(F),F})(),Oo(C,a.value,c.value);function z(){return[a.value,c.value,d.value,u.value,f.value]}const G=i.computed({get:()=>a.value,set:B=>{C.locale=B,a.value=B}}),V=i.computed({get:()=>c.value,set:B=>{C.fallbackLocale=B,c.value=B,Oo(C,a.value,B)}}),O=i.computed(()=>d.value),Y=i.computed(()=>u.value),Q=i.computed(()=>f.value);function P(){return Ne(k)?k:null}function K(B){k=B,C.postTranslation=B}function U(){return y}function re(B){B!==null&&(b=dm(B)),y=B,C.missing=b}function se(B,F){return B!=="translate"||!F.resolvedMessage}const ve=(B,F,he,v,N,H)=>{z();let W;try{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(C.fallbackContext=e?GV():void 0),W=B(C)}finally{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(C.fallbackContext=void 0)}if(he!=="translate exists"&&je(W)&&W===Tl||he==="translate exists"&&!W){const[Z,fe]=F();if(process.env.NODE_ENV!=="production"&&e&&J(Z)&&se(he,fe)&&(m&&(Bl(h,Z)||$h(p,Z))&&tn(jr(Rt.FALLBACK_TO_ROOT,{key:Z,type:he})),process.env.NODE_ENV!=="production")){const{__v_emitter:T}=C;T&&m&&T.emit("fallback",{type:he,key:Z,to:"global",groupId:`${he}:${Z}`})}return e&&m?v(e):N(Z)}else{if(H(W))return W;throw kt(Ae.UNEXPECTED_RETURN_TYPE)}};function pt(...B){return ve(F=>Reflect.apply(Zh,null,[F,...B]),()=>Qa(...B),"translate",F=>Reflect.apply(F.t,F,[...B]),F=>F,F=>J(F))}function St(...B){const[F,he,v]=B;if(v&&!ye(v))throw kt(Ae.INVALID_ARGUMENT);return pt(F,he,We({resolvedMessage:!0},v||{}))}function Ft(...B){return ve(F=>Reflect.apply(Uh,null,[F,...B]),()=>Xa(...B),"datetime format",F=>Reflect.apply(F.d,F,[...B]),()=>Al,F=>J(F)||Ie(F))}function Ke(...B){return ve(F=>Reflect.apply(qh,null,[F,...B]),()=>Za(...B),"number format",F=>Reflect.apply(F.n,F,[...B]),()=>Al,F=>J(F)||Ie(F))}function ht(B){return B.map(F=>J(F)||je(F)||be(F)?lm(String(F)):F)}const Cn={normalize:ht,interpolate:B=>B,type:"vnode"};function vn(...B){return ve(F=>{let he;const v=F;try{v.processor=Cn,he=Reflect.apply(Zh,null,[v,...B])}finally{v.processor=null}return he},()=>Qa(...B),"translate",F=>F[tc](...B),F=>[lm(F)],F=>Ie(F))}function xr(...B){return ve(F=>Reflect.apply(qh,null,[F,...B]),()=>Za(...B),"number format",F=>F[rc](...B),am,F=>J(F)||Ie(F))}function mt(...B){return ve(F=>Reflect.apply(Uh,null,[F,...B]),()=>Xa(...B),"datetime format",F=>F[nc](...B),am,F=>J(F)||Ie(F))}function Pt(B){M=B,C.pluralRules=M}function cn(B,F){return ve(()=>{if(!B)return!1;const he=J(F)?F:a.value,v=qt(he),N=C.messageResolver(v,B);return It(N)||Dt(N)||J(N)},()=>[B],"translate exists",he=>Reflect.apply(he.te,he,[B,F]),EL,he=>be(he))}function qe(B){let F=null;const he=Th(C,c.value,a.value);for(let v=0;v<he.length;v++){const N=d.value[he[v]]||{},H=C.messageResolver(N,B);if(H!=null){F=H;break}}return F}function $t(B){const F=qe(B);return F??(e?e.tm(B)||{}:{})}function qt(B){return d.value[B]||{}}function dn(B,F){if(o){const he={[B]:F};for(const v in he)Kt(he,v)&&Do(he[v]);F=he[B]}d.value[B]=F,C.messages=d.value}function Xn(B,F){d.value[B]=d.value[B]||{};const he={[B]:F};if(o)for(const v in he)Kt(he,v)&&Do(he[v]);F=he[B],Sl(F,d.value[B]),C.messages=d.value}function _(B){return u.value[B]||{}}function S(B,F){u.value[B]=F,C.datetimeFormats=u.value,Kh(C,B,F)}function D(B,F){u.value[B]=We(u.value[B]||{},F),C.datetimeFormats=u.value,Kh(C,B,F)}function X(B){return f.value[B]||{}}function we(B,F){f.value[B]=F,C.numberFormats=f.value,Jh(C,B,F)}function Be(B,F){f.value[B]=We(f.value[B]||{},F),C.numberFormats=f.value,Jh(C,B,F)}cm++,e&&Wt&&(i.watch(e.locale,B=>{l&&(a.value=B,C.locale=B,Oo(C,a.value,c.value))}),i.watch(e.fallbackLocale,B=>{l&&(c.value=B,C.fallbackLocale=B,Oo(C,a.value,c.value))}));const pe={id:cm,locale:G,fallbackLocale:V,get inheritLocale(){return l},set inheritLocale(B){l=B,B&&e&&(a.value=e.locale.value,c.value=e.fallbackLocale.value,Oo(C,a.value,c.value))},get availableLocales(){return Object.keys(d.value).sort()},messages:O,get modifiers(){return E},get pluralRules(){return M||{}},get isGlobal(){return r},get missingWarn(){return p},set missingWarn(B){p=B,C.missingWarn=p},get fallbackWarn(){return h},set fallbackWarn(B){h=B,C.fallbackWarn=h},get fallbackRoot(){return m},set fallbackRoot(B){m=B},get fallbackFormat(){return g},set fallbackFormat(B){g=B,C.fallbackFormat=g},get warnHtmlMessage(){return w},set warnHtmlMessage(B){w=B,C.warnHtmlMessage=B},get escapeParameter(){return x},set escapeParameter(B){x=B,C.escapeParameter=B},t:pt,getLocaleMessage:qt,setLocaleMessage:dn,mergeLocaleMessage:Xn,getPostTranslationHandler:P,setPostTranslationHandler:K,getMissingHandler:U,setMissingHandler:re,[nm]:Pt};return pe.datetimeFormats=Y,pe.numberFormats=Q,pe.rt=St,pe.te=cn,pe.tm=$t,pe.d=Ft,pe.n=Ke,pe.getDateTimeFormat=_,pe.setDateTimeFormat=S,pe.mergeDateTimeFormat=D,pe.getNumberFormat=X,pe.setNumberFormat=we,pe.mergeNumberFormat=Be,pe[rm]=t,pe[tc]=vn,pe[nc]=mt,pe[rc]=xr,process.env.NODE_ENV!=="production"&&(pe[kr]=B=>{C.__v_emitter=B},pe[Io]=()=>{C.__v_emitter=void 0}),pe}const um="vue-i18n: composer properties",ic={"vue-devtools-plugin-vue-i18n":"Vue I18n DevTools","vue-i18n-resource-inspector":"Vue I18n DevTools","vue-i18n-timeline":"Vue I18n"},vL={"vue-i18n-resource-inspector":"Search for scopes ..."},_L={"vue-i18n-timeline":16764185};let ac;async function SL(n,e){return new Promise((t,r)=>{try{yL({id:"vue-devtools-plugin-vue-i18n",label:ic["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[um],app:n},o=>{ac=o,o.on.visitComponentTree(({componentInstance:l,treeNode:a})=>{NL(l,a,e)}),o.on.inspectComponent(({componentInstance:l,instanceData:a})=>{l.vnode.el&&l.vnode.el.__VUE_I18N__&&a&&(e.mode==="legacy"?l.vnode.el.__VUE_I18N__!==e.global.__composer&&pm(a,l.vnode.el.__VUE_I18N__):pm(a,l.vnode.el.__VUE_I18N__))}),o.addInspector({id:"vue-i18n-resource-inspector",label:ic["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:vL["vue-i18n-resource-inspector"]}),o.on.getInspectorTree(l=>{l.app===n&&l.inspectorId==="vue-i18n-resource-inspector"&&VL(l,e)});const s=new Map;o.on.getInspectorState(async l=>{if(l.app===n&&l.inspectorId==="vue-i18n-resource-inspector")if(o.unhighlightElement(),OL(l,e),l.nodeId==="global"){if(!s.has(l.app)){const[a]=await o.getComponentInstances(l.app);s.set(l.app,a)}o.highlightElement(s.get(l.app))}else{const a=LL(l.nodeId,e);a&&o.highlightElement(a)}}),o.on.editInspectorState(l=>{l.app===n&&l.inspectorId==="vue-i18n-resource-inspector"&&DL(l,e)}),o.addTimelineLayer({id:"vue-i18n-timeline",label:ic["vue-i18n-timeline"],color:_L["vue-i18n-timeline"]}),t(!0)})}catch(o){console.error(o),r(!1)}})}function fm(n){return n.type.name||n.type.displayName||n.type.__file||"Anonymous"}function NL(n,e,t){const r=t.mode==="composition"?t.global:t.global.__composer;if(n&&n.vnode.el&&n.vnode.el.__VUE_I18N__&&n.vnode.el.__VUE_I18N__!==r){const o={label:`i18n (${fm(n)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(o)}}function pm(n,e){const t=um;n.state.push({type:t,key:"locale",editable:!0,value:e.locale.value}),n.state.push({type:t,key:"availableLocales",editable:!1,value:e.availableLocales}),n.state.push({type:t,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),n.state.push({type:t,key:"inheritLocale",editable:!0,value:e.inheritLocale}),n.state.push({type:t,key:"messages",editable:!1,value:cc(e.messages.value)}),n.state.push({type:t,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),n.state.push({type:t,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function cc(n){const e={};return Object.keys(n).forEach(t=>{const r=n[t];Ne(r)&&"source"in r?e[t]=BL(r):It(r)&&r.loc&&r.loc.source?e[t]=r.loc.source:ye(r)?e[t]=cc(r):e[t]=r}),e}const ML={"<":"<",">":">",'"':""","&":"&"};function TL(n){return n.replace(/[<>"&]/g,AL)}function AL(n){return ML[n]||n}function BL(n){return{_custom:{type:"function",display:`<span>ƒ</span> ${n.source?`("${TL(n.source)}")`:"(?)"}`}}}function VL(n,e){n.rootNodes.push({id:"global",label:"Global Scope"});const t=e.mode==="composition"?e.global:e.global.__composer;for(const[r,o]of e.__instances){const s=e.mode==="composition"?o:o.__composer;t!==s&&n.rootNodes.push({id:s.id.toString(),label:`${fm(r)} Scope`})}}function LL(n,e){let t=null;if(n!=="global"){for(const[r,o]of e.__instances.entries())if(o.id.toString()===n){t=r;break}}return t}function hm(n,e){if(n==="global")return e.mode==="composition"?e.global:e.global.__composer;{const t=Array.from(e.__instances.values()).find(r=>r.id.toString()===n);return t?e.mode==="composition"?t:t.__composer:null}}function OL(n,e){const t=hm(n.nodeId,e);return t&&(n.state=IL(t)),null}function IL(n){const e={},t="Locale related info",r=[{type:t,key:"locale",editable:!0,value:n.locale.value},{type:t,key:"fallbackLocale",editable:!0,value:n.fallbackLocale.value},{type:t,key:"availableLocales",editable:!1,value:n.availableLocales},{type:t,key:"inheritLocale",editable:!0,value:n.inheritLocale}];e[t]=r;const o="Locale messages info",s=[{type:o,key:"messages",editable:!1,value:cc(n.messages.value)}];e[o]=s;{const l="Datetime formats info",a=[{type:l,key:"datetimeFormats",editable:!1,value:n.datetimeFormats.value}];e[l]=a;const c="Datetime formats info",d=[{type:c,key:"numberFormats",editable:!1,value:n.numberFormats.value}];e[c]=d}return e}function Ro(n,e){if(ac){let t;e&&"groupId"in e&&(t=e.groupId,delete e.groupId),ac.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:n,groupId:t,time:Date.now(),meta:{},data:e||{},logType:n==="compile-error"?"error":n==="fallback"||n==="missing"?"warning":"default"}})}}function DL(n,e){const t=hm(n.nodeId,e);if(t){const[r]=n.path;r==="locale"&&J(n.state.value)?t.locale.value=n.state.value:r==="fallbackLocale"&&(J(n.state.value)||Ie(n.state.value)||ye(n.state.value))?t.fallbackLocale.value=n.state.value:r==="inheritLocale"&&be(n.state.value)&&(t.inheritLocale=n.state.value)}}function RL(n){const e=J(n.locale)?n.locale:Lo,t=J(n.fallbackLocale)||Ie(n.fallbackLocale)||me(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:e,r=Ne(n.missing)?n.missing:void 0,o=be(n.silentTranslationWarn)||Fr(n.silentTranslationWarn)?!n.silentTranslationWarn:!0,s=be(n.silentFallbackWarn)||Fr(n.silentFallbackWarn)?!n.silentFallbackWarn:!0,l=be(n.fallbackRoot)?n.fallbackRoot:!0,a=!!n.formatFallbackMessages,c=me(n.modifiers)?n.modifiers:{},d=n.pluralizationRules,u=Ne(n.postTranslation)?n.postTranslation:void 0,f=J(n.warnHtmlInMessage)?n.warnHtmlInMessage!=="off":!0,p=!!n.escapeParameterHtml,h=be(n.sync)?n.sync:!0;let m=n.messages;if(me(n.sharedMessages)){const E=n.sharedMessages;m=Object.keys(E).reduce((C,A)=>{const z=C[A]||(C[A]={});return We(z,E[A]),C},m||{})}const{__i18n:g,__root:y,__injectWithOption:b}=n,k=n.datetimeFormats,w=n.numberFormats,x=n.flatJson;return{locale:e,fallbackLocale:t,messages:m,flatJson:x,datetimeFormats:k,numberFormats:w,missing:r,missingWarn:o,fallbackWarn:s,fallbackRoot:l,fallbackFormat:a,modifiers:c,pluralRules:d,postTranslation:u,warnHtmlMessage:f,escapeParameter:p,messageResolver:n.messageResolver,inheritLocale:h,__i18n:g,__root:y,__injectWithOption:b}}function dc(n={}){const e=lc(RL(n)),{__extender:t}=n,r={id:e.id,get locale(){return e.locale.value},set locale(o){e.locale.value=o},get fallbackLocale(){return e.fallbackLocale.value},set fallbackLocale(o){e.fallbackLocale.value=o},get messages(){return e.messages.value},get datetimeFormats(){return e.datetimeFormats.value},get numberFormats(){return e.numberFormats.value},get availableLocales(){return e.availableLocales},get missing(){return e.getMissingHandler()},set missing(o){e.setMissingHandler(o)},get silentTranslationWarn(){return be(e.missingWarn)?!e.missingWarn:e.missingWarn},set silentTranslationWarn(o){e.missingWarn=be(o)?!o:o},get silentFallbackWarn(){return be(e.fallbackWarn)?!e.fallbackWarn:e.fallbackWarn},set silentFallbackWarn(o){e.fallbackWarn=be(o)?!o:o},get modifiers(){return e.modifiers},get formatFallbackMessages(){return e.fallbackFormat},set formatFallbackMessages(o){e.fallbackFormat=o},get postTranslation(){return e.getPostTranslationHandler()},set postTranslation(o){e.setPostTranslationHandler(o)},get sync(){return e.inheritLocale},set sync(o){e.inheritLocale=o},get warnHtmlInMessage(){return e.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(o){e.warnHtmlMessage=o!=="off"},get escapeParameterHtml(){return e.escapeParameter},set escapeParameterHtml(o){e.escapeParameter=o},get pluralizationRules(){return e.pluralRules||{}},__composer:e,t(...o){return Reflect.apply(e.t,e,[...o])},rt(...o){return Reflect.apply(e.rt,e,[...o])},te(o,s){return e.te(o,s)},tm(o){return e.tm(o)},getLocaleMessage(o){return e.getLocaleMessage(o)},setLocaleMessage(o,s){e.setLocaleMessage(o,s)},mergeLocaleMessage(o,s){e.mergeLocaleMessage(o,s)},d(...o){return Reflect.apply(e.d,e,[...o])},getDateTimeFormat(o){return e.getDateTimeFormat(o)},setDateTimeFormat(o,s){e.setDateTimeFormat(o,s)},mergeDateTimeFormat(o,s){e.mergeDateTimeFormat(o,s)},n(...o){return Reflect.apply(e.n,e,[...o])},getNumberFormat(o){return e.getNumberFormat(o)},setNumberFormat(o,s){e.setNumberFormat(o,s)},mergeNumberFormat(o,s){e.mergeNumberFormat(o,s)}};return r.__extender=t,process.env.NODE_ENV!=="production"&&(r.__enableEmitter=o=>{const s=e;s[kr]&&s[kr](o)},r.__disableEmitter=()=>{const o=e;o[Io]&&o[Io]()}),r}function FL(n,e,t){return{beforeCreate(){const r=i.getCurrentInstance();if(!r)throw kt(Ae.UNEXPECTED_ERROR);const o=this.$options;if(o.i18n){const s=o.i18n;if(o.__i18n&&(s.__i18n=o.__i18n),s.__root=e,this===this.$root)this.$i18n=mm(n,s);else{s.__injectWithOption=!0,s.__extender=t.__vueI18nExtend,this.$i18n=dc(s);const l=this.$i18n;l.__extender&&(l.__disposer=l.__extender(this.$i18n))}}else if(o.__i18n)if(this===this.$root)this.$i18n=mm(n,o);else{this.$i18n=dc({__i18n:o.__i18n,__injectWithOption:!0,__extender:t.__vueI18nExtend,__root:e});const s=this.$i18n;s.__extender&&(s.__disposer=s.__extender(this.$i18n))}else this.$i18n=n;o.__i18nGlobal&&sm(e,o,o),this.$t=(...s)=>this.$i18n.t(...s),this.$rt=(...s)=>this.$i18n.rt(...s),this.$te=(s,l)=>this.$i18n.te(s,l),this.$d=(...s)=>this.$i18n.d(...s),this.$n=(...s)=>this.$i18n.n(...s),this.$tm=s=>this.$i18n.tm(s),t.__setInstance(r,this.$i18n)},mounted(){if(process.env.NODE_ENV!=="production"&&this.$el&&this.$i18n){const r=this.$i18n;this.$el.__VUE_I18N__=r.__composer;const o=this.__v_emitter=za();r.__enableEmitter&&r.__enableEmitter(o),o.on("*",Ro)}},unmounted(){const r=i.getCurrentInstance();if(!r)throw kt(Ae.UNEXPECTED_ERROR);const o=this.$i18n;process.env.NODE_ENV!=="production"&&this.$el&&this.$el.__VUE_I18N__&&(this.__v_emitter&&(this.__v_emitter.off("*",Ro),delete this.__v_emitter),this.$i18n&&(o.__disableEmitter&&o.__disableEmitter(),delete this.$el.__VUE_I18N__)),delete this.$t,delete this.$rt,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,o.__disposer&&(o.__disposer(),delete o.__disposer,delete o.__extender),t.__deleteInstance(r),delete this.$i18n}}}function mm(n,e){n.locale=e.locale||n.locale,n.fallbackLocale=e.fallbackLocale||n.fallbackLocale,n.missing=e.missing||n.missing,n.silentTranslationWarn=e.silentTranslationWarn||n.silentFallbackWarn,n.silentFallbackWarn=e.silentFallbackWarn||n.silentFallbackWarn,n.formatFallbackMessages=e.formatFallbackMessages||n.formatFallbackMessages,n.postTranslation=e.postTranslation||n.postTranslation,n.warnHtmlInMessage=e.warnHtmlInMessage||n.warnHtmlInMessage,n.escapeParameterHtml=e.escapeParameterHtml||n.escapeParameterHtml,n.sync=e.sync||n.sync,n.__composer[nm](e.pluralizationRules||n.pluralizationRules);const t=sc(n.locale,{messages:e.messages,__i18n:e.__i18n});return Object.keys(t).forEach(r=>n.mergeLocaleMessage(r,t[r])),e.datetimeFormats&&Object.keys(e.datetimeFormats).forEach(r=>n.mergeDateTimeFormat(r,e.datetimeFormats[r])),e.numberFormats&&Object.keys(e.numberFormats).forEach(r=>n.mergeNumberFormat(r,e.numberFormats[r])),n}const uc={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:n=>n==="parent"||n==="global",default:"parent"},i18n:{type:Object}};function PL({slots:n},e){return e.length===1&&e[0]==="default"?(n.default?n.default():[]).reduce((r,o)=>[...r,...o.type===i.Fragment?o.children:[o]],[]):e.reduce((t,r)=>{const o=n[r];return o&&(t[r]=o()),t},Ce())}function gm(){return i.Fragment}const ym=i.defineComponent({name:"i18n-t",props:We({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:n=>je(n)||!isNaN(n)}},uc),setup(n,e){const{slots:t,attrs:r}=e,o=n.i18n||fc({useScope:n.scope,__useComponent:!0});return()=>{const s=Object.keys(t).filter(f=>f[0]!=="_"),l=Ce();n.locale&&(l.locale=n.locale),n.plural!==void 0&&(l.plural=J(n.plural)?+n.plural:n.plural);const a=PL(e,s),c=o[tc](n.keypath,a,l),d=We(Ce(),r),u=J(n.tag)||ye(n.tag)?n.tag:gm();return i.h(u,d,c)}}});function $L(n){return Ie(n)&&!J(n[0])}function bm(n,e,t,r){const{slots:o,attrs:s}=e;return()=>{const l={part:!0};let a=Ce();n.locale&&(l.locale=n.locale),J(n.format)?l.key=n.format:ye(n.format)&&(J(n.format.key)&&(l.key=n.format.key),a=Object.keys(n.format).reduce((p,h)=>t.includes(h)?We(Ce(),p,{[h]:n.format[h]}):p,Ce()));const c=r(n.value,l,a);let d=[l.key];Ie(c)?d=c.map((p,h)=>{const m=o[p.type],g=m?m({[p.type]:p.value,index:h,parts:c}):[p.value];return $L(g)&&(g[0].key=`${p.type}-${h}`),g}):J(c)&&(d=[c]);const u=We(Ce(),s),f=J(n.tag)||ye(n.tag)?n.tag:gm();return i.h(f,u,d)}}const km=i.defineComponent({name:"i18n-n",props:We({value:{type:Number,required:!0},format:{type:[String,Object]}},uc),setup(n,e){const t=n.i18n||fc({useScope:n.scope,__useComponent:!0});return bm(n,e,Gh,(...r)=>t[rc](...r))}});function zL(n,e){const t=n;if(n.mode==="composition")return t.__getInstance(e)||n.global;{const r=t.__getInstance(e);return r!=null?r.__composer:n.global.__composer}}function HL(n){const e=l=>{process.env.NODE_ENV!=="production"&&Fa(jr(Rt.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE));const{instance:a,value:c}=l;if(!a||!a.$)throw kt(Ae.UNEXPECTED_ERROR);const d=zL(n,a.$),u=xm(c);return[Reflect.apply(d.t,d,[...wm(u)]),d]};return{created:(l,a)=>{const[c,d]=e(a);Wt&&n.global===d&&(l.__i18nWatcher=i.watch(d.locale,()=>{a.instance&&a.instance.$forceUpdate()})),l.__composer=d,l.textContent=c},unmounted:l=>{Wt&&l.__i18nWatcher&&(l.__i18nWatcher(),l.__i18nWatcher=void 0,delete l.__i18nWatcher),l.__composer&&(l.__composer=void 0,delete l.__composer)},beforeUpdate:(l,{value:a})=>{if(l.__composer){const c=l.__composer,d=xm(a);l.textContent=Reflect.apply(c.t,c,[...wm(d)])}},getSSRProps:l=>{const[a]=e(l);return{textContent:a}}}}function xm(n){if(J(n))return{path:n};if(me(n)){if(!("path"in n))throw kt(Ae.REQUIRED_VALUE,"path");return n}else throw kt(Ae.INVALID_VALUE)}function wm(n){const{path:e,locale:t,args:r,choice:o,plural:s}=n,l={},a=r||{};return J(t)&&(l.locale=t),je(o)&&(l.plural=o),je(s)&&(l.plural=s),[e,a,l]}function jL(n,e,...t){const r=me(t[0])?t[0]:{};(be(r.globalInstall)?r.globalInstall:!0)&&([ym.name,"I18nT"].forEach(s=>n.component(s,ym)),[km.name,"I18nN"].forEach(s=>n.component(s,km)),[Cm.name,"I18nD"].forEach(s=>n.component(s,Cm))),n.directive("t",HL(e))}const UL=nn("global-vue-i18n");function WL(n={}){const e=__VUE_I18N_LEGACY_API__&&be(n.legacy)?n.legacy:__VUE_I18N_LEGACY_API__;process.env.NODE_ENV!=="production"&&e&&Fa(jr(Rt.DEPRECATE_LEGACY_MODE));const t=be(n.globalInjection)?n.globalInjection:!0,r=new Map,[o,s]=KL(n,e),l=nn(process.env.NODE_ENV!=="production"?"vue-i18n":"");function a(f){return r.get(f)||null}function c(f,p){r.set(f,p)}function d(f){r.delete(f)}const u={get mode(){return __VUE_I18N_LEGACY_API__&&e?"legacy":"composition"},async install(f,...p){if(process.env.NODE_ENV!=="production"&&(f.__VUE_I18N__=u),f.__VUE_I18N_SYMBOL__=l,f.provide(f.__VUE_I18N_SYMBOL__,u),me(p[0])){const g=p[0];u.__composerExtend=g.__composerExtend,u.__vueI18nExtend=g.__vueI18nExtend}let h=null;!e&&t&&(h=eO(f,u.global)),__VUE_I18N_FULL_INSTALL__&&jL(f,u,...p),__VUE_I18N_LEGACY_API__&&e&&f.mixin(FL(s,s.__composer,u));const m=f.unmount;if(f.unmount=()=>{h&&h(),u.dispose(),m()},process.env.NODE_ENV!=="production"){if(!await SL(f,u))throw kt(Ae.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const y=za();if(e){const b=s;b.__enableEmitter&&b.__enableEmitter(y)}else{const b=s;b[kr]&&b[kr](y)}y.on("*",Ro)}},get global(){return s},dispose(){o.stop()},__instances:r,__getInstance:a,__setInstance:c,__deleteInstance:d};return u}function fc(n={}){const e=i.getCurrentInstance();if(e==null)throw kt(Ae.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw kt(Ae.NOT_INSTALLED);const t=qL(e),r=JL(t),o=om(e),s=GL(n,o);if(s==="global")return sm(r,n,o),r;if(s==="parent"){let c=YL(t,e,n.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&tn(jr(Rt.NOT_FOUND_PARENT_SCOPE)),c=r),c}const l=t;let a=l.__getInstance(e);if(a==null){const c=We({},n);"__i18n"in o&&(c.__i18n=o.__i18n),r&&(c.__root=r),a=lc(c),l.__composerExtend&&(a[oc]=l.__composerExtend(a)),ZL(l,e,a),l.__setInstance(e,a)}else process.env.NODE_ENV!=="production"&&s==="local"&&tn(jr(Rt.DUPLICATE_USE_I18N_CALLING));return a}function KL(n,e){const t=i.effectScope(),r=__VUE_I18N_LEGACY_API__&&e?t.run(()=>dc(n)):t.run(()=>lc(n));if(r==null)throw kt(Ae.UNEXPECTED_ERROR);return[t,r]}function qL(n){const e=i.inject(n.isCE?UL:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw kt(n.isCE?Ae.NOT_INSTALLED_WITH_PROVIDE:Ae.UNEXPECTED_ERROR);return e}function GL(n,e){return vl(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function JL(n){return n.mode==="composition"?n.global:n.global.__composer}function YL(n,e,t=!1){let r=null;const o=e.root;let s=XL(e,t);for(;s!=null;){const l=n;if(n.mode==="composition")r=l.__getInstance(s);else if(__VUE_I18N_LEGACY_API__){const a=l.__getInstance(s);a!=null&&(r=a.__composer,t&&r&&!r[rm]&&(r=null))}if(r!=null||o===s)break;s=s.parent}return r}function XL(n,e=!1){return n==null?null:e&&n.vnode.ctx||n.parent}function ZL(n,e,t){let r=null;i.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=t,r=za();const o=t;o[kr]&&o[kr](r),r.on("*",Ro)}},e),i.onUnmounted(()=>{const o=t;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(r&&r.off("*",Ro),o[Io]&&o[Io](),delete e.vnode.el.__VUE_I18N__),n.__deleteInstance(e);const s=o[oc];s&&(s(),delete o[oc])},e)}const QL=["locale","fallbackLocale","availableLocales"],Em=["t","rt","d","n","tm","te"];function eO(n,e){const t=Object.create(null);return QL.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s)throw kt(Ae.UNEXPECTED_ERROR);const l=i.isRef(s.value)?{get(){return s.value.value},set(a){s.value.value=a}}:{get(){return s.get&&s.get()}};Object.defineProperty(t,o,l)}),n.config.globalProperties.$i18n=t,Em.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s||!s.value)throw kt(Ae.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,`$${o}`,s)}),()=>{delete n.config.globalProperties.$i18n,Em.forEach(o=>{delete n.config.globalProperties[`$${o}`]})}}const Cm=i.defineComponent({name:"i18n-d",props:We({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},uc),setup(n,e){const t=n.i18n||fc({useScope:n.scope,__useComponent:!0});return bm(n,e,Wh,(...r)=>t[nc](...r))}});if(kL(),jV(wV),UV(FV),WV(Th),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const n=yr();n.__INTLIFY__=!0,EV(n.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const tO={},nO={},rO={paragraph:"Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",createTable:"Create Table",addColumn:"Add Column",addRow:"Add Row",deleteColumn:"Delete Column",deleteRow:"Delete Row",deleteTable:"Delete Table",linkTitle:"Enter Link",create:"Create",cancel:"Cancel"},oO={paragraph:"Звичайний текст",heading1:"Заголовок 1",heading2:"Заголовок 2",heading3:"Заголовок 3",heading4:"Заголовок 4",heading5:"Заголовок 5",heading6:"Заголовок 6",createTable:"Створити таблицю",addColumn:"Додати колонку",addRow:"Додати рядок",deleteColumn:"Видалити колонку",deleteRow:"Видалити рядок",deleteTable:"Видалити таблицю",linkTitle:"Введіть посилання",create:"Створити",cancel:"Скасувати"},pc=WL({legacy:!1,locale:"uk",fallbackLocale:"en",messages:{en:{...tO,tiptap:rO},uk:{...nO,tiptap:oO}}}),sO={install:(n,e={})=>{if(e.i18nConfig){const t=e.i18nConfig,r=pc.global?.messages?.value||pc.messages;r&&t.global?.messages?.value&&Object.keys(r).forEach(o=>{t.global.mergeLocaleMessage?t.global.mergeLocaleMessage(o,r[o]):t.global.setLocaleMessage(o,r[o])})}else n.use(pc);n.component("vs-richtext",El),n.component("vs-richtext-md",El),n.component("vs-richtext-page",ah)}};function Jn(n){return typeof n=="string"||n instanceof String}function vm(n){var e;return typeof n=="object"&&n!=null&&(n==null||(e=n.constructor)==null?void 0:e.name)==="Object"}function _m(n,e){return Array.isArray(e)?_m(n,(t,r)=>e.includes(r)):Object.entries(n).reduce((t,r)=>{let[o,s]=r;return e(s,o)&&(t[o]=s),t},{})}const ee={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Sm(n){switch(n){case ee.LEFT:return ee.FORCE_LEFT;case ee.RIGHT:return ee.FORCE_RIGHT;default:return n}}function hc(n){return n.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Vl(n,e){if(e===n)return!0;const t=Array.isArray(e),r=Array.isArray(n);let o;if(t&&r){if(e.length!=n.length)return!1;for(o=0;o<e.length;o++)if(!Vl(e[o],n[o]))return!1;return!0}if(t!=r)return!1;if(e&&n&&typeof e=="object"&&typeof n=="object"){const s=e instanceof Date,l=n instanceof Date;if(s&&l)return e.getTime()==n.getTime();if(s!=l)return!1;const a=e instanceof RegExp,c=n instanceof RegExp;if(a&&c)return e.toString()==n.toString();if(a!=c)return!1;const d=Object.keys(e);for(o=0;o<d.length;o++)if(!Object.prototype.hasOwnProperty.call(n,d[o]))return!1;for(o=0;o<d.length;o++)if(!Vl(n[d[o]],e[d[o]]))return!1;return!0}else if(e&&n&&typeof e=="function"&&typeof n=="function")return e.toString()===n.toString();return!1}class lO{constructor(e){for(Object.assign(this,e);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?ee.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?ee.RIGHT:ee.LEFT}}function ce(n,e){return new ce.InputMask(n,e)}function Nm(n){if(n==null)throw new Error("mask property should be defined");return n instanceof RegExp?ce.MaskedRegExp:Jn(n)?ce.MaskedPattern:n===Date?ce.MaskedDate:n===Number?ce.MaskedNumber:Array.isArray(n)||n===Array?ce.MaskedDynamic:ce.Masked&&n.prototype instanceof ce.Masked?n:ce.Masked&&n instanceof ce.Masked?n.constructor:n instanceof Function?ce.MaskedFunction:(console.warn("Mask not found for mask",n),ce.Masked)}function Ur(n){if(!n)throw new Error("Options in not defined");if(ce.Masked){if(n.prototype instanceof ce.Masked)return{mask:n};const{mask:e=void 0,...t}=n instanceof ce.Masked?{mask:n}:vm(n)&&n.mask instanceof ce.Masked?n:{};if(e){const r=e.mask;return{..._m(e,(o,s)=>!s.startsWith("_")),mask:e.constructor,_mask:r,...t}}}return vm(n)?{...n}:{mask:n}}function sn(n){if(ce.Masked&&n instanceof ce.Masked)return n;const e=Ur(n),t=Nm(e.mask);if(!t)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===t&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new t(e)}ce.createMask=sn;class Ll{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,t){if(!(e==null||t==null||e===this.selectionStart&&t===this.selectionEnd))try{this._unsafeSelect(e,t)}catch{}}get isActive(){return!1}}ce.MaskElement=Ll;const Mm=90,iO=89;class Fo extends Ll{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,t,r;return(e=(t=(r=this.input).getRootNode)==null?void 0:t.call(r))!=null?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===Mm&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===iO&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===Mm&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}ce.HTMLMaskElement=Fo;class Tm extends Fo{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,t){this.input.setSelectionRange(e,t)}get value(){return this.input.value}set value(e){this.input.value=e}}ce.HTMLMaskElement=Fo;class mc extends Fo{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),r=t&&t.anchorOffset,o=t&&t.focusOffset;return o==null||r==null||r<o?r:o}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),r=t&&t.anchorOffset,o=t&&t.focusOffset;return o==null||r==null||r>o?r:o}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const r=this.rootElement.createRange();r.setStart(this.input.firstChild||this.input,e),r.setEnd(this.input.lastChild||this.input,t);const o=this.rootElement,s=o.getSelection&&o.getSelection();s&&(s.removeAllRanges(),s.addRange(r))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}ce.HTMLContenteditableMaskElement=mc;class Ol{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>Ol.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}Ol.MAX_LENGTH=100;class Am{constructor(e,t){this.el=e instanceof Ll?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new mc(e):new Tm(e),this.masked=sn(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Ol,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var t;return e==null||((t=this.masked)==null?void 0:t.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof ce.Masked)&&this.masked.constructor===Nm(e)){this.masked.updateOptions({mask:e});return}const t=e instanceof ce.Masked?e:sn({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,t){const r=this._listeners[e];r&&r.forEach(o=>o(t))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){!this.el||!this.el.isActive||(this.el.select(e,e),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(e){const t=this.masked.unmaskedValue,r=this.masked.value,o=this.masked.rawInputValue,s=this.displayValue,l=this.unmaskedValue!==t||this.value!==r||this._rawInputValue!==o;this._unmaskedValue=t,this._value=r,this._rawInputValue=o,this.el.value!==s&&(this.el.value=s),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),l&&this._fireChangeEvents(),!this._historyChanging&&(l||this.history.isEmpty)&&this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...r}=e,o=!this.maskEquals(t),s=this.masked.optionsIsChanged(r);o&&(this.mask=t),s&&this.masked.updateOptions(r),(o||s)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,ee.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;if(!t)return delete this._listeners[e],this;const r=this._listeners[e].indexOf(t);return r>=0&&this._listeners[e].splice(r,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new lO({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),r=this.masked.rawInputValue,o=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,s=r===this.masked.rawInputValue?t.removeDirection:ee.NONE;let l=this.masked.nearestInputPos(t.startChangePos+o,s);s!==ee.NONE&&(l=this.masked.nearestInputPos(l,ee.NONE)),this.updateControl(l),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}ce.InputMask=Am;class de{static normalize(e){return Array.isArray(e)?e:[e,new de]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}ce.ChangeDetails=de;class ln{constructor(e,t,r){e===void 0&&(e=""),t===void 0&&(t=0),this.value=e,this.from=t,this.stop=r}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const t=this.value[0];return this.value=this.value.slice(1),t}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class nt{constructor(e){this._value="",this._update({...nt.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,t){t===void 0&&(t={input:!0}),this.reset(),this.append(e,t,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,t){return e}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),Math.min(this.displayValue.length,t-e)}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),this.displayValue.slice(e,t)}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new ln(this.extractInput(e,t),e)}appendTail(e){return Jn(e)&&(e=new ln(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new de({inserted:e,rawInserted:e})):new de}_appendChar(e,t,r){t===void 0&&(t={});const o=this.state;let s;if([e,s]=this.doPrepareChar(e,t),e&&(s=s.aggregate(this._appendCharRaw(e,t)),!s.rawInserted&&this.autofix==="pad")){const l=this.state;this.state=o;let a=this.pad(t);const c=this._appendCharRaw(e,t);a=a.aggregate(c),c.rawInserted||a.equals(s)?s=a:this.state=l}if(s.inserted){let l,a=this.doValidate(t)!==!1;if(a&&r!=null){const c=this.state;if(this.overwrite===!0){l=r.state;for(let u=0;u<s.rawInserted.length;++u)r.unshift(this.displayValue.length-s.tailShift)}let d=this.appendTail(r);if(a=d.rawInserted.length===r.toString().length,!(a&&d.inserted)&&this.overwrite==="shift"){this.state=c,l=r.state;for(let u=0;u<s.rawInserted.length;++u)r.shift();d=this.appendTail(r),a=d.rawInserted.length===r.toString().length}a&&d.inserted&&(this.state=c)}a||(s=new de,this.state=o,r&&l&&(r.state=l))}return s}_appendPlaceholder(){return new de}_appendEager(){return new de}append(e,t,r){if(!Jn(e))throw new Error("value should be string");const o=Jn(r)?new ln(String(r)):r;t!=null&&t.tail&&(t._beforeTailState=this.state);let s;[e,s]=this.doPrepare(e,t);for(let l=0;l<e.length;++l){const a=this._appendChar(e[l],t,o);if(!a.rawInserted&&!this.doSkipInvalid(e[l],t,o))break;s.aggregate(a)}return(this.eager===!0||this.eager==="append")&&t!=null&&t.input&&e&&s.aggregate(this._appendEager()),o!=null&&(s.tailShift+=this.appendTail(o).tailShift),s}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(t),new de}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,r=this.value,o=e();return this.rawInputValue=t,this.value&&this.value!==r&&r.indexOf(this.value)===0&&(this.append(r.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,o}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,r=e(this);return this.state=t,delete this._isolated,r}doSkipInvalid(e,t,r){return!!this.skipInvalid}doPrepare(e,t){return t===void 0&&(t={}),de.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return t===void 0&&(t={}),de.normalize(this.prepareChar?this.prepareChar(e,this,t):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,t,r,o,s){r===void 0&&(r=""),o===void 0&&(o=ee.NONE),s===void 0&&(s={input:!0});const l=e+t,a=this.extractTail(l),c=this.eager===!0||this.eager==="remove";let d;c&&(o=Sm(o),d=this.extractInput(0,l,{raw:!0}));let u=e;const f=new de;if(o!==ee.NONE&&(u=this.nearestInputPos(e,t>1&&e!==0&&!c?ee.NONE:o),f.tailShift=u-e),f.aggregate(this.remove(u)),c&&o!==ee.NONE&&d===this.rawInputValue)if(o===ee.FORCE_LEFT){let p;for(;d===this.rawInputValue&&(p=this.displayValue.length);)f.aggregate(new de({tailShift:-1})).aggregate(this.remove(p-1))}else o===ee.FORCE_RIGHT&&a.unshift();return f.aggregate(this.append(r,s,a))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!Vl(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||nt.EMPTY_VALUES.includes(e)&&nt.EMPTY_VALUES.includes(t)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new de}}nt.DEFAULTS={skipInvalid:!0},nt.EMPTY_VALUES=[void 0,null,""],ce.Masked=nt;class Yn{constructor(e,t){e===void 0&&(e=[]),t===void 0&&(t=0),this.chunks=e,this.from=t}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=Jn(e)?new ln(String(e)):e;const t=this.chunks[this.chunks.length-1],r=t&&(t.stop===e.stop||e.stop==null)&&e.from===t.from+t.toString().length;if(e instanceof ln)r?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof Yn){if(e.stop==null){let o;for(;e.chunks.length&&e.chunks[0].stop==null;)o=e.chunks.shift(),o.from+=e.from,this.extend(o)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof ce.MaskedPattern))return new ln(this.toString()).appendTo(e);const t=new de;for(let r=0;r<this.chunks.length;++r){const o=this.chunks[r],s=e._mapPosToBlock(e.displayValue.length),l=o.stop;let a;if(l!=null&&(!s||s.index<=l)&&((o instanceof Yn||e._stops.indexOf(l)>=0)&&t.aggregate(e._appendPlaceholder(l)),a=o instanceof Yn&&e._blocks[l]),a){const c=a.appendTail(o);t.aggregate(c);const d=o.toString().slice(c.rawInserted.length);d&&t.aggregate(e.append(d,{tail:!0}))}else t.aggregate(e.append(o.toString(),{tail:!0}))}return t}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:t,...r}=e;Object.assign(this,r),this.chunks=t.map(o=>{const s="chunks"in o?new Yn:new ln;return s.state=o,s})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const t=e!=null?e-this.from:e;let r=0;for(;r<this.chunks.length;){const o=this.chunks[r],s=o.unshift(t);if(o.toString()){if(!s)break;++r}else this.chunks.splice(r,1);if(s)return s}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const t=this.chunks[e],r=t.shift();if(t.toString()){if(!r)break;--e}else this.chunks.splice(e,1);if(r)return r}return""}}class aO{constructor(e,t){this.masked=e,this._log=[];const{offset:r,index:o}=e._mapPosToBlock(t)||(t<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=r,this.index=o,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((t=this.block)==null?void 0:t.displayValue.length)||0){var t;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,ee.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,ee.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,ee.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,ee.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,ee.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,ee.NONE),!0})}}class gc{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(t),this._value||(this._isRawInput=!1),new de}nearestInputPos(e,t){t===void 0&&(t=ee.NONE);const r=0,o=this._value.length;switch(t){case ee.LEFT:case ee.FORCE_LEFT:return r;case ee.NONE:case ee.RIGHT:case ee.FORCE_RIGHT:default:return o}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),r===void 0&&(r={}),r.raw&&this._isRawInput&&this._value.slice(e,t)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,t){if(t===void 0&&(t={}),this.isFilled)return new de;const r=this.eager===!0||this.eager==="append",o=this.char===e&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!r)&&!t.tail,s=new de({inserted:this.char,rawInserted:o?this.char:""});return this._value=this.char,this._isRawInput=o&&(t.raw||t.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new de;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new ln("")}appendTail(e){return Jn(e)&&(e=new ln(String(e))),e.appendTo(this)}append(e,t,r){const o=this._appendChar(e[0],t);return r!=null&&(o.tailShift+=this.appendTail(r).tailShift),o}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}pad(e){return this._appendPlaceholder()}}class Po{constructor(e){const{parent:t,isOptional:r,placeholderChar:o,displayChar:s,lazy:l,eager:a,...c}=e;this.masked=sn(c),Object.assign(this,{parent:t,isOptional:r,placeholderChar:o,displayChar:s,lazy:l,eager:a})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),e===0&&t>=1?(this.isFilled=!1,this.masked.remove(e,t)):new de}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(e,t){if(t===void 0&&(t={}),this.isFilled)return new de;const r=this.masked.state;let o=this.masked._appendChar(e,this.currentMaskFlags(t));return o.inserted&&this.doValidate(t)===!1&&(o=new de,this.masked.state=r),!o.inserted&&!this.isOptional&&!this.lazy&&!t.input&&(o.inserted=this.placeholderChar),o.skip=!o.inserted&&!this.isOptional,this.isFilled=!!o.inserted,o}append(e,t,r){return this.masked.append(e,this.currentMaskFlags(t),r)}_appendPlaceholder(){return this.isFilled||this.isOptional?new de:(this.isFilled=!0,new de({inserted:this.placeholderChar}))}_appendEager(){return new de}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.masked.extractInput(e,t,r)}nearestInputPos(e,t){t===void 0&&(t=ee.NONE);const r=0,o=this.value.length,s=Math.min(Math.max(e,r),o);switch(t){case ee.LEFT:case ee.FORCE_LEFT:return this.isComplete?s:r;case ee.RIGHT:case ee.FORCE_RIGHT:return this.isComplete?s:o;case ee.NONE:default:return s}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.value.slice(e,t).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var t;return{...e,_beforeTailState:(e==null||(t=e._beforeTailState)==null?void 0:t.masked)||e?._beforeTailState}}pad(e){return new de}}Po.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class Bm extends nt{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=r=>r.search(t)>=0),super._update(e)}}ce.MaskedRegExp=Bm;class rt extends nt{constructor(e){super({...rt.DEFAULTS,...e,definitions:Object.assign({},Po.DEFAULT_DEFINITIONS,e?.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const t=this.mask;if(!t||!e)return;let r=!1,o=!1;for(let s=0;s<t.length;++s){if(this.blocks){const d=t.slice(s),u=Object.keys(this.blocks).filter(p=>d.indexOf(p)===0);u.sort((p,h)=>h.length-p.length);const f=u[0];if(f){const{expose:p,repeat:h,...m}=Ur(this.blocks[f]),g={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...m,repeat:h,parent:this},y=h!=null?new ce.RepeatBlock(g):sn(g);y&&(this._blocks.push(y),p&&(this.exposeBlock=y),this._maskedBlocks[f]||(this._maskedBlocks[f]=[]),this._maskedBlocks[f].push(this._blocks.length-1)),s+=f.length-1;continue}}let l=t[s],a=l in e;if(l===rt.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(l==="{"||l==="}"){r=!r;continue}if(l==="["||l==="]"){o=!o;continue}if(l===rt.ESCAPE_CHAR){if(++s,l=t[s],!l)break;a=!1}const c=a?new Po({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...Ur(e[l]),parent:this}):new gc({char:l,eager:this.eager,isUnmasking:r});this._blocks.push(c)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:t,...r}=e;this._blocks.forEach((o,s)=>o.state=t[s]),super.state=r}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,t)=>e+=t.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(t),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,t)=>e+=t.value,"")}set value(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(t),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(t),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,t)=>e+=t.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const t=new de;let r=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(r==null)return t;this._blocks[r].isFilled&&++r;for(let o=r;o<this._blocks.length;++o){const s=this._blocks[o]._appendEager();if(!s.inserted)break;t.aggregate(s)}return t}_appendCharRaw(e,t){t===void 0&&(t={});const r=this._mapPosToBlock(this.displayValue.length),o=new de;if(!r)return o;for(let l=r.index,a;a=this._blocks[l];++l){var s;const c=a._appendChar(e,{...t,_beforeTailState:(s=t._beforeTailState)==null||(s=s._blocks)==null?void 0:s[l]});if(o.aggregate(c),c.consumed)break}return o}extractTail(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=new Yn;return e===t||this._forEachBlocksInRange(e,t,(o,s,l,a)=>{const c=o.extractTail(l,a);c.stop=this._findStopBefore(s),c.from=this._blockStartPos(s),c instanceof Yn&&(c.blockIndex=s),r.extend(c)}),r}extractInput(e,t,r){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),r===void 0&&(r={}),e===t)return"";let o="";return this._forEachBlocksInRange(e,t,(s,l,a,c)=>{o+=s.extractInput(a,c,r)}),o}_findStopBefore(e){let t;for(let r=0;r<this._stops.length;++r){const o=this._stops[r];if(o<=e)t=o;else break}return t}_appendPlaceholder(e){const t=new de;if(this.lazy&&e==null)return t;const r=this._mapPosToBlock(this.displayValue.length);if(!r)return t;const o=r.index,s=e??this._blocks.length;return this._blocks.slice(o,s).forEach(l=>{if(!l.lazy||e!=null){var a;t.aggregate(l._appendPlaceholder((a=l._blocks)==null?void 0:a.length))}}),t}_mapPosToBlock(e){let t="";for(let r=0;r<this._blocks.length;++r){const o=this._blocks[r],s=t.length;if(t+=o.displayValue,e<=t.length)return{index:r,offset:e-s}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((t,r)=>t+=r.displayValue.length,0)}_forEachBlocksInRange(e,t,r){t===void 0&&(t=this.displayValue.length);const o=this._mapPosToBlock(e);if(o){const s=this._mapPosToBlock(t),l=s&&o.index===s.index,a=o.offset,c=s&&l?s.offset:this._blocks[o.index].displayValue.length;if(r(this._blocks[o.index],o.index,a,c),s&&!l){for(let d=o.index+1;d<s.index;++d)r(this._blocks[d],d,0,this._blocks[d].displayValue.length);r(this._blocks[s.index],s.index,0,s.offset)}}}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=super.remove(e,t);return this._forEachBlocksInRange(e,t,(o,s,l,a)=>{r.aggregate(o.remove(l,a))}),r}nearestInputPos(e,t){if(t===void 0&&(t=ee.NONE),!this._blocks.length)return 0;const r=new aO(this,e);if(t===ee.NONE)return r.pushRightBeforeInput()||(r.popState(),r.pushLeftBeforeInput())?r.pos:this.displayValue.length;if(t===ee.LEFT||t===ee.FORCE_LEFT){if(t===ee.LEFT){if(r.pushRightBeforeFilled(),r.ok&&r.pos===e)return e;r.popState()}if(r.pushLeftBeforeInput(),r.pushLeftBeforeRequired(),r.pushLeftBeforeFilled(),t===ee.LEFT){if(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.ok&&r.pos<=e||(r.popState(),r.ok&&r.pos<=e))return r.pos;r.popState()}return r.ok?r.pos:t===ee.FORCE_LEFT?0:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:0)}return t===ee.RIGHT||t===ee.FORCE_RIGHT?(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.pushRightBeforeFilled()?r.pos:t===ee.FORCE_RIGHT?this.displayValue.length:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:this.nearestInputPos(e,ee.LEFT))):e}totalInputPositions(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);let r=0;return this._forEachBlocksInRange(e,t,(o,s,l,a)=>{r+=o.totalInputPositions(l,a)}),r}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map(r=>this._blocks[r]):[]}pad(e){const t=new de;return this._forEachBlocksInRange(0,this.displayValue.length,r=>t.aggregate(r.pad(e))),t}}rt.DEFAULTS={...nt.DEFAULTS,lazy:!0,placeholderChar:"_"},rt.STOP_CHAR="`",rt.ESCAPE_CHAR="\\",rt.InputDefinition=Po,rt.FixedDefinition=gc,ce.MaskedPattern=rt;class $o extends rt{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:t=this.to||0,from:r=this.from||0,maxLength:o=this.maxLength||0,autofix:s=this.autofix,...l}=e;this.to=t,this.from=r,this.maxLength=Math.max(String(t).length,o),this.autofix=s;const a=String(this.from).padStart(this.maxLength,"0"),c=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<c.length&&c[d]===a[d];)++d;l.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(l)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let t="",r="";const[,o,s]=e.match(/^(\D*)(\d*)(\D*)/)||[];return s&&(t="0".repeat(o.length)+s,r="9".repeat(o.length)+s),t=t.padEnd(this.maxLength,"0"),r=r.padEnd(this.maxLength,"9"),[t,r]}doPrepareChar(e,t){t===void 0&&(t={});let r;return[e,r]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(r.skip=!this.isComplete),[e,r]}_appendCharRaw(e,t){if(t===void 0&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const r=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[s,l]=this.boundaries(this.value+e);return Number(l)<this.from?super._appendCharRaw(r[this.value.length],t):Number(s)>this.to?!t.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(r[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(o[this.value.length],t):super._appendCharRaw(e,t)}doValidate(e){const t=this.value;if(t.search(/[^0]/)===-1&&t.length<=this._matchFrom)return!0;const[r,o]=this.boundaries(t);return this.from<=Number(o)&&Number(r)<=this.to&&super.doValidate(e)}pad(e){const t=new de;if(this.value.length===this.maxLength)return t;const r=this.value,o=this.maxLength-this.value.length;if(o){this.reset();for(let s=0;s<o;++s)t.aggregate(super._appendCharRaw("0",e));r.split("").forEach(s=>this._appendCharRaw(s))}return t}}ce.MaskedRange=$o;const cO="d{.}`m{.}`Y";class an extends rt{static extractPatternOptions(e){const{mask:t,pattern:r,...o}=e;return{...o,mask:Jn(t)?t:r}}constructor(e){super(an.extractPatternOptions({...an.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:r,blocks:o,...s}={...an.DEFAULTS,...e},l=Object.assign({},an.GET_DEFAULT_BLOCKS());e.min&&(l.Y.from=e.min.getFullYear()),e.max&&(l.Y.to=e.max.getFullYear()),e.min&&e.max&&l.Y.from===l.Y.to&&(l.m.from=e.min.getMonth()+1,l.m.to=e.max.getMonth()+1,l.m.from===l.m.to&&(l.d.from=e.min.getDate(),l.d.to=e.max.getDate())),Object.assign(l,this.blocks,o),super._update({...s,mask:Jn(t)?t:r,blocks:l})}doValidate(e){const t=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&t!=null&&(this.min==null||this.min<=t)&&(this.max==null||t<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(an.extractPatternOptions(e))}}an.GET_DEFAULT_BLOCKS=()=>({d:{mask:$o,from:1,to:31,maxLength:2},m:{mask:$o,from:1,to:12,maxLength:2},Y:{mask:$o,from:1900,to:9999}}),an.DEFAULTS={...rt.DEFAULTS,mask:Date,pattern:cO,format:(n,e)=>{if(!n)return"";const t=String(n.getDate()).padStart(2,"0"),r=String(n.getMonth()+1).padStart(2,"0"),o=n.getFullYear();return[t,r,o].join(".")},parse:(n,e)=>{const[t,r,o]=n.split(".").map(Number);return new Date(o,r-1,t)}},ce.MaskedDate=an;class zo extends nt{constructor(e){super({...zo.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(t=>{const{expose:r,...o}=Ur(t),s=sn({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return r&&(this.exposeMask=s),s}):[])}_appendCharRaw(e,t){t===void 0&&(t={});const r=this._applyDispatch(e,t);return this.currentMask&&r.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),r}_applyDispatch(e,t,r){e===void 0&&(e=""),t===void 0&&(t={}),r===void 0&&(r="");const o=t.tail&&t._beforeTailState!=null?t._beforeTailState._value:this.value,s=this.rawInputValue,l=t.tail&&t._beforeTailState!=null?t._beforeTailState._rawInputValue:s,a=s.slice(l.length),c=this.currentMask,d=new de,u=c?.state;return this.currentMask=this.doDispatch(e,{...t},r),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),l&&(this.currentMask.append(l,{raw:!0}),d.tailShift=this.currentMask.value.length-o.length),a&&(d.tailShift+=this.currentMask.append(a,{raw:!0,tail:!0}).tailShift)):u&&(this.currentMask.state=u)),d}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const t=new de;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,r;return{...e,_beforeTailState:((t=e._beforeTailState)==null?void 0:t.currentMaskRef)===this.currentMask&&((r=e._beforeTailState)==null?void 0:r.currentMask)||e._beforeTailState}}doDispatch(e,t,r){return t===void 0&&(t={}),r===void 0&&(r=""),this.dispatch(e,this,t,r)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){t===void 0&&(t={});let[r,o]=super.doPrepare(e,t);if(this.currentMask){let s;[r,s]=super.doPrepare(r,this.currentMaskFlags(t)),o=o.aggregate(s)}return[r,o]}doPrepareChar(e,t){t===void 0&&(t={});let[r,o]=super.doPrepareChar(e,t);if(this.currentMask){let s;[r,s]=super.doPrepareChar(r,this.currentMaskFlags(t)),o=o.aggregate(s)}return[r,o]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let t=String(e);this.currentMask&&(this.currentMask.typedValue=e,t=this.currentMask.unmaskedValue),this.unmaskedValue=t}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e,t){const r=new de;return this.currentMask&&r.aggregate(this.currentMask.remove(e,t)).aggregate(this._applyDispatch()),r}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(t=>t.state),currentMaskRef:this.currentMask,currentMask:(e=this.currentMask)==null?void 0:e.state}}set state(e){const{compiledMasks:t,currentMaskRef:r,currentMask:o,...s}=e;t&&this.compiledMasks.forEach((l,a)=>l.state=t[a]),r!=null&&(this.currentMask=r,this.currentMask.state=o),super.state=s}extractInput(e,t,r){return this.currentMask?this.currentMask.extractInput(e,t,r):""}extractTail(e,t){return this.currentMask?this.currentMask.extractTail(e,t):super.extractTail(e,t)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,t){return this.currentMask?this.currentMask.nearestInputPos(e,t):super.nearestInputPos(e,t)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((t,r)=>{if(!e[r])return;const{mask:o,...s}=e[r];return Vl(t,s)&&t.maskEquals(o)}):super.maskEquals(e)}typedValueEquals(e){var t;return!!((t=this.currentMask)!=null&&t.typedValueEquals(e))}}zo.DEFAULTS={...nt.DEFAULTS,dispatch:(n,e,t,r)=>{if(!e.compiledMasks.length)return;const o=e.rawInputValue,s=e.compiledMasks.map((l,a)=>{const c=e.currentMask===l,d=c?l.displayValue.length:l.nearestInputPos(l.displayValue.length,ee.FORCE_LEFT);return l.rawInputValue!==o?(l.reset(),l.append(o,{raw:!0})):c||l.remove(d),l.append(n,e.currentMaskFlags(t)),l.appendTail(r),{index:a,weight:l.rawInputValue.length,totalInputPositions:l.totalInputPositions(0,Math.max(d,l.nearestInputPos(l.displayValue.length,ee.FORCE_LEFT)))}});return s.sort((l,a)=>a.weight-l.weight||a.totalInputPositions-l.totalInputPositions),e.compiledMasks[s[0].index]}},ce.MaskedDynamic=zo;class Ho extends rt{constructor(e){super({...Ho.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:t,...r}=e;if(t){const o=t.map(a=>a.length),s=Math.min(...o),l=Math.max(...o)-s;r.mask="*".repeat(s),l&&(r.mask+="["+"*".repeat(l)+"]"),this.enum=t}super._update(r)}_appendCharRaw(e,t){t===void 0&&(t={});const r=Math.min(this.nearestInputPos(0,ee.FORCE_RIGHT),this.value.length),o=this.enum.filter(s=>this.matchValue(s,this.unmaskedValue+e,r));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(l,a)=>{const c=o[0][a];a>=this.value.length||c===l.value||(l.reset(),l._appendChar(c,t))});const s=super._appendCharRaw(o[0][this.value.length],t);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(l=>s.aggregate(super._appendCharRaw(l))),s}return new de({skip:!this.isComplete})}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new ln("",e)}remove(e,t){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),e===t)return new de;const r=Math.min(super.nearestInputPos(0,ee.FORCE_RIGHT),this.value.length);let o;for(o=e;o>=0&&!(this.enum.filter(l=>this.matchValue(l,this.value.slice(r,o),r)).length>1);--o);const s=super.remove(o,t);return s.tailShift+=o-e,s}get isComplete(){return this.enum.indexOf(this.value)>=0}}Ho.DEFAULTS={...rt.DEFAULTS,matchValue:(n,e,t)=>n.indexOf(e,t)===t},ce.MaskedEnum=Ho;class Vm extends nt{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}ce.MaskedFunction=Vm;var Lm;class xt extends nt{constructor(e){super({...xt.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),t="\\d*",r=(this.scale?"("+hc(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+t+r),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(hc).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(hc(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepareChar(e,t){t===void 0&&(t={});const[r,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(t.input&&t.raw||!t.input&&!t.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),t);return e&&!r&&(o.skip=!0),r&&!this.allowPositive&&!this.value&&r!=="-"&&o.aggregate(this._appendChar("-")),[r,o]}_separatorsCount(e,t){t===void 0&&(t=!1);let r=0;for(let o=0;o<e;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++r,t&&(e+=this.thousandsSeparator.length));return r}_separatorsCountFromSlice(e){return e===void 0&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t),this._removeThousandsSeparators(super.extractInput(e,t,r))}_appendCharRaw(e,t){t===void 0&&(t={});const r=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(r);this._value=this._removeThousandsSeparators(this.value);const s=this._value;this._value+=e;const l=this.number;let a=!isNaN(l),c=!1;if(a){let p;this.min!=null&&this.min<0&&this.number<this.min&&(p=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(p=this.max),p!=null&&(this.autofix?(this._value=this.format(p,this).replace(xt.UNMASKED_RADIX,this.radix),c||(c=s===this._value&&!t.tail)):a=!1),a&&(a=!!this._value.match(this._numberRegExp))}let d;a?d=new de({inserted:this._value.slice(s.length),rawInserted:c?"":e,skip:c}):(this._value=s,d=new de),this._value=this._insertThousandsSeparators(this._value);const u=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,f=this._separatorsCountFromSlice(u);return d.tailShift+=(f-o)*this.thousandsSeparator.length,d}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,r=this.value.indexOf(this.thousandsSeparator,t);if(r<=e)return r}return-1}_adjustRangeWithSeparators(e,t){const r=this._findSeparatorAround(e);r>=0&&(e=r);const o=this._findSeparatorAround(t);return o>=0&&(t=o+this.thousandsSeparator.length),[e,t]}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t);const r=this.value.slice(0,e),o=this.value.slice(t),s=this._separatorsCount(r.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(r+o));const l=this._separatorsCountFromSlice(r);return new de({tailShift:(l-s)*this.thousandsSeparator.length})}nearestInputPos(e,t){if(!this.thousandsSeparator)return e;switch(t){case ee.NONE:case ee.LEFT:case ee.FORCE_LEFT:{const r=this._findSeparatorAround(e-1);if(r>=0){const o=r+this.thousandsSeparator.length;if(e<o||this.value.length<=o||t===ee.FORCE_LEFT)return r}break}case ee.RIGHT:case ee.FORCE_RIGHT:{const r=this._findSeparatorAround(e);if(r>=0)return r+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let t=e;this.min!=null&&(t=Math.max(t,this.min)),this.max!=null&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=this.format(t,this));let r=this.value;this.normalizeZeros&&(r=this._normalizeZeros(r)),this.padFractionalZeros&&this.scale>0&&(r=this._padFractionalZeros(r)),this._value=r}super.doCommit()}_normalizeZeros(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,(r,o,s,l)=>o+l),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}doSkipInvalid(e,t,r){t===void 0&&(t={});const o=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===xt.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,r)&&!o}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,xt.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(xt.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(e){return(super.typedValueEquals(e)||xt.EMPTY_VALUES.includes(e)&&xt.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}Lm=xt,xt.UNMASKED_RADIX=".",xt.EMPTY_VALUES=[...nt.EMPTY_VALUES,0],xt.DEFAULTS={...nt.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Lm.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:n=>n.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},ce.MaskedNumber=xt;const Il={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function yc(n,e,t){e===void 0&&(e=Il.MASKED),t===void 0&&(t=Il.MASKED);const r=sn(n);return o=>r.runIsolated(s=>(s[e]=o,s[t]))}function Om(n,e,t,r){return yc(e,t,r)(n)}ce.PIPE_TYPE=Il,ce.createPipe=yc,ce.pipe=Om;class Im extends rt{get repeatFrom(){var e;return(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?e:0}get repeatTo(){var e;return(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var t,r,o;const{repeat:s,...l}=Ur(e);this._blockOpts=Object.assign({},this._blockOpts,l);const a=sn(this._blockOpts);this.repeat=(t=(r=s??a.repeat)!=null?r:this.repeat)!=null?t:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((o=this._blocks)==null?void 0:o.length)||0,this.repeatFrom)),blocks:{m:a},eager:a.eager,overwrite:a.overwrite,skipInvalid:a.skipInvalid,lazy:a.lazy,placeholderChar:a.placeholderChar,displayChar:a.displayChar})}_allocateBlock(e){if(e<this._blocks.length)return this._blocks[e];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(sn(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(e,t){t===void 0&&(t={});const r=new de;for(let c=(o=(s=this._mapPosToBlock(this.displayValue.length))==null?void 0:s.index)!=null?o:Math.max(this._blocks.length-1,0),d,u;d=(l=this._blocks[c])!=null?l:u=!u&&this._allocateBlock(c);++c){var o,s,l,a;const f=d._appendChar(e,{...t,_beforeTailState:(a=t._beforeTailState)==null||(a=a._blocks)==null?void 0:a[c]});if(f.skip&&u){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(r.aggregate(f),f.consumed)break}return r}_trimEmptyTail(e,t){var r,o;e===void 0&&(e=0);const s=Math.max(((r=this._mapPosToBlock(e))==null?void 0:r.index)||0,this.repeatFrom,0);let l;t!=null&&(l=(o=this._mapPosToBlock(t))==null?void 0:o.index),l==null&&(l=this._blocks.length-1);let a=0;for(let c=l;s<=c&&!this._blocks[c].unmaskedValue;--c,++a);a&&(this._blocks.splice(l-a+1,a),this.mask=this.mask.slice(a))}reset(){super.reset(),this._trimEmptyTail()}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=super.remove(e,t);return this._trimEmptyTail(e,t),r}totalInputPositions(e,t){return e===void 0&&(e=0),t==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,t)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}}ce.RepeatBlock=Im;try{globalThis.IMask=ce}catch{}const dO=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:de,ChunksTailDetails:Yn,DIRECTION:ee,HTMLContenteditableMaskElement:mc,HTMLInputMaskElement:Tm,HTMLMaskElement:Fo,InputMask:Am,MaskElement:Ll,Masked:nt,MaskedDate:an,MaskedDynamic:zo,MaskedEnum:Ho,MaskedFunction:Vm,MaskedNumber:xt,MaskedPattern:rt,MaskedRange:$o,MaskedRegExp:Bm,PIPE_TYPE:Il,PatternFixedDefinition:gc,PatternInputDefinition:Po,RepeatBlock:Im,createMask:sn,createPipe:yc,default:ce,forceDirection:Sm,normalizeOpts:Ur,pipe:Om},Symbol.toStringTag,{value:"Module"}));Gt.VsRichtext=El,Gt.VsRichtextMd=El,Gt.VsRichtextPage=ah,Gt.default=sO,Object.defineProperties(Gt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|