PageSourceSearch

https://app.rankprompt.com/assets/vendor-editor-CTSc4oA7.js

js rankprompt.com collected 2026-09-29 14:16:25 UTC 523,745 bytes, 154 lines download raw bytes

1import{a as Qc,g as Hh,b as Ds,j as $e,r as P,R as ut,d as Fh}from"./vendor-react-BOt3JsBl.js";import{d as Vh}from"./vendor-charts-BHEyC1_A.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"rankprompt-frontend@1790182965787"};var e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="da20cd35-ce6e-4831-871a-3eec2bc0e4be",t._sentryDebugIdIdentifier="sentry-dbid-da20cd35-ce6e-4831-871a-3eec2bc0e4be")}catch{}})();var io={exports:{}},oo={};var $l;function Wh(){if($l)return oo;$l=1;var t=Qc();function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function l(d,f){var h=f(),p=r({inst:{value:h,getSnapshot:f}}),g=p[0].inst,m=p[1];return o(function(){g.value=h,g.getSnapshot=f,a(g)&&m({inst:g})},[d,h,f]),i(function(){return a(g)&&m({inst:g}),d(function(){a(g)&&m({inst:g})})},[d]),s(h),h}function a(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:l;return oo.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,oo}var zl;function Zc(){return zl||(zl=1,io.exports=Wh()),io.exports}var eu=Zc(),Bl=Object.defineProperty,_h=(t,e)=>{let n={};for(var r in t)Bl(n,r,{get:t[r],enumerable:!0});return Bl(n,Symbol.toStringTag,{value:"Module"}),n};function ce(t){this.content=t}ce.prototype={constructor:ce,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new ce(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new ce(n)},addToStart:function(t,e){return new ce([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new ce(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new ce(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=ce.from(t),t.size?new ce(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=ce.from(t),t.size?new ce(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=ce.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}};ce.from=function(t){if(t instanceof ce)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ce(e)};function tu(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){let s=i.text,l=o.text,a=0;for(;s[a]==l[a];a++)n++;return a&&a<s.length&&a<l.length&&iu(s.charCodeAt(a-1))&&ru(s.charCodeAt(a))&&n--,n}if(i.content.size||o.content.size){let s=tu(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function nu(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),l=e.child(--o),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=s.text,u=l.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,n--,r--;return d&&f&&d<c.length&&iu(c.charCodeAt(d-1))&&ru(c.charCodeAt(d))&&(n++,r++),{a:n,b:r}}if(s.content.size||l.content.size){let c=nu(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}function ru(t){return t>=56320&&t<57344}function iu(t){return t>=55296&&t<56320}class x{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,o){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,i+l,o||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}
vendor: 11,450 bytes, line 1
1textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new x(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let l=this.content[o],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),i+=l.nodeSize),s=a}return new x(r,i)}cutByIndex(e,n){return e==n?x.empty:e==0&&n==this.content.length?this:new x(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new x(i,o)}addToStart(e){return new x([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new x(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return tu(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return nu(this,e,n,r)}findIndex(e){if(e==0)return vr(0,e);if(e==this.size)return vr(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),o=r+i.nodeSize;if(o>=e)return o==e?vr(n+1,o):vr(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return x.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return x.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return x.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new x(n||e,r)}static from(e){if(!e)return x.empty;if(e instanceof x)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new x([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}x.empty=new x([],0);const so={index:0,offset:0};function vr(t,e){return so.index=t,so.offset=e,so}function Kr(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(!Kr(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Kr(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let K=class _o{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Kr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return _o.none;if(e instanceof _o)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};K.none=[];class Zn extends Error{}class M{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=su(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new M(r,this.openStart,this.openEnd)}removeBetween(e,n){return new M(ou(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 M.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new M(x.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new M(e,r,i)}}M.empty=new M(x.empty,0,0);function ou(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(i==e||o.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(ou(o.content,e-i-1,n-i-1)))}function su(t,e,n,r,i,o){let{index:s,offset:l}=t.findIndex(e),a=t.maybeChild(s);if(l==e||a.isText)return o&&r<=0&&i<=0&&!o.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=su(a.content,e-l-1,n,s==0?r-1:0,s==t.childCount-1?i-1:0,a);return c&&t.replaceChild(s,a.copy(c))}function Uh(t,e,n){if(n.openStart>t.depth)throw new Zn("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Zn("Inconsistent open depths");return lu(t,e,n,0)}function lu(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=lu(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return Ut(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=jh(n,t);return Ut(o,cu(t,s,l,e,r))}else return Ut(o,qr(t,e,r))}function au(t,e){if(!e.type.compatibleContent(t.type))throw new Zn("Cannot join "+e.type.name+" onto "+t.type.name)}function Uo(t,e,n){let r=t.node(n);return au(r,e.node(n)),r}function _t(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 Fn(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(_t(t.nodeAfter,r),o++));for(let l=o;l<s;l++)_t(i.child(l),r);e&&e.depth==n&&e.textOffset&&_t(e.nodeBefore,r)}function Ut(t,e){if(!t.type.validContent(e))throw new Zn("Invalid content for node "+t.type.name);return t.copy(e)}function cu(t,e,n,r,i){let o=t.depth>i&&Uo(t,e,i+1),s=r.depth>i&&Uo(n,r,i+1),l=[];return Fn(null,t,i,l),o&&s&&e.index(i)==n.index(i)?(au(o,s),_t(Ut(o,cu(t,e,n,r,i+1)),l)):(o&&_t(Ut(o,qr(t,e,i+1)),l),Fn(e,n,i,l),s&&_t(Ut(s,qr(n,r,i+1)),l)),Fn(r,null,i,l),new x(l)}function qr(t,e,n){let r=[];if(Fn(null,t,n,r),t.depth>n){let i=Uo(t,e,n+1);_t(Ut(i,qr(t,e,n+1)),r)}return Fn(e,null,n,r),new x(r)}function jh(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(x.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class er{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return K.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let l=r;r=i,i=l}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Jr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(o),c=o-a;if(r.push(s,l,i+a),!c||(s=s.child(l),s.isText))break;o=c-1,i+=a+1}return new er(n,r,o)}
vendor: 4,376 bytes, line 1
1static resolveCached(e,n){let r=Hl.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else Hl.set(e,r=new Kh);let i=r.elts[r.i]=er.resolve(e,n);return r.i=(r.i+1)%qh,i}}class Kh{constructor(){this.elts=[],this.i=0}}const qh=12,Hl=new WeakMap;class Jr{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 Jh=Object.create(null);let Ct=class jo{constructor(e,n,r,i=K.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||x.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Kr(this.attrs,n||e.defaultAttrs||Jh)&&K.sameSet(this.marks,r||K.none)}copy(e=null){return e==this.content?this:new jo(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new jo(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 M.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),l=i.start(s),c=i.node(s).content.cut(i.pos-l,o.pos-l);return new M(c,i.depth-s,o.depth-s)}replace(e,n,r){return Uh(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return er.resolveCached(this,e)}resolveNoCache(e){return er.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),uu(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=x.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=i;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=K.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(!K.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}
1`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=x.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};Ct.prototype.text=void 0;class Gr extends Ct{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):uu(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 Gr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Gr(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 uu(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Jt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Gh(e,n);if(r.next==null)return Jt.empty;let i=du(r);r.next&&r.err("Unexpected trailing text");let o=np(tp(i));return rp(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function o(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return x.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=o(d,l.concat(u));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let l=i;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:l,next:a}=o.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),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 i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
2`)}}Jt.empty=new Jt(!0);class Gh{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 du(t){let e=[];do e.push(Yh(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Yh(t){let e=[];do e.push(Xh(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Xh(t){let e=ep(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=Qh(t,e);else break;return e}function Fl(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");
vendor: 15,639 bytes, lines 2-4
2let e=Number(t.next);return t.pos++,e}function Qh(t,e){let n=Fl(t),r=n;return t.eat(",")&&(t.next!="}"?r=Fl(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Zh(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function ep(t){if(t.eat("(")){let e=du(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=Zh(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 tp(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function i(s,l){s.forEach(a=>a.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=o(s.exprs[a],l);if(a==s.exprs.length-1)return c;i(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),i(o(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return i(o(s.expr,l),a),i(o(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=n();i(o(s.expr,a),u),a=u}if(s.max==-1)i(o(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=n();r(a,u),i(o(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function fu(t,e){return e-t}function Vl(t,e){let n=[];return r(e),n.sort(fu);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let s=0;s<o.length;s++){let{term:l,to:a}=o[s];!l&&n.indexOf(a)==-1&&r(a)}}}function np(t){let e=Object.create(null);return n(Vl(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<i.length;u++)i[u][0]==l&&(c=i[u][1]);Vl(t,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new Jt(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort(fu);o.next.push({type:i[s][0],next:e[l.join(",")]||n(l)})}return o}}function rp(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];s.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function hu(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 pu(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let o=t[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function mu(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let i in t)t[i].validate&&t[i].validate(e[i])}function gu(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new op(t,r,e[r]);return n}let Wl=class yu{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=gu(e,r.attrs),this.defaultAttrs=hu(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==Jt.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:pu(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ct(this,this.computeAttrs(e),x.from(n),K.setFrom(r))}createChecked(e=null,n,r){return n=x.from(n),this.checkContent(n),new Ct(this,this.computeAttrs(e),n,K.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=x.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(x.empty,!0);return o?new Ct(this,e,n.append(o),K.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){mu(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:K.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new yu(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function ip(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}class op{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?ip(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class zi{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=gu(e,i.attrs),this.excluded=null;let o=hu(this.attrs);this.instance=o?new K(this,o):null}create(e=null){return!e&&this.instance?this.instance:new K(this,pu(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new zi(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){mu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class bu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=ce.from(e.nodes),n.marks=ce.from(e.marks||{}),this.nodes=Wl.compile(this.spec.nodes,this),this.marks=zi.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=Jt.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?_l(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:_l(this,s.split(" "))}this.nodeFromJSON=i=>Ct.fromJSON(this,i),this.markFromJSON=i=>K.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Wl){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Gr(r,r.defaultAttrs,e,K.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 _l(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],s=o;if(o)n.push(o);else for(let l in t.marks){let a=t.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function sp(t){return t.tag!=null}function lp(t){return t.style!=null}class Tt{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(sp(i))this.tags.push(i);else if(lp(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new jl(this,n,!1);return r.addAll(e,K.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new jl(this,n,!0);return r.addAll(e,K.none,n.from,n.to),M.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(up(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<o)break}n.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Kl(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Kl(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Tt(e,Tt.schemaRules(e)))}}const wu={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},ap={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},vu={ol:!0,ul:!0},tr=1,Ko=2,Vn=4;function Ul(t,e,n){return e!=null?(e?tr:0)|(e==="full"?Ko:0):t&&t.whitespace=="pre"?tr|Ko:n&~Vn}class xr{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=K.none,this.match=o||(s&Vn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(x.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&tr)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=x.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(x.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&&!wu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class jl{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,s=Ul(null,n.preserveWhitespace,0)|(r?Vn:0);i?o=new xr(i.type,i.attrs,K.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new xr(null,null,K.none,!0,null,s):o=new xr(e.schema.topNodeType,null,K.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,o=i.options&Ko?"full":this.localPreserveWS||(i.options&tr)>0,{schema:s}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
3`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(s.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=i.content[i.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;vu.hasOwnProperty(s)&&this.parser.normalizeLists&&cp(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:ap.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(wu.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(o),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
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 i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(o,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?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,i){let o,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,n.attrs||null,r,n.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEac
vendor: 4,073 bytes, line 4
4h(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)}o&&this.sync(l)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];s!=l;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o)}findPlace(e,n,r){let i,o;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],c=a.findWrapping(e);if(c&&(!i||i.length>c.length+l)&&(i=c,o=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)n=this.enterInner(i[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=K.none;for(let l of i.concat(e.marks))(o.type?o.type.allowsMarkType(l.type):ql(l.type,e.type))&&(s=l.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r,!1);return o&&(o=this.enterInner(e,n,r,!0,i)),o}enterInner(e,n,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=Ul(e,o,s.options);s.options&Vn&&s.content.length==0&&(l|=Vn);let a=K.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):ql(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new xr(e,n,a,i,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|=tr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=o;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function cp(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&vu.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function up(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Kl(t){let e={};for(let n in t)e[n]=t[n];return e}
vendor: 3,818 bytes, line 4
4function ql(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}class tn{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Sr(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let l=0,a=0;for(;l<o.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(o[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)i=o.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,n);u&&(o.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){if(e.isText)return Sr(n).createTextNode(e.text);let{dom:r,contentDOM:i}=Hr(Sr(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Hr(Sr(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:Hr(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new tn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Jl(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Jl(e.marks)}}function Jl(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Sr(t){return t.document||window.document}const Gl=new WeakMap;function dp(t){let e=Gl.get(t);return e===void 0&&Gl.set(t,e=fp(t)),e}function fp(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Hr(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=dp(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let l,a=n?t.createElementNS(n,i):t.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof f=="string")a.appendChild(t.createTextNode(f));else{let{dom:h,contentDOM:p}=Hr(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const xu=65535,Su=Math.pow(2,16);function hp(t,e){return t+e*Su}function Yl(t){return t&xu}function pp(t){return(t-(t&xu))/Su}const ku=1,Cu=2,Fr=4,Tu=8;class qo{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Tu)>0}get deletedBefore(){return(this.delInfo&(ku|Fr))>0}get deletedAfter(){return(this.delInfo&(Cu|Fr))>0}get deletedAcross(){return(this.delInfo&Fr)>0}}class ke{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&ke.empty)return ke.empty}recover(e){let n=0,r=Yl(e);
vendor: 3,691 bytes, line 4
4if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+pp(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+o],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,h=a+i+(f<0?0:u);if(r)return h;let p=e==(n<0?a:d)?null:hp(l/3,e-a),g=e==a?Cu:e==d?ku:Fr;return(n<0?e!=a:e!=d)&&(g|=Tu),new qo(h,g,p)}i+=u-c}return r?e+i:new qo(e+i,0,null)}touches(e,n){let r=0,i=Yl(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+o],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],l=s-(this.inverted?o:0),a=s+(this.inverted?0:o),c=this.ranges[i+n],u=this.ranges[i+r];e(l,l+c,a,a+u),o+=u-c}}invert(){return new ke(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ke.empty:new ke(e<0?[0,-e,0]:[0,0,e])}}ke.empty=new ke([]);class nr{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new nr(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new nr;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this._maps[o],l=s.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new qo(e,i,null)}}const lo=Object.create(null);class ye{getMap(){return ke.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=lo[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 lo)throw new RangeError("Duplicate use of step JSON ID "+e);return lo[e]=n,n.prototype.jsonID=e,n}}class ne{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new ne(e,null)}static fail(e){return new ne(null,e)}static fromReplace(e,n,r,i){try{return ne.ok(e.replace(n,r,i))}catch(o){if(o instanceof Zn)return ne.fail(o.message);throw o}}}function Is(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(Is(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return x.fromArray(r)}class St extends ye{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.no
vendor: 6,936 bytes, line 4
4de(r.sharedDepth(this.to)),o=new M(Is(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return ne.fromReplace(e,this.from,this.to,o)}invert(){return new ze(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 St(n.pos,r.pos,this.mark)}merge(e){return e instanceof St&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new St(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 St(n.from,n.to,e.markFromJSON(n.mark))}}ye.jsonID("addMark",St);class ze extends ye{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 M(Is(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return ne.fromReplace(e,this.from,this.to,r)}invert(){return new St(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 ze(n.pos,r.pos,this.mark)}merge(e){return e instanceof ze&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ze(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 ze(n.from,n.to,e.markFromJSON(n.mark))}}ye.jsonID("removeMark",ze);class kt extends ye{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ne.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ne.fromReplace(e,this.pos,this.pos+1,new M(x.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new kt(this.pos,n.marks[i]);return new kt(this.pos,this.mark)}}return new Gt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new kt(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 kt(n.pos,e.markFromJSON(n.mark))}}ye.jsonID("addNodeMark",kt);class Gt extends ye{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ne.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return ne.fromReplace(e,this.pos,this.pos+1,new M(x.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new kt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Gt(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 Gt(n.pos,e.markFromJSON(n.mark))}}ye.jsonID("removeNodeMark",Gt);class te extends ye{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Jo(e,this.from,this.to)?ne.fail("Structure replace would overwrite content"):ne.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ke([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.to,-1),r=this.from==this.to&&te.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new te(r.pos,Math.max(r.pos,n.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?M.empty:new M(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?M.empty:new M(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,M.fromJSON(e,n.slice),!!n.structure)}}te.MAP_BIAS=1;ye.jsonID("replace",te);class le extends ye{constructor(e,n,r,i,o,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Jo(e,this.from,this.gapFrom)||Jo(e,this.gapTo,this.to)))return ne.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return ne.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?ne.fromReplace(e,this.from,this.to,r):ne.fail("Content does not fit in gap")}getMap(){return new ke([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 le(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new le(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new le(n.from,n.to,n.gapFrom,n.gapTo,M.fromJSON(e,n.slice),n.insert,!!n.structure)}}ye.jsonID("replaceAround",le);function Jo(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>
vendor: 1,068 bytes, line 4
40&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function mp(t,e,n,r){let i=[],o=[],s,l;t.doc.nodesBetween(e,n,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(s&&s.to==f&&s.mark.eq(d[g])?s.to=h:i.push(s=new ze(f,h,d[g])));l&&l.to==f?l.to=h:o.push(l=new St(f,h,r))}}),i.forEach(a=>t.step(a)),o.forEach(a=>t.step(a))}function gp(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;o++;let a=null;if(r instanceof zi){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<i.length;h++){let p=i[h];p.step==o-1&&d.eq(i[h].style)&&(f=p)}f?(f.to=c,f.step=o):i.push({style:d,from:Math.max(l,e),to:c,step:o})}}}
vendor: 4,463 bytes, lines 4-5
4),i.forEach(s=>t.step(new ze(s.from,s.to,s.style)))}function Ls(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new te(l,u,M.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new ze(l,u,c.marks[f]));if(i&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new M(x.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new te(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(x.empty,!0);t.replace(l,l,new M(a,0,0))}for(let a=s.length-1;a>=0;a--)t.step(s[a])}function yp(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Mn(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,o=0;;--r){let s=t.$from.node(r),l=t.$from.index(r)+i,a=t.$to.indexAfter(r)-o;if(r<t.depth&&s.canReplace(l,a,n))return r;if(r==0||s.type.spec.isolating||!yp(s,l,a))break;l&&(i=1),a<s.childCount&&(o=1)}return null}function bp(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),l=i.after(o+1),a=s,c=l,u=x.empty,d=0;for(let p=o,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=x.from(r.node(p).copy(u)),d++):a--;let f=x.empty,h=0;for(let p=o,g=!1;p>n;p--)g||i.after(p+1)<i.end(p)?(g=!0,f=x.from(i.node(p).copy(f)),h++):c++;t.step(new le(a,c,s,l,new M(u.append(f),d,h),u.size-d,!0))}function Ps(t,e,n=null,r=t){let i=wp(t,e),o=i&&vp(r,e);return o?i.map(Xl).concat({type:e,attrs:n}).concat(o.map(Xl)):null}function Xl(t){return{type:t,attrs:null}}function wp(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return n.canReplaceWith(r,i,s)?o:null}function vp(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:s}function xp(t,e,n){let r=x.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=x.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new le(i,o,i,o,new M(r,0,0),n.length,!0))}function Sp(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let a=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,a)&&kp(t.doc,t.mapping.slice(o).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Eu(t,s,l,o),Ls(t,t.mapping.slice(o).map(l,1),r,void 0,c===null);let u=t.mapping.slice(o),d=u.map(l,1),f=u.map(l+s.nodeSize,1);return t.step(new le(d,f,d+1,f-1,new M(x.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Mu(t,s,l,o),!1}})}function Mu(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let a=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Eu(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(`
5`))}})}function kp(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Cp(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new le(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new M(x.from(s),0,0),1,!0))}function at(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=n-2;c>o;c--,u--){let d=i.node(c),f=i.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(h))return!1}
vendor: 4,650 bytes, line 5
5let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function Tp(t,e,n=1,r){let i=t.doc.resolve(e),o=x.empty,s=x.empty;for(let l=i.depth,a=i.depth-n,c=n-1;l>a;l--,c--){o=x.from(i.node(l).copy(o));let u=r&&r[c];s=x.from(u?u.type.create(u.attrs,s):i.node(l).copy(s))}t.step(new te(e,e,new M(o.append(s),n,n),!0))}function It(t,e){let n=t.resolve(e),r=n.index();return Au(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Mp(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?t.type.schema.nodes.text:o.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(o.marks))return!1}return n.validEnd}function Au(t,e){return!!(t&&e&&!t.isLeaf&&Mp(t,e))}function Bi(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let o,s,l=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):n>0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&Au(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Ep(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Eu(t,u.node(),u.before(),l)}s.inlineContent&&Ls(t,e+n-1,s,o.node().contentMatchAt(o.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),M.empty,!0)),r===!0){let u=t.doc.resolve(c);Mu(t,u.node(),u.before(),t.steps.length)}return t}function Ap(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function Ou(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),u=!1;if(o==1)u=c.canReplace(a,a,i);else{let d=c.contentMatchAt(a).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Hi(t,e,n=e,r=M.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Ru(i,o,r)?new te(e,n,r):new Op(i,o,r).fit()}function Ru(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Op{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=x.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=x.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let a=new M(o,s,l);return e>-1?new le(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new te(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=ao(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(x.from(s),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=ao(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new M(e,n+1,Math.max(r,
vendor: 12,083 bytes, line 5
5i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=ao(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new M(Pn(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new M(Pn(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let g=0;g<o.length;g++)this.openFrontierNode(o[g]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));d=d.matchFragment(i)}let h=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let g=l.child(c),m=d.matchType(g.type);if(!m)break;c++,(c>1||a==0||g.content.size)&&(d=m,u.push(Nu(g.mark(f.allowedMarks(g.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=$n(this.placed,n,x.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,m=l;g<h;g++){let y=m.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),m=y.content}this.unplaced=p?e==0?M.empty:new M(Pn(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new M(Pn(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!co(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=co(e,n,i,r,o);if(s){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=co(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=$n(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=$n(this.placed,this.depth,x.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(x.empty,!0);n.childCount&&(this.placed=$n(this.placed,this.frontier.length,n))}}function Pn(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Pn(t.firstChild.content,e-1,n)))}function $n(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy($n(t.lastChild.content,e-1,n)))}function ao(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Nu(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Nu(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(x.empty,!0)))),t.copy(r)}function co(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!Rp(n,o.content,s)?l:null}function Rp(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Np(t){return t.spec.defining||t.spec.definingForContent}function Dp(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(Ru(i,o,r))return t.step(new te(e,n,r));let s=Iu(i,o);s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(f)>-1?l=f:i.before(f)==h&&s.splice(1,0,-f)}let a=s.indexOf(l),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=Np(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let g=0;g<s.length;g++){let m=s[(g+a)%s.length],y=!0;m<0&&(y=!1,m=-m);let v=i.node(m-1),w=i.index(m-1);if(v.canReplaceWith(w,w,p.type,p.marks))return t.replace(i.before(m),y?o.after(m):n,new M(Du(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=s[f];h<0||(e=i.before(h),n=o.after(h))}}function Du(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(Du(o.content,e+1,n,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(x.empty,!0))}return t}function Ip(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Ap(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new M(x.from(r),0,0))}function Lp(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let s=r.sharedDepth(n),l=!1;for(let a=r.depth;a>s;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=i.depth;a>s;a--)i.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=i.depth;a>0&&n==i.start(a);a--)n=i.before(a);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let o=Iu(r,i);for(let s=0;s<o.length;s++){let l=o[s],a=s==o.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function Iu(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(o<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class fn extends ye{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 ne.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return ne.fromReplace(e,this.pos,this.pos+1,new M(x.from(i),0,n.isLeaf?0:1))}getMap(){return ke.empty}invert(e){return new fn(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 fn(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 fn(n.pos,n.attr,n.value)}}ye.jsonID("attr",fn);class rr extends ye{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return ne.ok(r)}getMap(){return ke.empty}invert(e){return new rr(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 rr(n.attr,n.value)}}ye.jsonID("docAttr",rr);let mn=class extends Error{};mn=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};mn.prototype=Object.create(Error.prototype);mn.prototype.constructor=mn;mn.prototype.name="TransformError";class $s{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new nr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new mn(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}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((o,s,l,a)=>{e=Math.min(e,l),n=Math.max(n,a)})}return e==1e9?null:{from:e,to:n}}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=M.empty){let i=Hi(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new M(x.from(r),0,0))}delete(e,n){return this.replace(e,n,M.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Dp(this,e,n,r),this}replaceRangeWith(e,n,r){return Ip(this,e,n,r),this}deleteRange(e,n){return Lp(this,e,n),this}lift(e,n){return bp(this,e,n),this}join(e,n=1){return Ep(this,e,n),this}wrap(e,n){return xp(this,e,n),this}setBlockType(e,n=e,r,i=null){return Sp(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return Cp(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new fn(e,n,r)),this}setDocAttribute(e,n){return this.step(new rr(e,n)),this}addNodeMark(e,n){return this.step(new kt(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 K)n.isInSet(r.marks)&&this.step(new Gt(e,n));else{let i=r.marks,o,s=[];for(;o=n.isInSet(i);)s.push(new Gt(e,o)),i=o.removeFromSet(i);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,n=1,r){return Tp(this,e,n,r),this}addMark(e,n,r){return mp(this,e,n,r),this}removeMark(e,n,r){return gp(this,e,n,r),this}clearIncompatible(e,n,r){return Ls(this,e,n,r),this}}const uo=Object.create(null);class I{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Lu(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=M.empty){let r=n.content.lastChild,i=null;for(let l=0;l<n.openEnd;l++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(o);e.replaceRange(u.map(a.pos),u.map(c.pos),l?M.empty:n),l==0&&ea(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:l}=i[o],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);o?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),ea(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new R(e):ln(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=n<0?ln(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):ln(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Te(e.node(0))}static atStart(e){return ln(e,e,0,0,1)||new Te(e)}static atEnd(e){return ln(e,e,e.content.size,e.childCount,-1)||new Te(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=uo[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 uo)throw new RangeError("Duplicate use of selection JSON ID "+e);return uo[e]=n,n.prototype.jsonID=e,n}getBookmark(){return R.between(this.$anchor,this.$head).getBookmark()}}I.prototype.visible=!0;class Lu{constructor(e,n){this.$from=e,this.$to=n}}let Ql=!1;function Zl(t){!Ql&&!t.parent.inlineContent&&(Ql=!0,console.warn("TextSelection endpoint not pointing into a 
5node with inline content ("+t.parent.type.name+")"))}class R extends I{constructor(e,n=e){Zl(e),Zl(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 I.near(r);let i=e.resolve(n.map(this.anchor));return new R(i.parent.inlineContent?i:r,r)}replace(e,n=M.empty){if(super.replace(e,n),n==M.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof R&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Fi(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 R(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=I.findFrom(n,r,!0)||I.findFrom(n,-r,!0);if(o)n=o.$head;else return I.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(I.findFrom(e,-r,!0)||I.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new R(e,n)}}I.jsonID("text",R);class Fi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Fi(e.map(this.anchor),e.map(this.head))}resolve(e){return R.between(e.resolve(this.anchor),e.resolve(this.head))}}class O extends I{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?I.near(o):new O(o)}content(){return new M(x.from(this.node),0,0)}eq(e){return e instanceof O&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new zs(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new O(e.resolve(n.anchor))}static create(e,n){return new O(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}O.prototype.visible=!1;I.jsonID("node",O);class zs{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Fi(r,r):new zs(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&O.isSelectable(r)?new O(n):I.near(n)}}class Te extends I{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=M.empty){if(n==M.empty){e.delete(0,e.doc.content.size);let r=I.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Te(e)}map(e){return new Te(e)}eq(e){return e instanceof Te}getBookmark(){return Pp}}I.jsonID("all",Te);const Pp={map(){return this},resolve(t){return new Te(t)}};function ln(t,e,n,r,i,o=!1){if(e.inlineContent)return R.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&O.isSelectable(l))return O.create(t,n-(i<0?l.nodeSize:0))}else{let a=ln(t,l,n+i,i<0?l.childCount:0,i,o);if(a)return a}n+=l.nodeSize*i}return null}function ea(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof te||i instanceof le))return;let o=t.mapping.maps[r],s;o.forEach((l,a,c,u)=>{s==null&&(s=u)}),t.setSelection(I.near(t.doc.resolve(s),n))}const ta=1,kr=2,na=4;class $p extends $s{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|ta)&~kr,this.storedMarks=null,this}get selectionSet(){return(this.updated&ta)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=kr,this}ensureMarks(e){return K.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&kr)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~kr,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)||K.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(I.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|=na,this}get scrolledIntoView(){return(this.updated&na)>0}}function ra(t,e){return!e||!t?t:t.bind(e)}class zn{constructor(e,n,r){this.name=e,this.init=ra(n.init,r),this.apply=ra(n.apply,r)}}const zp=[new zn("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new zn("selection",{init(t,e){return t.selection||I.atStart(e.doc)},apply(t){return t.selection}}),new zn("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new zn("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class fo{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=zp.slice(),n&&n.forEac
vendor: 4,962 bytes, line 5
5h(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 zn(r.key,r.spec.state,r))})}}class Bt{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=i?i[s].n:0,c=i?i[s].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),o=!0}i&&(i[s]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Bt(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(e,this[o.name],this,n)}return n}get tr(){return new $p(this)}static create(e){let n=new fo(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Bt(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new fo(this.schema,e.plugins),r=n.fields,i=new Bt(n);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new fo(e.schema,e.plugins),o=new Bt(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Ct.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=I.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){o[s.name]=c.fromJSON.call(a,e,n[l],o);return}}o[s.name]=s.init(e,o)}}),o}}function Pu(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Pu(i,e,{})),n[r]=i}return n}class V{constructor(e){this.spec=e,this.props={},e.props&&Pu(e.props,this,this.props),this.key=e.key?e.key.key:$u("plugin")}getState(e){return e[this.key]}}const ho=Object.create(null);function $u(t){return t in ho?t+"$"+ ++ho[t]:(ho[t]=0,t+"$")}class U{constructor(e="key"){this.key=$u(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const zu=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Bu(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Hu=(t,e,n)=>{let r=Bu(t,n);if(!r)return!1;let i=Bs(r);if(!i){let s=r.blockRange(),l=s&&Mn(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(Ju(t,i,e,-1))return!0;if(r.parent.content.size==0&&(gn(o,"end")||O.isSelectable(o)))for(let s=r.depth;;s--){let l=Hi(t.doc,r.before(s),r.after(s),M.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(gn(o,"end")?I.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):O.create(a.doc,i.pos-o.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},Bp=(t,e,n)=>{let r=Bu(t,n);if(!r)return!1;let i=Bs(r);return i?Fu(t,i,e):!1},Hp=(t,e,n)=>{let r=Wu(t,n);if(!r)return!1;let i=Hs(r);return i?Fu(t,i,e):!1};function Fu(t,e,n){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=Hi(t.doc,o,a,M.empty);if(!c||c.from!=o||c instanceof te&&c.slice.size>=a-o)return!1;if(n){let u=t.tr.step(c);u.setSelection(R.create(u.doc,o)),n(u.scrollIntoView())}return!0}function gn(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;
vendor: 10,540 bytes, lines 5-6
5if(n&&r.childCount!=1)return!1}return!1}const Vu=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=Bs(r)}let s=o&&o.nodeBefore;return!s||!O.isSelectable(s)?!1:(e&&e(t.tr.setSelection(O.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Bs(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 Wu(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const _u=(t,e,n)=>{let r=Wu(t,n);if(!r)return!1;let i=Hs(r);if(!i)return!1;let o=i.nodeAfter;if(Ju(t,i,e,1))return!0;if(r.parent.content.size==0&&(gn(o,"start")||O.isSelectable(o))){let s=Hi(t.doc,r.before(),r.after(),M.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(gn(o,"start")?I.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):O.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},Uu=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;o=Hs(r)}let s=o&&o.nodeAfter;return!s||!O.isSelectable(s)?!1:(e&&e(t.tr.setSelection(O.create(t.doc,o.pos)).scrollIntoView()),!0)};function Hs(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 Fp=(t,e)=>{let n=t.selection,r=n instanceof O,i;if(r){if(n.node.isTextblock||!It(t.doc,n.from))return!1;i=n.from}else if(i=Bi(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(O.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Vp=(t,e)=>{let n=t.selection,r;if(n instanceof O){if(n.node.isTextblock||!It(t.doc,n.to))return!1;r=n.to}else if(r=Bi(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Wp=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&Mn(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},ju=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
6`).scrollIntoView()),!0)};function Fs(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 _p=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=Fs(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,s.createAndFill());a.setSelection(I.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Ku=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Te||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Fs(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=t.tr.insert(s,o.createAndFill());l.setSelection(R.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},qu=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(at(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Mn(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function Up(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof O&&e.selection.node.isBlock)return!r.parentOffset||!at(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=Fs(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),o.unshift(a&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;o.unshift(null)}let u=e.tr;(e.selection instanceof R||e.selection instanceof Te)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=at(u.doc,d,o.length,o);if(f||(o[0]=l?{type:l}:null,f=at(u.doc,d,o.length,o)),!f)return!1;if(u.split(d,o.length,o),!a&&c&&r.node(s).type!=l){let h=u.mapping.map(r.before(s)),p=u.doc.resolve(h);l&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(s)),l)}return n&&n(u.scrollIntoView()),!0}}const jp=Up(),Kp=(t,e)=>{let{$from:n,to:r}=t.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(O.create(t.doc,i))),!0)};function qp(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||It(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Ju(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,a=i.type.spec.isolating||o.type.spec.isolating;if(!a&&qp(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&l.matchType(s[0]||o.type).validEnd){if(n){let h=e.pos+o.nodeSize,p=x.empty;for(let y=s.length-1;y>=0;y--)p=x.from(s[y].create(null,p));p=x.from(i.copy(p));let g=t.tr.step(new le(e.pos-1,h,e.pos,h,new M(p,1,0),s.length,!0)),m=g.doc.resolve(h+2*s.length);m.nodeAfter&&m.nodeAfter.type==i.type&&It(g.doc,m.pos)&&g.join(m.pos),n(g.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&a?null:I.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Mn(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&gn(o,"start",!0)&&gn(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let g=o,m=1;for(;!g.isTextblock;g=g.firstChild)m++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let y=x.empty;for(let w=p.length-1;w>=0;w--)y=x.from(p[w].copy(y));let v=t.tr.step(new le(e.pos-p.length,e.pos+o.nodeSize,e.pos+m,e.pos+o.nodeSize-m,new M(y,p.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function Gu(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(R.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const Jp=Gu(-1),Gp=Gu(1);function Yp(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),l=s&&Ps(s,t,e);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function ia(t,e=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[o];n.doc.nodesBetween(s,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)i=!0;else{let u=n.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[s];o.setBlockType(l,a,t,e)}r(o.scrollIntoView())}return!0}}function Vs(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}Vs(zu,Hu,Vu);Vs(zu,_u,Uu);Vs(ju,Ku,qu,jp);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Xp(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o);if(!s)return!1;let l=r?n.tr:null;return Qp(l,s,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Qp(t,e,n,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);o=new Jr(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Jr(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=Ps(o,n,r,e);return l?(t&&Zp(t,e,l,i,n),!0):!1}function Zp(t,e,n,r,i){let o=x.empty;for(let u=n.length-1;u>=0;u--)o=x.from(n[u].type.create(n[u].attrs,o));t.step(new le(e.start-(r?2:0),e.end,e.start,e.end,new M(o,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==i&&(s=u+1);let l=n.length-s,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&at(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function em(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?tm(e,n,t,o):nm(e,n,o):!0:!1}}function tm(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new le(o-1,s,o,s,new M(x.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Jr(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const l=Mn(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(o,-1)-1);return It(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}function nm(t,e,n){let r=t.tr,i=n.parent;for(let h=n.end,p=n.endIndex-1,g=n.startIndex;p>g;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==i.childCount,c=o.node(-1),u=o.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?x.empty:x.from(i))))return!1;let d=o.pos,f=d+s.nodeSize;return r.step(new le(d-(l?1:0),f+(a?1:0),d+1,f-1,new M((l?x.empty:x.from(i.copy(x.empty))).append(a?x.empty:x.from(i.copy(x.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function rm(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,a=l.child(s-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=x.from(c?t.create():null),d=new M(x.from(t.create(null,x.from(l.type.create(null,u)))),c?3:1,0),f=o.start,h=o.end;n(e.tr.step(new le(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const ue=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},yn=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Go=null;const it=function(t,e,n){let r=Go||(Go=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},im=function(){Go=null},Yt=function(t,e,n,r){return n&&(oa(t,e,n,r,-1)||oa(t,e,n,r,1))},om=/^(img|br|input|textarea|hr)$/i;function oa(t,e,n,r,i){for(var o;;){if(t==n&&e==r)return!0;
vendor: 6,641 bytes, line 6
6if(e==(i<0?0:Re(t))){let s=t.parentNode;if(!s||s.nodeType!=1||hr(t)||om.test(t.nodeName)||t.contentEditable=="false")return!1;e=ue(t)+(i<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else t=s,e=i<0?Re(t):0}else return!1}}function Re(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function sm(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=Re(t)}else if(t.parentNode&&!hr(t))e=ue(t),t=t.parentNode;else return null}}function lm(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&&!hr(t))e=ue(t)+1,t=t.parentNode;else return null}}function am(t,e,n){for(let r=e==0,i=e==Re(t);r||i;){if(t==n)return!0;let o=ue(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==Re(t)}}function hr(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 Vi=function(t){return t.focusNode&&Yt(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function zt(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function cm(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function um(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Re(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Re(r.startContainer),r.startOffset)}}}const Ge=typeof navigator<"u"?navigator:null,sa=typeof document<"u"?document:null,Lt=Ge&&Ge.userAgent||"",Yo=/Edge\/(\d+)/.exec(Lt),Yu=/MSIE \d/.exec(Lt),Xo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Lt),Se=!!(Yu||Xo||Yo),Mt=Yu?document.documentMode:Xo?+Xo[1]:Yo?+Yo[1]:0,Ne=!Se&&/gecko\/(\d+)/i.test(Lt);Ne&&+(/Firefox\/(\d+)/.exec(Lt)||[0,0])[1];const Qo=!Se&&/Chrome\/(\d+)/.exec(Lt),fe=!!Qo,Xu=Qo?+Qo[1]:0,me=!Se&&!!Ge&&/Apple Computer/.test(Ge.vendor),bn=me&&(/Mobile\/\w+/.test(Lt)||!!Ge&&Ge.maxTouchPoints>2),Oe=bn||(Ge?/Mac/.test(Ge.platform):!1),Qu=Ge?/Win/.test(Ge.platform):!1,ot=/Android \d/.test(Lt),pr=!!sa&&"webkitFontSmoothing"in sa.documentElement.style,dm=pr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function fm(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 Qe(t,e){return typeof t=="number"?t:t[e]}function hm(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 la(t,e,n){if(!Zo(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=yn(s);continue}let l=s,a=l==o.body,c=a?fm(o):hm(l),u=0,d=0;if(e.top<c.top+Qe(r,"top")?d=-(c.top-e.top+Qe(i,"top")):e.bottom>c.bottom-Qe(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Qe(i,"top")-c.top:e.bottom-c.bottom+Qe(i,"bottom")),e.left<c.left+Qe(r,"left")?u=-(c.left-e.left+Qe(i,"left")):e.right>c.right-Qe(r,"right")&&(u=e.right-c.right+Qe(i,"right")),u||d)if(a)o.defaultView.scrollBy(u,d);else{let h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let g=l.scrollLeft-h,m=l.scrollTop-p;e={left:e.left-g,top:e.top-m,right:e.right-g,bottom:e.bottom-m}}let f=a?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:yn(s)}}function pm(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(o,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:Zu(t.dom)}}function Zu(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=yn(r));return e}function mm({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;ed(n,r==0?0:r-e)}function ed(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:o}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let rn=null;function gm(t){if(t.setActive)return t.setActive();if(rn)return t.focus(rn);let e=Zu(t);t.focus(rn==null?{get preventScroll(){return rn={preventScroll:!0},!0}}:void 0),rn||(rn=!1,ed(e,0))}function td(t,e){let n,r=2e8,i,o=0,s=e.top,l=e.top,a,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=it(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=s&&p.bottom>=l){s=Math.max(p.bottom,s),l=Math.min(p.top,l);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){n=u,r=g,i=g&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&g&&(o=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(o=d+1)}}return!n&&a&&(n=a,i=c,r=0),n&&n.nodeType==3?ym(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:td(n,i)}function ym(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let s=gt(r,1);if(s.top!=s.bottom&&Ws(e,s)){i={node:t,offset:o+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function Ws(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function bm(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function wm(t,e,n){let{node:r,offset:i}=td(e,n),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function vm(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let l=t.docView.nearestDesc(o,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>r.left||a.top>
vendor: 4,373 bytes, line 6
6r.top?i=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),s=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;o=l.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function nd(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let s=t.childNodes[o];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Ws(e,c))return nd(s,e,c)}}if((o=(o+1)%r)==i)break}return t}function xm(t,e){let n=t.dom.ownerDocument,r,i=0,o=um(n,e.left,e.top);o&&({node:r,offset:i}=o);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!Ws(e,c)||(s=nd(t.dom,e,c),!s))return null}if(me)for(let c=s;r&&c;c=yn(c))c.draggable&&(r=void 0);if(s=bm(s,e),r){if(Ne&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;pr&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=vm(t,r,i,e))}l==null&&(l=wm(t,s,e));let a=t.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Zo(t){return t.top<t.bottom||t.left<t.right}function gt(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Zo(r))return r}return Array.prototype.find.call(n,Zo)||t.getBoundingClientRect()}const Sm=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function rd(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=pr||Ne;if(r.nodeType==3)if(s&&(Sm.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let a=gt(it(r,i,i),n);if(Ne&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=gt(it(r,i-1,i-1),-1);if(c.top==a.top){let u=gt(it(r,i,i+1),-1);if(u.top!=a.top)return Nn(u,u.left<c.left)}}return a}else{let a=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==r.nodeValue.length?(a--,u=1):n<0?a--:c++,Nn(gt(it(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Re(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return po(a.getBoundingClientRect(),!1)}if(o==null&&i<Re(r)){let a=r.childNodes[i];if(a.nodeType==1)return po(a.getBoundingClientRect(),!0)}return po(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==Re(r))){let a=r.childNodes[i-1],c=a.nodeType==3?it(a,Re(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Nn(gt(c,1),!1)}if(o==null&&i<Re(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?it(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return Nn(gt(c,-1),!0)}return Nn(gt(r.nodeType==3?it(r):r,-n),n>=0)}function Nn(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 po(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 id(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function km(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return id(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=rd(t,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=it(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Cm=/[\u0590-\u08ac]/;function Tm(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=t.domSelection();return l?!Cm.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?o:s:id(t,e,()=>
vendor: 29,793 bytes, lines 6-7
6{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:g}=t.domSelectionRange(),m=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==g;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),m}):r.pos==r.start()||r.pos==r.end()}let aa=null,ca=null,ua=!1;function Mm(t,e,n){return aa==e&&ca==n?ua:(aa=e,ca=n,ua=n=="up"||n=="down"?km(t,e,n):Tm(t,e,n))}const De=0,da=1,Ht=2,Be=3;class mr{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=De,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>ue(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let l=i.children[s];if(l.size){i=l;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],l=o+s.size;if(l>e||s instanceof sd){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof od&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?ue(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?ue(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(i==-1&&e<=c){let u=s+a.border;if(e>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,u);e=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=ue(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){o=ue(d.dom);break}n+=d.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let o=Math.min(e,n),s=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let g=this.children[h],m=p+g.size;if(o>p&&s<m)return g.setSelection(e-p-g.border,n-p-g.border,r,i);p=m}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Ne||me)&&e==n){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
7`),d&&p==h.nodeValue.length)for(let g=h,m;g;g=g.parentNode){if(m=g.nextSibling){m.nodeName=="BR"&&(l=a={node:m.parentNode,offset:ue(m)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=h.childNodes[p-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Ne&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&&me)&&Yt(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Yt(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&Ne)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let l=r+o.border,a=s-o.border;if(e>=l&&n<=a){this.dirty=e==r||n==s?Ht:da,e==l&&n==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Be:o.markDirty(e-l,n-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Ht:Be}r=s}this.dirty=Ht}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ht:da;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class od extends mr{constructor(e,n,r,i){let o,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.hasAttribute("contenteditable")||(s.contentEditable="false"),s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==De&&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 Em extends mr{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Et extends mr{constructor(e,n,r,i,o){super(e,[],r,i),this.mark=n,this.spec=o}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=tn.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Et(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Be||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Be&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=De){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=De}}slice(e,n,r){let i=Et.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=ts(o,n,s,r)),e>0&&(o=ts(o,0,e,r));for(let l=0;l<o.length;l++)o[l].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class At extends mr{constructor(e,n,r,i,o,s,l){super(e,[],o,s),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,n,r,i,o,s){let l=o.nodeViews[n.type.name],a,c=l&&l(n,o,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=tn.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=cd(u,r,n),c?a=new Am(e,n,r,i,u,d||null,f,c):n.isText?new Wi(e,n,r,i,u,f):new At(e,n,r,i,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let i=this.children[r];if(this.dom.contains(i.dom.parentNode)){n.contentElement=i.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(i=>i.nodeType==1&&e.indexOf(i.parentNode)<0&&this.dom.contains(i));r?n.contentElement=r:n.getContent=()=>x.empty}}return n}matchesNode(e,n,r){return this.dirty==De&&e.eq(this.node)&&Yr(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new Rm(this,s&&s.node,e);Im(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?K.none:this.node.child(u).marks,r,e,u),a.placeWidget(c,e,i)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e,f);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(h=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(c,u,d,h,e)||a.updateNextNode(c,u,d,e,f,i)||a.addNode(c,u,d,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Ht)&&(s&&this.protectLocalComposition(e,s),ld(this.contentDOM,this.children,e),bn&&Lm(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof R)||r<n||i>n+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,l=Pm(this.node.content,s,r-n,i-n);return l<0?null:{node:o,pos:l,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new Em(this,o,n,i);e.input.compositionNodes.push(s),this.children=ts(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==Be||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=De}updateOuterDeco(e){if(Yr(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=ad(this.dom,this.nodeDOM,es(this.outerDeco,this.node,n),es(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 fa(t,e,n,r,i){cd(r,e,t);let o=new At(void 0,t,e,n,r,r,r);return o.contentDOM&&o.updateChildren(i,0),o}class Wi extends At{constructor(e,n,r,i,o,s){super(e,n,r,i,o,null,s)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Be||this.dirty!=De&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=De||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=De,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new Wi(this.parent,i,this.outerDeco,this.innerDeco,o,o)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Be)}get domAtom(){return!1}isText(e){return this.node.text==e}}class sd extends mr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==De&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Am extends At{constructor(e,n,r,i,o,s,l,a){super(e,n,r,i,o,s,l),this.spec=a}update(e,n,r,i){if(this.dirty==Be)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function ld(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=s.dom;if(l.parentNode==t){for(;l!=r;)r=ha(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(l,r);if(s instanceof Et){let a=r?r.previousSibling:t.lastChild;ld(s.contentDOM,s.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=ha(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Wn=function(t){t&&(this.nodeName=t)};Wn.prototype=Object.create(null);const Ft=[new Wn];function es(t,e,n){if(t.length==0)return Ft;let r=n?Ft[0]:new Wn,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new Wn(s.nodeName));for(let l in s){let a=s[l];a!=null&&(n&&i.length==1&&i.push(r=new Wn(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return i}function ad(t,e,n,r){if(n==Ft&&r==Ft)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],l=n[o];if(o){let a;l&&l.nodeName==s.nodeName&&i!=t&&(a=i.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=Ft[0]),i=a}Om(i,l||Ft[0],s)}return i}function Om(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&t.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&t.classList.add(i[o]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function cd(t,e,n){return ad(t,t,Ft,es(e,n,t.nodeType!=1))}function Yr(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 ha(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Rm{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Nm(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let o=0,s=this.stack.length>>1,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=De,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,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[s])&&!this.isLocked(d.dom)){a=u;break}}if(a<0&&this.index<this.top.children.length){let u=this.top.children[this.index];u instanceof Et&&u.dirty!=Be&&u.mark.type==e[s].type&&u.spec.update&&!this.isLocked(u.dom)&&u.spec.update(e[s])&&(u.mark=e[s],a=this.index,this.changed=!0)}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=Et.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let 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)){o=l;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,n,r,i,o){let s=this.top.children[i];return s.dirty==Be&&s.dom==s.contentDOM&&(s.dirty=Ht),s.update(e,n,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,o,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof At){let c=this.preMatch.matched.get(a);if(c!=null&&c!=o)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Be&&Yr(n,a.outerDeco));if(!f&&a.update(e,n,r,i))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,i,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Ht,d.updateChildren(i,s+1),d.dirty=De),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,o,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Yr(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=At.create(this.top,n,r,i,o,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,i,o){let s=At.create(this.top,e,n,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new od(this.top,e,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Et;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Wi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((me||fe)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new sd(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Nm(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,s=[];e:for(;i>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof Et)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(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function Dm(t,e){return t.type.side-e.type.side}function Im(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,i,e.forChild(o,u),c),o+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d;for(;s<i.length&&i[s].to==o;){let m=i[s++];m.widget&&(u?(d||(d=[u])).push(m):u=m)}if(u)if(d){d.sort(Dm);for(let m=0;m<d.length;m++)n(d[m],c,!!a)}else n(u,c,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let m=0;m<l.length;m++)l[m].to<=o&&l.splice(m--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let p=o+f.nodeSize;if(f.isText){let m=p;s<i.length&&i[s].from<m&&(m=i[s].from);for(let y=0;y<l.length;y++)l[y].to<m&&(m=l[y].to);m<p&&(a=f.cut(m-o),f=f.cut(0,m-o),p=m,h=-1)}else for(;s<i.length&&i[s].to<p;)s++;let g=f.isInline&&!f.isLeaf?l.filter(m=>!m.inline):l.slice();r(f,g,e.forChild(o,f),h),o=p}}function Lm(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 Pm(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let s=t.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<t.childCount;){let c=t.child(i++);if(o+=c.nodeSize,!c.isText)break;a+=c.text}if(o>=n){if(o>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=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 ts(t,e,n,r,i){let o=[];for(let s=0,l=0;s<t.length;s++){let a=t[s],c=l,u=l+=a.size;c>=n||u<=e?o.push(a):(c<e&&o.push(a.slice(0,e-c,r)),i&&(o.push(i),i=void 0),u>n&&o.push(a.slice(n-c,a.size,r)))}return o}function _s(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(Vi(n)){for(a=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&O.isSelectable(d)&&i.parent&&!(d.isInline&&am(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new O(s==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,s]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(s)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!o?1:-1;c=Us(t,u,l,d)}return c}function ud(t){return t.editable?t.hasFocus():fd(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function ct(t,e=!1){let n=t.state.selection;if(dd(t,n),!ud(t))return;let r=t.input.mouseDown;if(!e&&fe&&r){let i=t.domSelectionRange(),o=t.domObserver.currentSelection;if(i.anchorNode&&o.anchorNode&&Yt(i.anchorNode,i.anchorOffset,o.anchorNode,o.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)zm(t);else{let{anchor:i,head:o}=n,s,l;pa&&!(n instanceof R)&&(n.$from.parent.inlineContent||(s=ma(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=ma(t,n.to))),t.docView.setSelection(i,o,t,e),pa&&(s&&ga(s),l&&ga(l)),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 pa=me||fe&&Xu<63;function ma(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(me&&i&&i.contentEditable=="false")return mo(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return mo(i);if(o)return mo(o)}}function mo(t){return t.contentEditable="true",me&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function ga(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,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!ud(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function zm(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,ue(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Se&&Mt<=11&&(n.disabled=!0,n.disabled=!1)}function dd(t,e){if(e instanceof O){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(ya(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else ya(t)}function ya(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Us(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||R.between(e,n,r)}function ba(t){return t.editable&&!t.hasFocus()?!1:fd(t)}function fd(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 Bm(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Yt(e.node,e.offset,n.anchorNode,n.anchorOffset)}function ns(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&I.findFrom(o,e)}function yt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function wa(t,e,n){let r=t.state.selection;if(r instanceof R)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return yt(t,new R(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=ns(t.state,e);return i&&i instanceof O?yt(t,i):!1}else if(!(Oe&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?O.isSelectable(o)?yt(t,new O(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):pr?yt(t,new R(t.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof O&&r.node.isInline)return yt(t,new R(e>0?r.$to:r.$from));{let i=ns(t.state,e);return i?yt(t,i):!1}}}function Xr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function _n(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function on(t,e){return e<0?Hm(t):Fm(t)}function Hm(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;
vendor: 4,674 bytes, line 7
7for(Ne&&n.nodeType==1&&r<Xr(n)&&_n(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(_n(l,-1))i=n,o=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(hd(n))break;{let l=n.previousSibling;for(;l&&_n(l,-1);)i=n.parentNode,o=ue(l),l=l.previousSibling;if(l)n=l,r=Xr(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?rs(t,n,r):i&&rs(t,i,o)}function Fm(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Xr(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let l=n.childNodes[r];if(_n(l,1))o=n,s=++r;else break}else{if(hd(n))break;{let l=n.nextSibling;for(;l&&_n(l,1);)o=l.parentNode,s=ue(l)+1,l=l.nextSibling;if(l)n=l,r=0,i=Xr(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&rs(t,o,s)}function hd(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Vm(t,e){for(;t&&e==t.childNodes.length&&!hr(t);)e=ue(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 Wm(t,e){for(;t&&!e&&!hr(t);)e=ue(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 rs(t,e,n){if(e.nodeType!=3){let o,s;(s=Vm(e,n))?(e=s,n=0):(o=Wm(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Vi(r)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&ct(t)},50)}function va(t,e){let n=t.state.doc.resolve(e);if(!(fe||Qu)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function xa(t,e,n){let r=t.state.selection;if(r instanceof R&&!r.empty||n.indexOf("s")>-1||Oe&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=ns(t.state,e);if(s&&s instanceof O)return yt(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Te?I.near(s,e):I.findFrom(s,e);return l?yt(t,l):!1}return!1}function Sa(t,e){if(!(t.state.selection instanceof R))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function ka(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function _m(t){if(!me||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;ka(t,r,"true"),setTimeout(()=>ka(t,r,"false"),20)}return!1}function Um(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=Um(e);if(n==8||Oe&&n==72&&r=="c")return Sa(t,-1)||on(t,-1);if(n==46&&!e.shiftKey||Oe&&n==68&&r=="c")return Sa(t,1)||on(t,1);if(n==13||n==27)return!0;if(n==37||Oe&&n==66&&r=="c"){let i=n==37?va(t,t.state.selection.from)=="ltr"?-1:1:-1;return wa(t,i,r)||on(t,i)}else if(n==39||Oe&&n==70&&r=="c"){let i=n==39?va(t,t.state.selection.from)=="ltr"?1:-1:1;return wa(t,i,r)||on(t,i)}else{if(n==38||Oe&&n==80&&r=="c")return xa(t,-1,r)||on(t,-1);if(n==40||Oe&&n==78&&r=="c")return _m(t)||xa(t,1,r)||on(t,1);if(r==(Oe?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function js(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=t.someProp("clipboardSerializer")||tn.fromSchema(t.state.schema),l=bd(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=yd[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(n)}`);
vendor: 4,319 bytes, lines 7-10
7let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
8
9`);return{dom:a,text:f,slice:e}}function Ks(t,e,n,r,i){let o=i.parent.type.spec.code,s,l;if(!n&&!e)return null;let a=!!e&&(r||o||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,o||r,t)}),o)return l=new M(x.from(t.state.schema.text(e.replace(/\r\n?/g,`
10`))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)l=d;else{let f=i.marks(),{schema:h}=t.state,p=tn.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=s.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=Gm(n),pr&&Ym(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Tt.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Km.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Xm(Ca(l,+u[1],+u[2]),u[4]);else if(l=M.maxOpen(qm(l.content,i),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=Ca(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const Km=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function qm(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,s=[];if(t.forEach(l=>{if(!s)return;let a=i.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&o.length&&md(a,o,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=gd(s[s.length-1],o.length));let u=pd(l,a);s.push(u),i=i.matchType(u.type),o=a}}),s)return x.from(s)}return t}function pd(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,x.from(t));return t}function md(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=md(t,e,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(x.from(pd(n,t,i+1))))}}function gd(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,gd(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(x.empty,!0);return t.copy(n.append(r))}function is(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(o=0),i<r-1&&(l=is(l,e,n,r,i+1,o)),i>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(x.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function Ca(t,e,n){return e<t.openStart&&(t=new M(is(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new M(is(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const yd={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function bd(){return document.implementation.createHTMLDocument("title")}let Dn=null;function Jm(t){let e=window.trustedTypes;if(!e)return t;if(!Dn){if(Dn=e.defaultPolicy)try{return Dn.createHTML(t)}catch{}Dn=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})}return Dn.createHTML(t)}function Gm(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=bd(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(t),o;if((o=i&&yd[i[1].toLowerCase()])&&(t=o.map(s=>"<"+s+">").join("")+t+o.map(s=>"</"+s+">").reverse().join("")),r.innerHTML=Jm(t),o)for(let s=0;s<o.length;s++)r=r.querySelector(o[s])||r;for(let s=0;s<n.styleSheets.length;s++){let l=n.styleSheets[s];for(let a=0;a<l.rules.length;a++){let c=l.rules[a];if(c instanceof CSSStyleRule){let u=r.querySelectorAll(c.selectorText);for(let d=0;d<u.length;d++)u[d].style.cssText+=c.style.cssText}}}return r}function Ym(t){let e=t.querySelectorAll(fe?"span:not([class]):not
10([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 Xm(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:o,openEnd:s}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;try{a.checkAttrs(r[l+1])}catch{break}i=x.from(a.create(r[l+1],i)),o++,s++}return new M(i,o,s)}const we={},ve={},Qm={touchstart:!0,touchmove:!0};class Zm{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function eg(t){for(let e in we){let n=we[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{ng(t,r)&&!qs(t,r)&&(t.editable||!(r.type in ve))&&n(t,r)},Qm[e]?{passive:!0}:void 0)}me&&t.dom.addEventListener("input",()=>null),ss(t)}function st(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function tg(t){t.input.mouseDown&&t.input.mouseDown.done(),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 ss(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>qs(t,r))})}function qs(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function ng(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 rg(t,e){!qs(t,e)&&we[e.type]&&(t.editable||!(e.type in ve))&&we[e.type](t,e)}ve.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Sd(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ot&&fe&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),bn&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,zt(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||jm(t,n)?n.preventDefault():st(t,"key")};ve.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ve.keypress=(t,e)=>{let n=e;if(Sd(t)||!n.charCode||n.ctrlKey&&!n.altKey||Oe&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof R)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i,o))&&t.dispatch(o()),n.preventDefault()}};function gr(t){return{left:t.clientX,top:t.clientY}}function ig(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Js(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,l=>s>o.depth?l(t,n,o.nodeAfter,o.before(s),i,!0):l(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function yr(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 og(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&O.isSelectable(r)?(yr(t,new O(n)),!0):!1}function sg(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof O&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(O.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(yr(t,O.create(t.state.doc,i)),!0):!1}function lg(t,e,n,r,i){return Js(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>
vendor: 13,962 bytes, line 10
10o(t,e,r))||(i?sg(t,n):og(t,n))}function ag(t,e,n,r){return Js(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function cg(t,e,n,r){return Js(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||ug(t,n,r)}function ug(t,e,n){if(n.button!=0)return!1;let r=wd(t,e,!0),i=t.state.doc;return r?(yr(t,r),r instanceof R&&i.eq(t.state.doc)&&(t.input.mouseDown=new fg(t,r)),!0):!1}function wd(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?R.create(r,0,r.content.size):null;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),l=i.before(o);if(s.inlineContent)return R.create(r,l+1,l+1+s.content.size);if(n&&O.isSelectable(s))return O.create(r,l)}return null}function Gs(t){return ir(t)}const vd=Oe?"metaKey":"ctrlKey";we.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Gs(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&ig(n,t.input.lastClick)&&!n[vd]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let s=t.posAtCoords(gr(n));s&&(o=="singleClick"?t.input.mouseDown=new dg(t,s,n,!!r):(o=="doubleClick"?ag:cg)(t,s.pos,s.inside,n)?n.preventDefault():st(t,"pointer"))};class xd{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class dg extends xd{constructor(e,n,r,i){super(e),this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[vd],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);o=u.parent,s=u.depth?u.before():0}const l=i?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&&(o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof O&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ne&&!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()),st(e,"pointer")}done(){super.done(),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(()=>{this.view.isDestroyed||ct(this.view)})}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(gr(e))),this.updateAllowDefault(e),this.allowDefault||!n?st(this.view,"pointer"):lg(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||me&&this.mightDrag&&!this.mightDrag.node.isAtom||fe&&!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)?(yr(this.view,I.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):st(this.view,"pointer")}move(e){this.updateAllowDefault(e),st(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class fg extends xd{constructor(e,n){super(e),this.startSelection=n,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),st(this.view,"pointer");let n=this.view.posAtCoords(gr(e)),r=n&&wd(this.view,n.inside,!1);if(!r)return;let{doc:i}=this.view.state,o=this.startSelection,[s,l]=r.from<o.from?[o.to,r.from]:[o.from,r.to];yr(this.view,R.create(i,s,l))}}we.touchstart=t=>{t.input.lastTouch=Date.now(),Gs(t),st(t,"pointer")};we.touchmove=t=>{t.input.lastTouch=Date.now(),st(t,"pointer")};we.contextmenu=t=>Gs(t);function Sd(t,e){return t.composing?!0:me&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const hg=ot?5e3:-1;ve.compositionstart=ve.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof R&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||fe&&Qu&&pg(t)))t.markCursor=t.state.storedMarks||n.marks(),ir(t,!0),t.markCursor=null;else if(ir(t,!e.selection.empty),Ne&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}kd(t,hg)};function pg(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}ve.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,kd(t,20))};function kd(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ir(t),e))}function Cd(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function mg(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=sm(e.focusNode,e.focusOffset),r=lm(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function ir(t,e=!1){if(!(ot&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Cd(t),e||t.docView&&t.docView.dirty){let n=_s(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 gg(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const or=Se&&Mt<15||bn&&dm<604;we.copy=ve.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=or?null:n.clipboardData,s=r.content(),{dom:l,text:a}=js(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):gg(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function yg(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function bg(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?sr(t,r.value,null,i,e):sr(t,r.textContent,r.innerHTML,i,e)},50)}function sr(t,e,n,r,i){let o=Ks(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,o||M.empty)))return!0;if(!o)return!1;let s=yg(o),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Td(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," "):""}ve.paste=(t,e)=>{let n=e;if(t.composing&&!ot)return;let r=or?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&sr(t,Td(r),r.getData("text/html"),i,n)?n.preventDefault():bg(t,n)};class Md{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const wg=Oe?"altKey":"ctrlKey";function Ed(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[wg]}we.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(gr(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof O?i.to-1:i.to))){if(r&&r.mightDrag)s=O.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=O.create(t.state.doc,d.posBefore))}}let l=(s||t.state.selection).content(),{dom:a,text:c,slice:u}=js(t,l);(!n.dataTransfer.files.length||!fe||Xu>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(or?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",or||n.dataTransfer.setData("text/plain",c),t.dragging=new Md(u,Ed(t,n),s)};we.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ve.dragover=ve.dragenter=(t,e)=>e.preventDefault();ve.drop=(t,e)=>{try{vg(t,e,t.dragging)}finally{t.dragging=null}};function vg(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(gr(e));if(!r)return;let i=t.state.doc.resolve(r.pos),o=n&&n.slice;o?t.someProp("transformPasted",h=>{o=h(o,t,!1)}):o=Ks(t,Td(e.dataTransfer),or?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&Ed(t,e));if(t.someProp("handleDrop",h=>h(t,e,o||M.empty,s))){e.preventDefault();return}if(!o)return;e.preventDefault();let l=o?Ou(t.state.doc,i.pos,o):i.pos;l==null&&(l=i.pos);let a=t.state.tr;if(s){let{node:h}=n;h?h.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,o.content.firstChild):a.replaceRange(c,c,o),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&O.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))a.setSelection(new O(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,g,m,y)=>h=y),a.setSelection(Us(t,f,a.doc.resolve(h)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}we.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())&&ct(t)},20))};we.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)};we.beforeinput=(t,e)=>{if(ot&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,zt(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in ve)we[t]=ve[t];function lr(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 Qr{constructor(e,n){this.toDOM=e,this.spec=n||jt,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new re(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Qr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&lr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ot{constructor(e,n){this.attrs=e,this.spec=n||jt}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new re(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Ot&&lr(this.attrs,e.attrs)&&lr(this.spec,e.spec)}static is(e){return e.type instanceof Ot}destroy(){}}class Ys{constructor(e,n){this.attrs=e,this.spec=n||jt}map(e,n,r,i){let o=e.mapResult(n.from+i,1);if(o.deleted)return null;let s=e.mapResult(n.to+i,-1);return s.deleted||s.pos<=o.pos?null:new re(o.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),o;return i==n.from&&!(o=e.child(r)).isText&&i+o.nodeSize==n.to}eq(e){return this==e||e instanceof Ys&&lr(this.attrs,e.attrs)&&lr(this.spec,e.spec)}destroy(){}}class re{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new re(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 re(e,e,new Qr(n,r))}static inline(e,n,r,i){return new re(e,n,new Ot(r,i))}
vendor: 4,219 bytes, line 10
10static node(e,n,r,i){return new re(e,n,new Ys(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ot}get widget(){return this.type instanceof Qr}}const an=[],jt={};class ${constructor(e,n){this.local=e.length?e:an,this.children=n.length?n:an}static create(e,n){return n.length?Zr(n,e,0,jt):he}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,o){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,i+l,o)}}map(e,n,r){return this==he||e.maps.length==0?this:this.mapInner(e,n,0,0,r||jt)}mapInner(e,n,r,i,o){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(n,a)?(s||(s=[])).push(a):o.onRemove&&o.onRemove(this.local[l].spec)}return this.children.length?xg(this.children,s||[],e,n,r,i,o):s?new $(s.sort(Kt),an):he}add(e,n){return n.length?this==he?$.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Od(n,l,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<a;)o+=3;i[o]==a?i[o+2]=i[o+2].addInner(l,u,c+1):i.splice(o,0,a,a+l.nodeSize,Zr(u,l,c+1,jt)),o+=3}});let s=Ad(o?Rd(n):n,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new $(s.length?this.local.concat(s).sort(Kt):this.local,i||this.children)}remove(e){return e.length==0||this==he?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,l=r[o]+n,a=r[o+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,l+1);c!=he?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let l=0;l<i.length;l++)i[l].eq(s,n)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new $(i,r):he}forChild(e,n){if(this==he)return this;if(n.isLeaf)return $.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let o=e+1,s=o+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>o&&a.type instanceof Ot){let c=Math.max(o,a.from)-o,u=Math.min(s,a.to)-o;c<u&&(i||(i=[])).push(a.copy(c,u))}}if(i){let l=new $(i.sort(Kt),an);return r?new vt([l,r]):l}return r||he}eq(e){if(this==e)return!0;if(!(e instanceof $)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let 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 Xs(this.localsInner(e))}localsInner(e){if(this==he)return an;if(e.inlineContent||!this.local.some(Ot.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Ot||n.push(this.local[r]);return n}forEachSet(e){e(this)}}$.empty=new $([],[]);$.removeOverlap=Xs;const he=$.empty;class vt{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,jt));return vt.from(r)}forChild(e,n){if(n.isLeaf)return $.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=he&&(o instanceof vt?r=r.concat(o.members):r.push(o))}return vt.from(r)}eq(e){if(!(e instanceof vt)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let s=0;s<o.length;s++)n.push(o[s])}}return n?Xs(r?n:n.sort(Kt)):an}static from(e){switch(e.length){case 0:return he;case 1:return e[0];default:return new vt(e.every(n=>n instanceof $)?e:e.reduce((n,r)=>n.concat(r instanceof $?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;
vendor: 27,298 bytes, line 10
10n++)this.members[n].forEachSet(e)}}function xg(t,e,n,r,i,o,s){let l=t.slice();for(let c=0,u=o;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,g)=>{let m=g-p-(h-f);for(let y=0;y<l.length;y+=3){let v=l[y+1];if(v<0||f>v+u-d)continue;let w=l[y]+u-d;h>=w?l[y+1]=f<=w?-2:-1:f>=u&&m&&(l[y]+=m,l[y+1]+=m)}d+=m}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+o),d=u-i;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+o,-1),h=f-i,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==h){let y=l[c+2].mapInner(n,m,u+1,t[c]+o+1,s);y!=he?(l[c]=d,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Sg(l,t,e,n,i,o,s),u=Zr(c,r,0,s);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new $(e.sort(Kt),l)}function Ad(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new re(i.from+e,i.to+e,i.type))}return n}function Sg(t,e,n,r,i,o,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,i,c);d?n.push(d):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+o+1);return n}function Od(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let o=0,s;o<t.length;o++)(s=t[o])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),t[o]=null);return i}function Rd(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Zr(t,e,n,r){let i=[],o=!1;e.forEach((l,a)=>{let c=Od(t,l,a+n);if(c){o=!0;let u=Zr(c,l,n+a+1,r);u!=he&&i.push(a,a+l.nodeSize,u)}});let s=Ad(o?Rd(t):t,-n).sort(Kt);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||i.length?new $(s,i):he}function Kt(t,e){return t.from-e.from||t.to-e.to}function Xs(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==t&&(e=t.slice()),e[i]=o.copy(o.from,r.to),Ta(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),Ta(e,i,r.copy(o.from,r.to)));break}}}return e}function Ta(t,e,n){for(;e<t.length&&Kt(n,t[e])>0;)e++;t.splice(e,0,n)}function go(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=he&&e.push(r)}),t.cursorWrapper&&e.push($.create(t.state.doc,[t.cursorWrapper.deco])),vt.from(e)}const kg={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Cg=Se&&Mt<=11;class Tg{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 Mg{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Tg,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Se&&Mt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():me&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Cg&&(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,kg)),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(ba(this.view)){if(this.suppressingSelectionUpdates)return ct(this.view);if(Se&&Mt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Yt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=yn(o))n.add(o);for(let o=e.anchorNode;o;o=yn(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&ba(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(o=o<0?d.from:Math.min(d.from,o),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||fe&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(u=>u.type=="childList"&&u.removedNodes.length))){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Ne&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||Og(e,d)!=h)&&f.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Vi(r)&&(c=_s(e))&&c.eq(I.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ct(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Eg(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Rg(e,a)),this.handleDOMChange(o,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ct(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(Se&&Mt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(o=f)}let s=i&&i.parentNode==e.target?ue(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=o&&o.parentNode==e.target?ue(o):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Ma=new WeakMap,Ea=!1;function Eg(t){if(!Ma.has(t)&&(Ma.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ne,Ea)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."),Ea=!0}}function Aa(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return Yt(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function Ag(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Aa(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Aa(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 Rg(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let o of e)if(((n=o.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=o.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(o,l.firstChild),r==o&&t.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}function Ng(t,e,n,r){let{node:i,fromOffset:o,toOffset:s,from:l,to:a}=t.docView.parseRange(e,n),c=t.domSelectionRange(),u,d=c.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:c.anchorOffset}],Vi(c)||u.push({node:c.focusNode,offset:c.focusOffset})),fe&&t.input.lastKeyCode===8)for(let y=s;y>o;y--){let v=i.childNodes[y-1],w=v.pmViewDesc;if(v.nodeName=="BR"&&!w){s=y;break}if(!w||w.size)break}let f=t.state.doc,h=t.someProp("domParser")||Tt.fromSchema(t.state.schema),p=f.resolve(l),g=null,m=h.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:Dg(r),context:p});if(u&&u[0].pos!=null){let y=u[0].pos,v=u[1]&&u[1].pos;v==null&&(v=y),g={anchor:y+l,head:v+l}}return{doc:m,sel:g,from:l,to:a}}const Dg=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(me&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||me&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},Ig=/^(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 Lg(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,E=_s(t,C);if(E&&!t.state.selection.eq(E)){if(fe&&ot&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",A=>A(t,zt(13,"Enter"))))return;let D=t.state.tr.setSelection(E);C=="pointer"?D.setMeta("pointer",!0):C=="key"&&D.scrollIntoView(),o&&D.setMeta("composition",o),t.dispatch(D)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=Ng(t,e,n,i),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=zg(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(bn&&t.input.lastIOSEnter>Date.now()-225||ot)&&i.some(C=>C.nodeType==1&&!Ig.test(C.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",C=>C(t,zt(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof R&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let C=Oa(t,t.state.doc,c.sel);if(C&&!C.eq(t.state.selection)){let E=t.state.tr.setSelection(C);o&&E.setMeta("composition",o),t.dispatch(E)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof R&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),Se&&Mt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let g=c.doc.resolveNoCache(p.start-c.from),m=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),v=g.sameParent(m)&&g.parent.inlineContent&&y.end()>=p.endA;if((bn&&t.input.lastIOSEnter>Date.now()-225&&(!v||i.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!v&&g.pos<c.doc.content.size&&(!g.sameParent(m)||!g.parent.inlineContent)&&g.pos<m.pos&&!/\S/.test(c.doc.textBetween(g.pos,m.pos,"","")))&&t.someProp("handleKeyDown",C=>C(t,zt(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&$g(u,p.start,p.endA,g,m)&&t.someProp("handleKeyDown",C=>C(t,zt(8,"Backspace")))){ot&&fe&&t.domObserver.suppressSelectionUpdates();return}fe&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),ot&&!v&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,m=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(C){return C(t,zt(13,"Enter"))})},20));let w=p.start,b=p.endA,k=C=>{let E=C||t.state.tr.replace(w,b,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let D=Oa(t,E.doc,c.sel);D&&!(fe&&t.composing&&D.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(D.head==w||D.head==E.mapping.map(b)-1)||Se&&D.empty&&D.head==w)&&E.setSelection(D)}return o&&E.setMeta("composition",o),E.scrollIntoView()},S;if(v)if(g.pos==m.pos){Se&&Mt<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>ct(t),20));let C=k(t.state.tr.delete(w,b)),E=u.resolve(p.start).marksAcross(u.resolve(p.endA));E&&C.ensureMarks(E),t.dispatch(C)}else if(p.endA==p.endB&&(S=Pg(g.parent.content.cut(g.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let C=k(t.state.tr);S.type=="add"?C.addMark(w,b,S.mark):C.removeMark(w,b,S.mark),t.dispatch(C)}else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let C=g.parent.textBetween(g.parentOffset,m.parentOffset),E=()=>k(t.state.tr.insertText(C,w,b));t.someProp("handleTextInput",D=>D(t,w,b,C,E))||t.dispatch(E())}else t.dispatch(k());else t.dispatch(k())}function Oa(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Us(t,e.resolve(n.anchor),e.resolve(n.head))}function Pg(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,l,a;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)o=n[u].removeFromSet(o);if(i.length==1&&o.length==0)l=i[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(i.length==0&&o.length==1)l=o[0],s="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(x.from(c).eq(t))return{mark:l,type:s}}function $g(t,e,n,r,i){if(n-e<=i.pos-r.pos||yo(r,!0,!1)<i.pos)return!1;let o=t.resolve(e);if(!r.parent.isTextblock){let l=o.nodeAfter;return l!=null&&n==e+l.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=t.resolve(yo(o,!0,!0));return!s.parent.isTextblock||s.pos>n||yo(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function yo(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function zg(t,e,n,r,i){let o=t.findDiffStart(e,n),s=n+t.size,l=n+e.size;if(o==null)return null;let{a,b:c}=t.findDiffEnd(e,s,l);if(i=="end"){let u=Math.max(0,o-Math.min(a,c));r-=a+u-o}if(a<o&&s<l){let u=r<=o&&r>=a?o-r:0;o-=u,c=o+(c-a),a=o}else if(c<o){let u=r<=o&&r>=c?o-r:0;o-=u,a=o+(a-c),c=o}return{start:o,endA:a,endB:c}}const Bg=Ks,Hg=ir;class Qs{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 Zm,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(La),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=Da(this),Na(this),this.nodeViews=Ia(this),this.docView=fa(this.state.doc,Ra(this),go(this),this.dom,this),this.domObserver=new Mg(this,(r,i,o,s)=>Lg(this,r,i,o,s)),this.domObserver.start(),eg(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&&ss(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(La),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Cd(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=Ia(this);Vg(h,this.nodeViews)&&(this.nodeViews=h,o=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&ss(this),this.editable=Da(this),Na(this);let a=go(this),c=Ra(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(i.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&pm(this);if(s){this.domObserver.stop();let h=d&&(Se||fe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Fg(i.selection,e.selection);if(d){let g=fe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=mg(this)),(o||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=fa(e.doc,c,a,this.dom,this)),g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}let p=this.input.mouseDown;h||!(p&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Bm(this)&&p.delaySelUpdate())?ct(this,h):(dd(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&mm(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof O){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&la(this,n.getBoundingClientRect(),e)}else la(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&o<this.state.doc.content.size&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Md(e.slice,e.move,i<0?void 0:O.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(i=n?n(l):l))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let l=o[s].props[e];if(l!=null&&(i=n?n(l):l))return i}}hasFocus(){if(Se){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&&gm(this.dom),ct(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 xm(this,e)}coordsAtPos(e,n=1){return rd(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return Mm(this,n||this.state,e)}pasteHTML(e,n){return sr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return sr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return js(this,e)}destroy(){this.docView&&(tg(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],go(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,im())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return rg(this,e)}domSelectionRange(){let e=this.domSelection();return e?me&&this.root.nodeType===11&&cm(this.dom.ownerDocument)==this.dom&&Ag(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Qs.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Ra(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"),[re.node(0,t.state.doc.content.size,e)]}function Na(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:re.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Da(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Fg(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 Ia(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Vg(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function La(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")}const Wg=Object.freeze(Object.defineProperty({__proto__:null,Decoration:re,DecorationSet:$,EditorView:Qs,__endComposition:Hg,__parseFromClipboard:Bg},Symbol.toStringTag,{value:"Module"}));var Rt={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:"'"},ei={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},_g=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ug=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var de=0;de<10;de++)Rt[48+de]=Rt[96+de]=String(de);for(var de=1;de<=24;de++)Rt[de+111]="F"+de;for(var de=65;de<=90;de++)Rt[de]=String.fromCharCode(de+32),ei[de]=String.fromCharCode(de);for(var bo in Rt)ei.hasOwnProperty(bo)||(ei[bo]=Rt[bo]);function jg(t){var e=_g&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Ug&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ei:Rt)[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 Kg=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),qg=typeof navigator<"u"&&/Win/.test(navigator.platform);function Jg(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let l=0;l<e.length-1;l++){let a=e[l];
10if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))Kg?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function Gg(t){let e=Object.create(null);for(let n in t)e[Jg(n)]=t[n];return e}function wo(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 Yg(t){return new V({props:{handleKeyDown:Zs(t)}})}function Zs(t){let e=Gg(t);return function(n,r){let i=jg(r),o,s=e[wo(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[wo(i,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(qg&&r.ctrlKey&&r.altKey)&&(o=Rt[r.keyCode])&&o!=i){let l=e[wo(o,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}function _i(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var hn=class Nd{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const d=a(...u)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l=[],a=!!e,c=e||o.tr,u=()=>(!a&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...g)=>{const m=this.buildProps(c,n),y=h(...g)(m);return l.push(y),d}])),run:u};return d}static createFakeChain(){const e=new Proxy({},{get:(n,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>e}});return e}createCan(e){const{rawCommands:n,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}static createFallbackCan(){const e=Nd.createFakeChain();return new Proxy({chain:()=>e},{get:(n,r)=>{if(r!=="then")return r==="chain"?n.chain:()=>!1}})}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l={tr:e,editor:i,view:s,state:_i({state:o,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}};const Xg=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{if(!t.isDestroyed){var n;
vendor: 5,728 bytes, line 10
10e.dom.blur(),(n=window)===null||n===void 0||(n=n.getSelection())===null||n===void 0||n.removeAllRanges()}}),!0),Qg=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),Zg=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:s})=>{t.doc.nodesBetween(o.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=Mn(h);if(l.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(p||p===0)&&e.lift(h,p)})}),!0},ey=t=>e=>t(e),ty=()=>({state:t,dispatch:e})=>Ku(t,e),ny=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new R(r.doc.resolve(Math.max(s-1,0)))),!0},ry=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const s=i.before(o),l=i.after(o);t.delete(s,l).scrollIntoView()}return!0}return!1};function oe(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}const iy=t=>({tr:e,state:n,dispatch:r})=>{const i=oe(t,n.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const l=o.before(s),a=o.after(s);e.delete(l,a).scrollIntoView()}return!0}return!1},oy=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},sy=t=>t.content?/^text(\*|\+)/.test(t.content):!1,Pa=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;const r=e.nodes[t.parent.type.name].spec;return sy(r)?n==="left"?t.start()-1:t.end()+1:t.pos},ly=(t,e,n)=>({from:Pa(t,n,"left"),to:Pa(e,n,"right")}),ay=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){const n=t.tr,{ranges:r}=t.selection,i=n.steps.length;r.forEach(o=>{const s=n.mapping.slice(i),l=n.doc.resolve(s.map(o.$from.pos)),a=n.doc.resolve(s.map(o.$to.pos)),{from:c,to:u}=ly(l,a,t.schema);n.deleteRange(c,u)}),n.selection.empty||n.setSelection(R.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),e(n)}return!0},cy=()=>({commands:t})=>t.keyboardShortcut("Enter"),uy=()=>({state:t,dispatch:e})=>_p(t,e);function el(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function ti(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:el(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Dd(t,e,n={}){return t.find(r=>r.type===e&&ti(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function $a(t,e,n={}){return!!Dd(t,e,n)}function tl(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(a=>a.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(a=>a.type===e))return;if(!n){const a=r.node.marks.find(c=>c.type===e);a&&(n=a.attrs)}if(!Dd([...r.node.marks],e,n))return;let i=r.index,o=t.start()+r.offset,s=i+1,l=o+r.node.nodeSize;for(;i>0&&$a([...t.parent.child(i-1).marks],e,n);)i-=1,o-=t.parent.child(i).nodeSize;for(;s<t.parent.childCount&&$a([...t.parent.child(s).marks],e,n);)l+=t.parent.child(s).nodeSize,s+=1;return{from:o,to:l}}function ft(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}const dy=(t,e)=>({tr:n,state:r,dispatch:i})=>{const o=ft(t,r.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:u}=l;if(i){const d=tl(a,o,e);if(d&&d.from<=c&&d.to>=u){const f=R.create(s,d.from,d.to);n.setSelection(f)}}return!0},fy=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 nl(t){return t instanceof R}function lt(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function ls(t,e=null){if(!e)return null;const n=I.atStart(t),r=I.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,o=r.to;return e==="all"?R.create(t,lt(0,i,o),lt(t.content.size,i,o)):R.create(t,lt(e,i,o),lt(e,i,o))}function za(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function ni(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function hy(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const py=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(ni()||za())&&r.dom.focus(),hy()&&!ni()&&!za()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(o&&t===null&&!nl(n.state.selection))return s(),!0;const l=ls(i.doc,t)||n.state.selection,a=n.state.selection.eq(l);return o&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},my=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),gy=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Id=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&&Id(r)}return t};function Cr(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 Id(n)}
10function Ld(t){return typeof t?.nodesBetween=="function"}function wn(t,e,n){if(Ld(t))return t;const r=typeof t=="object"&&t!==null;n={slice:!0,parseOptions:{},...n};const i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return x.fromArray(t.map(s=>e.nodeFromJSON(s)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),wn("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,l="";const a=new bu({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Tt.fromSchema(a).parseSlice(Cr(t),n.parseOptions):Tt.fromSchema(a).parse(Cr(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const o=Tt.fromSchema(e);return n.slice?o.parseSlice(Cr(t),n.parseOptions).content:o.parse(Cr(t),n.parseOptions)}return wn("",e,n)}function Pd(t){return!("type"in t)}function $d(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof te||i instanceof le))return;const o=t.mapping.maps[r];let s=0;o.forEach((l,a,c,u)=>{s===0&&(s=u)}),t.setSelection(I.near(t.doc.resolve(s),n))}const yy=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=m=>{o.emit("contentError",{editor:o,error:m,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{wn(e,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(m){a(m)}try{var s;l=wn(e,o.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:o.options.enableContentCheck})}catch(m){return a(m),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;const p=Pd(l)?l.content:[l];if(p.forEach(m=>{m.check(),f=f?m.isText&&m.marks.length===0:!1,h=h?m.isBlock:!1}),u===d&&h){const{parent:m}=r.doc.resolve(u);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(u-=1,d+=1)}let g;if(f)Array.isArray(e)?g=e.map(m=>m.text||"").join(""):Ld(e)?g=p.map(m=>{var y;return(y=m.text)!==null&&y!==void 0?y:""}).join(""):typeof e=="object"&&e&&e.text?g=e.text:g=e,r.insertText(g,u,d);else{g=x.from(p);const m=r.doc.resolve(u),y=m.node(),v=m.parentOffset===0,w=y.isText||y.isTextblock,b=y.content.size>0;v&&w&&b&&h&&(u=Math.max(0,u-1)),r.replaceWith(u,d,p)}n.updateSelection&&$d(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0};function zd(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}const by=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{pos:i,attrs:o,content:s,updateSelection:l=!0}=t;let a;typeof i=="number"?a=e.doc.resolve(i):i?a=i:a=e.selection.$from;const c=zd(a.parent.contentMatchAt(a.index()));if(!c)return!1;const u=Object.keys(c.spec.attrs||{}),d=o?Object.fromEntries(Object.entries(o).filter(([h])=>u.includes(h))):{};let f;if(s){const h=wn(s,r.schema);f=c.createAndFill(d,h)}else f=c.createAndFill(d);return f?(n&&(e.insert(a.pos,f),l&&$d(e,e.steps.length-1,-1)),!0):!1},wy=()=>({state:t,dispatch:e})=>Fp(t,e),vy=()=>({state:t,dispatch:e})=>Vp(t,e),xy=()=>({state:t,dispatch:e})=>Hu(t,e),Sy=()=>({state:t,dispatch:e})=>_u(t,e),ky=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Bi(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Cy=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Bi(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Ty=()=>({state:t,dispatch:e})=>Bp(t,e),My=()=>({state:t,dispatch:e})=>Hp(t,e);function Bd(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Ey(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];
vendor: 4,896 bytes, line 10
10if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))ni()||Bd()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}const Ay=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const o=Ey(t).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a?.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function dt(t,e,n={}){const{from:r,to:i,empty:o}=t.selection,s=e?oe(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,(u,d)=>{if(u.isText)return;const f=Math.max(r,d),h=Math.min(i,d+u.nodeSize);l.push({node:u,from:f,to:h})});const a=i-r,c=l.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>ti(u.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=a}const Oy=(t,e={})=>({state:n,dispatch:r})=>dt(n,oe(t,n.schema),e)?Wp(n,r):!1,Ry=()=>({state:t,dispatch:e})=>qu(t,e),Ny=t=>({state:e,dispatch:n})=>{const r=oe(t,e.schema);return em(r)(e,n)},Dy=()=>({state:t,dispatch:e})=>ju(t,e);function Ui(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Ba(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const Iy=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const l=Ui(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(o=oe(t,r.schema)),l==="mark"&&(s=ft(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{o&&o===u.type&&(a=!0,i&&n.setNodeMarkup(d,void 0,Ba(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(f=>{s===f.type&&(a=!0,i&&n.addMark(d,d+u.nodeSize,s.create(Ba(f.attrs,e))))})})}),a},Ly=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Py=()=>({tr:t,dispatch:e})=>{if(e){const n=new Te(t.doc);t.setSelection(n)}return!0},$y=()=>({state:t,dispatch:e})=>Vu(t,e),zy=()=>({state:t,dispatch:e})=>Uu(t,e),By=()=>({state:t,dispatch:e})=>Kp(t,e),Hy=()=>({state:t,dispatch:e})=>Gp(t,e),Fy=()=>({state:t,dispatch:e})=>Jp(t,e);function as(t,e,n={},r={}){return wn(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const Vy=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:l})=>{const{doc:a}=o;if(r.preserveWhitespace!=="full"){const c=as(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});if(s){const u=Pd(c)?c.content:[c];o.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!n)}return!0}return s&&o.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function Hd(t,e){const n=ft(e,t.schema),{from:r,to:i,empty:o}=t.selection,s=[];o?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function Fd(t,e){const n=new $s(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function Wy(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function ar(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 ji(t){return e=>ar(e.$from,t)}function N(t,e,n){return t.config[e]===void 0&&t.parent?N(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?N(t.parent,e,n):null}):t.config[e]}function rl(t){return t.map(e=>{const n=N(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return n?[e,...rl(n())]:e}).flat(10)}function il(t,e){const n=tn.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function Vd(t){return typeof t=="function"}function B(t,e=void 0,...n){return Vd(t)?e?t.bind(e)(...n):t(...n):t}function _y(t={}){return Object.keys(t).length===0&&t.constructor===Object}function vn(t){return{baseExtensions:t.filter(e=>e.type==="extension"),nodeExtensions:t.filter(e=>e.type==="node"),markExtensions:t.filter(e=>e.type==="mark")}}function Wd(t){const e=[],{nodeExtensions:n,markExtensions:r}=vn(t),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(c=>c.name!=="text").map(c=>c.name),l=r.map(c=>c.name),a=[...s,...l];return t.forEach(c=>{const u=N(c,"addGlobalAttributes",{name:c.name,options:c.options,storage:c.storage,extensions:i});
10u&&u().forEach(d=>{let f;Array.isArray(d.types)?f=d.types:d.types==="*"?f=a:d.types==="nodes"?f=s:d.types==="marks"?f=l:f=[],f.forEach(h=>{Object.entries(d.attributes).forEach(([p,g])=>{e.push({type:h,name:p,attribute:{...o,...g}})})})})}),i.forEach(c=>{const u=N(c,"addAttributes",{name:c.name,options:c.options,storage:c.storage});if(!u)return;const d=u();Object.entries(d).forEach(([f,h])=>{const p={...o,...h};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:c.name,name:f,attribute:p})})}),e}function Uy(t){const e=[];let n="",r=!1,i=!1,o=0;const s=t.length;for(let l=0;l<s;l+=1){const a=t[l];if(a==="'"&&!i){r=!r,n+=a;continue}if(a==='"'&&!r){i=!i,n+=a;continue}if(!r&&!i){if(a==="("){o+=1,n+=a;continue}if(a===")"&&o>0){o-=1,n+=a;continue}if(a===";"&&o===0){e.push(n),n="";continue}}n+=a}return n&&e.push(n),e}function Ha(t){const e=[],n=Uy(t||""),r=n.length;for(let i=0;i<r;i+=1){const o=n[i],s=o.indexOf(":");if(s===-1)continue;const l=o.slice(0,s).trim(),a=o.slice(s+1).trim();l&&a&&e.push([l,a])}return e}function F(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,o])=>{if(i==="__proto__"){Object.defineProperty(r,i,{configurable:!0,enumerable:!0,value:o,writable:!0});return}if(!r[i]){r[i]=o;return}if(i==="class"){const s=o?String(o).split(" "):[],l=r[i]?r[i].split(" "):[],a=s.filter(c=>!l.includes(c));r[i]=[...l,...a].join(" ")}else if(i==="style"){const s=new Map([...Ha(r[i]),...Ha(o)]);r[i]=Array.from(s.entries()).map(([l,a])=>`${l}: ${a}`).join("; ")}else r[i]=o}),r},{})}function xn(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)=>F(n,r),{})}function jy(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Fa(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):jy(n.getAttribute(s.name));return l==null?o:{...o,[s.name]:l}},{});return{...r,...i}}}}function Va(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&_y(n)?!1:n!=null))}function Wa(t){var e,n;const r={};return!(!(t==null||(e=t.attribute)===null||e===void 0)&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),(t==null||(n=t.attribute)===null||n===void 0?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function Ky(t,e){var n;const r=Wd(t),{nodeExtensions:i,markExtensions:o}=vn(t),s=(n=i.find(c=>N(c,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(i.map(c=>{const u=r.filter(m=>m.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=Va({...t.reduce((m,y)=>{const v=N(y,"extendNodeSchema",d);return{...m,...v?v(c):{}}},{}),content:B(N(c,"content",d)),marks:B(N(c,"marks",d)),group:B(N(c,"group",d)),inline:B(N(c,"inline",d)),atom:B(N(c,"atom",d)),selectable:B(N(c,"selectable",d)),draggable:B(N(c,"draggable",d)),code:B(N(c,"code",d)),whitespace:B(N(c,"whitespace",d)),linebreakReplacement:B(N(c,"linebreakReplacement",d)),defining:B(N(c,"defining",d)),isolating:B(N(c,"isolating",d)),attrs:Object.fromEntries(u.map(Wa))}),h=B(N(c,"parseHTML",d));h&&(f.parseDOM=h.map(m=>Fa(m,u)));const p=N(c,"renderHTML",d);p&&(f.toDOM=m=>p({node:m,HTMLAttributes:xn(m,u)}));const g=N(c,"renderText",d);return g&&(f.toText=g),[c.name,f]})),a=Object.fromEntries(o.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=Va({...t.reduce((g,m)=>{const y=N(m,"extendMarkSchema",d);return{...g,...y?y(c):{}}},{}),inclusive:B(N(c,"inclusive",d)),excludes:B(N(c,"excludes",d)),group:B(N(c,"group",d)),spanning:B(N(c,"spanning",d)),code:B(N(c,"code",d)),attrs:Object.fromEntries(u.map(Wa))}),h=B(N(c,"parseHTML",d));h&&(f.parseDOM=h.map(g=>Fa(g,u)));const p=N(c,"renderHTML",d);return p&&(f.toDOM=g=>p({mark:g,HTMLAttributes:xn(g,u)})),[c.name,f]}));return new bu({topNode:s,nodes:l,marks:a})}function qy(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Un(t){return t.sort((n,r)=>{const i=N(n,"priority")||100,o=N(r,"priority")||100;return i>o?-1:i<o?1:0})}function _d(t){const e=Un(rl(t)),n=qy(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Ud(t,e,n){const{from:r,to:i}=e,{blockSeparator:o=`
11
12`,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(r,i,(a,c,u,d)=>{a.isBlock&&c>r&&(l+=o);const f=s?.[a.type.name];if(f)return u&&(l+=f({node:a,pos:c,parent:u,index:d,range:e})),!1;if(a.isText){var h;l+=a==null||(h=a.text)===null||h===void 0?void 0:h.slice(Math.max(r,c)-c,i-c)}}),l}function jd(t,e){return Ud(t,{from:0,to:t.content.size},e)}function ol(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function Jy(t,e){const n=oe(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,l=>{o.push(l)});const s=o.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function Kd(t,e){const n=Ui(typeof e=="string"?e:e.name,t.schema);return n==="node"?Jy(t,e):n==="mark"?Hd(t,e):{}}function Gy(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function Yy(t){const e=Gy(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function Ki(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,o)=>{const s=[];if(i.ranges.length)i.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=n[o];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{const c=e.slice(o).map(l,-1),u=e.slice(o).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),Yy(r)}function sl(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=tl(n.resolve(t),i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}const Xy=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let o=r,s=null;for(;o>0&&s===null;){const l=i.node(o);l?.type.name===e?s=l:o-=1}return[s,o]},Qy=t=>{const e=t.depth-1;if(e<0)return null;const n=t.index(e);return n===0?null:t.node(e).child(n-1)};function sn(t,e){return e.nodes[t]||e.marks[t]||null}function Vr(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}const Zy=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,l)=>{var a,c;const u=((a=(c=i.type.spec).toText)===null||a===void 0?void 0:a.call(c,{node:i,pos:o,parent:s,index:l}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-o))}),n};function cs(t,e,n={}){const{empty:r,ranges:i}=t.selection,o=e?ft(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>o?o.name===u.type.name:!0).find(u=>ti(u.attrs,n,{strict:!1}));let s=0;const l=[];if(i.forEach(({$from:u,$to:d})=>{const f=u.pos,h=d.pos;t.doc.nodesBetween(f,h,(p,g)=>{if(o&&p.inlineContent&&!p.type.allowsMarkType(o))return!1;if(!p.isText&&!p.marks.length)return;const m=Math.max(f,g),y=Math.min(h,g+p.nodeSize),v=y-m;s+=v,l.push(...p.marks.map(w=>({mark:w,from:m,to:y})))})}),s===0)return!1;const a=l.filter(u=>o?o.name===u.mark.type.name:!0).filter(u=>ti(u.mark.attrs,n,{strict:!1})).reduce((u,d)=>u+d.to-d.from,0),c=l.filter(u=>o?u.mark.type!==o&&u.mark.type.excludes(o):!0).reduce((u,d)=>u+d.to-d.from,0);return(a>0?a+c:a)>=s}function e0(t,e,n={}){if(!e)return dt(t,null,n)||cs(t,null,n);const r=Ui(e,t.schema);return r==="node"?dt(t,e,n):r==="mark"?cs(t,e,n):!1}const t0=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const o=ji(l=>l.type.name===e)(t.selection);if(!o)return!1;const s=t.doc.resolve(o.pos+1);return i.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},n0=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function _a(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function vo(t,e){const{nodeExtensions:n}=vn(e),r=n.find(o=>o.name===t);if(!r)return!1;const i=B(N(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof i!="string"?!1:i.split(" ").includes("list")}function br(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){if(n){if(t.type.name==="hardBreak")return!0;
vendor: 4,517 bytes, line 12
12if(t.isText){var r;return!/\S/.test((r=t.text)!==null&&r!==void 0?r:"")}}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(o=>{i!==!1&&(br(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function qd(t){return t instanceof O}var Jd=class Gd{constructor(e){this.position=e}static fromJSON(e){return new Gd(e.position)}toJSON(){return{position:this.position}}};function r0(t,e){const n=e.mapping.mapResult(t.position);return{position:new Jd(n.pos),mapResult:n}}function i0(t){return new Jd(t)}function Yd(t,e,n){const i=t.state.doc.content.size,o=lt(e,0,i),s=lt(n,0,i),l=t.coordsAtPos(o),a=t.coordsAtPos(s,-1),c=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),f=Math.max(l.right,a.right),h={top:c,bottom:u,left:d,right:f,width:f-d,height:u-c,x:d,y:c};return{...h,toJSON:()=>h}}function o0(t,e,n){const{selection:r}=e;let i=null;if(nl(r)&&(i=r.$cursor),i){var o;const l=(o=t.storedMarks)!==null&&o!==void 0?o:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(a=>a.type.excludes(n)))}const{ranges:s}=r;return s.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=h&&p}return!c}),c})}const s0=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:s,ranges:l}=o,a=ft(t,r.schema);if(i)if(s){const c=Hd(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),g=Math.min(h+f.nodeSize,d);f.marks.find(m=>m.type===a)?f.marks.forEach(m=>{a===m.type&&n.addMark(p,g,a.create({...m.attrs,...e}))}):n.addMark(p,g,a.create(e))})});return o0(r,n,a)},l0=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),a0=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const o=oe(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:l})=>ia(o,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>ia(o,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},c0=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=lt(t,0,r.content.size),o=O.create(r,i);e.setSelection(o)}return!0},u0=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=r;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=o.from,l=o.to),i&&n.doc.nodesBetween(s,l,(a,c)=>{a.isText||n.setNodeMarkup(c,void 0,{...a.attrs,dir:t})}),!0},d0=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=R.atStart(r).from,l=R.atEnd(r).to,a=lt(i,s,l),c=lt(o,s,l),u=R.create(r,a,c);e.setSelection(u)}return!0},f0=t=>({state:e,dispatch:n})=>{const r=oe(t,e.schema);return rm(r)(e,n)};function Ua(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}const h0=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:l,$to:a}=o,c=i.extensionManager.attributes,u=Vr(c,l.node().type.name,l.node().attrs);if(o instanceof O&&o.node.isBlock)return!l.parentOffset||!at(s,l.pos)?!1:(r&&(t&&Ua(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:zd(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=at(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&at(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(o instanceof R&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const g=e.mapping.map(l.before()),m=e.doc.resolve(g);l.node(-1).canReplaceWith(m.index(),m.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&Ua(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},p0=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{const s=oe(t,r.schema),{$from:l,$to:a}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;const u=l.node(-1);if(u.type!==s)return!1;const d=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if
12(l.depth===2||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){var f;let y=x.empty;const v=l.index(-1)?1:l.index(-2)?2:3;for(let E=l.depth-v;E>=l.depth-3;E-=1)y=x.from(l.node(E).copy(y));const w=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,b={...Vr(d,l.node().type.name,l.node().attrs),...e},k=((f=s.contentMatch.defaultType)===null||f===void 0?void 0:f.createAndFill(b))||void 0;y=y.append(x.from(s.createAndFill(null,k)||void 0));const S=l.before(l.depth-(v-1));n.replace(S,l.after(-w),new M(y,4-v,0));let C=-1;n.doc.nodesBetween(S,n.doc.content.size,(E,D)=>{if(C>-1)return!1;E.isTextblock&&E.content.size===0&&(C=D+1)}),C>-1&&n.setSelection(R.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const h=a.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...Vr(d,u.type.name,u.attrs),...e},g={...Vr(d,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,a.pos);const m=h?[{type:s,attrs:p},{type:h,attrs:g}]:[{type:s,attrs:p}];if(!at(n.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:v}=r,{splittableMarks:w}=o.extensionManager,b=v||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,m).scrollIntoView(),!b||!i)return!0;const k=b.filter(S=>w.includes(S.type.name));n.ensureMarks(k)}return!0};function ja(t){return!t||t==="1"?null:t}function Xd(t,e){return ja(t)===ja(e)}const xo=(t,e)=>{const n=ji(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&It(t.doc,n.pos))||!Xd(n.node.attrs.type,i?.attrs.type)||t.join(n.pos),!0},So=(t,e)=>{const n=ji(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&It(t.doc,r))||!Xd(n.node.attrs.type,i?.attrs.type)||t.join(r),!0};function m0(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),i=e.resolve(n.nodeSize-1);return R.between(r,i)}const g0=(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=oe(t,s.schema),p=oe(e,s.schema),{selection:g,storedMarks:m}=s,{$from:y,$to:v}=g,w=y.blockRange(v),b=m||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const k=ji(W=>vo(W.type.name,d))(g),S=g.from===0&&g.to===s.doc.content.size,C=s.doc.content.content,E=C.length===1?C[0]:null,D=S&&E&&vo(E.type.name,d)?{node:E,pos:0}:null,A=k??D,_=!!k&&w.depth>
12=1&&w.depth-k.depth<=1,G=!!D;if((_||G)&&A){if(A.node.type===h)return S&&G?a().command(({tr:W,dispatch:H})=>{const z=m0(W);return z?(W.setSelection(z),H&&H(W),!0):!1}).liftListItem(p).run():c.liftListItem(p);if(vo(A.node.type.name,d)&&h.validContent(A.node.content))return a().command(()=>(o.setNodeMarkup(A.pos,h),!0)).command(()=>xo(o,h)).command(()=>So(o,h)).run()}return!n||!b||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>xo(o,h)).command(()=>So(o,h)).run():a().command(()=>{const W=u().wrapInList(h,r),H=b.filter(z=>f.includes(z.type.name));return o.ensureMarks(H),W?!0:c.clearNodes()}).wrapInList(h,r).command(()=>xo(o,h)).command(()=>So(o,h)).run()},y0=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,s=ft(t,r.schema);return cs(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},b0=(t,e,n={})=>({state:r,commands:i})=>{const o=oe(t,r.schema),s=oe(e,r.schema),l=dt(r,o,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(s,a):i.setNode(o,{...a,...n})},w0=(t,e={})=>({state:n,commands:r})=>{const i=oe(t,n.schema);return dt(n,i,e)?r.lift(i):r.wrapIn(i,e)},v0=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let o;if(i.spec.isInputRules&&(o=i.getState(t))){if(e){const s=t.tr,l=o.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(o.text){const a=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,a))}else s.delete(o.from,o.to)}return!0}}return!1},x0=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:i=!1}=t,{selection:o}=e,{empty:s,ranges:l}=o;if(s)return!0;const{nonClearableMarks:a}=r.extensionManager;if(n){const c=Object.values(r.schema.marks).filter(u=>i||!a.includes(u.name));l.forEach(u=>{for(const d of c)e.removeMark(u.$from.pos,u.$to.pos,d)})}return!0},S0=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{extendEmptyMarkRange:o=!1}=e,{selection:s}=n,l=ft(t,r.schema),{$from:a,empty:c,ranges:u}=s;if(!i)return!0;if(c&&o){var d;let{from:f,to:h}=s;const p=tl(a,l,(d=a.marks().find(g=>g.type===l))===null||d===void 0?void 0:d.attrs);p&&(f=p.from,h=p.to),n.removeMark(f,h,l)}else u.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},k0=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let o,s;return typeof t=="number"?(o=t,s=t):t&&"from"in t&&"to"in t?(o=t.from,s=t.to):(o=i.from,s=i.to),r&&e.doc.nodesBetween(o,s,(l,a)=>{if(l.isText)return;const c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},C0=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const l=Ui(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(o=oe(t,r.schema)),l==="mark"&&(s=ft(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let f,h,p,g;n.selection.empty?r.doc.nodesBetween(u,d,(m,y)=>{o&&o===m.type&&(a=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m)}):r.doc.nodesBetween(u,d,(m,y)=>{y<u&&o&&o===m.type&&(a=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m),y>=u&&y<=d&&(o&&o===m.type&&(a=!0,i&&n.setNodeMarkup(y,void 0,{...m.attrs,...e})),s&&m.marks.length&&m.marks.forEach(v=>{if(s===v.type&&(a=!0,i)){const w=Math.max(y,u),b=Math.min(y+m.nodeSize,d);n.addMark(w,b,s.create({...v.attrs,...e}))}}))}),h&&(f!==void 0&&i&&n.setNodeMarkup(f,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(m=>{s===m.type&&i&&n.addMark(p,g,s.create({...m.attrs,...e}))}))}),a},cn=new U("__tiptap_decorations__"),T0=t=>({tr:e,dispatch:n})=>(n&&e.setMeta(cn,{type:"force",name:t}),!0),M0=(t,e={})=>({state:n,dispatch:r})=>{const i=oe(t,n.schema);return Yp(i,e)(n,r)},E0=(t,e={})=>({state:n,dispatch:r})=>{const i=oe(t,n.schema);return Xp(i,e)(n,r)};var A0=_h({blur:()=>Xg,clearContent:()=>Qg,clearNodes:()=>Zg,command:()=>ey,createParagraphNear:()=>ty,cut:()=>ny,deleteCurrentNode:()=>ry,deleteNode:()=>iy,deleteRange:()=>oy,deleteSelection:()=>ay,enter:()=>cy,exitCode:()=>uy,extendMarkRange:()=>dy,first:()=>fy,focus:()=>py,forEach:()=>my,insertContent:()=>gy,insertContentAt:()=>yy,insertDefaultBlock:()=>by,joinBackward:()=>xy,joinDown:()=>vy,joinForward:()=>Sy,joinItemBackward:()=>ky,joinItemForward:()=>Cy,joinTextblockBackward:()=>Ty,joinTextblockForward:()=>My,joinUp:()=>wy,keyboardShortcut:()=>Ay,lift:()=>Oy,liftEmptyBlock:()=>Ry,liftListItem:()=>Ny,newlineInCode:()=>Dy,resetAttributes:()=>Iy,scrollIntoView:()=>Ly,selectAll:()=>Py,selectNodeBackward:()=>$y,selectNodeForward:()=>zy,selectParentNode:()=>By,selectTextblockEnd:()=>Hy,selectTextblockStart:()=>Fy,setContent:()=>Vy,setMark:()=>s0,setMeta:()=>l0,setNode:()=>a0,setNodeSelection:()=>c0,setTextDirection:()=>u0,setTextSelection:()=>d0,sinkListItem:()=>f0,splitBlock:()=>h0,splitListItem:()=>p0,toggleList:()=>g0,toggleMark:()=>y0,toggleNode:()=>b0,toggleWrap:()=>w0,undoInputRule:()=>v0,unsetAllMarks:()=>x0,unsetMark:()=>S0,unsetTextDirection:()=>k0,updateAttributes:()=>C0,updateDecorations:()=>T0,wrapIn:()=>M0,wrapInList:()=>E0});const In=new WeakMap;function O0(t,e){var n;In.set(t,((n=In.get(t))!==null&&n!==void 0?n:0)+1);try{return e()}finally{var r;const i=((r=In.get(t))!==null&&r!==void 0?r:1)-1;i>0?In.set(t,i):In.delete(t)}}var R0=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];
12return 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 N0(t){return t.kind==="widget"}function Qd(t,e){const n=[],r=new Set;for(const i of t)i.kind==="widget"&&N0(i)&&r.add(i.key),n.push(i.toPMDecoration(e));return{decorations:n,widgetKeys:r}}function D0(t,e,n){const{decorations:r,widgetKeys:i}=Qd(e,n);return{set:$.create(t,r),widgetKeys:i}}function Zd({position:t,from:e,to:n,docSize:r}){return t<e?!1:t<n?!0:t===n&&n===r}function I0({decorations:t,from:e,to:n,docSize:r,extensionName:i,warnedExtensions:o}){return t.filter(s=>Zd({position:s.anchor,from:e,to:n,docSize:r})?!0:(s.anchor===n||o.has(i)||(o.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${e}, ${n}). It was ignored.`)),!1))}function L0(t){var e;const n=(e=t.spec)===null||e===void 0?void 0:e.key;return typeof n=="string"?n:void 0}function ef(t){return t.jsonID==="attr"}function P0(t){let e=!1;
12if(t.getMap().forEach(()=>{e=!0}),e||ef(t))return!0;const n=t;return typeof n.from=="number"&&typeof n.to=="number"}function $0(t,e){let n=null,r=0,i=0;for(let o=0;o<t.childCount&&!(i>e.to);o+=1){const s=i+t.child(o).nodeSize;s>=e.from&&(n===null&&(n=i),r=s),i=s}return n===null?null:{from:n,to:r}}function z0(t,e){if(t.steps.some(o=>!P0(o)))return{type:"full"};const n=Ki(t).map(({newRange:o})=>o);t.steps.forEach((o,s)=>{if(!ef(o))return;const l=t.mapping.slice(s);n.push({from:l.map(o.pos,-1),to:l.map(o.pos+1)})});const r=[];for(const o of n){const s=$0(e,o);s&&r.push(s)}r.sort((o,s)=>o.from-s.from);const i=[];for(const o of r){const s=i[i.length-1];s&&o.from<=s.to?s.to=Math.max(s.to,o.to):i.push({...o})}return{type:"ranges",ranges:i}}function tf(t,e,n,r){return t.map(e,n,{onRemove:i=>{const o=i?.key;typeof o=="string"&&r.delete(o)}})}function B0(t,e,n){var r,i;const o=(r=e.decorationSetsByExtension[t])!==null&&r!==void 0?r:$.empty,s=new Set((i=e.widgetKeysByExtension[t])!==null&&i!==void 0?i:[]);return{set:tf(o,n.mapping,n.doc,s),widgetKeys:s}}function Ka(t,e){const n=Object.values(e).flatMap(r=>r.find());return $.create(t,n)}function qa(t){const e=new Set;for(const n of Object.values(t))for(const r of n)e.add(r);return e}function H0(t,e){var n;switch((n=e.update)!==null&&n!==void 0?n:"document"){case"document":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(e.shouldUpdate)throw new Error(`[tiptap error]: Extension "${t}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${t}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function F0(t,e,n){return n?!0:t.update==="manual"?!1:t.shouldUpdate?t.shouldUpdate(e):e.tr.docChanged}const V0=new Set;var W0=class{constructor(t){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{const n=cn.getState(e);n&&this.warnDuplicateWidgetKeys(n)},this.editor=t.editor,this.entries=this.resolveEntries(t.entries),this.entries.forEach(({name:e,spec:n})=>H0(e,n)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var t,e;return(t=(e=cn.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&t!==void 0?t:V0}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(t){const e=[];for(const{name:n,addDecorations:r}of t){const i=r();i&&e.push({name:n,spec:i})}return e}createPlugin(){const{editor:t,entries:e}=this;return new V({key:cn,state:{init:(n,r)=>{const i={},o={};for(const{name:l,spec:a}of e){const{set:c,widgetKeys:u}=this.buildFullSet(l,a,r);i[l]=c,o[l]=u}const s={decorationSetsByExtension:i,widgetKeysByExtension:o,mergedDecorationSet:this.buildMergedSet(r.doc,i),widgetKeys:qa(o)};return this.warnDuplicateWidgetKeys(s),s},apply:(n,r,i,o)=>{const s=n.getMeta(cn),l=s?.type==="force"&&!s.name,a=s?.type==="force"?s.name:void 0,c={},u={},d=new Set;return O0(t,()=>{for(const{name:f,spec:h}of e){const p=l||a===f;if(F0(h,{editor:t,tr:n,oldState:i,newState:o},p))if(h.update==="changedRanges"&&n.docChanged&&!p){const g=this.applyChangedRangesRecompute(f,h,r,n,o);c[f]=g.set,u[f]=g.widgetKeys,d.add(f)}else{const{set:g,widgetKeys:m}=this.buildFullSet(f,h,o);c[f]=g,u[f]=m,d.add(f)}else{const g=B0(f,r,n);c[f]=g.set,u[f]=g.widgetKeys}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:c,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:e,previous:r,tr:n,decorationSetsByExtension:c,recomputedNames:d}),widgetKeys:qa(u)}}},props:{decorations(n){var r,i;return(r=(i=cn.getState(n))===null||i===void 0?void 0:i.mergedDecorationSet)!==null&&r!==void 0?r:$.empty}}})}applyChangedRangesRecompute(t,e,n,r,i){const o=z0(r,i.doc);return o.type==="full"?this.buildFullSet(t,e,i):this.rebuildRanges(t,e,n,r,i,o.ranges)}rebuildRanges(t,e,n,r,i,o){var s,l;const a=(s=n.decorationSetsByExtension[t])!==null&&s!==void 0?s:$.empty,c=new Set((l=n.widgetKeysByExtension[t])!==null&&l!==void 0?l:[]);let u=tf(a,r.mapping,r.doc,c);const d=i.doc.content.size;
12for(const{from:f,to:h}of o){const p=u.find(f,h).filter(y=>Zd({position:y.from,from:f,to:h,docSize:d}));for(const y of p){const v=L0(y);v&&c.delete(v)}u=u.remove(p);const{decorations:g,widgetKeys:m}=Qd(I0({decorations:this.runCreate(t,"createInRange",()=>e.createInRange({editor:this.editor,state:i,view:this.mountedView,from:f,to:h})),from:f,to:h,docSize:d,extensionName:t,warnedExtensions:this.warnedOutOfRangeExtensions}),t);u=u.add(i.doc,g);for(const y of m)c.add(y)}return{set:u,widgetKeys:c}}buildFullSet(t,e,n){const r=this.runCreate(t,"create",()=>e.create({editor:this.editor,state:n,view:this.mountedView}));return D0(n.doc,r,t)}runCreate(t,e,n){try{return n()}catch(r){return console.error(`[tiptap error]: Extension "${t}" threw in \`addDecorations().${e}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(t){}buildMergedSet(t,e){const n=Object.keys(e);return n.length===1?e[n[0]]:Ka(t,e)}mergeAfterApply({entries:t,previous:e,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return t.length===1?r[t[0].name]:i.size===0?e.mergedDecorationSet.map(n.mapping,n.doc):Ka(n.doc,r)}};function _0(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof O){const o=r.index();return r.parent.canReplaceWith(o,o+1,e)}let i=r.depth;for(;i>=0;){const o=r.index(i);if(r.node(i).contentMatchAt(o).matchType(e))return!0;i-=1}return!1}function U0(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}function j0(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function K0(t){return typeof t=="number"}function q0(t){return Object.prototype.toString.call(t).slice(8,-1)}function Tr(t){return q0(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function ll(t){return/\s/.test(t)}function J0(t){return/^[a-zA-Z]$/.test(t)}function nf(t){return/^\w$/.test(t)}function us(t,e){for(;e<t.length&&ll(t[e]);)e+=1;return e}function Sn(t,e){for(;e<t.length&&!ll(t[e]);)e+=1;return e}function rf(t,e,n){for(;e<t.length&&(nf(t[e])||n&&t[e]==="-");)e+=1;return e}function G0(t,e){const n=t[e],r=e+1,i=rf(t,r,!0);return i===r?{nextIndex:Sn(t,i)}:{token:{type:n==="."?"class":"id",name:t.slice(r,i)},nextIndex:Sn(t,i)}}function Y0(t,e){const n=t.indexOf(t[e],e+1);return{nextIndex:Sn(t,n===-1?e:n+1)}}function X0(t,e,n,r){let i=r?us(t,n):n;if(t[i]!=="=")return;i=r?us(t,i+1):i+1;const o=t[i];if(o!=='"'&&o!=="'")return;const s=t.indexOf(o,i+1);if(s!==-1)return{token:{type:"keyValue",name:e,value:t.slice(i+1,s)},nextIndex:Sn(t,s+1)}}function Q0(t,e,n){const r=n==="pandoc",i=rf(t,e+1,r),o=t.slice(e,i),s=X0(t,o,i,r);if(s)return s;const l=i===t.length||ll(t[i]);return{token:r&&l?{type:"boolean",name:o}:void 0,nextIndex:n==="shortcode"?Sn(t,i):i}}function Z0(t,e,n){const r=t[e];return n==="pandoc"&&(r==="."||r==="#")?G0(t,e):r==='"'||r==="'"?Y
120(t,e):(n==="pandoc"?J0(r):nf(r))?Q0(t,e,n):{nextIndex:Sn(t,e)}}function of(t,e){const n=[];let r=0;for(;r<t.length&&(r=us(t,r),!(r>=t.length));){const i=Z0(t,r,e);i.token&&n.push(i.token),r=i.nextIndex}return n}function eb(t){const e={},n=t.filter(i=>i.type==="class").map(i=>i.name),r=t.find(i=>i.type==="id");return n.length>0&&(e.class=n.join(" ")),r&&(e.id=r.name),t.forEach(i=>{i.type==="keyValue"&&(e[i.name]=i.value)}),t.forEach(i=>{i.type==="boolean"&&(e[i.name]=!0)}),e}function tb(t){return t?.trim()?eb(of(t,"pandoc")):{}}function nb(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(n=>e.push(`.${n}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function rb(t){const{nodeName:e,name:n,parseAttributes:r=tb,serializeAttributes:i=nb,defaultAttributes:o={},requiredAttributes:s=[],allowedAttributes:l}=t,a=n||e,c=u=>{if(!l)return u;const d={};return l.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...o,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(d=u.match(f))===null||d===void 0?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;const g=p[1]||"",m=r(g);if(!s.find(y=>!(y in m)))return{type:e,raw:p[0],attributes:m}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=i(d),h=f?` {${f}}`:"";return`:::${a}${h} :::`}}}function ib(t){const e={};return of(t,"shortcode").forEach(n=>{n.type==="keyValue"&&(e[n.name]=n.value)}),e}function ob(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function sb(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=ib,serializeAttributes:o=ob,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=t,c=n||e,u=f=>{if(!a)return f;const h={};return a.forEach(p=>{const g=typeof p=="string"?p:p.name,m=typeof p=="string"?void 0:p.skipIfDefault;if(g in f){const y=f[g];if(m!==void 0&&y===m)return;h[g]=y}}),h},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const p={...s,...f.attributes};if(l)return h.createNode(e,p);const g=r?r(f):f.content||"";return g?h.createNode(e,p,[h.createTextNode(g)]):h.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(f){const h=l?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=f.match(h),g=p?.index;return g!==void 0?g:-1},tokenize(f,h,p){const g=l?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),m=f.match(g);if(!m)return;let y="",v="";if(l){const[,b]=m;v=b}else{const[,b,k]=m;v=b,y=k||""}const w=i(v.trim());return{type:e,raw:m[0],content:y.trim(),attributes:w}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const p=u(f.attrs||{}),g=o(p),m=g?` ${g}`:"";return l?`[${c}${m}]`:`[${c}${m}]${h}[/${c}]`}}}function Ja(t,e,n){const r=t.split(`
13`),i=[];let o="",s=0;const l=e.baseIndentSize||2;for(;s<r.length;){const u=r[s],d=u.match(e.itemPattern);if(!d){if(i.length>0)break;if(u.trim()===""){s+=1,o=`${o}${u}
14`;continue}else return}const f=e.extractItemData(d),{indentLevel:h,mainContent:p}=f;o=`${o}${u}
15`;const g=[p];for(s+=1;s<r.length;){var a;const w=r[s];if(w.trim()===""){var c;const b=r.slice(s+1).findIndex(k=>k.trim()!=="");if(b===-1)break;if((((c=r[s+1+b].match(/^(\s*)/))===null||c===void 0||(c=c[1])===null||c===void 0?void 0:c.length)||0)>h){g.push(w),o=`${o}${w}
16`,s+=1;continue}else break}if((((a=w.match(/^(\s*)/))===null||a===void 0||(a=a[1])===null||a===void 0?void 0:a.length)||0)>h)g.push(w),o=`${o}${w}
17`,s+=1;else break}let m;const y=g.slice(1);if(y.length>0){const w=y.map(b=>b.slice(h+l)).join(`
18`);w.trim()&&(e.customNestedParser?m=e.customNestedParser(w):m=n.blockTokens(w))}const v=e.createToken(f,m);i.push(v)}if(i.length!==0)return{items:i,raw:o}}const Ga=4;function Ya(t){let e=0;for(const n of t)e=n==="	"?e+Ga-e%Ga:e+1;return e}function sf(t,e,n,r,i){if(!t||!Array.isArray(t.content))return"";const o=typeof n=="function"?n(r):n,[s,...l]=t.content;let a=`${o}${e.renderChildren([s])}`;return l&&l.length>0&&l.forEach((c,u)=>{var d,f;const h=(d=(f=e.renderChild)===null||f===void 0?void 0:f.call(e,c,u+1))!==null&&d!==void 0?d:e.renderChildren([c]);if(h!=null){const p=m=>{if(!i?.alignNestedToPrefix)return e.indent(m);const y=e.indent(""),v=Ya(o);return(Ya(y)>=v?y:" ".repeat(v))+m},g=h.split(`
19`).map(m=>p(m||"")).join(`
20`);a+=c.type==="paragraph"?`
21
22${g}`:`
23${g}`}}),a}function lf(t,e){const n={...t};return Tr(t)&&Tr(e)&&Object.keys(e).forEach(r=>{Tr(e[r])&&Tr(t[r])?n[r]=lf(t[r],e[r]):n[r]=e[r]}),n}function lb(t,e,n={}){const{state:r}=e,{doc:i,tr:o}=r,s=t;i.descendants((l,a)=>{const c=o.mapping.map(a),u=o.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(h=>{if(h!==s)return!1;d=h}),!d)return;let f=!1;
23if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});o.removeMark(c,u,t.type),o.addMark(c,u,h)}}),o.docChanged&&e.view.dispatch(o)}var En=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!==null&&e!==void 0?e:!0}};const ab=(t,e)=>{if(el(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 Mr(t){var e;const{editor:n,from:r,to:i,text:o,rules:s,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Zy(c)+o;return s.forEach(f=>{if(u)return;const h=ab(d,f.find);if(!h)return;const p=h[0].length-o.length;if(p>0){const k=c.parentOffset-p;if(k<0||c.parent.textBetween(k,c.parentOffset)!==h[0].slice(0,p))return}const g=a.state.tr,m=_i({state:a.state,transaction:g}),y={from:r-(h[0].length-o.length),to:i}
vendor: 5,252 bytes, lines 23-24
23,{commands:v,chain:w,can:b}=new hn({editor:n,state:m});f.handler({state:m,range:y,match:h,commands:v,chain:w,can:b})===null||!g.steps.length||(f.undoable&&g.setMeta(l,{transform:g,from:r,to:i,text:o}),a.dispatch(g),u=!0)}),u}function cb(t){const{editor:e,rules:n}=t,r=new V({state:{init(){return null},apply(i,o,s){const l=i.getMeta(r);if(l)return l;const a=i.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=il(x.from(c),s.schema);const{from:u}=a,d=u+c.length;Mr({editor:e,from:u,to:d,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,l){return Mr({editor:e,from:o,to:s,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&Mr({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?Mr({editor:e,from:s.pos,to:s.pos,text:`
24`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var al=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{...B(N(this,"addOptions",{name:this.name}))}}get storage(){return{...B(N(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>lf(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,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}},nn=class af extends al{constructor(...e){super(...e),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new af(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!o.find(l=>l?.type.name===n.name))return!1;const s=o.find(l=>l?.type.name===n.name);return s&&r.removeStoredMark(s),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},cl=class{constructor(t){this.find=t.find,this.handler=t.handler}};const ub=(t,e,n)=>{if(el(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function db(t){const{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=t,{commands:a,chain:c,can:u}=new hn({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(f,h)=>{var p,g,m,y;if(!((p=f.type)===null||p===void 0||(p=p.spec)===null||p===void 0)&&p.code||!(f.isText||f.isTextblock||f.isInline))return;const v=(g=(m=(y=f.content)===null||y===void 0?void 0:y.size)!==null&&m!==void 0?m:f.nodeSize)!==null&&g!==void 0?g:0,w=Math.max(r,h),b=Math.min(i,h+v);if(w>=b)return;const k=f.isText?f.text||"":f.textBetween(w-h,b-h,void 0,"");ub(k,o.find,s).forEach(S=>{if(S.index===void 0)return;const C=w+S.index+1,E=C+S[0].length,D={from:n.tr.mapping.map(C),to:n.tr.mapping.map(E)},A=o.handler({state:n,range:D,match:S,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(A)})}),d.every(f=>f!==null)}let Er=null;const fb=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function hb(t){const{editor:e,rules:n}=t;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:c,from:u,to:d,rule:f,pasteEvt:h})=>{const p=c.tr,g=_i({state:c,transaction:p});if(!(!db({editor:e,state:g,from:Math.max(u-1,0),to:d.b-1,rule:f,pasteEvent:h,dropEvent:l})||!p.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,p}};return n.map(c=>new V({view(u){const d=h=>{var p;r=!((p=u.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?u.dom.parentElement:null,r&&(Er=e)},f=()=>{Er&&(Er=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(u,d)=>{if(o=r===u.dom.parentElement,l=d,!o){const f=Er;f?.isEditable&&setTimeout(()=>{const h=f.state.selection;h&&f.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(u,d)=>{var f;const h=(f=d.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return s=d,i=!!h?.includes("data-pm-slice"),!1}}},appendTransaction:(u,d,f)=>{const h=u[0],p=h.getMeta("uiEvent")==="paste"&&!i,g=h.getMeta("uiEvent")==="drop"&&!o,m=h.getMeta("applyPasteRules"),y=!!m;if(!p&&!g&&!y)return;if(y){let{text:b}=m;typeof b=="string"?b=b:b=il(x.from(b),f.schema);const{from:k}=m,S=k+b.length,C=fb(b);return a({rule:c,state:f,from:k,to:{b:S},pasteEvt:C})}const v=d.doc.content.findDiffStart(f.doc.content),w=d.doc.content.findDiffEnd(f.doc.
24content);if(!(!K0(v)||!w||v===w.b))return a({rule:c,state:f,from:v,to:w,pasteEvt:s})}}))}var qi=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=e,this.baseExtensions=t,this.extensions=_d(t),this.schema=Ky(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n=N(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:sn(e.name,this.schema)});return n?{...t,...n()}:t},{})}get plugins(){const{editor:t}=this,e=Un([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:sn(r.name,this.schema)},o=[],s=N(r,"addKeyboardShortcuts",i);let l={};if(r.type==="mark"&&N(r,"exitable",i)&&(l.ArrowRight=()=>nn.handleExit({editor:t,mark:r})),s){const f=Object.fromEntries(Object.entries(s()).map(([h,p])=>[h,()=>p({editor:t})]));l={...l,...f}}const a=Yg(l);o.push(a);const c=N(r,"addInputRules",i);if(_a(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=cb({editor:t,rules:f}),p=Array.isArray(h)?h:[h];o.push(...p)}}const u=N(r,"addPasteRules",i);if(_a(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=hb({editor:t,rules:f});o.push(...h)}}const d=N(r,"addProseMirrorPlugins",i);if(d){const f=d();o.push(...f)}return o}),n=this.createDecorationPlugin();return n&&e.push(n),e}createDecorationPlugin(){var t;const{editor:e}=this;(t=this.decorationManager)===null||t===void 0||t.destroy();const n=[];return this.extensions.forEach(r=>{const i=N(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:sn(r.name,this.schema)});i&&n.push({name:r.name,addDecorations:i})}),this.decorationManager=new W0({editor:e,entries:n}),this.decorationManager.plugin}get attributes(){return Wd(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=vn(this.extensions);return Object.fromEntries(e.filter(n=>!!N(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i=N(n,"addNodeView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:oe(n.name,this.schema)});if(!i)return[];const o=i();if(!o)return[];const s=(l,a,c,u,d)=>{const f=xn(l,r);return o({node:l,view:a,getPos:c,decorations:u,innerDecorations:d,editor:t,extension:n,HTMLAttributes:f})};return[n.name,s]}))}dispatchTransaction(t){const{editor:e}=this;return Un([...this.extensions].reverse()).reduceRight((n,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:sn(r.name,this.schema)},o=N(r,"dispatchTransaction",i);return o?s=>{o.call(i,{transaction:s,next:n})}:n},t)}transformPastedHTML(t){const{editor:e}=this;return Un([...this.extensions]).reduce((n,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:sn(r.name,this.schema)},o=N(r,"transformPastedHTML",i);return o?(s,l)=>{const a=n(s,l);return o.call(i,a)}:n},t||(n=>n))}get markViews(){const{editor:t}=this,{markExtensions:e}=vn(this.extensions);return Object.fromEntries(e.filter(n=>!!N(n,"addMarkView")).map(n=>{const r=this.attributes.filter(s=>s.type===n.name),i=N(n,"addMarkView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ft(n.name,this.schema)});if(!i)return[];const o=(s,l,a)=>{const c=xn(s,r);return i()({mark:s,view:l,inline:a,editor:t,extension:n,HTMLAttributes:c,updateAttributes:u=>{lb(s,t,u)}})};return[n.name,o]}))}destroy(){var t;(t=this.decorationManager)===null||t===void 0||t.destroy(),this.extensions.forEach(e=>{let n=e;for(;n.parent;){const r=n.parent;r.child===n&&(r.child=null),n=r}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:sn(e.name,this.schema)};if(e.type==="mark"){var r,i;(!((r=B(N(e,"keepOnSplit",n)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(e.name),!((i=B(N(e,"clearable",n)))!==null&&i!==void 0)||i||this.nonClearableMarks.push(e.name)}const o=N(e,"onBeforeCreate",n),s=N(e,"onCreate",n),l=N(e,"onUpdate",n),a=N(e,"onSelectionUpdate",n),c=N(e,"onTransaction",n),u=N(e,"onFocus",n),d=N(e,"onBlur",n),f=N(e,"onDestroy",n);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),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};qi.resolve=_d;qi.sort=Un;qi.flatten=rl;var J=class cf extends al{constructor(...e){super(...e),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new cf(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};
24const pb=J.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new V({key:new U("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,o=ol(n),{blockSeparator:s}=this.options,l={...s!==void 0?{blockSeparator:s}:{},textSerializers:o};return[...i.ranges].sort((a,c)=>a.$from.pos-c.$from.pos).map(({$from:a,$to:c})=>Ud(r,{from:a.pos,to:c.pos},l)).join(s??`
25
26`)}}})]}}),mb=J.create({name:"commands",addCommands(){return{...A0}}}),gb=J.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r;const i=()=>{var o,s,l;if((o=(s=this.editor.options.coreExtensionOptions)===null||s===void 0||(s=s.delete)===null||s===void 0||(l=s.filterTransaction)===null||l===void 0?void 0:l.call(s,t))!==null&&o!==void 0?o:t.getMeta("y-sync$"))return;const a=Fd(t.before,[t,...e]);Ki(a).forEach(u=>{a.mapping.mapResult(u.oldRange.from).deletedAfter&&a.mapping.mapResult(u.oldRange.to).deletedBefore&&a.before.nodesBetween(u.oldRange.from,u.oldRange.to,(d,f)=>{const h=f+d.nodeSize-2,p=u.oldRange.from<=f&&h<=u.oldRange.to;this.editor.emit("delete",{type:"node",node:d,from:f,to:h,newFrom:a.mapping.map(f),newTo:a.mapping.map(h),deletedRange:u.oldRange,newRange:u.newRange,partial:!p,editor:this.editor,transaction:t,combinedTransform:a})})});const c=a.mapping;a.steps.forEach((u,d)=>{if(u instanceof ze){var f,h;const p=c.slice(d).map(u.from,-1),g=c.slice(d).map(u.to),m=c.invert().map(p,-1),y=c.invert().map(g),v=p>0?(f=a.doc.nodeAt(p-1))===null||f===void 0?void 0:f.marks.some(b=>b.eq(u.mark)):!1,w=(h=a.doc.nodeAt(g))===null||h===void 0?void 0:h.marks.some(b=>b.eq(u.mark));this.editor.emit("delete",{type:"mark",mark:u.mark,from:u.from,to:u.to,deletedRange:{from:m,to:y},newRange:{from:p,to:g},partial:!!(w||v),editor:this.editor,transaction:t,combinedTransform:a})}})};!((n=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&n!==void 0)||n?setTimeout(i,0):i()}}),yb=J.create({name:"drop",addProseMirrorPlugins(){return[new V({key:new U("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),bb=J.create({name:"editable",addProseMirrorPlugins(){return[new V({key:new U("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wb=new U("focusEvents"),vb=J.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new V({key:wb,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}}}})]}}),xb=J.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,g=p.parent.type.spec.isolating,m=d.pos-d.parentOffset,y=g&&p.parent.childCount===1?m===d.pos:I.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ni()||Bd()?o:i},addProseMirrorPlugins(){return[new V({key:new U("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(h=>h.getMeta("composition")))return;const r=t.some(h=>h.docChanged)&&!e.doc.eq(n.doc),i=t.some(h=>h.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:l}=e.selection,a=I.atStart(e.doc).from,c=I.atEnd(e.doc).to;
vendor: 13,781 bytes, lines 26-96
26if(o||!(s===a&&l===c)||!br(n.doc))return;const u=n.tr,d=_i({state:n,transaction:u}),{commands:f}=new hn({editor:this.editor,state:d});if(f.clearNodes(),!!u.steps.length)return u}})]}}),Sb=J.create({name:"paste",addProseMirrorPlugins(){return[new V({key:new U("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),kb=J.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new V({key:new U("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!==null&&t!==void 0?t:"0"}}}})]}}),Cb=J.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=vn(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new V({key:new U("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}});let Xa=!1;function Tb(t){if(Xa)return;Xa=!0;let e;try{e=te.fromJSON(t,{from:0,to:0}).slice.content}catch{return}e instanceof x||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}var Mb=class Bn{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get 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!==void 0?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 Bn(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 Bn(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 Bn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=n.isInline,l=this.pos+r+(o?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!i&&!s&&a.depth<=this.depth)return;const c=new Bn(a,this.editor,i,i||s?n:null);i&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const o=i.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const a=s[l];if(o[a]!==n[a])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(n);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(l=>n[l]===s.node.attrs[l])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}};const Eb=`.ProseMirror {
27  position: relative;
28}
29
30.ProseMirror {
31  word-wrap: break-word;
32  white-space: pre-wrap;
33  white-space: break-spaces;
34  -webkit-font-variant-ligatures: none;
35  font-variant-ligatures: none;
36  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
37}
38
39.ProseMirror [contenteditable="false"] {
40  white-space: normal;
41}
42
43.ProseMirror [contenteditable="false"] [contenteditable="true"] {
44  white-space: pre-wrap;
45}
46
47.ProseMirror pre {
48  white-space: pre-wrap;
49}
50
51img.ProseMirror-separator {
52  display: inline !important;
53  border: none !important;
54  margin: 0 !important;
55  width: 0 !important;
56  height: 0 !important;
57}
58
59.ProseMirror-gapcursor {
60  display: none;
61  pointer-events: none;
62  position: absolute;
63  margin: 0;
64}
65
66.ProseMirror-gapcursor:after {
67  content: "";
68  display: block;
69  position: absolute;
70  top: -2px;
71  width: 20px;
72  border-top: 1px solid black;
73  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
74}
75
76@keyframes ProseMirror-cursor-blink {
77  to {
78    visibility: hidden;
79  }
80}
81
82.ProseMirror-hideselection *::selection {
83  background: transparent;
84}
85
86.ProseMirror-hideselection *::-moz-selection {
87  background: transparent;
88}
89
90.ProseMirror-hideselection * {
91  caret-color: transparent;
92}
93
94.ProseMirror-focused .ProseMirror-gapcursor {
95  display: block;
96}`;var Ab=class extends R0{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:r0,createMappablePosition:i0},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);const e=this.createDoc();if(!this.editorState){const n=ls(e,this.options.autofocus);this.editorState=Bt.create({doc:e,schema:this.schema,selection:n||void 0})}Tb(this.schema),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():hn.createFakeChain()}can(){return this.commandManager?this.commandManager.can():hn.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=U0(Eb,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=Vd(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const o=typeof i=="string"?`${i}$`:i.key;n=n.filter(s=>!s.key.startsWith(o))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[bb,pb.configure({blockSeparator:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),mb,vb,xb,kb.configure({value:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.tabindex)===null||e===void 0?void 0:e.value}),yb,Sb,gb,Cb.configure({direction:this.options.textDirection})].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new qi(n,this)}createCommandManager(){this.commandManager=new hn({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=as(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;const n=as(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=Bt.create({doc:n,schema:this.schema,selection:ls(n,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,o=e.transformPastedHTML,s=this.extensionManager.transformPastedHTML(o);this.editorView=new Qs(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();const a=this.view.dom;a.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)===null||u===void 0?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),o=this.state;
96if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const s=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=s?.getMeta("focus"),a=s?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:s}),a&&this.emit("blur",{editor:this,event:a.event,transaction:s}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||o.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return Kd(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return e0(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return il(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
97
98`,textSerializers:n={}}=t||{};return jd(this.state.doc,{blockSeparator:e,textSerializers:{...ol(this.schema),...n}})}get isEmpty(){return br(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(t=(e=this.editorView)===null||e===void 0?void 0:e.isDestroyed)!==null&&t!==void 0?t:!0}$node(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new Mb(e,this,!1,n)}get $doc(){return this.$pos(0)}};function Xt(t){return new En({find:t.find,handler:({state:e,range:n,match:r})=>{const i=B(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],l=r[0];if(s){const a=l.search(/\S/),c=n.from+l.indexOf(s),u=c+s.length;if(sl(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(h=>h===t.type&&h!==f.mark.type)).filter(f=>f.to>c).length)return null;u<n.to&&o.delete(u,n.to),c>n.from&&o.delete(n.from+a,c);const d=n.from+a+s.length;o.addMark(n.from+a,d,t.type.create(i||{})),o.removeStoredMark(t.type)}},undoable:t.undoable})}function uf(t){return new En({find:t.find,handler:({state:e,range:n,match:r})=>{const i=B(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from;let l=n.to;const a=t.type.create(i);if(r[1]){let c=s+r[0].lastIndexOf(r[1]);c>l?c=l:l=c+r[1].length;const u=r[0][r[0].length-1];o.insertText(u,s+r[0].length-1),o.replaceWith(c,l,a)}else if(r[0]){const c=t.type.isInline?s:s-1;o.insert(c,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(l))}o.scrollIntoView()},undoable:t.undoable})}function ds(t){return new En({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),o=B(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)},undoable:t.undoable})}function ee(t){return new En({find:t.find,handler:({state:e,range:n,match:r})=>{let i=t.replace,o=n.from;const s=n.to;if(r[1]){const l=r[0].lastIndexOf(r[1]);i+=r[0].slice(l+r[1].length),o+=l;const a=o-s;a>0&&(i=r[0].slice(l-a,l)+i,o=s)}e.tr.insertText(i,o,s)},undoable:t.undoable})}function kn(t){return new En({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const o=B(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),a=l&&Ps(l,t.type,o);if(!a)return null;if(s.wrap(l,a),t.keepMarks&&t.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:f}=t.editor.extensionManager,h=d||u.$to.parentOffset&&u.$from.marks();if(h){const p=h.filter(g=>f.includes(g.type.name));s.ensureMarks(p)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,o).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&It(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)},undoable:t.undoable})}const Ob=t=>"touches"in t;var Rb=class{constructor(t){var e,n,r,i,o,s;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.clientX-this.startX,c=l.clientY-this.startY;this.handleResize(a,c)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.touches[0];if(!a)return;const c=a.clientX-this.startX,u=a.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>
98{if(!this.isResizing)return;const l=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(l,a),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)},this.node=t.node,this.editor=t.editor,this.element=t.element,this.element.draggable=!1,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,!((e=t.options)===null||e===void 0)&&e.min&&(this.minSize={...this.minSize,...t.options.min}),!((n=t.options)===null||n===void 0)&&n.max&&(this.maxSize=t.options.max),!(t==null||(r=t.options)===null||r===void 0)&&r.directions&&(this.directions=t.options.directions),!((i=t.options)===null||i===void 0)&&i.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),!((o=t.options)===null||o===void 0)&&o.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),!((s=t.options)===null||s===void 0)&&s.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!==null&&t!==void 0?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),i=e.includes("left"),o=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),i&&(t.style.left="0"),o&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}
98removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,Ob(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,t,e),o=this.applyConstraints(r,i,n);this.element.style.width=`${o.width}px`,this.element.style.height=`${o.height}px`,this.onResize&&this.onResize(o.width,o.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,i=this.startHeight;const o=t.includes("right"),s=t.includes("left"),l=t.includes("bottom"),a=t.includes("top");return o?r=this.startWidth+e:s&&(r=this.startWidth-e),l?i=this.startHeight+n:a&&(i=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(o?e:-e)),(t==="top"||t==="bottom")&&(i=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,t):{width:r,height:i}}applyConstraints(t,e,n){var r,i;if(!n){var o,s;let c=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return!((o=this.maxSize)===null||o===void 0)&&o.width&&(c=Math.min(this.maxSize.width,c)),!((s=this.maxSize)===null||s===void 0)&&s.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let l=t,a=e;return l<this.minSize.width&&(l=this.minSize.width,a=l/this.aspectRatio),a<this.minSize.height&&(a=this.minSize.height,l=a*this.aspectRatio),!((r=this.maxSize)===null||r===void 0)&&r.width&&l>this.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),!((i=this.maxSize)===null||i===void 0)&&i.height&&a>this.maxSize.height&&(a=this.maxSize.height,l=a*this.aspectRatio),{width:l,height:a}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",i=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:i?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}},ie=class df extends al{constructor(...e){super(...e),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new df(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Nt(t){return new cl({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const o=B(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const u=a.search(/\S/),d=n.from+a.indexOf(l),f=d+l.length;if(sl(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(p=>p===t.type&&p!==h.mark.type)).filter(h=>h.to>d).length)return null;f<n.to&&s.delete(f,n.to),d>n.from&&s.delete(n.from+u,d),c=n.from+u+l.length,s.addMark(n.from+u,c,t.type.create(o||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||s.removeStoredMark(t.type)}}})}function Nb(t){return new cl({find:t.find,handler({match:e,chain:n,range:r,pasteEvent:i}){const o=B(t.getAttributes,void 0,e,i),s=B(t.getContent,void 0,o);if(o===!1||o===null)return null;const l={type:t.type.name,attrs:o};s&&(l.content=s),e.input&&n().deleteRange(r).insertContentAt(r.from,l)}})}var ko={exports:{}},Co={};var Qa;function Db(){if(Qa)return Co;Qa=1;var t=Qc(),e=Zc();
98function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,s=t.useEffect,l=t.useMemo,a=t.useDebugValue;return Co.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=o(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=l(function(){function y(S){if(!v){if(v=!0,w=S,S=f(S),h!==void 0&&g.hasValue){var C=g.value;if(h(C,S))return b=C}return b=S}if(C=b,r(w,S))return C;var E=f(S);return h!==void 0&&h(C,E)?(w=S,C):(w=S,b=E)}var v=!1,w,b,k=d===void 0?null:d;return[function(){return y(u())},k===null?void 0:function(){return y(k())}]},[u,d,f,h]);var m=i(c,p[0],p[1]);return s(function(){g.hasValue=!0,g.value=m},[m]),a(m),m},Co}var Za;function Ib(){return Za||(Za=1,ko.exports=Db()),ko.exports}var ff=Ib();const zk=Hh(ff),Lb=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},Pb=({contentComponent:t})=>{const e=eu.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return $e.jsx($e.Fragment,{children:Object.values(e)})};function $b(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(i=>i())}))};return{subscribe(i){return t.add(i),()=>{t.delete(i)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(i,o){e={...e,[i]:Fh.createPortal(o.reactElement,o.element,i)},r()},removeRenderer(i){const o={...e};delete o[i],e=o,r()}}}var zb=class extends ut.Component{constructor(t){super(t),this.editorContentRef=ut.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&(!((t=e.view.dom)===null||t===void 0)&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=$b(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){const t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{var e;if(!(!((e=t.view.dom)===null||e===void 0)&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return $e.jsxs($e.Fragment,{children:[$e.jsx("div",{ref:Lb(e,this.editorContentRef),...n}),t?.contentComponent&&$e.jsx(Pb,{contentComponent:t.contentComponent})]})}};const Bb=P.forwardRef((t,e)=>{const n=ut.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return ut.createElement(zb,{key:n,innerRef:e,...t})}),Hb=ut.memo(Bb),Fb=typeof window<"u"?P.useLayoutEffect:P.useEffect;var Vb=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){let e;const n=i=>{i?.transaction!==void 0&&i.transaction===e||(e=i?.transaction,this.transactionNumber+=1,this.subscribers.forEach(o=>o()))},r=this.editor;return r.on("transaction",n),r.on("update",n),()=>{r.off("transaction",n),r.off("update",n)}}}};function Wb(t){var e;const[n]=P.useState(()=>new Vb(t.editor)),r=ff.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:Vh);return Fb(()=>n.watch(t.editor),[t.editor,n]),P.useDebugValue(r),r}const _b=!1,hf=typeof window>"u",Ub=hf||!!(typeof window<"u"&&window.next);var jb=class pf{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.get
98ServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){const e=this.options.current.immediatelyRender;let n=e??!0;return hf?(n&&_b&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):Ub&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var r,i;return(r=(i=this.options.current).onBeforeCreate)===null||r===void 0?void 0:r.call(i,...n)},onBlur:(...n)=>{var r,i;return(r=(i=this.options.current).onBlur)===null||r===void 0?void 0:r.call(i,...n)},onCreate:(...n)=>{var r,i;return(r=(i=this.options.current).onCreate)===null||r===void 0?void 0:r.call(i,...n)},onDestroy:(...n)=>{var r,i;return(r=(i=this.options.current).onDestroy)===null||r===void 0?void 0:r.call(i,...n)},onFocus:(...n)=>{var r,i;return(r=(i=this.options.current).onFocus)===null||r===void 0?void 0:r.call(i,...n)},onSelectionUpdate:(...n)=>{var r,i;return(r=(i=this.options.current).onSelectionUpdate)===null||r===void 0?void 0:r.call(i,...n)},onTransaction:(...n)=>{var r,i;return(r=(i=this.options.current).onTransaction)===null||r===void 0?void 0:r.call(i,...n)},onUpdate:(...n)=>{var r,i;return(r=(i=this.options.current).onUpdate)===null||r===void 0?void 0:r.call(i,...n)},onContentError:(...n)=>{var r,i;return(r=(i=this.options.current).onContentError)===null||r===void 0?void 0:r.call(i,...n)},onDrop:(...n)=>{var r,i;return(r=(i=this.options.current).onDrop)===null||r===void 0?void 0:r.call(i,...n)},onPaste:(...n)=>{var r,i;return(r=(i=this.options.current).onPaste)===null||r===void 0?void 0:r.call(i,...n)},onDelete:(...n)=>{var r,i;return(r=(i=this.options.current).onDelete)===null||r===void 0?void 0:r.call(i,...n)},onMount:(...n)=>{var r,i;return(r=(i=this.options.current).onMount)===null||r===void 0?void 0:r.call(i,...n)},onUnmount:(...n)=>{var r,i;return(r=(i=this.options.current).onUnmount)===null||r===void 0?void 0:r.call(i,...n)}};return new Ab(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,o)=>{var s;return i===((s=n.extensions)===null||s===void 0?void 0:s[o])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?pf.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((n,r)=>n===e[r]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Bk(t={},e=[]){const n=P.useRef(t);n.current=t;const[r]=P.useState(()=>new jb(n)),i=eu.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return P.useDebugValue(i),P.useEffect(r.onRender(e)),Wb({editor:i,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&o===0?0:o+1}),i}const ul=P.createContext({editor:null});ul.Consumer;const mf=()=>P.useContext(ul),Kb=P.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),qb=()=>P.useContext(Kb);ut.forwardRef((t,e)=>{const{onDragStart:n}=qb(),r=t.as||"div";
98return $e.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function ec(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function tc(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function Jb(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function Gb(t){if(ec(t)||tc(t))return!0;if(Jb(t)){const e=t.type;if(e)return ec(e)||tc(e)}return!1}function Yb(){try{if(P.version)return parseInt(P.version.split(".")[0],10)>=19}catch{}return!1}var Hk=class{constructor(t,{editor:e,props:n={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isEditorContentInitialized?Ds.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,i=Yb(),o=Gb(e),s={...n};s.ref&&!(i||o)&&delete s.ref,!s.ref&&(i||o)&&(s.ref=l=>{this.ref=l}),this.reactElement=$e.jsx(e,{...s}),r==null||(t=r.contentComponent)===null||t===void 0||t.setRenderer(this.id,this)}updateProps(t={}){if(this.destroyed)return;let e=!1;const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const i=n[r];if(t[i]!==this.props[i]){e=!0;break}}e&&(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;e==null||(t=e.contentComponent)===null||t===void 0||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};ut.createContext({markViewContentRef:()=>{}});const dl=P.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});dl.displayName="TiptapContext";const Xb=()=>P.useContext(dl);function gf({children:t,...e}){const n="editor"in e?e.editor:e.instance;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=P.useMemo(()=>({editor:n}),[n]),i=P.useMemo(()=>({editor:n}),[n]);return $e.jsx(ul.Provider,{value:i,children:$e.jsx(dl.Provider,{value:r,children:t})})}gf.displayName="Tiptap";function yf({...t}){const{editor:e}=Xb();return $e.jsx(Hb,{editor:e,...t})}yf.displayName="Tiptap.Content";Object.assign(gf,{Content:yf});const Qb=ie.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
99
100`):""}),Ar="&nbsp;",To=" ",Zb=ie.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",F(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===Ar||n[0].text===Ar||n[0].raw===To||n[0].text===To)&&r.length===1&&r[0].type==="text"&&(r[0].text===Ar||r[0].text===To)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{if(!t)return"";const r=Array.isArray(t.content)?t.content:[];if(r.length===0){var i,o;const s=Array.isArray(n==null||(i=n.previousNode)===null||i===void 0?void 0:i.content)?n.previousNode.content:[];return(n==null||(o=n.previousNode)===null||o===void 0?void 0:o.type)==="paragraph"&&s.length===0?Ar:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),ew=ie.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""});function tw(t={}){return new V({view(e){return new nw(e,t)}})}class nw{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>
vendor: 4,348 bytes, line 100
100{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,l=o.height/i.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=d?p.bottom:p.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let m=this.width/2*l;r={left:p.left,right:p.right,top:g-m,bottom:g+m}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Ou(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Q extends I{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Q.valid(r)?new Q(r):I.near(r)}content(){return M.empty}eq(e){return e instanceof Q&&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 Q(e.resolve(n.pos))}getBookmark(){return new fl(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!rw(e)||!iw(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Q.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(n>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let a=e.doc.resolve(i);if(Q.valid(a))return a}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!O.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let l=e.doc.resolve(i);if(Q.valid(l))return l}return null}}}Q.prototype.visible=!1;Q.findFrom=Q.findGapCursorFrom;I.jsonID("gapcursor",Q);class fl{constructor(e){this.pos=e}map(e){return new fl(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Q.valid(n)?new Q(n):I.near(n)}}function bf(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function rw(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||bf(i.type))return!0;
vendor: 9,686 bytes, line 100
100if(i.inlineContent)return!1}}return!0}function iw(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||bf(i.type))return!0;if(i.inlineContent)return!1}}return!0}function ow(){return new V({props:{decorations:cw,createSelectionBetween(t,e,n){return e.pos==n.pos&&Q.valid(n)?new Q(n):null},handleClick:lw,handleKeyDown:sw,handleDOMEvents:{beforeinput:aw}}})}const sw=Zs({ArrowLeft:Or("horiz",-1),ArrowRight:Or("horiz",1),ArrowUp:Or("vert",-1),ArrowDown:Or("vert",1)});function Or(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof R){if(!o.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=Q.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new Q(c))),!0):!1}}function lw(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Q.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&O.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Q(r))),!0)}function aw(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Q))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=x.empty;for(let s=r.length-1;s>=0;s--)i=x.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new M(i,0,0));return o.setSelection(R.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function cw(t){if(!(t.selection instanceof Q))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",$.create(t.doc,[re.widget(t.selection.head,e,{key:"gapcursor"})])}var ri=200,ae=function(){};ae.prototype.append=function(e){return e.length?(e=ae.from(e),!this.length&&e||e.length<ri&&this.leafAppend(e)||this.length<ri&&e.leafPrepend(this)||this.appendInner(e)):this};ae.prototype.prepend=function(e){return e.length?ae.from(e).append(this):this};ae.prototype.appendInner=function(e){return new uw(this,e)};ae.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ae.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ae.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ae.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)};ae.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},n,r),i};ae.from=function(e){return e instanceof ae?e:e&&e.length?new wf(e):ae.empty};var wf=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=ri)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=ri)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(ae);ae.empty=new wf([]);var uw=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(ae);const dw=500;class Pe{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),o=i.maps.length),o--,u.push(d);return}if(i){u.push(new Ue(d.map));let h=d.step.map(i.slice(o)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new Ue(p,void 0,void 0,c.length+u.length))),o--,p&&i.appendMap(p,o)}else s.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(o)):d.selection,a=new Pe(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,n,r,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new Ue(e.mapping.maps[u],d,n),h;(h=a&&a.merge(f))&&(f=h,u?o.pop():l=l.slice(0,l.length-1)),o.push(f),n&&(s++,n=void 0),i||(a=f)}let c=s-r.depth;return c>hw&&(l=fw(l,c),s-=c),new Pe(l.append(o),s)}remapping(e,n){let r=new nr;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new Pe(this.items.append(e.map(n=>new Ue(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=n;this.items.forEach(f=>{let h=o.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=o.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),m=f.selection&&f.selection.map(o.slice(a+1,h));m&&l++,r.push(new Ue(p,g,m))}else r.push(new Ue(p))},i);let c=[];for(let f=n;f<s;f++)c.push(new Ue(o.maps[f]));let u=this.items.slice(0,i).append(c).append(r),d=new Pe(u,l);return d.emptyItemCount()>dw&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=s.selection&&s.selection.map(n.slice(r));u&&o++;let d=new Ue(c.invert(),a,u),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else s.map&&r--},this.items.length,0),new Pe(ae.from(i.reverse()),o)}}Pe.empty=new Pe(ae.empty,0);function fw(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Ue{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Ue(n.getMap().invert(),n,this.selection)}}}class bt{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const hw=20;function pw(t,e,n,r){let i=n.getMeta(qt),o;if(i)return i.historyState;n.getMeta(yw)&&(t=new bt(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(qt))return s.getMeta(qt).redo?new bt(t.done.addTransform(n,void 0,r,Wr(e)),t.undone,nc(n.mapping.maps),t.prevTime,t.prevComposition):new bt(t.done,t.undone.addTransform(n,void 0,r,Wr(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!mw(n,t.prevRanges)),c=s?Mo(t.prevRanges,n.mapping):nc(n.mapping.maps);return new bt(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Wr(e)),Pe.empty,c,n.time,l??t.prevComposition)}else return(o=n.getMeta("rebased"))?new bt(t.done.rebased(n,o),t.undone.rebased(n,o),Mo(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new bt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Mo(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function mw(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0)}),n}function nc(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;
vendor: 4,161 bytes, line 100
100n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function Mo(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}function gw(t,e,n){let r=Wr(e),i=qt.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),a=new bt(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(qt,{redo:n,historyState:a})}let Eo=!1,rc=null;function Wr(t){let e=t.plugins;if(rc!=e){Eo=!1,rc=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Eo=!0;break}}return Eo}const qt=new U("history"),yw=new U("closeHistory");function bw(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new V({key:qt,state:{init(){return new bt(Pe.empty,Pe.empty,null,0,-1)},apply(e,n,r){return pw(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?xf:r=="historyRedo"?Sf:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function vf(t,e){return(n,r)=>{let i=qt.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=gw(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}const xf=vf(!1,!0),Sf=vf(!0,!0);J.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,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 n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}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 V({key:new U("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit,o=this.options.autoTrim;if(i==null||i===0||o===!1){t=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const l=s-i,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(a,c);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),o=this.storage.characters({node:e.doc});if(o<=r||i>r&&o>r&&o<=i)return!0;if(i>r&&o>r&&o>i||!e.getMeta("paste"))return!1;const s=e.selection.$head.pos,l=s-(o-r),a=s;return e.deleteRange(l,a),!(this.storage.characters({node:e.doc})>r)}})]}});const ww=J.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[tw(this.options)]}});J.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new V({key:new U("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!n||!r)return $.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(!a.isText){if(!(i>=c&&i<=c+a.nodeSize-1))return!1;s+=1}});let l=0;return t.descendants((a,c)=>{if(a.isText||!(i>=c&&i<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(re.node(c,c+a.nodeSize,{class:this.options.className}))}),$.create(t,o)}}})]}});const vw=J.create({name:"gapCursor",addProseMirrorPlugins(){return[ow()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=B(N(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),kf="placeholder",ic=new U("tiptap__placeholder");function Cf(t){const{editor:e,placeholder:n,dataAttribute:r,pos:i,node:o,isEmptyDoc:s,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=t,u=[a];return s&&u.push(c),re.node(i,i+o.nodeSize,{class:u.join(" "),[r]:typeof n=="function"?n({editor:e,node:o,pos:i,hasAnchor:l}):n}
100)}function Tf(t,e){return typeof t=="function"?t(e):t}function Mf({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:o,to:s}){const{anchor:l}=i,a=[],c=t.isEmpty;return r.nodesBetween(o,s,(u,d)=>{const f=l>=d&&l<=d+u.nodeSize,h=!u.isLeaf&&br(u);return u.type.isTextblock&&(f||!e.showOnlyCurrent)&&h&&a.push(Cf({editor:t,isEmptyDoc:c,dataAttribute:n,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Tf(e.emptyNodeClass,{editor:t,node:u,pos:d,hasAnchor:f})},node:u,pos:d})),e.includeChildren}),a}function Ef({editor:t,options:e,dataAttribute:n,doc:r,selection:i}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:o}=i,s=[],l=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const a=r.resolve(o),c=a.depth>0?a.node(1):a.nodeAfter,u=a.depth>0?a.before(1):o;if(c&&c.type.isTextblock&&br(c)){const d=o>=u&&o<=u+c.nodeSize;s.push(Cf({editor:t,isEmptyDoc:l,dataAttribute:n,hasAnchor:d,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Tf(e.emptyNodeClass,{editor:t,node:c,pos:u,hasAnchor:d})},node:c,pos:u}))}}else s.push(...Mf({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return $.create(r,s)}function jn(t,e){const n=t.resolve(e);if(n.depth===0){var r;const o=(r=n.nodeAfter)!==null&&r!==void 0?r:n.nodeBefore;if(!o)return{from:e,to:e};const s=n.nodeAfter?e:e-o.nodeSize;return{from:s,to:s+o.nodeSize}}const i=n.before(1);return{from:i,to:i+n.node(1).nodeSize}}function Kn(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function xw(t,e,n){const r=[];return t.forEach((i,o)=>{const s=o,l=s+i.nodeSize,a=s+1,c=l+1;a<n&&c>e&&r.push({from:s,to:l})}),r}function Sw(t){if(t.length===0)return[];const e=[...t].sort((r,i)=>r.from-i.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){const i=n[n.length-1],o=e[r];o.from<=i.to?i.to=Math.max(i.to,o.to):n.push({...o})}return n}function kw(t,e){const n=xw(t,e.from,e.to);return n.push(Kn(t,jn(t,e.from))),e.to>e.from?n.push(Kn(t,jn(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(Kn(t,jn(t,Math.min(e.from+1,t.content.size)))),n}function Cw(t,e,n){const r=[];if(t.docChanged){const i=Ki(t);for(const o of i)r.push(...kw(n.doc,o.newRange))}return t.selectionSet&&(r.push(Kn(n.doc,jn(n.doc,t.mapping.map(e.selection.anchor)))),r.push(Kn(n.doc,jn(n.doc,n.selection.anchor)))),Sw(r)}function Tw(t,e,n){const r=Math.max(0,Math.min(t,n.content.size));return{from:r,to:Math.max(r,Math.min(e,n.content.size))}}function Mw({decorations:t,ranges:e,editor:n,options:r,dataAttribute:i,doc:o,selection:s}){let l=t;for(const a of e){const{from:c,to:u}=Tw(a.from,a.to,o),d=l.find(c,u).filter(h=>h.from>=c&&h.to<=u);d.length&&(l=l.remove(d));const f=Mf({editor:n,options:r,dataAttribute:i,doc:o,selection:s,from:c,to:u});f.length&&(l=l.add(o,f))}return l}function Ew({editor:t,options:e,dataAttribute:n}){return{init(r,i){const o=Ef({editor:t,options:e,dataAttribute:n,doc:i.doc,selection:i.selection});return o??$.empty},apply(r,i,o,s){return!r.docChanged&&!r.selectionSet?i:Mw({decorations:i.map(r.mapping,r.doc),ranges:Cw(r,o,s),editor:t,options:e,dataAttribute:n,doc:s.doc,selection:s.selection})}}}function Aw(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function Ow({editor:t,options:e}){const n=e.dataAttribute?`data-${Aw(e.dataAttribute)}`:`data-${kf}`,r=e.showOnlyCurrent&&!e.includeChildren;return new V({key:ic,...r?{}:{state:Ew({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:i,selection:o})=>Ef({editor:t,options:e,dataAttribute:n,doc:i,selection:o}):i=>{var o;return e.showOnlyWhenEditable&&!t.isEditable?$.empty:(o=ic.getState(i))!==null&&o!==void 0?o:$.empty}}})}const Rw=J.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:kf,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Ow({editor:this.editor,options:this.options})]}});function fs(t,e){return!t.selection.empty&&!qd(t.selection)&&e.isEditable}function Nw(t,e){return fs(t,e)&&!e.isFocused&&!e.view.dragging}function Dw(){var t;(t=window.getSelection())===null||t===void 0||t.removeAllRanges()}function Iw(t){t.focus()}J.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new V({key:new U("selection"),props:{decorations(n){return Nw(n,t)?$.create(n.doc,[re.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return fs(n.state,t)&&Dw(),!1},focus(n){return fs(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&Iw(n)}),!1}}}})]}});function oc({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}const Lw=J.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new U(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)===null||t===void 0?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new V({key:e,appendTransaction:(i,o,s)=>{const{doc:l,tr:a,schema:c}
100=s,u=e.getState(s),d=l.content.size,f=c.nodes[n];if(!i.some(h=>h.getMeta("skipTrailingNode"))&&u)return a.insert(d,f.create())},state:{init:(i,o)=>{const s=o.tr.doc.lastChild;return!oc({node:s,types:r})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!oc({node:s,types:r})}}})]}}),Pw=J.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>xf(t,e),redo:()=>({state:t,dispatch:e})=>Sf(t,e)}},addProseMirrorPlugins(){return[bw(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()}}});var Fk=Rw;const Af=["top","right","bottom","left"],sc=["start","end"],lc=Af.reduce((t,e)=>t.concat(e,e+"-"+sc[0],e+"-"+sc[1]),[]),Fe=Math.min,pe=Math.max,ii=Math.round,Rr=Math.floor,Je=t=>({x:t,y:t}),$w={left:"right",right:"left",bottom:"top",top:"bottom"};function hs(t,e,n){return pe(t,Fe(e,n))}function ht(t,e){return typeof t=="function"?t(e):t}function Ie(t){return t.split("-")[0]}function He(t){return t.split("-")[1]}function Of(t){return t==="x"?"y":"x"}function hl(t){return t==="y"?"height":"width"}function qe(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function pl(t){return Of(qe(t))}function Rf(t,e,n){n===void 0&&(n=!1);const r=He(t),i=pl(t),o=hl(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=si(s)),[s,si(s)]}function zw(t){const e=si(t);return[oi(t),e,oi(e)]}function oi(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const ac=["left","right"],cc=["right","left"],Bw=["top","bottom"],Hw=["bottom","top"];function Fw(t,e,n){switch(t){case"top":case"bottom":return n?e?cc:ac:e?ac:cc;case"left":case"right":return e?Bw:Hw;default:return[]}}function Vw(t,e,n,r){const i=He(t);let o=Fw(Ie(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(oi)))),o}function si(t){const e=Ie(t);return $w[e]+t.slice(e.length)}function Ww(t){return{top:0,right:0,bottom:0,left:0,...t}}function ml(t){return typeof t!="number"?Ww(t):{top:t,right:t,bottom:t,left:t}}function Cn(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function uc(t,e,n){let{reference:r,floating:i}=t;const o=qe(e),s=pl(e),l=hl(s),a=Ie(e),c=o==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[l]/2-i[l]/2;let h;switch(a){case"top":h={x:u,y:r.y-i.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-i.width,y:d};break;default:h={x:r.x,y:r.y}}switch(He(e)){case"start":h[s]-=f*(n&&c?-1:1);break;case"end":h[s]+=f*(n&&c?-1:1);break}return h}async function _w(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:o,rects:s,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=ht(e,t),p=ml(h),m=l[f?d==="floating"?"reference":"floating":d],y=Cn(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(m)))==null||n?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),v=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,w=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),b=await(o.isElement==null?void 0:o.isElement(w))?await(o.getScale==null?void 0:o.getScale(w))||{x:1,y:1}:{x:1,y:1},k=Cn(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:w,strategy:a}):v);return{top:(y.top-k.top+p.top)/b.y,bottom:(k.bottom-y.bottom+p.bottom)/b.y,left:(y.left-k.left+p.left)/b.x,right:(k.right-y.right+p.right)/b.x}}const Uw=50,jw=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,l=s.detectOverflow?s:{...s,detectOverflow:_w},a=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:i}
100),{x:u,y:d}=uc(c,r,a),f=r,h=0;const p={};for(let g=0;g<o.length;g++){const m=o[g];if(!m)continue;const{name:y,fn:v}=m,{x:w,y:b,data:k,reset:S}=await v({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:c,platform:l,elements:{reference:t,floating:e}});u=w??u,d=b??d,p[y]={...p[y],...k},S&&h<Uw&&(h++,typeof S=="object"&&(S.placement&&(f=S.placement),S.rects&&(c=S.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):S.rects),{x:u,y:d}=uc(c,f,a)),g=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},Kw=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:l,middlewareData:a}=e,{element:c,padding:u=0}=ht(t,e)||{};if(c==null)return{};const d=ml(u),f={x:n,y:r},h=pl(i),p=hl(h),g=await s.getDimensions(c),m=h==="y",y=m?"top":"left",v=m?"bottom":"right",w=m?"clientHeight":"clientWidth",b=o.reference[p]+o.reference[h]-f[h]-o.floating[p],k=f[h]-o.reference[h],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let C=S?S[w]:0;(!C||!await(s.isElement==null?void 0:s.isElement(S)))&&(C=l.floating[w]||o.floating[p]);const E=b/2-k/2,D=C/2-g[p]/2-1,A=Fe(d[y],D),_=Fe(d[v],D),G=A,W=C-g[p]-_,H=C/2-g[p]/2+E,z=hs(G,H,W),j=!a.arrow&&He(i)!=null&&H!==z&&o.reference[p]/2-(H<G?A:_)-g[p]/2<0,se=j?H<G?H-G:H-W:0;return{[h]:f[h]+se,data:{[h]:z,centerOffset:H-z-se,...j&&{alignmentOffset:se}},reset:j}}});function qw(t,e,n){return(t?[...n.filter(i=>He(i)===t),...n.filter(i=>He(i)!==t)]:n.filter(i=>Ie(i)===i)).filter(i=>t?He(i)===t||(e?oi(i)!==i:!1):!0)}const Jw=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var n,r,i;const{rects:o,middlewareData:s,placement:l,platform:a,elements:c}=e,{crossAxis:u=!1,alignment:d,allowedPlacements:f=lc,autoAlignment:h=!0,...p}=ht(t,e),g=d!==void 0||f===lc?qw(d||null,h,f):f,m=await a.detectOverflow(e,p),y=((n=s.autoPlacement)==null?void 0:n.index)||0,v=g[y];if(v==null)return{};const w=Rf(v,o,await(a.isRTL==null?void 0:a.isRTL(c.floating)));if(l!==v)return{reset:{placement:g[0]}};const b=[m[Ie(v)],m[w[0]],m[w[1]]],k=[...((r=s.autoPlacement)==null?void 0:r.overflows)||[],{placement:v,overflows:b}],S=g[y+1];if(S)return{data:{index:y+1,overflows:k},reset:{placement:S}};const C=k.map(A=>{const _=He(A.placement);return[A.placement,_&&u?A.overflows.slice(0,2).reduce((G,W)=>G+W,0):A.overflows[0],A.overflows]}).sort((A,_)=>A[1]-_[1]),D=((i=C.filter(A=>A[2].slice(0,He(A[0])?2:3).every(_=>_<=0))[0])==null?void 0:i[0])||C[0][0];return D!==l?{data:{index:y+1,overflows:k},reset:{placement:D}}:{}}}},Gw=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...m}=ht(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=Ie(i),v=qe(l),w=Ie(l)===l,b=await(a.isRTL==null?void 0:a.isRTL(c.floating)),k=f||(w||!g?[si(l)]:zw(l)),S=p!=="none";!f&&S&&k.push(...Vw(l,g,p,b));const C=[l,...k],E=await a.detectOverflow(e,m),D=[];let A=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&D.push(E[y]),d){const H=Rf(i,s,b);D.push(E[H[0]],E[H[1]])}if(A=[...A,{placement:i,overflows:D}],!D.every(H=>H<=0)){var _,G;const H=(((_=o.flip)==null?void 0:_.index)||0)+1,z=C[H];if(z&&(!(d==="alignment"?v!==qe(z):!1)||A.every(be=>qe(be.placement)===v?be.overflows[0]>0:!0)))return{data:{index:H,overflows:A},reset:{placement:z}};let j=(G=A.filter(se=>se.overflows[0]<=0).sort((se,be)=>se.overflows[1]-be.overflows[1])[0])==null?void 0:G.placement;if(!j)switch(h){case"bestFit":{var W;const se=(W=A.filter(be=>{if(S){const Le=qe(be.placement);return Le===v||Le==="y"}return!0}).map(be=>[be.placement,be.overflows.filter(Le=>Le>0).reduce((Le,On)=>Le+On,0)]).sort((be,Le)=>be[1]-Le[1])[0])==null?void 0:W[0];se&&(j=se);break}case"initialPlacement":j=l;break}if(i!==j)return{reset:{placement:j}}}return{}}}};function dc(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function fc(t){return Af.some(e=>t[e]>=0)}const Yw=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...o}=ht(t,e);switch(i){case"referenceHidden":{const s=await r.detectOverflow(e,{...o,elementContext:"reference"}),l=dc(s,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:fc(l)}}}case"escaped":{const s=await r.detectOverflow(e,{...o,altBoundary:!0}),l=dc(s,n.floating);return{data:{escapedOffsets:l,escaped:fc(l)}}}default:return{}}}}};function Nf(t){const e=Fe(...t.map(o=>o.left)),n=Fe(...t.map(o=>o.top)),r=pe(...t.map(o=>o.right)),i=pe(...t.map(o=>o.bottom));return{x:e,y:n,width:r-e,height:i-n}}function Xw(t){const e=t.slice().sort((i,o)=>i.y-o.y),n=[];let r=null;for(let i=0;i<e.length;i++){const o=e[i];!r||o.y-r.y>r.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map(i=>Cn(Nf(i)))}const Qw=function(t){return t===void 0&&(t={}),{name:"inline",options:t,async fn(e){const{placement:n,elements:r,rects:i,platform:o,strategy:s}=e,{padding:l=2,x:a,y:c}=ht(t,e),u=Array.from(await(o.getClientRects==null?void 0:o.getClientRects(r.reference))||[]),d=Xw(u),f=Cn(Nf(u)),h=ml(l);function p(){if(d.length===2&&d[0].left>d[1].right&&a!=null&&c!=null)return d.find(m=>a>m.left-h.left&&a<m.right+h.right&&c>m.top-h.top&&c<m.bottom+h.bottom)||f;if(d.length>=2){if(qe(n)==="y"){const A=d[0],_=d[d.length-1],G=Ie(n)==="top",W=A.top,H=_.bottom,z=G?A.left:_.left,j=G?A.right:_.right,se=j-z,be=H-W;return{top:W,bottom:H,left:z,right:j,width:se,height:be,x:z,y:W}}const m=Ie(n)==="left",y=pe(...d.map(A=>A.right)),v=Fe(...d.map(A=>A.left)),w=d.filter(A=>m?A.left===v:A.right===y),b=w[0].top,k=w[w.length-1].bottom,S=v,C=y,E=C-S,D=k-b;return{top:b,bottom:k,left:S,right:C,width:E,height:D,x:S,y:b}}return f}const g=await o.getElementRects({reference:{getBoundingClientRect:p},floating:r.floating,strategy:s});return i.reference.x!==g.reference.x||i.reference.y!==g.reference.y||i.reference.width!==g.reference.width||i.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},Zw=new Set(["left","top"]);async function ev(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Ie(n),l=He(n),a=qe(n)==="y",c=Zw.has(s)?-1:1,u=o&&a?-1:1,d=ht(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}
vendor: 4,128 bytes, line 100
100:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof p=="number"&&(h=l==="end"?p*-1:p),a?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const tv=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:o,placement:s,middlewareData:l}=e,a=await ev(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+a.x,y:o+a.y,data:{...a,placement:s}}}}},nv=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:o}=e,{mainAxis:s=!0,crossAxis:l=!1,limiter:a={fn:y=>{let{x:v,y:w}=y;return{x:v,y:w}}},...c}=ht(t,e),u={x:n,y:r},d=await o.detectOverflow(e,c),f=qe(Ie(i)),h=Of(f);let p=u[h],g=u[f];if(s){const y=h==="y"?"top":"left",v=h==="y"?"bottom":"right",w=p+d[y],b=p-d[v];p=hs(w,p,b)}if(l){const y=f==="y"?"top":"left",v=f==="y"?"bottom":"right",w=g+d[y],b=g-d[v];g=hs(w,g,b)}const m=a.fn({...e,[h]:p,[f]:g});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:s,[f]:l}}}}}},rv=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:o,platform:s,elements:l}=e,{apply:a=()=>{},...c}=ht(t,e),u=await s.detectOverflow(e,c),d=Ie(i),f=He(i),h=qe(i)==="y",{width:p,height:g}=o.floating;let m,y;d==="top"||d==="bottom"?(m=d,y=f===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(y=d,m=f==="end"?"top":"bottom");const v=g-u.top-u.bottom,w=p-u.left-u.right,b=Fe(g-u[m],v),k=Fe(p-u[y],w),S=!e.middlewareData.shift;let C=b,E=k;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(E=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){const A=pe(u.left,0),_=pe(u.right,0),G=pe(u.top,0),W=pe(u.bottom,0);h?E=p-2*(A!==0||_!==0?A+_:pe(u.left,u.right)):C=g-2*(G!==0||W!==0?G+W:pe(u.top,u.bottom))}await a({...e,availableWidth:E,availableHeight:C});const D=await s.getDimensions(l.floating);return p!==D.width||g!==D.height?{reset:{rects:!0}}:{}}}};function Ji(){return typeof window<"u"}function An(t){return Df(t)?(t.nodeName||"").toLowerCase():"#document"}function Me(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ye(t){var e;return(e=(Df(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Df(t){return Ji()?t instanceof Node||t instanceof Me(t).Node:!1}function Ve(t){return Ji()?t instanceof Element||t instanceof Me(t).Element:!1}function pt(t){return Ji()?t instanceof HTMLElement||t instanceof Me(t).HTMLElement:!1}function hc(t){return!Ji()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Me(t).ShadowRoot}function wr(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=We(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function iv(t){return/^(table|td|th)$/.test(An(t))}function Gi(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const ov=/transform|translate|scale|rotate|perspective|filter/,sv=/paint|layout|strict|content/,Pt=t=>!!t&&t!=="none";let Ao;function gl(t){const e=Ve(t)?We(t):t;return Pt(e.transform)||Pt(e.translate)||Pt(e.scale)||Pt(e.rotate)||Pt(e.perspective)||!yl()&&(Pt(e.backdropFilter)||Pt(e.filter))||ov.test(e.willChange||"")||sv.test(e.contain||"")}function lv(t){let e=Dt(t);for(;pt(e)&&!Tn(e);){if(gl(e))return e;if(Gi(e))return null;e=Dt(e)}return null}function yl(){return Ao==null&&(Ao=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ao}function Tn(t){return/^(html|body|#document)$/.test(An(t))}function We(t){return Me(t).getComputedStyle(t)}function Yi(t){return Ve(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Dt(t){if(An(t)==="html")return t;const e=t.assignedSlot||t.parentNode||hc(t)&&t.host||Ye(t);return hc(e)?e.host:e}function If(t){const e=Dt(t);return Tn(e)?t.ownerDocument?t.ownerDocument.body:t.body:pt(e)&&wr(e)?e:If(e)}function cr(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=If(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Me(i);if(o){const l=ps(s);
vendor: 8,445 bytes, lines 100-101
100return e.concat(s,s.visualViewport||[],wr(i)?i:[],l&&n?cr(l):[])}else return e.concat(i,cr(i,[],n))}function ps(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Lf(t){const e=We(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=pt(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,l=ii(n)!==o||ii(r)!==s;return l&&(n=o,r=s),{width:n,height:r,$:l}}function bl(t){return Ve(t)?t:t.contextElement}function pn(t){const e=bl(t);if(!pt(e))return Je(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=Lf(e);let s=(o?ii(n.width):n.width)/r,l=(o?ii(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const av=Je(0);function Pf(t){const e=Me(t);return!yl()||!e.visualViewport?av:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function cv(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Me(t)?!1:e}function Qt(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=bl(t);let s=Je(1);e&&(r?Ve(r)&&(s=pn(r)):s=pn(t));const l=cv(o,n,r)?Pf(o):Je(0);let a=(i.left+l.x)/s.x,c=(i.top+l.y)/s.y,u=i.width/s.x,d=i.height/s.y;if(o){const f=Me(o),h=r&&Ve(r)?Me(r):r;let p=f,g=ps(p);for(;g&&r&&h!==p;){const m=pn(g),y=g.getBoundingClientRect(),v=We(g),w=y.left+(g.clientLeft+parseFloat(v.paddingLeft))*m.x,b=y.top+(g.clientTop+parseFloat(v.paddingTop))*m.y;a*=m.x,c*=m.y,u*=m.x,d*=m.y,a+=w,c+=b,p=Me(g),g=ps(p)}}return Cn({width:u,height:d,x:a,y:c})}function Xi(t,e){const n=Yi(t).scrollLeft;return e?e.left+n:Qt(Ye(t)).left+n}function $f(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Xi(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function uv(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=Ye(r),l=e?Gi(e.floating):!1;if(r===s||l&&o)return n;let a={scrollLeft:0,scrollTop:0},c=Je(1);const u=Je(0),d=pt(r);if((d||!d&&!o)&&((An(r)!=="body"||wr(s))&&(a=Yi(r)),d)){const h=Qt(r);c=pn(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=s&&!d&&!o?$f(s,a):Je(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-a.scrollTop*c.y+u.y+f.y}}function dv(t){return Array.from(t.getClientRects())}function fv(t){const e=Ye(t),n=Yi(t),r=t.ownerDocument.body,i=pe(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=pe(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Xi(t);const l=-n.scrollTop;return We(r).direction==="rtl"&&(s+=pe(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:l}}const pc=25;function hv(t,e){const n=Me(t),r=Ye(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,l=0,a=0;if(i){o=i.width,s=i.height;const u=yl();(!u||u&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}const c=Xi(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=pc&&(o-=p)}else c<=pc&&(o+=c);return{width:o,height:s,x:l,y:a}}function pv(t,e){const n=Qt(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=pt(t)?pn(t):Je(1),s=t.clientWidth*o.x,l=t.clientHeight*o.y,a=i*o.x,c=r*o.y;return{width:s,height:l,x:a,y:c}}function mc(t,e,n){let r;if(e==="viewport")r=hv(t,n);else if(e==="document")r=fv(Ye(t));else if(Ve(e))r=pv(e,n);else{const i=Pf(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Cn(r)}function zf(t,e){const n=Dt(t);return n===e||!Ve(n)||Tn(n)?!1:We(n).position==="fixed"||zf(n,e)}function mv(t,e){const n=e.get(t);if(n)return n;let r=cr(t,[],!1).filter(l=>Ve(l)&&An(l)!=="body"),i=null;const o=We(t).position==="fixed";let s=o?Dt(t):t;for(;Ve(s)&&!Tn(s);){const l=We(s),a=gl(s);!a&&l.position==="fixed"&&(i=null),(o?!a&&!i:!a&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||wr(s)&&!a&&zf(t,s))?r=r.filter(u=>u!==s):i=l,s=Dt(s)}return e.set(t,r),r}function gv(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?Gi(e)?[]:mv(e,this._c):[].concat(n),r],l=mc(e,s[0],i);let a=l.top,c=l.right,u=l.bottom,d=l.left;for(let f=1;f<s.length;f++){const h=mc(e,s[f],i);a=pe(h.top,a),c=Fe(h.right,c),u=Fe(h.bottom,u),d=pe(h.left,d)}return{width:c-d,height:u-a,x:d,y:a}}function yv(t){const{width:e,height:n}=Lf(t);return{width:e,height:n}}function bv(t,e,n){const r=pt(e),i=Ye(e),o=n==="fixed",s=Qt(t,!0,o,e);let l={scrollLeft:0,scrollTop:0};const a=Je(0);function c(){a.x=Xi(i)}if(r||!r&&!o)if((An(e)!=="body"||wr(i))&&(l=Yi(e)),r){const h=Qt(e,!0,o,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else i&&c();o&&!r&&i&&c();const u=i&&!r&&!o?$f(i,l):Je(0),d=s.left+l.scrollLeft-a.x-u.x,f=s.top+l.scrollTop-a.y-u.y;return{x:d,y:f,width:s.width,height:s.height}}function Oo(t){return We(t).position==="static"}function gc(t,e){if(!pt(t)||We(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Ye(t)===n&&(n=n.ownerDocument.body),n}function Bf(t,e){const n=Me(t);if(Gi(t))return n;if(!pt(t)){let i=Dt(t);for(;i&&!Tn(i);){if(Ve(i)&&!Oo(i))return i;i=Dt(i)}return n}let r=gc(t,e);for(;r&&iv(r)&&Oo(r);)r=gc(r,e);return r&&Tn(r)&&Oo(r)&&!gl(r)?n:r||lv(t)||n}const wv=async function(t){const e=this.getOffsetParent||Bf,n=this.getDimensions,r=await n(t.floating);return{reference:bv(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function vv(t){return We(t).direction==="rtl"}const xv={convertOffsetParentRelativeRectToViewportRelativeRect:uv,getDocumentElement:Ye,getClippingRect:gv,getOffsetParent:Bf,getElementRects:wv,getClientRects:dv,getDimensions:yv,getScale:pn,isElement:Ve,isRTL:vv};function Hf(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Sv(t,e){let n=null,r;const i=Ye(t);function o(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function s(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),o();const c=t.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(l||e(),!f||!h)return;const p=Rr(d),g=Rr(i.clientWidth-(u+f)),m=Rr(i.clientHeight-(d+h)),y=Rr(u),w={rootMargin:-p+"px "+-g+"px "+-m+"px "+-y+"px",threshold:pe(0,Fe(1,a))||1};let b=!0;function k(S){const C=S[0].intersectionRatio;if(C!==a){if(!b)return s();C?s(!1,C):r=setTimeout(()=>{s(!1,1e-7)},1e3)}C===1&&!Hf(c,t.getBoundingClientRect())&&s(),b=!1}try{n=new IntersectionObserver(k,{...w,root:i.ownerDocument})}catch{n=new IntersectionObserver(k,w)}n.observe(t)}return s(!0),o}function kv(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=bl(t),u=i||o?[...c?cr(c):[],...e?cr(e):[]]:[];u.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),o&&y.addEventListener("resize",n)});const d=c&&l?Sv(c,n):null;let f=-1,h=null;s&&(h=new ResizeObserver(y=>{let[v]=y;v&&v.target===c&&h&&e&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(e)})),n()}),c&&!a&&h.observe(c),e&&h.observe(e));let p,g=a?Qt(t):null;a&&m();function m(){const y=Qt(t);g&&!Hf(g,y)&&n(),g=y,p=requestAnimationFrame(m)}return n(),()=>{var y;u.forEach(v=>{i&&v.removeEventListener("scroll",n),o&&v.removeEventListener("resize",n)}),d?.(),(y=h)==null||y.disconnect(),h=null,a&&cancelAnimationFrame(p)}}const wl=tv,Ff=Jw,Vf=nv,vl=Gw,Wf=rv,_f=Yw,Uf=Kw,jf=Qw,xl=(t,e,n)=>{const r=new Map,i={platform:xv,...n},o={...i.platform,_c:r};return jw(t,e,{...i,platform:o})};function Cv(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:s,$position:l}=t,a=r&&!i,c=j0(n),u=new RegExp(`\\s${c}$`),d=s?"^":"",f=i?"":c,h=a?new RegExp(`${d}${c}.*?(?=\\s${f}|$)`,"gm"):new RegExp(`${d}(?:^)?${c}[^\\s${f}]*`,"gm"),p=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!p)return null;const g=l.pos-p.length,m=Array.from(p.matchAll(h)).pop();if(!m||m.input===void 0||m.index===void 0)return null;const y=m.input.slice(Math.max(0,m.index-1),m.index),v=new RegExp(`^[${o?.join("")}\0]?$`).test(y);if(o!==null&&!v)return null;const w=g+m.index;let b=w+m[0].length;return a&&u.test(p.slice(b-1,b+1))&&(m[0]+=" ",b+=1),w<l.pos&&b>=l.pos?{range:{from:w,to:b},query:m[0].slice(n.length),text:m[0]}:null}function Tv(t){return t.docChanged?t.steps.some(e=>{const n=e.slice;if(!n?.content)return!1;const r=n.content.textBetween(0,n.content.size,`
101`);return/\s/.test(r)}):!1}function Mv(t){return()=>
101{const e=t.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:o}=t.view.coordsAtPos(e);try{return new DOMRect(o,n,r-o,i-n)}catch{return null}}}function Ev(t,e,n,r){return n?()=>{const i=r.getState(t.state),o=i?.decorationId,s=e.dom.querySelector(`[data-decoration-id="${o}"]`);return s?.getBoundingClientRect()||null}:Mv(t)}function Av({match:t,dismissedRange:e,state:n,transaction:r,editor:i,shouldResetDismissed:o,effectiveAllowSpaces:s}){return o?.({editor:i,state:n,range:e,match:t,transaction:r,allowSpaces:s})?!1:s?t.range.from===e.from:t.range.from===e.from&&!Tv(r)}function Ov({view:t,pluginKeyRef:e}){const n=t.state.tr.setMeta(e,{exit:!0});t.dispatch(n)}function Rv({pluginKey:t,decorationTag:e,decorationClass:n,decorationContent:r,decorationEmptyClass:i,renderer:o,dispatchExit:s}){return{handleKeyDown(l,a){var c;const u=t.getState(l.state);if(!u.active)return!1;if(a.key==="Escape"||a.key==="Esc"){var d;return o==null||(d=o.onKeyDown)===null||d===void 0||d.call(o,{view:l,event:a,range:u.range}),s(l),!0}return(o==null||(c=o.onKeyDown)===null||c===void 0?void 0:c.call(o,{view:l,event:a,range:u.range}))||!1},decorations(l){const{active:a,range:c,decorationId:u,query:d}=t.getState(l);if(!a)return null;const f=!d?.length,h=[n];return f&&h.push(i),$.create(l.doc,[re.inline(c.from,c.to,{nodeName:e,class:h.join(" "),"data-decoration-id":u||void 0,"data-decoration-content":r})])}}}function Nv({editor:t,char:e,effectiveAllowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:o,findSuggestionMatch:s,allow:l,shouldShow:a,shouldKeepDismissed:c,pluginKey:u}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(d,f,h,p){const{isEditable:g}=t,{composing:m}=t.view,{selection:y}=d,{empty:v,from:w}=y,b={...f},k=d.getMeta(u);if(k&&k.exit)return b.active=!1,b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null,b.dismissedRange=f.active?{...f.range}:f.dismissedRange,b;if(b.composing=m,d.docChanged&&b.dismissedRange!==null&&(b.dismissedRange={from:d.mapping.map(b.dismissedRange.from),to:d.mapping.map(b.dismissedRange.to)}),g&&(v||t.view.composing)){(w<f.range.from||w>f.range.to)&&!m&&!f.composing&&(b.active=!1);const S=s({char:e,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:o,$position:y.$from}),C=`id_${Math.floor(Math.random()*4294967295)}`;S&&l({editor:t,state:p,range:S.range,isActive:f.active})&&(!a||a({editor:t,range:S.range,query:S.query,text:S.text,transaction:d}))?(b.dismissedRange!==null&&!c({match:S,dismissedRange:b.dismissedRange,state:p,transaction:d})&&(b.dismissedRange=null),b.dismissedRange===null?(b.active=!0,b.decorationId=f.decorationId||C,b.range=S.range,b.query=S.query,b.text=S.text):b.active=!1):(S||(b.dismissedRange=null),b.active=!1)}else b.active=!1;return b.active||(b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null),b}}}function Dv({editor:t,items:e}){let n=null,r=null,i=null;const o=()=>{r!==null&&(clearTimeout(r),r=null),i?.(),i=null},s=c=>new Promise(u=>{i=u,r=setTimeout(()=>{r=null;const d=i;i=null,d?.()},c)}),l=()=>{n?.abort(),o(),n=null};return{abort:l,fetch:async(c,u)=>{l(),n=new AbortController;const d=n;if(u>0&&await s(u),n!==d||d.signal.aborted)return{status:"aborted"};try{const f=await e({editor:t,query:c,signal:d.signal});return n!==d||d.signal.aborted?{status:"aborted"}:{status:"resolved",items:f}}catch{return n!==d||d.signal.aborted?{status:"aborted"}:{status:"error"}}}}}function Iv({placement:t,offset:e,flip:n,floatingUi:r}){var i,o,s,l;const a=[wl({mainAxis:(i=e.mainAxis)!==null&&i!==void 0?i:4,crossAxis:(o=e.crossAxis)!==null&&o!==void 0?o:0})];return n&&a.push(vl()),!(r==null||(s=r.middleware)===null||s===void 0)&&s.length&&a.push(...r.middleware),{placement:t,strategy:(l=r?.strategy)!==null&&l!==void 0?l:"absolute",middleware:a}}function Lv(t){if(t instanceof HTMLElement)return t;if(typeof t=="string")try{const e=document.querySelector(t);if(e)return e}catch{return document.body}return document.body}function Pv({getReferenceRect:t,contextElement:e,config:n,container:r,dismissOnOutsideClick:i,dismiss:o}){return(s,l={})=>{const a={getBoundingClientRect:()=>{var p;return(p=t())!==null&&p!==void 0?p:new DOMRect},contextElement:e};let c=!1;const u=!s.isConnected;u&&Lv(r).appendChild(s),l.onPosition||(s.style.visibility="hidden",s.style.width="max-content");const f=kv(a,s,()=>{xl(a,s,{placement:n.placement,strategy:n.strategy,middleware:n.middleware}).then(({x:p,y:g,placement:m,strategy:y})=>{if(l.onPosition){l.onPosition({x:p,y:g,placement:m,strategy:y});return}Object.assign(s.style,{position:y,left:`${p}px`,top:`${g}px`}),c||(c=!0,s.style.visibility="")})},l.autoUpdate);let h;return i&&(h=p=>{const g=p.target;!(g instanceof Node)||s.contains(g)||e.contains(g)||o()},document.addEventListener("pointerdown",h,!0)),()=>{f(),h&&document.removeEventListener("pointerdown",h,!0),u&&s.remove()}}}function $v({editor:t,pluginKey:e,items:n,renderer:r,minQueryLength:i,debounce:o,initialItems:s,placement:l,offset:a,container:c,flip:u,floatingUi:d,dismissOnOutsideClick:f,command:h,clientRectFor:p,dispatchExit:g}){let m;const y=Dv({editor:t,items:n}),v=Iv({placement:l,offset:a,flip:u,floatingUi:d});function w(b,k){switch(b){case"started":var S;r==null||(S=r.onStart)===null||S===void 0||S.call(r,k);break;case"updated":var C;r==null||(C=r.onUpdate)===null||C===void 0||C.call(r,k);break;case"stopped":var E;r==null||(E=r.onExit)===null||E===void 0||E.call(r,k)}}return{update:async(b,k)=>{var S,C;const E=e.getState(k),D=e.getState(b.state);if(!E||!D)return;let A=null;const _=E.query!==D.query,G=E.text!==D.text,W=E.range.from!==D.range.from||E.range.to!==D.range.to,H=_||G||W;if(!E.active&&D.active)A="started";else if(E.active&&!D.active)A="stopped";else if(D.active&&H)A="updated";else return;const z=A==="stopped"?E:D,j=b.dom.querySelector(`[data-decoration-id="${z.decorationId}"]`),se=p(b,j),be=i===0||(z.query?z.query.length>=i:!1),Le=(A==="started"||A==="updated")&&be;if(m={editor:t,range:z.range,query:z.query||"",text:z.text||"",items:s??[],command:Rn=>h({editor:t,range:z.range,props:Rn}),decorationNode:j,clientRect:se,loading:Le,placement:l,offset:{mainAxis:(S=a.mainAxis)!==null&&S!==void 0?S:4,crossAxis:(C=a.crossAxis)!==null&&C!==void 0?C:0},container:c,flip:u,floatingUi:v,mount:Pv({getReferenceRect:se,contextElement:b.dom,config:v,container:c,dismissOnOutsideClick:f,dismiss:()=>g(t.view)})},A==="started"){var On;
101r==null||(On=r.onBeforeStart)===null||On===void 0||On.call(r,m)}if(A==="updated"){var no;r==null||(no=r.onBeforeUpdate)===null||no===void 0||no.call(r,m)}if(A==="started"&&w(A,m),A==="started"||A==="updated")if(!Le)y.abort(),m={...m,items:s??[],loading:!1};else{m={...m,items:s??[],loading:!0},A="updated",w(A,m);const Rn=await y.fetch(z.query||"",o);if(Rn.status==="aborted")return;const ro=e.getState(b.state);if(!ro?.active){y.abort();return}m=Rn.status==="resolved"?{...m,items:Rn.items,loading:!1}:{...m,loading:!1}}if(A==="stopped"){y.abort(),w(A,m),m=void 0;return}A==="updated"&&w(A,m)},destroy:()=>{var b;y.abort(),m&&(r==null||(b=r.onExit)===null||b===void 0||b.call(r,m))}}}const zv=new U("suggestion");function Bv({pluginKey:t=zv,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:c="",decorationEmptyClass:u="is-empty",command:d=()=>null,items:f=()=>[],minQueryLength:h=0,debounce:p=0,initialItems:g,placement:m="bottom-start",offset:y={},container:v,flip:w=!0,floatingUi:b,dismissOnOutsideClick:k=!0,render:S=()=>({}),allow:C=()=>!0,findSuggestionMatch:E=Cv,shouldShow:D,shouldResetDismissed:A}){const _=S?.(),G=r&&!i,W=(j,se)=>Ev(e,j,se,t);function H(j){return Av({...j,editor:e,shouldResetDismissed:A,effectiveAllowSpaces:G})}const z=j=>Ov({view:j,pluginKeyRef:t});return new V({key:t,view:()=>$v({editor:e,pluginKey:t,items:f,renderer:_,minQueryLength:h,debounce:p,initialItems:g,placement:m,offset:y,container:v,flip:w,floatingUi:b,dismissOnOutsideClick:k,command:d,clientRectFor:W,dispatchExit:z}),state:Nv({editor:e,char:n,effectiveAllowSpaces:G,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:s,findSuggestionMatch:E,allow:C,shouldShow:D,shouldKeepDismissed:H,pluginKey:t}),props:Rv({pluginKey:t,decorationTag:l,decorationClass:a,decorationContent:c,decorationEmptyClass:u,renderer:_,dispatchExit:z})})}function Hv({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){return{editor:t,char:r,pluginKey:new U,command:({editor:i,range:o,props:s})=>{var l,a;const c=i.view.state.selection.$to.nodeAfter;!(c==null||(l=c.text)===null||l===void 0)&&l.startsWith(" ")&&(o.to+=1),i.chain().focus().insertContentAt(o,[{type:n,attrs:{...s,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(a=i.view.dom.ownerDocument.defaultView)===null||a===void 0||(a=a.getSelection())===null||a===void 0||a.collapseToEnd()},allow:({state:i,range:o})=>{const s=i.doc.resolve(o.from),l=i.schema.nodes[n];return!!s.parent.type.contentMatch.matchType(l)},...e}}function Kf(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Hv({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function yc(t,e){const n=Kf(t),r=n.find(i=>i.char===e);return r||(n.length?n[0]:null)}const Fv=ie.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e?.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,i;return["span",F(this.HTMLAttributes,t.HTMLAttributes),`${(r=n?.char)!==null&&r!==void 0?r:"@"}${(i=e.attrs.label)!==null&&i!==void 0?i:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=yc(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",F({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=F({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof i=="string"?["span",F({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...sb({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(?:^|\s)(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,o,s]=r;e[i==="char"?"mentionSuggestionChar":i]=o??s,r=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:yc(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:i,anchor:o}=r;if(!i)return!1;let s=new Ct,l=0;return e.doc.nodesBetween(o-1,o,(a,c)=>{if(a.type.name===this.name)return n=!0,s=a,l=c,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,l,l+s.nodeSize),n})}},addProseMirrorPlugins(){return Kf(this).map(Bv)}});var Vk=Fv;let ms,gs;if(typeof WeakMap<"u"){let t=new WeakMap;ms=e=>t.get(e),gs=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;ms=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},gs=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Z=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let o=r+1,s=i+1;for(let l=1;o<this.width&&this.map[e+l]==n;l++)o++;for(let l=1;s<this.height&&this.map[e+this.width*l]==n;l++)s++;return{left:r,top:i,right:o,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:o,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?o==0:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:o}=this.findCell(t),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(o,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const o=r*this.width+i,s=this.map[o];n[s]||(n[s]=!0,!(i==t.left&&i&&this.map[o-1]==s||r==t.top&&r&&this.map[o-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const o=i+n.child(r).nodeSize;if(r==t){let s=e+t*this.width;const l=(t+1)*this.width;for(;s<l&&this.map[s]<i;)s++;return s==l?o-1:this.map[s]}i=o}}static get(t){return ms(t)||gs(t,Vv(t))}};function Vv(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=Wv(t),n=t.childCount,r=[];let i=0,o=null;const s=[];for(let c=0,u=e*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const d=t.child(c);u++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const g=d.child(p),{colspan:m,rowspan:y,colwidth:v}=g.attrs;for(let w=0;w<y;w++){if(w+c>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:u,n:y-w});break}const b=i+w*e;for(let k=0;k<m;k++){r[b+k]==0?r[b+k]=u:(o||(o=[])).push({type:"collision",row:c,pos:u,n:m-k});const S=v&&v[k];if(S){const C=(b+k)%e*2,E=s[C];E==null||E!=S&&s[C+1]==1?(s[C]=S,s[C+1]=1):E==S&&s[C+1]++}}}i+=m,u+=g.nodeSize}const f=(c+1)*e;let h=0;for(;i<f;)r[i++]==0&&h++;h&&(o||(o=[])).push({type:"missing",row:c,n:h}),u++}(e===0||n===0)&&(o||(o=[])).push({type:"zero_sized"});const l=new Z(e,n,r,o);let a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<n&&(a=!0);return a&&_v(l,s,t),l}function Wv(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let o=0;if(n)for(let s=0;s<r;s++){const l=t.child(s);for(let a=0;a<l.childCount;a++){const c=l.child(a);s+c.attrs.rowspan>r&&(o+=c.attrs.colspan)}}for(let s=0;s<i.childCount;s++){const l=i.child(s);o+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function _v(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const o=t.map[i];if(r[o])continue;r[o]=!0;const s=n.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let l=null;const a=s.attrs;for(let c=0;c<a.colspan;c++){const u=e[(i+c)%t.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=Uv(a)))[c]=u)}l&&t.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:l})}}function Uv(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function ge(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};
101for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const xt=new U("selectingCells");function Zt(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 jv(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 _e(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 Qi(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=Zt(e.$head)||Kv(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Kv(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 ys(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function qv(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Sl(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function qf(t,e,n){const r=t.node(-1),i=Z.get(r),o=t.start(-1),s=i.nextCell(t.pos-o,e,n);return s==null?null:t.node(0).resolve(o+s)}function en(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Jf(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function Jv(t,e,n){const r=ge(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var q=class nt extends I{constructor(e,n=e){const r=e.node(-1),i=Z.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,n.pos-o),l=e.node(0),a=i.cellsInRect(s).filter(u=>u!=n.pos-o);a.unshift(n.pos-o);const c=a.map(u=>{const d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const f=o+u+1;return new Lu(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(ys(r)&&ys(i)&&Sl(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?nt.rowSelection(r,i):o&&this.isColSelection()?nt.colSelection(r,i):new nt(r,i)}return R.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Z.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let u=a*n.width+i.left,d=i.left;d<i.right;d++,u++){const f=n.map[u];if(o[f])continue;o[f]=!0;const h=n.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const g=i.left-h.left,m=h.right-i.right;if(g>0||m>0){let y=p.attrs;if(g>0&&(y=en(y,0,g)),m>0&&(y=en(y,y.colspan-m,m)),h.left<i.left){if(p=p.type.createAndFill(y),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else p=p.type.create(y,p.content)}if(h.top<i.top||h.bottom>i.bottom){const y={...p.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?p=p.type.createAndFill(y):p=p.type.create(y,p.content)}c.push(p)}s.push(e.child(a).copy(x.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new M(x.from(l),1,1)}replace(e,n=M.empty){const r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){const{$from:l,$to:a}=i[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?M.empty:n)}const o=I.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,n){this.replace(e,new M(x.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Z.get(n),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)e(n.nodeAt(o[s]),i+o[s])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;
vendor: 4,606 bytes, line 101
101return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Z.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(n.pos-o),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(o+i.map[s.left])),l.bottom<i.height&&(n=a.resolve(o+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(o+i.map[l.left])),s.bottom<i.height&&(e=a.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new nt(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Z.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),o=n.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,l=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==n.width}eq(e){return e instanceof nt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Z.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(n.pos-o),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(o+i.map[s.top*i.width])),l.right<i.width&&(n=a.resolve(o+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(o+i.map[l.top*i.width])),s.right<i.width&&(e=a.resolve(o+i.map[i.width*(s.top+1)-1]))),new nt(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new nt(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new nt(e.resolve(n),e.resolve(r))}getBookmark(){return new Gv(this.$anchorCell.pos,this.$headCell.pos)}};q.prototype.visible=!1;I.jsonID("cell",q);var Gv=class Gf{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Gf(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&&Sl(n,r)?new q(n,r):I.near(r,1)}};function Yv(t){if(!(t.selection instanceof q))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(re.node(r,r+n.nodeSize,{class:"selectedCell"}))}),$.create(t.doc,e)}function Xv({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let o=e.depth;o>=0&&!(e.before(o+1)>e.start(o));o--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function Qv({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const o=t.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let i=e.depth;i>0;i--){const o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return n!==r&&e.parentOffset===0}function Zv(t,e,n){const r=(e||t).selection,i=(e||t).doc;let o,s;if(r instanceof O&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=q.create(i,r.from);else if(s=="row"){const l=i.resolve(r.from+1);o=q.rowSelection(l,l)}else if(!n){const l=Z.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];o=q.create(i,a+1,c)}}else r instanceof R&&Xv(r)?o=R.create(i,r.from):r instanceof R&&Qv(r)&&(o=R.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}const e1=new U("fix-tables");function Yf(t,e,n,r){const i=t.childCount,o=e.childCount;e:for(let s=0,l=0;s<o;s++){const a=e.child(s);for(let c=l,u=Math.min(i,s+3);c<u;c++)if(t.child(c)==a){l=c+1,n+=a.nodeSize;continue e}r(a,n),l<i&&t.child(l).sameMarkup(a)?Yf(t.child(l),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function Xf(t,e){let n;const r=(i,o)=>{i.type.spec.tableRole=="table"&&(n=t1(t,i,o,n))};return e?e.doc!=t.doc&&Yf(e.doc,t.doc,0,r):t.doc.descendants(r),n}function t1(t,e,n,r){const i=Z.get(e);if(!i.problems)return r;r||(r=t.tr);const o=[];for(let a=0;a<i.height;a++)o.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)o[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,en(d,d.colspan-c.n,c.n))}else if(c.type=="missing")o[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(n);r.delete(u,u+e.nodeSize)}}let s,l;for(let a=0;a<o.length;a++)o[a]&&(s==null&&(s=a),l=a);for(let a=0,c=n+1;a<i.height;
101a++){const u=e.child(a),d=c+u.nodeSize,f=o[a];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const p=[];for(let m=0;m<f;m++){const y=ge(t.schema)[h].createAndFill();y&&p.push(y)}const g=(a==0||s==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(g),p)}c=d}return r.setMeta(e1,{fixTables:!0})}function Xe(t){const e=t.selection,n=Qi(t),r=n.node(-1),i=n.start(-1),o=Z.get(r);return{...e instanceof q?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function Qf(t,{map:e,tableStart:n,table:r},i){let o=i>0?-1:0;Jv(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);t.setNodeMarkup(t.mapping.map(n+a),null,Jf(c.attrs,i-e.colCount(a))),s+=c.attrs.rowspan-1}else{const a=o==null?ge(r.type.schema).cell:r.nodeAt(e.map[l+o]).type,c=e.positionAt(s,i,r);t.insert(t.mapping.map(n+c),a.createAndFill())}}return t}function n1(t,e){if(!_e(t))return!1;if(e){const n=Xe(t);e(Qf(t.tr,n,n.left))}return!0}function r1(t,e){if(!_e(t))return!1;if(e){const n=Xe(t);e(Qf(t.tr,n,n.right))}return!0}function i1(t,{map:e,table:n,tableStart:r},i){const o=t.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+i,a=e.map[l],c=n.nodeAt(a),u=c.attrs;if(i>0&&e.map[l-1]==a||i<e.width-1&&e.map[l+1]==a)t.setNodeMarkup(t.mapping.slice(o).map(r+a),null,en(u,i-e.colCount(a)));else{const d=t.mapping.slice(o).map(r+a);t.delete(d,d+c.nodeSize)}s+=u.rowspan}}function o1(t,e){if(!_e(t))return!1;if(e){const n=Xe(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;i1(r,n,i),i!=n.left;i--){const o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw new RangeError("No table found");n.table=o,n.map=Z.get(o)}e(r)}return!0}function s1(t,e,n){var r;const i=ge(e.type.schema).header_cell;for(let o=0;o<t.width;o++)if(((r=e.nodeAt(t.map[o+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function Zf(t,{map:e,tableStart:n,table:r},i){let o=n;for(let c=0;c<i;c++)o+=r.child(c).nodeSize;const s=[];let l=i>0?-1:0;s1(e,r,i+l)&&(l=i==0||i==e.height?null:0);for(let c=0,u=e.width*i;c<e.width;c++,u++)if(i>0&&i<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],f=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{var a;const d=l==null?ge(r.type.schema).cell:(a=r.nodeAt(e.map[u+l*e.width]))===null||a===void 0?void 0:a.type,f=d?.createAndFill();f&&s.push(f)}return t.insert(o,ge(r.type.schema).row.create(null,s)),t}function l1(t,e){if(!_e(t))return!1;if(e){const n=Xe(t);e(Zf(t.tr,n,n.top))}return!0}function a1(t,e){if(!_e(t))return!1;if(e){const n=Xe(t);e(Zf(t.tr,n,n.bottom))}return!0}function c1(t,{map:e,table:n,tableStart:r},i){let o=0;for(let c=0;c<i;c++)o+=n.child(c).nodeSize;const s=o+n.child(i).nodeSize,l=t.mapping.maps.length;t.delete(o+r,s+r);const a=new Set;for(let c=0,u=i*e.width;c<e.width;c++,u++){const d=e.map[u];if(!a.has(d)){if(a.add(d),i>0&&d==e.map[u-e.width]){const f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(i<e.height&&d==e.map[u+e.width]){const f=n.nodeAt(d),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(l).map(r+g),p),c+=h.colspan-1}}}}function u1(t,e){if(!_e(t))return!1;if(e){const n=Xe(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;c1(r,n,i),i!=n.top;i--){const o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw new RangeError("No table found");n.table=o,n.map=Z.get(n.table)}e(r)}return!0}function bc(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function d1({width:t,height:e,map:n},r){let i=r.top*t+r.left,o=i,s=(r.bottom-1)*t+r.left,l=i+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&n[o]==n[o-1]||r.right<t&&n[l]==n[l+1])return!0;o+=t,l+=t}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[s]==n[s+t])return!0;i++,s++}return!1}function wc(t,e){const n=t.selection;if(!(n instanceof q)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Xe(t),{map:i}=r;if(d1(i,r))return!1;if(e){const o=t.tr,s={};let l=x.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const f=i.map[u*i.width+d],h=r.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,a==null)a=f,c=h;else{bc(h)||(l=l.append(h.content));const p=o.mapping.map(f+r.tableStart);o.delete(p,p+h.nodeSize)}}if(a==null||c==null)return!0;
vendor: 4,387 bytes, line 101
101if(o.setNodeMarkup(a+r.tableStart,null,{...Jf(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){const u=a+1+c.content.size,d=bc(c)?a+1:u;o.replaceWith(d+r.tableStart,u+r.tableStart,l)}o.setSelection(new q(o.doc.resolve(a+r.tableStart))),e(o)}return!0}function vc(t,e){const n=ge(t.schema);return f1(({node:r})=>n[r.type.spec.tableRole])(t,e)}function f1(t){return(e,n)=>{const r=e.selection;let i,o;if(r instanceof q){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,o=r.$anchorCell.pos}else{var s;if(i=jv(r.$from),!i)return!1;o=(s=Zt(r.$from))===null||s===void 0?void 0:s.pos}if(i==null||o==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let l=i.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const u=Xe(e),d=e.tr;for(let h=0;h<u.right-u.left;h++)a.push(c?{...l,colwidth:c&&c[h]?[c[h]]:null}:l);let f;for(let h=u.top;h<u.bottom;h++){let p=u.map.positionAt(h,u.left,u.table);h==u.top&&(p+=i.nodeSize);for(let g=u.left,m=0;g<u.right;g++,m++)g==u.left&&h==u.top||d.insert(f=d.mapping.map(p+u.tableStart,1),t({node:i,row:h,col:g}).createAndFill(a[m]))}d.setNodeMarkup(o,t({node:i,row:u.top,col:u.left}),a[0]),r instanceof q&&d.setSelection(new q(d.doc.resolve(r.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function h1(t,e){return function(n,r){if(!_e(n))return!1;const i=Qi(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const o=n.tr;n.selection instanceof q?n.selection.forEachCell((s,l)=>{s.attrs[t]!==e&&o.setNodeMarkup(l,null,{...s.attrs,[t]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(o)}return!0}}function p1(t){return function(e,n){if(!_e(e))return!1;if(n){const r=ge(e.schema),i=Xe(e),o=e.tr,s=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=s.map(a=>i.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[a],r.cell,l[a].attrs);if(o.steps.length===0)for(let a=0;a<s.length;a++)o.setNodeMarkup(i.tableStart+s[a],r.header_cell,l[a].attrs);n(o)}return!0}}function xc(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const o=e.table.nodeAt(r[i]);if(o&&o.type!==n.header_cell)return!1}return!0}function ur(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?p1(t):function(n,r){if(!_e(n))return!1;if(r){const i=ge(n.schema),o=Xe(n),s=n.tr,l=xc("row",o,i),a=xc("column",o,i),c=(t==="column"?l:t==="row"&&a)?1:0,u=t=="column"?{left:0,top:c,right:1,bottom:o.map.height}:t=="row"?{left:c,top:0,right:o.map.width,bottom:1}:o,d=t=="column"?a?i.cell:i.header_cell:t=="row"?l?i.cell:i.header_cell:i.cell;o.map.cellsInRect(u).forEach(f=>{const h=f+o.tableStart,p=s.doc.nodeAt(h);p&&s.setNodeMarkup(h,d,p.attrs)}),r(s)}return!0}}ur("row",{useDeprecatedLogic:!0});ur("column",{useDeprecatedLogic:!0});const m1=ur("cell",{useDeprecatedLogic:!0});function g1(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const o=t.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const o=n.child(r);if(o.childCount)return i+1;i+=o.nodeSize}}return null}function Sc(t){return function(e,n){if(!_e(e))return!1;const r=g1(Qi(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(R.between(i,qv(i))).scrollIntoView())}return!0}}function y1(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 Nr(t,e){const n=t.selection;if(!(n instanceof q))return!1;if(e){const r=t.tr,i=ge(t.schema).cell.createAndFill().content;n.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new M(i,0,0))}),r.docChanged&&e(r)}return!0}function b1(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,l=[];
101if(o=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const u=a?0:Math.max(0,n-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=bs(ge(s).row,new M(c,u,d)).content),l.push(c)}else if(o=="cell"||o=="header_cell")l.push(n||r?bs(ge(s).row,new M(e,n,r)).content:e);else return null;return w1(s,l)}function w1(t,e){const n=[];for(let i=0;i<e.length;i++){const o=e[i];for(let s=o.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=o.child(s).attrs;for(let c=i;c<i+l;c++)n[c]=(n[c]||0)+a}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(x.empty),n[i]<r){const o=ge(t).cell.createAndFill(),s=[];for(let l=n[i];l<r;l++)s.push(o);e[i]=e[i].append(x.from(s))}return{height:e.length,width:r,rows:e}}function bs(t,e){const n=t.createAndFill();return new $s(n).replace(0,n.content.size,e).doc}function v1({width:t,height:e,rows:n},r,i){if(t!=r){const o=[],s=[];for(let l=0;l<n.length;l++){const a=n[l],c=[];for(let u=o[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(en(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)o[l+h]=(o[l+h]||0)+f.attrs.colspan}s.push(x.from(c))}n=s,t=r}if(e!=i){const o=[];for(let s=0,l=0;s<i;s++,l++){const a=[],c=n[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),a.push(d)}o.push(x.from(a))}n=o,e=i}return{width:t,height:e,rows:n}}function x1(t,e,n,r,i,o,s){const l=t.doc.type.schema,a=ge(l);let c,u;if(i>e.width)for(let d=0,f=0;d<e.height;d++){const h=n.child(d);f+=h.nodeSize;const p=[];let g;h.lastChild==null||h.lastChild.type==a.cell?g=c||(c=a.cell.createAndFill()):g=u||(u=a.header_cell.createAndFill());for(let m=e.width;m<i;m++)p.push(g);t.insert(t.mapping.slice(s).map(f-1+r),p)}if(o>e.height){const d=[];for(let p=0,g=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const m=p>=e.width?!1:n.nodeAt(e.map[g+p]).type==a.header_cell;d.push(m?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const f=a.row.create(null,x.from(d)),h=[];for(let p=e.height;p<o;p++)h.push(f);t.insert(t.mapping.slice(s).map(r+n.nodeSize-2),h)}return!!(c||u)}function kc(t,e,n,r,i,o,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=i;c<o;c++){const u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;const f=n.nodeAt(d),{top:h,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:s-h}),t.insert(t.mapping.slice(l).map(e.positionAt(s,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),c+=f.attrs.colspan-1}}return a}function Cc(t,e,n,r,i,o,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=i;c<o;c++){const u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){a=!0;const f=n.nodeAt(d),h=e.colCount(d),p=t.mapping.slice(l).map(d+r);t.setNodeMarkup(p,null,en(f.attrs,s-h,f.attrs.colspan-(s-h))),t.insert(p+f.nodeSize,f.type.createAndFill(en(f.attrs,0,s-h))),c+=f.attrs.rowspan-1}}return a}function Tc(t,e,n,r,i){let o=n?t.doc.nodeAt(n-1):t.doc;if(!o)throw new Error("No table found");let s=Z.get(o);const{top:l,left:a}=r,c=a+i.width,u=l+i.height,d=t.tr;let f=0;function h(){if(o=n?d.doc.nodeAt(n-1):d.doc,!o)throw new Error("No table found");s=Z.get(o),f=d.mapping.maps.length}x1(d,s,o,n,c,u,f)&&h(),kc(d,s,o,n,a,c,l,f)&&h(),kc(d,s,o,n,a,c,u,f)&&h(),Cc(d,s,o,n,l,u,a,f)&&h(),Cc(d,s,o,n,l,u,c,f)&&h();for(let p=l;p<u;p++){const g=s.positionAt(p,a,o),m=s.positionAt(p,c,o);d.replace(d.mapping.slice(f).map(g+n),d.mapping.slice(f).map(m+n),new M(i.rows[p-l],0,0))}h(),d.setSelection(new q(d.doc.resolve(n+s.positionAt(l,a,o)),d.doc.resolve(n+s.positionAt(u-1,c-1,o)))),e(d)}const S1=Zs({ArrowLeft:Dr("horiz",-1),ArrowRight:Dr("horiz",1),ArrowUp:Dr("vert",-1),ArrowDown:Dr("vert",1),"Shift-ArrowLeft":Ir("horiz",-1),"Shift-ArrowRight":Ir("horiz",1),"Shift-ArrowUp":Ir("vert",-1),"Shift-ArrowDown":Ir("vert",1),Backspace:Nr,"Mod-Backspace":Nr,Delete:Nr,"Mod-Delete":Nr});function _r(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Dr(t,e){return(n,r,i)=>{if(!i)return!1;const o=n.selection;if(o instanceof q)return _r(n,r,I.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;const s=eh(i,t,e);if(s==null)return!1;if(t=="horiz")return _r(n,r,I.near(n.doc.resolve(o.head+e),e));{const l=n.doc.resolve(s),a=qf(l,t,e);let c;return a?c=I.near(a,1):e<0?c=I.near(n.doc.resolve(l.before(-1)),-1):c=I.near(n.doc.resolve(l.after(-1)),1),_r(n,r,c)}}}function Ir(t,e){return(n,r,i)=>{if(!i)return!1;const o=n.selection;let s;if(o instanceof q)s=o;else{const a=eh(i,t,e);if(a==null)return!1;s=new q(n.doc.resolve(a))}const l=qf(s.$headCell,t,e);return l?_r(n,r,new q(s.$anchorCell,l)):!1}}function k1(t,e){const n=t.state.doc,r=Zt(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new q(r))),!0):!1}function C1(t,e,n){if(!_e(t.state))return!1;let r=b1(n);const i=t.state.selection;if(i instanceof q){r||(r={width:1,height:1,rows:[x.from(bs(ge(t.state.schema).cell,n))]});const o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),l=Z.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=v1(r,l.right-l.left,l.bottom-l.top),Tc(t.state,t.dispatch,s,l,r),!0}else if(r){const o=Qi(t.state),s=o.start(-1);return Tc(t.state,t.dispatch,s,Z.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function T1(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Mc(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof q)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Zt(t.state.selection.$anchor))!=null&&((n=Ro(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(a,c){let u=Ro(t,c);const d=xt.getState(t.state)==null;if(!u||!Sl(a,u))if(d)u=a;else return;const f=new q(a,u);if(d||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);d&&h.setMeta(xt,a.pos),t.dispatch(h)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",l),xt.getState(t.state)!=null&&t.dis
101patch(t.state.tr.setMeta(xt,-1))}function l(a){const c=a,u=xt.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(Mc(t,c.target)!=r&&(d=Ro(t,e),!d))return s();d&&o(d,c)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",l)}function eh(t,e,n){if(!(t.state.selection instanceof R))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const s=r.before(i),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?s:null}}return null}function Mc(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Ro(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&Zt(t.state.doc.resolve(r))||Zt(t.state.doc.resolve(i))}var M1=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")),ws(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,ws(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ws(t,e,n,r,i,o){let s=0,l=!0,a=e.firstChild;const c=t.firstChild;if(c){for(let d=0,f=0;d<c.childCount;d++){const{colspan:h,colwidth:p}=c.child(d).attrs;for(let g=0;g<h;g++,f++){const m=i==f?o:p&&p[g],y=m?m+"px":"";if(s+=m||r,m||(l=!1),a)a.style.width!=y&&(a.style.width=y),a=a.nextSibling;else{const v=document.createElement("col");v.style.width=y,e.appendChild(v)}}}for(;a;){var u;const d=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=d}l?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}const Ce=new U("tableColumnResizing");function E1({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=M1,lastColumnResizable:i=!0}={}){const o=new V({key:Ce,state:{init(s,l){var a;const c=(a=o.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=ge(l.schema).table.name;return r&&c&&(c[u]=(d,f)=>new r(d,n,f)),new A1(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=Ce.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{O1(s,l,t,i)},mouseleave:s=>{R1(s)},mousedown:(s,l)=>{N1(s,l,e,n)}},decorations:s=>{const l=Ce.getState(s);if(l&&l.activeHandle>-1)return $1(s,l.activeHandle)},nodeViews:{}}});return o}var A1=class Ur{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Ce);if(r&&r.setHandle!=null)return new Ur(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Ur(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return ys(e.doc.resolve(i))||(i=-1),new Ur(i,n.dragging)}return n}};function O1(t,e,n,r){if(!t.editable)return;const i=Ce.getState(t.state);if(i&&!i.dragging){const o=I1(e.target);let s=-1;if(o){const{left:l,right:a}=o.getBoundingClientRect();e.clientX-l<=n?s=Ec(t,e,"left",n):a-e.clientX<=n&&(s=Ec(t,e,"right",n))}if(s!=i.activeHandle){if(!r&&s!==-1){const l=t.state.doc.resolve(s),a=l.node(-1),c=Z.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}th(t,s)}}}function R1(t){if(!t.editable)return;const e=Ce.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&th(t,-1)}function N1(t,e,n,r){var i;if(!t.editable)return!1;const o=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,s=Ce.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=t.state.doc.nodeAt(s.activeHandle),a=D1(t,s.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Ce,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",u);const f=Ce.getState(t.state);
101f?.dragging&&(L1(t,f.activeHandle,Ac(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(Ce,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=Ce.getState(t.state);if(f&&f.dragging){const h=Ac(f.dragging,d,n);Oc(t,f.activeHandle,h,r)}}return Oc(t,s.activeHandle,a,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",u),e.preventDefault(),!0}function D1(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=t.domAtPos(e);let s=o.node.childNodes[o.offset].offsetWidth,l=n;if(r)for(let a=0;a<n;a++)r[a]&&(s-=r[a],l--);return s/l}function I1(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Ec(t,e,n,r){const i=n=="right"?-r:r,o=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!o)return-1;const{pos:s}=o,l=Zt(t.state.doc.resolve(s));if(!l)return-1;if(n=="right")return l.pos;const a=Z.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function Ac(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function th(t,e){t.dispatch(t.state.tr.setMeta(Ce,{setHandle:e}))}function L1(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),o=Z.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let c=0;c<o.height;c++){const u=c*o.width+l;if(c&&o.map[u]==o.map[u-o.width])continue;const d=o.map[u],f=i.nodeAt(d).attrs,h=f.colspan==1?0:l-o.colCount(d);if(f.colwidth&&f.colwidth[h]==n)continue;const p=f.colwidth?f.colwidth.slice():P1(f.colspan);p[h]=n,a.setNodeMarkup(s+d,null,{...f,colwidth:p})}a.docChanged&&t.dispatch(a)}function Oc(t,e,n,r){const i=t.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),l=Z.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;let a=t.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&ws(o,a.firstChild,a,r,l,n)}function P1(t){return Array(t).fill(0)}function $1(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return $.empty;const o=Z.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<o.height;c++){const u=l+c*o.width;if((l==o.width-1||o.map[u]!=o.map[u+1])&&(c==0||o.map[u]!=o.map[u-o.width])){var a;const d=o.map[u],f=s+d+i.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=Ce.getState(t))===null||a===void 0)&&a.dragging&&n.push(re.node(s+d,s+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(re.widget(f,h))}}return $.create(t.doc,n)}function z1({allowTableNodeSelection:t=!1}={}){return new V({key:xt,state:{init(){return null},apply(e,n){const r=e.getMeta(xt);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:o}=e.mapping.mapResult(n);return i?null:o}},props:{decorations:Yv,handleDOMEvents:{mousedown:T1},createSelectionBetween(e){return xt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:k1,handleKeyDown:S1,handlePaste:C1},appendTransaction(e,n,r){return Zv(r,Xf(r,n),t)}})}function B1(t,e){const n=Math.min(t.top,e.top),r=Math.max(t.bottom,e.bottom),i=Math.min(t.left,e.left),o=Math.max(t.right,e.right)-i,s=r-n;return new DOMRect(i,n,o,s)}var H1=class{get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(vl(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(Vf(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(wl(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(Uf(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(Wf(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(Ff(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(_f(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(jf(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}get virtualElement(){var t,e;const{selection:n}=this.editor.state,r=(t=this.getReferencedVirtualElement)===null||t===void 0?void 0:t.call(this);if(r)return r;if(!(!((e=this.view)===null||e===void 0||(e=e.dom)===null||e===void 0)&&e.parentNode))return;const i=Yd(this.view,n.from,n.to);let o={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(n instanceof O){let s=this.view.nodeDOM(n.from);const l=s.dataset.nodeViewWrapper?s:s.querySelector("[data-node-view-wrapper]");l&&(s=l),s&&(o={getBoundingClientRect:()=>s.getBoundingClientRect(),getClientRects:()=>[s.getBoundingClientRect()]})}if(n instanceof q){const{$anchorCell:s,$headCell:l}=n,a=s?s.pos:l.pos,c=l?l.pos:s.pos,u=this.view.nodeDOM(a),d=this.view.nodeDOM(c);if(!u||!d)return;const f=u===d?u.getBoundingClientRect():B1(u.getBoundingClientRect(),d.getBoundingClientRect());o={getBoundingClientRect:()=>f,getClientRects:()=>[f]}}return o}constructor({editor:t,element:e,view:n,pluginKey:r="bubbleMenu",updateDelay:i=250,resizeDelay:o=60,shouldShow:s,appendTo:l,getReferencedVirtualElement:a,options:c}){var u;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:d,state:f,from:h,to:p})=>{const{doc:g,selection:m}=f,{empty:y}=m,v=!g.textBetween(h,p).length&&nl(f.selection),w=this.element.contains(document.activeElement);return!(!(d.hasFocus()||w)||y||v||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var f;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}d?.relatedTarget&&(!((f=this.element.parentNode)===null||f===void 0)&&f.contains(d.relatedTarget))||d?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(d,f)=>
101{const h=!f?.selection.eq(d.state.selection),p=!f?.doc.eq(d.state.doc);!h&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(d,h,p,f)},this.updateDelay))},this.updateHandler=(d,f,h,p)=>{const{composing:g}=d;if(!(g||!f&&!h)){if(!this.getShouldShow(p)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:d})=>{const f=d.getMeta(this.pluginKey);f==="updatePosition"?this.updatePosition():f&&typeof f=="object"&&f.type==="updateOptions"?this.updateOptions(f.options):f==="hide"?this.hide():f==="show"&&(this.updatePosition(),this.show())},this.editor=t,this.element=e,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=o,this.appendTo=l,this.scrollTarget=(u=c?.scrollTarget)!==null&&u!==void 0?u:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}updatePosition(){if(!this.isVisible)return;const t=this.virtualElement;t&&xl(t,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:n,strategy:r,middlewareData:i})=>{var o,s;if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(!((o=i.hide)===null||o===void 0)&&o.referenceHidden||!((s=i.hide)===null||s===void 0)&&s.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${e}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(t,e){const{state:n}=t,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(t,e);return}const i=!e?.selection.eq(t.state.selection),o=!e?.doc.eq(t.state.doc);this.updateHandler(t,i,o,e)}getShouldShow(t){var e;const{state:n}=this.view,{selection:r}=n,{ranges:i}=r,o=Math.min(...i.map(l=>l.$from.pos)),s=Math.max(...i.map(l=>l.$to.pos));return((e=this.shouldShow)===null||e===void 0?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:t,from:o,to:s}))||!1}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(t=e??this.view.dom.parentElement)===null||t===void 0||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(t){if(t.updateDelay!==void 0&&(this.updateDelay=t.updateDelay),t.resizeDelay!==void 0&&(this.resizeDelay=t.resizeDelay),t.appendTo!==void 0&&(this.appendTo=t.appendTo),t.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=t.getReferencedVirtualElement),t.shouldShow!==void 0&&t.shouldShow&&(this.shouldShow=t.shouldShow),t.options!==void 0){var e;const n=(e=t.options.scrollTarget)!==null&&e!==void 0?e:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...t.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const nh=t=>new V({key:typeof t.pluginKey=="string"?new U(t.pluginKey):t.pluginKey,view:e=>
101new H1({view:e,...t})});J.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[nh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var F1=class{getTextContent(t){return jd(t,{textSerializers:ol(this.editor.schema)})}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(vl(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(Vf(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(wl(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(Uf(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(Wf(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(Ff(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(_f(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(jf(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}constructor({editor:t,element:e,view:n,pluginKey:r="floatingMenu",updateDelay:i=250,resizeDelay:o=60,options:s,appendTo:l,shouldShow:a}){var c;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:d})=>{const{selection:f}=d,{$anchor:h,empty:p}=f,g=h.depth===1,m=h.parent.isTextblock&&!h.parent.type.spec.code&&!h.parent.textContent&&h.parent.childCount===0&&!this.getTextContent(h.parent);return!(!u.hasFocus()||!p||!g||!m||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(u,d,f,h)=>{const{composing:p}=u;if(!(p||!d&&!f)){if(!this.getShouldShow(h)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var d;if(this.preventHide){this.preventHide=!1;return}u?.relatedTarget&&(!((d=this.element.parentNode)===null||d===void 0)&&d.contains(u.relatedTarget))||u?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:u})=>{const d=u.getMeta(this.pluginKey);d==="updatePosition"?this.updatePosition():d&&typeof d=="object"&&d.type==="updateOptions"?this.updateOptions(d.options):d==="hide"?this.hide():d==="show"&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=t,this.element=e,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=o,this.appendTo=l,this.scrollTarget=(c=s?.scrollTarget)!==null&&c!==void 0?c:window,this.floatingUIOptions={...this.floatingUIOptions,...s},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getShouldShow(t){var e;const{state:n}=this.view,{selection:r}=n,{ranges:i}=r,o=Math.min(...i.map(l=>l.$from.pos)),s=Math.max(...i.map(l=>l.$to.pos));return(e=this.shouldShow)===null||e===void 0?void 0:e.call(this,{editor:this.editor,view:this.view,state:n,oldState:t,from:o,to:s})}updateOptions(t){if(t.updateDelay!==void 0&&(this.updateDelay=t.updateDelay),t.resizeDelay!==void 0&&(this.resizeDelay=t.resizeDelay),t.appendTo!==void 0&&(this.appendTo=t.appendTo),t.shouldShow!==void 0&&t.shouldShow&&(this.shouldShow=t.shouldShow),t.options!==void 0){var e;const n=(e=t.options.scrollTarget)!==null&&e!==void 0?e:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...t.options}}}updatePosition(){var t;if(!(!((t=this.view)===null||t===void 0||(t=t.dom)===null||t===void 0)&&t.parentNode))return;const{selection:e}=this.editor.state,n=Yd(this.view,e.from,e.to);xl({getBoundingClientRect:()=>n,getClientRects:()=>[n]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:i,strategy:o,middlewareData:s})=>{var l,a;if(!((l=s.hide)===null||l===void 0)&&l.referenceHidden||!((a=s.hide)===null||a===void 0)&&a.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${r}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const n=!e?.selection.eq(t.state.selection),r=!e?.doc.eq(t.state.doc);this.updateHandler(t,n,r,e)}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(t=e??this.view.dom.parentElement)===null||t===void 0||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const rh=t=>new V({key:typeof t.pluginKey=="string"?new U(t.pluginKey):t.pluginKey,view:e=>
101new F1({view:e,...t})});J.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:t,dispatch:e})=>(e&&t.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[rh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function ih(t,e){return t??new U(e)}const V1=typeof window<"u"?P.useLayoutEffect:P.useEffect,oh=new Set(["left","opacity","position","top","visibility","width"]),W1=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),_1=new Set(["children","className","style"]),U1=new Set(["tabIndex"]),j1=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),K1={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function vs(t,e){return/^on[A-Z]/.test(t)&&typeof e=="function"}function q1(t){return t.startsWith("aria-")||t.startsWith("data-"),t}function J1(t){return t.startsWith("aria-")||t.startsWith("data-")||j1.has(t)}function sh(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function G1(t){var e;const n=t.endsWith("Capture"),r=(n?t.slice(0,-7):t).slice(2);return{eventName:(e=K1[r])!==null&&e!==void 0?e:r.toLowerCase(),options:n?{capture:!0}:void 0}}function Y1(t,e){let n=e.defaultPrevented,r=!1;const i=Object.create(e);return Object.defineProperties(i,{nativeEvent:{value:e},currentTarget:{value:t},target:{value:e.target},persist:{value:()=>{}},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,e.preventDefault()}},stopPropagation:{value:()=>{r=!0,e.stopPropagation()}}}),i}function No(t){return U1.has(t)}function Rc(t,e,n){if(e==="tabIndex"){t.tabIndex=Number(n);return}t[e]=n}function X1(t,e){if(e==="tabIndex"){t.removeAttribute("tabindex");return}const n=t[e];if(typeof n=="boolean"){t[e]=!1;return}if(typeof n=="number"){t[e]=0;return}t[e]=""}function Q1(t,e){return typeof e!="number"||e===0||t.startsWith("--")||W1.has(t)?String(e):`${e}px`}function Z1(t,e){oh.has(e)||t.style.removeProperty(sh(e))}function ex(t,e,n){oh.has(e)||t.style.setProperty(sh(e),Q1(e,n))}function tx(t,e,n){new Set([...Object.keys(e),...Object.keys(n)]).forEach(r=>{if(_1.has(r)||!J1(r)||vs(r,e[r])||vs(r,n[r]))return;const i=e[r],o=n[r];if(i===o)return;const s=q1(r);if(o==null||o===!1){No(r)&&X1(t,r),t.removeAttribute(s);return}if(o===!0){No(r)&&Rc(t,r,!0),t.setAttribute(s,"");return}if(No(r)){Rc(t,r,o);return}t.setAttribute(s,String(o))})}function nx(t,e,n){if(e!==n){if(n){t.className=n;return}t.removeAttribute("class")}}function rx(t,e,n){const r=e??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(o=>{const s=r[o],l=i[o];if(s!==l){if(l==null){Z1(t,o);return}ex(t,o,l)}})}function ix(t,e,n){e.forEach(({eventName:i,listener:o,options:s})=>{t.removeEventListener(i,o,s)});const r=[];return Object.entries(n).forEach(([i,o])=>{if(!vs(i,o))return;const{eventName:s,options:l}=G1(i),a=c=>{o(Y1(t,c))};t.addEventListener(s,a,l),r.push({eventName:s,listener:a,options:l})}),r}function lh(t,e){const n=P.useRef({}),r=P.useRef([]);V1(()=>{const i=n.current;return nx(t,i.className,e.className),rx(t,i.style,e.style),tx(t,i,e),r.current=ix(t,r.current,e),n.current=e,()=>{r.current.forEach(({eventName:o,listener:s,options:l})=>{t.removeEventListener(o,s,l)}),r.current=[]}},[t,e])}const _k=ut.forwardRef(({pluginKey:t,editor:e,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:o=null,getReferencedVirtualElement:s,options:l,children:a,...c},u)=>{const d=P.useRef(document.createElement("div")),f=P.useRef(ih(t,"bubbleMenu")).current;lh(d.current,c),typeof u=="function"?u(d.current):u&&(u.current=d.current);const{editor:h}=mf(),p=e||h,g={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:o,getReferencedVirtualElement:s,options:l},m=P.useRef(g);m.current=g;const[y,v]=P.useState(!1),w=P.useRef(!0);return P.useEffect(()=>{if(p?.isDestroyed)return;if(!p){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const b=d.current;b.style.visibility="hidden",b.style.position="absolute";const k=nh({...m.current,editor:p,element:b});p.registerPlugin(k);const S=m.current.pluginKey;return w.current=!0,v(!0),()=>{v(!1),p.unregisterPlugin(S),window.requestAnimationFrame(()=>{b.parentNode&&b.parentNode.removeChild(b)})}},[p]),P.useEffect(()=>{if(!(!y||!p||p.isDestroyed)){if(w.current){w.current=!1;return}p.view.dispatch(p.state.tr.setMeta(f,{type:"updateOptions",options:m.current}))}},[y,p,n,r,o,l,i,s,f]),Ds.createPortal(a,d.current)});ut.forwardRef(({pluginKey:t,editor:e,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:o=null,options:s,children:l,...a},c)=>{const u=P.useRef(document.createElement("div")),d=P.useRef(ih(t,"floatingMenu")).current;lh(u.current,a),typeof c=="function"?c(u.current):c&&(c.current=u.current);const{editor:f}=mf(),h=e||f,p={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:o,options:s},g=P.useRef(p);g.current=p;const[m,y]=P.useState(!1),v=P.useRef(!0);return P.useEffect(()=>{if(h?.isDestroyed)return;if(!h){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const w=u.current;
101w.style.visibility="hidden",w.style.position="absolute";const b=rh({...g.current,editor:h,element:w});h.registerPlugin(b);const k=g.current.pluginKey;return v.current=!0,y(!0),()=>{y(!1),h.unregisterPlugin(k),window.requestAnimationFrame(()=>{w.parentNode&&w.parentNode.removeChild(w)})}},[h]),P.useEffect(()=>{if(!(!m||!h||h.isDestroyed)){if(v.current){v.current=!1;return}h.view.dispatch(h.state.tr.setMeta(d,{type:"updateOptions",options:g.current}))}},[m,h,n,r,o,s,i,d]),Ds.createPortal(l,u.current)});const ah=new WeakSet,ch=new WeakSet;function $t(t){const e=t;return ah.add(e),e}function xs(t){return Array.isArray(t)&&ah.has(t)}function uh(t){return t.flatMap(e=>e==null?[]:Array.isArray(e)&&ch.has(e)&&!xs(e)?uh(e):[e])}function ox(t,e){if(t==="slot")return 0;if(t instanceof Function){const i=t(e);return Array.isArray(i)&&!xs(i)&&!ch.has(i)?$t(i):i}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");if(Array.isArray(n)){if(xs(n))return $t([t,r,n]);if(n.length===0)return $t([t,r]);const i=uh(n);return i.length===0?$t([t,r]):$t([t,r,...i])}return n!=null?$t([t,r,n]):$t([t,r])}const li=(t,e)=>ox(t,e),sx=(t,e)=>{var n;const{state:r}=t,{selection:i}=r;if(!i.empty)return!1;const{$from:o}=i;if(o.parentOffset!==0)return!1;const s=o.depth-1;if(s<0)return!1;const l=o.node(s),a=o.index(s);if(a===0)return!1;if(l.type===e)return t.commands.lift(e.name);const c=l.child(a-1);if(c.type!==e||!(!((n=c.lastChild)===null||n===void 0)&&n.isTextblock))return!1;const u=o.before()-1-1;return t.commands.command(({tr:d,dispatch:f})=>{if(!f)return!0;const h=o.parent.content,p=new M(h,0,0);return d.replace(u,o.after(),p),d.setSelection(R.create(d.doc,u+h.size)),d.scrollIntoView(),f(d),!0})},lx=/^\s*>\s$/,ax=ie.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return li("blockquote",{...F(this.options.HTMLAttributes,t),children:li("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((i,o)=>{var s,l;const a=((s=(l=e.renderChild)===null||l===void 0?void 0:l.call(e,i,o))!==null&&s!==void 0?s:e.renderChildren([i])).split(`
102`).map(c=>c.trim()===""?n:`${n} ${c}`);r.push(a.join(`
103`))}),r.join(`
104${n}
105`)},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(),Backspace:()=>sx(this.editor,this.type)}}
vendor: 2,308 bytes, line 105
105,addInputRules(){return[kn({find:lx,type:this.type})]}}),cx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ux=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,dx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,fx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,hx=nn.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 li("strong",{...F(this.options.HTMLAttributes,t),children:li("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Xt({find:cx,type:this.type}),Xt({find:dx,type:this.type})]},addPasteRules(){return[Nt({find:ux,type:this.type}),Nt({find:fx,type:this.type})]}}),px=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},mx=t=>{const e=/`([^`]+)`(?!`)/g,n=[];let r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},gx=nn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",F(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}}
vendor: 7,233 bytes, lines 105-124
105,addInputRules(){return[Xt({find:px,type:this.type})]},addPasteRules(){return[Nt({find:mx,type:this.type})]}}),Do=4,yx=/^```([a-z]+)?[\s\n]$/,bx=/^~~~([a-z]+)?[\s\n]$/,wx=ie.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Do,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const r=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(i=>i.startsWith(n)).map(i=>i.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",F(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)===null||n===void 0?void 0:n.startsWith("```"))===!1&&((r=t.raw)===null||r===void 0?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const i=((n=t.attrs)===null||n===void 0?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
106`):r=`\`\`\`${i}
107
108\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!==null&&e!==void 0?e:Do,{state:r}=t,{selection:i}=r,{$from:o,empty:s}=i;if(o.parent.type!==this.type)return!1;const l=" ".repeat(n);return s?t.commands.insertContent(l):t.commands.command(({tr:a})=>{const{from:c,to:u}=i,d=r.doc.textBetween(c,u,`
109`,`
110`).split(`
111`).map(f=>l+f).join(`
112`);return a.replaceWith(c,u,r.schema.text(d)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!==null&&e!==void 0?e:Do,{state:r}=t,{selection:i}=r,{$from:o,empty:s}=i;return o.parent.type!==this.type?!1:s?t.commands.command(({tr:l})=>{var a;const{pos:c}=o,u=o.start(),d=o.end(),f=r.doc.textBetween(u,d,`
113`,`
114`).split(`
115`);let h=0,p=0;const g=c-u;for(let w=0;w<f.length;w+=1){if(p+f[w].length>=g){h=w;break}p+=f[w].length+1}const m=((a=f[h].match(/^ */))===null||a===void 0?void 0:a[0])||"",y=Math.min(m.length,n);if(y===0)return!0;let v=u;for(let w=0;w<h;w+=1)v+=f[w].length+1;return l.delete(v,v+y),c-v<=y&&l.setSelection(R.create(l.doc,v)),!0}):t.commands.command(({tr:l})=>{const{from:a,to:c}=i,u=r.doc.textBetween(a,c,`
116`,`
117`).split(`
118`).map(d=>{var f;const h=((f=d.match(/^ */))===null||f===void 0?void 0:f[0])||"",p=Math.min(h.length,n);return d.slice(p)}).join(`
119`);return l.replaceWith(a,c,r.schema.text(u)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
120
121`);return!o||!s?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:t})=>{if(!this.options.exitOnArrowUp)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;const o=r.before();return o>0?!1:t.commands.insertDefaultBlock({pos:o})},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;const s=i.after();return s===void 0?!1:r.nodeAt(s)?t.commands.command(({tr:l})=>(l.setSelection(I.near(r.resolve(s))),!0)):t.commands.exitCode()}}},addInputRules(){return[ds({find:yx,type:this.type,getAttributes:t=>({language:t[1]})}),ds({find:bx,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new V({key:new U("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i?.mode;if(!n||!o)return!1;const{tr:s,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
122`));return s.replaceSelectionWith(this.type.create({language:o},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(R.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),vx=ie.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",F(this.options.HTMLAttributes,t)]},renderText(){return`
123`},renderMarkdown:()=>`  
124`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&s){const d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),xx=ie.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]}`,F(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=!((n=t.attrs)===null||n===void 0)&&n.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>ds({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}}
124)\\s$`),type:this.type,getAttributes:{level:t}}))}}),Sx=ie.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",F(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!_0(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return qd(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:o,tr:s,dispatch:l})=>{if(l){const{$to:a}=s.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(R.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection(O.create(s.doc,a.pos)):s.setSelection(R.create(s.doc,a.pos));else{const u=o.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u?.create();d&&(s.insert(c,d),s.setSelection(R.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[uf({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.t
vendor: 1,045 bytes, line 124
124ype})]}}),kx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Cx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Tx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Mx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Ex=nn.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",F(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}}
124,addInputRules(){return[Xt({find:kx,type:this.type}),Xt({find:Tx,type:this.type})]},addPasteRules(){return[Nt({find:Cx,type:this.type}),Nt({find:Mx,type:this.type})]}}),Ax="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yac
124hts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Ox="ελ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",Ss="numeric",ks="ascii",Cs="alpha",qn="asciinumeric",Hn="alphanumeric",Ts="domain",dh="emoji",Rx="scheme",Nx="slashscheme",Io="whitespace";function Dx(t,e){return t in e||(e[t]=[]),e[t]}function Vt(t,e,n){e[Ss]&&(e[qn]=!0,e[Hn]=!0),e[ks]&&(e[qn]=!0,e[Cs]=!0),e[qn]&&(e[Hn]=!0),e[Cs]&&(e[Hn]=!0),e[Hn]&&(e[Ts]=!0),e[dh]&&(e[Ts]=!0);for(const r in e){const i=Dx(r,n);i.indexOf(t)<0&&i.push(t)}}function Ix(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function xe(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}xe.groups={};xe.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(t))return o}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||xe.groups;let i;return e&&e.j?i=e:(i=new xe(e),n&&r&&Vt(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const o=t.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(t[s]);return i.tt(t[o-1],e,n,r)},tt(t,e,n,r){r=r||xe.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const o=e;let s,l=i.go(t);if(l?(s=new xe,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new xe,o){if(r)if(s.t&&typeof s.t=="string"){const a=Object.assign(Ix(s.t,r),n);Vt(o,a,r)}else n&&Vt(o,n,r);s.t=o}return i.j[t]=s,s}};const L=(t,e,n,r,i)=>t.ta(e,n,r,i),X=(t,e,n,r,i)=>t.tr(e,n,r,i),Nc=(t,e,n,r,i)=>t.ts(e,n,r,i),T=(t,e,n,r,i)=>t.tt(e,n,r,i),rt="WORD",Ms="UWORD",fh="ASCIINUMERICAL",hh="ALPHANUMERICAL",dr="LOCALHOST",Es="TLD",As="UTLD",jr="SCHEME",un="SLASH_SCHEME",kl="NUM",Os="WS",Cl="NL",Jn="OPENBRACE",Gn="CLOSEBRACE",ai="OPENBRACKET",ci="CLOSEBRACKET",ui="OPENPAREN",di="CLOSEPAREN",fi="OPENANGLEBRACKET",hi="CLOSEANGLEBRACKET",pi="FULLWIDTHLEFTPAREN",mi="FULLWIDTHRIGHTPAREN",gi="LEFTCORNERBRACKET",yi="RIGHTCORNERBRACKET",bi="LEFTWHITECORNERBRACKET",wi="RIGHTWHITECORNERBRACKET",vi="FULLWIDTHLESSTHAN",xi="FULLWIDTHGREATERTHAN",Si="AMPERSAND",ki="APOSTROPHE",Ci="ASTERISK",wt="AT",Ti="BACKSLASH",Mi="BACKTICK",Ei="CARET",Wt="COLON",Tl="COMMA",Ai="DOLLAR",je="DOT",Oi="EQUALS",Ml="EXCLAMATION",Ae="HYPHEN",Yn="PERCENT",Ri="PIPE",Ni="PLUS",Di="POUND",Xn="QUERY",El="QUOTE",ph="FULLWIDTHMIDDLEDOT",Al="SEMI",Ke="SLASH",Qn="TILDE",Ii="UNDERSCORE",mh="EMOJI",Li="SYM";var gh=Object.freeze({__proto__:null,ALPHANUMERICAL:hh,AMPERSAND:Si,APOSTROPHE:ki,ASCIINUMERICAL:fh,ASTERISK:Ci,AT:wt,BACKSLASH:Ti,BACKTICK:Mi,CARET:Ei,CLOSEANGLEBRACKET:hi,CLOSEBRACE:Gn,CLOSEBRACKET:ci,CLOSEPAREN:di,COLON:Wt,COMMA:Tl,DOLLAR:Ai,DOT:je,EMOJI:mh,EQUALS:Oi,EXCLAMATION:Ml,FULLWIDTHGREATERTHAN:xi,FULLWIDTHLEFTPAREN:pi,FULLWIDTHLESSTHAN:vi,FULLWIDTHMIDDLEDOT:ph,FULLWIDTHRIGHTPAREN:m
vendor: 9,864 bytes, lines 124-128
124i,HYPHEN:Ae,LEFTCORNERBRACKET:gi,LEFTWHITECORNERBRACKET:bi,LOCALHOST:dr,NL:Cl,NUM:kl,OPENANGLEBRACKET:fi,OPENBRACE:Jn,OPENBRACKET:ai,OPENPAREN:ui,PERCENT:Yn,PIPE:Ri,PLUS:Ni,POUND:Di,QUERY:Xn,QUOTE:El,RIGHTCORNERBRACKET:yi,RIGHTWHITECORNERBRACKET:wi,SCHEME:jr,SEMI:Al,SLASH:Ke,SLASH_SCHEME:un,SYM:Li,TILDE:Qn,TLD:Es,UNDERSCORE:Ii,UTLD:As,UWORD:Ms,WORD:rt,WS:Os});const Ze=/[a-z]/,Ln=new RegExp("\\p{L}","u"),Lo=new RegExp("\\p{Emoji}","u"),et=/\d/,Po=/\s/,Dc="\r",$o=`
125`,Lx="️",Px="‍",zo="";let Lr=null,Pr=null;function $x(t=[]){const e={};xe.groups=e;const n=new xe;Lr==null&&(Lr=Ic(Ax)),Pr==null&&(Pr=Ic(Ox)),T(n,"'",ki),T(n,"{",Jn),T(n,"}",Gn),T(n,"[",ai),T(n,"]",ci),T(n,"(",ui),T(n,")",di),T(n,"<",fi),T(n,">",hi),T(n,"(",pi),T(n,")",mi),T(n,"「",gi),T(n,"」",yi),T(n,"『",bi),T(n,"』",wi),T(n,"<",vi),T(n,">",xi),T(n,"&",Si),T(n,"*",Ci),T(n,"@",wt),T(n,"`",Mi),T(n,"^",Ei),T(n,":",Wt),T(n,",",Tl),T(n,"$",Ai),T(n,".",je),T(n,"=",Oi),T(n,"!",Ml),T(n,"-",Ae),T(n,"%",Yn),T(n,"|",Ri),T(n,"+",Ni),T(n,"#",Di),T(n,"?",Xn),T(n,'"',El),T(n,"/",Ke),T(n,";",Al),T(n,"~",Qn),T(n,"_",Ii),T(n,"\\",Ti),T(n,"・",ph);const r=X(n,et,kl,{[Ss]:!0});X(r,et,r);const i=X(r,Ze,fh,{[qn]:!0}),o=X(r,Ln,hh,{[Hn]:!0}),s=X(n,Ze,rt,{[ks]:!0});X(s,et,i),X(s,Ze,s),X(i,et,i),X(i,Ze,i);const l=X(n,Ln,Ms,{[Cs]:!0});X(l,Ze),X(l,et,o),X(l,Ln,l),X(o,et,o),X(o,Ze),X(o,Ln,o);const a=T(n,$o,Cl,{[Io]:!0}),c=T(n,Dc,Os,{[Io]:!0}),u=X(n,Po,Os,{[Io]:!0});T(n,zo,u),T(c,$o,a),T(c,zo,u),X(c,Po,u),T(u,Dc),T(u,$o),X(u,Po,u),T(u,zo,u);const d=X(n,Lo,mh,{[dh]:!0});T(d,"#"),X(d,Lo,d),T(d,Lx,d);const f=T(d,Px);T(f,"#"),X(f,Lo,d);const h=[[Ze,s],[et,i]],p=[[Ze,null],[Ln,l],[et,o]];for(let g=0;g<Lr.length;g++)mt(n,Lr[g],Es,rt,h);for(let g=0;g<Pr.length;g++)mt(n,Pr[g],As,Ms,p);Vt(Es,{tld:!0,ascii:!0},e),Vt(As,{utld:!0,alpha:!0},e),mt(n,"file",jr,rt,h),mt(n,"mailto",jr,rt,h),mt(n,"http",un,rt,h),mt(n,"https",un,rt,h),mt(n,"ftp",un,rt,h),mt(n,"ftps",un,rt,h),Vt(jr,{scheme:!0,ascii:!0},e),Vt(un,{slashscheme:!0,ascii:!0},e),t=t.sort((g,m)=>g[0]>m[0]?1:-1);for(let g=0;g<t.length;g++){const m=t[g][0],v=t[g][1]?{[Rx]:!0}:{[Nx]:!0};m.indexOf("-")>=0?v[Ts]=!0:Ze.test(m)?et.test(m)?v[qn]=!0:v[ks]=!0:v[Ss]=!0,Nc(n,m,m,v)}return Nc(n,"localhost",dr,{ascii:!0}),n.jd=new xe(Li),{start:n,tokens:Object.assign({groups:e},gh)}}function yh(t,e){const n=zx(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,i=[];let o=0,s=0;for(;s<r;){let l=t,a=null,c=0,u=null,d=-1,f=-1;for(;s<r&&(a=l.go(n[s]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=n[s].length,f++),c+=n[s].length,o+=n[s].length,s++;o-=d,s-=f,c-=d,i.push({t:u.t,v:e.slice(o-c,o),s:o-c,e:o})}return i}function zx(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),o,s=i<55296||i>56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function mt(t,e,n,r,i){let o;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];t.j[a]?o=t.j[a]:(o=new xe(r),o.jr=i.slice(),t.j[a]=o),t=o}return o=new xe(n),o.jr=i.slice(),t.j[e[s-1]]=o,o}function Ic(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let o=0;for(;i.indexOf(t[r+o])>=0;)o++;if(o>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+o),10);s>0;s--)n.pop();r+=o}else n.push(t[r]),r++}return e}const fr={defaultProtocol:"http",events:null,format:Lc,formatHref:Lc,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ol(t,e=null){let n=Object.assign({},fr);t&&(n=Object.assign(n,t instanceof Ol?t.o:t));const r=n.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}Ol.prototype={o:fr,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:fr[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function Lc(t){return t}function bh(t,e){this.t="token",this.v=t,this.tk=e}bh.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=fr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),o=this.toFormattedString(t),s={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:i,attributes:s,content:o,eventListeners:d}}};function Zi(t,e){class n extends bh{constructor(i,o){super(i,o),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const Bx=Zi("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Pc=Zi("text"),Hx=Zi("nl"),$r=Zi("url",{isLink:!0,toHref(t=fr.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==dr&&t[1].t===Wt}}),Ee=t=>new xe(t);function Fx({groups:t}){const e=t.domain.concat([Si,Ci,wt,Ti,Mi,Ei,Ai,Oi,Ae,kl,Yn,Ri,Ni,Di,Ke,Li,Qn,Ii]),n=[ki,Wt,Tl,je,Ml,Yn,Xn,El,Al,fi,hi,Jn,Gn,ci,ai,ui,di,pi,mi,gi,yi,bi,wi,vi,xi],r=[Si,ki,Ci,Ti,Mi,Ei,Ai,Oi,Ae,Jn,Gn,Yn,Ri,Ni,Di,Xn,Ke,Li,Qn,Ii],i=Ee(),o=T(i,Qn);L(o,r,o),L(o,t.domain,o);const s=Ee(),l=Ee(),a=Ee();L(i,t.domain,s),L(i,t.scheme,l),L(i,t.slashscheme,a),L(s,r,o),L(s,t.domain,s);const c=T(s,wt);T(o,wt,c),T(l,wt,c),T(a,wt,c);const u=T(o,je);L(u,r,o),L(u,t.domain,o);const d=Ee();L(c,t.domain,d),L(d,t.domain,d);const f=T(d,je);L(f,t.domain,d);const h=Ee(Bx);L(f,t.tld,h),L(f,t.utld,h),T(c,dr,h);const p=T(d,Ae);T(p,Ae,p),L(p,t.domain,d),L(h,t.domain,d),T(h,je,f),T(h,Ae,p);const g=T(s,Ae),m=T(s,je);T(g,Ae,g),L(g,t.domain,s),L(m,r,o),L(m,t.domain,s);const y=Ee($r);L(m,t.tld,y),L(m,t.utld,y),L(y,t.domain,s),L(y,r,o),T(y,je,m),T(y,Ae,g),T(y,wt,c);const v=T(y,Wt),w=Ee($r);L(v,t.numeric,w);const b=Ee($r),k=Ee();L(b,e,b),L(b,n,k),L(k,e,b),L(k,n,k),T(y,Ke,b),T(w,Ke,b);const S=T(l,Wt),C=T(a,Wt),E=T(C,Ke),D=T(E,Ke);L(l,t.domain,s),T(l,je,m),T(l,Ae,g),L(a,t.domain,s),T(a,je,m),T(a,Ae,g),L(S,t.domain,b),T(S,Ke,b),T(S,Xn,b),L(D,t.domain,b),L(D,e,b),T(D,Ke,b);const A=[[Jn,Gn],[ai,ci],[ui,di],[fi,hi],[pi,mi],[gi,yi],[bi,wi],[vi,xi]];for(let _=0;_<A.length;_++){const[G,W]=A[_],H=T(b,G);T(k,G,H);const z=Ee($r);L(H,e,z);const j=Ee();L(H,n,j),T(H,W,b),L(z,e,z),L(z,n,j),L(j,e,z),L(j,n,j),T(z,W,b),T(j,W,b)}return T(i,dr,y),T(i,Cl,Hx),{start:i,tokens:gh}}function Vx(t,e,n){let r=n.length,i=0,o=[],s=[];for(;i<r;){let l=t,a=null,c=null,u=0,d=null,f=-1;for(;i<r&&!(a=l.go(n[i].t));)s.push(n[i++]);for(;i<r&&(c=a||l.go(n[i].t));)a=null,l=c,l.accepts()?(f=0,d=l):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(s.push(n[i]),i++);else{s.length>0&&(o.push(Bo(Pc,e,s)),s=[]),i-=f,u-=f;const h=d.t,p=n.slice(i-u,i);o.push(Bo(h,e,p))}}return s.length>0&&o.push(Bo(Pc,e,s)),o}function Bo(t,e,n){const r=n[0].s,i=n[n.length-1].e,o=e.slice(r,i);return new t(o,n)}const Wx=typeof console<"u"&&console&&console.warn||(()=>{}),_x="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Y={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Ux(){return xe.groups={},Y.scanner=null,Y.parser=null,Y.tokenQueue=[],Y.pluginQueue=[],Y.customSchemes=[],Y.initialized=!1,Y}function $c(t,e=!1){if(Y.initialized&&Wx(`linkifyjs: already initialized - will not register custom scheme "${t}" ${_x}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
1261. Must only contain digits, lowercase ASCII letters or "-"
1272. Cannot start or end with "-"
1283. "-" cannot repeat`);Y.customSchemes.push([t,e])}function jx(){Y.scanner=$x(Y.customSchemes);for(let t=0;t<Y.tokenQueue.length;t++)Y.tokenQueue[t][1]({scanner:Y.scanner});Y.parser=Fx(Y.scanner.tokens);for(let t=0;t<Y.pluginQueue.length;t++)Y.pluginQueue[t][1]({scanner:Y.scanner,parser:Y.parser});return Y.initialized=!0,Y}function Rl(t){return Y.initialized||jx(),Vx(Y.parser.start,t,yh(Y.scanner.start,t))}Rl.scan=yh;function wh(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 Ol(n),i=Rl(t),o=[];for(let s=0;s<i.length;s++){const l=i[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&o.push(l.toFormattedObject(r))}return o}const Nl="[\0-   ᠎ -\u2029  ]",Kx=new RegExp(Nl),qx=new RegExp(`${Nl}$`),Jx=new RegExp(Nl,"g");function Gx(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Yx(t){return new V({key:new U("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(a=>a.docChanged)&&!n.doc.eq(r.doc),o=e.some(a=>a.getMeta("preventAutolink"));if(!i||o)return;const{tr:s}=r,l=Fd(n.doc,[...e]);if(Ki(l).forEach(({newRange:a})=>{const c=Wy(r.doc,a,f=>f.isTextblock);let u,d;if(c.length>1)u=c[0],d=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(c.length){const f=r.doc.textBetween(a.from,a.to," "," ");
128if(!qx.test(f))return;u=c[0],d=r.doc.textBetween(u.pos,a.to,void 0," ")}if(u&&d){const f=d.split(Kx).filter(Boolean);if(f.length<=0)return!1;const h=f[f.length-1],p=u.pos+d.lastIndexOf(h);if(!h)return!1;const g=Rl(h).map(m=>m.toObject(t.defaultProtocol));if(!Gx(g))return!1;g.filter(m=>m.isLink).map(m=>({...m,from:p+m.start+1,to:p+m.end+1})).filter(m=>r.schema.marks.code?!r.doc.rangeHasMark(m.from,m.to,r.schema.marks.code):!0).filter(m=>t.validate(m.value)).filter(m=>t.shouldAutoLink(m.value)).forEach(m=>{sl(m.from,m.to,r.doc).some(y=>y.mark.type===t.type)||s.addMark(m.from,m.to,t.type.create({href:m.href}))})}}),!!s.steps.length)return s}})}function Xx(t){return new V({key:new U("handleClickLink"),props:{handleClick:(e,n,r)=>{if(r.button!==0||!e.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{const a=r.target;if(!a)return!1;const c=t.editor.view.dom;i=a.closest("a"),i&&!c.contains(i)&&(i=null)}if(!i)return!1;let o=!1;if(t.enableClickSelection&&(o=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){var s,l;const a=Kd(e.state,t.type.name),c=(s=i.href)!==null&&s!==void 0?s:a.href,u=(l=i.target)!==null&&l!==void 0?l:a.target;c&&(window.open(c,u),o=!0)}return o}}})}const Qx=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,Zx=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function vh(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function eS(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&vh(t,r)){r+=1;continue}let i=0;for(;r<e&&t[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function xh(t,e,n){var r,i;const[,o,s]=e;return(e.index?t[e.index-1]:void 0)==="!"||vh(t,(r=e.index)!==null&&r!==void 0?r:0)||eS(t,(i=e.index)!==null&&i!==void 0?i:0)?!1:!!o.trim()&&n(s)}function Sh(t){var e,n;const[r,i,o,,s,l,a]=t,c=(e=s??l)!==null&&e!==void 0?e:a;return{index:(n=t.index)!==null&&n!==void 0?n:0,text:r,replaceWith:i,data:{href:o,title:c||null,markdown:!0}}}function tS(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function kh(t){var e,n,r;return{href:(e=t.data)===null||e===void 0?void 0:e.href,title:(n=(r=t.data)===null||r===void 0?void 0:r.title)!==null&&n!==void 0?n:null}}function nS(t){const e=Xt({find:n=>{const r=Qx.exec(n);return!r||!xh(n,r,t.isAllowedHref)?null:Sh(r)},type:t.type,getAttributes:kh});return new En({find:e.find,handler:n=>{const r=e.handler(n);return r!==null&&n.state.tr.steps.length&&n.state.tr.setMeta("preventAutolink",!0),r}})}function rS(t){const e=Nt({find:n=>{var r,i;const o=[];for(const l of n.matchAll(Zx))xh(n,l,t.isAllowedHref)&&o.push(Sh(l));const s=((r=(i=t.findPlainUrls)===null||i===void 0?void 0:i.call(t,n))!==null&&r!==void 0?r:[]).filter(l=>!o.some(a=>tS(a,l)));return[...o,...s]},type:t.type,getAttributes:kh});return new cl({find:e.find,handler:n=>{var r;const i=e.handler(n);return i!==null&&n.state.tr.steps.length&&(!((r=n.match.data)===null||r===void 0)&&r.markdown)&&n.state.tr.setMeta("preventAutolink",!0),i}})}function iS(t){return new V({key:new U("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=wh(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||i!==void 0&&!i(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function tt(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(Jx,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}const Ch=nn.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.forEac
128h(t=>{if(typeof t=="string"){$c(t);return}$c(t.scheme,t.optionalSlashes)})},onDestroy(){Ux()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!tt(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){var t,e,n;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(t=this.options.HTMLAttributes.target)!==null&&t!==void 0?t:null},rel:{default:(e=this.options.HTMLAttributes.rel)!==null&&e!==void 0?e:null},class:{default:(n=this.options.HTMLAttributes.class)!==null&&n!==void 0?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!tt(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=>!!tt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",F(this.options.HTMLAttributes,t),0]:["a",F(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,i,o;const s=(n=(r=t.attrs)===null||r===void 0?void 0:r.href)!==null&&n!==void 0?n:"",l=(i=(o=t.attrs)===null||o===void 0?void 0:o.title)!==null&&i!==void 0?i:"",a=e.renderChildren(t);return l?`[${a}](${s} "${l}")`:`[${a}](${s})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!tt(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=>!!tt(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()}},addInputRules(){return this.options.markdownLinks?[nS({type:this.type,isAllowedHref:t=>this.options.isAllowedUri(t,{defaultValidate:e=>!!tt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const t=e=>{const n=[];if(e){const{protocols:r,defaultProtocol:i}=this.options;wh(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!tt(s,r),protocols:r,defaultProtocol:i})).forEach(o=>{this.options.shouldAutoLink(o.value)&&n.push({text:o.value,data:{href:o.href},index:o.start})})}return n};return this.options.markdownLinks?[rS({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:n=>!!tt(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:t})]:[Nt({find:t,type:this.type,getAttributes:e=>{var n;return{href:(n=e.data)===null||n===void 0?void 0:n.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Yx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!tt(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Xx({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(iS({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.t
vendor: 1,060 bytes, lines 128-129
128ype,shouldAutoLink:this.options.shouldAutoLink})),t}});var Uk=Ch;const oS="listItem",zc="textStyle",Bc=/^\s*([-+*])\s$/,Th=ie.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",F(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
129`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(oS,this.editor.getAttributes(zc)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}}
129,addInputRules(){let t=kn({find:Bc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=kn({find:Bc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(zc),editor:this.editor})),[t]}}),sS=(t,e,n)=>{const{selection:r}=t;if(!r.empty)return null;const{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let o=-1;for(let h=i.depth;h>0;h-=1)if(i.node(h).type.name===e){o=h;break}if(o<0)return null;const s=i.node(o),l=i.index(o);if(l+1>=s.childCount)return null;const a=s.child(l+1);if(!n.includes(a.type.name))return null;const c=t.schema.nodes[e];let u=!1;if(a.forEach(h=>{h.type===c&&h.childCount>1&&(u=!0)}),!u)return null;const d=t.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;const f=[];return d.forEach(h=>{f.push(h)}),f.length===0?null:{listItemDepth:o,nestedList:d,nestedListPos:i.after(),insertPos:i.after(o),items:f}},lS=(t,e,n,r)=>{const i=sS(t,n,r);if(!i)return!1;const{selection:o}=t,{nestedList:s,nestedListPos:l,insertPos:a,items:c}=i,u=t.tr;u.delete(l,l+s.nodeSize);const d=u.mapping.map(a);return u.insert(d,x.from(c)),u.setSelection(o.map(u.doc,u.mapping)),e&&e(u),!0},aS=(t,e,n)=>lS(t.state,t.view.dispatch,e,n),Mh=(t,e)=>J.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>aS(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),Eh=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],zr="abcdefghijklmnopqrstuvwxyz",Ah=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function eo(t){let e=t,n="";for(const[r,i]of Eh)for(;e>=r;)n+=i,e-=r;return n}function Dl(t){return eo(t).toUpperCase()}function Oh(t){const e=t.toLowerCase();let n=0,r=0;for(;n<e.length;){let i=!1;for(const[o,s]of Eh)if(e.startsWith(s,n)){r+=o,n+=s.length,i=!0;break}if(!i)return 0}return r}function cS(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;const e=Oh(t);return e<=0?!1:(t===t.toLowerCase()?eo(e):Dl(e))===t}function uS(t){const e=t.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){const n=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(n+1)*26+r+1}return 0}function Pi(t){if(t<=26)return zr[t-1];const e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?zr[n]:zr[e]+zr[n]}function to(t){if(!(!t||/^\d+$/.test(t))){if(cS(t))return t===t.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(t))return"a";if(/^[A-Z]{1,2}$/.test(t))return"A"}}function Il(t){if(/^\d+$/.test(t))return parseInt(t,10);const e=to(t);if(e==="i"||e==="I")return Oh(t);if(e==="a"||e==="A"){const r=uS(t);return r>0?r:1}const n=parseInt(t,10);return Number.isNaN(n)?1:n}function dS(t,e){if(t==="numeric")return String(e);switch(t){case"a":return Pi(e);case"A":return Pi(e).toUpperCase();case"i":return eo(e);case"I":return Dl(e);default:return String(e)}}function fS(t){var e;if(t.length===0)return!1;const n=(e=to(t[0]))!==null&&e!==void 0?e:"numeric",r=Il(t[0]);if(r<1)return!1;for(let i=0;i<t.length;i++){const o=dS(n,r+i);if(t[i]!==o)return!1}return!0}function hS(t){return{type:to(t),start:Il(t)}}function pS(t){const{type:e,start:n}=hS(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function mS(t,e,n=". "){const r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${Pi(r)}${n}`;case"A":return`${Pi(r).toUpperCase()}${n}`;case"i":return`${eo(r)}${n}`;case"I":return`${Dl(r)}${n}`;default:return`${r}${n}`}}function gS(t){var e,n;const r=(e=t.tokens)===null||e===void 0?void 0:e[0];return!!(t.text&&((n=t.tokens)===null||n===void 0?void 0:n.length)===1&&r?.type==="list"&&r.ordered&&r.raw===t.text)}function yS(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}const Rh=ie.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",F(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren;let i=[];if(t.tokens&&t.tokens.length>0){if(gS(t))return{type:"listItem",content:[{type:"paragraph",content:yS(t.text||"",e)}]};if(t.tokens.some(o=>o.type==="paragraph"))i=r(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const s=r(t.tokens.slice(1));i.push(...s)}}else i=r(t.tokens)}}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(t,e,n)=>sf(t,e,r=>{if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){var i,o;const s=((i=r.meta)===null||i===void 0||(i=i.parentAttrs)===null||i===void 0?void 0:i.start)||1;return mS((o=r.meta)===null||o===void 0||(o=o.parentAttrs)===null||o===void 0?void 0:o.type,s-1+(r.index||0),". ")}return"- "},n,{alignNestedToPrefix:n?.parentType==="orderedList"}),addExtensions(){return[Mh(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Ll=(t,e)=>{const{$from:n}=e.selection,r=oe(t,e.schema);let i=null,o=n.depth,s=n.pos,l=null;for(;o>0&&l===null;)i=n.node(o),i.type===r?l=o:(o-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},Nh=(t,e)=>{const n=Ll(t,e);if(!n)return!1;const[,r]=Xy(e,t,n.$pos.pos+4);return r},bS=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),o=t.doc.resolve(i).node();return!(!o||!n.includes(o.type.name))},Hc=(t,e,n)=>{if(t.commands.undoInputRule())return!0;
129if(t.state.selection.from!==t.state.selection.to)return!1;if(!dt(t.state,e)&&bS(t.state,e,n)){const{$anchor:o}=t.state.selection,s=t.state.doc.resolve(o.before()-1),l=[];s.node().descendants((u,d)=>{u.type.name===e&&l.push({node:u,pos:d})});const a=l.at(-1);if(!a)return!1;const c=t.state.doc.resolve(s.start()+a.pos+1);return t.chain().cut({from:o.start()-1,to:o.end()+1},c.end()).joinForward().run()}if(!dt(t.state,e)||!n0(t.state))return!1;const{$from:r}=t.state.selection,i=r.depth-1;return r.node(i).type!==t.schema.nodes[e]||r.index(i)!==0?!1:t.chain().liftListItem(e).run()},wS=(t,e)=>{const n=Nh(t,e),r=Ll(t,e);return!r||!n?!1:n>r.depth},vS=(t,e)=>{const n=Nh(t,e),r=Ll(t,e);return!r||!n?!1:n<r.depth},Fc=(t,e)=>{if(!dt(t.state,e)||!t0(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:wS(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():vS(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},xS=(t,e,n)=>{const{state:r}=t,{selection:i}=r;if(!i.empty)return!1;const{$from:o}=i;if(o.parentOffset!==0||!o.parent.isTextblock||dt(r,e))return!1;const s=Qy(o);if(!s||!n.includes(s.type.name))return!1;const l=s.lastChild;if(!l||l.type.name!==e)return!1;const a=o.parent;if(!l.canReplace(l.childCount,l.childCount,x.from(a)))return!1;const c=o.before(),u=o.after(),d=c-2;return t.commands.command(({tr:f,dispatch:h})=>(h&&(f.delete(c,u).insert(d,x.from(a)),f.setSelection(R.create(f.doc,d+1)),f.scrollIntoView()),!0))},Dh=J.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&&Fc(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&&Fc(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&&Hc(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&&Hc(t,n,r)&&(e=!0)}),e},Tab:({editor:t})=>{for(const{itemName:e,wrapperNames:n}of this.options.listTypes)if(t.state.schema.nodes[e]!==void 0&&xS(t,e,n))return!0;return!1}}}}),Rs=new RegExp(`^(\\s*)(${Ah})([.)])\\s+(.*)$`),SS=/^\s/,dn={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function kS(t){return Rs.test(t.trimStart())}function CS(t){const e=t.trimStart();return dn.bulletItem.test(e)||kS(e)||dn.heading.test(e)||dn.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||dn.codeFence.test(e)||dn.blockMath.test(e)}function TS(t){return Object.values(dn).some(e=>e.test(t))}function MS(t){const e=[],n=[];let r=!1;return t.forEach(i=>{if(r){n.push(i);return}if(i.trim()===""){r=!0,n.push(i);return}if(e.length>0&&CS(i)){r=!0,n.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:n}}function ES(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],o=i.match(Rs);if(!o)break;const[,s,l,a,c]=o,u=s.length,d=parseInt(l,10),f=isNaN(d)?to(l):void 0,h=isNaN(d)?Il(l):d,p=[c];let g=n+1;const m=[i];let y=!1;for(;g<t.length;){const v=t[g];if(v.match(Rs))break;if(v.trim()==="")m.push(v),p.push(""),y=!0,g+=1;else if(v.match(SS)){const w=v.length-v.trimStart().length,b=u+l.length+1;m.push(v),p.push(v.slice(Math.min(w,b))),g+=1}else{if(y||TS(v))break;m.push(v),p.push(v),g+=1}}e.push({indent:u,number:h,type:f,content:p.join(`
130`).trim(),contentLines:p,raw:m.join(`
131`)}),r=g,n=g}return[e,r]}const AS=new RegExp(`^(${Ah})([.)])\\s+(.+)$`);function OS(t){const e=t.split(`
132`).filter(r=>r.trim().length>0);if(e.length===0)return null;const n=[];for(const r of e){const i=r.trim().match(AS);if(!i)return null;n.push({marker:i[1],content:i[3]})}return fS(n.map(r=>r.marker))?{type:"orderedList",attrs:pS(n[0].marker),content:n.map(r=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:r.content}]}]}))}:null}function Ih(t,e,n){const r=[];let i=0;for(;i<t.length;){const o=t[i];if(o.indent===e){const{paragraphLines:s,blockLines:l}
132=MS(o.contentLines),a=s.join(`
133`).trim(),c=[];a&&c.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});const u=l.join(`
134`).trim();if(u){const h=n.blockTokens(u);c.push(...h)}let d=i+1;const f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){const h=Ih(f,Math.min(...f.map(p=>p.indent)),n);c.push({type:"list",ordered:!0,start:f[0].number,typeMarker:f[0].type,items:h,raw:f.map(p=>p.raw).join(`
135`)})}r.push({type:"list_item",raw:o.raw,tokens:c}),i=d}else i+=1}return r}function RS(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const o=e.parseChildren([i]);r.push({type:"paragraph",content:o})}else{const o=e.parseChildren([i]);o.length>0&&r.push(...o)}}),{type:"listItem",content:r}})}const NS="listItem",Vc="textStyle",Wc=/^(\d+)\.\s$/;function _c(t){const e=t.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}const Lh=ie.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=>{const e=t.getAttribute("type");if(e)return e;const n=t.getAttribute("style");if(n){const i=_c(n);if(i)return i}const r=t.querySelector("li");if(r){const i=r.getAttribute("style");if(i){const o=_c(i);if(o)return o}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,type:n,...r}=t,i=F(this.options.HTMLAttributes,r);return e!==1&&(i.start=e),n&&n!=="1"&&(i.type=n),["ol",i,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.typeMarker,i=t.items?RS(t.items,e):[],o={};return n!==1&&(o.start=n),r&&(o.type=r),Object.keys(o).length>0?{type:"orderedList",attrs:o,content:i}:{type:"orderedList",content:i}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
136`):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,i;const o=t.split(`
137`),[s,l]=ES(o);if(s.length===0)return;const a=Ih(s,s[0].indent,n);if(a.length!==0)return{type:"list",ordered:!0,start:((r=s[0])===null||r===void 0?void 0:r.number)||1,typeMarker:(i=s[0])===null||i===void 0?void 0:i.type,items:a,raw:o.slice(0,l).join(`
138`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(NS,this.editor.getAttributes(Vc)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new V({props:{handlePaste:(t,e)=>{var n,r;const i=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/html");if(i?.trim())return!1;const o=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!o)return!1;const s=OS(o);if(!s)return!1;try{const l=t.state.schema.nodeFromJSON(s),a=t.state.tr.replaceSelectionWith(l);return t.dispatch(a),!0}catch{return!1}}}})]},addInputRules(){const t=(n,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+n[1];
vendor: 3,933 bytes, line 138
138let e=kn({find:Wc,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=kn({find:Wc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(Vc)}),joinPredicate:t,editor:this.editor})),[e]}}),DS=/^\s*(\[([( |x])?\])\s$/,IS="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",LS=(t,e,n)=>{var r;return(n==null||(r=n.checkboxLabel)===null||r===void 0?void 0:r.call(n,t,e))||`Task item checkbox for ${t.textContent||"empty task item"}`},PS=ie.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,contentElement:t=>{var e;return(e=t.querySelector("div"))!==null&&e!==void 0?e:t}}]},renderHTML({node:t,HTMLAttributes:e}){return["li",F(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const r=`- [${!((n=t.attrs)===null||n===void 0)&&n.checked?"x":" "}] `;return sf(t,e,r)},addExtensions(){return this.options.nested?[Mh(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div");s.style.cssText=IS;const c=d=>{const f=LS(d,d.attrs.checked,this.options.a11y);l.setAttribute("aria-label",f),s.textContent=f};c(t),o.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:f}=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 g=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...g?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{i.setAttribute(d,f)}),i.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,o.append(l,s),i.append(o,a),Object.entries(e).forEach(([d,f])=>{i.setAttribute(d,f)});let u=new Set(Object.keys(e));return{dom:i,contentDOM:a,update:d=>{if(d.type!==this.type)return!1;i.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d);const f=r.extensionManager.attributes,h=xn(d,f),p=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return u.forEach(m=>{p.has(m)||(m in g?i.setAttribute(m,g[m]):i.removeAttribute(m))}),Object.entries(h).forEach(([m,y])=>{y==null?m in g?i.setAttribute(m,g[m]):i.removeAttribute(m):i.setAttribute(m,y)}),u=p,!0}}}}
vendor: 3,287 bytes, lines 138-139
138,addInputRules(){return[kn({find:DS,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),$S=ie.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",F(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
139`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=o=>{const s=Ja(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);if(s){const l={type:"taskList",raw:s.raw,items:s.items},a=o.slice(s.raw.length);return a.trim()?[l,...n.blockTokens(a)]:[l]}return n.blockTokens(o)},i=Ja(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,s)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:s}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});J.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(Th.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Rh.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Dh.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Lh.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(PS.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push($S.configure(this.options.taskList)),t}});const zS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,BS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,HS=nn.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",F(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}}
139,addInputRules(){return[Xt({find:zS,type:this.type})]},addPasteRules(){return[Nt({find:BS,type:this.type})]}}),FS=nn.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",F(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),VS=J.create({name:"starterKit",addExtensions(){const t=[];if(this.options.bold!==!1&&t.push(hx.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(ax.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(Th.configure(this.options.bulletList)),this.options.code!==!1&&t.push(gx.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(wx.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(Qb.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(ww.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(vw.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(vx.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(xx.configure(this.options.heading)),this.options.undoRedo!==!1&&t.push(Pw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&t.push(Sx.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(Ex.configure(this.options.italic)),this.options.listItem!==!1&&t.push(Rh.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;t.push(Dh.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var n;t.push(Ch.configure((n=this.options)===null||n===void 0?void 0:n.link))}if(this.options.orderedList!==!1&&t.push(Lh.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(Zb.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(HS.configure(this.options.strike)),this.options.text!==!1&&t.push(ew.configure(this.options.text)),this.options.underline!==!1){var r;t.push(FS.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var i;t.push(Lw.configure((i=this.options)===null||i===void 0?void 0:i.trailingNode))}return t}});var jk=VS;const WS=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,_S=ie.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},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",F(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,i,o,s;const l=(e=(n=t.attrs)===null||n===void 0?void 0:n.src)!==null&&e!==void 0?e:"",a=(r=(i=t.attrs)===null||i===void 0?void 0:i.alt)!==null&&r!==void 0?r:"",c=(o=(s=t.attrs)===null||s===void 0?void 0:s.title)!==null&&o!==void 0?o:"";return c?`![${a}](${l} "${c}")`:`![${a}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,i=new Set(["src","width","height"]);return({node:o,getPos:s,HTMLAttributes:l,editor:a})=>{const c=document.createElement("img");c.draggable=!1;const u=F(this.options.HTMLAttributes,l);Object.entries(u).forEach(([y,v])=>{if(v!=null)switch(y){case"src":case"width":case"height":break;default:c.setAttribute(y,v)}}),u.src!==null&&(c.src=u.src);let d={...l};const f=y=>{if(typeof y=="string"&&y!==""){c.getAttribute("src")!==y&&(c.src=y);return}c.hasAttribute("src")&&c.removeAttribute("src"),c.src!==""&&(c.src="")};f(l.src);const h=y=>{if(y.type!==o.type)return!1;const v=a.extensionManager.attributes.filter(b=>b.type===y.type.name),w=xn(y,v);
139return Object.keys(d).forEach(b=>{!i.has(b)&&!(b in w)&&c.removeAttribute(b)}),Object.entries(w).forEach(([b,k])=>{i.has(b)||(k!=null?c.setAttribute(b,k):c.removeAttribute(b))}),f(w.src),d=w,!0},p=new Rb({element:c,editor:a,node:o,getPos:s,onResize:(y,v)=>{c.style.width=`${y}px`,c.style.height=`${v}px`},onCommit:(y,v)=>{const w=s();w!==void 0&&this.editor.chain().setNodeSelection(w).updateAttributes(this.name,{width:y,height:v}).run()},onUpdate:h,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),g=p.dom,m=()=>{g.style.visibility="",g.style.pointerEvents=""};return g.style.visibility="hidden",g.style.pointerEvents="none",c.complete&&c.naturalWidth>0?m():(c.onload=m,c.onerror=m),p}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[uf({find:WS,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});var Kk=_S;const US=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/,jS=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g,Pl=t=>t?t.match(US):null,Uc=(t,e)=>e?"https://www.youtube-nocookie.com/embed/videoseries?list=":t?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",KS=t=>{const{url:e,allowFullscreen:n,autoplay:r,ccLanguage:i,ccLoadPolicy:o,controls:s,disableKBcontrols:l,enableIFrameApi:a,endTime:c,interfaceLanguage:u,ivLoadPolicy:d,loop:f,modestBranding:h,nocookie:p,origin:g,playlist:m,progressBarColor:y,startAt:v,rel:w}=t;if(!Pl(e))return null;if(e.includes("/embed/"))return e;if(e.includes("youtu.be")){const C=e.split("/").pop();return C?`${Uc(p)}${C}`:null}const b=/(?:(v|list)=|\/(?:shorts|live)\/)([-\w]+)/gm.exec(e);if(!b||!b[2])return null;let k=`${Uc(p,b[1]==="list")}${b[2]}`;const S=[];return n===!1&&S.push("fs=0"),r&&S.push("autoplay=1"),i&&S.push(`cc_lang_pref=${i}`),o&&S.push("cc_load_policy=1"),s||S.push("controls=0"),l&&S.push("disablekb=1"),a&&S.push("enablejsapi=1"),c&&S.push(`end=${c}`),u&&S.push(`hl=${u}`),d&&S.push(`iv_load_policy=${d}`),f&&S.push("loop=1"),h&&S.push("modestbranding=1"),g&&S.push(`origin=${g}`),m&&S.push(`playlist=${m}`),v&&S.push(`start=${v}`),y&&S.push(`color=${y}`),w!==void 0&&S.push(`rel=${w}`),S.length&&(k+=`${b[1]==="list"?"&":"?"}${S.join("&")}`),k},qS=t=>{let e;try{e=new URL(t)}catch{return null}const n=e.hostname.replace(/^www\./,"");if(n!=="youtube.com"&&n!=="youtube-nocookie.com")return null;let r=null;if(e.pathname==="/embed/videoseries"){const s=e.searchParams.get("list");if(!s)return null;r=`https://www.youtube.com/playlist?list=${s}`}else{const s=e.pathname.match(/^\/embed\/([\w-]+)$/);if(!s?.[1])return null;r=`https://www.youtube.com/watch?v=${s[1]}`}if(!Pl(r))return null;const i={src:r},o=e.searchParams.get("start");if(o){const s=Number.parseInt(o,10);Number.isNaN(s)||(i.start=s)}return i},jc=t=>{if(!t)return null;const e=t.trim();if(e==="")return null;const n=Number(e);return Number.isNaN(n)?e:n},Kc=t=>{const e=t.getAttribute("src");if(!e)return null;const n=qS(e);return n||{src:e}},JS=ie.create({name:"youtube",addOptions(){return{addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:"",playlist:"",progressBarColor:void 0,width:640,rel:1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null,parseHTML:t=>{var e;return(e=Kc(t))===null||e===void 0?void 0:e.src}},start:{default:0,parseHTML:t=>{var e;return(e=Kc(t))===null||e===void 0?void 0:e.start}},width:{default:this.options.width,parseHTML:t=>jc(t.getAttribute("width"))},height:{default:this.options.height,parseHTML:t=>jc(t.getAttribute("height"))}}},parseHTML(){return[{tag:"div[data-youtube-video] iframe"}]},addCommands(){return{setYoutubeVideo:t=>({commands:e})=>Pl(t.src)?e.insertContent({type:this.name,attrs:t}):!1}}
139,addPasteRules(){return this.options.addPasteHandler?[Nb({find:jS,type:this.type,getAttributes:t=>({src:t.input})})]:[]},renderHTML({HTMLAttributes:t}){return t.src=KS({url:t.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:t.start||0,rel:this.options.rel}),["div",{"data-youtube-video":""},["iframe",F(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,rel:this.options.rel},t)]]},...rb({nodeName:"youtube",allowedAttributes:["src","width","height","start"]})});var qk=JS;function $i(t){return t==="left"||t==="right"||t==="center"?t:null}function GS(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return $i(e||n)}function YS(t){return $i(t?.align)}function Ph(){return{default:null,parseHTML:t=>GS(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}function XS(t){var e;const n=t.parentElement,r=t.closest("table");if(!n||!r)return null;const i=Array.from(n.children).indexOf(t),o=(e=r.querySelectorAll("colgroup > col")[i])===null||e===void 0?void 0:e.getAttribute("width");return o?[parseInt(o,10)]:null}function $h(t){const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):XS(t)}const QS=/[ \t\r\n\f]+/g;function zh(t){var e;return t.children.length>0?!1:((e=t.textContent)!==null&&e!==void 0?e:"").replace(QS,"")===""}function Bh(t){const e=t.createAndFill();if(!e)throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);return e.content}const ZS=ie.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:$h},align:Ph()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:t=>zh(t)?{}:!1,getContent:(t,e)=>Bh(e.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",F(this.options.HTMLAttributes,t),0]}}),ek=ie.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:$h},align:Ph()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:t=>zh(t)?{}:!1,getContent:(t,e)=>Bh(e.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",F(this.options.HTMLAttributes,t),0]}}),tk=ie.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",F(this.options.HTMLAttributes,t),0]}});function Ns(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function qc(t,e,n,r,i,o){let s=0,l=!0,a=e.firstChild;const c=t.firstChild;if(c!==null)for(let f=0,h=0;f<c.childCount;f+=1){const{colspan:p,colwidth:g}=c.child(f).attrs;for(let m=0;m<p;m+=1,h+=1){const y=i===h?o:g&&g[m],v=y?`${y}px`:"";if(s+=y||r,y||(l=!1),a){if(a.style.width!==v){const[w,b]=Ns(r,y);a.style.setProperty(w,b)}a=a.nextSibling}else{const w=document.createElement("col"),[b,k]=Ns(r,y);w.style.setProperty(b,k),e.appendChild(w)}}}for(;a;){var u;const f=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=f}const d=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);l&&!d?(n.style.width=`${s}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${s}px`)}var nk=class{constructor(t,e,n,r={}){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(const[i,o]of Object.entries(r))o!=null&&(i==="style"?this.table.style.cssText=String(o):this.table.setAttribute(i,String(o)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),qc(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,qc(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 rk(t,e,n,r){let i=0,o=!0;const s=[],l=t.firstChild;if(!l)return{};for(let u=0,d=0;u<l.childCount;u+=1){const{colspan:f,colwidth:h}=l.child(u).attrs;for(let p=0;p<f;p+=1,d+=1){const g=n===d?r:h&&h[p];i+=g||e,g||(o=!1);const[m,y]=Ns(e,g);s.push(["col",{style:`${m}: ${y}`}])}}const a=o?`${i}px`:"",c=o?"":`${i}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:c}}
139function Jc(t,e){return t.createAndFill()}function ik(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 ok(t,e,n,r,i){const o=ik(t),s=[],l=[];for(let c=0;c<n;c+=1){const u=Jc(o.cell);if(u&&l.push(u),r){const d=Jc(o.header_cell);d&&s.push(d)}}const a=[];for(let c=0;c<e;c+=1)a.push(o.row.createChecked(null,r&&c===0?s:l));return o.table.createChecked(null,a)}function sk(t){return t instanceof q}const Br=({editor:t})=>{const{selection:e}=t.state;if(!sk(e))return!1;let n=0;const r=ar(e.ranges[0].$from,i=>i.type.name==="table");return r?.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n!==e.ranges.length?!1:(t.commands.deleteTable(),!0)};function Gc(t,e){const n=t.mapping.map(e),r=ar(t.selection.$from,s=>s.type.name==="table");if(r?.pos===n)return;const i=t.doc.nodeAt(n);if(!i)return;const o=n+i.nodeSize-1;t.setSelection(R.near(t.doc.resolve(o),-1))}function lk(t){let e="",n=0;for(;n<t.length;){if(t[n]==="\\"&&n+1<t.length){e+=t[n]+t[n+1],n+=2;continue}if(t[n]!=="`"){e+=t[n++];continue}let r=0;for(;n+r<t.length&&t[n+r]==="`";)r+=1;let i=n+r,o=!1;for(;i<t.length;){if(t[i]!=="`"){i+=1;continue}let s=0;for(;i+s<t.length&&t[i+s]==="`";)s+=1;if(s===r){const l=t.slice(n+r,i);e+=t.slice(n,n+r)+l.replace(/\\\||\|/g,a=>a==="|"?"\\|":a)+t.slice(i,i+r),n=i+r,o=!0;break}i+=s}o||(e+=t.slice(n,n+r),n+=r)}return e}function ak(t){return t.split(`
140`).map(e=>!e.includes("|")||!e.includes("`")?e:lk(e)).join(`
141`)}function ck(t){return(t||"").replace(/\s+/g," ").trim()}function uk(t,e,n={}){var r;const i=(r=n.cellLineSeparator)!==null&&r!==void 0?r:"�";if(!t||!t.content||t.content.length===0)return"";const o=[];t.content.forEach(p=>{const g=[];p.content&&p.content.forEach(m=>{let y="";m.content&&Array.isArray(m.content)&&m.content.length>1?y=m.content.map(k=>e.renderChildren(k)).join(i):y=m.content?e.renderChildren(m.content):"";const v=ck(y.split(i).join(`
142`).replace(/[ \t]*\r?\n[ \t]*/g,"<br>")),w=m.type==="tableHeader",b=YS(m.attrs);g.push({text:v,isHeader:w,align:b})}),o.push(g)});const s=o.reduce((p,g)=>Math.max(p,g.length),0);if(s===0)return"";const l=Array.from({length:s}).fill(0);o.forEach(p=>{for(let m=0;m<s;m+=1){var g;const y=(((g=p[m])===null||g===void 0?void 0:g.text)||"").length;y>l[m]&&(l[m]=y),l[m]<3&&(l[m]=3)}});const a=(p,g)=>p+" ".repeat(Math.max(0,g-p.length)),c=o[0],u=c.some(p=>p.isHeader),d=Array.from({length:s}).fill(null);o.forEach(p=>{for(let m=0;m<s;m+=1){var g;!d[m]&&(!((g=p[m])===null||g===void 0)&&g.align)&&(d[m]=p[m].align)}});let f=`
143`;const h=Array.from({length:s}).map((p,g)=>u&&c[g]&&c[g].text||"");return f+=`| ${h.map((p,g)=>a(p,l[g])).join(" | ")} |
144`,f+=`| ${l.map((p,g)=>{const m=Math.max(3,p),y=d[g];return y==="left"?`:${"-".repeat(m)}`:y==="right"?`${"-".repeat(m)}:`:y==="center"?`:${"-".repeat(m)}:`:"-".repeat(m)}).join(" | ")} |
145`,(u?o.slice(1):o).forEach(p=>{f+=`| ${Array.from({length:s}).fill(0).map((g,m)=>a(p[m]&&p[m].text||"",l[m])).join(" | ")} |
146`}),f}const dk=ie.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:nk,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=rk(t,this.options.cellMinWidth),o=e.style;function s(){return o||(r?`width: ${r}`:`min-width: ${i}`)}const l=["table",F(this.options.HTMLAttributes,e,{style:s()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(t,e)=>{const n=[],r=Array.isArray(t.align)?t.align:[];if(t.header){const i=[];t.header.forEach((o,s)=>{var l;const a=$i((l=r[s])!==null&&l!==void 0?l:o.align),c=a?{align:a}:{};i.push(e.createNode("tableHeader",c,[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}return t.rows&&t.rows.forEach(i=>
146{const o=[];i.forEach((s,l)=>{var a;const c=$i((a=r[l])!==null&&a!==void 0?a:s.align),u=c?{align:c}:{};o.push(e.createNode("tableCell",u,[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},o))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>uk(t,e),markdownTokenizer:{name:"table",level:"block",start:t=>{const e=t.split(`
147`);if(e.length<2)return-1;const n=e[1];return!/^[ \t|:]*-[ \t|:-]*$/.test(n)||!n.includes("|")?-1:e[0].includes("|")?0:-1},tokenize(t,e,n){const r=t.indexOf(`
148
149`),i=r>=0?t.slice(0,r):t,o=i.split(`
150`);if(o.length<2)return;const s=o[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(s)||!s.includes("|"))return;const l=ak(i);if(l===i)return;const a=n.blockTokens(l)[0];if(a?.type!=="table"||!a.raw)return;const c=a.raw.split(`
151`).length,u=t.split(`
152`).slice(0,c).join(`
153`);return{...a,raw:u}}},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:o})=>{const s=ok(o.schema,t,e,n);if(i){const l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(R.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>n1(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>r1(t,e),deleteColumn:()=>({state:t,dispatch:e})=>{const n=ar(t.selection.$from,r=>r.type.name==="table");return o1(t,e&&(r=>{n&&Gc(r,n.pos),e(r)}))},addRowBefore:()=>({state:t,dispatch:e})=>l1(t,e),addRowAfter:()=>({state:t,dispatch:e})=>a1(t,e),deleteRow:()=>({state:t,dispatch:e})=>{const n=ar(t.selection.$from,r=>r.type.name==="table");return u1(t,e&&(r=>{n&&Gc(r,n.pos),e(r)}))},deleteTable:()=>({state:t,dispatch:e})=>y1(t,e),mergeCells:()=>({state:t,dispatch:e})=>wc(t,e),splitCell:()=>({state:t,dispatch:e})=>vc(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>ur("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>ur("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>m1(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>wc(t,e)?!0:vc(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>h1(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Sc(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Sc(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Xf(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=q.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:Br,"Mod-Backspace":Br,Delete:Br,"Mod-Delete":Br}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[E1({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],z1({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){const t=this.options.resizable&&this.editor.isEditable,e=this.options.View;return t||!e?null:({node:n,view:r,HTMLAttributes:i})=>{const o=F(this.options.HTMLAttributes,i);return new e(n,this.options.cellMinWidth,r,o)}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:B(N(t,"tableRole",e))}}});J.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(dk.configure(this.options.table)),this.options.tableCell!==!1&&t.push(ZS.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(ek.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(tk.configure(this.options.tableRow)),t}});const fk=t=>ee({find:/--$/,replace:t??"—"}),hk=t=>ee({find:/\.\.\.$/,replace:t??"…"}),Ho=t=>ee({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),Fo=t=>ee({find:/"$/,replace:t??"”"}),Vo=t=>ee({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),Wo=t=>ee({find:/'$/,replace:t??"’"}),pk=t=>ee({find:/<-$/,replace:t??"←"}),mk=t=>ee({find:/->$/,replace:t??"→"}),gk=t=>ee({find:/\(c\)$/,replace:t??"©"}),yk=t=>ee({find:/\(tm\)$/,replace:t??"™"}),bk=t=>ee({find:/\(sm\)$/,replace:t??"℠"}),wk=t=>ee({find:/\(r\)$/,replace:t??"®"}),vk=t=>ee({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),xk=t=>ee({find:/\+\/-$/,replace:t??"±"}),Sk=t=>ee({find:/!=$/,replace:t??"≠"}),kk=t=>ee({find:/<<$/,replace:t??"«"}),Ck=t=>ee({find:/>>$/,replace:t??"»"}),Tk=t=>ee({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),Mk=t=>ee({find:/\^2$/,replace:t??"²"}),Ek=t=>ee({find:/\^3$/,replace:t??"³"}),Ak=t=>ee({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),Ok=t=>ee({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),Jk=J.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){var t,e;const n=[];this.options.emDash!==!1&&n.push(fk(this.options.emDash)),this.options.ellipsis!==!1&&n.push(hk(this.options.ellipsis));const r=this.editor.options.textDirection==="rtl";if(!((t=this.options.doubleQuotes)===null||t===void 0)&&t.rtl){const{open:i,close:o}=this.options.doubleQuotes.rtl;n.push(Ho(i)),n.push(Fo(o))}else r?(n.push(Ho("”")),n.push(Fo("“"))):(this.options.openDoubleQuote!==!1&&n.push(Ho(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&n.push(Fo(this.options.closeDoubleQuote)));if(!((e=this.options.singleQuotes)===null||e===void 0)&&e.rtl){const{open:i,close:o}=this.options.singleQuotes.rtl;n.push(Vo(i)),n.push(Wo(o))}else r?(n.push(Vo("’")),n.push(Wo("‘"))):(this.options.openSingleQuote!==!1&&n.push(Vo(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&n.push(Wo(this.options.closeSingleQuote)));return this.options.leftArrow!==!1&&n.push(pk(this.options.leftArrow)),this.options.rightArrow!==!1&&n.push(mk(this.options.rightArrow)),this.options.copyright!==!1&&n.push(gk(this.options.copyright)),this.options.trademark!==!1&&n.push(yk(this.options.trademark)),this.options.servicemark!==!1&&n.push(bk(this.options.servicemark)),this.options.registeredTrademark!==!1&&n.push(wk(this.options.registeredTrademark)),this.options.oneHalf!==!1&&n.push(vk(this.options.oneHalf)),this.options.plusMinus!==!1&&n.push(xk(this.options.plusMinus)),this.options.notEqual!==!1&&n.push(Sk(this.options.notEqual)),this.options.laquo!==!1&&n.push(kk(this.options.laquo)),this.options.raquo!==!1&&n.push(Ck(this.options.raquo)),this.options.multiplication!==!1&&n.push(Tk(this.options.multiplication)),this.options.superscriptTwo!==!1&&n.push(Mk(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&n.push(Ek(this.options.superscriptThree)),this.options.oneQuarter!==!1&&n.push(Ak(this.options.oneQuarter)),this.options.threeQuarters!==!1&&n.push(Ok(this.options.threeQuarters)),n}});function Rk(){try{return Wg}catch{return null}}function Nk(t,e){if(t&&typeof t.serializeForClipboard=="function")return t.serializeForClipboard(e);const n=Rk();if(n&&typeof n?.__serializeForClipboard=="function")return n.__serializeForClipboard(t,e);throw new Error("No supported clipboard serialization method found.")}function Dk(t){const e=t.getBoundingClientRect(),n=t.closest('[role="dialog"]');if(n&&window.getComputedStyle(n).transform!=="none"){const r=n.getBoundingClientRect();
153return{top:e.top-r.top,left:e.left-r.left,width:e.width}}return{top:e.top,left:e.left,width:e.width}}function Yc(t,e){const n=["li","p:not(:first-child)","pre","blockquote","h1","h2","h3","h4","h5","h6",...e.customNodes.map(r=>`[data-type=${r}]`)].join(", ");return document.elementsFromPoint(t.x,t.y).find(r=>r.parentElement?.matches?.(".ProseMirror")||r.matches(n))}function Ik(t,e,n){const r=t.getBoundingClientRect();return e.posAtCoords({left:r.left+50+n.dragHandleWidth,top:r.top+1})?.inside}function Xc(t,e){const n=e.state.doc.resolve(t);return n.depth>1?n.before(n.depth):t}function Lk(t){let e="";function n(l,a){if(a.focus(),!l.dataTransfer)return;const c=Yc({x:l.clientX+50+t.dragHandleWidth,y:l.clientY},t);if(!(c instanceof Element))return;let u=Ik(c,a,t);if(u==null||u<0)return;u=Xc(u,a);const{from:d,to:f}=a.state.selection,h=d-f,p=Xc(d,a);let g=!1;const m=a.state.doc.resolve(p);if(m.node().type.name==="doc")g=!0;else{const k=O.create(a.state.doc,m.before());g=!(u+1>=k.$from.pos&&u<=k.$to.pos)}let y=a.state.selection;if(!g&&h!==0&&!(a.state.selection instanceof O)){const k=O.create(a.state.doc,f-1);y=R.create(a.state.doc,u,k.$to.pos)}else if(y=O.create(a.state.doc,u),y.node.type.isInline||y.node.type.name==="tableRow"){let k=a.state.doc.resolve(y.from);y=O.create(a.state.doc,k.before())}a.dispatch(a.state.tr.setSelection(y)),a.state.selection instanceof O&&a.state.selection.node.type.name==="listItem"&&(e=c.parentElement.tagName);const v=a.state.selection.content(),{dom:w,text:b}=Nk(a,v);l.dataTransfer.clearData(),l.dataTransfer.setData("text/html",w.innerHTML),l.dataTransfer.setData("text/plain",b),l.dataTransfer.effectAllowed="copyMove",l.dataTransfer.setDragImage(c,0,0),a.dragging={slice:v,move:l.ctrlKey}}let r=null;function i(){r&&r.classList.add("hide")}function o(){r&&r.classList.remove("hide")}function s(l){if(l.target instanceof Element){const a=l.relatedTarget;if(a?.classList.contains("tiptap")||a?.classList.contains("drag-handle"))return}i()}return new V({key:new U(t.pluginKey),view:l=>{const a=t.dragHandleSelector?document.querySelector(t.dragHandleSelector):null;r=a??document.createElement("div"),r.draggable=!0,r.dataset.dragHandle="",r.classList.add("drag-handle");function c(d){n(d,l)}r.addEventListener("dragstart",c);function u(d){i();let f=window.scrollY;d.clientY<t.scrollTreshold?window.scrollTo({top:f-30,behavior:"smooth"}):window.innerHeight-d.clientY<t.scrollTreshold&&window.scrollTo({top:f+30,behavior:"smooth"})}return r.addEventListener("drag",u),i(),a||l?.dom?.parentElement?.appendChild(r),l?.dom?.parentElement?.addEventListener("mouseout",s),{destroy:()=>{a||r?.remove?.(),r?.removeEventListener("drag",u),r?.removeEventListener("dragstart",c),r=null,l?.dom?.parentElement?.removeEventListener("mouseout",s)}}},props:{handleDOMEvents:{mousemove:(l,a)=>{if(!l.editable)return;const c=Yc({x:a.clientX+50+t.dragHandleWidth,y:a.clientY},t),u=c?.closest(".not-draggable"),d=t.excludedTags.concat(["ol","ul"]).join(", ");if(!(c instanceof Element)||c.matches(d)||u){i();return}const f=window.getComputedStyle(c),h=parseInt(f.lineHeight,10),p=isNaN(h)?parseInt(f.fontSize)*1.2:h,g=parseInt(f.paddingTop,10),m=Dk(c);m.top+=(p-24)/2,m.top+=g,c.matches("ul:not([data-type=taskList]) li, ol li")&&(m.left-=t.dragHandleWidth),m.width=t.dragHandleWidth,r&&(r.style.left=`${m.left-m.width}px`,r.style.top=`${m.top}px`,o())},keydown:()=>{i()},mousewheel:()=>{i()},dragstart:l=>{l.dom.classList.add("dragging")},drop:(l,a)=>{l.dom.classList.remove("dragging"),i();let c=null;const u=l.posAtCoords({left:a.clientX,top:a.clientY});if(!u||(l.state.selection instanceof O&&(c=l.state.selection.node),!c))return;const f=l.state.doc.resolve(u.pos).parent.type.name==="listItem";if(l.state.selection instanceof O&&l.state.selection.node.type.name==="listItem"&&!f&&e=="OL"){const h=l.state.schema.nodes.orderedList?.createAndFill(null,c),p=new M(x.from(h),0,0);l.dragging={slice:p,move:a.ctrlKey}}},dragend:l=>{l.dom.classList.remove("dragging")}}}})}const Gk=J.create({name:"globalDragHandle",addOptions(){return{dragHandleWidth:20,scrollTreshold:100,excludedTags:[],customNodes:[]}},addProseMirrorPlugins(){return[Lk({pluginKey:"globalDragHandle",dragHandleWidth:this.options.dragHandleWidth,scrollTreshold:this.options.scrollTreshold,dragHandleSelector:this.options.dragHandleSelector,excludedTags:this.options.excludedTags,customNodes:this.options.customNodes})]}});
153export{_k as B,Qb as D,Hb as E,Gk as G,Zb as P,Hk as R,ew as T,FS as U,Fk as a,Vk as b,J as c,V as d,U as e,re as f,$ as g,tk as h,ZS as i,ek as j,Jk as k,jk as l,Uk as m,Kk as n,qk as o,dk as p,$S as q,PS as r,eu as s,tn as t,Bk as u,zk as v};
154//# sourceMappingURL=vendor-editor-CTSc4oA7.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.