PageSourceSearch

https://dentasmart.ai/assets/vendor-tiptap-DWHPc8nd.js

js dentasmart.ai collected 2026-10-05 15:32:39 UTC 492,149 bytes, 162 lines download raw bytes

1import{d as Uc,c as Ct,r as q,a as Io,j as $e,b as lp,g as ap}from"./vendor-react-DViTTRkQ.js";import{f as Wc,s as Kc,o as qc,a as Jc,b as Gc,c as Yc,h as Xc,i as Qc,d as Zc}from"./vendor-radix-CFYyFGFF.js";var ds={exports:{}},hs={};/**
2 * @license React
3 * use-sync-external-store-shim.production.js
4 *
5 * Copyright (c) Meta Platforms, Inc. and affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var jl;function cp(){if(jl)return hs;jl=1;var t=Uc();function e(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function l(d,h){var f=h(),p=r({inst:{value:f,getSnapshot:h}}),m=p[0].inst,g=p[1];return s(function(){m.value=f,m.getSnapshot=h,a(m)&&g({inst:m})},[d,f,h]),i(function(){return a(m)&&g({inst:m}),d(function(){a(m)&&g({inst:m})})},[d]),o(f),f}function a(d){var h=d.getSnapshot;d=d.value;try{var f=h();return!n(d,f)}catch{return!0}}function c(d,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:l;return hs.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,hs}var Ul;function eu(){return Ul||(Ul=1,ds.exports=cp()),ds.exports}var tu=eu();function Me(t){this.content=t}Me.prototype={constructor:Me,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),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new Me(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Me(n)},addToStart:function(t,e){return new Me([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Me(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new Me(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=Me.from(t),t.size?new Me(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Me.from(t),t.size?new Me(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Me.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}};Me.from=function(t){if(t instanceof Me)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Me(e)};function nu(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),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=nu(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function ru(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){n-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||l.content.size){let c=ru(o.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}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,s){for(let o=0,l=0;l<n;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,i+l,s||null,o)!==!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)}textBetween(e,n,r,i){let s="",o=!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):"":"";
vendor: 4,320 bytes, line 9
9l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);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 s=0,o=0;o<n;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),i+=l.nodeSize),o=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(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new x(i,s)}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 nu(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return ru(this,e,n,r)}findIndex(e){if(e==0)return Ar(0,e);if(e==this.size)return Ar(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),s=r+i.nodeSize;if(s>=e)return s==e?Ar(n+1,s):Ar(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return x.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new x(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 s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}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 fs={index:0,offset:0};function Ar(t,e){return fs.index=t,fs.offset=e,fs}function Qr(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(!Qr(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Qr(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let te=class Js{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Qr(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;
vendor: 20,518 bytes, lines 9-10
9if(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 Js.none;if(e instanceof Js)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};te.none=[];class Zr extends Error{}class A{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);return r&&new A(r,this.openStart,this.openEnd)}removeBetween(e,n){return new A(iu(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 A.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 A(x.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new A(e,r,i)}}A.empty=new A(x.empty,0,0);function iu(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(i==e||s.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(iu(s.content,e-i-1,n-i-1)))}function su(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=su(o.content,e-s-1,n,o);return l&&t.replaceChild(i,o.copy(l))}function up(t,e,n){if(n.openStart>t.depth)throw new Zr("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Zr("Inconsistent open depths");return ou(t,e,n,0)}function ou(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=ou(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,l=o.content;return ln(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=dp(n,t);return ln(s,au(t,o,l,e,r))}else return ln(s,ei(t,e,r))}function lu(t,e){if(!e.type.compatibleContent(t.type))throw new Zr("Cannot join "+e.type.name+" onto "+t.type.name)}function Gs(t,e,n){let r=t.node(n);return lu(r,e.node(n)),r}function on(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 qn(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(on(t.nodeAfter,r),s++));for(let l=s;l<o;l++)on(i.child(l),r);e&&e.depth==n&&e.textOffset&&on(e.nodeBefore,r)}function ln(t,e){return t.type.checkContent(e),t.copy(e)}function au(t,e,n,r,i){let s=t.depth>i&&Gs(t,e,i+1),o=r.depth>i&&Gs(n,r,i+1),l=[];return qn(null,t,i,l),s&&o&&e.index(i)==n.index(i)?(lu(s,o),on(ln(s,au(t,e,n,r,i+1)),l)):(s&&on(ln(s,ei(t,e,i+1)),l),qn(e,n,i,l),o&&on(ln(o,ei(n,r,i+1)),l)),qn(r,null,i,l),new x(l)}function ei(t,e,n){let r=[];if(qn(null,t,n,r),t.depth>n){let i=Gs(t,e,n+1);on(ln(i,ei(t,e,n+1)),r)}return qn(e,null,n,r),new x(r)}function dp(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(x.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class rr{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 s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return te.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 s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}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 s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new ti(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,s=n;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new rr(n,r,s)}static resolveCached(e,n){let r=Wl.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else Wl.set(e,r=new hp);let i=r.elts[r.i]=rr.resolve(e,n);return r.i=(r.i+1)%fp,i}}class hp{constructor(){this.elts=[],this.i=0}}const fp=12,Wl=new WeakMap;class ti{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 pp=Object.create(null);class et{constructor(e,n,r,i=te.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&&Qr(this.attrs,n||e.defaultAttrs||pp)&&te.sameSet(this.marks,r||te.none)}copy(e=null){return e==this.content?this:new et(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new et(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 A.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new A(c,i.depth-o,s.depth-o)}replace(e,n,r){return up(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 rr.resolveCached(this,e)}resolveNoCache(e){return rr.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.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()+")"),cu(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,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=i;a<s;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 s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.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=te.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(!te.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=x.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}}et.prototype.text=void 0;class ni extends et{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):cu(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 ni(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ni(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 cu(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class dn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new mp(e,n);if(r.next==null)return dn.empty;let i=uu(r);r.next&&r.err("Unexpected trailing text");let s=Sp(xp(i));return vp(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).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 s(o,l){let a=o.matchFragment(e,r);if(a&&(!n||a.validEnd))return x.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=s(d,l.concat(u));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!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 s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
10`)}}dn.empty=new dn(!0);class mp{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 uu(t){let e=[];do e.push(gp(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function gp(t){let e=[];do e.push(yp(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function yp(t){let e=kp(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=bp(t,e);else break;return e}function Kl(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function bp(t,e){let n=Kl(t),r=n;return t.eat(",")&&(t.next!="}"?r=Kl(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function wp(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function kp(t){if(t.eat("(")){let e=uu(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=wp(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function xp(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=n())}else if(o.type=="star"){let a=n();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=n();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=n();i(s(o.expr,a),u),a=u}if(o.max==-1)i(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=n();r(a,u),i(s(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function du(t,e){return e-t}function ql(t,e){let n=[];return r(e),n.sort(du);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&n.indexOf(a)==-1&&r(a)}}}function Sp(t){let e=Object.create(null);return n(ql(t,0));function n(r){let i=[];r.forEach(o=>{t[o].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]);ql(t,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new dn(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(du);s.next.push({type:i[o][0],next:e[l.join(",")]||n(l)})}return s}}function vp(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.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 fu(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function pu(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function mu(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Mp(t,r,e[r]);return n}let Jl=class gu{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=mu(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==dn.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:fu(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new et(this,this.computeAttrs(e),x.from(n),te.setFrom(r))}createChecked(e=null,n,r){return n=x.from(n),this.checkContent(n),new et(this,this.computeAttrs(e),n,te.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=x.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(x.empty,!0);return s?new et(this,e,n.append(s),te.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);
vendor: 9,375 bytes, lines 10-11
10if(!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){pu(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:te.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new gu(s,n,o));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 s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Cp(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class Mp{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Cp(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Vi{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=mu(e,i.attrs),this.excluded=null;let s=hu(this.attrs);this.instance=s?new te(this,s):null}create(e=null){return!e&&this.instance?this.instance:new te(this,fu(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Vi(s,i++,n,o)),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){pu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class yu{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=Me.from(e.nodes),n.marks=Me.from(e.marks||{}),this.nodes=Jl.compile(this.spec.nodes,this),this.marks=Vi.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 s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=dn.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?Gl(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Gl(this,o.split(" "))}this.nodeFromJSON=i=>et.fromJSON(this,i),this.markFromJSON=i=>te.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 Jl){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 ni(r,r.defaultAttrs,e,te.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 Gl(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);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(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function Ep(t){return t.tag!=null}function Tp(t){return t.style!=null}class Ft{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(Ep(i))this.tags.push(i);else if(Tp(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new Xl(this,n,!1);return r.addAll(e,te.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Xl(this,n,!0);return r.addAll(e,te.none,n.from,n.to),A.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Np(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(o.getAttrs){let a=o.getAttrs(n);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Ql(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Ql(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ft(e,Ft.schemaRules(e)))}}const bu={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Ap={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},wu={ol:!0,ul:!0},ir=1,Ys=2,Jn=4;function Yl(t,e,n){return e!=null?(e?ir:0)|(e==="full"?Ys:0):t&&t.whitespace=="pre"?ir|Ys:n&~Jn}class Or{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=te.none,this.match=s||(o&Jn?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&ir)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.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&&!bu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Xl{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=Yl(null,n.preserveWhitespace,0)|(r?Jn:0);i?s=new Or(i.type,i.attrs,te.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new Or(null,null,te.none,!0,null,o):s=new Or(e.schema.topNodeType,null,te.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&Ys?"full":this.localPreserveWS||(i.options&ir)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
11`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(o.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(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;wu.hasOwnProperty(o)&&this.parser.normalizeLists&&Op(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Ap.hasOwnProperty(o))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;
vendor: 5,109 bytes, lines 11-12
11if(bu.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.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(s),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(`
12`),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 s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(s,o,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 s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,n.attrs||null,r,n.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(o&&o.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).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!i||i.length>c.length+l)&&(i=c,s=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=te.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):Zl(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Yl(e,s,o.options);o.options&Jn&&o.content.length==0&&(l|=Jn);let a=te.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Zl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Or(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|=ir)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let 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),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(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;
vendor: 7,936 bytes, line 12
12if(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 Op(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&wu.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Np(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Ql(t){let e={};for(let n in t)e[n]=t[n];return e}function Zl(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class bn{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=ps(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,n);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Wr(ps(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 s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Wr(ps(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Wr(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new bn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=ea(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return ea(e.marks)}}function ea(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ps(t){return t.document||window.document}const ta=new WeakMap;function Rp(t){let e=ta.get(t);return e===void 0&&ta.set(t,e=Dp(t)),e}function Dp(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 Wr(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=Rp(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+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 h=d.indexOf(" ");h>0?a.setAttributeNS(d.slice(0,h),d.slice(h+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 h=e[d];if(h===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:f,contentDOM:p}=Wr(t,h,n,r);if(a.appendChild(f),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const ku=65535,xu=Math.pow(2,16);function Ip(t,e){return t+e*xu}function na(t){return t&ku}function Lp(t){return(t-(t&ku))/xu}const Su=1,vu=2,Kr=4,Cu=8;class Xs{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Cu)>0}get deletedBefore(){return(this.delInfo&(Su|Kr))>0}get deletedAfter(){return(this.delInfo&(vu|Kr))>0}get deletedAcross(){return(this.delInfo&Kr)>0}}class Ve{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ve.empty)return Ve.empty}recover(e){let n=0,r=na(e);if(!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+Lp(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,s=this.inverted?2:1,o=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+s],u=this.ranges[l+o],d=a+c;if(e<=d){let h=c?e==a?-1:e==d?1:n:n,f=a+i+(h<0?0:u);if(r)return f;let p=e==(n<0?a:d)?null:Ip(l/3,e-a),m=e==a?vu:e==d?Su:Kr;return(n<0?e!=a:e!=d)&&(m|=Cu),new Xs(f,m,p)}i+=u-c}return r?e+i:new Xs(e+i,0,null)}touches(e,n){let r=0,i=na(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),c=this.ranges[i+n],u=this.ranges[i+r];e(l,l+c,a,a+u),s+=u-c}}invert(){return new Ve(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ve.empty:new Ve(e<0?[0,-e,0]:[0,0,e])}}Ve.empty=new Ve([]);class sr{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 sr(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 sr;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 s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new Xs(e,i,null)}}const ms=Object.create(null);class Pe{getMap(){return Ve.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ms[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 ms)throw new RangeError("Duplicate use of step JSON ID "+e);return ms[e]=n,n.prototype.jsonID=e,n}}class pe{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new pe(e,null)}static fail(e){return new pe(null,e)}static fromReplace(e,n,r,i){try{return pe.ok(e.replace(n,r,i))}catch(s){if(s instanceof Zr)return pe.fail(s.message);throw s}}}function Lo(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Lo(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return x.fromArray(r)}class Ht extends Pe{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: 5,494 bytes, line 12
12de(r.sharedDepth(this.to)),s=new A(Lo(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return pe.fromReplace(e,this.from,this.to,s)}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 Ht(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ht&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ht(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 Ht(n.from,n.to,e.markFromJSON(n.mark))}}Pe.jsonID("addMark",Ht);class Ze extends Pe{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 A(Lo(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return pe.fromReplace(e,this.from,this.to,r)}invert(){return new Ht(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))}}Pe.jsonID("removeMark",Ze);class $t extends Pe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return pe.fromReplace(e,this.pos,this.pos+1,new A(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 $t(this.pos,n.marks[i]);return new $t(this.pos,this.mark)}}return new hn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new $t(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new $t(n.pos,e.markFromJSON(n.mark))}}Pe.jsonID("addNodeMark",$t);class hn extends Pe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return pe.fromReplace(e,this.pos,this.pos+1,new A(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 $t(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new hn(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 hn(n.pos,e.markFromJSON(n.mark))}}Pe.jsonID("removeNodeMark",hn);class xe extends Pe{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Qs(e,this.from,this.to)?pe.fail("Structure replace would overwrite content"):pe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ve([this.from,this.to-this.from,this.slice.size])}invert(e){return new xe(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new xe(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof xe)||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?A.empty:new A(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new xe(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?A.empty:new A(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new xe(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 xe(n.from,n.to,A.fromJSON(e,n.slice),!!n.structure)}}Pe.jsonID("replace",xe);class Se extends Pe{constructor(e,n,r,i,s,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Qs(e,this.from,this.gapFrom)||Qs(e,this.gapTo,this.to)))return pe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return pe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);
vendor: 1,930 bytes, line 12
12return r?pe.fromReplace(e,this.from,this.to,r):pe.fail("Content does not fit in gap")}getMap(){return new Ve([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Se(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),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Se(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Se(n.from,n.to,n.gapFrom,n.gapTo,A.fromJSON(e,n.slice),n.insert,!!n.structure)}}Pe.jsonID("replaceAround",Se);function Qs(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Pp(t,e,n,r){let i=[],s=[],o,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 h=Math.max(c,e),f=Math.min(c+a.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(d[m])?o.to=f:i.push(o=new Ze(h,f,d[m])));l&&l.to==h?l.to=f:s.push(l=new Ht(h,f,r))}}
vendor: 5,885 bytes, lines 12-13
12),i.forEach(a=>t.step(a)),s.forEach(a=>t.step(a))}function zp(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof Vi){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&d.eq(i[f].style)&&(h=p)}h?(h.to=c,h.step=s):i.push({style:d,from:Math.max(l,e),to:c,step:s})}}}),i.forEach(o=>t.step(new Ze(o.from,o.to,o.style)))}function Po(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let c=s.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new xe(l,u,A.empty));else{r=d;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new Ze(l,u,c.marks[h]));if(i&&c.isText&&n.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new A(x.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new xe(l+h.index,l+h.index+h[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(x.empty,!0);t.replace(l,l,new A(a,0,0))}for(let a=o.length-1;a>=0;a--)t.step(o[a])}function Bp(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Bn(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),l=t.$from.index(r)+i,a=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(l,a,n))return r;if(r==0||o.type.spec.isolating||!Bp(o,l,a))break;l&&(i=1),a<o.childCount&&(s=1)}return null}function Hp(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),a=o,c=l,u=x.empty,d=0;for(let p=s,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=x.from(r.node(p).copy(u)),d++):a--;let h=x.empty,f=0;for(let p=s,m=!1;p>n;p--)m||i.after(p+1)<i.end(p)?(m=!0,h=x.from(i.node(p).copy(h)),f++):c++;t.step(new Se(a,c,o,l,new A(u.append(h),d,f),u.size-d,!0))}function zo(t,e,n=null,r=t){let i=$p(t,e),s=i&&_p(r,e);return s?i.map(ra).concat({type:e,attrs:n}).concat(s.map(ra)):null}function ra(t){return{type:t,attrs:null}}function $p(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function _p(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:o}function Fp(t,e,n){let r=x.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let l=n[o].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[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new Se(i,s,i,s,new A(r,0,0),n.length,!0))}function Vp(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,a)&&jp(t.doc,t.mapping.slice(s).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&Eu(t,o,l,s),Po(t,t.mapping.slice(s).map(l,1),r,void 0,c===null);let u=t.mapping.slice(s),d=u.map(l,1),h=u.map(l+o.nodeSize,1);return t.step(new Se(d,h,d+1,h-1,new A(x.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&Mu(t,o,l,s),!1}})}function Mu(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Eu(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
13`))}})}function jp(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Up(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Se(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new A(x.from(o),0,0),1,!0))}function St(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=n-2;c>s;c--,u--){let d=i.node(c),h=i.index(c);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),p=r&&r[u+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(h+1,d.childCount)||!m.type.validContent(f))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function Wp(t,e,n=1,r){let i=t.doc.resolve(e),s=x.empty,o=x.empty;for(let l=i.depth,a=i.depth-n,c=n-1;l>a;l--,c--){s=x.from(i.node(l).copy(s));let u=r&&r[c];o=x.from(u?u.type.create(u.attrs,o):i.node(l).copy(o))}t.step(new xe(e,e,new A(s.append(o),n,n),!0))}function Jt(t,e){let n=t.resolve(e),r=n.index();return Tu(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Kp(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 s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function Tu(t,e){return!!(t&&e&&!t.isLeaf&&Kp(t,e))}function ji(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;
vendor: 4,470 bytes, line 13
13i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&Tu(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function qp(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.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)}o.inlineContent&&Po(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new xe(c,a.map(e+n,-1),A.empty,!0)),r===!0){let u=t.doc.resolve(c);Mu(t,u.node(),u.before(),t.steps.length)}return t}function Jp(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 s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function Au(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(s==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(o+1):r.after(o+1)}return null}function Ui(t,e,n=e,r=A.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return Ou(i,s,r)?new xe(e,n,r):new Gp(i,s,r).fit()}function Ou(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Gp{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 s=e.node(i);this.frontier.push({type:s.type,match:s.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 s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new A(s,o,l);return e>-1?new Se(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new xe(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 s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=gs(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(x.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=gs(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new A(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=gs(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new A(Vn(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new A(Vn(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,c=0,u=[],{match:d,type:h}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)u.push(i.child(m));d=d.matchFragment(i)}let f=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let m=l.child(c),g=d.matchType(m.type);if(!g)break;c++,(c>
vendor: 10,949 bytes, line 13
131||a==0||m.content.size)&&(d=g,u.push(Nu(m.mark(h.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?f:-1)))}let p=c==l.childCount;p||(f=-1),this.placed=jn(this.placed,n,x.from(u)),this.frontier[n].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<f;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?A.empty:new A(Vn(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new A(Vn(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!ys(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],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=ys(e,n,i,r,s);if(o){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=ys(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=jn(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=jn(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=jn(this.placed,this.frontier.length,n))}}function Vn(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Vn(t.firstChild.content,e-1,n)))}function jn(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(jn(t.lastChild.content,e-1,n)))}function gs(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 ys(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!Yp(n,s.content,o)?l:null}function Yp(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Xp(t){return t.spec.defining||t.spec.definingForContent}function Qp(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(Ou(i,s,r))return t.step(new xe(e,n,r));let o=Du(i,s);o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?l=h:i.before(h)==f&&o.splice(1,0,-h)}let a=o.indexOf(l),c=[],u=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==r.openStart)break;h=p.content}for(let h=u-1;h>=0;h--){let f=c[h],p=Xp(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(l)-1)))u=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+u+1)%(r.openStart+1),p=c[f];if(p)for(let m=0;m<o.length;m++){let g=o[(m+a)%o.length],y=!0;g<0&&(y=!1,g=-g);let w=i.node(g-1),v=i.index(g-1);if(w.canReplaceWith(v,v,p.type,p.marks))return t.replace(i.before(g),y?s.after(g):n,new A(Ru(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>d));h--){let f=o[h];f<0||(e=i.before(f),n=s.after(f))}}function Ru(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(Ru(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(x.empty,!0))}return t}function Zp(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Jp(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new A(x.from(r),0,0))}function em(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=Du(r,i);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.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 o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function Du(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<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;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class An extends Pe{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return pe.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return pe.fromReplace(e,this.pos,this.pos+1,new A(x.from(i),0,n.isLeaf?0:1))}getMap(){return Ve.empty}invert(e){return new An(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 An(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 An(n.pos,n.attr,n.value)}}Pe.jsonID("attr",An);class or extends Pe{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 pe.ok(r)}getMap(){return Ve.empty}invert(e){return new or(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 or(n.attr,n.value)}}Pe.jsonID("docAttr",or);let Nn=class extends Error{};Nn=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Nn.prototype=Object.create(Error.prototype);Nn.prototype.constructor=Nn;Nn.prototype.name="TransformError";class Bo{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new sr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Nn(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((s,o,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=A.empty){let i=Ui(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new A(x.from(r),0,0))}delete(e,n){return this.replace(e,n,A.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Qp(this,e,n,r),this}replaceRangeWith(e,n,r){return Zp(this,e,n,r),this}deleteRange(e,n){return em(this,e,n),this}lift(e,n){return Hp(this,e,n),this}join(e,n=1){return qp(this,e,n),this}wrap(e,n){return Fp(this,e,n),this}setBlockType(e,n=e,r,i=null){return Vp(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return Up(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new An(e,n,r)),this}setDocAttribute(e,n){return this.step(new or(e,n)),this}addNodeMark(e,n){return this.step(new $t(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof te)n.isInSet(r.marks)&&this.step(new hn(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new hn(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,n=1,r){return Wp(this,e,n,r),this}addMark(e,n,r){return Pp(this,e,n,r),this}removeMark(e,n,r){return zp(this,e,n,r),this}clearIncompatible(e,n,r){return Po(this,e,n,r),this}}const bs=Object.create(null);class _{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Iu(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=A.empty){let r=n.content.lastChild,i=null;for(let l=0;l<n.openEnd;l++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],u=e.mapping.slice(s);e.replaceRange(u.map(a.pos),u.map(c.pos),l?A.empty:n),l==0&&oa(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],a=e.mapping.slice(r),c=a.map(o.pos),u=a.map(l.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),oa(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new H(e):Cn(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?Cn(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Cn(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Ue(e.node(0))}static atStart(e){return Cn(e,e,0,0,1)||new Ue(e)}static atEnd(e){return Cn(e,e,e.content.size,e.childCount,-1)||new Ue(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=bs[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 bs)throw new RangeError("Duplicate use of selection JSON ID "+e);return bs[e]=n,n.prototype.jsonID=e,n}getBookmark(){return H.between(this.$anchor,this.$head).getBookmark()}}_.prototype.visible=!0;class Iu{constructor(e,n){this.$from=e,this.$to=n}}let ia=!1;function sa(t){!ia&&!t.parent.inlineContent&&(ia=!0,console.warn("TextSelection endpoint not pointing into a 
13node with inline content ("+t.parent.type.name+")"))}class H extends _{constructor(e,n=e){sa(e),sa(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 _.near(r);let i=e.resolve(n.map(this.anchor));return new H(i.parent.inlineContent?i:r,r)}replace(e,n=A.empty){if(super.replace(e,n),n==A.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof H&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Wi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new H(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let 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 s=_.findFrom(n,r,!0)||_.findFrom(n,-r,!0);if(s)n=s.$head;else return _.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(_.findFrom(e,-r,!0)||_.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new H(e,n)}}_.jsonID("text",H);class Wi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Wi(e.map(this.anchor),e.map(this.head))}resolve(e){return H.between(e.resolve(this.anchor),e.resolve(this.head))}}class L extends _{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),s=e.resolve(i);return r?_.near(s):new L(s)}content(){return new A(x.from(this.node),0,0)}eq(e){return e instanceof L&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ho(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new L(e.resolve(n.anchor))}static create(e,n){return new L(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}L.prototype.visible=!1;_.jsonID("node",L);class Ho{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Wi(r,r):new Ho(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&L.isSelectable(r)?new L(n):_.near(n)}}class Ue extends _{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=A.empty){if(n==A.empty){e.delete(0,e.doc.content.size);let r=_.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ue(e)}map(e){return new Ue(e)}eq(e){return e instanceof Ue}getBookmark(){return tm}}_.jsonID("all",Ue);const tm={map(){return this},resolve(t){return new Ue(t)}};function Cn(t,e,n,r,i,s=!1){if(e.inlineContent)return H.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&L.isSelectable(l))return L.create(t,n-(i<0?l.nodeSize:0))}else{let a=Cn(t,l,n+i,i<0?l.childCount:0,i,s);if(a)return a}n+=l.nodeSize*i}return null}function oa(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof xe||i instanceof Se))return;let s=t.mapping.maps[r],o;s.forEach((l,a,c,u)=>{o==null&&(o=u)}),t.setSelection(_.near(t.doc.resolve(o),n))}const la=1,Nr=2,aa=4;class nm extends Bo{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|la)&~Nr,this.storedMarks=null,this}get selectionSet(){return(this.updated&la)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Nr,this}ensureMarks(e){return te.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&Nr)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Nr,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)||te.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 s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(_.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|=aa,this}get scrolledIntoView(){return(this.updated&aa)>0}}function ca(t,e){return!e||!t?t:t.bind(e)}class Un{constructor(e,n,r){this.name=e,this.init=ca(n.init,r),this.apply=ca(n.apply,r)}}const rm=[new Un("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Un("selection",{init(t,e){return t.selection||_.atStart(e.doc)},apply(t){return t.selection}}),new Un("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Un("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class ws{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=rm.slice(),n&&n.forEac
vendor: 4,963 bytes, line 13
13h(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 Un(r.key,r.spec.state,r))})}}class Tn{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 s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=i?i[o].n:0,c=i?i[o].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Tn(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new nm(this)}static create(e){let n=new ws(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Tn(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 ws(this.schema,e.plugins),r=n.fields,i=new Tn(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].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],s=i.spec.state;s&&s.toJSON&&(n[r]=s.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 ws(e.schema,e.plugins),s=new Tn(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=et.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=_.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){s[o.name]=c.fromJSON.call(a,e,n[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function Lu(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Lu(i,e,{})),n[r]=i}return n}class Z{constructor(e){this.spec=e,this.props={},e.props&&Lu(e.props,this,this.props),this.key=e.key?e.key.key:Pu("plugin")}getState(e){return e[this.key]}}const ks=Object.create(null);function Pu(t){return t in ks?t+"$"+ ++ks[t]:(ks[t]=0,t+"$")}class oe{constructor(e="key"){this.key=Pu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const $o=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function zu(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Bu=(t,e,n)=>{let r=zu(t,n);if(!r)return!1;let i=_o(r);if(!i){let o=r.blockRange(),l=o&&Bn(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(Ku(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Rn(s,"end")||L.isSelectable(s)))for(let o=r.depth;;o--){let l=Ui(t.doc,r.before(o),r.after(o),A.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(Rn(s,"end")?_.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):L.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},im=(t,e,n)=>{let r=zu(t,n);if(!r)return!1;let i=_o(r);return i?Hu(t,i,e):!1},sm=(t,e,n)=>{let r=_u(t,n);if(!r)return!1;let i=Fo(r);return i?Hu(t,i,e):!1};function Hu(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,l=o,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=Ui(t.doc,s,a,A.empty);if(!c||c.from!=s||c instanceof xe&&c.slice.size>=a-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(H.create(u.doc,s)),n(u.scrollIntoView())}return!0}function Rn(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;
vendor: 5,948 bytes, lines 13-14
13if(n&&r.childCount!=1)return!1}return!1}const $u=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=_o(r)}let o=s&&s.nodeBefore;return!o||!L.isSelectable(o)?!1:(e&&e(t.tr.setSelection(L.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function _o(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 _u(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Fu=(t,e,n)=>{let r=_u(t,n);if(!r)return!1;let i=Fo(r);if(!i)return!1;let s=i.nodeAfter;if(Ku(t,i,e,1))return!0;if(r.parent.content.size==0&&(Rn(s,"start")||L.isSelectable(s))){let o=Ui(t.doc,r.before(),r.after(),A.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(Rn(s,"start")?_.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):L.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Vu=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=Fo(r)}let o=s&&s.nodeAfter;return!o||!L.isSelectable(o)?!1:(e&&e(t.tr.setSelection(L.create(t.doc,s.pos)).scrollIntoView()),!0)};function Fo(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 om=(t,e)=>{let n=t.selection,r=n instanceof L,i;if(r){if(n.node.isTextblock||!Jt(t.doc,n.from))return!1;i=n.from}else if(i=ji(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(L.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},lm=(t,e)=>{let n=t.selection,r;if(n instanceof L){if(n.node.isTextblock||!Jt(t.doc,n.to))return!1;r=n.to}else if(r=ji(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},am=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Bn(i);return s==null?!1:(e&&e(t.tr.lift(i,s).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(`
14`).scrollIntoView()),!0)};function Vo(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 cm=(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),s=n.indexAfter(-1),o=Vo(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,o.createAndFill());a.setSelection(_.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Uu=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Ue||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Vo(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=t.tr.insert(o,s.createAndFill());l.setSelection(H.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},Wu=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(St(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Bn(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function um(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof L&&e.selection.node.isBlock)return!r.parentOffset||!St(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){a=r.end(f)==r.pos+(r.depth-f),c=r.start(f)==r.pos-(r.depth-f),l=Vo(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),s.unshift(a&&l?{type:l}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof H||e.selection instanceof Ue)&&u.deleteSelection();let d=u.mapping.map(r.pos),h=St(u.doc,d,s.length,s);if(h||(s[0]=l?{type:l}:null,h=St(u.doc,d,s.length,s)),!h)return!1;if(u.split(d,s.length,s),!a&&c&&r.node(o).type!=l){let f=u.mapping.map(r.before(o)),p=u.doc.resolve(f);l&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(o)),l)}return n&&n(u.scrollIntoView()),!0}}const dm=um(),hm=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(L.create(t.doc,i))),!0)};function fm(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Jt(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Ku(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&fm(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(n){let f=e.pos+s.nodeSize,p=x.empty;for(let y=o.length-1;y>=0;y--)p=x.from(o[y].create(null,p));p=x.from(i.copy(p));let m=t.tr.step(new Se(e.pos-1,f,e.pos,f,new A(p,1,0),o.length,!0)),g=m.doc.resolve(f+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Jt(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&a?null:_.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),h=d&&Bn(d);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(d,h).scrollIntoView()),!0;if(c&&Rn(s,"start",!0)&&Rn(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;
vendor: 4,592 bytes, line 14
14if(f.canReplace(f.childCount,f.childCount,m.content)){if(n){let y=x.empty;for(let v=p.length-1;v>=0;v--)y=x.from(p[v].copy(y));let w=t.tr.step(new Se(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new A(y,p.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function qu(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(H.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const pm=qu(-1),mm=qu(1);function gm(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),l=o&&zo(o,t,e);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function ua(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[s];n.doc.nodesBetween(o,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 s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[o];s.setBlockType(l,a,t,e)}r(s.scrollIntoView())}return!0}}function jo(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}jo($o,Bu,$u);jo($o,Fu,Vu);jo(ju,Uu,Wu,dm);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function ym(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let l=r?n.tr:null;return bm(l,o,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function bm(t,e,n,r=null){let i=!1,s=e,o=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=o.resolve(e.start-2);s=new ti(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new ti(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=zo(s,n,r,e);return l?(t&&wm(t,e,l,i,n),!0):!1}function wm(t,e,n,r,i){let s=x.empty;for(let u=n.length-1;u>=0;u--)s=x.from(n[u].type.create(n[u].attrs,s));t.step(new Se(e.start-(r?2:0),e.end,e.start,e.end,new A(s,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==i&&(o=u+1);let l=n.length-o,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,h=!0;u<d;u++,h=!1)!h&&St(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function km(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?xm(e,n,t,s):Sm(e,n,s):!0:!1}}function xm(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Se(s-1,o,s,o,new A(x.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ti(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const l=Bn(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(s,-1)-1);return Jt(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}function Sm(t,e,n){let r=t.tr,i=n.parent;for(let f=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(l?0:1),u+1,o.content.append(a?x.empty:x.from(i))))return!1;let d=s.pos,h=d+o.nodeSize;return r.step(new Se(d-(l?1:0),h+(a?1:0),d+1,h-1,new A((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 vm(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-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 A(x.from(t.create(null,x.from(l.type.create(null,u)))),c?3:1,0),h=s.start,f=s.end;n(e.tr.step(new Se(h-(c?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}const Ee=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Dn=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Zs=null;const wt=function(t,e,n){let r=Zs||(Zs=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Cm=function(){Zs=null},fn=function(t,e,n,r){return n&&(da(t,e,n,r,-1)||da(t,e,n,r,1))},Mm=/^(img|br|input|textarea|hr)$/i;function da(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;
vendor: 10,986 bytes, line 14
14if(e==(i<0?0:Je(t))){let o=t.parentNode;if(!o||o.nodeType!=1||mr(t)||Mm.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ee(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Je(t):0}else return!1}}function Je(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Em(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=Je(t)}else if(t.parentNode&&!mr(t))e=Ee(t),t=t.parentNode;else return null}}function Tm(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&&!mr(t))e=Ee(t)+1,t=t.parentNode;else return null}}function Am(t,e,n){for(let r=e==0,i=e==Je(t);r||i;){if(t==n)return!0;let s=Ee(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Je(t)}}function mr(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 Ki=function(t){return t.focusNode&&fn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function tn(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Om(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Nm(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Je(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Je(r.startContainer),r.startOffset)}}}const ct=typeof navigator<"u"?navigator:null,ha=typeof document<"u"?document:null,Gt=ct&&ct.userAgent||"",eo=/Edge\/(\d+)/.exec(Gt),Ju=/MSIE \d/.exec(Gt),to=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Gt),_e=!!(Ju||to||eo),Vt=Ju?document.documentMode:to?+to[1]:eo?+eo[1]:0,Ge=!_e&&/gecko\/(\d+)/i.test(Gt);Ge&&+(/Firefox\/(\d+)/.exec(Gt)||[0,0])[1];const no=!_e&&/Chrome\/(\d+)/.exec(Gt),Ae=!!no,Gu=no?+no[1]:0,Ie=!_e&&!!ct&&/Apple Computer/.test(ct.vendor),In=Ie&&(/Mobile\/\w+/.test(Gt)||!!ct&&ct.maxTouchPoints>2),qe=In||(ct?/Mac/.test(ct.platform):!1),Yu=ct?/Win/.test(ct.platform):!1,kt=/Android \d/.test(Gt),gr=!!ha&&"webkitFontSmoothing"in ha.documentElement.style,Rm=gr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Dm(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 pt(t,e){return typeof t=="number"?t:t[e]}function Im(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 fa(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Dn(o);continue}let l=o,a=l==s.body,c=a?Dm(s):Im(l),u=0,d=0;if(e.top<c.top+pt(r,"top")?d=-(c.top-e.top+pt(i,"top")):e.bottom>c.bottom-pt(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+pt(i,"top")-c.top:e.bottom-c.bottom+pt(i,"bottom")),e.left<c.left+pt(r,"left")?u=-(c.left-e.left+pt(i,"left")):e.right>c.right-pt(r,"right")&&(u=e.right-c.right+pt(i,"right")),u||d)if(a)s.defaultView.scrollBy(u,d);else{let f=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let m=l.scrollLeft-f,g=l.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let h=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:Dn(o)}}function Lm(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=t.root.elementFromPoint(s,o);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:Xu(t.dom)}}function Xu(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Dn(r));return e}function Pm({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Qu(n,r==0?0:r-e)}function Qu(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Sn=null;function zm(t){if(t.setActive)return t.setActive();if(Sn)return t.focus(Sn);let e=Xu(t);t.focus(Sn==null?{get preventScroll(){return Sn={preventScroll:!0},!0}}:void 0),Sn||(Sn=!1,Qu(e,0))}function Zu(t,e){let n,r=2e8,i,s=0,o=e.top,l=e.top,a,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=wt(u).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=u,r=m,i=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(s=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)&&(s=d+1)}}return!n&&a&&(n=a,i=c,r=0),n&&n.nodeType==3?Bm(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:Zu(n,i)}function Bm(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=Rt(r,1);if(o.top!=o.bottom&&Uo(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function Uo(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Hm(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function $m(t,e,n){let{node:r,offset:i}=Zu(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function _m(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&a.left>r.left||a.top>r.top?i=l.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),o=!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;s=l.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function ed(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)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Uo(e,c))return ed(o,e,c)}}if((s=(s+1)%r)==i)break}return t}function Fm(t,e){let n=t.dom.ownerDocument,r,i=0,s=Nm(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!Uo(e,c)||(o=ed(t.dom,e,c),!o))return null}if(Ie)for(let c=o;r&&c;c=Dn(c))c.draggable&&(r=void 0);if(o=Hm(o,e),r){if(Ge&&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;gr&&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=_m(t,r,i,e))}l==null&&(l=$m(t,o,e));let a=t.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function pa(t){return t.top<t.bottom||t.left<t.right}function Rt(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(pa(r))return r}return Array.prototype.find.call(n,pa)||t.getBoundingClientRect()}const Vm=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function td(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=gr||Ge;if(r.nodeType==3)if(o&&(Vm.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let a=Rt(wt(r,i,i),n);if(Ge&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Rt(wt(r,i-1,i-1),-1);if(c.top==a.top){let u=Rt(wt(r,i,i+1),-1);if(u.top!=a.top)return $n(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++,$n(Rt(wt(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Je(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return xs(a.getBoundingClientRect(),!1)}if(s==null&&i<Je(r)){let a=r.childNodes[i];if(a.nodeType==1)return xs(a.getBoundingClientRect(),!0)}return xs(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Je(r))){let a=r.childNodes[i-1],c=a.nodeType==3?wt(a,Je(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return $n(Rt(c,1),!1)}if(s==null&&i<Je(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?wt(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return $n(Rt(c,-1),!0)}return $n(Rt(r.nodeType==3?wt(r):r,-n),n>=0)}function $n(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 xs(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 nd(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 jm(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return nd(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=td(t,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=wt(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"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const Um=/[\u0590-\u08ac]/;function Wm(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=t.domSelection();return l?!Um.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:o:nd(t,e,()=>
vendor: 5,956 bytes, lines 14-15
14{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return h!=null&&(l.caretBidiLevel=h),g}):r.pos==r.start()||r.pos==r.end()}let ma=null,ga=null,ya=!1;function Km(t,e,n){return ma==e&&ga==n?ya:(ma=e,ga=n,ya=n=="up"||n=="down"?jm(t,e,n):Wm(t,e,n))}const Ye=0,ba=1,nn=2,ut=3;class yr{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Ye,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let 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 s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Ee(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 s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.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 s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let l=i.children[o];if(l.size){i=l;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.size;if(l>e||o instanceof id){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof rd&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Ee(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Ee(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,l=0;;l++){let a=this.children[l],c=o+a.size;if(i==-1&&e<=c){let u=o+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=o;for(let d=l;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Ee(h.dom)+1;break}e-=h.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)){s=Ee(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],g=p+m.size;if(s>p&&o<g)return m.setSelection(e-p-m.border,n-p-m.border,r,i);p=g}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((Ge||Ie)&&e==n){let{node:f,offset:p}=l;if(f.nodeType==3){if(d=!!(p&&f.nodeValue[p-1]==`
15`),d&&p==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:Ee(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=f.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Ge&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let f=u.focu
vendor: 4,255 bytes, line 15
15sNode.childNodes[u.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||d&&Ie)&&fn(l.node,l.offset,u.anchorNode,u.anchorOffset)&&fn(a.node,a.offset,u.focusNode,u.focusOffset))return;let h=!1;if((c.extend||e==n)&&!(d&&Ge)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),h=!0}catch{}}if(!h){if(e>n){let p=l;l=a,a=p}let f=document.createRange();f.setEnd(a.node,a.offset),f.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(f)}}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 s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let l=r+s.border,a=o-s.border;if(e>=l&&n<=a){this.dirty=e==r||n==o?nn:ba,e==l&&n==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=ut:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?nn:ut}r=o}this.dirty=nn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?nn:ba;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class rd extends yr{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Ye&&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 qm extends yr{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 pn extends yr{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=bn.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new pn(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&ut||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ut&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ye){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ye}}slice(e,n,r){let i=pn.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=io(s,n,o,r)),e>0&&(s=io(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class jt extends yr{constructor(e,n,r,i,s,o,l,a,c){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,n,r,i,s,o){let l=s.nodeViews[n.type.name],a,c=l&&l(n,s,()=>{if(!a)return o;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}=bn.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 h=u;return u=ld(u,r,n),c?a=new Jm(e,n,r,i,u,d||null,h,c,s,o+1):n.isText?new qi(e,n,r,i,u,h,s):new jt(e,n,r,i,u,d||null,h,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;
vendor: 4,426 bytes, line 15
15let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>x.empty)}return e}matchesNode(e,n,r){return this.dirty==Ye&&e.eq(this.node)&&ri(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,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new Ym(this,o&&o.node,e);Zm(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?te.none:this.node.child(u).marks,r,e,u),a.placeWidget(c,e,i)},(c,u,d,h)=>{a.syncToMarks(c.marks,r,e,h);let f;a.findNodeMatch(c,u,d,h)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(f=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(c,u,d,f,e)||a.updateNextNode(c,u,d,e,h,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==nn)&&(o&&this.protectLocalComposition(e,o),sd(this.contentDOM,this.children,e),In&&eg(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof H)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=tg(this.node.content,o,r-n,i-n);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new qm(this,s,n,i);e.input.compositionNodes.push(o),this.children=io(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==ut||!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=Ye}updateOuterDeco(e){if(ri(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=od(this.dom,this.nodeDOM,ro(this.outerDeco,this.node,n),ro(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 wa(t,e,n,r,i){ld(r,e,t);let s=new jt(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class qi extends jt{constructor(e,n,r,i,s,o,l){super(e,n,r,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==ut||this.dirty!=Ye&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ye||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=Ye,!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),s=document.createTextNode(i.text);return new qi(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ut)}get domAtom(){return!1}isText(e){return this.node.text==e}}
vendor: 4,144 bytes, line 15
15class id extends yr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ye&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Jm extends jt{constructor(e,n,r,i,s,o,l,a,c,u){super(e,n,r,i,s,o,l,c,u),this.spec=a}update(e,n,r,i){if(this.dirty==ut)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}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 sd(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=ka(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(l,r);if(o instanceof pn){let a=r?r.previousSibling:t.lastChild;sd(o.contentDOM,o.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=ka(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Gn=function(t){t&&(this.nodeName=t)};Gn.prototype=Object.create(null);const rn=[new Gn];function ro(t,e,n){if(t.length==0)return rn;let r=n?rn[0]:new Gn,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new Gn(o.nodeName));for(let l in o){let a=o[l];a!=null&&(n&&i.length==1&&i.push(r=new Gn(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 od(t,e,n,r){if(n==rn&&r==rn)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],l=n[s];if(s){let a;l&&l.nodeName==o.nodeName&&i!=t&&(a=i.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=rn[0]),i=a}Gm(i,l||rn[0],o)}return i}function Gm(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 s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);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 ld(t,e,n){return od(t,t,rn,ro(e,n,t.nodeType!=1))}function ri(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 ka(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Ym{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Xm(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 s=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;s<l&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=Ye,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<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[o])&&!this.isLocked(d.dom)){a=u;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];
vendor: 13,950 bytes, line 15
15else{let u=pn.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==ut&&o.dom==o.contentDOM&&(o.dirty=nn),o.update(e,n,r,s)?(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,s,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof jt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=s)return!1;let u=a.dom,d,h=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=ut&&ri(n,a.outerDeco));if(!h&&a.update(e,n,r,i))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(a,e,n,r,i,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=nn,d.updateChildren(i,o+1),d.dirty=Ye),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!ri(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=jt.create(this.top,n,r,i,s,o);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,s){let o=jt.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),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 s=new rd(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof pn;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof qi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ie||Ae)&&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 id(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 Xm(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof pn)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,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function Qm(t,e){return t.type.side-e.type.side}function Zm(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,i,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,l=[],a=null;for(let c=0;;){let u,d;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(u?(d||(d=[u])).push(g):u=g)}if(u)if(d){d.sort(Qm);for(let g=0;g<d.length;g++)n(d[g],c,!!a)}else n(u,c,!!a);let h,f;if(a)f=-1,h=a,a=null;else if(c<t.childCount)f=c,h=t.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=s&&l.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let p=s+h.nodeSize;if(h.isText){let g=p;o<i.length&&i[o].from<g&&(g=i[o].from);for(let y=0;y<l.length;y++)l[y].to<g&&(g=l[y].to);g<p&&(a=h.cut(g-s),h=h.cut(0,g-s),p=g,f=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=h.isInline&&!h.isLeaf?l.filter(g=>!g.inline):l.slice();r(h,m,e.forChild(s,h),f),s=p}}function eg(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 tg(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;i<t.childCount;){let c=t.child(i++);if(s+=c.nodeSize,!c.isText)break;a+=c.text}if(s>=n){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function io(t,e,n,r,i){let s=[];for(let o=0,l=0;o<t.length;o++){let a=t[o],c=l,u=l+=a.size;c>=n||u<=e?s.push(a):(c<e&&s.push(a.slice(0,e-c,r)),i&&(s.push(i),i=void 0),u>n&&s.push(a.slice(n-c,a.size,r)))}return s}function Wo(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(Ki(n)){for(a=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&L.isSelectable(d)&&i.parent&&!(d.isInline&&Am(n.focusNode,n.focusOffset,i.dom))){let h=i.posBefore;c=new L(o==h?l:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,h=o;for(let f=0;f<n.rangeCount;f++){let p=n.getRangeAt(f);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,o]=h==t.state.selection.anchor?[h,d]:[d,h],l=r.resolve(o)}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&&!s?1:-1;c=Ko(t,u,l,d)}return c}function ad(t){return t.editable?t.hasFocus():ud(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function vt(t,e=!1){let n=t.state.selection;if(cd(t,n),!!ad(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ae){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&fn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)rg(t);else{let{anchor:r,head:i}=n,s,o;xa&&!(n instanceof H)&&(n.$from.parent.inlineContent||(s=Sa(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Sa(t,n.to))),t.docView.setSelection(r,i,t,e),xa&&(s&&va(s),o&&va(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&ng(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const xa=Ie||Ae&&Gu<63;function Sa(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Ie&&i&&i.contentEditable=="false")return Ss(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Ss(i);if(s)return Ss(s)}}function Ss(t){return t.contentEditable="true",Ie&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function va(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function ng(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(()=>{(!ad(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function rg(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Ee(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&_e&&Vt<=11&&(n.disabled=!0,n.disabled=!1)}function cd(t,e){if(e instanceof L){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Ca(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Ca(t)}function Ca(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Ko(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||H.between(e,n,r)}function Ma(t){return t.editable&&!t.hasFocus()?!1:ud(t)}function ud(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 ig(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return fn(e.node,e.offset,n.anchorNode,n.anchorOffset)}function so(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&_.findFrom(s,e)}function Dt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Ea(t,e,n){let r=t.state.selection;if(r instanceof H)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Dt(t,new H(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=so(t.state,e);return i&&i instanceof L?Dt(t,i):!1}else if(!(qe&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?L.isSelectable(s)?Dt(t,new L(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):gr?Dt(t,new H(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof L&&r.node.isInline)return Dt(t,new H(e>0?r.$to:r.$from));{let i=so(t.state,e);return i?Dt(t,i):!1}}}function ii(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Yn(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function vn(t,e){return e<0?sg(t):og(t)}function sg(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Ge&&n.nodeType==1&&r<ii(n)&&Yn(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Yn(l,-1))i=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(dd(n))break;{let l=n.previousSibling;for(;l&&Yn(l,-1);)i=n.parentNode,s=Ee(l),l=l.previousSibling;if(l)n=l,r=ii(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?oo(t,n,r):i&&oo(t,i,s)}function og(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=ii(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let l=n.childNodes[r];if(Yn(l,1))s=n,o=++r;else break}else{if(dd(n))break;{let l=n.nextSibling;for(;l&&Yn(l,1);)s=l.parentNode,o=Ee(l)+1,l=l.nextSibling;if(l)n=l,r=0,i=ii(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&oo(t,s,o)}function dd(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function lg(t,e){for(;t&&e==t.childNodes.length&&!mr(t);)e=Ee(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 ag(t,e){for(;t&&!e&&!mr(t);)e=Ee(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 oo(t,e,n){if(e.nodeType!=3){let s,o;(o=lg(e,n))?(e=o,n=0):(s=ag(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Ki(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&vt(t)},50)}function Ta(t,e){let n=t.state.doc.resolve(e);if(!(Ae||Yu)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Aa(t,e,n){let r=t.state.selection;if(r instanceof H&&!r.empty||n.indexOf("s")>-1||qe&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=so(t.state,e);if(o&&o instanceof L)return Dt(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof Ue?_.near(o,e):_.findFrom(o,e);return l?Dt(t,l):!1}return!1}function Oa(t,e){if(!(t.state.selection instanceof H))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 s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function Na(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function cg(t){if(!Ie||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;Na(t,r,"true"),setTimeout(()=>Na(t,r,"false"),20)}return!1}function ug(t){let e="";
vendor: 4,149 bytes, lines 15-18
15return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function dg(t,e){let n=e.keyCode,r=ug(e);if(n==8||qe&&n==72&&r=="c")return Oa(t,-1)||vn(t,-1);if(n==46&&!e.shiftKey||qe&&n==68&&r=="c")return Oa(t,1)||vn(t,1);if(n==13||n==27)return!0;if(n==37||qe&&n==66&&r=="c"){let i=n==37?Ta(t,t.state.selection.from)=="ltr"?-1:1:-1;return Ea(t,i,r)||vn(t,i)}else if(n==39||qe&&n==70&&r=="c"){let i=n==39?Ta(t,t.state.selection.from)=="ltr"?1:-1:1;return Ea(t,i,r)||vn(t,i)}else{if(n==38||qe&&n==80&&r=="c")return Aa(t,-1,r)||vn(t,-1);if(n==40||qe&&n==78&&r=="c")return cg(t)||Aa(t,1,r)||vn(t,1);if(r==(qe?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function qo(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=t.someProp("clipboardSerializer")||bn.fromSchema(t.state.schema),l=yd(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=gd[c.nodeName.toLowerCase()]);){for(let f=u.length-1;f>=0;f--){let p=l.createElement(u[f]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
16
17`);return{dom:a,text:h,slice:e}}function hd(t,e,n,r,i){let s=i.parent.type.spec.code,o,l;if(!n&&!e)return null;let a=!!e&&(r||s||!n);if(a){if(t.someProp("transformPastedText",h=>{e=h(e,s||r,t)}),s)return l=new A(x.from(t.state.schema.text(e.replace(/\r\n?/g,`
18`))),0,0),t.someProp("transformPasted",h=>{l=h(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(d)l=d;else{let h=i.marks(),{schema:f}=t.state,p=bn.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=mg(n),gr&&gg(o);let c=o&&o.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 h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Ft.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!hg.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)l=yg(Ra(l,+u[1],+u[2]),u[4]);else if(l=A.maxOpen(fg(l.content,i),!0),l.openStart||l.openEnd){let d=0,h=0;for(let f=l.content.firstChild;d<l.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=l.content.lastChild;h<l.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);l=Ra(l,d,h)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const hg=/^(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 fg(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)),s,o=[];if(t.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&pd(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=md(o[o.length-1],s.length));let u=fd(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return x.from(o)}return t}function fd(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,x.from(t));return t}function pd(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=pd(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(x.from(fd(n,t,i+1))))}}function md(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,md(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(x.empty,!0);return t.copy(n.append(r))}
vendor: 4,199 bytes, line 18
18function lo(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(s=0),i<r-1&&(l=lo(l,e,n,r,i+1,s)),i>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(x.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function Ra(t,e,n){return e<t.openStart&&(t=new A(lo(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new A(lo(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const gd={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Da=null;function yd(){return Da||(Da=document.implementation.createHTMLDocument("title"))}let vs=null;function pg(t){let e=window.trustedTypes;return e?(vs||(vs=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),vs.createHTML(t)):t}function mg(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=yd().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&gd[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=pg(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function gg(t){let e=t.querySelectorAll(Ae?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function yg(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:s,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=x.from(a.create(r[l+1],i)),s++,o++}return new A(i,s,o)}const ze={},Be={},bg={touchstart:!0,touchmove:!0};class wg{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 kg(t){for(let e in ze){let n=ze[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Sg(t,r)&&!Jo(t,r)&&(t.editable||!(r.type in Be))&&n(t,r)},bg[e]?{passive:!0}:void 0)}Ie&&t.dom.addEventListener("input",()=>null),ao(t)}function _t(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function xg(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function ao(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Jo(t,r))})}function Jo(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Sg(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 vg(t,e){!Jo(t,e)&&ze[e.type]&&(t.editable||!(e.type in Be))&&ze[e.type](t,e)}Be.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!wd(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(kt&&Ae&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),In&&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,tn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||dg(t,n)?n.preventDefault():_t(t,"key")};Be.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};
vendor: 7,303 bytes, line 18
18Be.keypress=(t,e)=>{let n=e;if(wd(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||qe&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof H)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Ji(t){return{left:t.clientX,top:t.clientY}}function Cg(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Go(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,l=>o>s.depth?l(t,n,s.nodeAfter,s.before(o),i,!0):l(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function On(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 Mg(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&L.isSelectable(r)?(On(t,new L(n)),!0):!1}function Eg(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof L&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(L.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(On(t,L.create(t.state.doc,i)),!0):!1}function Tg(t,e,n,r,i){return Go(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?Eg(t,n):Mg(t,n))}function Ag(t,e,n,r){return Go(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Og(t,e,n,r){return Go(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Ng(t,n,r)}function Ng(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(On(t,H.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)On(t,H.create(r,l+1,l+1+o.content.size));else if(L.isSelectable(o))On(t,L.create(r,l));else continue;return!0}}function Yo(t){return si(t)}const bd=qe?"metaKey":"ctrlKey";ze.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Yo(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&Cg(n,t.input.lastClick)&&!n[bd]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(Ji(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Rg(t,o,n,!!r)):(s=="doubleClick"?Ag:Og)(t,o.pos,o.inside,n)?n.preventDefault():_t(t,"pointer"))};class Rg{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[bd],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,o=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&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof L&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ge&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),_t(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>vt(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ji(e))),this.updateAllowDefault(e),this.allowDefault||!n?_t(this.view,"pointer"):Tg(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ie&&this.mightDrag&&!this.mightDrag.node.isAtom||Ae&&!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)?(On(this.view,_.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):_t(this.view,"pointer")}move(e){this.updateAllowDefault(e),_t(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}ze.touchstart=t=>{t.input.lastTouch=Date.now(),Yo(t),_t(t,"pointer")};ze.touchmove=t=>{t.input.lastTouch=Date.now(),_t(t,"pointer")};ze.contextmenu=t=>Yo(t);function wd(t,e){return t.composing?!0:Ie&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Dg=kt?5e3:-1;Be.compositionstart=Be.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof H&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ae&&Yu&&Ig(t)))t.markCursor=t.state.storedMarks||n.marks(),si(t,!0),t.markCursor=null;else if(si(t,!e.selection.empty),Ge&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}kd(t,Dg)};function Ig(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"}Be.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.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(()=>si(t),e))}function xd(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Pg());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Lg(t){let e=t.domSelectionRange();if(!e.focusNode)return null;
vendor: 13,075 bytes, line 18
18let n=Em(e.focusNode,e.focusOffset),r=Tm(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Pg(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function si(t,e=!1){if(!(kt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),xd(t),e||t.docView&&t.docView.dirty){let n=Wo(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 zg(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 lr=_e&&Vt<15||In&&Rm<604;ze.copy=Be.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=lr?null:n.clipboardData,o=r.content(),{dom:l,text:a}=qo(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):zg(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Bg(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Hg(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?ar(t,r.value,null,i,e):ar(t,r.textContent,r.innerHTML,i,e)},50)}function ar(t,e,n,r,i){let s=hd(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,s||A.empty)))return!0;if(!s)return!1;let o=Bg(s),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Sd(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," "):""}Be.paste=(t,e)=>{let n=e;if(t.composing&&!kt)return;let r=lr?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ar(t,Sd(r),r.getData("text/html"),i,n)?n.preventDefault():Hg(t,n)};class vd{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const $g=qe?"altKey":"ctrlKey";function Cd(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[$g]}ze.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Ji(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof L?i.to-1:i.to))){if(r&&r.mightDrag)o=L.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&&(o=L.create(t.state.doc,d.posBefore))}}let l=(o||t.state.selection).content(),{dom:a,text:c,slice:u}=qo(t,l);(!n.dataTransfer.files.length||!Ae||Gu>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(lr?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",lr||n.dataTransfer.setData("text/plain",c),t.dragging=new vd(u,Cd(t,n),o)};ze.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Be.dragover=Be.dragenter=(t,e)=>e.preventDefault();Be.drop=(t,e)=>{try{_g(t,e,t.dragging)}finally{t.dragging=null}};function _g(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Ji(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",f=>{s=f(s,t,!1)}):s=hd(t,Sd(e.dataTransfer),lr?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&Cd(t,e));if(t.someProp("handleDrop",f=>f(t,e,s||A.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?Au(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let a=t.state.tr;if(o){let{node:f}=n;f?f.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,s.content.firstChild):a.replaceRange(c,c,s),a.doc.eq(d))return;let h=a.doc.resolve(c);if(u&&L.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))a.setSelection(new L(h));else{let f=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,m,g,y)=>f=y),a.setSelection(Ko(t,h,a.doc.resolve(f)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}ze.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())&&vt(t)},20))};ze.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)};ze.beforeinput=(t,e)=>{if(Ae&&kt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,tn(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 Be)ze[t]=Be[t];function cr(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 oi{constructor(e,n){this.toDOM=e,this.spec=n||an,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new ye(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof oi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&cr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ut{constructor(e,n){this.attrs=e,this.spec=n||an}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new ye(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Ut&&cr(this.attrs,e.attrs)&&cr(this.spec,e.spec)}static is(e){return e.type instanceof Ut}destroy(){}}class Xo{constructor(e,n){this.attrs=e,this.spec=n||an}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new ye(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof Xo&&cr(this.attrs,e.attrs)&&cr(this.spec,e.spec)}destroy(){}}class ye{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new ye(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 ye(e,e,new oi(n,r))}static inline(e,n,r,i){return new ye(e,n,new Ut(r,i))}static node(e,n,r,i){return new ye(e,n,new Xo(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ut}get widget(){return this.type instanceof oi}}const Mn=[],an={};class ee{constructor(e,n){this.local=e.length?e:Mn,this.children=n.length?n:Mn}static create(e,n){return n.length?li(n,e,0,an):De}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,i+l,s)}}map(e,n,r){return this==De||e.maps.length==0?this:this.mapInner(e,n,0,0,r||an)}mapInner(e,n,r,i,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(n,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?Fg(this.children,o||[],e,n,r,i,s):o?new ee(o.sort(cn),Mn):De}add(e,n){return n.length?this==De?ee.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Ed(n,l,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,u,c+1):i.splice(s,0,a,a+l.nodeSize,li(u,l,c+1,an)),s+=3}});let o=Md(s?Td(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new ee(o.length?this.local.concat(o).sort(cn):this.local,i||this.children)}remove(e){return e.length==0||this==De?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,l=r[s]+n,a=r[s+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,l+1);c!=De?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,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 ee(i,r):De}forChild(e,n){if(this==De)return this;if(n.isLeaf)return ee.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 s=e+1,o=s+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof Ut){let c=Math.max(s,a.from)-s,u=Math.min(o,a.to)-s;c<u&&(i||(i=[])).push(a.copy(c,u))}}if(i){let l=new ee(i.sort(cn),Mn);return r?new Pt([l,r]):l}return r||De}eq(e){if(this==e)return!0;if(!(e instanceof ee)||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 Qo(this.localsInner(e))}localsInner(e){if(this==De)return Mn;if(e.inlineContent||!this.local.some(Ut.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Ut||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ee.empty=new ee([],[]);ee.removeOverlap=Qo;const De=ee.empty;class Pt{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,an));return Pt.from(r)}forChild(e,n){if(n.isLeaf)return ee.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=De&&(s instanceof Pt?r=r.concat(s.members):r.push(s))}return Pt.from(r)}eq(e){if(!(e instanceof Pt)||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 s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?Qo(r?n:n.sort(cn)):Mn}static from(e){switch(e.length){case 0:return De;case 1:return e[0];default:return new Pt(e.every(n=>n instanceof ee)?e:e.reduce((n,r)=>n.concat(r instanceof ee?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Fg(t,e,n,r,i,s,o){let l=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let d=0;n.maps[c].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let y=0;y<l.length;y+=3){let w=l[y+1];if(w<0||h>w+u-d)continue;let v=l[y]+u-d;f>=v?l[y+1]=h<=v?-2:-1:h>=u&&g&&(l[y]+=g,l[y+1]+=g)}d+=g}),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]+s),d=u-i;if(d<0||d>=r.content.size){a=!0;continue}let h=n.map(t[c+1]+s,-1),f=h-i,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==f){let y=l[c+2].mapInner(n,g,u+1,t[c]+s+1,o);y!=De?(l[c]=d,l[c+1]=f,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Vg(l,t,e,n,i,s,o),u=li(c,r,0,o);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,h=0;d<u.children.length;d+=3){let f=u.children[d];for(;h<l.length&&l[h]<f;)h+=3;l.splice(h,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ee(e.sort(cn),l)}function Md(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 ye(i.from+e,i.to+e,i.type))}return n}function Vg(t,e,n,r,i,s,o){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):o.onRemove&&o.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;
vendor: 10,766 bytes, line 18
18a+=3)t[a+1]==-1&&l(t[a+2],e[a]+s+1);return n}function Ed(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function Td(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function li(t,e,n,r){let i=[],s=!1;e.forEach((l,a)=>{let c=Ed(t,l,a+n);if(c){s=!0;let u=li(c,l,n+a+1,r);u!=De&&i.push(a,a+l.nodeSize,u)}});let o=Md(s?Td(t):t,-n).sort(cn);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new ee(o,i):De}function cn(t,e){return t.from-e.from||t.to-e.to}function Qo(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 s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),Ia(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),Ia(e,i,r.copy(s.from,r.to)));break}}}return e}function Ia(t,e,n){for(;e<t.length&&cn(n,t[e])>0;)e++;t.splice(e,0,n)}function Cs(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=De&&e.push(r)}),t.cursorWrapper&&e.push(ee.create(t.state.doc,[t.cursorWrapper.deco])),Pt.from(e)}const jg={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ug=_e&&Vt<=11;class Wg{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 Kg{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Wg,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]);_e&&Vt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Ie&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Ug&&(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,jg)),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(Ma(this.view)){if(this.suppressingSelectionUpdates)return vt(this.view);if(_e&&Vt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&fn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=Dn(s))n.add(s);for(let s=e.anchorNode;s;s=Dn(s))if(n.has(s)){r=s;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)&&Ma(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&u.parentNode.removeChild(u)}}else if(Ge&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,h]=u;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of u){let f=h.parentNode;f&&f.nodeName=="LI"&&(!d||Gg(e,d)!=f)&&h.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ki(r)&&(c=Wo(e))&&c.eq(_.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,vt(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),qg(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Yg(e,a)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||vt(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,s=e.nextSibling;if(_e&&Vt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:h}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?Ee(i)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=s&&s.parentNode==e.target?Ee(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let La=new WeakMap,Pa=!1;function qg(t){if(!La.has(t)&&(La.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ge,Pa)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."),Pa=!0}}function za(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return fn(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function Jg(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return za(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?za(t,n):null}function Gg(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 Yg(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(s,l.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function Xg(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,u=a.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],Ki(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Ae&&t.input.lastKeyCode===8)for(let g=s;g>i;g--){let y=r.childNodes[g-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){s=g;break}if(!w||w.size)break}let d=t.state.doc,h=t.someProp("domParser")||Ft.fromSchema(t.state.schema),f=d.resolve(o),p=null,m=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:s,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Qg,context:f});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+o,head:y+o}}return{doc:m,sel:p,from:o,to:l}}function Qg(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ie&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ie&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Zg=/^(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 ey(t,e,n,r,i){let s=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,$=Wo(t,C);if($&&!t.state.selection.eq($)){if(Ae&&kt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",Oe=>Oe(t,tn(13,"Enter"))))return;let J=t.state.tr.setSelection($);C=="pointer"?J.setMeta("pointer",!0):C=="key"&&J.scrollIntoView(),s&&J.setMeta("composition",s),t.dis
vendor: 4,876 bytes, line 18
18patch(J)}return}let o=t.state.doc.resolve(e),l=o.sharedDepth(n);e=o.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=Xg(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),h,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,f="end"):(h=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let p=ry(d.content,c.doc.content,c.from,h,f);if(p&&t.input.domChangeCount++,(In&&t.input.lastIOSEnter>Date.now()-225||kt)&&i.some(C=>C.nodeType==1&&!Zg.test(C.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",C=>C(t,tn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof H&&!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=Ba(t,t.state.doc,c.sel);if(C&&!C.eq(t.state.selection)){let $=t.state.tr.setSelection(C);s&&$.setMeta("composition",s),t.dispatch($)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof H&&(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)),_e&&Vt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),w=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA;if((In&&t.input.lastIOSEnter>Date.now()-225&&(!w||i.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!w&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"","")))&&t.someProp("handleKeyDown",C=>C(t,tn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&ny(u,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",C=>C(t,tn(8,"Backspace")))){kt&&Ae&&t.domObserver.suppressSelectionUpdates();return}Ae&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),kt&&!w&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(C){return C(t,tn(13,"Enter"))})},20));let v=p.start,T=p.endA,S=C=>{let $=C||t.state.tr.replace(v,T,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let J=Ba(t,$.doc,c.sel);J&&!(Ae&&t.composing&&J.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(J.head==v||J.head==$.mapping.map(T)-1)||_e&&J.empty&&J.head==v)&&$.setSelection(J)}return s&&$.setMeta("composition",s),$.scrollIntoView()},R;if(w)if(m.pos==g.pos){_e&&Vt<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>vt(t),20));let C=S(t.state.tr.delete(v,T)),$=u.resolve(p.start).marksAcross(u.resolve(p.endA));$&&C.ensureMarks($),t.dispatch(C)}else if(p.endA==p.endB&&(R=ty(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let C=S(t.state.tr);R.type=="add"?C.addMark(v,T,R.mark):C.removeMark(v,T,R.mark),t.dispatch(C)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let C=m.parent.textBetween(m.parentOffset,g.parentOffset),$=()=>S(t.state.tr.insertText(C,v,T));t.someProp("handleTextInput",J=>J(t,v,T,C,$))||t.dispatch($())}else t.dispatch(S());else t.dispatch(S())}function Ba(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Ko(t,e.resolve(n.anchor),e.resolve(n.head))}function ty(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,l,a;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],o="add",a=u=>u.mark(l.addToSet(u.marks));else if(i.length==0&&s.length==1)l=s[0],o="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:o}}function ny(t,e,n,r,i){if(n-e<=i.pos-r.pos||Ms(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Ms(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Ms(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Ms(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 s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function ry(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);
vendor: 4,498 bytes, line 18
18if(i=="end"){let a=Math.max(0,s-Math.min(o,l));r-=o+a-s}if(o<s&&t.size<e.size){let a=r<=s&&r>=o?s-r:0;s-=a,s&&s<e.size&&Ha(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-o),o=s}else if(l<s){let a=r<=s&&r>=l?s-r:0;s-=a,s&&s<t.size&&Ha(t.textBetween(s-1,s+1))&&(s+=a?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}function Ha(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Ad{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 wg,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ja),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=Fa(this),_a(this),this.nodeViews=Va(this),this.docView=wa(this.state.doc,$a(this),Cs(this),this.dom,this),this.domObserver=new Kg(this,(r,i,s,o)=>ey(this,r,i,s,o)),this.domObserver.start(),kg(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&&ao(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ja),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,s=!1,o=!1;e.storedMarks&&this.composing&&(xd(this),o=!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 f=Va(this);sy(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&ao(this),this.editable=Fa(this),_a(this);let a=Cs(this),c=$a(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(i.selection))&&(o=!0);let h=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Lm(this);if(o){this.domObserver.stop();let f=d&&(_e||Ae)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&iy(i.selection,e.selection);if(d){let p=Ae?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Lg(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=wa(e.doc,c,a,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&ig(this))?vt(this,f):(cd(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():h&&Pm(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof L){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&fa(this,n.getBoundingClientRect(),e)}else fa(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(this.state.doc.nodeAt(r.from)==r.node)i=r.from;
vendor: 5,549 bytes, line 18
18else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new vd(e.slice,e.move,i<0?void 0:L.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 o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(i=n?n(l):l))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(i=n?n(l):l))return i}}hasFocus(){if(_e){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&&zm(this.dom),vt(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 Fm(this,e)}coordsAtPos(e,n=1){return td(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 Km(this,n||this.state,e)}pasteHTML(e,n){return ar(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ar(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return qo(this,e)}destroy(){this.docView&&(xg(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Cs(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Cm())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return vg(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ie&&this.root.nodeType===11&&Om(this.dom.ownerDocument)==this.dom&&Jg(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Ad.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function $a(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"),[ye.node(0,t.state.doc.content.size,e)]}function _a(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:ye.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Fa(t){return!t.someProp("editable",e=>e(t.state)===!1)}function iy(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 Va(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 sy(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 ja(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Wt={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:"'"},ai={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},oy=typeof navigator<"u"&&/Mac/.test(navigator.platform),ly=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Te=0;Te<10;Te++)Wt[48+Te]=Wt[96+Te]=String(Te);for(var Te=1;Te<=24;Te++)Wt[Te+111]="F"+Te;for(var Te=65;Te<=90;Te++)Wt[Te]=String.fromCharCode(Te+32),ai[Te]=String.fromCharCode(Te);for(var Es in Wt)ai.hasOwnProperty(Es)||(ai[Es]=Wt[Es]);function ay(t){var e=oy&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||ly&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ai:Wt)[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 cy=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),uy=typeof navigator<"u"&&/Win/.test(navigator.platform);function dy(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let l=0;l<e.length-1;l++){let a=e[l];
vendor: 56,065 bytes, lines 18-61
18if(/^(cmd|meta|m)$/i.test(a))o=!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))s=!0;else if(/^mod$/i.test(a))cy?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function hy(t){let e=Object.create(null);for(let n in t)e[dy(n)]=t[n];return e}function Ts(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 fy(t){return new Z({props:{handleKeyDown:Zo(t)}})}function Zo(t){let e=hy(t);return function(n,r){let i=ay(r),s,o=e[Ts(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[Ts(i,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(uy&&r.ctrlKey&&r.altKey)&&(s=Wt[r.keyCode])&&s!=i){let l=e[Ts(s,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var py=Object.defineProperty,el=(t,e)=>{for(var n in e)py(t,n,{get:e[n],enumerable:!0})};function Gi(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var Yi=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([o,l])=>[o,(...c)=>{const u=l(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o=[],l=!!t,a=t||i.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(a),o.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,h])=>[d,(...p)=>{const m=this.buildProps(a,e),g=h(...p)(m);return o.push(g),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o={tr:t,editor:r,view:s,state:Gi({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)(o)]))}};return o}},Od={};el(Od,{blur:()=>my,clearContent:()=>gy,clearNodes:()=>yy,command:()=>by,createParagraphNear:()=>wy,cut:()=>ky,deleteCurrentNode:()=>xy,deleteNode:()=>Sy,deleteRange:()=>vy,deleteSelection:()=>Cy,enter:()=>My,exitCode:()=>Ey,extendMarkRange:()=>Ty,first:()=>Ay,focus:()=>Ny,forEach:()=>Ry,insertContent:()=>Dy,insertContentAt:()=>Py,joinBackward:()=>Hy,joinDown:()=>By,joinForward:()=>$y,joinItemBackward:()=>_y,joinItemForward:()=>Fy,joinTextblockBackward:()=>Vy,joinTextblockForward:()=>jy,joinUp:()=>zy,keyboardShortcut:()=>Wy,lift:()=>Ky,liftEmptyBlock:()=>qy,liftListItem:()=>Jy,newlineInCode:()=>Gy,resetAttributes:()=>Yy,scrollIntoView:()=>Xy,selectAll:()=>Qy,selectNodeBackward:()=>Zy,selectNodeForward:()=>eb,selectParentNode:()=>tb,selectTextblockEnd:()=>nb,selectTextblockStart:()=>rb,setContent:()=>ib,setMark:()=>Sb,setMeta:()=>vb,setNode:()=>Cb,setNodeSelection:()=>Mb,setTextDirection:()=>Eb,setTextSelection:()=>Tb,sinkListItem:()=>Ab,splitBlock:()=>Ob,splitListItem:()=>Nb,toggleList:()=>Rb,toggleMark:()=>Db,toggleNode:()=>Ib,toggleWrap:()=>Lb,undoInputRule:()=>Pb,unsetAllMarks:()=>zb,unsetMark:()=>Bb,unsetTextDirection:()=>Hb,updateAttributes:()=>$b,wrapIn:()=>_b,wrapInList:()=>Fb});var my=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),gy=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),yy=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),h=c.resolve(u.map(a+l.nodeSize)),f=d.blockRange(h);if(!f)return;const p=Bn(f);if(l.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,m)}(p||p===0)&&e.lift(f,p)})}),!0},by=t=>e=>t(e),wy=()=>({state:t,dispatch:e})=>Uu(t,e),ky=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new H(r.doc.resolve(Math.max(o-1,0)))),!0},xy=()=>({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 s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const l=i.before(s),a=i.after(s);t.delete(l,a).scrollIntoView()}return!0}return!1};function me(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var Sy=t=>({tr:e,state:n,dispatch:r})=>{const i=me(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const a=s.before(o),c=s.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},vy=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},Cy=()=>({state:t,dispatch:e})=>$o(t,e),My=()=>({commands:t})=>t.keyboardShortcut("Enter"),Ey=()=>({state:t,dispatch:e})=>cm(t,e);function tl(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function ci(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:tl(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Nd(t,e,n={}){return t.find(r=>r.type===e&&ci(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function Ua(t,e,n={}){return!!Nd(t,e,n)}function nl(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(n=n||((r=i.node.marks[0])==null?void 0:r.attrs),!Nd([...i.node.marks],e,n)))return;let o=i.index,l=t.start()+i.offset,a=o+1,c=l+i.node.nodeSize;for(;o>0&&Ua([...t.parent.child(o-1).marks],e,n);)o-=1,l-=t.parent.child(o).nodeSize;for(;a<t.parent.childCount&&Ua([...t.parent.child(a).marks],e,n);)c+=t.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function Mt(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var Ty=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=Mt(t,r.schema),{doc:o,selection:l}=n,{$from:a,from:c,to:u}=l;if(i){const d=nl(a,s,e);if(d&&d.from<=c&&d.to>=u){const h=H.create(o,d.from,d.to);n.setSelection(h)}}return!0},Ay=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 rl(t){return t instanceof H}function xt(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Rd(t,e=null){if(!e)return null;const n=_.atStart(t),r=_.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?H.create(t,xt(0,i,s),xt(t.content.size,i,s)):H.create(t,xt(e,i,s),xt(e,i,s))}function co(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ur(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Oy(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var Ny=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(ur()||co())&&r.dom.focus(),Oy()&&!ur()&&!co()&&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(s&&t===null&&!rl(n.state.selection))return o(),!0;const l=Rd(i.doc,t)||n.state.selection,a=n.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Ry=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),Dy=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Dd=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&&Dd(r)}return t};function Rr(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 Dd(n)}function dr(t,e,n){if(t instanceof et||t instanceof x)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return x.fromArray(t.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),dr("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,l="";const a=new yu({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=>(o=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Ft.fromSchema(a).parseSlice(Rr(t),n.parseOptions):Ft.fromSchema(a).parse(Rr(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=Ft.fromSchema(e);return n.slice?s.parseSlice(Rr(t),n.parseOptions).content:s.parse(Rr(t),n.parseOptions)}return dr("",e,n)}function Iy(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof xe||i instanceof Se))return;const s=t.mapping.maps[r];let o=0;s.forEach((l,a,c,u)=>{o===0&&(o=u)}),t.setSelection(_.near(t.doc.resolve(o),n))}var Ly=t=>!("type"in t),Py=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{dr(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){a(g)}try{l=dr(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(g){return a(g),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,f=!0;if((Ly(l)?l:[l]).forEach(g=>{g.check(),h=h?g.isText&&g.marks.length===0:!1,f=f?g.isBlock:!1}),u===d&&f){const{parent:g}=r.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,d+=1)}let m;if(h){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof x){let g="";e.forEach(y=>{y.text&&(g+=y.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,d)}else{m=l;const g=r.doc.resolve(u),y=g.node(),w=g.parentOffset===0,v=y.isText||y.isTextblock,T=y.content.size>0;w&&v&&T&&(u=Math.max(0,u-1)),r.replaceWith(u,d,m)}n.updateSelection&&Iy(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},zy=()=>({state:t,dispatch:e})=>om(t,e),By=()=>({state:t,dispatch:e})=>lm(t,e),Hy=()=>({state:t,dispatch:e})=>Bu(t,e),$y=()=>({state:t,dispatch:e})=>Fu(t,e),_y=()=>({state:t,dispatch:e,tr:n})=>{try{const r=ji(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Fy=()=>({state:t,dispatch:e,tr:n})=>{try{const r=ji(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Vy=()=>({state:t,dispatch:e})=>im(t,e),jy=()=>({state:t,dispatch:e})=>sm(t,e);function Id(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Uy(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!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))s=!0;else if(/^mod$/i.test(a))ur()||Id()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var Wy=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=Uy(t).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a?.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function Kt(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?me(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,(d,h)=>{if(d.isText)return;const f=Math.max(r,h),p=Math.min(i,h+d.nodeSize);l.push({node:d,from:f,to:p})});const a=i-r,c=l.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>ci(d.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((d,h)=>d+h.to-h.from,0)>=a}var Ky=(t,e={})=>({state:n,dispatch:r})=>{const i=me(t,n.schema);return Kt(n,i,e)?am(n,r):!1},qy=()=>({state:t,dispatch:e})=>Wu(t,e),Jy=t=>({state:e,dispatch:n})=>{const r=me(t,e.schema);return km(r)(e,n)},Gy=()=>({state:t,dispatch:e})=>ju(t,e);function Xi(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Wa(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var Yy=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=Xi(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=me(t,r.schema)),l==="mark"&&(o=Mt(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{s&&s===u.type&&(a=!0,i&&n.setNodeMarkup(d,void 0,Wa(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(h=>{o===h.type&&(a=!0,i&&n.addMark(d,d+u.nodeSize,o.create(Wa(h.attrs,e))))})})}),a},Xy=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Qy=()=>({tr:t,dispatch:e})=>{if(e){const n=new Ue(t.doc);t.setSelection(n)}return!0},Zy=()=>({state:t,dispatch:e})=>$u(t,e),eb=()=>({state:t,dispatch:e})=>Vu(t,e),tb=()=>({state:t,dispatch:e})=>hm(t,e),nb=()=>({state:t,dispatch:e})=>mm(t,e),rb=()=>({state:t,dispatch:e})=>pm(t,e);function uo(t,e,n={},r={}){return dr(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var ib=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{const{doc:a}=s;if(r.preserveWhitespace!=="full"){const c=uo(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!n),!0}return o&&s.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function Ld(t,e){const n=Mt(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function Pd(t,e){const n=new Bo(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function sb(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function ho(t,e){const n=[];return t.descendants((r,i)=>{e(r)&&n.push({node:r,pos:i})}),n}function ob(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function zd(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 Qi(t){return e=>zd(e.$from,t)}function z(t,e,n){return t.config[e]===void 0&&t.parent?z(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?z(t.parent,e,n):null}):t.config[e]}function il(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=z(e,"addExtensions",n);return r?[e,...il(r())]:e}).flat(10)}function sl(t,e){const n=bn.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function Bd(t){return typeof t=="function"}function G(t,e=void 0,...n){return Bd(t)?e?t.bind(e)(...n):t(...n):t}function lb(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Ln(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Hd(t){const e=[],{nodeExtensions:n,markExtensions:r}=Ln(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage,extensions:i},a=z(o,"addGlobalAttributes",l);if(!a)return;a().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([h,f])=>{e.push({type:d,name:h,attribute:{...s,...f}})})})})}),i.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},a=z(o,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([u,d])=>{const h={...s,...d};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:o.name,name:u,attribute:h})})}),e}function X(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const l=s?String(s).split(" "):[],a=r[i]?r[i].split(" "):[],c=l.filter(u=>!a.includes(u));r[i]=[...a,...c].join(" ")}else if(i==="style"){const l=s?s.split(";").map(u=>u.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;a.forEach(u=>{const[d,h]=u.split(":").map(f=>f.trim());c.set(d,h)}),l.forEach(u=>{const[d,h]=u.split(":").map(f=>f.trim());c.set(d,h)}),r[i]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[i]=s}),r},{})}function Pn(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)=>X(n,r),{})}function ab(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Ka(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((s,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):ab(n.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...i}}}}function qa(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&lb(n)?!1:n!=null))}function Ja(t){var e,n;const r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function cb(t,e){var n;const r=Hd(t),{nodeExtensions:i,markExtensions:s}=Ln(t),o=(n=i.find(c=>z(c,"topNode")))==null?void 0:n.name,l=Object.fromEntries(i.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((y,w)=>{const v=z(w,"extendNodeSchema",d);return{...y,...v?v(c):{}}},{}),f=qa({...h,content:G(z(c,"content",d)),marks:G(z(c,"marks",d)),group:G(z(c,"group",d)),inline:G(z(c,"inline",d)),atom:G(z(c,"atom",d)),selectable:G(z(c,"selectable",d)),draggable:G(z(c,"draggable",d)),code:G(z(c,"code",d)),whitespace:G(z(c,"whitespace",d)),linebreakReplacement:G(z(c,"linebreakReplacement",d)),defining:G(z(c,"defining",d)),isolating:G(z(c,"isolating",d)),attrs:Object.fromEntries(u.map(Ja))}),p=G(z(c,"parseHTML",d));p&&(f.parseDOM=p.map(y=>Ka(y,u)));const m=z(c,"renderHTML",d);m&&(f.toDOM=y=>m({node:y,HTMLAttributes:Pn(y,u)}));const g=z(c,"renderText",d);return g&&(f.toText=g),[c.name,f]})),a=Object.fromEntries(s.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((g,y)=>{const w=z(y,"extendMarkSchema",d);return{...g,...w?w(c):{}}},{}),f=qa({...h,inclusive:G(z(c,"inclusive",d)),excludes:G(z(c,"excludes",d)),group:G(z(c,"group",d)),spanning:G(z(c,"spanning",d)),code:G(z(c,"code",d)),attrs:Object.fromEntries(u.map(Ja))}),p=G(z(c,"parseHTML",d));p&&(f.parseDOM=p.map(g=>Ka(g,u)));const m=z(c,"renderHTML",d);return m&&(f.toDOM=g=>m({mark:g,HTMLAttributes:Pn(g,u)})),[c.name,f]}));return new yu({topNode:o,nodes:l,marks:a})}function ub(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function ui(t){return t.sort((n,r)=>{const i=z(n,"priority")||100,s=z(r,"priority")||100;return i>s?-1:i<s?1:0})}function $d(t){const e=ui(il(t)),n=ub(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 _d(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
19
20`,textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,i,(a,c,u,d)=>{var h;a.isBlock&&c>r&&(l+=s);const f=o?.[a.type.name];if(f)return u&&(l+=f({node:a,pos:c,parent:u,index:d,range:e})),!1;a.isText&&(l+=(h=a?.text)==null?void 0:h.slice(Math.max(r,c)-c,i-c))}),l}function Fd(t,e){const n={from:0,to:t.content.size};return _d(t,n,e)}function ol(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function db(t,e){const n=me(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function Vd(t,e){const n=Xi(typeof e=="string"?e:e.name,t.schema);return n==="node"?db(t,e):n==="mark"?Ld(t,e):{}}function hb(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 fb(t){const e=hb(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function jd(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=n[s];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const c=e.slice(s).map(l,-1),u=e.slice(s).map(a),d=e.invert().map(c,-1),h=e.invert().map(u);r.push({oldRange:{from:d,to:h},newRange:{from:c,to:u}})})}),fb(r)}function ll(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=nl(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var pb=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let s=r,o=null;for(;s>0&&o===null;){const l=i.node(s);l?.type.name===e?o=l:s-=1}return[o,s]};function Dr(t,e){return e.nodes[t]||e.marks[t]||null}function qr(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var mb=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var a,c;const u=((c=(a=i.type.spec).toText)==null?void 0:c.call(a,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-s))}),n};function fo(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?Mt(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>ci(d.attrs,n,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:d,$to:h})=>{const f=d.pos,p=h.pos;t.doc.nodesBetween(f,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const y=Math.max(f,g),w=Math.min(p,g+m.nodeSize),v=w-y;o+=v,l.push(...m.marks.map(T=>({mark:T,from:y,to:w})))})}),o===0)return!1;const a=l.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>ci(d.mark.attrs,n,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),c=l.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,h)=>d+h.to-h.from,0);return(a>0?a+c:a)>=o}function gb(t,e,n={}){if(!e)return Kt(t,null,n)||fo(t,null,n);const r=Xi(e,t.schema);return r==="node"?Kt(t,e,n):r==="mark"?fo(t,e,n):!1}var yb=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const s=Qi(l=>l.type.name===e)(t.selection);if(!s)return!1;const o=t.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},bb=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function Ga(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Ya(t,e){const{nodeExtensions:n}=Ln(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=G(z(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Zi(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(Zi(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function Ud(t){return t instanceof L}var Wd=class Kd{constructor(e){this.position=e}static fromJSON(e){return new Kd(e.position)}toJSON(){return{position:this.position}}};function wb(t,e){const n=e.mapping.mapResult(t.position);return{position:new Wd(n.pos),mapResult:n}}function kb(t){return new Wd(t)}function qd(t,e,n){const i=t.state.doc.content.size,s=xt(e,0,i),o=xt(n,0,i),l=t.coordsAtPos(s),a=t.coordsAtPos(o,-1),c=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),h=Math.max(l.right,a.right),f=h-d,p=u-c,y={top:c,bottom:u,left:d,right:h,width:f,height:p,x:d,y:c};return{...y,toJSON:()=>y}}function xb(t,e,n){var r;const{selection:i}=e;let s=null;if(rl(i)&&(s=i.$cursor),s){const l=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(c=>c.type.excludes(n)))}const{ranges:o}=i;return o.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,h)=>{if(c)return!1;if(u.isInline){const f=!h||h.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=f&&p}return!c}),c})}var Sb=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:l}=s,a=Mt(t,r.schema);if(i)if(o){const c=Ld(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,(h,f)=>{const p=Math.max(f,u),m=Math.min(f+h.nodeSize,d);h.marks.find(y=>y.type===a)?h.marks.forEach(y=>{a===y.type&&n.addMark(p,m,a.create({...y.attrs,...e}))}):n.addMark(p,m,a.create(e))})});return xb(r,n,a)},vb=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Cb=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=me(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>ua(s,{...o,...e})(n)?!0:l.clearNodes()).command(({state:l})=>ua(s,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Mb=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=xt(t,0,r.content.size),s=L.create(r,i);e.setSelection(s)}return!0},Eb=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=s.from,l=s.to),i&&n.doc.nodesBetween(o,l,(a,c)=>{a.isText||n.setNodeMarkup(c,void 0,{...a.attrs,dir:t})}),!0},Tb=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=H.atStart(r).from,l=H.atEnd(r).to,a=xt(i,o,l),c=xt(s,o,l),u=H.create(r,a,c);e.setSelection(u)}return!0},Ab=t=>({state:e,dispatch:n})=>{const r=me(t,e.schema);return vm(r)(e,n)};function Xa(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)}}var Ob=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:a}=s,c=i.extensionManager.attributes,u=qr(c,l.node().type.name,l.node().attrs);if(s instanceof L&&s.node.isBlock)return!l.parentOffset||!St(o,l.pos)?!1:(r&&(t&&Xa(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,h=l.depth===0?void 0:sb(l.node(-1).contentMatchAt(l.indexAfter(-1)));let f=d&&h?[{type:h,attrs:u}]:void 0,p=St(e.doc,e.mapping.map(l.pos),1,f);if(!f&&!p&&St(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:u}]:void 0),r){if(p&&(s instanceof H&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,f),h&&!d&&!l.parentOffset&&l.parent.type!==h)){const m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}t&&Xa(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},Nb=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const l=me(t,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const d=a.node(-1);if(d.type!==l)return!1;const h=s.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let y=x.empty;const w=a.index(-1)?1:a.index(-2)?2:3;for(let $=a.depth-w;$>=a.depth-3;$-=1)y=x.from(a.node($).copy(y));const v=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,T={...qr(h,a.node().type.name,a.node().attrs),...e},S=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(T))||void 0;y=y.append(x.from(l.createAndFill(null,S)||void 0));const R=a.before(a.depth-(w-1));n.replace(R,a.after(-v),new A(y,4-w,0));let C=-1;n.doc.nodesBetween(R,n.doc.content.size,($,J)=>{if(C>-1)return!1;$.isTextblock&&$.content.size===0&&(C=J+1)}),C>-1&&n.setSelection(H.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const f=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...qr(h,d.type.name,d.attrs),...e},m={...qr(h,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,c.pos);const g=f?[{type:l,attrs:p},{type:f,attrs:m}]:[{type:l,attrs:p}];if(!St(n.doc,a.pos,2))return!1;if(i){const{selection:y,storedMarks:w}=r,{splittableMarks:v}=s.extensionManager,T=w||y.$to.parentOffset&&y.$from.marks();if(n.split(a.pos,2,g).scrollIntoView(),!T||!i)return!0;const S=T.filter(R=>v.includes(R.type.name));n.ensureMarks(S)}return!0},As=(t,e)=>{const n=Qi(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&&Jt(t.doc,n.pos)&&t.join(n.pos),!0},Os=(t,e)=>{const n=Qi(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&&Jt(t.doc,r)&&t.join(r),!0},Rb=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:h}=i.extensionManager,f=me(t,o.schema),p=me(e,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:w}=m,v=y.blockRange(w),T=g||m.$to.parentOffset&&m.$from.marks();if(!v)return!1;const S=Qi(R=>Ya(R.type.name,d))(m);if(v.depth>=1&&S&&v.depth-S.depth<=1){if(S.node.type===f)return c.liftListItem(p);if(Ya(S.node.type.name,d)&&f.validContent(S.node.content)&&l)return a().command(()=>(s.setNodeMarkup(S.pos,f),!0)).command(()=>As(s,f)).command(()=>Os(s,f)).run()}return!n||!T||!l?a().command(()=>u().wrapInList(f,r)?!0:c.clearNodes()).wrapInList(f,r).command(()=>As(s,f)).command(()=>Os(s,f)).run():a().command(()=>{const R=u().wrapInList(f,r),C=T.filter($=>h.includes($.type.name));return s.ensureMarks(C),R?!0:c.clearNodes()}).wrapInList(f,r).command(()=>As(s,f)).command(()=>Os(s,f)).run()},Db=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=Mt(t,r.schema);return fo(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},Ib=(t,e,n={})=>({state:r,commands:i})=>{const s=me(t,r.schema),o=me(e,r.schema),l=Kt(r,s,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(o,a):i.setNode(s,{...a,...n})},Lb=(t,e={})=>({state:n,commands:r})=>{const i=me(t,n.schema);return Kt(n,i,e)?r.lift(i):r.wrapIn(i,e)},Pb=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,l=s.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(s.text){const a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},zb=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},Bb=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=n,a=Mt(t,r.schema),{$from:c,empty:u,ranges:d}=l;if(!i)return!0;if(u&&o){let{from:h,to:f}=l;const p=(s=c.marks().find(g=>g.type===a))==null?void 0:s.attrs,m=nl(c,a,p);m&&(h=m.from,f=m.to),n.removeMark(h,f,a)}else d.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,a)});return n.removeStoredMark(a),!0},Hb=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,o;return typeof t=="number"?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(l,a)=>{if(l.isText)return;const c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},$b=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=Xi(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=me(t,r.schema)),l==="mark"&&(o=Mt(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let h,f,p,m;n.selection.empty?r.doc.nodesBetween(u,d,(g,y)=>{s&&s===g.type&&(a=!0,p=Math.max(y,u),m=Math.min(y+g.nodeSize,d),h=y,f=g)}):r.doc.nodesBetween(u,d,(g,y)=>{y<u&&s&&s===g.type&&(a=!0,p=Math.max(y,u),m=Math.min(y+g.nodeSize,d),h=y,f=g),y>=u&&y<=d&&(s&&s===g.type&&(a=!0,i&&n.setNodeMarkup(y,void 0,{...g.attrs,...e})),o&&g.marks.length&&g.marks.forEach(w=>{if(o===w.type&&(a=!0,i)){const v=Math.max(y,u),T=Math.min(y+g.nodeSize,d);n.addMark(v,T,o.create({...w.attrs,...e}))}}))}),f&&(h!==void 0&&i&&n.setNodeMarkup(h,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&i&&n.addMark(p,m,o.create({...g.attrs,...e}))}))}),a},_b=(t,e={})=>({state:n,dispatch:r})=>{const i=me(t,n.schema);return gm(i,e)(n,r)},Fb=(t,e={})=>({state:n,dispatch:r})=>{const i=me(t,n.schema);return ym(i,e)(n,r)},Vb=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},br=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},jb=(t,e)=>{if(tl(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 Ir(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const d=mb(c)+s;return o.forEach(h=>{if(u)return;const f=jb(d,h.find);if(!f)return;const p=a.state.tr,m=Gi({state:a.state,transaction:p}),g={from:r-(f[0].length-s.length),to:i},{commands:y,chain:w,can:v}=new Yi({editor:n,state:m});h.handler({state:m,range:g,match:f,commands:y,chain:w,can:v})===null||!p.steps.length||(h.undoable&&p.setMeta(l,{transform:p,from:r,to:i,text:s}),a.dispatch(p),u=!0)}),u}function Ub(t){const{editor:e,rules:n}=t,r=new Z({state:{init(){return null},apply(i,s,o){const l=i.getMeta(r);if(l)return l;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=sl(x.from(u),o.schema);const{from:d}=a,h=d+u.length;Ir({editor:e,from:d,to:h,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return Ir({editor:e,from:s,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Ir({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Ir({editor:e,from:o.pos,to:o.pos,text:`
21`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Wb(t){return Object.prototype.toString.call(t).slice(8,-1)}function Lr(t){return Wb(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Jd(t,e){const n={...t};return Lr(t)&&Lr(e)&&Object.keys(e).forEach(r=>{Lr(e[r])&&Lr(t[r])?n[r]=Jd(t[r],e[r]):n[r]=e[r]}),n}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{...G(z(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...G(z(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Jd(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},tt=class Gd extends al{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new Gd(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(c=>c?.type.name===n.name))return!1;const a=o.find(c=>c?.type.name===n.name);return a&&r.removeStoredMark(a),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)}};function Kb(t){return typeof t=="number"}var Yd=class{constructor(t){this.find=t.find,this.handler=t.handler}},qb=(t,e,n)=>{if(tl(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function Jb(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=t,{commands:a,chain:c,can:u}=new Yi({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(f,p)=>{var m,g,y,w,v;if((g=(m=f.type)==null?void 0:m.spec)!=null&&g.code||!(f.isText||f.isTextblock||f.isInline))return;const T=(v=(w=(y=f.content)==null?void 0:y.size)!=null?w:f.nodeSize)!=null?v:0,S=Math.max(r,p),R=Math.min(i,p+T);if(S>=R)return;const C=f.isText?f.text||"":f.textBetween(S-p,R-p,void 0,"");qb(C,s.find,o).forEach(J=>{if(J.index===void 0)return;const Oe=S+J.index+1,ht=Oe+J[0].length,rt={from:n.tr.mapping.map(Oe),to:n.tr.mapping.map(ht)},Et=s.handler({state:n,range:rt,match:J,commands:a,chain:c,can:u,pasteEvent:o,dropEvent:l});d.push(Et)})}),d.every(f=>f!==null)}var Pr=null,Gb=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function Yb(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:d,to:h,rule:f,pasteEvt:p})=>{const m=u.tr,g=Gi({state:u,transaction:m});if(!(!Jb({editor:e,state:g,from:Math.max(d-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new Z({view(d){const h=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(Pr=e)},f=()=>{Pr&&(Pr=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(s=r===d.dom.parentElement,l=h,!s){const f=Pr;f?.isEditable&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,h)=>{var f;const p=(f=h.clipboardData)==null?void 0:f.getData("text/html");return o=h,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,h,f)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),w=!!y;if(!m&&!g&&!w)return;if(w){let{text:S}=y;typeof S=="string"?S=S:S=sl(x.from(S),f.schema);const{from:R}=y,C=R+S.length,$=Gb(S);return a({rule:u,state:f,from:R,to:{b:C},pasteEvt:$})}const v=h.doc.content.findDiffStart(f.doc.content),T=h.doc.content.findDiffEnd(f.doc.content);if(!(!Kb(v)||!T||v===T.b))return a({rule:u,state:f,from:v,to:T,pasteEvt:o})}}))}var es=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=$d(t),this.schema=cb(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Dr(e.name,this.schema)},r=z(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return ui([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Dr(r.name,this.schema)},s=[],o=z(r,"addKeyboardShortcuts",i);let l={};if(r.type==="mark"&&z(r,"exitable",i)&&(l.ArrowRight=()=>tt.handleExit({editor:t,mark:r})),o){const h=Object.fromEntries(Object.entries(o()).map(([f,p])=>[f,()=>p({editor:t})]));l={...l,...h}}const a=fy(l);s.push(a);const c=z(r,"addInputRules",i);if(Ga(r,t.options.enableInputRules)&&c){const h=c();if(h&&h.length){const f=Ub({editor:t,rules:h}),p=Array.isArray(f)?f:[f];s.push(...p)}}const u=z(r,"addPasteRules",i);if(Ga(r,t.options.enablePasteRules)&&u){const h=u();if(h&&h.length){const f=Yb({editor:t,rules:h});s.push(...f)}}const d=z(r,"addProseMirrorPlugins",i);if(d){const h=d();s.push(...h)}return s})}get attributes(){return Hd(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Ln(this.extensions);return Object.fromEntries(e.filter(n=>!!z(n,"addNodeView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:me(n.name,this.schema)},s=z(n,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const l=(a,c,u,d,h)=>{const f=Pn(a,r);return o({node:a,view:c,getPos:u,decorations:d,innerDecorations:h,editor:t,extension:n,HTMLAttributes:f})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return ui([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Dr(i.name,this.schema)},o=z(i,"dispatchTransaction",s);return o?l=>{o.call(s,{transaction:l,next:r})}:r},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=Ln(this.extensions);return Object.fromEntries(e.filter(n=>!!z(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Mt(n.name,this.schema)},s=z(n,"addMarkView",i);if(!s)return[];const o=(l,a,c)=>{const u=Pn(l,r);return s()({mark:l,view:a,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{u0(l,t,d)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Dr(e.name,this.schema)};e.type==="mark"&&((n=G(z(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const i=z(e,"onBeforeCreate",r),s=z(e,"onCreate",r),o=z(e,"onUpdate",r),l=z(e,"onSelectionUpdate",r),a=z(e,"onTransaction",r),c=z(e,"onFocus",r),u=z(e,"onBlur",r),d=z(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};es.resolve=$d;es.sort=ui;es.flatten=il;var Xb={};el(Xb,{ClipboardTextSerializer:()=>Qd,Commands:()=>Zd,Delete:()=>eh,Drop:()=>th,Editable:()=>nh,FocusEvents:()=>ih,Keymap:()=>sh,Paste:()=>oh,Tabindex:()=>lh,TextDirection:()=>ah,focusEventsPluginKey:()=>rh});var Y=class Xd extends al{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Xd(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Qd=Y.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Z({key:new oe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),l=Math.max(...s.map(u=>u.$to.pos)),a=ol(n);return _d(r,{from:o,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),Zd=Y.create({name:"commands",addCommands(){return{...Od}}}),eh=Y.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const s=()=>{var o,l,a,c;if((c=(a=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,t))!=null?c:t.getMeta("y-sync$"))return;const u=Pd(t.before,[t,...e]);jd(u).forEach(f=>{u.mapping.mapResult(f.oldRange.from).deletedAfter&&u.mapping.mapResult(f.oldRange.to).deletedBefore&&u.before.nodesBetween(f.oldRange.from,f.oldRange.to,(p,m)=>{const g=m+p.nodeSize-2,y=f.oldRange.from<=m&&g<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:g,newFrom:u.mapping.map(m),newTo:u.mapping.map(g),deletedRange:f.oldRange,newRange:f.newRange,partial:!y,editor:this.editor,transaction:t,combinedTransform:u})})});const h=u.mapping;u.steps.forEach((f,p)=>{var m,g;if(f instanceof Ze){const y=h.slice(p).map(f.from,-1),w=h.slice(p).map(f.to),v=h.invert().map(y,-1),T=h.invert().map(w),S=(m=u.doc.nodeAt(y-1))==null?void 0:m.marks.some(C=>C.eq(f.mark)),R=(g=u.doc.nodeAt(w))==null?void 0:g.marks.some(C=>C.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:v,to:T},newRange:{from:y,to:w},partial:!!(R||S),editor:this.editor,transaction:t,combinedTransform:u})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),th=Y.create({name:"drop",addProseMirrorPlugins(){return[new Z({key:new oe("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),nh=Y.create({name:"editable",addProseMirrorPlugins(){return[new Z({key:new oe("editable"),props:{editable:()=>this.editor.options.editable}})]}}),rh=new oe("focusEvents"),ih=Y.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Z({key:rh,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}}}})]}}),sh=Y.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:h,parent:f}=d,p=d.parent.isTextblock&&h>0?l.doc.resolve(h-1):d,m=p.parent.type.spec.isolating,g=d.pos-d.parentOffset,y=m&&p.parent.childCount===1?g===d.pos:_.atStart(c).from===h;return!u||!f.type.isTextblock||f.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.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},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ur()||Id()?s:i},addProseMirrorPlugins(){return[new Z({key:new oe("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),i=t.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:l}=e.selection,a=_.atStart(e.doc).from,c=_.atEnd(e.doc).to;if(s||!(o===a&&l===c)||!Zi(n.doc))return;const h=n.tr,f=Gi({state:n,transaction:h}),{commands:p}=new Yi({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),oh=Y.create({name:"paste",addProseMirrorPlugins(){return[new Z({key:new oe("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),lh=Y.create({name:"tabindex",addProseMirrorPlugins(){return[new Z({key:new oe("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),ah=Y.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Ln(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 Z({key:new oe("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),Qb=class Wn{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 name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Wn(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 Wn(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 Wn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=n.isInline,l=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!i&&!o&&a.depth<=this.depth)return;const c=new Wn(a,this.editor,i,i||o?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 s=i.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const a=o[l];if(s[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 s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(a=>n[a]===o.node.attrs[a])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.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)}},Zb=`.ProseMirror {
22  position: relative;
23}
24
25.ProseMirror {
26  word-wrap: break-word;
27  white-space: pre-wrap;
28  white-space: break-spaces;
29  -webkit-font-variant-ligatures: none;
30  font-variant-ligatures: none;
31  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
32}
33
34.ProseMirror [contenteditable="false"] {
35  white-space: normal;
36}
37
38.ProseMirror [contenteditable="false"] [contenteditable="true"] {
39  white-space: pre-wrap;
40}
41
42.ProseMirror pre {
43  white-space: pre-wrap;
44}
45
46img.ProseMirror-separator {
47  display: inline !important;
48  border: none !important;
49  margin: 0 !important;
50  width: 0 !important;
51  height: 0 !important;
52}
53
54.ProseMirror-gapcursor {
55  display: none;
56  pointer-events: none;
57  position: absolute;
58  margin: 0;
59}
60
61.ProseMirror-gapcursor:after {
62  content: "";
63  display: block;
64  position: absolute;
65  top: -2px;
66  width: 20px;
67  border-top: 1px solid black;
68  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
69}
70
71@keyframes ProseMirror-cursor-blink {
72  to {
73    visibility: hidden;
74  }
75}
76
77.ProseMirror-hideselection *::selection {
78  background: transparent;
79}
80
81.ProseMirror-hideselection *::-moz-selection {
82  background: transparent;
83}
84
85.ProseMirror-hideselection * {
86  caret-color: transparent;
87}
88
89.ProseMirror-focused .ProseMirror-gapcursor {
90  display: block;
91}`;function e0(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}var t0=class extends Vb{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,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:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:wb,createMappablePosition:kb},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=Rd(e,this.options.autofocus);this.editorState=Tn.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.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){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=e0(Zb,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}
vendor: 8,652 bytes, lines 91-93
91),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=Bd(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 s=typeof i=="string"?`${i}$`:i.key;n=n.filter(o=>!o.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[nh,Qd.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Zd,ih,sh,lh,th,oh,eh,ah.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new es(r,this)}createCommandManager(){this.commandManager=new Yi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=uo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=uo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}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;this.editorView=new Ad(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(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 o=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=o?.getMeta("focus"),a=o?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),a&&this.emit("blur",{editor:this,event:a.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return Vd(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return gb(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return sl(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
92
93`,textSerializers:n={}}=t||{};return Fd(this.state.doc,{blockSeparator:e,textSerializers:{...ol(this.schema),...n}})}get isEmpty(){return Zi(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new Qb(e,this)}get $doc(){return this.$pos(0)}};function mn(t){return new br({find:t.find,handler:({state:e,range:n,match:r})=>{const i=G(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),c=n.from+l.indexOf(o),u=c+o.length;if(ll(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(m=>m===t.type&&m!==f.mark.type)).filter(f=>f.to>c).length)return null;u<n.to&&s.delete(u,n.to),c>n.from&&s.delete(n.from+a,c);const h=n.from+a+o.length;s.addMark(n.from+a,h,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function ch(t){return new br({find:t.find,handler:({state:e,range:n,match:r})=>{const i=G(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let l=n.to;const a=t.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(u,l,a)}else if(r[0]){const c=t.type.isInline?o:o-1;s.insert(c,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()},undoable:t.undoable})}function po(t){return new br({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=G(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,s)},undoable:t.undoable})}function ue(t){return new br({find:t.find,handler:({state:e,range:n,match:r})=>{let i=t.replace,s=n.from;const o=n.to;if(r[1]){const l=r[0].lastIndexOf(r[1]);i+=r[0].slice(l+r[1].length),s+=l;const a=s-o;a>0&&(i=r[0].slice(l-a,l)+i,s=o)}e.tr.insertText(i,s,o)},undoable:t.undoable})}function zn(t){return new br({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=G(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),a=o.doc.resolve(n.from).blockRange(),c=a&&zo(a,t.type,s);if(!c)return null;if(o.wrap(a,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:h}=e,{splittableMarks:f}=t.editor.extensionManager,p=h||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(g=>f.includes(g.type.name));o.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const u=o.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Jt(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&o.join(n.from-1)},undoable:t.undoable})}var n0=t=>"touches"in t,r0=class{constructor(t){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=()=>
93{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)};var e,n,r,i,s,o;this.node=t.node,this.editor=t.editor,this.element=t.element,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.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t?.options)!=null&&r.directions&&(this.directions=t.options.directions),(i=t.options)!=null&&i.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(s=t.options)!=null&&s.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.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: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="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"),s=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),i&&(t.style.left="0"),s&&(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)})}
93removeHandles(){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,n0(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),s=this.applyConstraints(r,i,n);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,i=this.startHeight;const s=t.includes("right"),o=t.includes("left"),l=t.includes("bottom"),a=t.includes("top");return s?r=this.startWidth+e:o&&(r=this.startWidth-e),l?i=this.startHeight+n:a&&(i=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(s?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,s,o;if(!n){let c=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(c=Math.min(this.maxSize.width,c)),(i=this.maxSize)!=null&&i.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),(s=this.maxSize)!=null&&s.width&&l>this.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),(o=this.maxSize)!=null&&o.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}}};function i0(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof L){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}var s0={};el(s0,{createAtomBlockMarkdownSpec:()=>uh,createBlockMarkdownSpec:()=>o0,createInlineMarkdownSpec:()=>c0,parseAttributes:()=>cl,parseIndentedBlocks:()=>mo,renderNestedMarkdownContent:()=>dl,serializeAttributes:()=>ul});function cl(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const c=i.map(u=>u.trim().slice(1));e.class=c.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,u])=>{var d;const h=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),f=n[h];f&&(e[c]=f.slice(1,-1))});const a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();
vendor: 5,814 bytes, lines 93-108
93return a&&a.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function ul(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function uh(t){const{nodeName:e,name:n,parseAttributes:r=cl,serializeAttributes:i=ul,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:l}=t,a=n||e,c=u=>{if(!l)return u;const d={};return l.forEach(h=>{h in u&&(d[h]=u[h])}),d};return{parseMarkdown:(u,d)=>{const h={...s,...u.attributes};return d.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const h=new RegExp(`^:::${a}(?:\\s|$)`,"m"),f=(d=u.match(h))==null?void 0:d.index;return f!==void 0?f:-1},tokenize(u,d,h){const f=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(f);if(!p)return;const m=p[1]||"",g=r(m);if(!o.find(w=>!(w in g)))return{type:e,raw:p[0],attributes:g}}},renderMarkdown:u=>{const d=c(u.attrs||{}),h=i(d),f=h?` {${h}}`:"";return`:::${a}${f} :::`}}}function o0(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=cl,serializeAttributes:s=ul,defaultAttributes:o={},content:l="block",allowedAttributes:a}=t,c=n||e,u=d=>{if(!a)return d;const h={};return a.forEach(f=>{f in d&&(h[f]=d[f])}),h};return{parseMarkdown:(d,h)=>{let f;if(r){const m=r(d);f=typeof m=="string"?[{type:"text",text:m}]:m}else l==="block"?f=h.parseChildren(d.tokens||[]):f=h.parseInline(d.tokens||[]);const p={...o,...d.attributes};return h.createNode(e,p,f)},markdownTokenizer:{name:e,level:"block",start(d){var h;const f=new RegExp(`^:::${c}`,"m"),p=(h=d.match(f))==null?void 0:h.index;return p!==void 0?p:-1},tokenize(d,h,f){var p;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=d.match(m);if(!g)return;const[y,w=""]=g,v=i(w);let T=1;const S=y.length;let R="";const C=/^:::([\w-]*)(\s.*)?/gm,$=d.slice(S);for(C.lastIndex=0;;){const J=C.exec($);if(J===null)break;const Oe=J.index,ht=J[1];if(!((p=J[2])!=null&&p.endsWith(":::"))){if(ht)T+=1;else if(T-=1,T===0){const rt=$.slice(0,Oe);R=rt.trim();const Et=d.slice(0,S+Oe+J[0].length);let we=[];if(R)if(l==="block")for(we=f.blockTokens(rt),we.forEach(Ne=>{Ne.text&&(!Ne.tokens||Ne.tokens.length===0)&&(Ne.tokens=f.inlineTokens(Ne.text))});we.length>0;){const Ne=we[we.length-1];if(Ne.type==="paragraph"&&(!Ne.text||Ne.text.trim()===""))we.pop();else break}else we=f.inlineTokens(R);return{type:e,raw:Et,attributes:v,content:R,tokens:we}}}}}},renderMarkdown:(d,h)=>{const f=u(d.attrs||{}),p=s(f),m=p?` {${p}}`:"",g=h.renderChildren(d.content||[],`
94
95`);return`:::${c}${m}
96
97${g}
98
99:::`}}}function l0(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,s,o]=r;e[i]=s||o,r=n.exec(t)}return e}function a0(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function c0(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=l0,serializeAttributes:s=a0,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:a}=t,c=n||e,u=h=>{if(!a)return h;const f={};return a.forEach(p=>{const m=typeof p=="string"?p:p.name,g=typeof p=="string"?void 0:p.skipIfDefault;if(m in h){const y=h[m];if(g!==void 0&&y===g)return;f[m]=y}}),f},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,f)=>{const p={...o,...h.attributes};if(l)return f.createNode(e,p);const m=r?r(h):h.content||"";return m?f.createNode(e,p,[f.createTextNode(m)]):f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(h){const f=l?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=h.match(f),m=p?.index;return m!==void 0?m:-1},tokenize(h,f,p){const m=l?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),g=h.match(m);if(!g)return;let y="",w="";if(l){const[,T]=g;w=T}else{const[,T,S]=g;w=T,y=S||""}const v=i(w.trim());return{type:e,raw:g[0],content:y.trim(),attributes:v}}},renderMarkdown:h=>{let f="";r?f=r(h):h.content&&h.content.length>0&&(f=h.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const p=u(h.attrs||{}),m=s(p),g=m?` ${m}`:"";return l?`[${c}${g}]`:`[${c}${g}]${f}[/${c}]`}}}function mo(t,e,n){var r,i,s,o;const l=t.split(`
100`),a=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<l.length;){const h=l[u],f=h.match(e.itemPattern);if(!f){if(a.length>0)break;if(h.trim()===""){u+=1,c=`${c}${h}
101`;continue}else return}const p=e.extractItemData(f),{indentLevel:m,mainContent:g}=p;c=`${c}${h}
102`;const y=[g];for(u+=1;u<l.length;){const S=l[u];if(S.trim()===""){const C=l.slice(u+1).findIndex(Oe=>Oe.trim()!=="");if(C===-1)break;if((((i=(r=l[u+1+C].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>m){y.push(S),c=`${c}${S}
103`,u+=1;continue}else break}if((((o=(s=S.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>m)y.push(S),c=`${c}${S}
104`,u+=1;else break}let w;const v=y.slice(1);if(v.length>0){const S=v.map(R=>R.slice(m+d)).join(`
105`);S.trim()&&(e.customNestedParser?w=e.customNestedParser(S):w=n.blockTokens(S))}const T=e.createToken(p,w);a.push(T)}if(a.length!==0)return{items:a,raw:c}}function dl(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...o]=t.content,l=e.renderChildren([s]),a=[`${i}${l}`];return o&&o.length>0&&o.forEach(c=>{const u=e.renderChildren([c]);if(u){const d=u.split(`
106`).map(h=>h?e.indent(h):"").join(`
107`);a.push(d)}}),a.join(`
108`)}function u0(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants((l,a)=>{const c=s.mapping.map(a),u=s.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(f=>{if(f!==o)return!1;d=f}),!d)return;let h=!1;
108if(Object.keys(n).forEach(f=>{n[f]!==d.attrs[f]&&(h=!0)}),h){const f=t.type.create({...t.attrs,...n});s.removeMark(c,u,t.type),s.addMark(c,u,f)}}),s.docChanged&&e.view.dispatch(s)}var be=class dh extends al{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new dh(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},d0=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,i,s,o,l;const{view:a}=this.editor,c=t.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!u)return;let d=0,h=0;if(this.dom!==u){const w=this.dom.getBoundingClientRect(),v=u.getBoundingClientRect(),T=(i=t.offsetX)!=null?i:(r=t.nativeEvent)==null?void 0:r.offsetX,S=(o=t.offsetY)!=null?o:(s=t.nativeEvent)==null?void 0:s.offsetY;d=v.x-w.x+T,h=v.y-w.y+S}const f=this.dom.cloneNode(!0);try{const w=this.dom.getBoundingClientRect();f.style.width=`${Math.round(w.width)}px`,f.style.height=`${Math.round(w.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let p=null;try{p=document.createElement("div"),p.style.position="absolute",p.style.top="-9999px",p.style.left="-9999px",p.style.pointerEvents="none",p.appendChild(f),document.body.appendChild(p),(l=t.dataTransfer)==null||l.setDragImage(f,d,h)}finally{p&&setTimeout(()=>{try{p?.remove()}catch{}},0)}const m=this.getPos();if(typeof m!="number")return;const g=L.create(a.state.doc,m),y=a.state.tr.setSelection(g);a.dispatch(y)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const i=t.type.startsWith("drag"),s=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!s&&!i)return!0;const{isEditable:l}=this.editor,{isDragging:a}=this,c=!!this.node.type.spec.draggable,u=L.isSelectable(this.node),d=t.type==="copy",h=t.type==="paste",f=t.type==="cut",p=t.type==="mousedown";if(!c&&u&&i&&t.target===this.dom&&t.preventDefault(),c&&i&&!a&&t.target===this.dom)return t.preventDefault(),!1;if(c&&l&&!a&&p){const m=n.closest("[data-drag-handle]");m&&(this.dom===m||this.dom.contains(m))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||s||d||h||f||p&&u)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(ur()||co())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function qt(t){return new Yd({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=G(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=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),h=d+l.length;if(ll(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>d).length)return null;h<n.to&&o.delete(h,n.to),d>n.from&&o.delete(n.from+u,d),c=n.from+u+l.length,o.addMark(n.from+u,c,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}function h0(t){return new Yd({find:t.find,handler({match:e,chain:n,range:r,pasteEvent:i}){const s=G(t.getAttributes,void 0,e,i),o=G(t.getContent,void 0,s);if(s===!1||s===null)return null;const l={type:t.type.name,attrs:s};o&&(l.content=o),e.input&&n().deleteRange(r).insertContentAt(r.from,l)}})}const{getOwnPropertyNames:f0,getOwnPropertySymbols:p0}=Object,{hasOwnProperty:m0}=Object.prototype;function Ns(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function zr(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:s}=i,o=s.get(n),l=s.get(r);if(o&&l)return o===r&&l===n;s.set(n,r),s.set(r,n);const a=t(n,r,i);return s.delete(n),s.delete(r),a}}function g0(t){return t?.[Symbol.toStringTag]}function Qa(t){return f0(t).concat(p0(t))}const y0=Object.hasOwn||((t,e)=>m0.call(t,e));function wn(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const b0="__v",w0="__o",k0="_owner",{getOwnPropertyDescriptor:Za,keys:ec}=Object;function x0(t,e){return t.byteLength===e.byteLength&&di(new Uint8Array(t),new Uint8Array(e))}function S0(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function v0(t,e){return t.byteLength===e.byteLength&&di(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function C0(t,e){return wn(t.getTime(),e.getTime())}function M0(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function E0(t,e){return t===e}function tc(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.entries();let o,l,a=0;for(;(o=s.next())&&!o.done;){const c=e.entries();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(i[d]){d++;continue}const h=o.value,f=l.value;if(n.equals(h[0],f[0],a,d,t,e,n)&&n.equals(h[1],f[1],h[0],f[0],t,e,n)){u=i[d]=!0;break}d++}if(!u)return!1;a++}return!0}const T0=wn;function A0(t,e,n){const r=ec(t);let i=r.length;if(ec(e).length!==i)return!1;for(;i-- >0;)if(!hh(t,e,n,r[i]))return!1;return!0}function _n(t,e,n){const r=Qa(t);let i=r.length;if(Qa(e).length!==i)return!1;let s,o,l;for(;i-- >0;)if(s=r[i],!hh(t,e,n,s)||(o=Za(t,s),l=Za(e,s),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function O0(t,e){return wn(t.valueOf(),e.valueOf())}function N0(t,e){return t.source===e.source&&t.flags===e.flags}function nc(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.values();let o,l;for(;(o=s.next())&&!o.done;){const a=e.values();let c=!1,u=0;for(;(l=a.next())&&!l.done;){if(!i[u]&&n.equals(o.value,l.value,o.value,l.value,t,e,n)){c=i[u]=!0;break}u++}if(!c)return!1}return!0}function di(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function R0(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function hh(t,e,n,r){return(r===k0||r===w0||r===b0)&&(t.$$typeof||e.$$typeof)?!0:y0(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const D0="[object ArrayBuffer]",I0="[object Arguments]",L0="[object Boolean]",P0="[object DataView]",z0="[object Date]",B0="[object Error]",H0="[object Map]",$0="[object Number]",_0="[object Object]",F0="[object RegExp]",V0="[object Set]",j0="[object String]",U0={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array
108]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},W0="[object URL]",K0=Object.prototype.toString;function q0({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:h,areUrlsEqual:f,unknownTagComparators:p}){return function(g,y,w){if(g===y)return!0;if(g==null||y==null)return!1;const v=typeof g;if(v!==typeof y)return!1;if(v!=="object")return v==="number"?l(g,y,w):v==="function"?s(g,y,w):!1;const T=g.constructor;if(T!==y.constructor)return!1;if(T===Object)return a(g,y,w);if(Array.isArray(g))return e(g,y,w);if(T===Date)return r(g,y,w);if(T===RegExp)return u(g,y,w);if(T===Map)return o(g,y,w);if(T===Set)return d(g,y,w);const S=K0.call(g);if(S===z0)return r(g,y,w);if(S===F0)return u(g,y,w);if(S===H0)return o(g,y,w);if(S===V0)return d(g,y,w);if(S===_0)return typeof g.then!="function"&&typeof y.then!="function"&&a(g,y,w);if(S===W0)return f(g,y,w);if(S===B0)return i(g,y,w);if(S===I0)return a(g,y,w);if(U0[S])return h(g,y,w);if(S===D0)return t(g,y,w);if(S===P0)return n(g,y,w);if(S===L0||S===$0||S===j0)return c(g,y,w);if(p){let R=p[S];if(!R){const C=g0(g);C&&(R=p[C])}if(R)return R(g,y,w)}return!1}}function J0({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:x0,areArraysEqual:n?_n:S0,areDataViewsEqual:v0,areDatesEqual:C0,areErrorsEqual:M0,areFunctionsEqual:E0,areMapsEqual:n?Ns(tc,_n):tc,areNumbersEqual:T0,areObjectsEqual:n?_n:A0,arePrimitiveWrappersEqual:O0,areRegExpsEqual:N0,areSetsEqual:n?Ns(nc,_n):nc,areTypedArraysEqual:n?Ns(di,_n):di,areUrlsEqual:R0,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=zr(r.areArraysEqual),s=zr(r.areMapsEqual),o=zr(r.areObjectsEqual),l=zr(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:l})}return r}function G0(t){return function(e,n,r,i,s,o,l){return t(e,n,l)}}function Y0({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(l,a){const{cache:c=t?new WeakMap:void 0,meta:u}=n();return e(l,a,{cache:c,equals:r,meta:u,strict:i})};if(t)return function(l,a){return e(l,a,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(l,a){return e(l,a,s)}}const X0=Yt();Yt({strict:!0});Yt({circular:!0});Yt({circular:!0,strict:!0});Yt({createInternalComparator:()=>wn});Yt({strict:!0,createInternalComparator:()=>wn});Yt({circular:!0,createInternalComparator:()=>wn});Yt({circular:!0,createInternalComparator:()=>wn,strict:!0});function Yt(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,s=J0(t),o=q0(s),l=n?n(o):G0(o);return Y0({circular:e,comparator:o,createState:r,equals:l,strict:i})}var Rs={exports:{}},Ds={};/**
109 * @license React
110 * use-sync-external-store-shim/with-selector.production.js
111 *
112 * Copyright (c) Meta Platforms, Inc. and affiliates.
113 *
114 * This source code is licensed under the MIT license found in the
115 * LICENSE file in the root directory of this source tree.
116 */var rc;function Q0(){if(rc)return Ds;rc=1;var t=Uc(),e=eu();function 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,s=t.useRef,o=t.useEffect,l=t.useMemo,a=t.useDebugValue;return Ds.useSyncExternalStoreWithSelector=function(c,u,d,h,f){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=l(function(){function y(R){if(!w){if(w=!0,v=R,R=h(R),f!==void 0&&m.hasValue){var C=m.value;if(f(C,R))return T=C}return T=R}if(C=T,r(v,R))return C;var $=h(R);return f!==void 0&&f(C,$)?(v=R,C):(v=R,T=$)}var w=!1,v,T,S=d===void 0?null:d;return[function(){return y(u())},S===null?void 0:function(){return y(S())}]},[u,d,h,f]);var g=i(c,p[0],p[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),a(g),g},Ds}var ic;function Z0(){return ic||(ic=1,Rs.exports=Q0()),Rs.exports}var ew=Z0(),tw=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},nw=({contentComponent:t})=>{const e=tu.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);
116return $e.jsx($e.Fragment,{children:Object.values(e)})};function rw(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:lp.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}var iw=class extends Ct.Component{constructor(t){var e;super(t),this.editorContentRef=Ct.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=rw(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return $e.jsxs($e.Fragment,{children:[$e.jsx("div",{ref:tw(e,this.editorContentRef),...n}),t?.contentComponent&&$e.jsx(nw,{contentComponent:t.contentComponent})]})}},sw=q.forwardRef((t,e)=>{const n=Ct.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ct.createElement(iw,{key:n,innerRef:e,...t})}),ow=Ct.memo(sw),lw=typeof window<"u"?q.useLayoutEffect:q.useEffect,aw=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function cw(t){var e;const[n]=q.useState(()=>new aw(t.editor)),r=ew.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:X0);return lw(()=>n.watch(t.editor),[t.editor,n]),q.useDebugValue(r),r}var uw=!1,go=typeof window>"u",dw=go||!!(typeof window<"u"&&window.next),hw=class fh{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?go||dw?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...r)}
116,onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...r)},onDelete:(...r)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...r)}};return new t0(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,s)=>{var o;return i===((o=n.extensions)==null?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?fh.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))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 sS(t={},e=[]){const n=q.useRef(t);n.current=t;const[r]=q.useState(()=>new hw(n)),i=tu.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return q.useDebugValue(i),q.useEffect(r.onRender(e)),cw({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),i}var hl=q.createContext({editor:null});hl.Consumer;var ph=()=>q.useContext(hl),mh=q.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),fw=()=>q.useContext(mh),oS=Ct.forwardRef((t,e)=>{const{onDragStart:n}=fw(),r=t.as||"div";return $e.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function sc(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function oc(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function pw(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function mw(t){if(sc(t)||oc(t))return!0;if(pw(t)){const e=t.type;if(e)return sc(e)||oc(e)}return!1}function gw(){try{if(q.version)return parseInt(q.version.split(".")[0],10)>=19}catch{}return!1}var yw=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.isInitialized?Io.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=gw(),s=mw(e),o={...n};o.ref&&!(i||s)&&delete o.ref,!o.ref&&(i||s)&&(o.ref=l=>{this.ref=l}),this.reactElement=$e.jsx(e,{...o}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.destroyed||(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;
116(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};Ct.createContext({markViewContentRef:()=>{}});var bw=class extends d0{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,i){var s;return r==="storage"?(s=t.storage[e.name])!=null?s:{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(a={})=>this.updateAttributes(a),deleteNode:()=>this.deleteNode(),ref:q.createRef()};if(!this.component.displayName){const a=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=a(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:a=>{a&&this.contentDOMElement&&a.firstChild!==this.contentDOMElement&&(a.hasAttribute("data-node-view-wrapper")&&a.removeAttribute("data-node-view-wrapper"),a.appendChild(this.contentDOMElement))}},i=this.component,s=q.memo(a=>$e.jsx(mh.Provider,{value:r,children:q.createElement(i,a)}));s.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:l=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new yw(s,{editor:this.editor,props:t,as:o,className:`node-${this.node.type.name} ${l}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,e,n){const r=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,s=this.decorations,o=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:i,oldDecorations:s,newNode:t,newDecorations:e,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=Pn(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n}
116)}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function lS(t,e){return n=>n.editor.contentComponent?new bw(t,n,e):{}}var fl=q.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});fl.displayName="TiptapContext";var ww=()=>q.useContext(fl);function gh({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=q.useMemo(()=>({editor:r}),[r]),s=q.useMemo(()=>({editor:r}),[r]);return $e.jsx(hl.Provider,{value:s,children:$e.jsx(fl.Provider,{value:i,children:n})})}gh.displayName="Tiptap";function yh({...t}){const{editor:e}=ww();return $e.jsx(ow,{editor:e,...t})}yh.displayName="Tiptap.Content";Object.assign(gh,{Content:yh});var hi=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},kw=/^\s*>\s$/,xw=be.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return hi("blockquote",{...X(this.options.HTMLAttributes,t),children:hi("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(i=>{const l=e.renderChildren([i]).split(`
117`).map(a=>a.trim()===""?n:`${n} ${a}`);r.push(l.join(`
118`))}),r.join(`
119${n}
120`)},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()}}
vendor: 8,910 bytes, lines 120-141
120,addInputRules(){return[zn({find:kw,type:this.type})]}}),Sw=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,vw=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Cw=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Mw=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Ew=tt.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 hi("strong",{...X(this.options.HTMLAttributes,t),children:hi("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[mn({find:Sw,type:this.type}),mn({find:Cw,type:this.type})]},addPasteRules(){return[qt({find:vw,type:this.type}),qt({find:Mw,type:this.type})]}}),Tw=/(^|[^`])`([^`]+)`(?!`)$/,Aw=/(^|[^`])`([^`]+)`(?!`)/g,Ow=tt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",X(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[mn({find:Tw,type:this.type})]},addPasteRules(){return[qt({find:Aw,type:this.type})]}}),Is=4,Nw=/^```([a-z]+)?[\s\n]$/,Rw=/^~~~([a-z]+)?[\s\n]$/,bh=be.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Is,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 s=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",X(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
121`):r=`\`\`\`${i}
122
123\`\`\``,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:Is,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const l=" ".repeat(n);return o?t.commands.insertContent(l):t.commands.command(({tr:a})=>{const{from:c,to:u}=i,f=r.doc.textBetween(c,u,`
124`,`
125`).split(`
126`).map(p=>l+p).join(`
127`);return a.replaceWith(c,u,r.schema.text(f)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Is,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?t.commands.command(({tr:l})=>{var a;const{pos:c}=s,u=s.start(),d=s.end(),f=r.doc.textBetween(u,d,`
128`,`
129`).split(`
130`);let p=0,m=0;const g=c-u;for(let R=0;R<f.length;R+=1){if(m+f[R].length>=g){p=R;break}m+=f[R].length+1}const w=((a=f[p].match(/^ */))==null?void 0:a[0])||"",v=Math.min(w.length,n);if(v===0)return!0;let T=u;for(let R=0;R<p;R+=1)T+=f[R].length+1;return l.delete(T,T+v),c-T<=v&&l.setSelection(H.create(l.doc,T)),!0}):t.commands.command(({tr:l})=>{const{from:a,to:c}=i,h=r.doc.textBetween(a,c,`
131`,`
132`).split(`
133`).map(f=>{var p;const m=((p=f.match(/^ */))==null?void 0:p[0])||"",g=Math.min(m.length,n);return f.slice(g)}).join(`
134`);return l.replaceWith(a,c,r.schema.text(h)),!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 s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
135
136`);return!s||!o?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:c})=>(c.setSelection(_.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[po({find:Nw,type:this.type,getAttributes:t=>({language:t[1]})}),po({find:Rw,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Z({key:new oe("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,s=i?.mode;if(!n||!s)return!1;const{tr:o,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
137`));return o.replaceSelectionWith(this.type.create({language:s},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(H.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),Dw=be.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
138
139`):""}),Iw=be.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",X(this.options.HTMLAttributes,t)]},renderText(){return`
140`},renderMarkdown:()=>`  
141`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&o){const d=a.filter(h=>l.includes(h.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),wh=be.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]}`,X(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,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=>po({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}}
141)\\s$`),type:this.type,getAttributes:{level:t}}))}}),aS=wh,Lw=be.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",X(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!i0(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return Ud(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:l})=>{if(l){const{$to:a}=o.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?o.setSelection(H.create(o.doc,a.pos+1)):a.nodeAfter.isBlock?o.setSelection(L.create(o.doc,a.pos)):o.setSelection(H.create(o.doc,a.pos));else{const u=s.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u?.create();d&&(o.insert(c,d),o.setSelection(H.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ch({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.t
vendor: 1,039 bytes, line 141
141ype})]}}),Pw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,zw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Bw=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Hw=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,$w=tt.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",X(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[mn({find:Pw,type:this.type}
141),mn({find:Bw,type:this.type})]},addPasteRules(){return[qt({find:zw,type:this.type}),qt({find:Hw,type:this.type})]}});const _w="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yac
141hts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Fw="ελ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",yo="numeric",bo="ascii",wo="alpha",Xn="asciinumeric",Kn="alphanumeric",ko="domain",kh="emoji",Vw="scheme",jw="slashscheme",Ls="whitespace";function Uw(t,e){return t in e||(e[t]=[]),e[t]}function sn(t,e,n){e[yo]&&(e[Xn]=!0,e[Kn]=!0),e[bo]&&(e[Xn]=!0,e[wo]=!0),e[Xn]&&(e[Kn]=!0),e[wo]&&(e[Kn]=!0),e[Kn]&&(e[ko]=!0),e[kh]&&(e[ko]=!0);for(const r in e){const i=Uw(r,n);i.indexOf(t)<0&&i.push(t)}}function Ww(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function He(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}He.groups={};He.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],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||He.groups;let i;return e&&e.j?i=e:(i=new He(e),n&&r&&sn(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||He.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,l=i.go(t);if(l?(o=new He,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new He,s){if(r)if(o.t&&typeof o.t=="string"){const a=Object.assign(Ww(o.t,r),n);sn(s,a,r)}else n&&sn(s,n,r);o.t=s}return i.j[t]=o,o}};const U=(t,e,n,r,i)=>t.ta(e,n,r,i),le=(t,e,n,r,i)=>t.tr(e,n,r,i),lc=(t,e,n,r,i)=>t.ts(e,n,r,i),M=(t,e,n,r,i)=>t.tt(e,n,r,i),yt="WORD",xo="UWORD",xh="ASCIINUMERICAL",Sh="ALPHANUMERICAL",hr="LOCALHOST",So="TLD",vo="UTLD",Jr="SCHEME",En="SLASH_SCHEME",pl="NUM",Co="WS",ml="NL",Qn="OPENBRACE",Zn="CLOSEBRACE",fi="OPENBRACKET",pi="CLOSEBRACKET",mi="OPENPAREN",gi="CLOSEPAREN",yi="OPENANGLEBRACKET",bi="CLOSEANGLEBRACKET",wi="FULLWIDTHLEFTPAREN",ki="FULLWIDTHRIGHTPAREN",xi="LEFTCORNERBRACKET",Si="RIGHTCORNERBRACKET",vi="LEFTWHITECORNERBRACKET",Ci="RIGHTWHITECORNERBRACKET",Mi="FULLWIDTHLESSTHAN",Ei="FULLWIDTHGREATERTHAN",Ti="AMPERSAND",Ai="APOSTROPHE",Oi="ASTERISK",It="AT",Ni="BACKSLASH",Ri="BACKTICK",Di="CARET",zt="COLON",gl="COMMA",Ii="DOLLAR",ot="DOT",Li="EQUALS",yl="EXCLAMATION",Ke="HYPHEN",er="PERCENT",Pi="PIPE",zi="PLUS",Bi="POUND",tr="QUERY",bl="QUOTE",vh="FULLWIDTHMIDDLEDOT",wl="SEMI",lt="SLASH",nr="TILDE",Hi="UNDERSCORE",Ch="EMOJI",$i="SYM";var Mh=Object.freeze({__proto__:null,ALPHANUMERICAL:Sh,AMPERSAND:Ti,APOSTROPHE:Ai,ASCIINUMERICAL:xh,ASTERISK:Oi,AT:It,BACKSLASH:Ni,BACKTICK:Ri,CARET:Di,CLOSEANGLEBRACKET:bi,CLOSEBRACE:Zn,CLOSEBRACKET:pi,CLOSEPAREN:gi,COLON:zt,COMMA:gl,DOLLAR:Ii,DOT:ot,EMOJI:Ch,EQUALS:Li,EXCLAMATION:yl,FULLWIDTHGREATERTHAN:Ei,FULLWIDTHLEFTPAREN:wi,FULLWIDTHLESSTHAN:Mi,FULLWIDTHMIDDLEDOT:vh,FULLWIDTHRIGHTPAREN:ki,HYPHEN:Ke,LEFTCORNERBRACKET:xi,LEFTWHITECORNERBRACKET:vi,LOCALHOST:hr,NL:ml,NUM:pl,OPENANGLEBRACKET:yi,OPENBRACE:Qn,OP
vendor: 26,833 bytes, lines 141-155
141ENBRACKET:fi,OPENPAREN:mi,PERCENT:er,PIPE:Pi,PLUS:zi,POUND:Bi,QUERY:tr,QUOTE:bl,RIGHTCORNERBRACKET:Si,RIGHTWHITECORNERBRACKET:Ci,SCHEME:Jr,SEMI:wl,SLASH:lt,SLASH_SCHEME:En,SYM:$i,TILDE:nr,TLD:So,UNDERSCORE:Hi,UTLD:vo,UWORD:xo,WORD:yt,WS:Co});const mt=/[a-z]/,Fn=/\p{L}/u,Ps=/\p{Emoji}/u,gt=/\d/,zs=/\s/,ac="\r",Bs=`
142`,Kw="️",qw="‍",Hs="";let Br=null,Hr=null;function Jw(t=[]){const e={};He.groups=e;const n=new He;Br==null&&(Br=cc(_w)),Hr==null&&(Hr=cc(Fw)),M(n,"'",Ai),M(n,"{",Qn),M(n,"}",Zn),M(n,"[",fi),M(n,"]",pi),M(n,"(",mi),M(n,")",gi),M(n,"<",yi),M(n,">",bi),M(n,"(",wi),M(n,")",ki),M(n,"「",xi),M(n,"」",Si),M(n,"『",vi),M(n,"』",Ci),M(n,"<",Mi),M(n,">",Ei),M(n,"&",Ti),M(n,"*",Oi),M(n,"@",It),M(n,"`",Ri),M(n,"^",Di),M(n,":",zt),M(n,",",gl),M(n,"$",Ii),M(n,".",ot),M(n,"=",Li),M(n,"!",yl),M(n,"-",Ke),M(n,"%",er),M(n,"|",Pi),M(n,"+",zi),M(n,"#",Bi),M(n,"?",tr),M(n,'"',bl),M(n,"/",lt),M(n,";",wl),M(n,"~",nr),M(n,"_",Hi),M(n,"\\",Ni),M(n,"・",vh);const r=le(n,gt,pl,{[yo]:!0});le(r,gt,r);const i=le(r,mt,xh,{[Xn]:!0}),s=le(r,Fn,Sh,{[Kn]:!0}),o=le(n,mt,yt,{[bo]:!0});le(o,gt,i),le(o,mt,o),le(i,gt,i),le(i,mt,i);const l=le(n,Fn,xo,{[wo]:!0});le(l,mt),le(l,gt,s),le(l,Fn,l),le(s,gt,s),le(s,mt),le(s,Fn,s);const a=M(n,Bs,ml,{[Ls]:!0}),c=M(n,ac,Co,{[Ls]:!0}),u=le(n,zs,Co,{[Ls]:!0});M(n,Hs,u),M(c,Bs,a),M(c,Hs,u),le(c,zs,u),M(u,ac),M(u,Bs),le(u,zs,u),M(u,Hs,u);const d=le(n,Ps,Ch,{[kh]:!0});M(d,"#"),le(d,Ps,d),M(d,Kw,d);const h=M(d,qw);M(h,"#"),le(h,Ps,d);const f=[[mt,o],[gt,i]],p=[[mt,null],[Fn,l],[gt,s]];for(let m=0;m<Br.length;m++)Nt(n,Br[m],So,yt,f);for(let m=0;m<Hr.length;m++)Nt(n,Hr[m],vo,xo,p);sn(So,{tld:!0,ascii:!0},e),sn(vo,{utld:!0,alpha:!0},e),Nt(n,"file",Jr,yt,f),Nt(n,"mailto",Jr,yt,f),Nt(n,"http",En,yt,f),Nt(n,"https",En,yt,f),Nt(n,"ftp",En,yt,f),Nt(n,"ftps",En,yt,f),sn(Jr,{scheme:!0,ascii:!0},e),sn(En,{slashscheme:!0,ascii:!0},e),t=t.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<t.length;m++){const g=t[m][0],w=t[m][1]?{[Vw]:!0}:{[jw]:!0};g.indexOf("-")>=0?w[ko]=!0:mt.test(g)?gt.test(g)?w[Xn]=!0:w[bo]=!0:w[yo]=!0,lc(n,g,g,w)}return lc(n,"localhost",hr,{ascii:!0}),n.jd=new He($i),{start:n,tokens:Object.assign({groups:e},Mh)}}function Eh(t,e){const n=Gw(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let l=t,a=null,c=0,u=null,d=-1,h=-1;for(;o<r&&(a=l.go(n[o]));)l=a,l.accepts()?(d=0,h=0,u=l):d>=0&&(d+=n[o].length,h++),c+=n[o].length,s+=n[o].length,o++;s-=d,o-=h,c-=d,i.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function Gw(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,o=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Nt(t,e,n,r,i){let s;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];t.j[a]?s=t.j[a]:(s=new He(r),s.jr=i.slice(),t.j[a]=s),t=s}return s=new He(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function cc(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const fr={defaultProtocol:"http",events:null,format:uc,formatHref:uc,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function kl(t,e=null){let n=Object.assign({},fr);t&&(n=Object.assign(n,t instanceof kl?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}kl.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 uc(t){return t}function Th(t,e){this.t="token",this.v=t,this.tk=e}Th.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),s=this.toFormattedString(t),o={},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 o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:i,attributes:o,content:s,eventListeners:d}}};function ts(t,e){class n extends Th{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const dc=ts("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),hc=ts("text"),Yw=ts("nl"),$r=ts("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!==hr&&t[1].t===zt}}),We=t=>new He(t);function Xw({groups:t}){const e=t.domain.concat([Ti,Oi,It,Ni,Ri,Di,Ii,Li,Ke,pl,er,Pi,zi,Bi,lt,$i,nr,Hi]),n=[Ai,zt,gl,ot,yl,er,tr,bl,wl,yi,bi,Qn,Zn,pi,fi,mi,gi,wi,ki,xi,Si,vi,Ci,Mi,Ei],r=[Ti,Ai,Oi,Ni,Ri,Di,Ii,Li,Ke,Qn,Zn,er,Pi,zi,Bi,tr,lt,$i,nr,Hi],i=We(),s=M(i,nr);U(s,r,s),U(s,t.domain,s);const o=We(),l=We(),a=We();U(i,t.domain,o),U(i,t.scheme,l),U(i,t.slashscheme,a),U(o,r,s),U(o,t.domain,o);const c=M(o,It);M(s,It,c),M(l,It,c),M(a,It,c);const u=M(s,ot);U(u,r,s),U(u,t.domain,s);const d=We();U(c,t.domain,d),U(d,t.domain,d);const h=M(d,ot);U(h,t.domain,d);const f=We(dc);U(h,t.tld,f),U(h,t.utld,f),M(c,hr,f);const p=M(d,Ke);M(p,Ke,p),U(p,t.domain,d),U(f,t.domain,d),M(f,ot,h),M(f,Ke,p);const m=M(f,zt);U(m,t.numeric,dc);const g=M(o,Ke),y=M(o,ot);M(g,Ke,g),U(g,t.domain,o),U(y,r,s),U(y,t.domain,o);const w=We($r);U(y,t.tld,w),U(y,t.utld,w),U(w,t.domain,o),U(w,r,s),M(w,ot,y),M(w,Ke,g),M(w,It,c);const v=M(w,zt),T=We($r);U(v,t.numeric,T);const S=We($r),R=We();U(S,e,S),U(S,n,R),U(R,e,S),U(R,n,R),M(w,lt,S),M(T,lt,S);const C=M(l,zt),$=M(a,zt),J=M($,lt),Oe=M(J,lt);U(l,t.domain,o),M(l,ot,y),M(l,Ke,g),U(a,t.domain,o),M(a,ot,y),M(a,Ke,g),U(C,t.domain,S),M(C,lt,S),M(C,tr,S),U(Oe,t.domain,S),U(Oe,e,S),M(Oe,lt,S);const ht=[[Qn,Zn],[fi,pi],[mi,gi],[yi,bi],[wi,ki],[xi,Si],[vi,Ci],[Mi,Ei]];for(let rt=0;rt<ht.length;rt++){const[Et,we]=ht[rt],Ne=M(S,Et);M(R,Et,Ne),M(Ne,we,S);const Tt=We($r);U(Ne,e,Tt);const Xt=We();U(Ne,n),U(Tt,e,Tt),U(Tt,n,Xt),U(Xt,e,Tt),U(Xt,n,Xt),M(Tt,we,S),M(Xt,we,S)}return M(i,hr,w),M(i,ml,Yw),{start:i,tokens:Mh}}function Qw(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let l=t,a=null,c=null,u=0,d=null,h=-1;for(;i<r&&!(a=l.go(n[i].t));)o.push(n[i++]);for(;i<r&&(c=a||l.go(n[i].t));)a=null,l=c,l.accepts()?(h=0,d=l):h>=0&&h++,i++,u++;if(h<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push($s(hc,e,o)),o=[]),i-=h,u-=h;const f=d.t,p=n.slice(i-u,i);s.push($s(f,e,p))}}return o.length>0&&s.push($s(hc,e,o)),s}function $s(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const Zw=typeof console<"u"&&console&&console.warn||(()=>{}),ek="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",se={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function tk(){return He.groups={},se.scanner=null,se.parser=null,se.tokenQueue=[],se.pluginQueue=[],se.customSchemes=[],se.initialized=!1,se}function fc(t,e=!1){if(se.initialized&&Zw(`linkifyjs: already initialized - will not register custom scheme "${t}" ${ek}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
1431. Must only contain digits, lowercase ASCII letters or "-"
1442. Cannot start or end with "-"
1453. "-" cannot repeat`);se.customSchemes.push([t,e])}function nk(){se.scanner=Jw(se.customSchemes);for(let t=0;t<se.tokenQueue.length;t++)se.tokenQueue[t][1]({scanner:se.scanner});se.parser=Xw(se.scanner.tokens);for(let t=0;t<se.pluginQueue.length;t++)se.pluginQueue[t][1]({scanner:se.scanner,parser:se.parser});return se.initialized=!0,se}function xl(t){return se.initialized||nk(),Qw(se.parser.start,t,Eh(se.scanner.start,t))}xl.scan=Eh;function Ah(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 kl(n),i=xl(t),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}var Sl="[\0-   ᠎ -\u2029  ]",rk=new RegExp(Sl),ik=new RegExp(`${Sl}$`),sk=new RegExp(Sl,"g");function ok(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function lk(t){return new Z({key:new oe("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=Pd(n.doc,[...e]);if(jd(l).forEach(({newRange:c})=>{const u=ob(r.doc,c,f=>f.isTextblock);let d,h;if(u.length>1)d=u[0],h=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const f=r.doc.textBetween(c.from,c.to," "," ");if(!ik.test(f))return;d=u[0],h=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&h){const f=h.split(rk).filter(Boolean);if(f.length<=0)return!1;const p=f[f.length-1],m=d.pos+h.lastIndexOf(p);if(!p)return!1;const g=xl(p).map(y=>y.toObject(t.defaultProtocol));if(!ok(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{ll(y.from,y.to,r.doc).some(w=>w.mark.type===t.type)||o.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function ak(t){return new Z({key:new oe("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const a=r.target;if(!a)return!1;const c=t.editor.view.dom;o=a.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const a=Vd(e.state,t.type.name),c=(i=o.href)!=null?i:a.href,u=(s=o.target)!=null?s:a.target;c&&(window.open(c,u),l=!0)}return l}}})}function ck(t){return new Z({key:new oe("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:o}=s,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=Ah(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 en(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(sk,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Oh=tt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){fc(t);return}fc(t.scheme,t.optionalSlashes)})},onDestroy(){tk()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!en(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 i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!en(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=>!!en(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",X(this.options.HTMLAttributes,t),0]:["a",X(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,s;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",l=(s=(i=t.attrs)==null?void 0:i.title)!=null?s:"",a=e.renderChildren(t);return l?`[${a}](${o} "${l}")`:`[${a}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!en(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=>!!en(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[qt({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=Ah(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!en(o,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(lk({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!en(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(ak({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(ck({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),cS=Oh,uk=Object.defineProperty,dk=(t,e)=>{for(var n in e)uk(t,n,{get:e[n],enumerable:!0})},hk="listItem",pc="textStyle",mc=/^\s*([-+*])\s$/,Nh=be.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",X(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,`
146`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(hk,this.editor.getAttributes(pc)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=zn({find:mc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=zn({find:mc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(pc),editor:this.editor})),[t]}}),Rh=be.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",X(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(i=>i.type==="paragraph"))n=e.parseChildren(t.tokens);else{const i=t.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(i.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),l=e.parseChildren(o);n.push(...l)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>dl(t,e,r=>{var i,s;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((s=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),fk={};dk(fk,{findListItemPos:()=>wr,getNextListDepth:()=>vl,handleBackspace:()=>Mo,handleDelete:()=>Eo,hasListBefore:()=>Dh,hasListItemAfter:()=>pk,hasListItemBefore:()=>Ih,listItemHasSubList:()=>Lh,nextListIsDeeper:()=>Ph,nextListIsHigher:()=>zh});var wr=(t,e)=>{const{$from:n}=e.selection,r=me(t,e.schema);let i=null,s=n.depth,o=n.pos,l=null;for(;s>0&&l===null;)i=n.node(s),i.type===r?l=s:(s-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},vl=(t,e)=>{const n=wr(t,e);if(!n)return!1;const[,r]=pb(e,t,n.$pos.pos+4);return r},Dh=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),s=t.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},Ih=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},Lh=(t,e,n)=>{if(!n)return!1;const r=me(t,e.schema);let i=!1;return n.descendants(s=>{s.type===r&&(i=!0)}),i},Mo=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Kt(t.state,e)&&Dh(t.state,e,n)){const{$anchor:l}=t.state.selection,a=t.state.doc.resolve(l.before()-1),c=[];a.node().descendants((h,f)=>{h.type.name===e&&c.push({node:h,pos:f})});const u=c.at(-1);if(!u)return!1;const d=t.state.doc.resolve(a.start()+u.pos+1);return t.chain().cut({from:l.start()-1,to:l.end()+1},d.end()).joinForward().run()}if(!Kt(t.state,e)||!bb(t.state))return!1;const r=wr(e,t.state);if(!r)return!1;const s=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=Lh(e,t.state,s);return Ih(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},Ph=(t,e)=>{const n=vl(t,e),r=wr(t,e);return!r||!n?!1:n>r.depth},zh=(t,e)=>{const n=vl(t,e),r=wr(t,e);return!r||!n?!1:n<r.depth},Eo=(t,e)=>{if(!Kt(t.state,e)||!yb(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:Ph(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():zh(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},pk=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},Bh=Y.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&&Eo(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&&Eo(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&&Mo(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&&Mo(t,n,r)&&(e=!0)}),e}}}}),gc=/^(\s*)(\d+)\.\s+(.*)$/,mk=/^\s/;function gk(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],s=i.match(gc);if(!s)break;const[,o,l,a]=s,c=o.length;let u=a,d=n+1;const h=[i];for(;d<t.length;){const f=t[d];if(f.match(gc))break;if(f.trim()==="")h.push(f),u+=`
147`,d+=1;else if(f.match(mk))h.push(f),u+=`
148${f.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(l,10),content:u.trim(),raw:h.join(`
149`)}),r=d,n=d}return[e,r]}function Hh(t,e,n){var r;const i=[];let s=0;for(;s<t.length;){const o=t[s];if(o.indent===e){const l=o.content.split(`
150`),a=((r=l[0])==null?void 0:r.trim())||"",c=[];a&&c.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});const u=l.slice(1).join(`
151`).trim();if(u){const f=n.blockTokens(u);c.push(...f)}let d=s+1;const h=[];for(;d<t.length&&t[d].indent>e;)h.push(t[d]),d+=1;if(h.length>0){const f=Math.min(...h.map(m=>m.indent)),p=Hh(h,f,n);c.push({type:"list",ordered:!0,start:h[0].number,items:p,raw:h.map(m=>m.raw).join(`
152`)})}i.push({type:"list_item",raw:o.raw,tokens:c}),s=d}else s+=1}return i}function yk(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 s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var bk="listItem",yc="textStyle",bc=/^(\d+)\.\s$/,$h=be.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",X(this.options.HTMLAttributes,n),0]:["ol",X(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?yk(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
153`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const i=t.split(`
154`),[s,o]=gk(i);if(s.length===0)return;const l=Hh(s,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:l,raw:i.slice(0,o).join(`
155`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(bk,this.editor.getAttributes(yc)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=zn({find:bc,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=zn({find:bc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(yc)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),wk=/^\s*(\[([( |x])?\])\s$/,_h=be.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",X(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 i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return dl(t,e,i)},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"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=d=>{var h,f;l.ariaLabel=((f=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:f.call(h,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};
vendor: 10,325 bytes, lines 155-156
155c(t),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:h}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const p=n();if(typeof p!="number")return!1;const m=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,{...m?.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,h)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,h])=>{i.setAttribute(d,h)}),i.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,s.append(l,o),i.append(s,a),Object.entries(e).forEach(([d,h])=>{i.setAttribute(d,h)});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 h=r.extensionManager.attributes,f=Pn(d,h),p=new Set(Object.keys(f)),m=this.options.HTMLAttributes;return u.forEach(g=>{p.has(g)||(g in m?i.setAttribute(g,m[g]):i.removeAttribute(g))}),Object.entries(f).forEach(([g,y])=>{y==null?g in m?i.setAttribute(g,m[g]):i.removeAttribute(g):i.setAttribute(g,y)}),u=p,!0}}}},addInputRules(){return[zn({find:wk,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Fh=be.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",X(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,`
156`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=s=>{const o=mo(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(s)},i=mo(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:o}),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()}}});Y.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(Nh.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Rh.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Bh.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push($h.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(_h.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Fh.configure(this.options.taskList)),t}});var wc="&nbsp;",kk=" ",xk=be.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",X(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 r.length===1&&r[0].type==="text"&&(r[0].text===wc||r[0].text===kk)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?wc:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Sk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,vk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Ck=tt.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",X(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[mn({find:Sk,type:this.type})]},addPasteRules(){return[qt({find:vk,type:this.type})]}}),Mk=be.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Vh=tt.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",X(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 i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},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()}}}),uS=Vh;function Ek(t={}){return new Z({view(e){return new Tk(e,t)}})}class Tk{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 s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(n){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let p=f.getBoundingClientRect(),m=d?p.bottom:p.top;d&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*l;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:d.left-h,right:d.left+h,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(),h=d.width/a.offsetWidth,f=d.height/a.offsetHeight;c=d.left-a.scrollLeft*h,u=d.top-a.scrollTop*f}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/o+"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,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Au(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ae extends _{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ae.valid(r)?new ae(r):_.near(r)}content(){return A.empty}eq(e){return e instanceof ae&&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 ae(e.resolve(n.pos))}getBookmark(){return new Cl(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Ak(e)||!Ok(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&&ae.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>
vendor: 19,908 bytes, line 156
1560?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let a=e.doc.resolve(i);if(ae.valid(a))return a}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!L.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let l=e.doc.resolve(i);if(ae.valid(l))return l}return null}}}ae.prototype.visible=!1;ae.findFrom=ae.findGapCursorFrom;_.jsonID("gapcursor",ae);class Cl{constructor(e){this.pos=e}map(e){return new Cl(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ae.valid(n)?new ae(n):_.near(n)}}function jh(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Ak(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||jh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Ok(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||jh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Nk(){return new Z({props:{decorations:Lk,createSelectionBetween(t,e,n){return e.pos==n.pos&&ae.valid(n)?new ae(n):null},handleClick:Dk,handleKeyDown:Rk,handleDOMEvents:{beforeinput:Ik}}})}const Rk=Zo({ArrowLeft:_r("horiz",-1),ArrowRight:_r("horiz",1),ArrowUp:_r("vert",-1),ArrowDown:_r("vert",1)});function _r(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof H){if(!s.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=ae.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new ae(c))),!0):!1}}function Dk(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ae.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&L.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ae(r))),!0)}function Ik(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ae))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 o=r.length-1;o>=0;o--)i=x.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new A(i,0,0));return s.setSelection(H.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function Lk(t){if(!(t.selection instanceof ae))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ee.create(t.doc,[ye.widget(t.selection.head,e,{key:"gapcursor"})])}var _i=200,ve=function(){};ve.prototype.append=function(e){return e.length?(e=ve.from(e),!this.length&&e||e.length<_i&&this.leafAppend(e)||this.length<_i&&e.leafPrepend(this)||this.appendInner(e)):this};ve.prototype.prepend=function(e){return e.length?ve.from(e).append(this):this};ve.prototype.appendInner=function(e){return new Pk(this,e)};ve.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ve.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ve.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ve.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)};ve.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};ve.from=function(e){return e instanceof ve?e:e&&e.length?new Uh(e):ve.empty};var Uh=(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,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=_i)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=_i)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})(ve);ve.empty=new Uh([]);var Pk=(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,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},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})(ve);const zk=500;class Qe{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,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new at(d.map));let f=d.step.map(i.slice(s)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new at(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(s)):d.selection,a=new Qe(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,n,r,i){let s=[],o=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]),h=new at(e.mapping.maps[u],d,n),f;(f=a&&a.merge(h))&&(h=f,u?s.pop():l=l.slice(0,l.length-1)),s.push(h),n&&(o++,n=void 0),i||(a=h)}let c=o-r.depth;return c>Hk&&(l=Bk(l,c),o-=c),new Qe(l.append(s),o)}remapping(e,n){let r=new sr;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Qe(this.items.append(e.map(n=>new at(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=n;this.items.forEach(h=>{let f=s.getMirror(--a);if(f==null)return;o=Math.min(o,f);let p=s.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(s.slice(a+1,f));g&&l++,r.push(new at(p,m,g))}else r.push(new at(p))},i);let c=[];for(let h=n;h<o;h++)c.push(new at(s.maps[h]));let u=this.items.slice(0,i).append(c).append(r),d=new Qe(u,l);return d.emptyItemCount()>zk&&(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=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=o.selection&&o.selection.map(n.slice(r));u&&s++;let d=new at(c.invert(),a,u),h,f=i.length-1;(h=i.length&&i[f].merge(d))?i[f]=h:i.push(d)}}else o.map&&r--},this.items.length,0),new Qe(ve.from(i.reverse()),s)}}Qe.empty=new Qe(ve.empty,0);function Bk(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class at{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 at(n.getMap().invert(),n,this.selection)}}}class Lt{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const Hk=20;function $k(t,e,n,r){let i=n.getMeta(un),s;if(i)return i.historyState;n.getMeta(Vk)&&(t=new Lt(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(un))return o.getMeta(un).redo?new Lt(t.done.addTransform(n,void 0,r,Gr(e)),t.undone,kc(n.mapping.maps),t.prevTime,t.prevComposition):new Lt(t.done,t.undone.addTransform(n,void 0,r,Gr(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!_k(n,t.prevRanges)),c=o?_s(t.prevRanges,n.mapping):kc(n.mapping.maps);return new Lt(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Gr(e)),Qe.empty,c,n.time,l??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Lt(t.done.rebased(n,s),t.undone.rebased(n,s),_s(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Lt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),_s(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function _k(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function kc(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function _s(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function Fk(t,e,n){let r=Gr(e),i=un.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),a=new Lt(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(un,{redo:n,historyState:a})}let Fs=!1,xc=null;function Gr(t){let e=t.plugins;if(xc!=e){Fs=!1,xc=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Fs=!0;break}}return Fs}const un=new oe("history"),Vk=new oe("closeHistory");function jk(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Z({key:un,state:{init(){return new Lt(Qe.empty,Qe.empty,null,0,-1)},apply(e,n,r){return $k(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Kh:r=="historyRedo"?qh:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function Wh(t,e){return(n,r)=>{let i=un.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=Fk(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const Kh=Wh(!1,!0),qh=Wh(!0,!0);var Uk=Y.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Z({key:new oe("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit;if(i==null||i===0){t=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const o=s-i,l=0,a=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=s-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}}),Wk=Y.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Ek(this.options)]}});Y.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Z({key:new oe("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return ee.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(a.isText)return;if(!(i>=c&&i<=c+a.nodeSize-1))return!1;o+=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"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(ye.node(c,c+a.nodeSize,{class:this.options.className}))}),ee.create(t,s)}}})]}});var Kk=Y.create({name:"gapCursor",addProseMirrorPlugins(){return[Nk()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=G(z(t,"allowGapCursor",n)))!=null?e:null}}}),Sc="placeholder";function qk(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var Jk=Y.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Sc,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${qk(this.options.dataAttribute)}`:`data-${Sc}`;return[new Z({key:new oe("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,s=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((l,a)=>{const c=i>=a&&i<=a+l.nodeSize,u=!l.isLeaf&&Zi(l);if((c||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);const h=ye.node(a,a+l.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:a,hasAnchor:c}):this.options.placeholder});s.push(h)}return this.options.includeChildren}),ee.create(e,s)}}})]}});Y.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Z({key:new oe("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Ud(n.selection)||t.view.dragging?null:ee.create(n.doc,[ye.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function vc({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var Gk=Y.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new oe(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?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 Z({key:e,appendTransaction:(i,s,o)=>{const{doc:l,tr:a,schema:c}=o,u=e.getState(o),d=l.content.size,h=c.nodes[n];if(u)return a.insert(d,h.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!vc({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!vc({node:o,types:r})}}})]}}),Yk=Y.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Kh(t,e),redo:()=>({state:t,dispatch:e})=>qh(t,e)}},addProseMirrorPlugins(){return[jk(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()}}}),Xk=Y.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(Ew.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(xw.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Nh.configure(this.options.bulletList)),this.options.code!==!1&&i.push(Ow.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(bh.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(Dw.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(Wk.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(Kk.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(Iw.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(wh.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Yk.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(Lw.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push($w.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Rh.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Bh.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(Oh.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push($h.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(xk.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(Ck.configure(this.options.strike)),this.options.text!==!1&&i.push(Mk.configure(this.options.text)),this.options.underline!==!1&&i.push(Vh.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(Gk.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),dS=Xk,Qk=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Zk=be.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",X(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,s,o;const l=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",a=(i=(r=t.attrs)==null?void 0:r.alt)!=null?i:"",c=(o=(s=t.attrs)==null?void 0:s.title)!=null?o:"";return c?`![${a}](${l} "${c}")`:`![${a}](${l})`}
156,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;return({node:i,getPos:s,HTMLAttributes:o,editor:l})=>{const a=document.createElement("img");Object.entries(o).forEach(([d,h])=>{if(h!=null)switch(d){case"width":case"height":break;default:a.setAttribute(d,h);break}}),a.src=o.src;const c=new r0({element:a,editor:l,node:i,getPos:s,onResize:(d,h)=>{a.style.width=`${d}px`,a.style.height=`${h}px`},onCommit:(d,h)=>{const f=s();f!==void 0&&this.editor.chain().setNodeSelection(f).updateAttributes(this.name,{width:d,height:h}).run()},onUpdate:(d,h,f)=>d.type===i.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),u=c.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",a.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},c}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[ch({find:Qk,type:this.t
156ype,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),hS=Zk,ex=Y.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).some(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),fS=ex,tx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,nx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,rx=tt.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",X(this.options.HTMLAttributes,t),0]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,n){const i=/^(==)([^=]+)(==)/.exec(t);if(i){const s=i[2].trim(),o=n.inlineTokens(s);return{type:"highlight",raw:i[0],text:s,tokens:o}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}}
156,addInputRules(){return[mn({find:tx,type:this.type})]},addPasteRules(){return[qt({find:nx,type:this.type})]}}),pS=rx,ix=20,Jh=(t,e=0)=>{const n=[];return!t.children.length||e>ix||Array.from(t.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...Jh(r,e+1))}),n},sx=t=>{if(!t.children.length)return;const e=Jh(t);e&&e.forEach(n=>{var r,i;const s=n.getAttribute("style"),o=(i=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:i.getAttribute("style");n.setAttribute("style",`${o};${s}`)})},ox=tt.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&sx(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",X(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(s=>!!s))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),lx=Y.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const s=r[i].split(":");if(s.length>=2){const o=s[0].trim().toLowerCase(),l=s.slice(1).join(":").trim();if(o==="background-color")return l.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),Gh=Y.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const r=n.split(";").map(i=>i.trim()).filter(Boolean);for(let i=r.length-1;i>=0;i-=1){const s=r[i].split(":");if(s.length>=2){const o=s[0].trim().toLowerCase(),l=s.slice(1).join(":").trim();if(o==="color")return l.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),ax=Y.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),cx=Y.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),ux=Y.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});Y.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(lx.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(Gh.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(ax.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(cx.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(ux.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(ox.configure(this.options.textStyle)),t}});var mS=Gh,gS=Jk;let To,Ao;if(typeof WeakMap<"u"){let t=new WeakMap;To=e=>t.get(e),Ao=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;To=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Ao=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var ce=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 s=r+1,o=i+1;for(let l=1;s<this.width&&this.map[e+l]==n;l++)s++;for(let l=1;o<this.height&&this.map[e+this.width*l]==n;l++)o++;return{left:r,top:i,right:s,bottom:o}}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:s,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:o,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,o=this.map[s];n[o]||(n[o]=!0,!(i==t.left&&i&&this.map[s-1]==o||r==t.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const l=(t+1)*this.width;for(;o<l&&this.map[o]<i;)o++;return o==l?s-1:this.map[o]}i=s}}static get(t){return To(t)||Ao(t,dx(t))}};function dx(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=hx(t),n=t.childCount,r=[];let i=0,s=null;const o=[];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 m=d.child(p),{colspan:g,rowspan:y,colwidth:w}=m.attrs;for(let v=0;v<y;v++){if(v+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:y-v});break}const T=i+v*e;for(let S=0;S<g;S++){r[T+S]==0?r[T+S]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:g-S});const R=w&&w[S];if(R){const C=(T+S)%e*2,$=o[C];$==null||$!=R&&o[C+1]==1?(o[C]=R,o[C+1]=1):$==R&&o[C+1]++}}}i+=g,u+=m.nodeSize}const h=(c+1)*e;let f=0;for(;
156i<h;)r[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:c,n:f}),u++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new ce(e,n,r,s);let a=!1;for(let c=0;!a&&c<o.length;c+=2)o[c]!=null&&o[c+1]<n&&(a=!0);return a&&fx(l,o,t),l}function hx(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let o=0;o<r;o++){const l=t.child(o);for(let a=0;a<l.childCount;a++){const c=l.child(a);o+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const l=i.child(o);s+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function fx(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const o=n.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=o.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=px(a)))[c]=u)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function px(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Le(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Bt=new oe("selectingCells");function gn(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 mx(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 nt(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 ns(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=gn(e.$head)||gx(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function gx(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 Oo(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function yx(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Ml(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Yh(t,e,n){const r=t.node(-1),i=ce.get(r),s=t.start(-1),o=i.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function yn(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 Xh(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 bx(t,e,n){const r=Le(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 ne=class bt extends _{constructor(e,n=e){const r=e.node(-1),i=ce.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),l=e.node(0),a=i.cellsInRect(o).filter(u=>u!=n.pos-s);a.unshift(n.pos-s);const c=a.map(u=>{const d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=s+u+1;return new Iu(l.resolve(h),l.resolve(h+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(Oo(r)&&Oo(i)&&Ml(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?bt.rowSelection(r,i):s&&this.isColSelection()?bt.colSelection(r,i):new bt(r,i)}return H.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=ce.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];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 h=n.map[u];if(s[h])continue;s[h]=!0;const f=n.findCell(h);let p=e.nodeAt(h);if(!p)throw new RangeError(`No cell with offset ${h} found`);const m=i.left-f.left,g=f.right-i.right;if(m>0||g>0){let y=p.attrs;if(m>0&&(y=yn(y,0,m)),g>0&&(y=yn(y,y.colspan-g,g)),f.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(f.top<i.top||f.bottom>i.bottom){const y={...p.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?p=p.type.createAndFill(y):p=p.type.create(y,p.content)}c.push(p)}o.push(e.child(a).copy(x.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new A(x.from(l),1,1)}replace(e,n=A.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:l,$to:a}=i[o],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),o?A.empty:n)}const s=_.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new A(x.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=ce.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;
vendor: 4,248 bytes, line 156
156o++)e(n.nodeAt(s[o]),i+s[o])}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;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=ce.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(n.pos-s),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(s+i.map[o.left])),l.bottom<i.height&&(n=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(s+i.map[l.left])),o.bottom<i.height&&(e=a.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new bt(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=ce.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==n.width}eq(e){return e instanceof bt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=ce.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(n.pos-s),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(s+i.map[o.top*i.width])),l.right<i.width&&(n=a.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(s+i.map[l.top*i.width])),o.right<i.width&&(e=a.resolve(s+i.map[i.width*(o.top+1)-1]))),new bt(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new bt(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new bt(e.resolve(n),e.resolve(r))}getBookmark(){return new wx(this.$anchorCell.pos,this.$headCell.pos)}};ne.prototype.visible=!1;_.jsonID("cell",ne);var wx=class Qh{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Qh(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&&Ml(n,r)?new ne(n,r):_.near(r,1)}};function kx(t){if(!(t.selection instanceof ne))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(ye.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ee.create(t.doc,e)}function xx({$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 s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function Sx({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function vx(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof L&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=ne.create(i,r.from);else if(o=="row"){const l=i.resolve(r.from+1);s=ne.rowSelection(l,l)}else if(!n){const l=ce.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];s=ne.create(i,a+1,c)}}else r instanceof H&&xx(r)?s=H.create(i,r.from):r instanceof H&&Sx(r)&&(s=H.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const Cx=new oe("fix-tables");function Zh(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,l=0;o<s;o++){const a=e.child(o);for(let c=l,u=Math.min(i,o+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)?Zh(t.child(l),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function ef(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=Mx(t,i,s,n))};return e?e.doc!=t.doc&&Zh(e.doc,t.doc,0,r):t.doc.descendants(r),n}function Mx(t,e,n,r){const i=ce.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let a=0;a<i.height;a++)s.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 h=0;h<d.rowspan;h++)s[c.row+h]+=c.n;
156r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,yn(d,d.colspan-c.n,c.n))}else if(c.type=="missing")s[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 o,l;for(let a=0;a<s.length;a++)s[a]&&(o==null&&(o=a),l=a);for(let a=0,c=n+1;a<i.height;a++){const u=e.child(a),d=c+u.nodeSize,h=s[a];if(h>0){let f="cell";u.firstChild&&(f=u.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<h;g++){const y=Le(t.schema)[f].createAndFill();y&&p.push(y)}const m=(a==0||o==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(m),p)}c=d}return r.setMeta(Cx,{fixTables:!0})}function dt(t){const e=t.selection,n=ns(t),r=n.node(-1),i=n.start(-1),s=ce.get(r);return{...e instanceof ne?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function tf(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;bx(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const l=o*e.width+i;
vendor: 11,902 bytes, line 156
156if(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,Xh(c.attrs,i-e.colCount(a))),o+=c.attrs.rowspan-1}else{const a=s==null?Le(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,c=e.positionAt(o,i,r);t.insert(t.mapping.map(n+c),a.createAndFill())}}return t}function Ex(t,e){if(!nt(t))return!1;if(e){const n=dt(t);e(tf(t.tr,n,n.left))}return!0}function Tx(t,e){if(!nt(t))return!1;if(e){const n=dt(t);e(tf(t.tr,n,n.right))}return!0}function Ax(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const l=o*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(s).map(r+a),null,yn(u,i-e.colCount(a)));else{const d=t.mapping.slice(s).map(r+a);t.delete(d,d+c.nodeSize)}o+=u.rowspan}}function Ox(t,e){if(!nt(t))return!1;if(e){const n=dt(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;Ax(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=ce.get(s)}e(r)}return!0}function Nx(t,e,n){var r;const i=Le(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function nf(t,{map:e,tableStart:n,table:r},i){let s=n;for(let c=0;c<i;c++)s+=r.child(c).nodeSize;const o=[];let l=i>0?-1:0;Nx(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],h=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{var a;const d=l==null?Le(r.type.schema).cell:(a=r.nodeAt(e.map[u+l*e.width]))===null||a===void 0?void 0:a.type,h=d?.createAndFill();h&&o.push(h)}return t.insert(s,Le(r.type.schema).row.create(null,o)),t}function Rx(t,e){if(!nt(t))return!1;if(e){const n=dt(t);e(nf(t.tr,n,n.top))}return!0}function Dx(t,e){if(!nt(t))return!1;if(e){const n=dt(t);e(nf(t.tr,n,n.bottom))}return!0}function Ix(t,{map:e,table:n,tableStart:r},i){let s=0;for(let c=0;c<i;c++)s+=n.child(c).nodeSize;const o=s+n.child(i).nodeSize,l=t.mapping.maps.length;t.delete(s+r,o+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 h=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<e.height&&d==e.map[u+e.width]){const h=n.nodeAt(d),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),m=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(l).map(r+m),p),c+=f.colspan-1}}}}function Lx(t,e){if(!nt(t))return!1;if(e){const n=dt(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;Ix(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=ce.get(n.table)}e(r)}return!0}function Cc(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function Px({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,o=(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[s]==n[s-1]||r.right<t&&n[l]==n[l+1])return!0;s+=t,l+=t}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[o]==n[o+t])return!0;i++,o++}return!1}function Mc(t,e){const n=t.selection;if(!(n instanceof ne)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=dt(t),{map:i}=r;if(Px(i,r))return!1;if(e){const s=t.tr,o={};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 h=i.map[u*i.width+d],f=r.table.nodeAt(h);if(!(o[h]||!f))if(o[h]=!0,a==null)a=h,c=f;else{Cc(f)||(l=l.append(f.content));const p=s.mapping.map(h+r.tableStart);s.delete(p,p+f.nodeSize)}}if(a==null||c==null)return!0;if(s.setNodeMarkup(a+r.tableStart,null,{...Xh(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=Cc(c)?a+1:u;s.replaceWith(d+r.tableStart,u+r.tableStart,l)}s.setSelection(new ne(s.doc.resolve(a+r.tableStart))),e(s)}return!0}function Ec(t,e){const n=Le(t.schema);return zx(({node:r})=>n[r.type.spec.tableRole])(t,e)}function zx(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof ne){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var o;if(i=mx(r.$from),!i)return!1;s=(o=gn(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||s==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=dt(e),d=e.tr;for(let f=0;f<u.right-u.left;f++)a.push(c?{...l,colwidth:c&&c[f]?[c[f]]:null}:l);let h;for(let f=u.top;f<u.bottom;f++){let p=u.map.positionAt(f,u.left,u.table);f==u.top&&(p+=i.nodeSize);for(let m=u.left,g=0;m<u.right;m++,g++)m==u.left&&f==u.top||d.insert(h=d.mapping.map(p+u.tableStart,1),t({node:i,row:f,col:m}).createAndFill(a[g]))}d.setNodeMarkup(s,t({node:i,row:u.top,col:u.left}),a[0]),r instanceof ne&&d.setSelection(new ne(d.doc.resolve(r.$anchorCell.pos),h?d.doc.resolve(h):void 0)),n(d)}return!0}}function Bx(t,e){return function(n,r){if(!nt(n))return!1;const i=ns(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof ne?n.selection.forEachCell((o,l)=>{o.attrs[t]!==e&&s.setNodeMarkup(l,null,{...o.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function Hx(t){return function(e,n){if(!nt(e))return!1;if(n){const r=Le(e.schema),i=dt(e),s=e.tr,o=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=o.map(a=>i.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[a],r.cell,l[a].attrs);if(s.steps.length===0)for(let a=0;a<o.length;a++)s.setNodeMarkup(i.tableStart+o[a],r.header_cell,l[a].attrs);n(s)}return!0}}function Tc(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 s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function pr(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Hx(t):function(n,r){if(!nt(n))return!1;if(r){const i=Le(n.schema),s=dt(n),o=n.tr,l=Tc("row",s,i),a=Tc("column",s,i),c=(t==="column"?l:t==="row"&&a)?1:0,u=t=="column"?{left:0,top:c,right:1,bottom:s.map.height}:t=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=t=="column"?a?i.cell:i.header_cell:t=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const f=h+s.tableStart,p=o.doc.nodeAt(f);p&&o.setNodeMarkup(f,d,p.attrs)}),r(o)}return!0}}pr("row",{useDeprecatedLogic:!0});pr("column",{useDeprecatedLogic:!0});const $x=pr("cell",{useDeprecatedLogic:!0});function _x(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 s=t.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function Ac(t){return function(e,n){if(!nt(e))return!1;const r=_x(ns(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(H.between(i,yx(i))).scrollIntoView())}return!0}}function Fx(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 Fr(t,e){const n=t.selection;if(!(n instanceof ne))return!1;if(e){const r=t.tr,i=Le(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new A(i,0,0))}),r.docChanged&&e(r)}return!0}function Vx(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),s=i.type.spec.tableRole,o=i.type.schema,l=[];if(s=="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=No(Le(o).row,new A(c,u,d)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?No(Le(o).row,new A(e,n,r)).content:e);else return null;return jx(o,l)}function jx(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:l,colspan:a}=s.child(o).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 s=Le(t).cell.createAndFill(),o=[];for(let l=n[i];l<r;l++)o.push(s);e[i]=e[i].append(x.from(o))}return{height:e.length,width:r,rows:e}}function No(t,e){const n=t.createAndFill();return new Bo(n).replace(0,n.content.size,e).doc}function Ux({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let l=0;l<n.length;l++){const a=n[l],c=[];for(let u=s[l]||0,d=0;u<r;d++){let h=a.child(d%a.childCount);u+h.attrs.colspan>r&&(h=h.type.createChecked(yn(h.attrs,h.attrs.colspan,u+h.attrs.colspan-r),h.content)),c.push(h),u+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[l+f]=(s[l+f]||0)+h.attrs.colspan}o.push(x.from(c))}n=o,t=r}if(e!=i){const s=[];for(let o=0,l=0;o<i;o++,l++){const a=[],c=n[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);o+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),a.push(d)}s.push(x.from(a))}n=s,e=i}return{width:t,height:e,rows:n}}function Wx(t,e,n,r,i,s,o){const l=t.doc.type.schema,a=Le(l);let c,u;if(i>e.width)for(let d=0,h=0;d<e.height;d++){const f=n.child(d);h+=f.nodeSize;const p=[];let m;f.lastChild==null||f.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=u||(u=a.header_cell.createAndFill());for(let g=e.width;g<i;g++)p.push(m);t.insert(t.mapping.slice(o).map(h-1+r),p)}if(s>e.height){const d=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const g=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==a.header_cell;d.push(g?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const h=a.row.create(null,x.from(d)),f=[];for(let p=e.height;p<s;p++)f.push(h);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(c||u)}function Oc(t,e,n,r,i,s,o,l){if(o==0||o==e.height)return!1;let a=!1;for(let c=i;c<s;c++){const u=o*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;const h=n.nodeAt(d),{top:f,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...h.attrs,rowspan:o-f}),t.insert(t.mapping.slice(l).map(e.positionAt(o,p,n)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-o})),c+=h.attrs.colspan-1}}return a}function Nc(t,e,n,r,i,s,o,l){if(o==0||o==e.width)return!1;let a=!1;for(let c=i;c<s;c++){const u=c*e.width+o,d=e.map[u];if(e.map[u-1]==d){a=!0;const h=n.nodeAt(d),f=e.colCount(d),p=t.mapping.slice(l).map(d+r);t.setNodeMarkup(p,null,yn(h.attrs,o-f,h.attrs.colspan-(o-f))),t.insert(p+h.nodeSize,h.type.createAndFill(yn(h.attrs,0,o-f))),c+=h.attrs.rowspan-1}}return a}function Rc(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let o=ce.get(s);const{top:l,left:a}=r,c=a+i.width,u=l+i.height,d=t.tr;let h=0;function f(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");o=ce.get(s),h=d.mapping.maps.length}Wx(d,o,s,n,c,u,h)&&f(),Oc(d,o,s,n,a,c,l,h)&&f(),Oc(d,o,s,n,a,c,u,h)&&f(),Nc(d,o,s,n,l,u,a,h)&&f(),Nc(d,o,s,n,l,u,c,h)&&f();for(let p=l;p<u;p++){const m=o.positionAt(p,a,s),g=o.positionAt(p,c,s);d.replace(d.mapping.slice(h).map(m+n),d.mapping.slice(h).map(g+n),new A(i.rows[p-l],
1560,0))}f(),d.setSelection(new ne(d.doc.resolve(n+o.positionAt(l,a,s)),d.doc.resolve(n+o.positionAt(u-1,c-1,s)))),e(d)}const Kx=Zo({ArrowLeft:Vr("horiz",-1),ArrowRight:Vr("horiz",1),ArrowUp:Vr("vert",-1),ArrowDown:Vr("vert",1),"Shift-ArrowLeft":jr("horiz",-1),"Shift-ArrowRight":jr("horiz",1),"Shift-ArrowUp":jr("vert",-1),"Shift-ArrowDown":jr("vert",1),Backspace:Fr,"Mod-Backspace":Fr,Delete:Fr,"Mod-Delete":Fr});function Yr(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Vr(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof ne)return Yr(n,r,_.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=rf(i,t,e);if(o==null)return!1;if(t=="horiz")return Yr(n,r,_.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(o),a=Yh(l,t,e);let c;return a?c=_.near(a,1):e<0?c=_.near(n.doc.resolve(l.before(-1)),-1):c=_.near(n.doc.resolve(l.after(-1)),1),Yr(n,r,c)}}}function jr(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof ne)o=s;else{const a=rf(i,t,e);if(a==null)return!1;o=new ne(n.doc.resolve(a))}const l=Yh(o.$headCell,t,e);return l?Yr(n,r,new ne(o.$anchorCell,l)):!1}}function qx(t,e){const n=t.state.doc,r=gn(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new ne(r))),!0):!1}function Jx(t,e,n){if(!nt(t.state))return!1;let r=Vx(n);const i=t.state.selection;if(i instanceof ne){r||(r={width:1,height:1,rows:[x.from(No(Le(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),l=ce.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=Ux(r,l.right-l.left,l.bottom-l.top),Rc(t.state,t.dispatch,o,l,r),!0}else if(r){const s=ns(t.state),o=s.start(-1);return Rc(t.state,t.dispatch,o,ce.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function Gx(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Dc(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof ne)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=gn(t.state.selection.$anchor))!=null&&((n=Vs(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(a,c){let u=Vs(t,c);const d=Bt.getState(t.state)==null;if(!u||!Ml(a,u))if(d)u=a;else return;const h=new ne(a,u);if(d||!t.state.selection.eq(h)){const f=t.state.tr.setSelection(h);d&&f.setMeta(Bt,a.pos),t.dispatch(f)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",l),Bt.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Bt,-1))}function l(a){const c=a,u=Bt.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(Dc(t,c.target)!=r&&(d=Vs(t,e),!d))return o();d&&s(d,c)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",l)}function rf(t,e,n){if(!(t.state.selection instanceof H))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=r.before(i),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?o:null}}return null}function Dc(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Vs(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&&gn(t.state.doc.resolve(r))||gn(t.state.doc.resolve(i))}var Yx=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")),Ro(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,Ro(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Ro(t,e,n,r,i,s){let o=0,l=!0,a=e.firstChild;const c=t.firstChild;if(c){for(let d=0,h=0;d<c.childCount;d++){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let m=0;m<f;m++,h++){const g=i==h?s:p&&p[m],y=g?g+"px":"";if(o+=g||r,g||(l=!1),a)a.style.width!=y&&(a.style.width=y),a=a.nextSibling;else{const w=document.createElement("col");w.style.width=y,e.appendChild(w)}}}for(;a;){var u;const d=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=d}l?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const je=new oe("tableColumnResizing");function Xx({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=Yx,lastColumnResizable:i=!0}={}){const s=new Z({key:je,state:{init(o,l){var a;const c=(a=s.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=Le(l.schema).table.name;return r&&c&&(c[u]=(d,h)=>new r(d,n,h)),new Qx(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=je.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{Zx(o,l,t,i)},mouseleave:o=>{e1(o)},mousedown:(o,l)=>{t1(o,l,e,n)}},decorations:o=>{const l=je.getState(o);if(l&&l.activeHandle>-1)return o1(o,l.activeHandle)},nodeViews:{}}});return s}var Qx=class Xr{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(je);if(r&&r.setHandle!=null)return new Xr(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Xr(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);
156return Oo(e.doc.resolve(i))||(i=-1),new Xr(i,n.dragging)}return n}};function Zx(t,e,n,r){if(!t.editable)return;const i=je.getState(t.state);if(i&&!i.dragging){const s=r1(e.target);let o=-1;if(s){const{left:l,right:a}=s.getBoundingClientRect();e.clientX-l<=n?o=Ic(t,e,"left",n):a-e.clientX<=n&&(o=Ic(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const l=t.state.doc.resolve(o),a=l.node(-1),c=ce.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}sf(t,o)}}}function e1(t){if(!t.editable)return;const e=je.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&sf(t,-1)}function t1(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=je.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=t.state.doc.nodeAt(o.activeHandle),a=n1(t,o.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(je,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const h=je.getState(t.state);h?.dragging&&(i1(t,h.activeHandle,Lc(h.dragging,d,n)),t.dispatch(t.state.tr.setMeta(je,{setDragging:null})))}function u(d){if(!d.which)return c(d);const h=je.getState(t.state);if(h&&h.dragging){const f=Lc(h.dragging,d,n);Pc(t,h.activeHandle,f,r)}}return Pc(t,o.activeHandle,a,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),e.preventDefault(),!0}function n1(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,l=n;if(r)for(let a=0;a<n;a++)r[a]&&(o-=r[a],l--);return o/l}function r1(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Ic(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,l=gn(t.state.doc.resolve(o));if(!l)return-1;if(n=="right")return l.pos;const a=ce.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 Lc(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function sf(t,e){t.dispatch(t.state.tr.setMeta(je,{setHandle:e}))}function i1(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=ce.get(i),o=r.start(-1),l=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+l;if(c&&s.map[u]==s.map[u-s.width])continue;const d=s.map[u],h=i.nodeAt(d).attrs,f=h.colspan==1?0:l-s.colCount(d);if(h.colwidth&&h.colwidth[f]==n)continue;const p=h.colwidth?h.colwidth.slice():s1(h.colspan);p[f]=n,a.setNodeMarkup(o+d,null,{...h,colwidth:p})}a.docChanged&&t.dispatch(a)}function Pc(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),l=ce.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let a=t.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Ro(s,a.firstChild,a,r,l,n)}function s1(t){return Array(t).fill(0)}function o1(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return ee.empty;const s=ce.get(i),o=r.start(-1),l=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=l+c*s.width;if((l==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){var a;const d=s.map[u],h=o+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((a=je.getState(t))===null||a===void 0)&&a.dragging&&n.push(ye.node(o+d,o+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(ye.widget(h,f))}}return ee.create(t.doc,n)}function l1({allowTableNodeSelection:t=!1}={}){return new Z({key:Bt,state:{init(){return null},apply(e,n){const r=e.getMeta(Bt);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:kx,handleDOMEvents:{mousedown:Gx},createSelectionBetween(e){return Bt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:qx,handleKeyDown:Kx,handlePaste:Jx},appendTransaction(e,n,r){return vx(r,ef(r,n),t)}})}function Fi(t){return t==="left"||t==="right"||t==="center"?t:null}function a1(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return Fi(e||n)}function c1(t){return Fi(t?.align)}function of(){return{default:null,parseHTML:t=>a1(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}var lf=be.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const r=t.getAttribute("colwidth"),i=r?r.split(",").map(s=>parseInt(s,10)):null;if(!i){const s=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&s&&s[o]){const l=s[o].getAttribute("width");return l?[parseInt(l,10)]:null}}return i}},align:of()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",X(this.options.HTMLAttributes,t),0]}}),af=be.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}},align:of()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",X(this.options.HTMLAttributes,t),0]}}),cf=be.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",X(this.options.HTMLAttributes,t),0]}});function Do(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function zc(t,e,n,r,i,s){var o;let l=0,a=!0,c=e.firstChild;const u=t.firstChild;if(u!==null)for(let h=0,f=0;h<u.childCount;h+=1){const{colspan:p,colwidth:m}=u.child(h).attrs;for(let g=0;g<p;g+=1,f+=1){const y=i===f?s:m&&m[g],w=y?`${y}px`:"";
156if(l+=y||r,y||(a=!1),c){if(c.style.width!==w){const[v,T]=Do(r,y);c.style.setProperty(v,T)}c=c.nextSibling}else{const v=document.createElement("col"),[T,S]=Do(r,y);v.style.setProperty(T,S),e.appendChild(v)}}}for(;c;){const h=c.nextSibling;(o=c.parentNode)==null||o.removeChild(c),c=h}const d=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);a&&!d?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}var u1=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,s]of Object.entries(r))s!=null&&(i==="style"?this.table.style.cssText=String(s):this.table.setAttribute(i,String(s)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),zc(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,zc(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 d1(t,e,n,r){let i=0,s=!0;const o=[],l=t.firstChild;if(!l)return{};for(let d=0,h=0;d<l.childCount;d+=1){const{colspan:f,colwidth:p}=l.child(d).attrs;for(let m=0;m<f;m+=1,h+=1){const g=n===h?r:p&&p[m];i+=g||e,g||(s=!1);const[y,w]=Do(e,g);o.push(["col",{style:`${y}: ${w}`}])}}const a=s?`${i}px`:"",c=s?"":`${i}px`;return{colgroup:["colgroup",{},...o],tableWidth:a,tableMinWidth:c}}function Bc(t,e){return t.createAndFill()}function h1(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 f1(t,e,n,r,i){const s=h1(t),o=[],l=[];for(let c=0;c<n;c+=1){const u=Bc(s.cell);if(u&&l.push(u),r){const d=Bc(s.header_cell);d&&o.push(d)}}const a=[];for(let c=0;c<e;c+=1)a.push(s.row.createChecked(null,r&&c===0?o:l));return s.table.createChecked(null,a)}function p1(t){return t instanceof ne}var Ur=({editor:t})=>{const{selection:e}=t.state;if(!p1(e))return!1;let n=0;const r=zd(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},m1="�";function g1(t){return(t||"").replace(/\s+/g," ").trim()}function y1(t,e,n={}){var r;const i=(r=n.cellLineSeparator)!=null?r:m1;if(!t||!t.content||t.content.length===0)return"";const s=[];t.content.forEach(m=>{const g=[];m.content&&m.content.forEach(y=>{let w="";y.content&&Array.isArray(y.content)&&y.content.length>1?w=y.content.map(C=>e.renderChildren(C)).join(i):w=y.content?e.renderChildren(y.content):"";const v=g1(w),T=y.type==="tableHeader",S=c1(y.attrs);g.push({text:v,isHeader:T,align:S})}),s.push(g)});const o=s.reduce((m,g)=>Math.max(m,g.length),0);if(o===0)return"";const l=Array.from({length:o}).fill(0);s.forEach(m=>{var g;for(let y=0;y<o;y+=1){const v=(((g=m[y])==null?void 0:g.text)||"").length;v>l[y]&&(l[y]=v),l[y]<3&&(l[y]=3)}});const a=(m,g)=>m+" ".repeat(Math.max(0,g-m.length)),c=s[0],u=c.some(m=>m.isHeader),d=Array.from({length:o}).fill(null);s.forEach(m=>{var g;for(let y=0;y<o;y+=1)!d[y]&&((g=m[y])!=null&&g.align)&&(d[y]=m[y].align)});let h=`
157`;const f=Array.from({length:o}).map((m,g)=>u&&c[g]&&c[g].text||"");return h+=`| ${f.map((m,g)=>a(m,l[g])).join(" | ")} |
158`,h+=`| ${l.map((m,g)=>{const y=Math.max(3,m),w=d[g];return w==="left"?`:${"-".repeat(y)}`:w==="right"?`${"-".repeat(y)}:`:w==="center"?`:${"-".repeat(y)}:`:"-".repeat(y)}).join(" | ")} |
159`,(u?s.slice(1):s).forEach(m=>{h+=`| ${Array.from({length:o}).fill(0).map((g,y)=>a(m[y]&&m[y].text||"",l[y])).join(" | ")} |
160`}),h}var b1=y1,w1=be.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:u1,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}=d1(t,this.options.cellMinWidth),s=e.style;function o(){return s||(r?`width: ${r}`:`min-width: ${i}`)}const l=["table",X(this.options.HTMLAttributes,e,{style:o()}),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((s,o)=>{var l;const a=Fi((l=r[o])!=null?l:s.align),c=a?{align:a}:{};i.push(e.createNode("tableHeader",c,[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}return t.rows&&t.rows.forEach(i=>{const s=[];i.forEach((o,l)=>{var a;const c=Fi((a=r[l])!=null?a:o.align),u=c?{align:c}:{};s.push(e.createNode("tableCell",u,[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>b1(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const o=f1(s.schema,t,e,n);if(i){const l=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(H.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Ex(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Tx(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Ox(t,e),addRowBefore:()=>({state:t,dispatch:e})=>Rx(t,e),addRowAfter:()=>({state:t,dispatch:e})=>Dx(t,e),deleteRow:()=>({state:t,dispatch:e})=>Lx(t,e),deleteTable:()=>({state:t,dispatch:e})=>Fx(t,e),mergeCells:()=>({state:t,dispatch:e})=>Mc(t,e),splitCell:()=>({state:t,dispatch:e})=>Ec(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>pr("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>pr("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>$x(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Mc(t,e)?!0:Ec(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Bx(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Ac(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Ac(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&ef(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=ne.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:Ur,"Mod-Backspace":Ur,Delete:Ur,"Mod-Delete":Ur}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Xx({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],l1({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 s=X(this.options.HTMLAttributes,i);return new e(n,this.options.cellMinWidth,r,s)}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:G(z(t,"tableRole",e))}}});Y.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(w1.configure(this.options.table)),this.options.tableCell!==!1&&t.push(lf.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(af.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(cf.configure(this.options.tableRow)),t}});var bS=cf,wS=af,kS=lf,xS=Fh,SS=_h,vS=Uk,k1=t=>ue({find:/--$/,replace:t??"—"}),x1=t=>ue({find:/\.\.\.$/,replace:t??"…"}),js=t=>ue({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"“"}),Us=t=>ue({find:/"$/,replace:t??"”"}),Ws=t=>ue({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"‘"}),Ks=t=>ue({find:/'$/,replace:t??"’"}),S1=t=>ue({find:/<-$/,replace:t??"←"}),v1=t=>ue({find:/->$/,replace:t??"→"}),C1=t=>ue({find:/\(c\)$/,replace:t??"©"}),M1=t=>ue({find:/\(tm\)$/,replace:t??"™"}),E1=t=>ue({find:/\(sm\)$/,replace:t??"℠"}),T1=t=>ue({find:/\(r\)$/,replace:t??"®"}),A1=t=>ue({find:/(?:^|\s)(1\/2)\s$/,replace:t??"½"}),O1=t=>ue({find:/\+\/-$/,replace:t??"±"}),N1=t=>ue({find:/!=$/,replace:t??"≠"}),R1=t=>ue({find:/<<$/,replace:t??"«"}),D1=t=>ue({find:/>>$/,replace:t??"»"}),I1=t=>ue({find:/\d+\s?([*x])\s?\d+$/,replace:t??"×"}),L1=t=>ue({find:/\^2$/,replace:t??"²"}),P1=t=>ue({find:/\^3$/,replace:t??"³"}),z1=t=>ue({find:/(?:^|\s)(1\/4)\s$/,replace:t??"¼"}),B1=t=>ue({find:/(?:^|\s)(3\/4)\s$/,replace:t??"¾"}),H1=Y.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(k1(this.options.emDash)),this.options.ellipsis!==!1&&n.push(x1(this.options.ellipsis));const r=this.editor.options.textDirection==="rtl";if((t=this.options.doubleQuotes)!=null&&t.rtl){const{open:i,close:s}=this.options.doubleQuotes.rtl;n.push(js(i)),n.push(Us(s))}else r?(n.push(js("”")),n.push(Us("“"))):(this.options.openDoubleQuote!==!1&&n.push(js(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&n.push(Us(this.options.closeDoubleQuote)));if((e=this.options.singleQuotes)!=null&&e.rtl){const{open:i,close:s}=this.options.singleQuotes.rtl;n.push(Ws(i)),n.push(Ks(s))}else r?(n.push(Ws("’")),n.push(Ks("‘"))):(this.options.openSingleQuote!==!1&&n.push(Ws(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&n.push(Ks(this.options.closeSingleQuote)));return this.options.leftArrow!==!1&&n.push(S1(this.options.leftArrow)),this.options.rightArrow!==!1&&n.push(v1(this.options.rightArrow)),this.options.copyright!==!1&&n.push(C1(this.options.copyright)),this.options.trademark!==!1&&n.push(M1(this.options.trademark)),this.options.servicemark!==!1&&n.push(E1(this.options.servicemark)),this.options.registeredTrademark!==!1&&n.push(T1(this.options.registeredTrademark)),this.options.oneHalf!==!1&&n.push(A1(this.options.oneHalf)),this.options.plusMinus!==!1&&n.push(O1(this.options.plusMinus)),this.options.notEqual!==!1&&n.push(N1(this.options.notEqual)),this.options.laquo!==!1&&n.push(R1(this.options.laquo)),this.options.raquo!==!1&&n.push(D1(this.options.raquo)),this.options.multiplication!==!1&&n.push(I1(this.options.multiplication)),this.options.superscriptTwo!==!1&&n.push(L1(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&n.push(P1(this.options.superscriptThree)),this.options.oneQuarter!==!1&&n.push(z1(this.options.oneQuarter)),this.options.threeQuarters!==!1&&n.push(B1(this.options.threeQuarters)),n}}),CS=H1,$1=tt.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",X(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),MS=$1,_1=tt.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",X(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),ES=_1,qs,Hc;function F1(){if(Hc)return qs;Hc=1;function t(b){return b instanceof Map?b.clear=b.delete=b.set=function(){throw new Error("map is read-only")}:b instanceof Set&&(b.add=b.clear=b.delete=function(){throw new Error("set is read-only")}),Object.freeze(b),Object.getOwnPropertyNames(b).forEach(k=>{const O=b[k],V=typeof O;(V==="object"||V==="function")&&!Object.isFrozen(O)&&t(O)}),b}class e{constructor(k){k.data===void 0&&(k.data={}),this.data=k.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(b){return b.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(b,...k){const O=Object.create(null);for(const V in b)O[V]=b[V];
vendor: 17,679 bytes, lines 160-162
160return k.forEach(function(V){for(const de in V)O[de]=V[de]}),O}const i="</span>",s=b=>!!b.scope,o=(b,{prefix:k})=>{if(b.startsWith("language:"))return b.replace("language:","language-");if(b.includes(".")){const O=b.split(".");return[`${k}${O.shift()}`,...O.map((V,de)=>`${V}${"_".repeat(de+1)}`)].join(" ")}return`${k}${b}`};class l{constructor(k,O){this.buffer="",this.classPrefix=O.classPrefix,k.walk(this)}addText(k){this.buffer+=n(k)}openNode(k){if(!s(k))return;const O=o(k.scope,{prefix:this.classPrefix});this.span(O)}closeNode(k){s(k)&&(this.buffer+=i)}value(){return this.buffer}span(k){this.buffer+=`<span class="${k}">`}}const a=(b={})=>{const k={children:[]};return Object.assign(k,b),k};class c{constructor(){this.rootNode=a(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(k){this.top.children.push(k)}openNode(k){const O=a({scope:k});this.add(O),this.stack.push(O)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(k){return this.constructor._walk(k,this.rootNode)}static _walk(k,O){return typeof O=="string"?k.addText(O):O.children&&(k.openNode(O),O.children.forEach(V=>this._walk(k,V)),k.closeNode(O)),k}static _collapse(k){typeof k!="string"&&k.children&&(k.children.every(O=>typeof O=="string")?k.children=[k.children.join("")]:k.children.forEach(O=>{c._collapse(O)}))}}class u extends c{constructor(k){super(),this.options=k}addText(k){k!==""&&this.add(k)}startScope(k){this.openNode(k)}endScope(){this.closeNode()}__addSublanguage(k,O){const V=k.root;O&&(V.scope=`language:${O}`),this.add(V)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function d(b){return b?typeof b=="string"?b:b.source:null}function h(b){return m("(?=",b,")")}function f(b){return m("(?:",b,")*")}function p(b){return m("(?:",b,")?")}function m(...b){return b.map(O=>d(O)).join("")}function g(b){const k=b[b.length-1];return typeof k=="object"&&k.constructor===Object?(b.splice(b.length-1,1),k):{}}function y(...b){return"("+(g(b).capture?"":"?:")+b.map(V=>d(V)).join("|")+")"}function w(b){return new RegExp(b.toString()+"|").exec("").length-1}function v(b,k){const O=b&&b.exec(k);return O&&O.index===0}const T=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function S(b,{joinWith:k}){let O=0;return b.map(V=>{O+=1;const de=O;let he=d(V),I="";for(;he.length>0;){const D=T.exec(he);if(!D){I+=he;break}I+=he.substring(0,D.index),he=he.substring(D.index+D[0].length),D[0][0]==="\\"&&D[1]?I+="\\"+String(Number(D[1])+de):(I+=D[0],D[0]==="("&&O++)}return I}).map(V=>`(${V})`).join(k)}const R=/\b\B/,C="[a-zA-Z]\\w*",$="[a-zA-Z_]\\w*",J="\\b\\d+(\\.\\d+)?",Oe="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",ht="\\b(0b[01]+)",rt="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Et=(b={})=>{const k=/^#![ ]*\//;return b.binary&&(b.begin=m(k,/.*\b/,b.binary,/\b.*/)),r({scope:"meta",begin:k,end:/$/,relevance:0,"on:begin":(O,V)=>{O.index!==0&&V.ignoreMatch()}},b)},we={begin:"\\\\[\\s\\S]",relevance:0},Ne={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[we]},Tt={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[we]},Xt={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},kr=function(b,k,O={}){const V=r({scope:"comment",begin:b,end:k,contains:[]},O);V.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const de=y("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return V.contains.push({begin:m(/[ ]+/,"(",de,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),V},ff=kr("//","$"),pf=kr("/\\*","\\*/"),mf=kr("#","$"),gf={scope:"number",begin:J,relevance:0},yf={scope:"number",begin:Oe,relevance:0},bf={scope:"number",begin:ht,relevance:0},wf={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[we,{begin:/\[/,end:/\]/,relevance:0,contains:[we]}]},kf={scope:"title",begin:C,relevance:0},xf={scope:"title",begin:$,relevance:0},Sf={begin:"\\.\\s*"+$,relevance:0};var xr=Object.freeze({__proto__:null,APOS_STRING_MODE:Ne,BACKSLASH_ESCAPE:we,BINARY_NUMBER_MODE:bf,BINARY_NUMBER_RE:ht,COMMENT:kr,C_BLOCK_COMMENT_MODE:pf,C_LINE_COMMENT_MODE:ff,C_NUMBER_MODE:yf,C_NUMBER_RE:Oe,END_SAME_AS_BEGIN:function(b){return Object.assign(b,{"on:begin":(k,O)=>{O.data._beginMatch=k[1]},"on:end":(k,O)=>{O.data._beginMatch!==k[1]&&O.ignoreMatch()}})},HASH_COMMENT_MODE:mf,IDENT_RE:C,MATCH_NOTHING_RE:R,METHOD_GUARD:Sf,NUMBER_MODE:gf,NUMBER_RE:J,PHRASAL_WORDS_MODE:Xt,QUOTE_STRING_MODE:Tt,REGEXP_MODE:wf,RE_STARTERS_RE:rt,SHEBANG:Et,TITLE_MODE:kf,UNDERSCORE_IDENT_RE:$,UNDERSCORE_TITLE_MODE:xf});function vf(b,k){b.input[b.index-1]==="."&&k.ignoreMatch()}function Cf(b,k){b.className!==void 0&&(b.scope=b.className,delete b.className)}function Mf(b,k){k&&b.beginKeywords&&(b.begin="\\b("+b.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",b.__beforeBegin=vf,b.keywords=b.keywords||b.beginKeywords,delete b.beginKeywords,b.relevance===void 0&&(b.relevance=0))}function Ef(b,k){Array.isArray(b.illegal)&&(b.illegal=y(...b.illegal))}function Tf(b,k){if(b.match){if(b.begin||b.end)throw new Error("begin & end are not supported with match");b.begin=b.match,delete b.match}}function Af(b,k){b.relevance===void 0&&(b.relevance=1)}const Of=(b,k)=>{if(!b.beforeMatch)return;if(b.starts)throw new Error("beforeMatch cannot be used with starts");const O=Object.assign({},b);Object.keys(b).forEach(V=>{delete b[V]}),b.keywords=O.keywords,b.begin=m(O.beforeMatch,h(O.begin)),b.starts={relevance:0,contains:[Object.assign(O,{endsParent:!0})]},b.relevance=0,delete O.beforeMatch},Nf=["of","and","for","in","not","or","if","then","parent","list","value"],Rf="keyword";function Tl(b,k,O=Rf){const V=Object.create(null);return typeof b=="string"?de(O,b.split(" ")):Array.isArray(b)?de(O,b):Object.keys(b).forEach(function(he){Object.assign(V,Tl(b[he],k,he))}),V;function de(he,I){k&&(I=I.map(D=>D.toLowerCase())),I.forEach(function(D){const F=D.split("|");V[F[0]]=[he,Df(F[0],F[1])]})}}function Df(b,k){return k?Number(k):If(b)?0:1}function If(b){return Nf.includes(b.toLowerCase())}const Al={},Qt=b=>{console.error(b)},Ol=(b,...k)=>{console.log(`WARN: ${b}`,...k)},kn=(b,k)=>{Al[`${b}/${k}`]||(console.log(`Deprecated as of ${b}. ${k}`),Al[`${b}/${k}`]=!0)},Sr=new Error;function Nl(b,k,{key:O}){let V=0;const de=b[O],he={},I={};for(let D=1;D<=k.length;D++)I[D+V]=de[D],he[D+V]=!0,V+=w(k[D-1]);b[O]=I,b[O]._emit=he,b[O]._multi=!0}function Lf(b){if(Array.isArray(b.begin)){if(b.skip||b.excludeBegin||b.returnBegin)throw Qt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Sr;if(typeof b.beginScope!="object"||b.beginScope===null)throw Qt("beginScope must be object"),Sr;Nl(b,b.begin,{key:"beginScope"}),b.begin=S(b.begin,{joinWith:""})}}function Pf(b){if(Array.isArray(b.end)){if(b.skip||b.excludeEnd||b.returnEnd)throw Qt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Sr;if(typeof b.endScope!="object"||b.endScope===null)throw Qt("endScope must be object"),Sr;Nl(b,b.end,{key:"endScope"}),b.end=S(b.end,{joinWith:""})}}function zf(b){b.scope&&typeof b.scope=="object"&&b.scope!==null&&(b.beginScope=b.scope,delete b.scope)}function Bf(b){zf(b),typeof b.beginScope=="string"&&(b.beginScope={_wrap:b.beginScope}),typeof b.endScope=="string"&&(b.endScope={_wrap:b.endScope}),Lf(b),Pf(b)}function Hf(b){function k(I,D){return new RegExp(d(I),"m"+(b.case_insensitive?"i":"")+(b.unicodeRegex?"u":"")+(D?"g":""))}class O{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(D,F){F.position=this.position++,this.matchIndexes[this.matchAt]=F,this.regexes.push([F,D]),this.matchAt+=w(D)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const D=this.regexes.map(F=>F[1]);this.matcherRe=k(S(D,{joinWith:"|"}),!0),this.lastIndex=0}exec(D){this.matcherRe.lastIndex=this.lastIndex;const F=this.matcherRe.exec(D);if(!F)return null;const ke=F.findIndex((Hn,is)=>is>0&&Hn!==void 0),fe=this.matchIndexes[ke];return F.splice(0,ke),Object.assign(F,fe)}}class V{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(D){if(this.multiRegexes[D])return this.multiRegexes[D];const F=new O;return this.rules.slice(D).forEach(([ke,fe])=>F.addRule(ke,fe)),F.compile(),this.multiRegexes[D]=F,F}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(D,F){this.rules.push([D,F]),F.type==="begin"&&this.count++}exec(D){const F=this.getMatcher(this.regexIndex);F.lastIndex=this.lastIndex;let ke=F.exec(D);if(this.resumingScanAtSamePosition()&&!(ke&&ke.index===this.lastIndex)){const fe=this.getMatcher(0);fe.lastIndex=this.lastIndex+1,ke=fe.exec(D)}return ke&&(this.regexIndex+=ke.position+1,this.regexIndex===this.count&&this.considerAll()),ke}}function de(I){const D=new V;return I.contains.forEach(F=>D.addRule(F.begin,{rule:F,type:"begin"})),I.terminatorEnd&&D.addRule(I.terminatorEnd,{type:"end"}),I.illegal&&D.addRule(I.illegal,{type:"illegal"}),D}function he(I,D){const F=I;if(I.isCompiled)return F;[Cf,Tf,Bf,Of].forEach(fe=>fe(I,D)),b.compilerExtensions.forEach(fe=>fe(I,D)),I.__beforeBegin=null,[Mf,Ef,Af].forEach(fe=>fe(I,D)),I.isCompiled=!0;let ke=null;return typeof I.keywords=="object"&&I.keywords.$pattern&&(I.keywords=Object.assign({},I.keywords),ke=I.keywords.$pattern,delete I.keywords.$pattern),ke=ke||/\w+/,I.keywords&&(I.keywords=Tl(I.keywords,b.case_insensitive)),F.keywordPatternRe=k(ke,!0),D&&(I.begin||(I.begin=/\B|\b/),F.beginRe=k(F.begin),!I.end&&!I.endsWithParent&&(I.end=/\B|\b/),I.end&&(F.endRe=k(F.end)),F.terminatorEnd=d(F.end)||"",I.endsWithParent&&D.terminatorEnd&&(F.terminatorEnd+=(I.end?"|":"")+D.terminatorEnd)),I.illegal&&(F.illegalRe=k(I.illegal)),I.contains||(I.contains=[]),I.contains=[].concat(...I.contains.map(function(fe){return $f(fe==="self"?I:fe)})),I.contains.forEach(function(fe){he(fe,F)}),I.starts&&he(I.starts,D),F.matcher=de(F),F}if(b.compilerExtensions||(b.compilerExtensions=[]),b.contains&&b.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language.  See documentation.");return b.classNameAliases=r(b.classNameAliases||{}),he(b)}function Rl(b){return b?b.endsWithParent||Rl(b.starts):!1}function $f(b){return b.variants&&!b.cachedVariants&&(b.cachedVariants=b.variants.map(function(k){return r(b,{variants:null},k)})),b.cachedVariants?b.cachedVariants:Rl(b)?r(b,{starts:b.starts?r(b.starts):null}):Object.isFrozen(b)?r(b):b}var _f="11.11.1";class Ff extends Error{constructor(k,O){super(k),this.name="HTMLInjectionError",this.html=O}}const rs=n,Dl=r,Il=Symbol("nomatch"),Vf=7,Ll=function(b){const k=Object.create(null),O=Object.create(null),V=[];let de=!0;const he="Could not find the language '{}', did you forget to load/include a language module?",I={disableAutodetect:!0,name:"Plain text",contains:[]};let D={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function F(E){return D.noHighlightRe.test(E)}function ke(E){let B=E.className+" ";B+=E.parentNode?E.parentNode.className:"";const K=D.languageDetectRe.exec(B);if(K){const re=At(K[1]);return re||(Ol(he.replace("{}",K[1])),Ol("Falling back to no-highlight mode for this block.",E)),re?K[1]:"no-highlight"}return B.split(/\s+/).find(re=>F(re)||At(re))}function fe(E,B,K){let re="",ge="";typeof B=="object"?(re=E,K=B.ignoreIllegals,ge=B.language):(kn("10.7.0","highlight(lang, code, ...args) has been deprecated."),kn("10.7.0",`Please use highlight(code, options) instead.
161https://github.com/highlightjs/highlight.js/issues/2277`),ge=E,re=B),K===void 0&&(K=!0);const Xe={code:re,language:ge};Cr("before:highlight",Xe);const Ot=Xe.result?Xe.result:Hn(Xe.language,Xe.code,K);return Ot.code=Xe.code,Cr("after:highlight",Ot),Ot}function Hn(E,B,K,re){const ge=Object.create(null);function Xe(N,P){return N.keywords[P]}function Ot(){if(!j.keywords){Ce.addText(ie);return}let N=0;j.keywordPatternRe.lastIndex=0;let P=j.keywordPatternRe.exec(ie),W="";for(;P;){W+=ie.substring(N,P.index);const Q=st.case_insensitive?P[0].toLowerCase():P[0],Re=Xe(j,Q);if(Re){const[ft,sp]=Re;if(Ce.addText(W),W="",ge[Q]=(ge[Q]||0)+1,ge[Q]<=Vf&&(Tr+=sp),ft.startsWith("_"))W+=P[0];else{const op=st.classNameAliases[ft]||ft;it(P[0],op)}}else W+=P[0];N=j.keywordPatternRe.lastIndex,P=j.keywordPatternRe.exec(ie)}W+=ie.substring(N),Ce.addText(W)}function Mr(){if(ie==="")return;let N=null;if(typeof j.subLanguage=="string"){if(!k[j.subLanguage]){Ce.addText(ie);return}N=Hn(j.subLanguage,ie,!0,Vl[j.subLanguage]),Vl[j.subLanguage]=N._top}else N=ss(ie,j.subLanguage.length?j.subLanguage:null);j.relevance>0&&(Tr+=N.relevance),Ce.__addSublanguage(N._emitter,N.language)}function Fe(){j.subLanguage!=null?Mr():Ot(),ie=""}function it(N,P){N!==""&&(Ce.startScope(P),Ce.addText(N),Ce.endScope())}function Hl(N,P){let W=1;const Q=P.length-1;for(;W<=Q;){if(!N._emit[W]){W++;continue}const Re=st.classNameAliases[N[W]]||N[W],ft=P[W];Re?it(ft,Re):(ie=ft,Ot(),ie=""),W++}}function $l(N,P){return N.scope&&typeof N.scope=="string"&&Ce.openNode(st.classNameAliases[N.scope]||N.scope),N.beginScope&&(N.beginScope._wrap?(it(ie,st.classNameAliases[N.beginScope._wrap]||N.beginScope._wrap),ie=""):N.beginScope._multi&&(Hl(N.beginScope,P),ie="")),j=Object.create(N,{parent:{value:j}}),j}function _l(N,P,W){let Q=v(N.endRe,W);if(Q){if(N["on:end"]){const Re=new e(N);N["on:end"](P,Re),Re.isMatchIgnored&&(Q=!1)}if(Q){for(;N.endsParent&&N.parent;)N=N.parent;return N}}if(N.endsWithParent)return _l(N.parent,P,W)}function ep(N){return j.matcher.regexIndex===0?(ie+=N[0],1):(us=!0,0)}function tp(N){const P=N[0],W=N.rule,Q=new e(W),Re=[W.__beforeBegin,W["on:begin"]];for(const ft of Re)if(ft&&(ft(N,Q),Q.isMatchIgnored))return ep(P);return W.skip?ie+=P:(W.excludeBegin&&(ie+=P),Fe(),!W.returnBegin&&!W.excludeBegin&&(ie=P)),$l(W,N),W.returnBegin?0:P.length}function np(N){const P=N[0],W=B.substring(N.index),Q=_l(j,N,W);if(!Q)return Il;const Re=j;j.endScope&&j.endScope._wrap?(Fe(),it(P,j.endScope._wrap)):j.endScope&&j.endScope._multi?(Fe(),Hl(j.endScope,N)):Re.skip?ie+=P:(Re.returnEnd||Re.excludeEnd||(ie+=P),Fe(),Re.excludeEnd&&(ie=P));do j.scope&&Ce.closeNode(),!j.skip&&!j.subLanguage&&(Tr+=j.relevance),j=j.parent;while(j!==Q.parent);return Q.starts&&$l(Q.starts,N),Re.returnEnd?0:P.length}function rp(){const N=[];for(let P=j;P!==st;P=P.parent)P.scope&&N.unshift(P.scope);N.forEach(P=>Ce.openNode(P))}let Er={};function Fl(N,P){const W=P&&P[0];if(ie+=N,W==null)return Fe(),0;if(Er.type==="begin"&&P.type==="end"&&Er.index===P.index&&W===""){if(ie+=B.slice(P.index,P.index+1),!de){const Q=new Error(`0 width match regex (${E})`);throw Q.languageName=E,Q.badRule=Er.rule,Q}return 1}if(Er=P,P.type==="begin")return tp(P);if(P.type==="illegal"&&!K){const Q=new Error('Illegal lexeme "'+W+'" for mode "'+(j.scope||"<unnamed>")+'"');throw Q.mode=j,Q}else if(P.type==="end"){const Q=np(P);if(Q!==Il)return Q}if(P.type==="illegal"&&W==="")return ie+=`
162`,1;if(cs>1e5&&cs>P.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ie+=W,W.length}const st=At(E);if(!st)throw Qt(he.replace("{}",E)),new Error('Unknown language: "'+E+'"');const ip=Hf(st);let as="",j=re||ip;const Vl={},Ce=new D.__emitter(D);rp();let ie="",Tr=0,Zt=0,cs=0,us=!1;try{if(st.__emitTokens)st.__emitTokens(B,Ce);else{for(j.matcher.considerAll();;){cs++,us?us=!1:j.matcher.considerAll(),j.matcher.lastIndex=Zt;const N=j.matcher.exec(B);if(!N)break;const P=B.substring(Zt,N.index),W=Fl(P,N);Zt=N.index+W}Fl(B.substring(Zt))}return Ce.finalize(),as=Ce.toHTML(),{language:E,value:as,relevance:Tr,illegal:!1,_emitter:Ce,_top:j}}catch(N){if(N.message&&N.message.includes("Illegal"))return{language:E,value:rs(B),illegal:!0,relevance:0,_illegalBy:{message:N.message,index:Zt,context:B.slice(Zt-100,Zt+100),mode:N.mode,resultSoFar:as},_emitter:Ce};if(de)return{language:E,value:rs(B),illegal:!1,relevance:0,errorRaised:N,_emitter:Ce,_top:j};throw N}}function is(E){const B={value:rs(E),illegal:!1,relevance:0,_top:I,_emitter:new D.__emitter(D)};return B._emitter.addText(E),B}function ss(E,B){B=B||D.languages||Object.keys(k);const K=is(E),re=B.filter(At).filter(Bl).map(Fe=>Hn(Fe,E,!1));re.unshift(K);const ge=re.sort((Fe,it)=>{if(Fe.relevance!==it.relevance)return it.relevance-Fe.relevance;if(Fe.language&&it.language){if(At(Fe.language).supersetOf===it.language)return 1;if(At(it.language).supersetOf===Fe.language)return-1}return 0}),[Xe,Ot]=ge,Mr=Xe;return Mr.secondBest=Ot,Mr}function jf(E,B,K){const re=B&&O[B]||K;E.classList.add("hljs"),E.classList.add(`language-${re}`)}function ls(E){let B=null;const K=ke(E);if(F(K))return;if(Cr("before:highlightElement",{el:E,language:K}),E.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",E);return}if(E.children.length>0&&(D.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(E)),D.throwUnescapedHTML))throw new Ff("One of your co
162de blocks includes unescaped HTML.",E.innerHTML);B=E;const re=B.textContent,ge=K?fe(re,{language:K,ignoreIllegals:!0}):ss(re);E.innerHTML=ge.value,E.dataset.highlighted="yes",jf(E,K,ge.language),E.result={language:ge.language,re:ge.relevance,relevance:ge.relevance},ge.secondBest&&(E.secondBest={language:ge.secondBest.language,relevance:ge.secondBest.relevance}),Cr("after:highlightElement",{el:E,result:ge,text:re})}function Uf(E){D=Dl(D,E)}const Wf=()=>{vr(),kn("10.6.0","initHighlighting() deprecated.  Use highlightAll() now.")};function Kf(){vr(),kn("10.6.0","initHighlightingOnLoad() deprecated.  Use highlightAll() now.")}let Pl=!1;function vr(){function E(){vr()}if(document.readyState==="loading"){Pl||window.addEventListener("DOMContentLoaded",E,!1),Pl=!0;return}document.querySelectorAll(D.cssSelector).forEach(ls)}function qf(E,B){let K=null;try{K=B(b)}catch(re){if(Qt("Language definition for '{}' could not be registered.".replace("{}",E)),de)Qt(re);else throw re;K=I}K.name||(K.name=E),k[E]=K,K.rawDefinition=B.bind(null,b),K.aliases&&zl(K.aliases,{languageName:E})}function Jf(E){delete k[E];for(const B of Object.keys(O))O[B]===E&&delete O[B]}function Gf(){return Object.keys(k)}function At(E){return E=(E||"").toLowerCase(),k[E]||k[O[E]]}function zl(E,{languageName:B}){typeof E=="string"&&(E=[E]),E.forEach(K=>{O[K.toLowerCase()]=B})}function Bl(E){const B=At(E);return B&&!B.disableAutodetect}function Yf(E){E["before:highlightBlock"]&&!E["before:highlightElement"]&&(E["before:highlightElement"]=B=>{E["before:highlightBlock"](Object.assign({block:B.el},B))}),E["after:highlightBlock"]&&!E["after:highlightElement"]&&(E["after:highlightElement"]=B=>{E["after:highlightBlock"](Object.assign({block:B.el},B))})}function Xf(E){Yf(E),V.push(E)}function Qf(E){const B=V.indexOf(E);B!==-1&&V.splice(B,1)}function Cr(E,B){const K=E;
162V.forEach(function(re){re[K]&&re[K](B)})}function Zf(E){return kn("10.7.0","highlightBlock will be removed entirely in v12.0"),kn("10.7.0","Please use highlightElement now."),ls(E)}Object.assign(b,{highlight:fe,highlightAuto:ss,highlightAll:vr,highlightElement:ls,highlightBlock:Zf,configure:Uf,initHighlighting:Wf,initHighlightingOnLoad:Kf,registerLanguage:qf,unregisterLanguage:Jf,listLanguages:Gf,getLanguage:At,registerAliases:zl,autoDetection:Bl,inherit:Dl,addPlugin:Xf,removePlugin:Qf}),b.debugMode=function(){de=!1},b.safeMode=function(){de=!0},b.versionString=_f,b.regex={concat:m,lookahead:h,either:y,optional:p,anyNumberOfTimes:f};for(const E in xr)typeof xr[E]=="object"&&t(xr[E]);return Object.assign(b,xr),b},xn=Ll({});return xn.newInstance=()=>Ll({}),qs=xn,xn.HighlightJS=xn,xn.default=xn,qs}var V1=F1();const j1=ap(V1);function uf(t,e=[]){return t.flatMap(n=>{const r=[...e,...n.properties?n.properties.className:[]];return n.children?uf(n.children,r):{text:n.value,classes:r}})}function $c(t){return t.value||t.children||[]}function U1(t){return!!j1.getLanguage(t)}function _c({doc:t,name:e,lowlight:n,defaultLanguage:r}){const i=[];return ho(t,s=>s.type.name===e).forEach(s=>{var o;let l=s.pos+1;const a=s.node.attrs.language||r,c=n.listLanguages(),u=a&&(c.includes(a)||U1(a)||(o=n.registered)!=null&&o.call(n,a))?$c(n.highlight(a,s.node.textContent)):$c(n.highlightAuto(s.node.textContent));uf(u).forEach(d=>{const h=l+d.text.length;if(d.classes.length){const f=ye.inline(l,h,{class:d.classes.join(" ")});i.push(f)}l=h})}),ee.create(t,i)}function W1(t){return typeof t=="function"}function K1({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(i=>W1(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new Z({key:new oe("lowlight"),state:{init:(i,{doc:s})=>_c({doc:s,name:t,lowlight:e,defaultLanguage:n}),apply:(i,s,o,l)=>{const a=o.selection.$head.parent.type.name,c=l.selection.$head.parent.type.name,u=ho(o.doc,h=>h.type.name===t),d=ho(l.doc,h=>h.type.name===t);return i.docChanged&&([a,c].includes(t)||d.length!==u.length||i.steps.some(h=>h.from!==void 0&&h.to!==void 0&&u.some(f=>f.pos>
162=h.from&&f.pos+f.node.nodeSize<=h.to)))?_c({doc:i.doc,name:t,lowlight:e,defaultLanguage:n}):s.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var q1=bh.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var t;return[...((t=this.parent)==null?void 0:t.call(this))||[],K1({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),TS=q1,J1=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/,G1=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g,El=t=>t.match(J1),Fc=(t,e)=>e?"https://www.youtube-nocookie.com/embed/videoseries?list=":t?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",Y1=t=>{const{url:e,allowFullscreen:n,autoplay:r,ccLanguage:i,ccLoadPolicy:s,controls:o,disableKBcontrols:l,enableIFrameApi:a,endTime:c,interfaceLanguage:u,ivLoadPolicy:d,loop:h,modestBranding:f,nocookie:p,origin:m,playlist:g,progressBarColor:y,startAt:w,rel:v}=t;if(!El(e))return null;if(e.includes("/embed/"))return e;if(e.includes("youtu.be")){const $=e.split("/").pop();return $?`${Fc(p)}${$}`:null}const S=/(?:(v|list)=|shorts\/)([-\w]+)/gm.exec(e);if(!S||!S[2])return null;let R=`${Fc(p,S[1]==="list")}${S[2]}`;const C=[];return n===!1&&C.push("fs=0"),r&&C.push("autoplay=1"),i&&C.push(`cc_lang_pref=${i}`),s&&C.push("cc_load_policy=1"),o||C.push("controls=0"),l&&C.push("disablekb=1"),a&&C.push("enablejsapi=1"),c&&C.push(`end=${c}`),u&&C.push(`hl=${u}`),d&&C.push(`iv_load_policy=${d}`),h&&C.push("loop=1"),f&&C.push("modestbranding=1"),m&&C.push(`origin=${m}`),g&&C.push(`playlist=${g}`),w&&C.push(`start=${w}`),y&&C.push(`color=${y}`),v!==void 0&&C.push(`rel=${v}`),C.length&&(R+=`${S[1]==="list"?"&":"?"}${C.join("&")}`),R},X1=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 o=e.searchParams.get("list");if(!o)return null;r=`https://www.youtube.com/playlist?list=${o}`}else{const o=e.pathname.match(/^\/embed\/([\w-]+)$/);if(!o?.[1])return null;r=`https://www.youtube.com/watch?v=${o[1]}`}if(!El(r))return null;const i={src:r},s=e.searchParams.get("start");if(s){const o=Number.parseInt(s,10);Number.isNaN(o)||(i.start=o)}return i},Vc=t=>{if(!t)return null;const e=Number.parseInt(t,10);return Number.isNaN(e)?null:e},jc=t=>{const e=t.getAttribute("src");if(!e)return null;const n=X1(e);return n||{src:e}},Q1=be.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=jc(t))==null?void 0:e.src}},start:{default:0,parseHTML:t=>{var e;return(e=jc(t))==null?void 0:e.start}},width:{default:this.options.width,parseHTML:t=>Vc(t.getAttribute("width"))},height:{default:this.options.height,parseHTML:t=>Vc(t.getAttribute("height"))}}},parseHTML(){return[{tag:"div[data-youtube-video] iframe"}]},addCommands(){return{setYoutubeVideo:t=>({commands:e})=>El(t.src)?e.insertContent({type:this.name,attrs:t}):!1}},addPasteRules(){return this.options.addPasteHandler?[h0({find:G1,type:this.t
162ype,getAttributes:t=>({src:t.input})})]:[]},renderHTML({HTMLAttributes:t}){const e=Y1({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});return t.src=e,["div",{"data-youtube-video":""},["iframe",X(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)]]},...uh({nodeName:"youtube",allowedAttributes:["src","width","height","start"]})}),AS=Q1;function Z1(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,l=r-n,a=i,c=n;return new DOMRect(a,c,o,l)}var eS=class{constructor({editor:t,element:e,view:n,pluginKey:r="bubbleMenu",updateDelay:i=250,resizeDelay:s=60,shouldShow:o,appendTo:l,getReferencedVirtualElement:a,options:c}){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:h,from:f,to:p})=>{const{doc:m,selection:g}=h,{empty:y}=g,w=!m.textBetween(f,p).length&&rl(h.selection),v=this.element.contains(document.activeElement);return!(!(d.hasFocus()||v)||y||w||!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 h;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}d?.relatedTarget&&((h=this.element.parentNode)!=null&&h.contains(d.relatedTarget))||d?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(d,h)=>{const f=!h?.selection.eq(d.state.selection),p=!h?.doc.eq(d.state.doc);!f&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(d,f,p,h)},this.updateDelay))},this.updateHandler=(d,h,f,p)=>{const{composing:m}=d;if(m||!h&&!f)return;if(!this.getShouldShow(p)){this.hide();return}this.show(),this.updatePosition()},this.transactionHandler=({transaction:d})=>{const h=d.getMeta(this.pluginKey);h==="updatePosition"?this.updatePosition():h&&typeof h=="object"&&h.type==="updateOptions"?this.updateOptions(h.options):h==="hide"?this.hide():h==="show"&&(this.updatePosition(),this.show())};var u;this.editor=t,this.element=e,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=s,this.appendTo=l,this.scrollTarget=(u=c?.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,o&&(this.shouldShow=o),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.get
162ShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(Wc(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(Kc(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(qc(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(Jc(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(Gc(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(Yc(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(Xc(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(Qc(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}get virtualElement(){var t,e,n;const{selection:r}=this.editor.state,i=(t=this.getReferencedVirtualElement)==null?void 0:t.call(this);if(i)return i;if(!((n=(e=this.view)==null?void 0:e.dom)!=null&&n.parentNode))return;const s=qd(this.view,r.from,r.to);let o={getBoundingClientRect:()=>s,getClientRects:()=>[s]};if(r instanceof L){let l=this.view.nodeDOM(r.from);const a=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");a&&(l=a),l&&(o={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(r instanceof ne){const{$anchorCell:l,$headCell:a}=r,c=l?l.pos:a.pos,u=a?a.pos:l.pos,d=this.view.nodeDOM(c),h=this.view.nodeDOM(u);if(!d||!h)return;const f=d===h?d.getBoundingClientRect():Z1(d.getBoundingClientRect(),h.getBoundingClientRect());o={getBoundingClientRect:()=>f,getClientRects:()=>[f]}}return o}updatePosition(){if(!this.isVisible)return;const t=this.virtualElement;t&&Zc(t,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:n,strategy:r,middlewareData:i})=>{var s,o;if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if((s=i.hide)!=null&&s.referenceHidden||(o=i.hide)!=null&&o.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),s=!e?.doc.eq(t.state.doc);this.updateHandler(t,i,s,e)}getShouldShow(t){var e;const{state:n}=this.view,{selection:r}=n,{ranges:i}=r,s=Math.min(...i.map(a=>a.$from.pos)),o=Math.max(...i.map(a=>a.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:t,from:s,to:o}))||!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.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){var e;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){const n=(e=t.options.scrollTarget)!=null?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()}},df=t=>new Z({key:typeof t.pluginKey=="string"?new oe(t.pluginKey):t.pluginKey,view:e=>
162new eS({view:e,...t})});Y.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[df({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 tS=class{constructor({editor:t,element:e,view:n,pluginKey:r="floatingMenu",updateDelay:i=250,resizeDelay:s=60,options:o,appendTo:l,shouldShow:a}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:d})=>{const{selection:h}=d,{$anchor:f,empty:p}=h,m=f.depth===1,g=f.parent.isTextblock&&!f.parent.type.spec.code&&!f.parent.textContent&&f.parent.childCount===0&&!this.getTextContent(f.parent);return!(!u.hasFocus()||!p||!m||!g||!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,h,f)=>{const{composing:p}=u;if(p||!d&&!h)return;if(!this.getShouldShow(f)){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.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)};var c;this.editor=t,this.element=e,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=s,this.appendTo=l,this.scrollTarget=(c=o?.scrollTarget)!=null?c:window,this.floatingUIOptions={...this.floatingUIOptions,...o},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())}getTextContent(t){return Fd(t,{textSerializers:ol(this.editor.schema)})}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(Wc(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(Kc(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(qc(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(Jc(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(Gc(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(Yc(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(Xc(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(Qc(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}getShouldShow(t){var e;const{state:n}=this.view,{selection:r}=n,{ranges:i}=r,s=Math.min(...i.map(a=>a.$from.pos)),o=Math.max(...i.map(a=>a.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:n,oldState:t,from:s,to:o})}updateOptions(t){var e;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){const n=(e=t.options.scrollTarget)!=null?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,e;if(!((e=(t=this.view)==null?void 0:t.dom)!=null&&e.parentNode))return;const{selection:n}=this.editor.state,r=qd(this.view,n.from,n.to);Zc({getBoundingClientRect:()=>r,getClientRects:()=>[r]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:s,y:o,strategy:l,middlewareData:a})=>{var c,u;if((c=a.hide)!=null&&c.referenceHidden||(u=a.hide)!=null&&u.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=l,this.element.style.left=`${s}px`,this.element.style.top=`${o}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.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()}},hf=t=>new Z({key:typeof t.pluginKey=="string"?new oe(t.pluginKey):t.pluginKey,view:e=>
162new tS({view:e,...t})});Y.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?[hf({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})]:[]}});var OS=Ct.forwardRef(({pluginKey:t="bubbleMenu",editor:e,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:s=null,getReferencedVirtualElement:o,options:l,children:a,...c},u)=>{const d=q.useRef(document.createElement("div"));typeof u=="function"?u(d.current):u&&(u.current=d.current);const{editor:h}=ph(),f=e||h,p={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:t,shouldShow:s,getReferencedVirtualElement:o,options:l},m=q.useRef(p);m.current=p;const[g,y]=q.useState(!1),w=q.useRef(!0);return q.useEffect(()=>{if(f?.isDestroyed)return;if(!f){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const v=d.current;v.style.visibility="hidden",v.style.position="absolute";const T=df({...m.current,editor:f,element:v});f.registerPlugin(T);const S=m.current.pluginKey;return w.current=!0,y(!0),()=>{y(!1),f.unregisterPlugin(S),window.requestAnimationFrame(()=>{v.parentNode&&v.parentNode.removeChild(v)})}},[f]),q.useEffect(()=>{if(!(!g||!f||f.isDestroyed)){if(w.current){w.current=!1;return}f.view.dispatch(f.state.tr.setMeta("bubbleMenu",{type:"updateOptions",options:m.current}))}},[g,f,n,r,s,l,i,o]),Io.createPortal($e.jsx("div",{...c,children:a}),d.current)});Ct.forwardRef(({pluginKey:t="floatingMenu",editor:e,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:s=null,options:o,children:l,...a},c)=>{const u=q.useRef(document.createElement("div"));typeof c=="function"?c(u.current):c&&(c.current=u.current);const{editor:d}=ph(),h=e||d,f={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:t,shouldShow:s,options:o},p=q.useRef(f);p.current=f;const[m,g]=q.useState(!1),y=q.useRef(!0);return q.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;w.style.visibility="hidden",w.style.position="absolute";const v=hf({...p.current,editor:h,element:w});h.registerPlugin(v);const T=p.current.pluginKey;return y.current=!0,g(!0),()=>{g(!1),h.unregisterPlugin(T),window.requestAnimationFrame(()=>{w.parentNode&&w.parentNode.removeChild(w)})}},[h]),q.useEffect(()=>{if(!(!m||!h||h.isDestroyed)){if(y.current){y.current=!1;return}h.view.dispatch(h.state.tr.setMeta("floatingMenu",{type:"updateOptions",options:p.current}))}},[m,h,n,r,s,o,i]),Io.createPortal($e.jsx("div",{...a,children:l}),u.current)});export{ow as A,OS as B,Ft as D,Y as E,j1 as H,oS as N,Z as P,yw as R,ox as T,bn as a,oe as b,aS as c,cS as d,hS as e,fS as f,uS as g,pS as h,dS as i,mS as j,gS as k,w1 as l,bS as m,wS as n,kS as o,xS as p,SS as q,vS as r,tu as s,CS as t,sS as u,MS as v,ES as w,TS as x,AS as y,lS as z};

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.